skypilot-nightly 1.0.0.dev20251027__py3-none-any.whl → 1.0.0.dev20251101__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of skypilot-nightly might be problematic. Click here for more details.

Files changed (114) hide show
  1. sky/__init__.py +2 -2
  2. sky/adaptors/aws.py +25 -7
  3. sky/adaptors/coreweave.py +278 -0
  4. sky/backends/backend_utils.py +9 -6
  5. sky/backends/cloud_vm_ray_backend.py +2 -3
  6. sky/check.py +25 -13
  7. sky/client/cli/command.py +52 -24
  8. sky/cloud_stores.py +73 -0
  9. sky/clouds/aws.py +59 -11
  10. sky/core.py +7 -5
  11. sky/dashboard/out/404.html +1 -1
  12. sky/dashboard/out/_next/static/{YP5Vc3ROcDnTGta0XAhcs → 8ixeA0NVQJN8HUdijid8b}/_buildManifest.js +1 -1
  13. sky/dashboard/out/_next/static/chunks/{1141-d5204f35a3388bf4.js → 1141-c3c10e2c6ed71a8f.js} +1 -1
  14. sky/dashboard/out/_next/static/chunks/2755.d6dc6d530fed0b61.js +26 -0
  15. sky/dashboard/out/_next/static/chunks/3294.87a13fba0058865b.js +1 -0
  16. sky/dashboard/out/_next/static/chunks/{3785.538eb23a098fc304.js → 3785.170be320e0060eaf.js} +1 -1
  17. sky/dashboard/out/_next/static/chunks/4282-49b2065b7336e496.js +1 -0
  18. sky/dashboard/out/_next/static/chunks/7615-80aa7b09f45a86d2.js +1 -0
  19. sky/dashboard/out/_next/static/chunks/8969-4ed9236db997b42b.js +1 -0
  20. sky/dashboard/out/_next/static/chunks/9360.10a3aac7aad5e3aa.js +31 -0
  21. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-ac4a217f17b087cb.js +16 -0
  22. sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-fbf2907ce2bb67e2.js → [cluster]-1704039ccaf997cf.js} +1 -1
  23. sky/dashboard/out/_next/static/chunks/pages/{jobs-0dc34cf9a8710a9f.js → jobs-7eee823559e5cf9f.js} +1 -1
  24. sky/dashboard/out/_next/static/chunks/pages/{users-96d6b8bb2dec055f.js → users-2b172f13f8538a7a.js} +1 -1
  25. sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-fb1b4d3bfb047cad.js → [name]-bbfe5860c93470fd.js} +1 -1
  26. sky/dashboard/out/_next/static/chunks/pages/{workspaces-6fc994fa1ee6c6bf.js → workspaces-1891376c08050940.js} +1 -1
  27. sky/dashboard/out/_next/static/chunks/{webpack-585d805f693dbceb.js → webpack-e38d5319cd10a3a0.js} +1 -1
  28. sky/dashboard/out/_next/static/css/0748ce22df867032.css +3 -0
  29. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  30. sky/dashboard/out/clusters/[cluster].html +1 -1
  31. sky/dashboard/out/clusters.html +1 -1
  32. sky/dashboard/out/config.html +1 -1
  33. sky/dashboard/out/index.html +1 -1
  34. sky/dashboard/out/infra/[context].html +1 -1
  35. sky/dashboard/out/infra.html +1 -1
  36. sky/dashboard/out/jobs/[job].html +1 -1
  37. sky/dashboard/out/jobs/pools/[pool].html +1 -1
  38. sky/dashboard/out/jobs.html +1 -1
  39. sky/dashboard/out/users.html +1 -1
  40. sky/dashboard/out/volumes.html +1 -1
  41. sky/dashboard/out/workspace/new.html +1 -1
  42. sky/dashboard/out/workspaces/[name].html +1 -1
  43. sky/dashboard/out/workspaces.html +1 -1
  44. sky/data/data_utils.py +92 -1
  45. sky/data/mounting_utils.py +71 -2
  46. sky/data/storage.py +166 -9
  47. sky/global_user_state.py +14 -18
  48. sky/jobs/constants.py +2 -0
  49. sky/jobs/controller.py +62 -67
  50. sky/jobs/file_content_utils.py +80 -0
  51. sky/jobs/log_gc.py +201 -0
  52. sky/jobs/scheduler.py +15 -2
  53. sky/jobs/server/core.py +85 -13
  54. sky/jobs/server/server.py +14 -13
  55. sky/jobs/server/utils.py +28 -10
  56. sky/jobs/state.py +216 -40
  57. sky/jobs/utils.py +65 -28
  58. sky/metrics/utils.py +18 -0
  59. sky/optimizer.py +1 -1
  60. sky/provision/kubernetes/instance.py +88 -19
  61. sky/provision/kubernetes/volume.py +2 -2
  62. sky/schemas/api/responses.py +3 -5
  63. sky/schemas/db/spot_jobs/004_job_file_contents.py +42 -0
  64. sky/schemas/db/spot_jobs/005_logs_gc.py +38 -0
  65. sky/schemas/generated/managed_jobsv1_pb2.py +39 -35
  66. sky/schemas/generated/managed_jobsv1_pb2.pyi +21 -5
  67. sky/serve/replica_managers.py +2 -2
  68. sky/serve/serve_utils.py +9 -2
  69. sky/serve/server/server.py +8 -7
  70. sky/server/common.py +21 -15
  71. sky/server/constants.py +1 -1
  72. sky/server/daemons.py +23 -17
  73. sky/server/requests/executor.py +7 -3
  74. sky/server/requests/payloads.py +2 -0
  75. sky/server/requests/request_names.py +80 -0
  76. sky/server/requests/requests.py +137 -102
  77. sky/server/requests/serializers/decoders.py +0 -6
  78. sky/server/requests/serializers/encoders.py +33 -6
  79. sky/server/server.py +105 -36
  80. sky/server/stream_utils.py +56 -13
  81. sky/setup_files/dependencies.py +2 -0
  82. sky/skylet/constants.py +6 -1
  83. sky/skylet/events.py +7 -0
  84. sky/skylet/services.py +18 -7
  85. sky/ssh_node_pools/server.py +5 -4
  86. sky/task.py +14 -42
  87. sky/templates/kubernetes-ray.yml.j2 +1 -1
  88. sky/templates/nebius-ray.yml.j2 +1 -0
  89. sky/templates/websocket_proxy.py +140 -12
  90. sky/users/permission.py +4 -1
  91. sky/utils/cli_utils/status_utils.py +8 -2
  92. sky/utils/context_utils.py +13 -1
  93. sky/utils/db/migration_utils.py +1 -1
  94. sky/utils/resource_checker.py +4 -1
  95. sky/utils/resources_utils.py +53 -29
  96. sky/utils/schemas.py +23 -4
  97. sky/volumes/server/server.py +4 -3
  98. sky/workspaces/server.py +7 -6
  99. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/METADATA +53 -37
  100. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/RECORD +106 -100
  101. sky/dashboard/out/_next/static/chunks/2755.227c84f5adf75c6b.js +0 -26
  102. sky/dashboard/out/_next/static/chunks/3015-2dcace420c8939f4.js +0 -1
  103. sky/dashboard/out/_next/static/chunks/3294.6d5054a953a818cb.js +0 -1
  104. sky/dashboard/out/_next/static/chunks/4282-d2f3ef2fbf78e347.js +0 -1
  105. sky/dashboard/out/_next/static/chunks/8969-0389e2cb52412db3.js +0 -1
  106. sky/dashboard/out/_next/static/chunks/9360.07d78b8552bc9d17.js +0 -31
  107. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-c815b90e296b8075.js +0 -16
  108. sky/dashboard/out/_next/static/css/4c052b4444e52a58.css +0 -3
  109. /sky/dashboard/out/_next/static/{YP5Vc3ROcDnTGta0XAhcs → 8ixeA0NVQJN8HUdijid8b}/_ssgManifest.js +0 -0
  110. /sky/dashboard/out/_next/static/chunks/pages/{_app-513d332313670f2a.js → _app-bde01e4a2beec258.js} +0 -0
  111. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/WHEEL +0 -0
  112. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/entry_points.txt +0 -0
  113. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/licenses/LICENSE +0 -0
  114. {skypilot_nightly-1.0.0.dev20251027.dist-info → skypilot_nightly-1.0.0.dev20251101.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3294],{53294:function(e,s,t){t.r(s),t.d(s,{ContextDetails:function(){return F},GPUs:function(){return H},InfrastructureSection:function(){return D}});var a=t(85893),l=t(67294),r=t(55739);t(9353);var n=t(26409),o=t(98418),i=t(13626),c=t(23001),d=t(17853),m=t(32045),u=t(23266),x=t(68969),h=t(29326),g=t(50326),p=t(30803),f=t(42557),y=t(36185),j=t(69123);function b(e){let{isOpen:s,onClose:t,onSave:n,poolData:o=null,isLoading:i=!1}=e,[c,d]=(0,l.useState)(""),[m,u]=(0,l.useState)(""),[x,b]=(0,l.useState)("ubuntu"),[N,v]=(0,l.useState)(null),[w,S]=(0,l.useState)(""),[_,C]=(0,l.useState)({}),k=null!==o;(0,l.useEffect)(()=>{if(k&&o){var e,s,t;d(o.name||""),u(((null===(e=o.config)||void 0===e?void 0:e.hosts)||[]).join("\n")),b((null===(s=o.config)||void 0===s?void 0:s.user)||"ubuntu"),S((null===(t=o.config)||void 0===t?void 0:t.password)||"")}else d(""),u(""),b("ubuntu"),v(null),S("");C({})},[k,o]);let P=()=>{let e={};return c.trim()||(e.poolName="Pool name is required"),m.trim()||(e.hosts="At least one host is required"),x.trim()||(e.sshUser="SSH user is required"),N||w||(e.auth="Either SSH key file or password is required"),C(e),0===Object.keys(e).length},U=async()=>{if(!P())return;let e={hosts:m.split("\n").map(e=>e.trim()).filter(e=>e.length>0),user:x};try{if(N){let s=N.name;await (0,h.hY)(s,N),e.identity_file="~/.sky/ssh_keys/".concat(s)}w&&(e.password=w),n(c,e)}catch(e){console.error("Failed to upload SSH key:",e),C({..._,keyUpload:"Failed to upload SSH key"})}},I=()=>{i||t()};return(0,a.jsx)(g.Vq,{open:s,onOpenChange:I,children:(0,a.jsxs)(g.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,a.jsx)(g.fK,{children:(0,a.jsx)(g.$N,{children:k?"Edit SSH Node Pool: ".concat(null==o?void 0:o.name):"Add SSH Node Pool"})}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"poolName",children:"Pool Name"}),(0,a.jsx)(f.I,{id:"poolName",placeholder:"my-ssh-cluster",value:c,onChange:e=>d(e.target.value),disabled:k,className:"placeholder:text-gray-500 ".concat(_.poolName?"border-red-500":"")}),_.poolName&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:_.poolName})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"hosts",children:"Hosts (one per line)"}),(0,a.jsx)(j.g,{id:"hosts",placeholder:"192.168.1.10\n192.168.1.11\nhostname.example.com",value:m,onChange:e=>u(e.target.value),rows:6,className:"placeholder:text-gray-500 ".concat(_.hosts?"border-red-500":"")}),_.hosts&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:_.hosts})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"sshUser",children:"SSH User"}),(0,a.jsx)(f.I,{id:"sshUser",placeholder:"ubuntu",value:x,onChange:e=>b(e.target.value),className:"placeholder:text-gray-500 ".concat(_.sshUser?"border-red-500":"")}),_.sshUser&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:_.sshUser})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"keyFile",children:"SSH Private Key File"}),(0,a.jsx)(f.I,{id:"keyFile",type:"file",accept:".pem,.key,id_rsa,id_ed25519",onChange:e=>{var s;return v((null===(s=e.target.files)||void 0===s?void 0:s[0])||null)},className:"border-0 bg-transparent p-0 shadow-none focus:ring-0 file:mr-2 file:text-sm file:py-1 file:px-3 file:border file:border-gray-300 file:rounded file:bg-gray-50 hover:file:bg-gray-100 file:cursor-pointer"}),_.keyUpload&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:_.keyUpload})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"password",children:"Password (optional, if sudo requires a password)"}),(0,a.jsx)(f.I,{id:"password",type:"password",placeholder:"Leave empty if using passwordless sudo",value:w,onChange:e=>S(e.target.value),className:"placeholder:text-gray-500"})]}),_.auth&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:_.auth})]}),(0,a.jsxs)(g.cN,{children:[(0,a.jsx)(p.z,{variant:"outline",onClick:I,disabled:i,children:"Cancel"}),(0,a.jsx)(p.z,{onClick:U,disabled:i,className:"bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Saving..."]}):k?"Update Pool":"Create Pool"})]})]})})}var N=t(6378),v=t(36856),w=t(51214),S=t(11163),_=t(41664),C=t.n(_),k=t(36989);t(37673);var P=t(88950);let U=w.nb.REFRESH_INTERVAL,I=w.MO.NAME_TRUNCATE_LENGTH;function D(e){let{title:s,isLoading:t,isDataLoaded:l,contexts:n,gpus:o,groupedPerContextGPUs:i,groupedPerNodeGPUs:c,handleContextClick:d,contextStats:m={},jobsData:u={},isJobsDataLoading:x=!0,isSSH:h=!1,actionButton:g=null,contextWorkspaceMap:p={}}=e,f=n||[];return t&&0===f.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:s}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",s,"..."]})]})]})}):l&&0===f.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),g]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",s," found or ",s," is not configured."]})]})}):f.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[f.length," ",1===f.length?h?"pool":"context":h?"pools":"contexts"]})]}),g]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:h?"Node Pool":"Context"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(f.length>5?"max-h-[250px] overflow-y-auto block":""),children:f.map(e=>{var s,t;let n=i[e]||[],o=c[e]||[],g=n.reduce((e,s)=>e+(s.gpu_total||0),0),f=h?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e),y=m[f]||{clusters:0,jobs:0},j=Object.keys(m).length>0&&m[f]||l,b=i&&Object.keys(i).length>0||l,N=c&&Object.keys(c).length>0||l,v=b?Object.keys(n.reduce((e,s)=>(e[s.gpu_name]=(e[s.gpu_name]||0)+(s.gpu_total||0),e),{})).join(", "):null,w=h?e.replace(/^ssh-/,""):e,S=p[e]||[],_=S.length>0?" (".concat(S.join(", "),")"):"";return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(k.Md,{content:"".concat(w).concat(_),className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>d(e),children:[w.length>I?"".concat(w.substring(0,Math.floor((I-3)/2)),"...").concat(w.substring(w.length-Math.ceil((I-3)/2))):w,_&&(0,a.jsx)("span",{className:"text-xs text-gray-500 ml-1",children:_})]})})}),(0,a.jsx)("td",{className:"p-3",children:j?y.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:y.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:12})})}),(0,a.jsx)("td",{className:"p-3",children:x?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(0,a.jsx)(r.Z,{size:12})}):(null===(s=u[f])||void 0===s?void 0:s.jobs)?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:null===(t=u[f])||void 0===t?void 0:t.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:N?(0,a.jsx)("span",{className:0===o.length?"text-gray-400":"",title:0===o.length?"Context may be unavailable or timed out":"",children:0===o.length?"0*":o.length}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:b?v||"-":(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:b?g:(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})})]},e)})})]})})}),o&&o.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[o.reduce((e,s)=>e+s.gpu_free,0)," ","of"," ",o.reduce((e,s)=>e+s.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(o.length>5?"max-h-[250px] overflow-y-auto block":""),children:o.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/e.gpu_total*100:0,r=i?Object.values(i).flat().filter(s=>s.gpu_name===e.gpu_name&&(h?s.context.startsWith("ssh-"):!s.context.startsWith("ssh-"))).map(e=>e.gpu_requestable_qty_per_node).filter((e,s,t)=>t.indexOf(e)===s).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:e.gpu_name}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[r||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"flex-1 bg-gray-100 rounded-md h-5 flex overflow-hidden shadow-sm min-w-[100px] w-full",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs font-medium",children:l>15&&"".concat(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs font-medium",children:t>15&&"".concat(e.gpu_free," free")})]})})})]},e.gpu_name)})})]})})})]})]})}):null}function F(e){let{contextName:s,gpusInContext:t,nodesInContext:n}=e,o=s.startsWith("ssh-"),[i,c]=(0,l.useState)([]),[m,u]=(0,l.useState)("$__all"),[x,h]=(0,l.useState)({from:"now-1h",to:"now"}),[g,p]=(0,l.useState)(!1),[f,y]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{y(await (0,d.TO)())})()},[]);let j=(0,l.useCallback)(async()=>{if(f){p(!0);try{let e=(0,d.ki)(),t="in-cluster"===s?"^$":s,a="query="+encodeURIComponent('group by (node) (DCGM_FI_DEV_GPU_TEMP{cluster=~"'.concat(t,'"} or label_replace(amd_gpu_gfx_activity{cluster=~"').concat(t,'"}, "node", "$1", "hostname", "(.*)"))')),l="/api/datasources/proxy/1/api/v1/query?".concat(a);try{let s=await fetch("".concat(e).concat(l),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(s.ok){let e=await s.json();if(e.data&&e.data.result&&e.data.result.length>0){let s=e.data.result.map(e=>e.metric.node).filter(Boolean).sort();c(s),console.log("Successfully fetched hosts for cluster ".concat(t||"in-cluster",":"),s)}else console.log("No nodes found for this cluster"),c([])}else console.log("HTTP ".concat(s.status," from ").concat(l,": ").concat(s.statusText)),c([])}catch(e){console.log("Failed to fetch from ".concat(l,":"),e),c([])}}catch(e){console.error("Error fetching available hosts:",e),c([])}finally{p(!1)}}},[f,s]);(0,l.useEffect)(()=>{f&&n&&n.length>0&&j()},[n,f,j]);let b=e=>{let t=(0,d.ki)(),a="in-cluster"===s?"^$":s;return"".concat(t,"/d-solo/skypilot-dcgm-cluster-dashboard/skypilot-dcgm-kubernetes-cluster-dashboard?orgId=1&timezone=browser&var-datasource=prometheus&var-host=").concat(encodeURIComponent(m),"&var-gpu=$__all&var-cluster=").concat(encodeURIComponent(a),"&refresh=5s&theme=light&from=").concat(encodeURIComponent(x.from),"&to=").concat(encodeURIComponent(x.to),"&panelId=").concat(e,"&__feature.dashboardSceneSolo")},N=e=>{h({"15m":{from:"now-15m",to:"now"},"1h":{from:"now-1h",to:"now"},"6h":{from:"now-6h",to:"now"},"24h":{from:"now-24h",to:"now"},"7d":{from:"now-7d",to:"now"}}[e])};return(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h4",{className:"text-lg font-semibold",children:"Available GPUs"})}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:t.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/e.gpu_total*100:0;return(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[e.gpu_name,(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsxs)("div",{className:"w-full bg-gray-100 rounded-md h-4 flex overflow-hidden shadow-sm",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs",children:l>15&&"".concat(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs",children:t>15&&"".concat(e.gpu_free," free")})]})]},e.gpu_name)})}),n&&n.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"IP Address"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:n.map((e,s)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.ip_address||"-"}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(s)))})]})})]}),f&&t&&t.length>0&&!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4 mt-6",children:"GPU Metrics"}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[n&&n.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"host-select",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Node:"}),(0,a.jsxs)("select",{id:"host-select",value:m,onChange:e=>{u(e.target.value)},disabled:g,className:"px-3 py-1 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-sky-blue focus:border-transparent",children:[(0,a.jsx)("option",{value:"$__all",children:"All Nodes"}),i.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),g&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(r.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>N(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(x.from==="now-".concat(e.value)&&"now"===x.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})]}),(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-500",children:n&&n.length>0?(0,a.jsxs)(a.Fragment,{children:["Showing:"," ","$__all"===m?"All nodes":m," ","• Time: ",x.from," to ",x.to,i.length>0&&(0,a.jsxs)("span",{children:[" ","• ",i.length," nodes available"]})]}):(0,a.jsxs)(a.Fragment,{children:["Cluster:"," ",o?s.replace(/^ssh-/,""):s," ","• Time: ",x.from," to ",x.to," • Showing metrics for all nodes in cluster"]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("6"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(m,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("18"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory",className:"rounded"},"gpu-memory-".concat(m,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("10"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Consumption",className:"rounded"},"gpu-power-".concat(m,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("12"),width:"100%",height:"400",frameBorder:"0",title:"GPU Temperature",className:"rounded"},"gpu-temp-".concat(m,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("22"),width:"100%",height:"400",frameBorder:"0",title:"CPU Utilization",className:"rounded"},"cpu-util-".concat(m,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("21"),width:"100%",height:"400",frameBorder:"0",title:"Memory Utilization",className:"rounded"},"memory-util-".concat(m,"-").concat(x.from,"-").concat(x.to))})})]})]})]})})})}function E(e){var s;let{poolName:t,gpusInContext:i,nodesInContext:c,handleDeploySSHPool:d,handleEditSSHPool:m,handleDeleteSSHPool:u,poolConfig:x}=e,[f,y]=(0,l.useState)(null),[j,b]=(0,l.useState)(!0),[N,v]=(0,l.useState)({isOpen:!1,action:null,loading:!1}),[w,S]=(0,l.useState)({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});(0,l.useEffect)(()=>{(async()=>{try{b(!0);let e=await (0,h.IS)(t);y(e)}catch(e){console.error("Failed to fetch SSH Node Pool status:",e),y({pool_name:t,status:"Error",reason:"Failed to fetch status"})}finally{b(!1)}})()},[t]);let{deployDisabled:_}=(()=>{if(!f)return{deployDisabled:!0};let e=f.status;return"Ready"===e?{deployDisabled:!0}:"Error"===e?{deployDisabled:!0}:{deployDisabled:!1}})(),C=async()=>{v({...N,loading:!0});try{if("deploy"===N.action){v({isOpen:!1,action:null,loading:!1}),S({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await d(t)).request_id;S(s=>({...s,requestId:e}));let s=new AbortController;await (0,h.wJ)({requestId:e,signal:s.signal,onNewLog:e=>{S(s=>({...s,logs:s.logs+e}))}}),S(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0})),setTimeout(async()=>{(async()=>{try{let e=await (0,h.IS)(t);y(e)}catch(e){console.error("Failed to fetch SSH Node Pool status after deployment:",e)}})()},1e3)}catch(e){console.error("Deployment failed:",e),S(s=>({...s,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:s.logs+"\nDeployment failed: ".concat(e.message)}))}}else if("delete"===N.action){v({isOpen:!1,action:null,loading:!1}),S({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await (0,h.ez)(t)).request_id;S(s=>({...s,requestId:e})),e&&await (0,h.mF)({requestId:e,signal:null,onNewLog:e=>{S(s=>({...s,logs:s.logs+e}))},operationType:"down"}),await u(t),S(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0,logs:e.logs+"\nSSH Node Pool teardown completed successfully."}))}catch(e){console.error("Down operation failed:",e),S(s=>({...s,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:s.logs+"\nTeardown failed: ".concat(e.message)}))}}}catch(e){console.error("Action failed:",e),v({...N,loading:!1})}},k=()=>{v({isOpen:!1,action:null,loading:!1})},P=()=>{S({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null}),w.deploymentComplete&&setTimeout(()=>{(async()=>{try{let e=await (0,h.IS)(t);y(e)}catch(e){console.error("Failed to refresh status:",e)}})()},1e3)},U="deploy"===N.action?{title:"Deploy SSH Node Pool",description:'Are you sure you want to deploy SSH Node Pool "'.concat(t,'"?'),details:["• Set up SkyPilot runtime on the configured SSH hosts","• Install required components and dependencies","• Make the node pool available for workloads","","This process may take a few minutes to complete."]}:{title:"Delete SSH Node Pool",description:'Are you sure you want to delete SSH Node Pool "'.concat(t,'"?'),details:["• Clean up any deployed resources","• Remove the SSH Node Pool configuration"]};return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"SSH Node Pool Details"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border rounded flex items-center ".concat(_?"border-gray-300 bg-gray-100 text-gray-400 cursor-not-allowed":"border-green-300 bg-green-50 text-green-700 hover:bg-green-100"),onClick:_?void 0:()=>{v({isOpen:!0,action:"deploy",loading:!1})},disabled:_,children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 mr-2"}),"Deploy"]}),(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 flex items-center text-red-600 hover:text-red-700",onClick:()=>{v({isOpen:!0,action:"delete",loading:!1})},children:[(0,a.jsx)(o.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:t})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Nodes"}),(0,a.jsx)("div",{className:"text-base mt-1",children:c?c.length:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:j?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):f?(0,a.jsx)(e=>{let{status:s,reason:t}=e,l="Ready"===s,r="Not Ready"===s?"Click Deploy to set up this node pool":t;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(l?"bg-green-100":"bg-red-100"," ").concat(l?"text-green-800":"text-red-800"),children:s}),!l&&r&&(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:["(",r,")"]})]})},{status:f.status,reason:f.reason}):(0,a.jsx)("span",{className:"text-gray-500",children:"Unknown"})})]})]})})]})}),(0,a.jsx)(F,{contextName:"ssh-".concat(t),gpusInContext:i,nodesInContext:c}),(0,a.jsx)(g.Vq,{open:N.isOpen,onOpenChange:k,children:(0,a.jsxs)(g.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(g.fK,{className:"",children:[(0,a.jsx)(g.$N,{className:"",children:U.title}),(0,a.jsx)(g.Be,{className:"",children:U.description})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"This will:"}),U.details.map((e,s)=>(0,a.jsx)("p",{className:""===e?"pt-2":"",children:e},s))]})}),(0,a.jsxs)(g.cN,{className:"",children:[(0,a.jsx)(p.z,{variant:"outline",onClick:k,disabled:N.loading,className:"",children:"Cancel"}),(0,a.jsx)(p.z,{onClick:C,disabled:N.loading,className:"deploy"===N.action?"bg-green-600 hover:bg-green-700 text-white":"bg-red-600 hover:bg-red-700 text-white",children:N.loading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"deploy"===N.action?"Deploying...":"Deleting..."]}):"deploy"===N.action?"Deploy":"Delete"})]})]})}),(0,a.jsx)(g.Vq,{open:w.isOpen,onOpenChange:w.isStreaming?void 0:P,children:(0,a.jsxs)(g.cZ,{className:"sm:max-w-4xl max-h-[80vh]",children:[(0,a.jsxs)(g.fK,{className:"",children:[(0,a.jsxs)(g.$N,{className:"",children:["Deploying SSH Node Pool: ",t]}),(0,a.jsx)(g.Be,{className:"",children:w.isStreaming?"Deployment in progress. Do not close this dialog.":w.deploymentSuccess?"Deployment completed successfully!":"Deployment completed with errors."})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm max-h-96 overflow-y-auto",children:[(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:(s=w.logs)?s.split("\n").map(e=>(e=e.replace(/\x1b\[[0-9;]*m/g,"")).match(/^D \d{2}-\d{2} \d{2}:\d{2}:\d{2}/)?null:e=(e=e.replace(/├──/g,"├─")).replace(/└──/g,"└─")).filter(e=>null!==e&&""!==e.trim()).join("\n"):""}),w.isStreaming&&(0,a.jsxs)("div",{className:"flex items-center mt-2",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2 text-green-400"}),(0,a.jsx)("span",{className:"text-green-400",children:"Streaming logs..."})]})]})}),(0,a.jsx)(g.cN,{className:"",children:(0,a.jsx)(p.z,{onClick:P,disabled:w.isStreaming,className:w.deploymentSuccess?"bg-green-600 hover:bg-green-700 text-white":w.deploymentComplete&&!w.deploymentSuccess?"bg-red-600 hover:bg-red-700 text-white":"bg-gray-600 hover:bg-gray-700 text-white",children:w.isStreaming?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Deploying..."]}):"Close"})})]})})]})}function H(){let[e,s]=(0,l.useState)(!0),[t,n]=(0,l.useState)(!0),[o,d]=(0,l.useState)(!0),g=l.useRef(null),p=(0,c.X)(),[f,y]=(0,l.useState)(!1),[j,w]=(0,l.useState)(!1),_=(0,S.useRouter)(),[k,I]=(0,l.useState)([]),[H,A]=(0,l.useState)([]),[z,R]=(0,l.useState)([]),[q,O]=(0,l.useState)([]),[M,Z]=(0,l.useState)([]),[G,L]=(0,l.useState)(0),[T,W]=(0,l.useState)(0),[B,K]=(0,l.useState)({}),[$,J]=(0,l.useState)({}),[V,X]=(0,l.useState)({}),[Q,Y]=(0,l.useState)("all"),[ee,es]=(0,l.useState)([]),[et,ea]=(0,l.useState)({}),[el,er]=(0,l.useState)(!1),[en,eo]=(0,l.useState)(null),[ei,ec]=(0,l.useState)(!1),[ed,em]=(0,l.useState)(!0),[eu,ex]=(0,l.useState)({}),[eh,eg]=(0,l.useState)(null),ep=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0},{showLoadingIndicators:t=!0,forceRefresh:a=!1}=e;t&&(s(!0),n(!0),ec(!0),em(!0));try{async function l(e){await ef(e),await eb(e)}await Promise.all([l(a),ej(a),ey(a)])}catch(e){console.error("Error in fetchData:",e),X({}),I([]),A([]),R([]),O([]),K({}),J({}),es([]),y(!0),s(!1),Z([]),L(0),W(0),w(!0),ea({}),ec(!1),ex({}),em(!1)}finally{t&&(s(!1),n(!1),ec(!1),em(!1)),o&&t&&d(!1)}},[o]),ef=async e=>{try{let t=e?await (0,m.Xg)():await N.default.get(m.Xg);if(t){let{workspaces:e,allContextNames:a,allGPUs:l,perContextGPUs:r,perNodeGPUs:n,contextStats:o,contextWorkspaceMap:i}=t;X(e||{}),I(a||[]),A(l||[]),R(r||[]),O(n||[]),K(o||{}),J(i||{});let c=Object.keys(e||{});es(c.sort()),y(!0),s(!1)}else null===t&&(X({}),I([]),A([]),R([]),O([]),K({}),J({}),es([]),y(!0),s(!1))}catch(e){console.error("Error in fetchKubernetesData:",e),X({}),I([]),A([]),R([]),O([]),K({}),J({}),es([]),y(!0),s(!1)}},ey=async e=>{try{let s=e?await (0,x.getManagedJobs)({allUsers:!0,skipFinished:!0,fields:["cloud","region"]}):await N.default.get(x.getManagedJobs,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}]),t=(null==s?void 0:s.jobs)||[];ex(await (0,m.R8)(t)),em(!1)}catch(e){console.error("Error in fetchManagedJobsData:",e),ex({}),em(!1)}},ej=async e=>{try{let s=e?await (0,m.ef)():await N.default.get(m.ef,[e]);s?(Z(s.clouds||[]),L(s.totalClouds||0),W(s.enabledClouds||0),w(!0)):null===s&&(Z([]),L(0),W(0),w(!0))}catch(e){console.error("Error in fetchCloudData:",e),Z([]),L(0),W(0),w(!0)}},eb=async e=>{try{let s=e?await (0,h.It)():await N.default.get(h.It);ea(s),ec(!1)}catch(e){console.error("Failed to fetch SSH Node Pools:",e),ea({}),ec(!1)}},eN=(e,s)=>{eo({name:e,config:s}),er(!0)},ev=async e=>{try{await (0,h.MV)(e),await eb(),eg(null),_.push("/infra")}catch(e){throw console.error("Failed to delete SSH Node Pool:",e),e}},ew=async e=>{try{await (0,h._x)(e)}catch(e){throw console.error("Failed to deploy SSH Node Pool:",e),e}},eS=async(e,s)=>{ec(!0);try{let t={...et};t[e]=s,await (0,h.Ri)(t),await eb(),er(!1)}catch(e){console.error("Failed to save SSH Node Pool:",e),alert("Failed to save SSH Node Pool. Please try again.")}finally{ec(!1)}};(0,l.useEffect)(()=>{g.current=ep},[ep]),(0,l.useEffect)(()=>{(async()=>{await v.ZP.preloadForPage("infra"),ep({showLoadingIndicators:!0})})()},[]),(0,l.useEffect)(()=>{let e=!0,s=setInterval(()=>{e&&g.current&&"visible"===window.document.visibilityState&&g.current({showLoadingIndicators:!1})},U);return()=>{e=!1,clearInterval(s)}},[]),(0,l.useEffect)(()=>()=>{y(!1),w(!1),ec(!1),d(!0),em(!1)},[]);let e_=()=>{N.default.invalidate(u.getClusters),N.default.invalidate(x.getManagedJobs,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}]),N.default.invalidate(m.Xg),N.default.invalidate(m.ef,[!1]),N.default.invalidate(h.It),g.current&&g.current({showLoadingIndicators:!0,forceRefresh:!0})};(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),e_())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]),(H||[]).length,(H||[]).reduce((e,s)=>e+s.gpu_total,0),(H||[]).reduce((e,s)=>e+s.gpu_free,0);let eC=l.useMemo(()=>z?z.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[z]),ek=l.useCallback(e=>"all"===Q?e:e.filter(e=>($[e]||[]).includes(Q)),[Q,$]),eP=l.useMemo(()=>k&&Array.isArray(k)?ek(k.filter(e=>e.startsWith("ssh-"))):[],[k,ek]),eU=l.useMemo(()=>k&&Array.isArray(k)?ek(k.filter(e=>!e.startsWith("ssh-"))):[],[k,ek]),eI=l.useMemo(()=>{if(!z||!H)return[];let e=new Set;return z.forEach(s=>{s.context.startsWith("ssh-")&&e.add(s.gpu_name)}),H.filter(s=>e.has(s.gpu_name))},[H,z]),eD=l.useMemo(()=>{if(!z||!H)return[];let e=new Set;return z.forEach(s=>{s.context.startsWith("ssh-")||e.add(s.gpu_name)}),H.filter(s=>e.has(s.gpu_name))},[H,z]),eF=l.useMemo(()=>q?q.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[q]);(0,l.useEffect)(()=>{_.isReady&&_.query.context&&eg(decodeURIComponent(Array.isArray(_.query.context)?_.query.context[0]:_.query.context))},[_.isReady,_.query.context]);let eE=e=>{eg(e);let s="/infra/".concat(encodeURIComponent(e));_.asPath!==s&&_.push(s)},eH=s=>{let t=eC[s]||[],l=eF[s]||[];if(e&&!f)return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]});if(s.startsWith("ssh-")){let e=s.replace(/^ssh-/,"");return(0,a.jsx)(E,{poolName:e,gpusInContext:t,nodesInContext:l,handleDeploySSHPool:ew,handleEditSSHPool:eN,handleDeleteSSHPool:ev,poolConfig:et[e]})}return(0,a.jsx)(F,{contextName:s,gpusInContext:t,nodesInContext:l})},eA=()=>t&&(!M||0===M.length)?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[T," of ",G," enabled"]})]}),M&&0!==M.length?(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:M.map(e=>{let s=j&&void 0!==e.clusters&&void 0!==e.jobs;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 font-medium text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"p-3",children:s?e.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:s?e.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})})]},e.name)})})]})}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No enabled clouds available."})]})}),ez=()=>(0,a.jsx)(D,{title:"SSH Node Pool",isLoading:e,isDataLoaded:f,contexts:eP,gpus:eI,groupedPerContextGPUs:eC,groupedPerNodeGPUs:eF,handleContextClick:eE,contextStats:B,jobsData:eu,isJobsDataLoading:ed,isSSH:!0,contextWorkspaceMap:$,actionButton:null}),eR=()=>(0,a.jsx)(D,{title:"Kubernetes",isLoading:e,isDataLoaded:f,contexts:eU,gpus:eD,groupedPerContextGPUs:eC,groupedPerNodeGPUs:eF,handleContextClick:eE,contextStats:B,jobsData:eu,isJobsDataLoading:ed,isSSH:!1,contextWorkspaceMap:$}),eq=e||t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(C(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(eh?"":"cursor-default"),children:"Infrastructure"}),eh&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),eh.startsWith("ssh-")?(0,a.jsx)(C(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(C(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:eh.startsWith("ssh-")?eh.replace(/^ssh-/,""):eh})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[ee.length>0&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 mr-2",children:"Workspace:"}),(0,a.jsxs)(P.Ph,{value:Q,onValueChange:Y,children:[(0,a.jsx)(P.i4,{className:"w-40 h-8 text-sm",children:(0,a.jsx)(P.ki,{})}),(0,a.jsxs)(P.Bw,{children:[(0,a.jsx)(P.Ql,{value:"all",children:"All Workspaces"}),ee.map(e=>(0,a.jsx)(P.Ql,{value:e,children:e},e))]})]})]}),eq&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(r.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsxs)("button",{onClick:e_,disabled:eq,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 mr-1.5"}),!p&&"Refresh"]})]})]}),(()=>{if(eh)return e&&!f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):eH(eh);let s=[];s.push({name:"Kubernetes",render:eR,hasActivity:eU.length>0,priority:1}),s.push({name:"Cloud",render:eA,hasActivity:T>0,priority:2}),s.push({name:"SSH Node Pool",render:ez,hasActivity:eP.length>0&&function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.some(e=>{let t=B[s?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0};return t.clusters>0||t.jobs>0})}(eP,!0),priority:3});let t=s.sort((e,s)=>e.hasActivity!==s.hasActivity?e.hasActivity?-1:1:e.priority-s.priority);return(0,a.jsx)(a.Fragment,{children:t.map((e,s)=>(0,a.jsx)(l.Fragment,{children:e.render()},s))})})(),(0,a.jsx)(b,{isOpen:el,onClose:()=>er(!1),onSave:eS,poolData:en,isLoading:ei})]})}},42557:function(e,s,t){t.d(s,{I:function(){return n}});var a=t(85893),l=t(67294),r=t(32350);let n=l.forwardRef((e,s)=>{let{className:t,type:l,...n}=e;return(0,a.jsx)("input",{type:l,className:(0,r.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...n})});n.displayName="Input"},36185:function(e,s,t){t.d(s,{_:function(){return c}});var a=t(85893),l=t(67294),r=t(49102),n=t(12003),o=t(32350);let i=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(r.f,{ref:s,className:(0,o.cn)(i(),t),...l})});c.displayName=r.f.displayName},69123:function(e,s,t){t.d(s,{g:function(){return n}});var a=t(85893),l=t(67294),r=t(32350);let n=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...l})});n.displayName="Textarea"},17853:function(e,s,t){t.d(s,{TO:function(){return r},ki:function(){return n}});let a=null,l=null,r=async()=>null!==a?a:l||(l=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),s=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==s.status}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{l=null}})()),n=()=>"".concat(window.location.origin,"/grafana")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785],{42557:function(e,s,r){r.d(s,{I:function(){return l}});var t=r(85893),a=r(67294),n=r(32350);let l=a.forwardRef((e,s)=>{let{className:r,type:a,...l}=e;return(0,t.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...l})});l.displayName="Input"},36185:function(e,s,r){r.d(s,{_:function(){return c}});var t=r(85893),a=r(67294),n=r(49102),l=r(12003),o=r(32350);let i=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.f,{ref:s,className:(0,o.cn)(i(),r),...a})});c.displayName=n.f.displayName},33785:function(e,s,r){r.r(s),r.d(s,{NewWorkspace:function(){return b}});var t=r(85893),a=r(67294),n=r(11163),l=r(41664),o=r.n(l),i=r(5152),c=r.n(i),u=r(17324),d=r(30803),f=r(42557),m=r(36185),p=r(37673);let x=c()(()=>Promise.all([r.e(616),r.e(5739),r.e(7411),r.e(1272),r.e(7359),r.e(6989),r.e(3850),r.e(8969),r.e(9353),r.e(4282),r.e(6601),r.e(3015),r.e(1141)]).then(r.bind(r,11141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[11141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.getWorkspaces)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},k=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),w=e.trim()&&!y;return r?(0,t.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(p.Zb,{className:"max-w-md",children:[(0,t.jsx)(p.Ol,{children:(0,t.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(p.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.jsx)(f.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&w&&k()}}),y?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(d.z,{onClick:k,disabled:!w||b,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},49102:function(e,s,r){r.d(s,{f:function(){return o}});var t=r(67294),a=r(75320),n=r(85893),l=t.forwardRef((e,s)=>(0,n.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));l.displayName="Label";var o=l},12003:function(e,s,r){r.d(s,{j:function(){return l}});var t=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=t.W,l=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:o}=s,i=Object.keys(l).map(e=>{let s=null==r?void 0:r[e],t=null==o?void 0:o[e];if(null===s)return null;let n=a(s)||a(t);return l[e][n]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return n(e,i,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...a}=s;return Object.entries(a).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...o,...c}[s]):({...o,...c})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785],{42557:function(e,s,r){r.d(s,{I:function(){return l}});var t=r(85893),a=r(67294),n=r(32350);let l=a.forwardRef((e,s)=>{let{className:r,type:a,...l}=e;return(0,t.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...l})});l.displayName="Input"},36185:function(e,s,r){r.d(s,{_:function(){return c}});var t=r(85893),a=r(67294),n=r(49102),l=r(12003),o=r(32350);let i=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.f,{ref:s,className:(0,o.cn)(i(),r),...a})});c.displayName=n.f.displayName},33785:function(e,s,r){r.r(s),r.d(s,{NewWorkspace:function(){return b}});var t=r(85893),a=r(67294),n=r(11163),l=r(41664),o=r.n(l),i=r(5152),c=r.n(i),u=r(17324),d=r(30803),f=r(42557),m=r(36185),p=r(37673);let x=c()(()=>Promise.all([r.e(616),r.e(5739),r.e(7411),r.e(1272),r.e(7359),r.e(6989),r.e(3850),r.e(8969),r.e(9353),r.e(4282),r.e(6601),r.e(7615),r.e(1141)]).then(r.bind(r,11141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[11141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.getWorkspaces)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},k=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),w=e.trim()&&!y;return r?(0,t.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(p.Zb,{className:"max-w-md",children:[(0,t.jsx)(p.Ol,{children:(0,t.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(p.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.jsx)(f.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&w&&k()}}),y?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(d.z,{onClick:k,disabled:!w||b,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},49102:function(e,s,r){r.d(s,{f:function(){return o}});var t=r(67294),a=r(75320),n=r(85893),l=t.forwardRef((e,s)=>(0,n.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));l.displayName="Label";var o=l},12003:function(e,s,r){r.d(s,{j:function(){return l}});var t=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=t.W,l=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:o}=s,i=Object.keys(l).map(e=>{let s=null==r?void 0:r[e],t=null==o?void 0:o[e];if(null===s)return null;let n=a(s)||a(t);return l[e][n]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return n(e,i,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...a}=s;return Object.entries(a).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...o,...c}[s]):({...o,...c})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4282],{50326:function(e,t,a){a.d(t,{$N:function(){return m},Be:function(){return h},Vq:function(){return c},cN:function(){return _},cZ:function(){return d},fK:function(){return f}});var r=a(85893),s=a(67294),o=a(6327),n=a(32350),l=a(43767);let c=o.fC;o.xz;let u=o.h_;o.x8;let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.aV,{ref:t,className:(0,n.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s})});i.displayName=o.aV.displayName;let d=s.forwardRef((e,t)=>{let{className:a,children:s,...c}=e;return(0,r.jsxs)(u,{children:[(0,r.jsx)(i,{}),(0,r.jsxs)(o.VY,{ref:t,className:(0,n.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...c,children:[s,(0,r.jsxs)(o.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});d.displayName=o.VY.displayName;let f=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let _=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};_.displayName="DialogFooter";let m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.Dx,{ref:t,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});m.displayName=o.Dx.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.dk,{ref:t,className:(0,n.cn)("text-sm text-gray-500",a),...s})});h.displayName=o.dk.displayName},23266:function(e,t,a){a.d(t,{GH:function(){return f},QL:function(){return m},Sl:function(){return d},getClusters:function(){return u},uR:function(){return i}});var r=a(67294),s=a(15821),o=a(47145),n=a(93225),l=a(6378);let c={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function u(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await o.x.fetch("/status",{cluster_names:e,all_users:!0,include_credentials:!1,include_handle:!1,summary_response:null==e})).map(e=>{let t="",a=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let a=Math.floor((t-3)/2),r=a+(t-3)%2;return 0===a?e.substring(0,r)+"...":e.substring(0,r)+"..."+e.substring(e.length-a)}(t,25)),{status:c[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:a?"".concat(e.cloud," (").concat(a,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,last_event:e.last_event,to_down:e.to_down,cluster_name_on_cloud:e.cluster_name_on_cloud,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;try{let a={days:t,dashboard_summary_response:!0};e&&(a.cluster_hashes=[e]);let r=await o.x.fetch("/cost_report",a);console.log("Raw cluster history data:",r);let s=r.map(e=>{let t="Unknown";e.cloud?t=e.cloud:e.resources&&e.resources.cloud&&(t=e.resources.cloud);let a=e.user_name||"-";return{status:e.status?c[e.status]:"TERMINATED",cluster:e.name,user:a,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:t,region:"",infra:t,full_infra:t,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:e.launched_at?new Date(1e3*e.launched_at):null,num_nodes:e.num_nodes||1,duration:e.duration,total_cost:e.total_cost,workspace:e.workspace||"default",autostop:-1,last_event:e.last_event,to_down:!1,cluster_name_on_cloud:null,usage_intervals:e.usage_intervals,command:e.last_creation_command||"",task_yaml:e.last_creation_yaml||"{}",events:[{time:e.launched_at?new Date(1e3*e.launched_at):new Date,event:"Cluster created."}]}});return console.log("Processed cluster history data:",s),s}catch(e){return console.error("Error fetching cluster history:",e),[]}}async function d(e){let{clusterName:t,jobId:a,onNewLog:r,workspace:n}=e;try{await o.x.stream("/logs",{follow:!1,cluster_name:t,job_id:a,tail:1e4,override_skypilot_config:{active_workspace:n||"default"}},r)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,s.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function f(e){let{clusterName:t,jobIds:a=null,workspace:r}=e;try{let e=await o.x.fetch("/download_logs",{cluster_name:t,job_ids:a?a.map(String):null,override_skypilot_config:{active_workspace:r||"default"}}),l=Object.values(e||{});if(!l.length){(0,s.C)("No logs found to download.","warning");return}let c=window.location.origin,u="".concat(c).concat(n.f4,"/download"),i=await fetch("".concat(u,"?relative=items"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder_paths:l})});if(!i.ok){let e=await i.text();throw Error("Download failed: ".concat(i.status," ").concat(e))}let d=await i.blob(),f=window.URL.createObjectURL(d),_=document.createElement("a"),m=new Date().toISOString().replace(/[:.]/g,"-"),h=a&&1===a.length?"job-".concat(a[0]):"jobs";_.href=f,_.download="".concat(t,"-").concat(h,"-logs-").concat(m,".zip"),document.body.appendChild(_),_.click(),_.remove(),window.URL.revokeObjectURL(f)}catch(e){console.error("Error downloading logs:",e),(0,s.C)("Error downloading logs: ".concat(e.message),"error")}}async function _(e){let{clusterName:t,workspace:a}=e;try{return(await o.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:a}})).map(e=>{var r;let s=e.end_at?e.end_at:Date.now()/1e3,o=0,n=0;return e.submitted_at&&(o=s-e.submitted_at),e.start_at&&(n=s-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,user_hash:e.user_hash,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:o,job_duration:n,infra:"",logs:"",workspace:a||"default",git_commit:(null===(r=e.metadata)||void 0===r?void 0:r.git_commit)||"-"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function m(e){let{cluster:t,job:a=null}=e,[s,o]=(0,r.useState)(null),[n,c]=(0,r.useState)(null),[i,d]=(0,r.useState)(!0),[f,m]=(0,r.useState)(!0),h=(0,r.useCallback)(async()=>{if(t)try{d(!0);let e=await l.default.get(u,[{clusterNames:[t]}]);return o(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{d(!1)}return null},[t]),g=(0,r.useCallback)(async e=>{if(t)try{m(!0);let a=await l.default.get(_,[{clusterName:t,workspace:e||"default"}]);c(a)}catch(e){console.error("Error fetching cluster job data:",e)}finally{m(!1)}},[t]),p=(0,r.useCallback)(async()=>{l.default.invalidate(u,[{clusterNames:[t]}]);let e=await h();e&&(l.default.invalidate(_,[{clusterName:t,workspace:e.workspace||"default"}]),await g(e.workspace))},[h,g,t]),w=(0,r.useCallback)(async()=>{s&&(l.default.invalidate(_,[{clusterName:t,workspace:s.workspace||"default"}]),await g(s.workspace))},[g,s,t]);return(0,r.useEffect)(()=>{(async()=>{let e=await h();e&&g(e.workspace)})()},[t,a,h,g]),{clusterData:s,clusterJobData:n,loading:i,clusterDetailsLoading:i,clusterJobsLoading:f,refreshData:p,refreshClusterJobsOnly:w}}},53081:function(e,t,a){a.d(t,{R:function(){return s}});var r=a(47145);async function s(){try{let e=await r.x.get("/users");if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role,created_at:e.created_at}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7615],{47615:function(e,t,s){s.r(t),s.d(t,{ClusterJobs:function(){return W},ManagedJobs:function(){return J},ManagedJobsTable:function(){return U},Status2Actions:function(){return O},filterJobsByName:function(){return F},filterJobsByPool:function(){return z},filterJobsByUser:function(){return A},filterJobsByWorkspace:function(){return I},statusGroups:function(){return D}});var r=s(85893),a=s(67294),l=s(11163),n=s(41664),i=s.n(n),c=s(55739),o=s(30803),d=s(37673),u=s(68764),h=s(36989),x=s(51214),m=s(68969),p=s(6378);class j{_generateFilterKey(e){let{allUsers:t=!0,nameMatch:s,userMatch:r,workspaceMatch:a,poolMatch:l,statuses:n}=e;return["allUsers:".concat(t),s?"name:".concat(s):"",r?"user:".concat(r):"",a?"workspace:".concat(a):"",l?"pool:".concat(l):"",n&&n.length>0?"statuses:".concat(n.sort().join(",")):""].filter(Boolean).join("|")||"default"}_getCacheStatus(e){let t=this.fullDataCache.get(e),s=Date.now();if(!t)return{isCached:!1,isFresh:!1,age:0,maxAge:12e4,hasData:!1};let r=s-t.timestamp;return{isCached:!0,isFresh:r<12e4,age:r,maxAge:12e4,hasData:t.jobs&&Array.isArray(t.jobs),data:t}}async getPaginatedJobs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,limit:s=10,...r}=e,a=this._generateFilterKey(r);try{let e=this._getCacheStatus(a);if(e.isCached&&e.hasData){let l=e.data;if(!l.jobs||Array.isArray(l.jobs)&&0===l.jobs.length){if(!this.prefetching.has(a)){let e=this._loadFullDataset(r,a).catch(()=>{}).finally(()=>this.prefetching.delete(a));this.prefetching.set(a,e)}}else{let n=(t-1)*s,i=l.jobs.slice(n,n+s);if(!this.prefetching.has(a)&&(!e.isFresh||e.age>e.maxAge/2)){let e=this._loadFullDataset(r,a).catch(()=>{}).finally(()=>this.prefetching.delete(a));this.prefetching.set(a,e)}return{jobs:i,total:l.total,totalNoFilter:l.totalNoFilter||l.total,controllerStopped:l.controllerStopped,statusCounts:l.statusCounts||{},fromCache:!0,cacheStatus:e.isFresh?"local_cache_hit":"local_cache_stale_hit"}}}let l=await p.default.get(m.getManagedJobs,[{...r,page:t,limit:s}]),n=(null==l?void 0:l.jobs)||[],i="number"==typeof(null==l?void 0:l.total)?l.total:n.length,c=!!(null==l?void 0:l.controllerStopped);if(!this.prefetching.has(a)){let e=this._loadFullDataset(r,a).catch(e=>{console.warn("Background prefetch of full jobs failed:",e)}).finally(()=>{this.prefetching.delete(a)});this.prefetching.set(a,e)}return{jobs:n,total:i,totalNoFilter:(null==l?void 0:l.totalNoFilter)||i,controllerStopped:c,statusCounts:(null==l?void 0:l.statusCounts)||{},fromCache:!1,cacheStatus:"server_page_fetch"}}catch(e){return console.error("Error in getPaginatedJobs:",e),{jobs:[],total:0,totalNoFilter:0,controllerStopped:!1,statusCounts:{},fromCache:!1,cacheStatus:"error"}}}async _loadFullDataset(e,t){let s=await p.default.get(m.getManagedJobs,[e]);if(s&&s.__skipCache||s.controllerStopped||!s.jobs)return s;let r={jobs:s.jobs,total:s.jobs.length,totalNoFilter:s.totalNoFilter||s.jobs.length,controllerStopped:!1,statusCounts:s.statusCounts||{},timestamp:Date.now()};return this.fullDataCache.set(t,r),r}isDataLoading(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e);return this.isLoading.has(t)||this.prefetching.has(t)}isDataCached(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e),s=this._getCacheStatus(t);return s.isCached&&s.isFresh&&s.hasData}getCacheStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e);return this._getCacheStatus(t)}invalidateCache(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){let t=this._generateFilterKey(e);this.fullDataCache.delete(t),this.isLoading.delete(t),this.prefetching.delete(t)}else this.fullDataCache.clear(),this.isLoading.clear(),this.prefetching.clear();p.default.invalidateFunction(m.getManagedJobs)}getCacheStats(){let e={cachedFilters:Array.from(this.fullDataCache.keys()),loadingFilters:Array.from(this.isLoading.keys()),prefetchingFilters:Array.from(this.prefetching.keys()),cacheSize:this.fullDataCache.size,loadingCount:this.isLoading.size,prefetchingCount:this.prefetching.size};for(let[t,s]of(e.detailedStatus={},this.fullDataCache.entries())){let r=this._getCacheStatus(t);e.detailedStatus[t]={age:r.age,isFresh:r.isFresh,hasData:r.hasData,jobCount:s.jobs?s.jobs.length:0}}return e}constructor(){this.fullDataCache=new Map,this.isLoading=new Map,this.prefetching=new Map}}let f=new j;var g=s(23266),b=s(17324),v=s(53081),w=s(13626),y=s(23293),N=s(6521),k=s(16826),C=s(92128),S=s(94545),L=s(99307),_=s(20546),E=s(23001),R=s(10546);let D={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},M=[{label:"Name",value:"name"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Pool",value:"pool"}];function F(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.name||"").toLowerCase().includes(s))}function I(e,t){return t&&"ALL_WORKSPACES"!==t?e.filter(e=>(e.workspace||"default").toLowerCase()===t.toLowerCase()):e}function A(e,t){return t&&"ALL_USERS"!==t?e.filter(e=>(e.user_hash||e.user)===t):e}function z(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.pool||"").toLowerCase().includes(s))}let P=e=>{if(!e)return"-";let t=e instanceof Date?e:new Date(1e3*e);return(0,r.jsx)(h.Zg,{date:t})};function J(){let e=(0,l.useRouter)(),[t,s]=(0,a.useState)(!1),[n,c]=(0,a.useState)(!0),[o,d]=(0,a.useState)(!0),u=a.useRef(null),x=a.useRef(null),[j,g]=(0,a.useState)([]),[w,y]=(0,a.useState)([]),[N,k]=(0,a.useState)({name:[],user:[],workspace:[],pool:[]}),C=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];s(!0),!e&&o&&c(!0);try{let[e]=await Promise.all([p.default.get(m.vs,[{}])]);g(e.pools||[])}catch(e){console.error("Error fetching data:",e)}finally{s(!1),!e&&o&&(c(!1),d(!1))}},[o]);(0,a.useEffect)(()=>{C()},[C]);let S=t=>{(0,R.eG)(e,t)},L=a.useCallback(()=>{let t=new Map;t.set("",""),t.set("status","Status"),t.set("name","Name"),t.set("user","User"),t.set("workspace","Workspace"),t.set("pool","Pool"),y((0,R.Fu)(e,t))},[e,y]);return(0,a.useEffect)(()=>{e.isReady&&L()},[e.isReady,e.query.tab,L]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,r.jsx)("div",{className:"text-base",children:(0,r.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"})}),(0,r.jsx)("div",{className:"w-full sm:w-auto",children:(0,r.jsx)(R.ML,{propertyList:M,valueList:N,setFilters:y,updateURLParams:S,placeholder:"Filter jobs"})})]}),(0,r.jsx)(R.x$,{filters:w,setFilters:y,updateURLParams:S}),(0,r.jsx)(U,{refreshInterval:h.yc,setLoading:s,refreshDataRef:u,filters:w,onRefresh:()=>{f.invalidateCache(),p.default.invalidate(m.vs,[{}]),p.default.invalidate(b.getWorkspaces),p.default.invalidate(v.R),u.current&&u.current(),x.current&&x.current()},poolsData:j,poolsLoading:n,setValueList:k}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(B,{refreshInterval:h.yc,setLoading:s,refreshDataRef:x})})]})}function U(e){let{refreshInterval:t,setLoading:s,refreshDataRef:l,filters:n,onRefresh:j,poolsData:b,poolsLoading:v,setValueList:N}=e,[k,R]=(0,a.useState)([]),[M,F]=(0,a.useState)(0),[I,A]=(0,a.useState)(0),[z,J]=(0,a.useState)({key:null,direction:"ascending"}),[U,W]=(0,a.useState)(!1),[B,G]=(0,a.useState)(!0),[H,K]=(0,a.useState)(1),[q,V]=(0,a.useState)(10),[Y,$]=(0,a.useState)(null),Q=(0,a.useRef)(null),[X,ee]=(0,a.useState)([]),[et,es]=(0,a.useState)({}),[er,ea]=(0,a.useState)({}),[el,en]=(0,a.useState)(!1),[ei,ec]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[eu,eh]=(0,a.useState)("all"),[ex,em]=(0,a.useState)(!0),[ep,ej]=(0,a.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),ef=(0,E.X)(),eg=(0,a.useRef)(0),eb=a.useMemo(()=>{if(!k||0===k.length)return!1;let e=new Set(k.map(e=>e.workspace||"default"));return e.size>1||1===e.size&&!e.has("default")},[k]),ev=a.useMemo(()=>b&&b.length>0,[b]),ew=async()=>{ej({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{ed(!0),W(!0),await (0,m.Ce)("restartcontroller"),await ey()}catch(e){console.error("Error restarting controller:",e)}finally{ed(!1),W(!1)}}})},ey=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1!==e.includeStatus,r=eg.current+1;eg.current=r,W(!0),s(!0);try{let e,s;let a=e=>{let t=(n||[]).find(t=>(t.property||"").toLowerCase()===e);return t&&t.value?String(t.value):void 0};X.length>0?s=X:ex?"active"===eu?s=D.active:"finished"===eu&&(s=D.finished):s=[];let l={allUsers:!0,nameMatch:a("name"),userMatch:a("user"),workspaceMatch:a("workspace"),poolMatch:a("pool"),statuses:s,page:H,limit:q},i=null;if(f.isDataCached(l),f.isDataLoading(l),t){let[t,s]=await Promise.all([f.getPaginatedJobs(l),p.default.get(g.getClusters)]);e=t,i=s}else e=await f.getPaginatedJobs(l);let{jobs:c=[],total:o=0,totalNoFilter:d=0,controllerStopped:u=!1,cacheStatus:h="unknown",statusCounts:x={}}=e||{},m=!1,j=!1;if(t&&i){let e=null==i?void 0:i.find(e=>(0,S.Ym)(e.cluster)),t=e?e.status:"NOT_FOUND";"STOPPED"==t&&u&&(m=!0),"LAUNCHING"==t&&(j=!0)}r===eg.current&&(R(c),F(o||0),A(d||0),en(!!m),ec(!!j),ea(x),G(!1))}catch(e){console.error("Error fetching data:",e),r===eg.current&&(R([]),en(!1),G(!1))}finally{r===eg.current&&(W(!1),s(!1))}},[s,n,H,q,X,ex,eu]);a.useEffect(()=>{l&&(l.current=ey)},[l,ey]);let eN=a.useRef(ey);a.useEffect(()=>{eN.current=ey},[ey]);let ek=a.useRef(!0);a.useEffect(()=>{ey({includeStatus:!0}),ek.current=!1},[ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!1})},[H,ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!0})},[n,q,ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!0})},[eu,X,ex,ey]),(0,a.useEffect)(()=>{let e=setInterval(()=>{eN.current&&"visible"===window.document.visibilityState&&eN.current({includeStatus:!0})},t);return()=>{clearInterval(e)}},[t]),(0,a.useEffect)(()=>{K(1)},[eu]),(0,a.useEffect)(()=>{K(1)},[n,q]),(0,a.useEffect)(()=>{ee([]),em(!0)},[eu]),(0,a.useEffect)(()=>{if(!k||0===k.length||!N)return;let e=new Set,t=new Set,s=new Set,r=new Set;k.forEach(a=>{a.name&&e.add(a.name),a.user&&t.add(a.user),a.workspace&&s.add(a.workspace),a.pool&&r.add(a.pool)}),N({name:Array.from(e).sort(),user:Array.from(t).sort(),workspace:Array.from(s).sort(),pool:Array.from(r).sort()})},[k,N]);let eC=e=>{let t="ascending";z.key===e&&"ascending"===z.direction&&(t="descending"),J({key:e,direction:t})},eS=e=>z.key===e?"ascending"===z.direction?" ↑":" ↓":"";a.useMemo(()=>{let e=k||[];return{active:e.filter(e=>D.active.includes(e.status)).length,finished:e.filter(e=>D.finished.includes(e.status)).length}},[k]);let eL=e=>X.length>0?X.includes(e):"all"===eu||D[eu].includes(e),e_=a.useMemo(()=>k,[k]),eE=a.useMemo(()=>z.key?[...e_].sort((e,t)=>e[z.key]<t[z.key]?"ascending"===z.direction?-1:1:e[z.key]>t[z.key]?"ascending"===z.direction?1:-1:0):e_,[e_,z]),eR=(H-1)*q,eD=M>0?Math.ceil(M/q):0,eM=M>0?Math.min(eR+eE.length,M):0,eF=e=>{if(X.includes(e)){let t=X.filter(t=>t!==e);0===t.length?(em(!0),ee([])):(ee(t),em(!1))}else ee([...X,e]),em(!1);K(1)};return(0,a.useEffect)(()=>{es(er)},[er]),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between text-sm mb-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center",children:[(0,r.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!U&&0===I&&!B&&(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(et).map(e=>{let[t,s]=e;return(0,r.jsxs)("button",{onClick:()=>eF(t),className:"px-3 py-0.5 rounded-full flex items-center space-x-2 ".concat(eL(t)||X.includes(t)?(0,L.Cl)(t):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)("span",{className:"text-xs ".concat(eL(t)||X.includes(t)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:s})]},t)}),I>0&&(0,r.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,r.jsx)("span",{className:"text-gray-500",children:"("}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("all"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("all"===eu&&ex?"text-purple-700 underline":"text-gray-600 hover:text-purple-700 hover:underline"),children:"show all jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("active"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("active"===eu&&ex?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("finished"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("finished"===eu&&ex?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,r.jsx)("span",{className:"text-gray-500",children:")"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[U&&(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(c.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{j&&j()},disabled:U,className:"text-sky-blue hover:text-sky-blue-bright flex items-center text-sm",children:[(0,r.jsx)(w.Z,{className:"h-4 w-4 mr-1.5"}),(0,r.jsx)("span",{children:"Refresh"})]})]})]})}),ef&&el&&0===eE.length&&!U&&!B&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-gray-50 rounded-lg border",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3",children:[(0,r.jsxs)("p",{className:"text-gray-700 text-center text-sm",children:["Job controller stopped.",(0,r.jsx)("br",{}),"Restart to check status."]}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ew,className:"text-sky-blue hover:text-sky-blue-bright",disabled:U||eo,children:eo?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 mr-2"}),"Restart"]})})]})}),(0,r.jsx)(d.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(u.iA,{className:"min-w-full",children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("id"),children:["ID",eS("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("name"),children:["Name",eS("name")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("user"),children:["User",eS("user")]}),eb&&(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("workspace"),children:["Workspace",eS("workspace")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("submitted_at"),children:["Submitted",eS("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("job_duration"),children:["Duration",eS("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("status"),children:["Status",eS("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("infra"),children:["Infra",eS("infra")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("cluster"),children:["Resources",eS("cluster")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("recoveries"),children:["Recoveries",eS("recoveries")]}),ev&&(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("pool"),children:["Worker Pool",eS("pool")]}),(0,r.jsx)(u.ss,{children:"Details"}),(0,r.jsx)(u.ss,{children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:U&&B?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:11+(eb?1:0)+(ev?1:0),className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):eE.length>0?(0,r.jsx)(r.Fragment,{children:eE.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(_.H,{username:e.user,userHash:e.user_hash})}),eb&&(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(u.pj,{children:P(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(L.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(h.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+(()=>{let t=x.MO.NAME_TRUNCATE_LENGTH,s=e.infra.substring(e.infra.indexOf("(")),r=s.substring(1,s.length-1);if(r.length<=t)return s;let a="".concat(r.substring(0,Math.floor((t-3)/2)),"...").concat(r.substring(r.length-Math.ceil((t-3)/2)));return"(".concat(a,")")})()})]})}):(0,r.jsx)("span",{children:e.infra||"-"})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(h.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.resources_str})})}),(0,r.jsx)(u.pj,{children:e.recoveries}),ev&&(0,r.jsx)(u.pj,{children:(0,r.jsx)("div",{className:v?"blur-sm transition-all duration-300":"",children:v?"-":(0,h.os)(e.pool,e.pool_hash,b)})}),(0,r.jsx)(u.pj,{children:e.details?(0,r.jsx)(Z,{text:e.details,rowId:e.id,expandedRowId:Y,setExpandedRowId:$}):"-"}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(O,{jobParent:"/jobs",jobId:e.id,managed:!0,workspace:e.workspace})})]}),Y===e.id&&(0,r.jsx)(T,{text:e.details,colSpan:11+(eb?1:0)+(ev?1:0),innerRef:Q})]},e.task_job_id))}):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:11+(eb?1:0)+(ev?1:0),className:"text-center py-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[ei&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!el&&!ei&&(0,r.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),!ef&&el&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3 px-4",children:[(0,r.jsx)("p",{className:"text-gray-700 text-center text-sm sm:text-base max-w-md",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ew,className:"text-sky-blue hover:text-sky-blue-bright",disabled:U||eo,children:eo?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})})}),(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:q,onChange:e=>{V(parseInt(e.target.value,10)),K(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:30,children:"30"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]}),(0,r.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,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsx)("div",{children:M>0?"".concat(eR+1," – ").concat(eM," of ").concat(M):"0 – 0 of 0"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{K(e=>Math.max(e-1,1))},disabled:1===H||!eE||0===eE.length,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.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,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{eD>0&&H<eD&&K(e=>e+1)},disabled:0===eD||H>=eD||!eE||0===eE.length,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.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,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,r.jsx)(C.cV,{isOpen:ep.isOpen,onClose:()=>ej({...ep,isOpen:!1}),onConfirm:ep.onConfirm,title:ep.title,message:ep.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function O(e){let{withLabel:t=!1,jobParent:s,jobId:a,managed:n,workspace:i="default"}=e,c=(0,l.useRouter)(),o=(e,t)=>{e.preventDefault(),e.stopPropagation(),c.push({pathname:"".concat(s,"/").concat(a),query:{tab:t}})},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.preventDefault(),e.stopPropagation(),n)(0,m.jh)({jobId:parseInt(a),controller:t});else{let e=s.match(/\/clusters\/(.+)/);if(e){let t=e[1];(0,g.GH)({clusterName:t,jobIds:[a],workspace:i})}}};return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(h.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>o(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(N.Z,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),(0,r.jsx)(h.WH,{content:"Download Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>d(e,!1),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(k.Z,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Download"})]})},"downloadlogs")]})}function W(e){let{clusterName:t,clusterJobData:s,loading:l,refreshClusterJobsOnly:n,userFilter:x=null,nameFilter:m=null,workspace:p="default"}=e,[j,f]=(0,a.useState)(null),[g,b]=(0,a.useState)({key:null,direction:"ascending"}),[v,y]=(0,a.useState)(1),[N,k]=(0,a.useState)(10),C=(0,a.useRef)(null),[S,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=e=>{j&&C.current&&!C.current.contains(e.target)&&f(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[j]);let R=a.useMemo(()=>{let e=s||[];return x&&"ALL_USERS"!==x&&(e=A(e,x)),m&&(e=F(e,m)),e},[s,x,m]);(0,a.useEffect)(()=>{JSON.stringify(s)!==JSON.stringify(S)&&E(s)},[s,S]);let D=a.useMemo(()=>g.key?[...R].sort((e,t)=>e[g.key]<t[g.key]?"ascending"===g.direction?-1:1:e[g.key]>t[g.key]?"ascending"===g.direction?1:-1:0):R,[R,g]),M=e=>{let t="ascending";g.key===e&&"ascending"===g.direction&&(t="descending"),b({key:e,direction:t})},I=e=>g.key===e?"ascending"===g.direction?" ↑":" ↓":"",z=Math.ceil(D.length/N),J=(v-1)*N,U=J+N,W=D.slice(J,U);return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)(d.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,r.jsx)("div",{className:"flex items-center",children:n&&(0,r.jsxs)("button",{onClick:n,disabled:l,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,r.jsx)(w.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("id"),children:["ID",I("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("job"),children:["Name",I("job")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("user"),children:["User",I("user")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("submitted_at"),children:["Submitted",I("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("job_duration"),children:["Duration",I("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("status"),children:["Status",I("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>M("resources"),children:["Resources",I("resources")]}),(0,r.jsx)(u.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:l?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:8,className:"text-center py-12 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading cluster jobs..."})]})})}):W.length>0?W.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(u.SC,{className:j===e.id?"selected-row":"",children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:(0,r.jsx)(Z,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:j,setExpandedRowId:f})})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(_.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(u.pj,{children:P(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(L.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.resources}),(0,r.jsx)(u.pj,{className:"flex content-center items-center",children:(0,r.jsx)(O,{jobParent:"/clusters/".concat(t),jobId:e.id,managed:!1,workspace:p})})]}),j===e.id&&(0,r.jsx)(T,{text:e.job||"Unnamed job",colSpan:8,innerRef:C})]},e.id)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),D&&D.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:N,onChange:e=>{k(parseInt(e.target.value,10)),y(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:20,children:"20"}),(0,r.jsx)("option",{value:50,children:"50"})]}),(0,r.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,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[J+1," – ",Math.min(U,D.length)," of"," ",D.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{y(e=>Math.max(e-1,1))},disabled:1===v,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.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,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{y(e=>Math.min(e+1,z))},disabled:v===z||0===z,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.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,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function T(e){let{text:t,colSpan:s,innerRef:a}=e;return(0,r.jsx)(u.SC,{className:"expanded-details",children:(0,r.jsx)(u.pj,{colSpan:s,children:(0,r.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:a,children:(0,r.jsx)("div",{className:"flex justify-between items-start",children:(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:t})]})})})})})}function Z(e){let{text:t,rowId:s,expandedRowId:l,setExpandedRowId:n}=e,i=t||"",c=i.length>50,o=l===s,d=c?"".concat(i.substring(0,50)):i,u=(0,a.useRef)(null);return(0,r.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,r.jsx)("span",{className:"truncate",children:d}),c&&(0,r.jsx)("button",{ref:u,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),n(o?null:s)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}function B(e){let{refreshInterval:t,setLoading:s,refreshDataRef:l}=e,[n,o]=(0,a.useState)([]),[x,j]=(0,a.useState)({key:null,direction:"ascending"}),[f,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!0),[w,y]=(0,a.useState)(1),[N,k]=(0,a.useState)(10),C=a.useCallback(async()=>{g(!0),s(!0);try{let{pools:e=[]}=await p.default.get(m.vs,[{}])||{};o(e),v(!1)}catch(e){console.error("Error fetching pools data:",e),o([]),v(!1)}finally{g(!1),s(!1)}},[s]);a.useEffect(()=>{l&&(l.current=C)},[l,C]),(0,a.useEffect)(()=>{o([]);let e=!0;C();let s=setInterval(()=>{e&&"visible"===window.document.visibilityState&&C()},t);return()=>{e=!1,clearInterval(s)}},[t,C]);let S=e=>{let t="ascending";x.key===e&&"ascending"===x.direction&&(t="descending"),j({key:e,direction:t})},_=e=>x.key===e?"ascending"===x.direction?" ↑":" ↓":"",E=a.useMemo(()=>x.key?[...n].sort((e,t)=>e[x.key]<t[x.key]?"ascending"===x.direction?-1:1:e[x.key]>t[x.key]?"ascending"===x.direction?1:-1:0):n,[n,x]),R=Math.ceil(E.length/N),D=(w-1)*N,M=D+N,F=E.slice(D,M),I=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,s=e.target_num_replicas||0;return"".concat(t," (target: ").concat(s,")")},A=e=>{let{jobCounts:t}=e;return(0,r.jsx)(h.x9,{jobCounts:t,getStatusStyle:L.Cl})},z=e=>{let{replicaInfo:t}=e;return(0,r.jsx)(h.Kl,{replicaInfo:t})};return(0,r.jsxs)(d.Zb,{children:[(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(u.iA,{className:"min-w-full table-fixed",children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-32",onClick:()=>S("name"),children:["Pool",_("name")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>S("job_counts"),children:["Jobs",_("job_counts")]}),(0,r.jsx)(u.ss,{className:"whitespace-nowrap w-20",children:"Workers"}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-36",onClick:()=>S("requested_resources_str"),children:["Worker Details",_("requested_resources_str")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>S("requested_resources_str"),children:["Worker Resources",_("requested_resources_str")]})]})}),(0,r.jsx)(u.RM,{children:f&&b?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):F.length>0?F.map(e=>(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/pools/".concat(e.name),className:"text-blue-600 hover:text-blue-800",children:e.name})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(A,{jobCounts:e.jobCounts})}),(0,r.jsx)(u.pj,{children:I(e)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(z,{replicaInfo:e.replica_info})}),(0,r.jsx)(u.pj,{children:e.requested_resources_str||"-"})]},e.name)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No pools found"})})})]})}),F.length>0&&R>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-700",children:"Rows per page:"}),(0,r.jsxs)("select",{value:N,onChange:e=>{k(parseInt(e.target.value,10)),y(1)},className:"border border-gray-300 rounded px-2 py-1 text-sm",children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:25,children:"25"}),(0,r.jsx)("option",{value:50,children:"50"})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)("span",{className:"text-sm text-gray-700",children:[D+1,"-",Math.min(M,E.length)," of"," ",E.length]}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.max(e-1,1))},disabled:1===w,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Previous"}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.min(e+1,R))},disabled:w===R,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Next"})]})]})]})}},10546:function(e,t,s){s.d(t,{Fu:function(){return o},ML:function(){return d},cm:function(){return i},eG:function(){return c},x$:function(){return u}});var r=s(85893),a=s(67294),l=s(88950);let n=(e,t)=>{var s;let{property:r,operator:a,value:l}=t;if(!l)return!0;if(!r){let t=l.toLowerCase();return Object.values(e).some(e=>null==e?void 0:e.toString().toLowerCase().includes(t))}let n=null===(s=e[r.toLowerCase()])||void 0===s?void 0:s.toString().toLowerCase(),i=l.toString().toLowerCase();switch(a){case"=":return n===i;case":":return null==n?void 0:n.includes(i);default:return!0}},i=(e,t)=>0===t.length?e:e.filter(e=>{let s=null;for(let r=0;r<t.length;r++){let a=n(e,t[r]);s=null===s?a:s&&a}return s}),c=(e,t)=>{let s={...e.query},r=[],a=[],l=[];t.map((e,t)=>{var s;r.push(null!==(s=e.property.toLowerCase())&&void 0!==s?s:""),a.push(e.operator),l.push(e.value)}),s.property=r,s.operator=a,s.value=l,e.replace({pathname:e.pathname,query:s},void 0,{shallow:!0})},o=(e,t)=>{let s={...e.query},r=s.property,a=s.operator,l=s.value;if(void 0===r)return[];let n=[],i=Array.isArray(r)?r.length:1;if(1===i)n.push({property:t.get(r),operator:a,value:l});else for(let e=0;e<i;e++)n.push({property:t.get(r[e]),operator:a[e],value:l[e]});return n},d=e=>{var t,s;let{propertyList:n=[],valueList:i,setFilters:c,updateURLParams:o,placeholder:d="Filter items"}=e,u=(0,a.useRef)(null),h=(0,a.useRef)(null),[x,m]=(0,a.useState)(!1),[p,j]=(0,a.useState)(""),[f,g]=(0,a.useState)((null===(t=n[0])||void 0===t?void 0:t.value)||"status"),[b,v]=(0,a.useState)([]);(0,a.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,a.useEffect)(()=>{let e=[];i&&"object"==typeof i&&(e=i[f]||[]),""!==p.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(p.toLowerCase()))),v(e)},[f,i,p]);let w=e=>{let t=n.find(t=>t.value===e);return t?t.label:e},y=e=>{c(t=>{let s=[...t,{property:w(f),operator:":",value:e}];return o(s),s}),m(!1),j(""),u.current.focus()};return(0,r.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible bg-white",children:[(0,r.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,r.jsxs)(l.Ph,{onValueChange:g,value:f,children:[(0,r.jsx)(l.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,r.jsx)(l.ki,{placeholder:(null===(s=n[0])||void 0===s?void 0:s.label)||"Status"})}),(0,r.jsx)(l.Bw,{children:n.map((e,t)=>(0,r.jsx)(l.Ql,{value:e.value,children:e.label},"property-item-".concat(t)))})]})}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:"text",ref:u,placeholder:d,value:p,onChange:e=>{j(e.target.value),x||m(!0)},onFocus:()=>{m(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==p.trim()?(c(e=>{let t=[...e,{property:w(f),operator:":",value:p}];return o(t),t}),j(""),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"}),p&&(0,r.jsx)("button",{onClick:()=>{j(""),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,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),x&&b.length>0&&(0,r.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:b.map((e,t)=>(0,r.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(t!==b.length-1?"border-b border-gray-100":""),onClick:()=>y(e),children:(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(t)))})]})]})},u=e=>{let{filters:t=[],setFilters:s,updateURLParams:a}=e,l=e=>{s(t=>{let s=t.filter((t,s)=>s!==e);return a(s),s})};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[t.map((e,t)=>(0,r.jsx)(h,{filter:e,onRemove:()=>l(t)},"filteritem-".concat(t))),t.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("button",{onClick:()=>{a([]),s([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},h=e=>{let{filter:t,onRemove:s}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,r.jsx)("span",{children:"".concat(t.property," ")}),(0,r.jsx)("span",{children:"".concat(t.operator," ")}),(0,r.jsx)("span",{children:" ".concat(t.value)})]}),(0,r.jsx)("button",{onClick:()=>s(),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,r.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8969],{68969:function(e,t,o){o.d(t,{Ce:function(){return g},NJ:function(){return p},UA:function(){return h},aT:function(){return d},getManagedJobs:function(){return l},jh:function(){return b},vs:function(){return u}});var r=o(67294),a=o(15821),n=o(93225),s=o(6378),c=o(47145);let i=["job_id","_job_id","job_name","user_name","user_hash","workspace","submitted_at","job_duration","status","resources","cloud","region","accelerators","cluster_resources","cluster_resources_full","recovery_count","pool","pool_hash","details","failure_reason"];async function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var t;let{allUsers:o=!0,skipFinished:r=!1,allFields:a=!1,nameMatch:s,userMatch:l,workspaceMatch:d,poolMatch:u,page:h,limit:p,statuses:g,fields:b,jobIDs:f}=e,_={all_users:o,verbose:!0,skip_finished:r};void 0!==s&&(_.name_match=s),void 0!==l&&(_.user_match=l),void 0!==d&&(_.workspace_match=d),void 0!==u&&(_.pool_match=u),void 0!==h&&(_.page=h),void 0!==p&&(_.limit=p),void 0!==g&&g.length>0&&(_.statuses=g),void 0!==f&&f.length>0&&(_.job_ids=f),a||(b&&b.length>0?_.fields=b:_.fields=i);let m=(await c.x.post("/jobs/queue/v2",_)).headers.get("X-Skypilot-Request-ID"),y=await c.x.get("/api/get?request_id=".concat(m));if(500===y.status){try{let e=await y.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.iW)return{jobs:[],total:0,controllerStopped:!0}}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{__skipCache:!0,jobs:[],total:0,controllerStopped:!1}}let w=await y.json(),j=w.return_value?JSON.parse(w.return_value):[],v=Array.isArray(j)?j:(null==j?void 0:j.jobs)||[],k=Array.isArray(j)?v.length:null!==(t=null==j?void 0:j.total)&&void 0!==t?t:v.length,S=(null==j?void 0:j.total_no_filter)||k,C=(null==j?void 0:j.status_counts)||{};return{jobs:v.map(e=>{var t;let o=0;e.end_at&&e.submitted_at?o=e.end_at-e.submitted_at:e.submitted_at&&(o=Date.now()/1e3-e.submitted_at);let r=[];e.submitted_at&&r.push({type:"PENDING",timestamp:e.submitted_at}),e.start_at&&r.push({type:"RUNNING",timestamp:e.start_at}),e.end_at&&r.push({type:e.status,timestamp:e.end_at});let a="",n="",s="",c="",i="";try{if(a=e.cloud||"",s=e.cluster_resources,n=e.region||"",a&&(c=a,n&&(c+="/".concat(n))),i=c,e.accelerators){let t=Object.entries(e.accelerators).map(e=>{let[t,o]=e;return"".concat(o,"x").concat(t)}).join(", ");t&&(i+=" (".concat(t,")"))}}catch(t){s=e.cluster_resources}return{id:e.job_id,task_job_id:e._job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:o,workspace:e.workspace,status:e.status,requested_resources:e.resources,resources_str:s,resources_str_full:e.cluster_resources_full||s,cloud:a,region:e.region,infra:c,full_infra:i,recoveries:e.recovery_count,details:e.details||e.failure_reason,user:e.user_name,user_hash:e.user_hash,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:r,dag_yaml:e.user_yaml,entrypoint:e.entrypoint,git_commit:(null===(t=e.metadata)||void 0===t?void 0:t.git_commit)||"-",pool:e.pool,pool_hash:e.pool_hash,current_cluster_name:e.current_cluster_name,job_id_on_pool_cluster:e.job_id_on_pool_cluster,accelerators:e.accelerators}}),total:k,totalNoFilter:S,controllerStopped:!1,statusCounts:C}}catch(e){return console.error("Error fetching managed job data:",e),{__skipCache:!0,jobs:[],total:0,totalNoFilter:0,controllerStopped:!1,statusCounts:{}}}}async function d(e){let{allUsers:t=!0,nameMatch:o,userMatch:r,workspaceMatch:a,poolMatch:n,page:s=1,limit:c=10,jobIDs:i,fields:d,allFields:u=!1,useClientPagination:h=!0}=e||{};try{if(!h)return await l(e);let p=await l({allUsers:t,nameMatch:o,userMatch:r,workspaceMatch:a,poolMatch:n,jobIDs:i,fields:d,allFields:u});if(p.controllerStopped||!p.jobs)return p;let g=p.jobs,b=g.length,f=(s-1)*c;return{jobs:g.slice(f,f+c),total:b,controllerStopped:!1}}catch(e){return console.error("Error fetching managed job data with client pagination:",e),{__skipCache:!0,jobs:[],controllerStopped:!1,total:0}}}async function u(){try{let e=(await c.x.post("/jobs/pool_status",{pool_names:null})).headers.get("X-Skypilot-Request-ID"),t=await c.x.get("/api/get?request_id=".concat(e));if(500===t.status){try{let e=await t.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.iW)return{pools:[],controllerStopped:!0}}catch(e){console.error("Failed to parse error JSON:",e)}}catch(e){console.error("Failed to parse response JSON:",e)}throw Error("Server error")}let o=await t.json(),r=o.return_value?JSON.parse(o.return_value):[],a={jobs:[]};try{let e=await s.default.get(l,[{allUsers:!0,skipFinished:!0,fields:["pool","status"]}]);e.controllerStopped||(a=e)}catch(e){console.warn("Failed to fetch jobs for pool job counts:",e)}let i={},d=["SUCCEEDED","FAILED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER","CANCELLED"];return a.jobs&&Array.isArray(a.jobs)&&a.jobs.forEach(e=>{let t=e.pool,o=e.status;t&&!d.includes(o)&&(i[t]||(i[t]={}),i[t][o]=(i[t][o]||0)+1)}),{pools:r.map(e=>({...e,jobCounts:i[e.name]||{}})),controllerStopped:!1}}catch(e){throw console.error("Error fetching pools:",e),e}}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[o,a]=(0,r.useState)(null),[n,c]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{(async function(){if(e)try{var t;c(!0);let o=await s.default.get(l,[{allUsers:!0,allFields:!0,jobIDs:[e]}]),r=null==o?void 0:null===(t=o.jobs)||void 0===t?void 0:t.find(t=>String(t.id)===String(e));r?a({jobs:[r],controllerStopped:o.controllerStopped||!1}):a({jobs:[],controllerStopped:o.controllerStopped||!1})}catch(e){console.error("Error fetching single managed job data:",e),a({jobs:[],controllerStopped:!1})}finally{c(!1)}})()},[e,t]),{jobData:o,loading:n}}async function p(e){let t,{jobId:o,controller:r=!1,signal:s,onNewLog:c}=e,i=Date.now(),l=new Promise(e=>{let o=()=>{let r=Date.now()-i;r>=3e4?e({timeout:!0}):t=setTimeout(o,3e4-r)};t=setTimeout(o,3e4)}),d=window.location.origin,u="".concat(d).concat(n.f4),h=(async()=>{try{let e=(await fetch("".concat(u,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:r,follow:!1,job_id:o,tail:1e4}),...s?{signal:s}:{}})).body.getReader();try{for(;;){let{done:t,value:o}=await e.read();if(t)break;i=Date.now();let r=new TextDecoder().decode(o);c(r)}}finally{if(!s||!s.aborted)try{e.cancel()}catch(e){"AbortError"!==e.name&&console.warn("Error canceling reader:",e)}t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),p=await Promise.race([h,l]);if(t&&clearTimeout(t),p.timeout){(0,a.C)("Log request for job ".concat(o," timed out after ").concat(30,"s of inactivity"),"warning");return}}async function g(e,t,o){let r="",s="",c="",i={};if("restartcontroller"===e)r="Restarting",s="restarted",c="jobs/queue/v2",i={all_users:!0,refresh:!0},t="controller";else throw Error("Invalid action: ".concat(e));(0,a.C)("".concat(r," job ").concat(t,"..."),"info");let l=window.location.origin,d="".concat(l).concat(n.f4);try{try{let e=(await fetch("".concat(d,"/").concat(c),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).headers.get("X-Skypilot-Request-ID"),l=await fetch("".concat(d,"/api/get?request_id=").concat(e));if(200===l.status)(0,a.C)("Job ".concat(t," ").concat(s," successfully."),"success");else if(500===l.status)try{let e=await l.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);s.type&&s.type===n.Bo?(0,a.C)("".concat(r," job ").concat(t," is not supported!"),"error",1e4):s.type&&s.type===n.mF?(0,a.C)("Cluster ".concat(o," does not exist."),"error"):s.type&&s.type===n.iW?(0,a.C)("Cluster ".concat(o," is not up."),"error"):(0,a.C)("".concat(r," job ").concat(t," failed: ").concat(s.type),"error")}catch(o){(0,a.C)("".concat(r," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,a.C)("".concat(r," job ").concat(t," failed with no details."),"error")}catch(e){(0,a.C)("".concat(r," job ").concat(t," failed with parse error."),"error")}else(0,a.C)("".concat(r," job ").concat(t," failed with status ").concat(l.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,a.C)("Network error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,a.C)("Critical error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}async function b(e){let{jobId:t=null,name:o=null,controller:r=!1}=e;try{let e=await c.x.fetch("/jobs/download_logs",{job_id:t,name:o,controller:r,refresh:!1}),s=Object.values(e||{});if(!s.length){(0,a.C)("No logs found to download.","warning");return}let i=window.location.origin,l="".concat(i).concat(n.f4,"/download"),d=await fetch("".concat(l,"?relative=items"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder_paths:s})});if(!d.ok){let e=await d.text();throw Error("Download failed: ".concat(d.status," ").concat(e))}let u=await d.blob(),h=window.URL.createObjectURL(u),p=document.createElement("a"),g=new Date().toISOString().replace(/[:.]/g,"-"),b=t?"job-".concat(t):o?"job-".concat(o):"job";p.href=h,p.download="managed-".concat(b,"-").concat(r?"controller-logs":"logs","-").concat(g,".zip"),document.body.appendChild(p),p.click(),p.remove(),window.URL.revokeObjectURL(h)}catch(e){console.error("Error downloading managed job logs:",e),(0,a.C)("Error downloading managed job logs: ".concat(e.message),"error")}}},15821:function(e,t,o){o.d(t,{C:function(){return r}});function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=document.getElementById("toast-container");r||((r=document.createElement("div")).id="toast-container",r.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(r));let a=document.createElement("div");switch(a.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":a.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":a.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":a.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:a.className+=" bg-blue-100 border-blue-500 text-blue-800"}return a.innerHTML='\n <div class="flex-1 mr-2">\n <p class="text-sm font-medium">'.concat(e,'</p>\n </div>\n <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n '),r.appendChild(a),a.querySelector("button").addEventListener("click",()=>{r.removeChild(a)}),setTimeout(()=>{r.contains(a)&&r.removeChild(a)},o),a}},6378:function(e,t,o){o.r(t),o.d(t,{DashboardCache:function(){return n},dashboardCache:function(){return s}});let r=o(51214).ej.DEFAULT_TTL;function a(e){let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t+e.charCodeAt(o);return t>>>0}class n{setPreloader(e){this.preloader=e}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.ttl||r,n=!1!==o.refreshOnAccess,s=this._generateKey(e,t),c=e.name||"anonymous",i=this.cache.get(s),l=Date.now();if(i&&l-i.lastUpdated<a){let o=Math.round((l-i.lastUpdated)/1e3);if(this._debug("Cache HIT for ".concat(c," (age: ").concat(o,"s, TTL: ").concat(Math.round(a/1e3),"s)")),n&&(this.cache.set(s,{data:i.data,lastUpdated:l}),this._debug("Cache TTL refreshed for ".concat(c))),!this.backgroundJobs.has(s)){var d;(null===(d=this.preloader)||void 0===d?void 0:d.wasRecentlyPreloaded(e,t))?this._debug("Skipping background refresh for ".concat(c," - recently preloaded")):this._refreshInBackground(e,t,s)}return i.data}if(this.pendingRequests.has(s))return this._debug("Request deduplication: Waiting for pending request for ".concat(c)),this.pendingRequests.get(s);let u=(async()=>{try{let o=await e(...t);if(o&&o.__skipCache){if(this._debug("Skip caching for ".concat(c," due to __skipCache flag on result")),i)return i.data;return o}return this.cache.set(s,{data:o,lastUpdated:Date.now()}),o}catch(e){if(i)return console.warn("Failed to fetch fresh data for ".concat(s,", returning stale data:"),e),i.data;throw e}finally{this.pendingRequests.delete(s)}})();return this.pendingRequests.set(s,u),u}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t);this.cache.delete(o),this.backgroundJobs.delete(o),this.pendingRequests.delete(o)}invalidateFunction(e){let t=a(e.toString()),o=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&o.push(e);o.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e),this.pendingRequests.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear(),this.pendingRequests.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[o,r]of this.cache.entries()){let a=e-r.lastUpdated;t.push({key:o,age:Math.round(a/1e3),lastUpdated:new Date(r.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(o),hasPendingRequest:this.pendingRequests.has(o)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,o=Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];this.debugMode&&console.log("[DashboardCache] ".concat(e),...o)}_refreshInBackground(e,t,o){this.backgroundJobs.set(o,!0),e(...t).then(e=>{e&&e.__skipCache||this.cache.set(o,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(o,":"),e)}).finally(()=>{this.backgroundJobs.delete(o)})}_generateKey(e,t){let o=a(e.toString()),r=t.length>0?JSON.stringify(t):"";return"".concat(o,"_").concat(r)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.pendingRequests=new Map,this.debugMode=!1,this.preloader=null}}let s=new n;t.default=s}}]);
