(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2152,2350],{38808:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/pools/[pool]",function(){return r(84821)}])},27325:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,r(60998).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},88507:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,r(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},28586:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,r(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},1125:function(e,t,r){"use strict";r.d(t,{C:function(){return i}});var s=r(85893),n=r(67294),a=r(34209),l=r(84283);let o=e=>{if(!e||"string"!=typeof e)return e;let t=e.split("\n"),r=[];for(let e=0;e<t.length;e++){let s=t[e];if(""===s.trim()){let n=!1,a=0;for(let r=e-1;r>=0;r--){let e=t[r],s=e.trim();if(s&&e.match(/:\s*[|>]\s*$/)){n=!0;for(let e=r+1;e<t.length;e++){let r=t[e];if(r.trim()){a=r.search(/\S/);break}}break}if(s&&0===e.search(/\S/))break}if(n)for(let n=e+1;n<t.length;n++){let e=t[n];if(e.trim()){e.search(/\S/)>=a?r.push("  #YAML_BLANK_LINE_MARKER#"):r.push(s);break}}else r.push(s)}else r.push(s)}return r.join("\n")};function i(e){let{children:t,className:r=""}=e,i=(0,n.useRef)(null),c=o(t);(0,n.useEffect)(()=>{if(i.current){let e=i.current;setTimeout(()=>{let t;let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);for(;t=r.nextNode();)t.textContent&&t.textContent.includes("#YAML_BLANK_LINE_MARKER#")&&(t.textContent=t.textContent.replace(/#YAML_BLANK_LINE_MARKER#/g,""))},0)}},[c]);let d={...l.mQ,'code[class*="language-"]':{...l.mQ['code[class*="language-"]'],whiteSpace:"pre !important"},'pre[class*="language-"]':{...l.mQ['pre[class*="language-"]'],whiteSpace:"pre !important"}};return(0,s.jsx)("div",{ref:i,className:r,children:(0,s.jsx)(a.Z,{language:"yaml",style:d,customStyle:{margin:0,padding:0,background:"transparent",fontSize:"0.875rem",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'},wrapLines:!0,wrapLongLines:!0,showLineNumbers:!1,useInlineStyles:!0,children:c})})}},99307:function(e,t,r){"use strict";r.d(t,{Cl:function(){return o},OE:function(){return d}});var s=r(85893);r(67294);var n=r(55739),a=r(36989),l=r(53850);let o=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700";case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":case"PROVISIONING":case"SHUTTING_DOWN":return(0,s.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,s.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,s.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,s.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,s.jsx)(l.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,s.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},c=e=>{let t=o(e),r=i(e);return(0,s.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[r,e]})},d=e=>{let{status:t}=e;return(0,s.jsx)(a.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,s.jsx)("span",{children:c(t)})})}},10546:function(e,t,r){"use strict";r.d(t,{Fu:function(){return c},ML:function(){return u},P2:function(){return d},cm:function(){return o},eG:function(){return i},x$:function(){return h}});var s=r(85893),n=r(67294),a=r(88950);let l=(e,t)=>{var r;let{property:s,operator:n,value:a}=t;if(!a)return!0;if(!s){let t=a.toLowerCase();return Object.values(e).some(e=>null==e?void 0:e.toString().toLowerCase().includes(t))}let l=null===(r=e[s.toLowerCase()])||void 0===r?void 0:r.toString().toLowerCase(),o=a.toString().toLowerCase();switch(n){case"=":return l===o;case":":return null==l?void 0:l.includes(o);default:return!0}},o=(e,t)=>0===t.length?e:e.filter(e=>{let r=null;for(let s=0;s<t.length;s++){let n=l(e,t[s]);r=null===r?n:r&&n}return r}),i=(e,t)=>{let r={...e.query},s=[],n=[],a=[];t.map((e,t)=>{var r;s.push(null!==(r=e.property.toLowerCase())&&void 0!==r?r:""),n.push(e.operator),a.push(e.value)}),r.property=s,r.operator=n,r.value=a,e.replace({pathname:e.pathname,query:r},void 0,{shallow:!0})},c=(e,t)=>{let r={...e.query},s=r.property,n=r.operator,a=r.value;if(void 0===s)return[];let l=[],o=Array.isArray(s)?s.length:1;if(1===o)l.push({property:t.get(s),operator:n,value:a});else for(let e=0;e<o;e++)l.push({property:t.get(s[e]),operator:n[e],value:a[e]});return l},d=(e,t,r,s)=>{if(!s)return e;let n=new URLSearchParams({property:t.toLowerCase(),operator:r,value:s});return"".concat(e,"?").concat(n.toString())},u=e=>{var t,r;let{propertyList:l=[],valueList:o,setFilters:i,updateURLParams:c,placeholder:d="Filter items"}=e,u=(0,n.useRef)(null),h=(0,n.useRef)(null),[x,m]=(0,n.useState)(!1),[f,p]=(0,n.useState)(""),[g,j]=(0,n.useState)((null===(t=l[0])||void 0===t?void 0:t.value)||"status"),[N,v]=(0,n.useState)([]);(0,n.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&u.current&&!u.current.contains(e.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,n.useEffect)(()=>{let e=[];o&&"object"==typeof o&&(e=o[g]||[]),""!==f.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(f.toLowerCase()))),v(e)},[g,o,f]);let b=e=>{let t=l.find(t=>t.value===e);return t?t.label:e},y=e=>{i(t=>{let r=[...t,{property:b(g),operator:":",value:e}];return c(r),r}),m(!1),p(""),u.current.focus()};return(0,s.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible bg-white",children:[(0,s.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,s.jsxs)(a.Ph,{onValueChange:j,value:g,children:[(0,s.jsx)(a.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm bg-white",children:(0,s.jsx)(a.ki,{placeholder:(null===(r=l[0])||void 0===r?void 0:r.label)||"Status"})}),(0,s.jsx)(a.Bw,{children:l.map((e,t)=>(0,s.jsx)(a.Ql,{value:e.value,children:e.label},"property-item-".concat(t)))})]})}),(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)("input",{type:"text",ref:u,placeholder:d,value:f,onChange:e=>{p(e.target.value),x||m(!0)},onFocus:()=>{m(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==f.trim()?(i(e=>{let t=[...e,{property:b(g),operator:":",value:f}];return c(t),t}),p(""),m(!1)):"Escape"===e.key&&(m(!1),u.current.blur())},className:"h-8 w-full px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),f&&(0,s.jsx)("button",{onClick:()=>{p(""),m(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),x&&N.length>0&&(0,s.jsx)("div",{ref:h,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:N.map((e,t)=>(0,s.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(t!==N.length-1?"border-b border-gray-100":""),onClick:()=>y(e),children:(0,s.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(t)))})]})]})},h=e=>{let{filters:t=[],setFilters:r,updateURLParams:n}=e,a=e=>{r(t=>{let r=t.filter((t,r)=>r!==e);return n(r),r})};return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[t.map((e,t)=>(0,s.jsx)(x,{filter:e,onRemove:()=>a(t)},"filteritem-".concat(t))),t.length>0&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("button",{onClick:()=>{n([]),r([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},x=e=>{let{filter:t,onRemove:r}=e;return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,s.jsx)("span",{children:"".concat(t.property," ")}),(0,s.jsx)("span",{children:"".concat(t.operator," ")}),(0,s.jsx)("span",{children:" ".concat(t.value)})]}),(0,s.jsx)("button",{onClick:()=>r(),className:"p-0.5 ml-1 transform text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex flex-col items-center",title:"Clear filter",children:(0,s.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})}},30803:function(e,t,r){"use strict";r.d(t,{z:function(){return c}});var s=r(85893),n=r(67294),a=r(88426),l=r(12003),o=r(32350);let i=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=n.forwardRef((e,t)=>{let{className:r,variant:n,size:l,asChild:c=!1,...d}=e,u=c?a.g7:"button";return(0,s.jsx)(u,{className:(0,o.cn)(i({variant:n,size:l,className:r})),ref:t,...d})});c.displayName="Button"},68764:function(e,t,r){"use strict";r.d(t,{RM:function(){return i},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return o}});var s=r(85893),n=r(67294),a=r(32350);let l=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:t,className:(0,a.cn)("w-full caption-bottom text-base",r),...n})})});l.displayName="Table";let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("thead",{ref:t,className:(0,a.cn)("[&_tr]:border-b",r),...n})});o.displayName="TableHeader";let i=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tbody",{ref:t,className:(0,a.cn)("[&_tr:last-child]:border-0",r),...n})});i.displayName="TableBody",n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tfoot",{ref:t,className:(0,a.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...n})}).displayName="TableFooter";let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tr",{ref:t,className:(0,a.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...n})});c.displayName="TableRow";let d=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("th",{ref:t,className:(0,a.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",r),...n})});d.displayName="TableHead";let u=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("td",{ref:t,className:(0,a.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...n})});u.displayName="TableCell",n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("caption",{ref:t,className:(0,a.cn)("mt-4 text-base text-muted-foreground",r),...n})}).displayName="TableCaption"},32350:function(e,t,r){"use strict";r.d(t,{cn:function(){return a}});var s=r(90512),n=r(98388);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.m6)((0,s.W)(t))}},84303:function(e,t,r){"use strict";r.d(t,{_q:function(){return a},pJ:function(){return i}});var s=r(1272);let n={lineWidth:-1,quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2},a=e=>{if(!e)return"No YAML available";try{let t=s.ZP.load(e),r=s.ZP.dump(t,n).split("\n"),a=[],l=-1;for(let e=0;e<r.length;e++){let t=r[e],s=t.search(/\S/);0===s&&l>=0&&e>0&&a.push(""),a.push(t),l=s}return a.join("\n").trim()}catch(t){return console.error("YAML formatting error:",t),e}},l=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document",o=(e,t)=>{try{let r=s.ZP.load(e),a=s.ZP.dump(r,n).split("\n"),o=[],i=-1;for(let e=0;e<a.length;e++){let t=a[e],r=t.search(/\S/);0===r&&i>=0&&e>0&&o.push(""),o.push(t),i=r}return{index:t,content:o.join("\n").trim(),preview:l(r)}}catch(r){return console.error("YAML formatting error for document ".concat(t,":"),r),{index:t,content:e,preview:"Invalid YAML"}}},i=e=>{if(!e)return[];try{let t=[],r=e.split(/^---$/m);for(let e=0;e<r.length;e++){let s=r[e].trim();s&&""!==s&&t.push(s)}return(t.length>1?t.slice(1):t).map((e,t)=>o(e,t))}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}}},84821:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return k}});var s=r(85893),n=r(67294),a=r(11163),l=r(9008),o=r.n(l),i=r(41664),c=r.n(i),d=r(55739);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let u=(0,r(60998).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var h=r(70282),x=r(27325),m=r(45895),f=r(6639),p=r(68969),g=r(6378),j=r(36989),N=r(51214),v=r(99307),b=r(84303),y=r(1125),w=r(68764),E=r(30803),L=r(10546);function k(){let e=(0,a.useRouter)(),{pool:t}=e.query,[r,l]=(0,n.useState)(null),[i,k]=(0,n.useState)(!1),[C,_]=(0,n.useState)(!0),[I,R]=(0,n.useState)(null),[A,S]=(0,n.useState)(1),[T,D]=(0,n.useState)(10),[M,P]=(0,n.useState)(!1),[O,F]=(0,n.useState)({key:null,direction:"ascending"}),[W,U]=(0,n.useState)(!1),[Y,Z]=(0,n.useState)(!1),[G,z]=(0,n.useState)(!1),B=n.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(t){e?k(!0):_(!0),R(null);try{let{pools:e=[]}=await g.default.get(p.vs,[{}])||{},r=e.find(e=>e.name===t);r?l(r):(R("Pool ".concat(t," not found")),l(null))}catch(e){console.error("Error fetching pool data:",e),R("Failed to fetch pool data: ".concat(e.message)),l(null)}finally{e?k(!1):_(!1)}}},[t,k,_,R,l]);(0,n.useEffect)(()=>{B()},[t,B]);let H=e=>{let t="ascending";O.key===e&&"ascending"===O.direction&&(t="descending"),F({key:e,direction:t})},K=e=>O.key===e?"ascending"===O.direction?" ↑":" ↓":"",V=async()=>{try{if(r&&r.pool_yaml){let e=(0,b._q)(r.pool_yaml);await navigator.clipboard.writeText(e),Z(!0),setTimeout(()=>Z(!1),2e3)}}catch(e){console.error("Failed to copy Pool YAML to clipboard:",e)}},q=async()=>{try{r&&r.entrypoint&&(await navigator.clipboard.writeText(r.entrypoint),z(!0),setTimeout(()=>z(!1),2e3))}catch(e){console.error("Failed to copy entrypoint to clipboard:",e)}},{filteredWorkers:Q,totalPages:$,paginatedWorkers:J}=(0,n.useMemo)(()=>{if(!r||!r.replica_info)return{filteredWorkers:[],totalPages:0,paginatedWorkers:[]};let e=M?r.replica_info:r.replica_info.filter(e=>!e.status||!e.status.includes("FAILED"));O.key&&(e=[...e].sort((e,t)=>{let r=e[O.key],s=t[O.key];return("launched_at"===O.key&&(r=r||0,s=s||0),"string"==typeof r&&(r=r.toLowerCase()),"string"==typeof s&&(s=s.toLowerCase()),r<s)?"ascending"===O.direction?-1:1:r>s?"ascending"===O.direction?1:-1:0}));let t=Math.ceil(e.length/T),s=(A-1)*T,n=s+T,a=e.slice(s,n);return{filteredWorkers:e,totalPages:t,paginatedWorkers:a}},[r,M,A,T,O]);return((0,n.useEffect)(()=>{S(1)},[M,O]),!e.isReady||C)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o(),{children:(0,s.jsxs)("title",{children:["Pool ",t," | SkyPilot Dashboard"]})}),(0,s.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)(d.Z,{size:32,className:"mb-3"}),(0,s.jsx)("span",{className:"text-gray-600",children:"Loading pool details..."})]})})]}):I||!r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o(),{children:(0,s.jsxs)("title",{children:["Pool ",t," | SkyPilot Dashboard"]})}),(0,s.jsx)("div",{className:"bg-white shadow rounded-lg p-6",children:(0,s.jsxs)("div",{className:"text-center text-red-600",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Error"}),(0,s.jsx)("p",{children:I||"Pool ".concat(t," not found")}),(0,s.jsx)("button",{onClick:()=>{g.default.invalidate(p.vs,[{}]),B(!0)},className:"mt-4 bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600",children:"Retry"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o(),{children:(0,s.jsxs)("title",{children:["Pool ",t," | SkyPilot Dashboard"]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,s.jsxs)("div",{className:"text-base flex items-center",children:[(0,s.jsx)(c(),{href:"/jobs",className:"text-sky-blue hover:underline",children:"Pools"}),(0,s.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,s.jsx)(c(),{href:"/jobs/pools/".concat(t),className:"text-sky-blue hover:underline",children:t})]}),(0,s.jsxs)("div",{className:"text-sm flex items-center",children:[i&&(0,s.jsxs)("div",{className:"flex items-center mr-4",children:[(0,s.jsx)(d.Z,{size:15,className:"mt-0"}),(0,s.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,s.jsxs)("button",{onClick:()=>{g.default.invalidate(p.vs,[{}]),B(!0)},disabled:i,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,s.jsx)(u,{className:"w-4 h-4 mr-1.5 ".concat(i?"animate-spin":"")}),(0,s.jsx)("span",{children:"Refresh"})]})]})]}),(0,s.jsxs)("div",{className:"w-full flex flex-col space-y-6",children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,s.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Jobs"}),(0,s.jsx)("div",{className:"text-base mt-1",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)(j.x9,{jobCounts:(0,j.sY)(r),getStatusStyle:v.Cl}),(0,s.jsx)(c(),{href:(0,L.P2)("/jobs","pool",":",t),className:"text-blue-600 hover:text-blue-800 text-xs",children:"See all jobs"})]})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Workers"}),(0,s.jsx)("div",{className:"text-base mt-1",children:(e=>{if(!e||!e.replica_info||0===e.replica_info.length)return"0 (target: 0)";let t=e.replica_info.filter(e=>"READY"===e.status).length,r=e.target_num_replicas||0;return"".concat(t," (target: ").concat(r,")")})(r)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Worker Details"}),(0,s.jsx)("div",{className:"text-base mt-1",children:(0,s.jsx)(j.Kl,{replicaInfo:r.replica_info})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Worker Resources"}),(0,s.jsx)("div",{className:"text-base mt-1",children:r.requested_resources_str||"-"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Policy"}),(0,s.jsx)("div",{className:"text-base mt-1",children:r.policy||"-"})]})]}),r.entrypoint&&(0,s.jsxs)("div",{className:"pt-4 mt-4",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),(0,s.jsx)(j.WH,{content:G?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,s.jsx)("button",{onClick:q,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:G?(0,s.jsx)(h.Z,{className:"w-4 h-4 text-green-600"}):(0,s.jsx)(x.Z,{className:"w-4 h-4"})})})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,s.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:r.entrypoint})})})]}),r.pool_yaml&&r.pool_yaml.trim()&&(0,s.jsxs)("div",{className:"pt-4 mt-4",children:[(0,s.jsxs)("div",{className:"flex items-center mb-2",children:[(0,s.jsxs)("button",{onClick:()=>{U(!W)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[W?(0,s.jsx)(m.Z,{className:"w-4 h-4 mr-1"}):(0,s.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),(0,s.jsx)("span",{className:"text-base",children:"Show Pool YAML"})]}),(0,s.jsx)(j.WH,{content:Y?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,s.jsx)("button",{onClick:V,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:Y?(0,s.jsx)(h.Z,{className:"w-4 h-4 text-green-600"}):(0,s.jsx)(x.Z,{className:"w-4 h-4"})})})]}),W&&(0,s.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(0,s.jsx)(y.C,{className:"whitespace-pre-wrap",children:(0,b._q)(r.pool_yaml)})})]})]})]})}),(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Pool Workers"}),(0,s.jsx)("div",{className:"flex items-center space-x-2",children:(0,s.jsxs)("label",{className:"flex items-center space-x-3 text-sm cursor-pointer",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{type:"checkbox",checked:M,onChange:e=>P(e.target.checked),className:"sr-only"}),(0,s.jsx)("div",{className:"w-11 h-6 rounded-full transition-colors duration-200 ease-in-out ".concat(M?"bg-blue-600":"bg-gray-300"),children:(0,s.jsx)("div",{className:"w-5 h-5 bg-white rounded-full shadow transform transition-transform duration-200 ease-in-out translate-y-0.5 ".concat(M?"translate-x-5":"translate-x-0.5")})})]}),(0,s.jsx)("span",{className:"text-gray-700",children:"Show history"})]})})]}),(0,s.jsxs)(w.iA,{children:[(0,s.jsx)(w.xD,{children:(0,s.jsxs)(w.SC,{children:[(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("replica_id"),children:["ID",K("replica_id")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("launched_at"),children:["Launched",K("launched_at")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("cloud"),children:["Infra",K("cloud")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("resources_str"),children:["Resources",K("resources_str")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("status"),children:["Status",K("status")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("version"),children:["Pool Version",K("version")]}),(0,s.jsxs)(w.ss,{className:"sortable whitespace-nowrap",onClick:()=>H("used_by"),children:["Used By",K("used_by")]})]})}),(0,s.jsx)(w.RM,{children:J.length>0?J.map((e,t)=>(0,s.jsxs)(w.SC,{children:[(0,s.jsx)(w.pj,{children:e.replica_id}),(0,s.jsx)(w.pj,{children:e.launched_at&&e.launched_at>0?(0,s.jsx)(j.Zg,{date:new Date(1e3*e.launched_at)}):"-"}),(0,s.jsx)(w.pj,{children:(()=>{try{let t=e.cloud&&""!==e.cloud.trim()&&"undefined"!==e.cloud,r=e.region&&"undefined"!==e.region&&null!==e.region&&""!==e.region.trim();if(!t&&!r)return"-";let n=t?e.cloud:"Unknown",a=r?e.region:null;if(!a)return(0,s.jsx)(c(),{href:"/infra",className:"text-blue-600 hover:underline",children:n});let l="".concat(n," (").concat(a,")"),o=N.MO.NAME_TRUNCATE_LENGTH,i=l.indexOf("(");if(-1===i)return(0,s.jsx)(c(),{href:"/infra",className:"text-blue-600 hover:underline",children:n});if(a.length<=o)return(0,s.jsxs)("span",{children:[(0,s.jsx)(c(),{href:"/infra",className:"text-blue-600 hover:underline",children:n}),(0,s.jsxs)("span",{children:[" (",a,")"]})]});let d="".concat(a.substring(0,Math.floor((o-3)/2)),"...").concat(a.substring(a.length-Math.ceil((o-3)/2)));return(0,s.jsx)(j.Md,{content:l,className:"text-sm text-muted-foreground",children:(0,s.jsxs)("span",{children:[(0,s.jsx)(c(),{href:"/infra",className:"text-blue-600 hover:underline",children:n}),(0,s.jsxs)("span",{children:[" (",d,")"]})]})})}catch(e){return"-"}})()}),(0,s.jsx)(w.pj,{children:(()=>{try{return e.resources_str}catch(e){return"Error: ".concat(e.message)}})()}),(0,s.jsx)(w.pj,{children:(0,s.jsx)(v.OE,{status:e.status})}),(0,s.jsx)(w.pj,{children:e.version||"-"}),(0,s.jsx)(w.pj,{children:e.used_by?(0,s.jsxs)(c(),{href:"/jobs/".concat(e.used_by),className:"text-blue-600 hover:text-blue-800 hover:underline",children:["Job ID: ",e.used_by]}):"-"})]},e.replica_id)):(0,s.jsx)(w.SC,{children:(0,s.jsx)(w.pj,{colSpan:7,className:"text-center py-8 text-gray-500",children:M?"No workers found in this pool":"No non-failed workers found in this pool"})})})]})]}),Q.length>0&&(0,s.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,s.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,s.jsxs)("div",{className:"relative inline-block",children:[(0,s.jsxs)("select",{value:T,onChange:e=>{D(parseInt(e.target.value,10)),S(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,s.jsx)("option",{value:5,children:"5"}),(0,s.jsx)("option",{value:10,children:"10"}),(0,s.jsx)("option",{value:20,children:"20"}),(0,s.jsx)("option",{value:50,children:"50"})]}),(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,s.jsxs)("div",{children:[(A-1)*T+1," –"," ",Math.min(A*T,Q.length)," ","of ",Q.length]}),(0,s.jsx)(E.z,{variant:"ghost",size:"icon",onClick:()=>{S(e=>Math.max(e-1,1))},disabled:1===A,className:"text-gray-500 h-8 w-8 p-0",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,s.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,s.jsx)(E.z,{variant:"ghost",size:"icon",onClick:()=>{S(e=>Math.min(e+1,$))},disabled:A===$,className:"text-gray-500 h-8 w-8 p-0",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,s.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})})]})]})]})]})}},12003:function(e,t,r){"use strict";r.d(t,{j:function(){return l}});var s=r(90512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.W,l=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:o}=t,i=Object.keys(l).map(e=>{let t=null==r?void 0:r[e],s=null==o?void 0:o[e];if(null===t)return null;let a=n(t)||n(s);return l[e][a]}),c=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,i,null==t?void 0:null===(s=t.compoundVariants)||void 0===s?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...c}[t]):({...o,...c})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}},function(e){e.O(0,[616,5739,6130,1272,6212,6989,3850,8969,2888,9774,179],function(){return e(e.s=38808)}),_N_E=e.O()}]);