@@ -0,0 +1,31 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9360,8640],{88507:function(e,s,t){t.d(s,{Z:function(){return r}});/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let r=(0,t(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"}]])},81260:function(e,s,t){t.d(s,{Z:function(){return r}});/**
7
+ * @license lucide-react v0.407.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */let r=(0,t(60998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},47603:function(e,s,t){t.d(s,{Z:function(){return r}});/**
12
+ * @license lucide-react v0.407.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */let r=(0,t(60998).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},28586:function(e,s,t){t.d(s,{Z:function(){return r}});/**
17
+ * @license lucide-react v0.407.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */let r=(0,t(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"}]])},43767:function(e,s,t){t.d(s,{Z:function(){return r}});/**
22
+ * @license lucide-react v0.407.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */let r=(0,t(60998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(85893),a=t(67294);let n=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[o,i]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s&&i(!1)},[s]),!s||o)return null;let c="string"==typeof s?s:n(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},82077:function(e,s,t){t.r(s),t.d(s,{Workspaces:function(){return z},getWorkspaceClusters:function(){return S},getWorkspaceManagedJobs:function(){return L}});var r=t(85893),a=t(67294),n=t(11163),l=t(17324),o=t(37673),i=t(68764),c=t(30803),d=t(55739),u=t(1272),m=t(50326);t(53850);var h=t(1812),x=t(13626),p=t(81260);/**
27
+ * @license lucide-react v0.407.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */let f=(0,t(60998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var g=t(47603),j=t(23001),v=t(47615),w=t(6378),k=t(51214),b=t(36856),y=t(47145),N=t(94545),C=t(93225),E=t(41664),_=t.n(E);async function S(e){try{return(await y.x.fetch("/status",{cluster_names:null,all_users:!0,include_credentials:!1,include_handle:!1,override_skypilot_config:{active_workspace:e}})).map(e=>({status:"UP"===e.status?"RUNNING":"STOPPED"===e.status?"STOPPED":"INIT"===e.status?"LAUNCHING":"TERMINATED",cluster:e.name,user:e.user_name,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:e.cloud,region:e.region,zone:e.zone,launched_at:e.launched_at,handle:e.handle,last_use:e.last_use,autostop:e.autostop,to_down:e.to_down,resources_str:e.resources_str,workspace:e.workspace||"default"})).filter(s=>s.workspace===e)}catch(s){return console.error("Error fetching clusters for workspace ".concat(e,":"),s),[]}}async function L(e){try{let s=(await y.x.post("/jobs/queue/v2",{all_users:!0,verbose:!0,skip_finished:!0,workspace_match:e,fields:["workspace","status"],override_skypilot_config:{active_workspace:e}})).headers.get("X-Skypilot-Request-ID"),t=await y.x.get("/api/get?request_id=".concat(s)),r=await t.json(),a=r.return_value?JSON.parse(r.return_value):{jobs:[]};return a.jobs&&(a.jobs=a.jobs.map(e=>({...e,workspace:e.workspace||"default"})),a.jobs=a.jobs.filter(s=>s.workspace===e)),a}catch(s){return console.error("Error fetching managed jobs for workspace ".concat(e,":"),s),{jobs:[]}}}let Z=e=>{let{isPrivate:s}=e;return s?(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})};function z(){let[e,s]=(0,a.useState)([]),[t,E]=(0,a.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[z,M]=(0,a.useState)(!0),[R,D]=(0,a.useState)(null),[O,T]=(0,a.useState)({key:"name",direction:"asc"}),[W,P]=(0,a.useState)(""),[F,A]=(0,a.useState)(!1),[J,I]=(0,a.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[q,V]=(0,a.useState)({open:!1,message:"",userName:""}),[B,H]=(0,a.useState)(null),[X,U]=(0,a.useState)(!1),[G,K]=(0,a.useState)(null),[$,Q]=(0,a.useState)(null),Y=(0,n.useRouter)(),ee=(0,j.X)(),es=async()=>{if(B&&Date.now()-B.timestamp<3e5)return B;U(!0);try{let e=await y.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,timestamp:Date.now()};return H(t),U(!1),t}catch(e){throw U(!1),e}},et=async(e,s)=>{try{let t=await es();if("admin"!==t.role)return V({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),V({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},er=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&M(!0);try{let e=await w.default.get(l.getWorkspaces);D(e);let t=Object.keys(e),r=t.map(async e=>{let[s,t,r]=await Promise.all([w.default.get(l.getEnabledClouds,[e]),w.default.get(S,[e]),w.default.get(L,[e])]);return{workspaceName:e,enabledClouds:s,clusters:t||[],managedJobs:r||{jobs:[]}}}),a=await Promise.all(r),n=[],o=[],i={};a.forEach(e=>{let{workspaceName:s,enabledClouds:t,clusters:r,managedJobs:a}=e;r.forEach(e=>{n.push(e)}),a.jobs.forEach(e=>{o.push(e)}),i[s]=t}),Object.fromEntries(n.map(e=>[e.cluster,e.workspace||"default"]));let c={};t.forEach(e=>{c[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let d=0;n.forEach(e=>{let s=e.workspace||"default";c[s]||(c[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),c[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(c[s].runningClusterCount++,d++),e.cloud&&c[s].clouds.add(e.cloud)});let u=new Set(v.statusGroups.active),m=0;(o||[]).forEach(e=>{let s=e.workspace||"default";c[s]&&u.has(e.status)&&c[s].managedJobsCount++,u.has(e.status)&&m++});let h=Object.values(c).filter(e=>t.includes(e.name)).map(e=>{let s=Array.isArray(i[e.name])?i[e.name]:[];return{...e,clouds:s}}).sort((e,s)=>e.name.localeCompare(s.name));s(h),E({runningClusters:d,totalClusters:n.length,managedJobs:m})}catch(e){console.error("Error fetching workspace data:",e),s([]),E({runningClusters:0,totalClusters:0,managedJobs:0})}e&&M(!1)};(0,a.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),er(!0)})();let e=setInterval(()=>{"visible"===window.document.visibilityState&&er(!1)},k.nb.REFRESH_INTERVAL);return()=>clearInterval(e)},[]);let ea=e=>{let s="asc";O.key===e&&"asc"===O.direction&&(s="desc"),T({key:e,direction:s})},en=e=>O.key===e?"asc"===O.direction?" ↑":" ↓":"",el=a.useMemo(()=>{if(!e)return[];let s=e;if(W&&""!==W.trim()){let t=W.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(t)||e.clouds.some(e=>{let s=C.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(t)||s.toLowerCase().includes(t)}))||!!(!0===((null==R?void 0:R[e.name])||{}).private?"private":"public").includes(t))}return(0,N.R0)(s,O.key,O.direction)},[e,O,W,R]),eo=e=>{et("cannot delete workspace",()=>{I({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},ei=async()=>{if(J.workspaceToDelete){I(e=>({...e,deleting:!0,error:null}));try{await (0,l.zl)(J.workspaceToDelete),Q('Workspace "'.concat(J.workspaceToDelete,'" deleted successfully!')),I({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),w.default.invalidate(l.getWorkspaces),w.default.invalidateFunction(S),w.default.invalidateFunction(L),await er(!0)}catch(e){console.error("Error deleting workspace:",e),I(e=>({...e,deleting:!1,error:null})),K(e)}}},ec=()=>{I({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},ed=e=>{et("cannot edit workspace",()=>{Y.push("/workspaces/".concat(e))})};return z&&0===e.length?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(d.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[$&&(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:$})})]}),(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsxs)("button",{type:"button",onClick:()=>Q(null),className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})]})}),(0,r.jsx)(h.X,{error:G,title:"Error",onDismiss:()=>K(null)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,r.jsx)("div",{className:"text-base flex items-center",children:(0,r.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[z&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(d.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,r.jsxs)("button",{onClick:()=>{w.default.invalidate(l.getWorkspaces),w.default.invalidateFunction(l.getEnabledClouds),w.default.invalidateFunction(S),w.default.invalidateFunction(L),er(!0)},disabled:z,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(x.Z,{className:"h-4 w-4 mr-1.5"}),!ee&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,r.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:W,onChange:e=>P(e.target.value),className:"h-8 w-full px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),W&&(0,r.jsx)("button",{onClick:()=>P(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("button",{onClick:()=>{et("cannot create workspace",()=>{Y.push("/workspace/new")})},disabled:X,className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Workspace",children:X?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{children:"Create Workspace"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),0!==e.length||z?(0,r.jsx)(o.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(i.iA,{className:"min-w-full",children:[(0,r.jsx)(i.xD,{children:(0,r.jsxs)(i.SC,{children:[(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("name"),children:["Workspace",en("name")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("totalClusterCount"),children:["Clusters ",en("totalClusterCount")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("managedJobsCount"),children:["Jobs",en("managedJobsCount")]}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Enabled infra"}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,r.jsx)(i.RM,{children:z&&0===el.length?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(d.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):el.length>0?el.map(e=>{let s=!0===((null==R?void 0:R[e.name])||{}).private;return(0,r.jsxs)(i.SC,{className:"hover:bg-gray-50",children:[(0,r.jsxs)(i.pj,{className:"",children:[(0,r.jsx)("button",{onClick:()=>ed(e.name),disabled:X,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)(Z,{isPrivate:s})})]}),(0,r.jsx)(i.pj,{children:(0,r.jsxs)("button",{onClick:()=>{Y.push({pathname:"/clusters",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:[e.runningClusterCount," running,"," ",e.totalClusterCount," total"]})}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{Y.push({pathname:"/jobs",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.managedJobsCount})}),(0,r.jsx)(i.pj,{children:e.clouds.length>0?[...e.clouds].sort().map((s,t)=>{let a=C.Z2[s.toLowerCase()]||s;return(0,r.jsxs)("span",{children:[(0,r.jsx)(_(),{href:"/infra",className:"inline-flex items-center px-2 py-1 rounded text-sm bg-sky-100 text-sky-800 hover:bg-sky-200 hover:text-sky-900 transition-colors duration-200",children:a}),t<e.clouds.length-1&&" "]},s)}):(0,r.jsx)("span",{className:"text-gray-500 text-sm",children:"-"})}),(0,r.jsxs)(i.pj,{children:[(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>ed(e.name),disabled:X,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,r.jsx)(f,{className:"w-4 h-4"})}),(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>eo(e.name),disabled:"default"===e.name||X,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,r.jsx)(g.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No workspaces found"})})})]})})}):(0,r.jsxs)("div",{className:"text-center py-10",children:[(0,r.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),R&&(0,r.jsx)(m.Vq,{open:F,onOpenChange:A,children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,r.jsx)(m.fK,{children:(0,r.jsx)(m.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,r.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:u.ZP.dump(R,{indent:2})})})]})}),(0,r.jsx)(m.Vq,{open:q.open,onOpenChange:e=>{V(s=>({...s,open:e})),e||K(null)},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Permission Denied"}),(0,r.jsx)(m.Be,{children:X?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(d.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:q.userName?(0,r.jsxs)(r.Fragment,{children:[q.userName," is logged in as non-admin and ",q.message,"."]}):q.message})})]}),(0,r.jsx)(m.cN,{children:(0,r.jsx)(c.z,{variant:"outline",onClick:()=>V(e=>({...e,open:!1})),disabled:X,children:"OK"})})]})}),(0,r.jsx)(m.Vq,{open:J.confirmOpen,onOpenChange:e=>{e||(ec(),K(null))},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Delete Workspace"}),(0,r.jsxs)(m.Be,{children:['Are you sure you want to delete workspace "',J.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,r.jsxs)(m.cN,{children:[(0,r.jsx)(c.z,{variant:"outline",onClick:ec,disabled:J.deleting,children:"Cancel"}),(0,r.jsx)(c.z,{variant:"destructive",onClick:ei,disabled:J.deleting,children:J.deleting?"Deleting...":"Delete"})]})]})})]})}k.nb.REFRESH_INTERVAL},23001:function(e,s,t){t.d(s,{X:function(){return a}});var r=t(67294);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}},12003:function(e,s,t){t.d(s,{j:function(){return l}});var r=t(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=r.W,l=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=s,i=Object.keys(l).map(e=>{let s=null==t?void 0:t[e],r=null==o?void 0:o[e];if(null===s)return null;let n=a(s)||a(r);return l[e][n]}),c=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return n(e,i,null==s?void 0:null===(r=s.compoundVariants)||void 0===r?void 0:r.reduce((e,s)=>{let{class:t,className:r,...a}=s;return Object.entries(a).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...o,...c}[s]):({...o,...c})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
@@ -0,0 +1,16 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9826,2350],{94966:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]/[job]",function(){return s(50190)}])},27325:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let a=(0,s(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"}]])},16826:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
7
+ * @license lucide-react v0.407.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */let a=(0,s(60998).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},13626:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
12
+ * @license lucide-react v0.407.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */let a=(0,s(60998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},99307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return l},OE:function(){return d}});var a=s(85893);s(67294);var r=s(55739),n=s(36989),c=s(53850);let l=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"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":case"PROVISIONING":case"SHUTTING_DOWN":return(0,a.jsx)(r.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,a.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,a.jsx)(c.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,a.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,a.jsx)(c.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,a.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=l(e),s=o(e);return(0,a.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t}=e;return(0,a.jsx)(n.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,a.jsx)("span",{children:i(t)})})}},20546:function(e,t,s){"use strict";s.d(t,{H:function(){return d}});var a=s(85893);s(67294);var r=s(41664),n=s.n(r),c=s(45697),l=s.n(c);function o(e){return!!e&&"string"==typeof e&&e.toLowerCase().startsWith("sa-")}let i=()=>(0,a.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium ml-1",children:"SA"}),d=e=>{let{username:t,userHash:s,className:r="flex items-center gap-1",linkClassName:c="text-gray-700 hover:text-blue-600 hover:underline",showBadge:l=!0}=e,d=o(s),u=o(s)?"/users?tab=service-accounts":"/users";return(0,a.jsxs)("div",{className:r,children:[(0,a.jsx)(n(),{href:u,className:c,children:t}),l&&d&&(0,a.jsx)(i,{})]})};d.propTypes={username:l().string.isRequired,userHash:l().string,className:l().string,linkClassName:l().string,showBadge:l().bool}},37673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return i},Zb:function(){return o},aY:function(){return h},ll:function(){return d}});var a=s(85893),r=s(67294),n=s(45697),c=s.n(n),l=s(32350);let o=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n,children:r})});o.displayName="Card",o.propTypes={className:c().string,children:c().node};let i=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...n,children:r})});i.displayName="CardHeader",i.propTypes={className:c().string,children:c().node};let d=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n,children:r})});d.displayName="CardTitle",d.propTypes={className:c().string,children:c().node};let u=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",s),...n,children:r})});u.displayName="CardDescription",u.propTypes={className:c().string,children:c().node};let h=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",s),...n,children:r})});h.displayName="CardContent",h.propTypes={className:c().string,children:c().node};let m=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",s),...n,children:r})});m.displayName="CardFooter",m.propTypes={className:c().string,children:c().node}},47145:function(e,t,s){"use strict";s.d(t,{x:function(){return r}});var a=s(93225);let r={fetch:async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",r=window.location.origin,n="".concat(r).concat(a.f4).concat(e),c=await fetch(n,{method:s,headers:"POST"===s?{"Content-Type":"application/json"}:{},body:"POST"===s?JSON.stringify(t):void 0}),l=c.headers.get("X-Skypilot-Request-ID")||c.headers.get("X-Request-ID"),o=await fetch("".concat(r).concat(a.f4,"/api/get?request_id=").concat(l)),i=await o.json();return i.return_value?JSON.parse(i.return_value):[]},post:async(e,t)=>{let s=window.location.origin,r="".concat(s).concat(a.f4).concat(e);return await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},stream:async(e,t,s)=>{let a=(await r.post(e,t)).body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;let r=new TextDecoder().decode(t);s(r)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let t=window.location.origin,s="".concat(t).concat(a.f4).concat(e);return await fetch(s)}}},23266:function(e,t,s){"use strict";s.d(t,{GH:function(){return h},QL:function(){return f},Sl:function(){return u},getClusters:function(){return i},uR:function(){return d}});var a=s(67294),r=s(15821),n=s(47145),c=s(93225),l=s(6378);let o={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function i(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await n.x.fetch("/status",{cluster_names:e,all_users:!0,include_credentials:!1,include_handle:!1,summary_response:null==e})).map(e=>{let t="",s=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let s=Math.floor((t-3)/2),a=s+(t-3)%2;return 0===s?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-s)}(t,25)),{status:o[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:s?"".concat(e.cloud," (").concat(s,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,last_event:e.last_event,to_down:e.to_down,cluster_name_on_cloud:e.cluster_name_on_cloud,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;try{let s={days:t,dashboard_summary_response:!0};e&&(s.cluster_hashes=[e]);let a=await n.x.fetch("/cost_report",s);console.log("Raw cluster history data:",a);let r=a.map(e=>{let t="Unknown";e.cloud?t=e.cloud:e.resources&&e.resources.cloud&&(t=e.resources.cloud);let s=e.user_name||"-";return{status:e.status?o[e.status]:"TERMINATED",cluster:e.name,user:s,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:t,region:"",infra:t,full_infra:t,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:e.launched_at?new Date(1e3*e.launched_at):null,num_nodes:e.num_nodes||1,duration:e.duration,total_cost:e.total_cost,workspace:e.workspace||"default",autostop:-1,last_event:e.last_event,to_down:!1,cluster_name_on_cloud:null,usage_intervals:e.usage_intervals,command:e.last_creation_command||"",task_yaml:e.last_creation_yaml||"{}",events:[{time:e.launched_at?new Date(1e3*e.launched_at):new Date,event:"Cluster created."}]}});return console.log("Processed cluster history data:",r),r}catch(e){return console.error("Error fetching cluster history:",e),[]}}async function u(e){let{clusterName:t,jobId:s,onNewLog:a,workspace:c}=e;try{await n.x.stream("/logs",{follow:!1,cluster_name:t,job_id:s,tail:1e4,override_skypilot_config:{active_workspace:c||"default"}},a)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,r.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function h(e){let{clusterName:t,jobIds:s=null,workspace:a}=e;try{let e=await n.x.fetch("/download_logs",{cluster_name:t,job_ids:s?s.map(String):null,override_skypilot_config:{active_workspace:a||"default"}}),l=Object.values(e||{});if(!l.length){(0,r.C)("No logs found to download.","warning");return}let o=window.location.origin,i="".concat(o).concat(c.f4,"/download"),d=await fetch("".concat(i,"?relative=items"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder_paths:l})});if(!d.ok){let e=await d.text();throw Error("Download failed: ".concat(d.status," ").concat(e))}let u=await d.blob(),h=window.URL.createObjectURL(u),m=document.createElement("a"),f=new Date().toISOString().replace(/[:.]/g,"-"),g=s&&1===s.length?"job-".concat(s[0]):"jobs";m.href=h,m.download="".concat(t,"-").concat(g,"-logs-").concat(f,".zip"),document.body.appendChild(m),m.click(),m.remove(),window.URL.revokeObjectURL(h)}catch(e){console.error("Error downloading logs:",e),(0,r.C)("Error downloading logs: ".concat(e.message),"error")}}async function m(e){let{clusterName:t,workspace:s}=e;try{return(await n.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:s}})).map(e=>{var a;let r=e.end_at?e.end_at:Date.now()/1e3,n=0,c=0;return e.submitted_at&&(n=r-e.submitted_at),e.start_at&&(c=r-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,user_hash:e.user_hash,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:n,job_duration:c,infra:"",logs:"",workspace:s||"default",git_commit:(null===(a=e.metadata)||void 0===a?void 0:a.git_commit)||"-"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function f(e){let{cluster:t,job:s=null}=e,[r,n]=(0,a.useState)(null),[c,o]=(0,a.useState)(null),[d,u]=(0,a.useState)(!0),[h,f]=(0,a.useState)(!0),g=(0,a.useCallback)(async()=>{if(t)try{u(!0);let e=await l.default.get(i,[{clusterNames:[t]}]);return n(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{u(!1)}return null},[t]),x=(0,a.useCallback)(async e=>{if(t)try{f(!0);let s=await l.default.get(m,[{clusterName:t,workspace:e||"default"}]);o(s)}catch(e){console.error("Error fetching cluster job data:",e)}finally{f(!1)}},[t]),p=(0,a.useCallback)(async()=>{l.default.invalidate(i,[{clusterNames:[t]}]);let e=await g();e&&(l.default.invalidate(m,[{clusterName:t,workspace:e.workspace||"default"}]),await x(e.workspace))},[g,x,t]),N=(0,a.useCallback)(async()=>{r&&(l.default.invalidate(m,[{clusterName:t,workspace:r.workspace||"default"}]),await x(r.workspace))},[x,r,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await g();e&&x(e.workspace)})()},[t,s,g,x]),{clusterData:r,clusterJobData:c,loading:d,clusterDetailsLoading:d,clusterJobsLoading:h,refreshData:p,refreshClusterJobsOnly:N}}},15821:function(e,t,s){"use strict";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,a=document.getElementById("toast-container");a||((a=document.createElement("div")).id="toast-container",a.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(a));let r=document.createElement("div");switch(r.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":r.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":r.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":r.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:r.className+=" bg-blue-100 border-blue-500 text-blue-800"}return r.innerHTML='\n <div class="flex-1 mr-2">\n <p class="text-sm font-medium">'.concat(e,'</p>\n </div>\n <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n '),a.appendChild(r),r.querySelector("button").addEventListener("click",()=>{a.removeChild(r)}),setTimeout(()=>{a.contains(r)&&a.removeChild(r)},s),r}s.d(t,{C:function(){return a}})},6378:function(e,t,s){"use strict";s.r(t),s.d(t,{DashboardCache:function(){return n},dashboardCache:function(){return c}});let a=s(51214).ej.DEFAULT_TTL;function r(e){let t=5381;for(let s=0;s<e.length;s++)t=(t<<5)+t+e.charCodeAt(s);return t>>>0}class n{setPreloader(e){this.preloader=e}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=s.ttl||a,n=!1!==s.refreshOnAccess,c=this._generateKey(e,t),l=e.name||"anonymous",o=this.cache.get(c),i=Date.now();if(o&&i-o.lastUpdated<r){let s=Math.round((i-o.lastUpdated)/1e3);if(this._debug("Cache HIT for ".concat(l," (age: ").concat(s,"s, TTL: ").concat(Math.round(r/1e3),"s)")),n&&(this.cache.set(c,{data:o.data,lastUpdated:i}),this._debug("Cache TTL refreshed for ".concat(l))),!this.backgroundJobs.has(c)){var d;(null===(d=this.preloader)||void 0===d?void 0:d.wasRecentlyPreloaded(e,t))?this._debug("Skipping background refresh for ".concat(l," - recently preloaded")):this._refreshInBackground(e,t,c)}return o.data}if(this.pendingRequests.has(c))return this._debug("Request deduplication: Waiting for pending request for ".concat(l)),this.pendingRequests.get(c);let u=(async()=>{try{let s=await e(...t);if(s&&s.__skipCache){if(this._debug("Skip caching for ".concat(l," due to __skipCache flag on result")),o)return o.data;return s}return this.cache.set(c,{data:s,lastUpdated:Date.now()}),s}catch(e){if(o)return console.warn("Failed to fetch fresh data for ".concat(c,", returning stale data:"),e),o.data;throw e}finally{this.pendingRequests.delete(c)}})();return this.pendingRequests.set(c,u),u}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=this._generateKey(e,t);this.cache.delete(s),this.backgroundJobs.delete(s),this.pendingRequests.delete(s)}invalidateFunction(e){let t=r(e.toString()),s=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&s.push(e);s.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e),this.pendingRequests.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear(),this.pendingRequests.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[s,a]of this.cache.entries()){let r=e-a.lastUpdated;t.push({key:s,age:Math.round(r/1e3),lastUpdated:new Date(a.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(s),hasPendingRequest:this.pendingRequests.has(s)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,s=Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];this.debugMode&&console.log("[DashboardCache] ".concat(e),...s)}_refreshInBackground(e,t,s){this.backgroundJobs.set(s,!0),e(...t).then(e=>{e&&e.__skipCache||this.cache.set(s,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(s,":"),e)}).finally(()=>{this.backgroundJobs.delete(s)})}_generateKey(e,t){let s=r(e.toString()),a=t.length>0?JSON.stringify(t):"";return"".concat(s,"_").concat(a)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.pendingRequests=new Map,this.debugMode=!1,this.preloader=null}}let c=new n;t.default=c},32350:function(e,t,s){"use strict";s.d(t,{cn:function(){return n}});var a=s(90512),r=s(98388);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.m6)((0,a.W)(t))}},50190:function(e,t,s){"use strict";s.r(t),s.d(t,{JobDetailPage:function(){return w}});var a=s(85893),r=s(67294);s(9353);var n=s(37673),c=s(41664),l=s.n(c),o=s(11163),i=s(23266),d=s(36989),u=s(13626),h=s(16826),m=s(55739),f=s(99307),g=s(23001),x=s(9008),p=s.n(x),N=s(20546),b=s(70282),_=s(27325);function y(e){let{cluster:t,job:s,jobData:r,onRefresh:n,isRefreshing:c,loading:o}=e,i=(0,g.X)();return(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(l(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(l(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsxs)(l(),{href:"/clusters/".concat(t,"/").concat(s),className:"text-sky-blue hover:underline",children:[s,r.job&&"-"!=r.job?" (".concat(r.job,")"):""]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[(o||c)&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(m.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"text-sm ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsx)(d.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,a.jsxs)("button",{onClick:n,disabled:o||c,className:"text-sm text-sky-blue hover:text-sky-blue-bright font-medium mx-2 flex items-center",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),!i&&(0,a.jsx)("span",{children:"Refresh"})]})})]})]})}function w(){let e=(0,o.useRouter)(),{cluster:t,job:s}=e.query,{clusterData:c,clusterJobData:g,loading:x,refreshData:w}=(0,i.QL)({cluster:t}),[j,v]=(0,r.useState)(!1),[E,k]=(0,r.useState)(!0),[I,C]=(0,r.useState)(!1),[R,D]=(0,r.useState)(""),[L,T]=(0,r.useState)(!1),[S,O]=(0,r.useState)(!1),A=(0,r.useMemo)(()=>["INIT","PENDING","SETTING_UP"],[]),P=(0,r.useMemo)(()=>{if(!g||!s)return!0;let e=g.find(e=>e.id==s);return e&&A.includes(e.status)},[g,s,A]);r.useEffect(()=>{!x&&E&&k(!1)},[x,E]),(0,r.useEffect)(()=>{let e=!0;return t&&s&&!P?(C(!0),(0,i.Sl)({clusterName:t,jobId:s,onNewLog:t=>{e&&D(e=>{let s=t.split("\n").filter(e=>e.trim()),a=e;for(let e of s){let t=(0,d.Zn)(e);if(/\d+%\s*\|/.test(t)){let e=t.match(/^\(([^)]+)\)/);if(e&&a){let s=a.split("\n"),r=!1;for(let n=s.length-1;n>=0;n--){let c=s[n];if(/\d+%\s*\|/.test(c)){let l=c.match(/^\(([^)]+)\)/);if(l&&l[1]===e[1]){s[n]=t,a=s.join("\n"),r=!0;break}}}r||(a+=(a?"\n":"")+t)}else a+=(a?"\n":"")+t}else a+=(a?"\n":"")+t}return a})},workspace:null==c?void 0:c.workspace}).then(()=>{e&&C(!1)}).catch(t=>{e&&(console.error("Error streaming logs:",t),C(!1))})):C(!1),()=>{e=!1}},[t,s,L,P,c]);let U=async()=>{v(!0),T(e=>!e),D("");try{w&&await w()}catch(e){console.error("Error refreshing data:",e)}finally{v(!1)}};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let J={id:s};if(c&&g){let e=g.find(e=>e.id==s);e&&(J={...e,infra:c.infra,cluster:c.cluster,user:c.user,user_hash:c.user_hash})}let q=t&&s?"Job: ".concat(s," @ ").concat(t," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p(),{children:(0,a.jsx)("title",{children:q})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{cluster:t,job:s,jobData:J,onRefresh:U,isRefreshing:j,loading:x}),x&&E?(0,a.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,a.jsx)(m.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsx)("div",{id:"details",children:(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job ID"}),(0,a.jsx)("div",{className:"text-base mt-1",children:J.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:J.job})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(f.OE,{status:J.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(N.H,{username:J.user,userHash:J.user_hash})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Submitted"}),(0,a.jsx)("div",{className:"text-base mt-1",children:J.submitted_at?(0,d.xn)(J.submitted_at):"N/A"})]}),J.resources&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:J.resources||"N/A"})]}),J.cluster&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(l(),{href:"/clusters/".concat(J.cluster),className:"text-sky-blue hover:underline",children:J.cluster})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Git Commit"}),(0,a.jsx)("div",{className:"text-base mt-1 flex items-center",children:J.git_commit&&"-"!==J.git_commit?(0,a.jsxs)("span",{className:"flex items-center mr-2",children:[J.git_commit,(0,a.jsx)(d.WH,{content:S?"Copied!":"Copy commit",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:async()=>{await navigator.clipboard.writeText(J.git_commit),O(!0),setTimeout(()=>O(!1),2e3)},className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:S?(0,a.jsx)(b.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(_.Z,{className:"w-4 h-4"})})})]}):(0,a.jsx)("span",{className:"text-gray-400",children:"-"})})]})]})})]})}),(0,a.jsx)("div",{id:"logs",className:"mt-6",children:(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Logs"}),(0,a.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)(d.WH,{content:"Download full logs",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:()=>(0,i.GH)({clusterName:t,jobIds:s?[s]:null,workspace:null==c?void 0:c.workspace}),className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,a.jsx)(h.Z,{className:"w-4 h-4"})})}),(0,a.jsx)(d.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:()=>{T(e=>!e),D("")},disabled:I,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,a.jsx)(u.Z,{className:"w-4 h-4 ".concat(I?"animate-spin":"")})})})]})]}),(0,a.jsx)("div",{className:"p-4",children:P?(0,a.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,a.jsx)("span",{children:"Waiting for the job to start; refresh in a few moments."})}):I?(0,a.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,a.jsx)(m.Z,{size:20,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,a.jsx)(d.$B,{logs:R})})})]})})]})]})]})}t.default=w},9008:function(e,t,s){e.exports=s(37219)}},function(e){e.O(0,[616,6130,5739,7411,6989,3850,9353,2888,9774,179],function(){return e(e.s=94966)}),_N_E=e.O()}]);