meshy-node 0.3.4 → 0.3.5

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.
@@ -1,4 +1,4 @@
1
- import{c as k,j as e,i as u,a3 as B,r as a,aY as G,aX as J,A as Q,D as W,g as ee,aZ as se,B as D}from"./index-D8EsMsvI.js";import{I as re}from"./input-Cdu3B_SQ.js";/**
1
+ import{c as k,j as e,i as u,a4 as B,r as a,aZ as J,aY as Q,E as W,D as X,g as ee,a_ as se,B as D}from"./index-Cpz4J5-T.js";import{I as re}from"./input-BRIa-GWn.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -23,4 +23,4 @@ import{c as k,j as e,i as u,a3 as B,r as a,aY as G,aX as J,A as Q,D as W,g as ee
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const de=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ue=k("settings-2",de),xe={getOutput:J,createPreviewSession:G};function ve({taskId:s,api:n=xe,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,h]=a.useState(""),[P,y]=a.useState(!1),[V,C]=a.useState(!0),[j,m]=a.useState(null),[X,E]=a.useState(!1),_=a.useCallback(async()=>{C(!0),m(null),c(null),v(null),p(null);try{const t=await n.getOutput(s);c(t),C(!1)}catch(t){m(t instanceof Error?t.message:"Failed to load output"),C(!1)}},[n,s]);a.useEffect(()=>{_()},[_]);const w=a.useCallback(async t=>{m(null);try{const o=await n.createPreviewSession(s,t!=null&&t.path?{path:t.path}:void 0);v(o),y(!1),t&&p(t)}catch(o){m(o instanceof Error?o.message:"Failed to create preview session")}},[n,s]),S=a.useCallback(async t=>{const o=t??Number.parseInt(b,10);if(!Number.isInteger(o)||o<1||o>65535){m("Enter a port between 1 and 65535");return}m(null);try{const M=await n.createPreviewSession(s,{port:o});v(M),p(null),h(String(o)),y(!0)}catch(M){m(M instanceof Error?M.message:"Failed to create preview session")}},[n,b,s]),g=a.useMemo(()=>R(i),[i]);a.useEffect(()=>{if(P||!(i!=null&&i.available)||g.length===0||r&&r.kind!=="service")return;const t=d??g[0];t&&w(t)},[d,i,g,P,r,w]);const f=a.useCallback(()=>{if((r==null?void 0:r.kind)==="service"&&typeof r.port=="number"){S(r.port);return}v(null);const t=d??R(i)[0];t&&w(t)},[d,i,r,S,w]);if(a.useEffect(()=>{if(!r)return;const t=r.expiresAt-Date.now()-5e3;if(t<=0){f();return}const o=window.setTimeout(f,t);return()=>window.clearTimeout(o)},[f,r]),V)return e.jsx(N,{children:"Loading preview..."});const x=l&&P;if(j&&r&&!x)return e.jsx(N,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:j}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:f,className:"rounded-full",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const $=!!(i!=null&&i.available);if(!$&&!l)return e.jsx(N,{children:"Task output is not available yet."});if(!r)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:null,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>y(t=>!t),onServicePortChange:h,onServiceStart:()=>void S()}),!x&&e.jsx(U,{entries:g,activeEntry:d,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:null,error:j}):e.jsx(N,{children:j?e.jsx("span",{className:"text-sm text-destructive",children:j}):$?g.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const A=K(r),Y=q(r),F=he(r),T=r.kind==="service"?r:null,Z=x?T:r,L=e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:F,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:Z,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>y(t=>!t),onServicePortChange:h,onServiceStart:()=>void S()}),!x&&e.jsx(U,{entries:g,activeEntry:d,previewKind:r.kind,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:T,error:j,children:T?L:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:L})}),e.jsx(Q,{open:X,onOpenChange:E,children:e.jsxs(W,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(ee,{className:"sr-only",children:["Preview: ",A]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:A}),e.jsx("span",{className:"text-xs text-muted-foreground",children:O(r.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:f,title:"Refresh",children:e.jsx(z,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:Y,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(se,{asChild:!0,children:e.jsxs(u,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:F,title:"Task Preview Fullscreen"})})]})})]})}function R(s){var i,c;const n=((i=s==null?void 0:s.summary)==null?void 0:i.htmlEntries)??[],l=((c=s==null?void 0:s.summary)==null?void 0:c.markdownEntries)??[];return[...n.map(r=>({...r,kind:"html"})),...l.map(r=>({...r,kind:"markdown"}))]}function U({entries:s,activeEntry:n,previewKind:l,onEntrySelect:i}){return e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.map(c=>{const r=(n==null?void 0:n.path)===c.path;return e.jsx("button",{type:"button",onClick:()=>i(c),className:r?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:c.label},`${c.kind}:${c.path}`)}),e.jsxs(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[s.length," ",s.length===1?"file":"files"]}),e.jsx(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l==="service"?"Service proxy":"Sandboxed iframe"})]})})}function H({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:i,onRefresh:c,onFullscreen:r,onServiceModeToggle:v,onServicePortChange:d,onServiceStart:p}){const b=s?q(s):null;return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-3",children:n&&d&&p?e.jsxs("form",{className:"flex min-w-0 items-center gap-2",onSubmit:h=>{h.preventDefault(),p()},children:[e.jsx("span",{className:"shrink-0 text-sm font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Port",e.jsx(re,{type:"number",min:1,max:65535,inputMode:"numeric",value:i??"",onChange:h=>d(h.target.value),placeholder:"12345","aria-label":"Service preview port",className:"h-7 w-24 rounded-full px-3 text-xs"})]}),e.jsxs(u,{type:"submit",variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-xs",children:[e.jsx(ce,{className:"h-3.5 w-3.5"}),"Run"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s?K(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(z,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:b??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:r,title:"Fullscreen",children:e.jsx(ne,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(u,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:v,className:"h-7 shrink-0 rounded-full px-2.5 text-xs",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function I({serviceSession:s,error:n,children:l}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:n}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&l?e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:l}):e.jsx(N,{children:"No service preview running."})})]})}function q(s){return s.openUrl??s.previewUrl}function he(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function K(s){if(s.kind==="service"&&typeof s.port=="number"){const n=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${n}`}return s.entryPath}function N({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function O(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),i=n%60;return`${l}m ${i}s`}export{H as PreviewHeader,I as PreviewServicePanel,ve as PreviewTab,U as PreviewToolbar,he as getPreviewIframeSandbox,q as getPreviewOpenUrl};
26
+ */const de=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ue=k("settings-2",de),xe={getOutput:Q,createPreviewSession:J};function ve({taskId:s,api:n=xe,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,h]=a.useState(""),[P,y]=a.useState(!1),[V,E]=a.useState(!0),[j,m]=a.useState(null),[Y,C]=a.useState(!1),_=a.useCallback(async()=>{E(!0),m(null),c(null),v(null),p(null);try{const t=await n.getOutput(s);c(t),E(!1)}catch(t){m(t instanceof Error?t.message:"Failed to load output"),E(!1)}},[n,s]);a.useEffect(()=>{_()},[_]);const w=a.useCallback(async t=>{m(null);try{const o=await n.createPreviewSession(s,t!=null&&t.path?{path:t.path}:void 0);v(o),y(!1),t&&p(t)}catch(o){m(o instanceof Error?o.message:"Failed to create preview session")}},[n,s]),S=a.useCallback(async t=>{const o=t??Number.parseInt(b,10);if(!Number.isInteger(o)||o<1||o>65535){m("Enter a port between 1 and 65535");return}m(null);try{const M=await n.createPreviewSession(s,{port:o});v(M),p(null),h(String(o)),y(!0)}catch(M){m(M instanceof Error?M.message:"Failed to create preview session")}},[n,b,s]),g=a.useMemo(()=>R(i),[i]);a.useEffect(()=>{if(P||!(i!=null&&i.available)||g.length===0||r&&r.kind!=="service")return;const t=d??g[0];t&&w(t)},[d,i,g,P,r,w]);const f=a.useCallback(()=>{if((r==null?void 0:r.kind)==="service"&&typeof r.port=="number"){S(r.port);return}v(null);const t=d??R(i)[0];t&&w(t)},[d,i,r,S,w]);if(a.useEffect(()=>{if(!r)return;const t=r.expiresAt-Date.now()-5e3;if(t<=0){f();return}const o=window.setTimeout(f,t);return()=>window.clearTimeout(o)},[f,r]),V)return e.jsx(N,{children:"Loading preview..."});const x=l&&P;if(j&&r&&!x)return e.jsx(N,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:j}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:f,className:"rounded-full",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const $=!!(i!=null&&i.available);if(!$&&!l)return e.jsx(N,{children:"Task output is not available yet."});if(!r)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:null,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>C(!0),onServiceModeToggle:()=>y(t=>!t),onServicePortChange:h,onServiceStart:()=>void S()}),!x&&e.jsx(U,{entries:g,activeEntry:d,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:null,error:j}):e.jsx(N,{children:j?e.jsx("span",{className:"text-sm text-destructive",children:j}):$?g.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const F=K(r),Z=q(r),A=he(r),T=r.kind==="service"?r:null,G=x?T:r,L=e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:A,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:G,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>C(!0),onServiceModeToggle:()=>y(t=>!t),onServicePortChange:h,onServiceStart:()=>void S()}),!x&&e.jsx(U,{entries:g,activeEntry:d,previewKind:r.kind,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:T,error:j,children:T?L:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:L})}),e.jsx(W,{open:Y,onOpenChange:C,children:e.jsxs(X,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(ee,{className:"sr-only",children:["Preview: ",F]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:F}),e.jsx("span",{className:"text-xs text-muted-foreground",children:O(r.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:f,title:"Refresh",children:e.jsx(z,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:Z,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(se,{asChild:!0,children:e.jsxs(u,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:A,title:"Task Preview Fullscreen"})})]})})]})}function R(s){var i,c;const n=((i=s==null?void 0:s.summary)==null?void 0:i.htmlEntries)??[],l=((c=s==null?void 0:s.summary)==null?void 0:c.markdownEntries)??[];return[...n.map(r=>({...r,kind:"html"})),...l.map(r=>({...r,kind:"markdown"}))]}function U({entries:s,activeEntry:n,previewKind:l,onEntrySelect:i}){return e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.map(c=>{const r=(n==null?void 0:n.path)===c.path;return e.jsx("button",{type:"button",onClick:()=>i(c),className:r?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:c.label},`${c.kind}:${c.path}`)}),e.jsxs(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[s.length," ",s.length===1?"file":"files"]}),e.jsx(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l==="service"?"Service proxy":"Sandboxed iframe"})]})})}function H({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:i,onRefresh:c,onFullscreen:r,onServiceModeToggle:v,onServicePortChange:d,onServiceStart:p}){const b=s?q(s):null;return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-3",children:n&&d&&p?e.jsxs("form",{className:"flex min-w-0 items-center gap-2",onSubmit:h=>{h.preventDefault(),p()},children:[e.jsx("span",{className:"shrink-0 text-sm font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Port",e.jsx(re,{type:"number",min:1,max:65535,inputMode:"numeric",value:i??"",onChange:h=>d(h.target.value),placeholder:"12345","aria-label":"Service preview port",className:"h-7 w-24 rounded-full px-3 text-xs"})]}),e.jsxs(u,{type:"submit",variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-xs",children:[e.jsx(ce,{className:"h-3.5 w-3.5"}),"Run"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s?K(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(z,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:b??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:r,title:"Fullscreen",children:e.jsx(ne,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(u,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:v,className:"h-7 shrink-0 rounded-full px-2.5 text-xs",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function I({serviceSession:s,error:n,children:l}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:n}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&l?e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:l}):e.jsx(N,{children:"No service preview running."})})]})}function q(s){return s.openUrl??s.previewUrl}function he(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function K(s){if(s.kind==="service"&&typeof s.port=="number"){const n=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${n}`}return s.entryPath}function N({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function O(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),i=n%60;return`${l}m ${i}s`}export{H as PreviewHeader,I as PreviewServicePanel,ve as PreviewTab,U as PreviewToolbar,he as getPreviewIframeSandbox,q as getPreviewOpenUrl};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-BO5dV6XO.js","assets/index-D8EsMsvI.js","assets/index-DvQBsfbb.css","assets/folder-gwCJ2sbc.js","assets/file-D9zXUdI6.js","assets/PreviewTab-B0Kmn8YC.js","assets/input-Cdu3B_SQ.js"])))=>i.map(i=>d[i]);
2
- import{c as j,as as k,r as s,j as e,J as S,P as T,M as C,aN as P,aO as M,aP as w,aQ as _,aR as E,_ as y,aS as L}from"./index-D8EsMsvI.js";import{n as O,j as A,i as I,L as R,C as F,T as v,m as z}from"./DashboardShared-BdW5P7SR.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-CLLyWXEv.js","assets/index-Cpz4J5-T.js","assets/index-DvQBsfbb.css","assets/folder-BNfC8Y62.js","assets/file-YGIDkO7j.js","assets/PreviewTab-C1SWykXF.js","assets/input-BRIa-GWn.js"])))=>i.map(i=>d[i]);
2
+ import{c as j,at as k,r as s,j as e,K as S,P as T,N as C,aO as P,aP as M,aQ as w,aR as _,aS as E,$ as y,aT as L}from"./index-Cpz4J5-T.js";import{n as O,j as A,i as I,L as R,C as F,T as v,m as z}from"./DashboardShared-B4I_eZZK.js";/**
3
3
  * @license lucide-react v1.7.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -9,4 +9,4 @@ import{c as j,as as k,r as s,j as e,J as S,P as T,M as C,aN as P,aO as M,aP as w
9
9
  *
10
10
  * This source code is licensed under the ISC license.
11
11
  * See the LICENSE file in the root directory of this source tree.
12
- */const q=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],B=j("terminal",q),G=s.lazy(async()=>({default:(await y(()=>import("./FilesTab-BO5dV6XO.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),H=s.lazy(async()=>({default:(await y(()=>import("./PreviewTab-B0Kmn8YC.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),U={getOutput:w,getOutputTree:M,getOutputContent:P},W={getOutput:w,createPreviewSession:(t,r)=>L(t,typeof r=="string"?r:r==null?void 0:r.path)};function K(){const{shareId:t}=k(),[r,n]=s.useState(null),[c,a]=s.useState([]),[x,u]=s.useState(!0),[p,d]=s.useState(null),o=s.useRef(null);return s.useEffect(()=>{if(!t){n(null),a([]),d("Shared conversation not found"),u(!1);return}let l=!1;o.current=t,u(!0),d(null);const m=async h=>{try{const[f,b]=await Promise.all([_(t),E(t)]);if(l||o.current!==t)return;n(f),a(N=>h?b.logs:z(N,b.logs)),d(null)}catch(f){if(l||o.current!==t)return;h&&(n(null),a([]),d(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!l&&o.current===t&&h&&u(!1)}};m(!0);const i=window.setInterval(()=>{m(!1)},2500);return()=>{l=!0,window.clearInterval(i)}},[t]),e.jsx($,{conversation:r,logs:c,loading:x,error:p})}function $({conversation:t,logs:r,loading:n,error:c}){const[a,x]=s.useState("transcript"),[u,p]=s.useState(!1),d=s.useMemo(()=>{if(!t)return null;const i=O(t.payload.initialMessage);return i.length>0?A(i,new Date(t.createdAt).toISOString()):null},[t]),o=s.useMemo(()=>I([...d?[d]:[],...r]),[d,r]),l=(t==null?void 0:t.scope)==="filesPreview",m=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!n&&c&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:c})]}),!n&&!c&&o.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!n&&!c&&o.map((i,h)=>e.jsx(F,{event:i,questionResponseDisabled:!0},`shared-${h}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[u&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/ai-microsoft/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(J,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>p(i=>!i),"aria-expanded":u,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(B,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),l&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(a==="preview"),children:"Preview"})]})]}),l&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&m,a==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx(G,{taskId:t.shareId,api:U})})}),a==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(H,{taskId:t.shareId,api:W,allowPortPreview:!1})})})]}):m]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm font-medium transition-colors hover:text-foreground"}function J({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{K as SharedConversationPage,$ as SharedConversationView};
12
+ */const q=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],B=j("terminal",q),$=s.lazy(async()=>({default:(await y(()=>import("./FilesTab-CLLyWXEv.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),G=s.lazy(async()=>({default:(await y(()=>import("./PreviewTab-C1SWykXF.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),H={getOutput:w,getOutputTree:M,getOutputContent:P},U={getOutput:w,createPreviewSession:(t,r)=>L(t,typeof r=="string"?r:r==null?void 0:r.path)};function J(){const{shareId:t}=k(),[r,n]=s.useState(null),[c,a]=s.useState([]),[x,u]=s.useState(!0),[p,d]=s.useState(null),o=s.useRef(null);return s.useEffect(()=>{if(!t){n(null),a([]),d("Shared conversation not found"),u(!1);return}let l=!1;o.current=t,u(!0),d(null);const m=async h=>{try{const[f,b]=await Promise.all([_(t),E(t)]);if(l||o.current!==t)return;n(f),a(N=>h?b.logs:z(N,b.logs)),d(null)}catch(f){if(l||o.current!==t)return;h&&(n(null),a([]),d(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!l&&o.current===t&&h&&u(!1)}};m(!0);const i=window.setInterval(()=>{m(!1)},2500);return()=>{l=!0,window.clearInterval(i)}},[t]),e.jsx(W,{conversation:r,logs:c,loading:x,error:p})}function W({conversation:t,logs:r,loading:n,error:c}){const[a,x]=s.useState("transcript"),[u,p]=s.useState(!1),d=s.useMemo(()=>{if(!t)return null;const i=O(t.payload.initialMessage);return i.length>0?A(i,new Date(t.createdAt).toISOString()):null},[t]),o=s.useMemo(()=>I([...d?[d]:[],...r]),[d,r]),l=(t==null?void 0:t.scope)==="filesPreview",m=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!n&&c&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:c})]}),!n&&!c&&o.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!n&&!c&&o.map((i,h)=>e.jsx(F,{event:i,questionResponseDisabled:!0},`shared-${h}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[u&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/ai-microsoft/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>p(i=>!i),"aria-expanded":u,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(B,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),l&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(a==="preview"),children:"Preview"})]})]}),l&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&m,a==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx($,{taskId:t.shareId,api:H})})}),a==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(G,{taskId:t.shareId,api:U,allowPortPreview:!1})})})]}):m]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm font-medium transition-colors hover:text-foreground"}function K({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{J as SharedConversationPage,W as SharedConversationView};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D8EsMsvI.js";/**
1
+ import{c as a}from"./index-Cpz4J5-T.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-D8EsMsvI.js";/**
1
+ import{c as o}from"./index-Cpz4J5-T.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CJ55N6Jh.js","assets/DashboardShared-BdW5P7SR.js","assets/input-Cdu3B_SQ.js","assets/folder-gwCJ2sbc.js","assets/SharedConversationPage-BocsZBPi.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-DQjLt2wn.js","assets/DashboardShared-B4I_eZZK.js","assets/input-BRIa-GWn.js","assets/folder-BNfC8Y62.js","assets/SharedConversationPage-CDFyo1wW.js"])))=>i.map(i=>d[i]);
2
2
  function fS(a,r){for(var o=0;o<r.length;o++){const i=r[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(i,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function o(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function i(u){if(u.ep)return;u.ep=!0;const f=o(u);fetch(u.href,f)}})();function dv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Iu={exports:{}},To={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -263,4 +263,4 @@ You can add a description to the \`${wr}\` by passing a \`${jb}\` component as a
263
263
 
264
264
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${wr}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
265
265
 
266
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{var i;document.getElementById((i=a.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(r)},[r,a]),null},qR=Cb,GR=Ab,$R=Rb,Bb=_b,Hb=Ob,Vb=kb,Yb=Ub,qb=Db,Gb=zb;const XR=qR,QR=GR,ZR=$R,$b=b.forwardRef(({className:a,...r},o)=>y.jsx(Bb,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r,ref:o}));$b.displayName=Bb.displayName;const Xb=b.forwardRef(({className:a,...r},o)=>y.jsxs(ZR,{children:[y.jsx($b,{}),y.jsx(Hb,{ref:o,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background 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),...r})]}));Xb.displayName=Hb.displayName;const Qb=({className:a,...r})=>y.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",a),...r});Qb.displayName="AlertDialogHeader";const Zb=({className:a,...r})=>y.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...r});Zb.displayName="AlertDialogFooter";const Kb=b.forwardRef(({className:a,...r},o)=>y.jsx(qb,{ref:o,className:Ne("text-lg font-semibold",a),...r}));Kb.displayName=qb.displayName;const Pb=b.forwardRef(({className:a,...r},o)=>y.jsx(Gb,{ref:o,className:Ne("text-sm text-muted-foreground",a),...r}));Pb.displayName=Gb.displayName;const Jb=b.forwardRef(({className:a,...r},o)=>y.jsx(Vb,{ref:o,className:Ne(Zf(),a),...r}));Jb.displayName=Vb.displayName;const Fb=b.forwardRef(({className:a,...r},o)=>y.jsx(Yb,{ref:o,className:Ne(Zf({variant:"outline"}),"mt-2 sm:mt-0",a),...r}));Fb.displayName=Yb.displayName;const KR=2e3,PR=24e4;function qa(a){if(a==null||a==="")return"Unavailable";const r=new Date(a);return Number.isNaN(r.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(r)}function JR(a){const r=Math.max(0,Math.floor(a)),o=Math.floor(r/86400),i=Math.floor(r%86400/3600),u=Math.floor(r%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function sv(a){if(a==null||Number.isNaN(a))return"Unavailable";const r=["B","KB","MB","GB","TB"];let o=a,i=0;for(;o>=1024&&i<r.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${r[i]}`}function Ib(a){return a==="ok"?"default":a==="missing"||a==="install-failed"||a==="login-failed"?"destructive":a==="not-authenticated"||a==="unsupported-platform"?"outline":"secondary"}function FR(a){return a.available?y.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[y.jsx(Ow,{className:"h-3 w-3"}),"Available"]}):y.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[y.jsx(Dw,{className:"h-3 w-3"}),"Unavailable"]})}function IR(a){return a.update?a.update.updateAvailable?y.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",a.update.latestVersion]}):y.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function WR(a){var o;const r=`npm install -g ${(o=a.update)==null?void 0:o.packageName}@latest`;return a.id==="claude"?`${r} --include=optional --ignore-scripts=false`:r}function e_(a){return new Promise(r=>setTimeout(r,a))}function cv(a){return a.status==="succeeded"||a.status==="failed"}async function t_(a){if(cv(a))return a;const r=Date.now()+PR;let o=a;for(;!cv(o)&&Date.now()<r;)await e_(KR),o=await rw(a.id);return o}function n_(a){if(a.error)return a.error;const r=a.result;return(r==null?void 0:r.detail)??null}function ze({label:a,value:r,mono:o=!1}){return y.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[y.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:a}),y.jsx("span",{className:Ne("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:r})]})}function a_({agent:a,nodeName:r,upgrading:o,onUpgrade:i}){var d,h;const u=((d=a.update)==null?void 0:d.updateAvailable)===!0,f=IR(a);return y.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/70 p-2.5 shadow-sm",children:[y.jsxs("div",{className:"flex items-start justify-between gap-2",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[y.jsx(Vv,{className:"h-3.5 w-3.5 text-primary"}),a.label]}),y.jsxs("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:["Command: ",y.jsx("span",{className:"font-mono text-[10px]",children:a.command})]})]}),y.jsxs("div",{className:"flex flex-col items-end gap-1",children:[FR(a),u?y.jsxs(XR,{children:[y.jsx(QR,{asChild:!0,children:y.jsx("button",{type:"button",disabled:o,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:f})}),y.jsxs(Xb,{children:[y.jsxs(Qb,{children:[y.jsxs(Kb,{children:["Upgrade ",a.label,"?"]}),y.jsxs(Pb,{children:["This runs ",WR(a)," on ",r,". Remote nodes execute the command on the remote machine."]})]}),y.jsxs(Zb,{children:[y.jsx(Fb,{children:"Cancel"}),y.jsx(Jb,{onClick:()=>i(a),children:"Upgrade"})]})]})]}):f]})]}),y.jsxs("div",{className:"mt-2 space-y-1 text-[11px]",children:[y.jsx(ze,{label:"Version",value:a.version??"Unavailable",mono:!!a.version}),a.update&&y.jsx(ze,{label:"Latest",value:a.update.latestVersion??"Unavailable",mono:!!a.update.latestVersion}),y.jsx(ze,{label:"Path",value:a.path??"Not on PATH",mono:!!a.path}),y.jsx(ze,{label:"Checked",value:qa(a.checkedAt)}),a.update&&y.jsx(ze,{label:"Update check",value:qa(a.update.checkedAt)})]}),((h=a.update)==null?void 0:h.detail)&&y.jsx("div",{className:"mt-1.5 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:a.update.detail}),a.metadataStatus&&y.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[y.jsx(St,{variant:Ib(a.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:a.metadataStatus}),y.jsx("span",{children:"Startup preflight"})]}),a.detail&&y.jsx("div",{className:"mt-1.5 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:a.detail})]})}function cs({name:a,status:r}){return y.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] font-medium text-foreground",children:a}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:qa(r==null?void 0:r.checkedAt)})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(r==null?void 0:r.authenticated)=="boolean"&&y.jsx(St,{variant:r.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:r.authenticated?"auth ok":"auth required"}),y.jsx(St,{variant:Ib(r==null?void 0:r.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(r==null?void 0:r.status)??"unknown"})]})]})}function l_(a){return[{key:"workspace",label:"Workspace",value:a==null?void 0:a.workspace},{key:"node",label:"Node app",value:a==null?void 0:a.node},{key:"core",label:"Core",value:a==null?void 0:a.core},{key:"dashboard",label:"Dashboard",value:a==null?void 0:a.dashboard},{key:"api",label:"API",value:a==null?void 0:a.api}].filter(o=>o.value)}function r_(a,r){var o;return(o=a==null?void 0:a.nodes)!=null&&o.length?a.nodes:r?[r]:[]}function o_(a,r){var i;if(r&&a.id===r.nodeId)return r;const o=a.settingsSnapshot;return{...a,nodeId:a.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function i_(a,r){return a.id===r?`${a.name} (this node)`:`${a.name} (${a.role})`}function s_({cluster:a,systemInfo:r,sseConnected:o,onRefresh:i}){var C,j,D,B,Z,F,q,V,le,he,pe,fe,me,ge,ue,O,Y,J,re,I,_,G,X,W;const u=b.useMemo(()=>r_(a,r),[a,r]),[f,d]=b.useState(()=>{var P;return(r==null?void 0:r.nodeId)??((P=a==null?void 0:a.self)==null?void 0:P.id)??""}),[h,v]=b.useState(null),p=(a==null?void 0:a.self)??r??u[0]??null,x=u.find(P=>P.id===f)??p,m=x?o_(x,r):null,w=!!(r&&x&&x.id===r.nodeId),T=w||!!(x!=null&&x.settingsSnapshot),A=b.useMemo(()=>l_(m==null?void 0:m.packages),[m==null?void 0:m.packages]),E=((C=m==null?void 0:m.startupRequirements)==null?void 0:C.components)??(m==null?void 0:m.components)??{};async function N(P){if(!x)return;const ne=`${x.id}:${P.id}`;v(ne);try{const ee=await ow(x.id,P.id);Ya.info(`${P.label} upgrade started on ${x.name}`);const ae=await t_(ee);ae.status==="succeeded"?(Ya.success(`${P.label} upgrade finished on ${x.name}`),i==null||i()):ae.status==="failed"?Ya.error(n_(ae)??`${P.label} upgrade failed`):Ya.info(`${P.label} upgrade is still running on ${x.name}`)}catch(ee){Ya.error(ee instanceof Error?ee.message:`${P.label} upgrade failed`)}finally{v(null)}}return!x||!m?y.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):y.jsxs("div",{className:"space-y-4",children:[y.jsx("section",{className:"rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:y.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[y.jsx(cy,{status:x.status}),y.jsx("span",{className:"font-medium text-foreground",children:x.name})]}),y.jsx(cT,{role:x.role}),y.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:x.transportType??m.transportType??"direct"}),y.jsx(St,{variant:w?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:w?"Live local session":"Leader-synced snapshot"})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),y.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),y.jsx("p",{className:"mt-1 max-w-2xl text-[11px] text-muted-foreground",children:"Inspect the selected node's runtime environment, connectivity surface, and packaged build metadata from one place."})]}),u.length>1&&y.jsxs("div",{className:"max-w-md space-y-1.5",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),y.jsxs(mR,{value:x.id,onValueChange:d,children:[y.jsx(eb,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:y.jsx(hR,{placeholder:"Choose a node"})}),y.jsx(ab,{children:u.map(P=>y.jsx(lb,{value:P.id,children:i_(P,r==null?void 0:r.nodeId)},P.id))})]})]})]}),y.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[y.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[y.jsx(qv,{className:"h-3 w-3"}),o?"Live link connected":"Live link reconnecting"]}),y.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",JR(m.uptime)]}),!w&&y.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Updated ",qa((j=x.settingsSnapshot)==null?void 0:j.collectedAt)]})]})]})}),!T&&y.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),y.jsxs(DR,{defaultValue:"session",className:"space-y-2",children:[y.jsxs(Tb,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[y.jsx(ps,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),y.jsx(ps,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),y.jsx(ps,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),y.jsxs(gs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Fw,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),y.jsx(Dn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Node ID",value:m.nodeId,mono:!0}),y.jsx(ze,{label:"Status",value:x.status}),y.jsx(ze,{label:"Role",value:x.role}),y.jsx(ze,{label:"Endpoint",value:x.endpoint,mono:!0}),y.jsx(ze,{label:"Joined",value:qa(x.joinedAt)}),y.jsx(ze,{label:"Heartbeat",value:qa(x.lastHeartbeat)}),y.jsx(ze,{label:"Capabilities",value:x.capabilities.length>0?x.capabilities.join(", "):"None"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Lw,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),y.jsx(Dn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Host",value:((D=m.os)==null?void 0:D.hostname)??"Unavailable"}),y.jsx(ze,{label:"Platform",value:m.os?`${m.os.platform} ${m.os.release}`:"Unavailable"}),y.jsx(ze,{label:"Arch",value:((B=m.os)==null?void 0:B.arch)??"Unavailable"}),y.jsx(ze,{label:"CPU",value:((Z=m.os)==null?void 0:Z.cpuModel)??"Unavailable"}),y.jsx(ze,{label:"Cores",value:String(((F=m.os)==null?void 0:F.cpuCount)??"Unavailable")}),y.jsx(ze,{label:"Memory",value:m.os?`${sv(m.os.freeMemoryBytes)} free / ${sv(m.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Vv,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),y.jsx(Dn,{className:"text-[10px]",children:w?"Live command availability for Codex and Claude Code on this node.":"Most recent agent availability snapshot synced from this node."})]}),y.jsx(jn,{className:"grid gap-2 px-3 pb-2.5 md:grid-cols-2",children:(m.agents??[]).map(P=>y.jsx(a_,{agent:P,nodeName:x.name,upgrading:h===`${x.id}:${P.id}`,onUpgrade:N},P.id))})]})]}),y.jsxs(gs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Ew,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),y.jsx(Dn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Transport",value:x.transportType??m.transportType??"direct"}),y.jsx(ze,{label:"Node URL",value:x.endpoint,mono:!0}),y.jsx(ze,{label:"Node tunnel",value:x.devtunnelEndpoint??"Disabled",mono:!!x.devtunnelEndpoint}),y.jsx(ze,{label:"Dashboard URL",value:x.dashboardOrigin??m.localDashboardOrigin??"Unavailable",mono:!!(x.dashboardOrigin||m.localDashboardOrigin)}),y.jsx(ze,{label:"Local dashboard",value:m.localDashboardOrigin??"Unavailable",mono:!!m.localDashboardOrigin})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(tE,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),y.jsx(Dn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Enabled",value:(q=m.auth)!=null&&q.enabled?"Yes":"No"}),y.jsx(ze,{label:"Same tenant",value:(V=m.auth)!=null&&V.allowSameTenant?"Allowed":"Off"}),y.jsx(ze,{label:"Allowed users",value:(le=m.auth)!=null&&le.allowedUsers.length?m.auth.allowedUsers.join(", "):"None"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Vw,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),y.jsx(Dn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Work dir",value:((he=m.runtime)==null?void 0:he.workDir)??m.workDir??"Unavailable",mono:!!(((pe=m.runtime)==null?void 0:pe.workDir)??m.workDir)}),y.jsx(ze,{label:"Storage",value:((fe=m.runtime)==null?void 0:fe.storagePath)??"Unavailable",mono:!!((me=m.runtime)!=null&&me.storagePath)}),y.jsx(ze,{label:"Process cwd",value:((ge=m.runtime)==null?void 0:ge.cwd)??"Unavailable",mono:!!((ue=m.runtime)!=null&&ue.cwd)}),y.jsx(ze,{label:"Started",value:qa((O=m.runtime)==null?void 0:O.startedAt)}),y.jsx(ze,{label:"PID",value:m.runtime?String(m.runtime.pid):"Unavailable",mono:!!m.runtime})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Hv,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),y.jsx(Dn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),y.jsxs(jn,{className:"space-y-3 px-3 pb-2.5",children:[y.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),y.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:qa((Y=m.startupRequirements)==null?void 0:Y.lastCheckedAt)})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx(cs,{name:"Azure CLI",status:E.az}),y.jsx(cs,{name:"DevTunnel",status:E.devtunnel}),y.jsx(cs,{name:"Claude Code",status:E.claude}),y.jsx(cs,{name:"Codex",status:E.codex})]})]})]})]}),y.jsxs(gs,{value:"about",className:"mt-0 grid gap-2 xl:grid-cols-[0.92fr_1.08fr]",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(xw,{className:"h-3.5 w-3.5 text-primary"}),"Repository"]}),y.jsx(Dn,{className:"text-[10px]",children:"Source-of-truth repository metadata for this running node."})]}),y.jsxs(jn,{className:"space-y-3 px-3 pb-2.5",children:[(J=m.repository)!=null&&J.url?y.jsxs("a",{href:m.repository.url,target:"_blank",rel:"noreferrer",className:"group flex items-center justify-between rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[y.jsx("span",{className:"font-mono text-[10px]",children:m.repository.url}),y.jsx(Bw,{className:"h-3.5 w-3.5 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):y.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),y.jsxs("div",{className:"space-y-0",children:[y.jsx(ze,{label:"Branch",value:((re=m.repository)==null?void 0:re.branch)??"Unavailable",mono:!!((I=m.repository)!=null&&I.branch)}),y.jsx(ze,{label:"Commit",value:((_=m.repository)==null?void 0:_.commit)??"Unavailable",mono:!!((G=m.repository)!=null&&G.commit)}),y.jsx(ze,{label:"Runtime",value:`${m.packageName??"meshy"} ${m.version}`,mono:!0}),y.jsx(ze,{label:"Node.js",value:((X=m.runtime)==null?void 0:X.nodeVersion)??"Unavailable",mono:!!((W=m.runtime)!=null&&W.nodeVersion)})]})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(qw,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),y.jsx(Dn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),y.jsx(jn,{className:"space-y-1.5 px-3 pb-2.5",children:A.map(P=>{var ne,ee;return y.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] font-medium text-foreground",children:P.label}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:(ne=P.value)==null?void 0:ne.name})]}),y.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px]",children:(ee=P.value)==null?void 0:ee.version})]},P.key)})})]})]})]})]})}function c_(){const{cluster:a,systemInfo:r,sseConnected:o,refresh:i}=Uv(),[u,f]=b.useState(!1);return y.jsxs(hC,{open:u,onOpenChange:f,children:[y.jsx(pC,{asChild:!0,children:y.jsx(wl,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"rounded-full border border-border/70 bg-background/70 shadow-sm",children:y.jsx(Ww,{className:"h-4 w-4"})})}),y.jsxs(Xy,{className:"grid h-[min(82vh,42rem)] max-h-[82vh] max-w-[min(90vw,56rem)] grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-2xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[y.jsxs(Qy,{className:"shrink-0 border-b border-border/60 px-3 py-2 sm:px-4",children:[y.jsxs(Zy,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx($w,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),y.jsx(Ky,{className:"text-[11px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),y.jsx("div",{className:"min-h-0 overflow-y-auto px-3 py-2.5 sm:px-4 sm:py-3",children:y.jsx(s_,{cluster:a,systemInfo:r,sseConnected:o,onRefresh:i})})]})]})}const p5="bypass",u_=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],g5=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],v5=new Set(u_.filter(a=>a.supportsFollowUp).map(a=>a.value)),y5=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],b5=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],f_=new Set(["pending","assigned"]),d_=new Set(["running"]),m_=new Set(["completed","failed","cancelled"]);function x5(a,r){switch(r){case"running":return d_.has(a.status);case"waiting":return f_.has(a.status);case"closed":return m_.has(a.status);case"shared":return!!a.activeShare;case"archived":return a.status==="archived";case"active":default:return a.status!=="archived"}}function S5(a,r){if(r==="all")return!0;const o=a.conversationKind==="nativeSession";return r==="native"?o:!o}function w5(a,r){const o=r.trim().toLowerCase();return o?[a.title,a.description,a.id,a.agent,a.assignedTo??"",a.assignedNodeName??"",a.project??"",a.effectiveProjectPath??"",a.conversationKind==="nativeSession"?"native session":"meshy chat",a.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function h_(a,r,o){if(!a)return"unassigned";const i=r==null?void 0:r.find(u=>u.id===a);return(i==null?void 0:i.name)??o??a.slice(0,8)}function E5(a,r,o){return h_(a,r,o).toLowerCase()}function T5(a,r){return[...a].sort((o,i)=>o.id===r?-1:i.id===r?1:o.name.localeCompare(i.name))}function N5(a){if(!a||typeof a!="object")return null;const r=a,o=r.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:r.draftNewTask===!0,returnRoute:typeof r.returnRoute=="string"?r.returnRoute:void 0,returnTaskId:typeof r.returnTaskId=="string"||r.returnTaskId===null?r.returnTaskId:void 0,createMode:i}}function C5(a){switch(a){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function A5(a){return a==="default workspace"?a:a.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??a}function R5(a){const r=Date.now()-a;return r<6e4?"just now":r<36e5?`${Math.floor(r/6e4)}m`:r<864e5?`${Math.floor(r/36e5)}h`:`${Math.floor(r/864e5)}d`}function _5(a){return new Date(a).toLocaleString()}function O5(a){const r=Math.floor(a/1e3),o=Math.floor(r/3600),i=Math.floor(r%3600/60),u=r%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function p_(a,r="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(a),Ya.success(r),!0;const f=globalThis.document,d=(u=f==null?void 0:f.execCommand)==null?void 0:u.bind(f);if(!(f!=null&&f.body)||typeof f.createElement!="function"||typeof d!="function")throw new Error("Clipboard access is unavailable");const h=f.createElement("textarea"),v=f.activeElement,p=v&&typeof v.focus=="function"?v:null;h.value=a,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",f.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=d("copy");if(f.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Ya.success(r),!0}catch(f){return Ya.error(f instanceof Error?f.message:"Failed to copy"),!1}}function M5(a,r){const o=new Map;for(const u of a){const f=u.assignedTo??null,d=f??"__unassigned__",h=f?r.get(f)??u.assignedNodeName??f.slice(0,8):"Unassigned",v=u.effectiveProjectPath??u.project??"default workspace";o.has(d)||o.set(d,{nodeId:f,nodeName:h,dirMap:new Map});const p=o.get(d);p.dirMap.has(v)||p.dirMap.set(v,[]),p.dirMap.get(v).push(u)}const i=Array.from(o.values()).map(({nodeId:u,nodeName:f,dirMap:d})=>{const h=Array.from(d.entries()).map(([v,p])=>({path:v,tasks:p})).sort((v,p)=>p.tasks.length-v.tasks.length||v.path.localeCompare(p.path));return{nodeId:u,nodeName:f,dirs:h}});return i.sort((u,f)=>u.nodeId===null?1:f.nodeId===null?-1:u.nodeName.localeCompare(f.nodeName)),i}const g_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"};function v_(a){return a.split(".")[0]??"unknown"}function y_(a){return new Date(a).toLocaleTimeString("en-US",{hour12:!1})}function br(a,r){return(r==null?void 0:r.get(a))??a}function b_(a,r){const o=a.data,i=o.operation;switch(a.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${br(o.nodeId,r)} left (${o.reason})`;case"node.status":return`${br(o.nodeId,r)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${br(i==null?void 0:i.nodeId,r)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${br(i==null?void 0:i.nodeId,r)}`;case"transport.changed":return`${br(o.nodeId,r)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${br(o.nodeId,r)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function x_(a){return JSON.stringify(a,null,2)}function S_({events:a,maxHeight:r="400px",emptyTitle:o="No live events yet",emptyDescription:i="Cluster activity appears here as it happens.",nodeNameById:u,onDismiss:f}){return a.length===0?y.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] text-muted-foreground",children:o}),y.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground/70",children:i})]})}):y.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:r},children:y.jsx("div",{className:"space-y-1.5",children:a.map(d=>{const h=v_(d.type);return y.jsx("div",{className:"rounded-xl border border-border/60 bg-background/45 px-2 py-1.5 transition-colors hover:border-border hover:bg-background/65",children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:y_(d.timestamp)}),y.jsx(St,{variant:"outline",className:Ne("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",g_[h]),children:d.type})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[y.jsx(wl,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-muted-foreground",onClick:()=>void p_(x_(d),"Event copied"),"aria-label":`Copy ${d.type} event`,title:"Copy event",children:y.jsx(zw,{className:"h-3 w-3"})}),f&&y.jsx(wl,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>f(d.id),"aria-label":`Dismiss ${d.type} event`,title:"Dismiss event",children:y.jsx(Gv,{className:"h-3 w-3"})})]})]}),y.jsx("div",{className:"text-[11px] leading-snug text-foreground/85",children:b_(d,u)})]})},d.id)})})})}const w_=["node.","election.","transport."],Wb="cluster.state";function E_(a){return w_.some(r=>a.type.startsWith(r))}function T_(a){return new Date(a).toLocaleTimeString("en-US",{hour12:!1})}function uv(a,r){return typeof a=="string"?(r==null?void 0:r.get(a))??a:null}function N_(a,r){if(a.type===Wb)return uv(a.data.leaderId,r);const o=a.data.operation;return uv(a.data.nodeId??(o==null?void 0:o.nodeId)??a.data.leaderId??a.data.candidateId,r)}function C_(a,r){return a?`${N_(a,r)??a.type}: ${T_(a.timestamp)}`:"Waiting for cluster activity"}function A_({connected:a,events:r,nodeNameById:o,defaultOpen:i=!1}){const[u,f]=b.useState(i),[d,h]=b.useState(new Set),v=b.useRef(null),p=b.useMemo(()=>{const m=r.filter(T=>E_(T)&&!d.has(T.id)),w=new Set;return m.filter(T=>{if(T.type!=="node.status")return!0;const A=typeof T.data.nodeId=="string"?T.data.nodeId:T.type;return w.has(A)?!1:(w.add(A),!0)})},[r,d]),x=b.useMemo(()=>r.find(m=>m.type===Wb)??p[0],[r,p]);return b.useEffect(()=>{h(m=>{if(m.size===0)return m;const w=new Set(r.map(A=>A.id)),T=new Set(Array.from(m).filter(A=>w.has(A)));return T.size===m.size?m:T})},[r]),b.useEffect(()=>{if(!u)return;const m=T=>{var A;(A=v.current)!=null&&A.contains(T.target)||f(!1)},w=T=>{T.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",w)}},[u]),y.jsxs("div",{ref:v,className:"relative",children:[y.jsxs("button",{type:"button","aria-expanded":u,"aria-haspopup":"dialog",onClick:()=>f(m=>!m),className:Ne("flex items-center gap-1.5 rounded-full border px-2 py-1.5 text-[11px] transition-all sm:gap-2 sm:px-3 sm:py-2 sm:text-xs",a?"border-emerald-500/25 bg-emerald-500/8 text-muted-foreground hover:border-emerald-500/40 hover:bg-emerald-500/12":"border-destructive/25 bg-destructive/8 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/12",u&&"shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]"),title:a?"Live link connected":"Live link reconnecting",children:[y.jsx(qv,{className:Ne("h-3.5 w-3.5",a?"text-emerald-500":"text-destructive")}),a?"Live link":"Reconnecting"]}),u&&y.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[20rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[y.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-3 py-2",children:y.jsxs("div",{className:"flex items-start justify-between gap-3",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[a?y.jsx(Hv,{className:"h-3.5 w-3.5 text-emerald-500"}):y.jsx(rE,{className:"h-3.5 w-3.5 text-destructive"}),"Live link"]}),y.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:a?"SSE stream is connected":"SSE stream is reconnecting"})]}),y.jsx("div",{className:Ne("rounded-full border px-2 py-0.5 text-[9px] font-medium uppercase tracking-[0.14em]",a?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:a?"Connected":"Retrying"})]})}),y.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[y.jsxs("div",{className:"border-r border-border/60 px-3 py-2",children:[y.jsx("div",{className:"text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Connection events"}),y.jsx("div",{className:"mt-0.5 text-lg font-semibold tracking-tight text-foreground",children:p.length})]}),y.jsxs("div",{className:"min-w-0 px-3 py-2",children:[y.jsx("div",{className:"text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Latest"}),y.jsx("div",{className:"mt-1 truncate font-mono text-[9px] text-foreground/80",children:C_(x,o)})]})]}),y.jsx("div",{className:"px-2 py-2",children:y.jsx(S_,{events:p,maxHeight:"16rem",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:o,onDismiss:m=>h(w=>new Set(w).add(m))})}),y.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground",children:[y.jsx("span",{className:"truncate",children:"Node, election, and system activity."}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[y.jsx(wl,{type:"button",variant:"ghost",size:"sm",className:"h-6 rounded-full px-2 text-[10px]",onClick:()=>h(new Set(r.map(m=>m.id))),disabled:p.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),y.jsx(wl,{type:"button",variant:"ghost",size:"sm",className:"h-6 rounded-full px-2 text-[10px]",onClick:()=>f(!1),children:"Close"})]})]})]})]})}function R_(){var x,m;const{cluster:a,events:r,sseConnected:o}=Uv(),{theme:i,setTheme:u}=oT(),f=Bn(),d=f.pathname==="/"||/^\/tasks\/[^/]+$/.test(f.pathname),h=b.useMemo(()=>{const w=new Map;for(const T of(a==null?void 0:a.nodes)??[])w.set(T.id,T.name);return w},[a==null?void 0:a.nodes]),v=i==="dark"?Kw:i==="light"?aE:Qw,p=()=>{const w=["light","dark","system"],T=w.indexOf(i);u(w[(T+1)%w.length])};return y.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[y.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),y.jsx("div",{className:"pointer-events-none absolute left-[-12rem] top-[-10rem] h-[28rem] w-[28rem] rounded-full bg-primary/14 blur-3xl"}),y.jsx("div",{className:"pointer-events-none absolute right-[-10rem] top-[10%] h-[24rem] w-[24rem] rounded-full bg-emerald-500/10 blur-3xl dark:bg-emerald-300/8"}),y.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[y.jsx("header",{className:"relative z-50 shrink-0 px-2 pb-2 pt-3 sm:px-5 sm:pb-3 sm:pt-4 lg:px-6",children:y.jsxs("div",{className:"mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-2xl border border-border/60 bg-background/78 px-3 py-2 shadow-[0_20px_80px_-48px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl sm:gap-3 sm:rounded-[24px] sm:px-4 sm:py-3",children:[y.jsx("div",{className:"flex min-w-0 items-center gap-4",children:y.jsxs(jv,{to:"/",className:"flex items-center gap-3",children:[y.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background sm:h-11 sm:w-11 sm:rounded-2xl sm:text-sm",children:"M"}),y.jsxs("div",{className:"hidden min-w-0 sm:block",children:[y.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),y.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),y.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[y.jsxs("div",{className:"hidden items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground sm:flex",children:[y.jsxs("span",{className:"flex items-center gap-2",children:[(a==null?void 0:a.self)&&y.jsx(cy,{status:a.self.status}),y.jsx("span",{className:"font-medium text-foreground",children:((x=a==null?void 0:a.self)==null?void 0:x.name)??"offline"})]}),y.jsx("span",{className:"text-border",children:"/"}),y.jsx("span",{className:"capitalize",children:((m=a==null?void 0:a.self)==null?void 0:m.role)??"node"})]}),y.jsx(A_,{connected:o,events:r,nodeNameById:h}),y.jsx(c_,{}),y.jsx(wl,{variant:"ghost",size:"icon",onClick:p,className:"rounded-full border border-border/60 bg-background/70",title:`Theme: ${i}`,children:y.jsx(v,{className:"h-4 w-4"})})]})]})}),y.jsx("main",{className:Ne("min-h-0 flex-1 px-3 pb-3 sm:px-5 lg:px-6",d?"overflow-hidden":"overflow-y-auto"),children:y.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:y.jsx(x2,{})})})]})]})}const fv=b.lazy(async()=>({default:(await hv(()=>import("./DashboardPage-CJ55N6Jh.js").then(r=>r.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),__=b.lazy(async()=>({default:(await hv(()=>import("./SharedConversationPage-BocsZBPi.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function O_(){return y.jsx(Q2,{children:y.jsx(b.Suspense,{fallback:y.jsx(M_,{}),children:y.jsxs(w2,{children:[y.jsx(Sl,{path:"/shared/tasks/:shareId",element:y.jsx(__,{})}),y.jsxs(Sl,{element:y.jsx(fw,{children:y.jsx(R_,{})}),children:[y.jsx(Sl,{path:"/",element:y.jsx(fv,{})}),y.jsx(Sl,{path:"/nodes",element:y.jsx(Tg,{to:"/",replace:!0})}),y.jsx(Sl,{path:"/tasks",element:y.jsx(Tg,{to:"/",replace:!0})}),y.jsx(Sl,{path:"/tasks/:id",element:y.jsx(fv,{})})]})]})})})}function M_(){return y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function D_(a){return y.jsx(BT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...a})}xS.createRoot(document.getElementById("root")).render(y.jsx(b.StrictMode,{children:y.jsxs(rT,{children:[y.jsx(O_,{}),y.jsx(D_,{})]})}));export{T5 as $,hC as A,St as B,Nw as C,Xy as D,zw as E,Vw as F,p_ as G,h_ as H,DR as I,d5 as J,Tb as K,ps as L,_5 as M,gs as N,XR as O,m5 as P,Xb as Q,Qb as R,lb as S,g5 as T,Kb as U,Pb as V,Zb as W,Gv as X,Fb as Y,Jb as Z,hv as _,cE as a,qv as a0,S_ as a1,cy as a2,Bw as a3,cT as a4,O5 as a5,f_ as a6,Lo as a7,Be as a8,Oo as a9,w5 as aA,$_ as aB,v5 as aC,d_ as aD,I_ as aE,P_ as aF,J_ as aG,K_ as aH,Z_ as aI,k_ as aJ,U_ as aK,z_ as aL,B_ as aM,r5 as aN,l5 as aO,a5 as aP,t5 as aQ,n5 as aR,o5 as aS,Rw as aT,dv as aU,c5 as aV,s5 as aW,i5 as aX,u5 as aY,h5 as aZ,f5 as a_,Ie as aa,ke as ab,LA as ac,NA as ad,Rl as ae,M5 as af,Dw as ag,y5 as ah,b5 as ai,A5 as aj,C5 as ak,R5 as al,QR as am,W_ as an,e5 as ao,G_ as ap,sw as aq,F_ as ar,j_ as as,Bn as at,Nv as au,Uv as av,N5 as aw,x5 as ax,S5 as ay,E5 as az,Ne as b,We as c,Zv as d,L_ as e,Qy as f,Zy as g,vC as h,wl as i,y as j,V_ as k,q_ as l,H_ as m,p5 as n,Y_ as o,Q_ as p,mR as q,b as r,eb as s,Ya as t,hR as u,ab as v,Vv as w,Yv as x,u_ as y,X_ as z};
266
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{var i;document.getElementById((i=a.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(r)},[r,a]),null},qR=Cb,GR=Ab,$R=Rb,Bb=_b,Hb=Ob,Vb=kb,Yb=Ub,qb=Db,Gb=zb;const XR=qR,QR=GR,ZR=$R,$b=b.forwardRef(({className:a,...r},o)=>y.jsx(Bb,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r,ref:o}));$b.displayName=Bb.displayName;const Xb=b.forwardRef(({className:a,...r},o)=>y.jsxs(ZR,{children:[y.jsx($b,{}),y.jsx(Hb,{ref:o,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background 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),...r})]}));Xb.displayName=Hb.displayName;const Qb=({className:a,...r})=>y.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",a),...r});Qb.displayName="AlertDialogHeader";const Zb=({className:a,...r})=>y.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...r});Zb.displayName="AlertDialogFooter";const Kb=b.forwardRef(({className:a,...r},o)=>y.jsx(qb,{ref:o,className:Ne("text-lg font-semibold",a),...r}));Kb.displayName=qb.displayName;const Pb=b.forwardRef(({className:a,...r},o)=>y.jsx(Gb,{ref:o,className:Ne("text-sm text-muted-foreground",a),...r}));Pb.displayName=Gb.displayName;const Jb=b.forwardRef(({className:a,...r},o)=>y.jsx(Vb,{ref:o,className:Ne(Zf(),a),...r}));Jb.displayName=Vb.displayName;const Fb=b.forwardRef(({className:a,...r},o)=>y.jsx(Yb,{ref:o,className:Ne(Zf({variant:"outline"}),"mt-2 sm:mt-0",a),...r}));Fb.displayName=Yb.displayName;const KR=2e3,PR=24e4;function qa(a){if(a==null||a==="")return"Unavailable";const r=new Date(a);return Number.isNaN(r.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(r)}function JR(a){const r=Math.max(0,Math.floor(a)),o=Math.floor(r/86400),i=Math.floor(r%86400/3600),u=Math.floor(r%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function sv(a){if(a==null||Number.isNaN(a))return"Unavailable";const r=["B","KB","MB","GB","TB"];let o=a,i=0;for(;o>=1024&&i<r.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${r[i]}`}function Ib(a){return a==="ok"?"default":a==="missing"||a==="install-failed"||a==="login-failed"?"destructive":a==="not-authenticated"||a==="unsupported-platform"?"outline":"secondary"}function FR(a){return a.available?y.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[y.jsx(Ow,{className:"h-3 w-3"}),"Available"]}):y.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[y.jsx(Dw,{className:"h-3 w-3"}),"Unavailable"]})}function IR(a){return a.update?a.update.updateAvailable?y.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",a.update.latestVersion]}):y.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function WR(a){var o;const r=`npm install -g ${(o=a.update)==null?void 0:o.packageName}@latest`;return a.id==="claude"?`${r} --include=optional --ignore-scripts=false`:r}function e_(a){return new Promise(r=>setTimeout(r,a))}function cv(a){return a.status==="succeeded"||a.status==="failed"}async function t_(a){if(cv(a))return a;const r=Date.now()+PR;let o=a;for(;!cv(o)&&Date.now()<r;)await e_(KR),o=await rw(a.id);return o}function n_(a){if(a.error)return a.error;const r=a.result;return(r==null?void 0:r.detail)??null}function ze({label:a,value:r,mono:o=!1}){return y.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[y.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:a}),y.jsx("span",{className:Ne("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:r})]})}function a_({agent:a,nodeName:r,upgrading:o,onUpgrade:i}){var d,h;const u=((d=a.update)==null?void 0:d.updateAvailable)===!0,f=IR(a);return y.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/70 p-2.5 shadow-sm",children:[y.jsxs("div",{className:"flex items-start justify-between gap-2",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[y.jsx(Vv,{className:"h-3.5 w-3.5 text-primary"}),a.label]}),y.jsxs("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:["Command: ",y.jsx("span",{className:"font-mono text-[10px]",children:a.command})]})]}),y.jsxs("div",{className:"flex flex-col items-end gap-1",children:[FR(a),u?y.jsxs(XR,{children:[y.jsx(QR,{asChild:!0,children:y.jsx("button",{type:"button",disabled:o,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:f})}),y.jsxs(Xb,{children:[y.jsxs(Qb,{children:[y.jsxs(Kb,{children:["Upgrade ",a.label,"?"]}),y.jsxs(Pb,{children:["This runs ",WR(a)," on ",r,". Remote nodes execute the command on the remote machine."]})]}),y.jsxs(Zb,{children:[y.jsx(Fb,{children:"Cancel"}),y.jsx(Jb,{onClick:()=>i(a),children:"Upgrade"})]})]})]}):f]})]}),y.jsxs("div",{className:"mt-2 space-y-1 text-[11px]",children:[y.jsx(ze,{label:"Version",value:a.version??"Unavailable",mono:!!a.version}),a.update&&y.jsx(ze,{label:"Latest",value:a.update.latestVersion??"Unavailable",mono:!!a.update.latestVersion}),y.jsx(ze,{label:"Path",value:a.path??"Not on PATH",mono:!!a.path}),y.jsx(ze,{label:"Checked",value:qa(a.checkedAt)}),a.update&&y.jsx(ze,{label:"Update check",value:qa(a.update.checkedAt)})]}),((h=a.update)==null?void 0:h.detail)&&y.jsx("div",{className:"mt-1.5 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:a.update.detail}),a.metadataStatus&&y.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[y.jsx(St,{variant:Ib(a.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:a.metadataStatus}),y.jsx("span",{children:"Startup preflight"})]}),a.detail&&y.jsx("div",{className:"mt-1.5 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:a.detail})]})}function cs({name:a,status:r}){return y.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] font-medium text-foreground",children:a}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:qa(r==null?void 0:r.checkedAt)})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(r==null?void 0:r.authenticated)=="boolean"&&y.jsx(St,{variant:r.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:r.authenticated?"auth ok":"auth required"}),y.jsx(St,{variant:Ib(r==null?void 0:r.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(r==null?void 0:r.status)??"unknown"})]})]})}function l_(a){return[{key:"workspace",label:"Workspace",value:a==null?void 0:a.workspace},{key:"node",label:"Node app",value:a==null?void 0:a.node},{key:"core",label:"Core",value:a==null?void 0:a.core},{key:"dashboard",label:"Dashboard",value:a==null?void 0:a.dashboard},{key:"api",label:"API",value:a==null?void 0:a.api}].filter(o=>o.value)}function r_(a,r){var o;return(o=a==null?void 0:a.nodes)!=null&&o.length?a.nodes:r?[r]:[]}function o_(a,r){var i;if(r&&a.id===r.nodeId)return r;const o=a.settingsSnapshot;return{...a,nodeId:a.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function i_(a,r){return a.id===r?`${a.name} (this node)`:`${a.name} (${a.role})`}function s_({cluster:a,systemInfo:r,sseConnected:o,onRefresh:i}){var C,j,D,B,Z,F,q,V,le,he,pe,fe,me,ge,ue,O,Y,J,re,I,_,G,X,W;const u=b.useMemo(()=>r_(a,r),[a,r]),[f,d]=b.useState(()=>{var P;return(r==null?void 0:r.nodeId)??((P=a==null?void 0:a.self)==null?void 0:P.id)??""}),[h,v]=b.useState(null),p=(a==null?void 0:a.self)??r??u[0]??null,x=u.find(P=>P.id===f)??p,m=x?o_(x,r):null,w=!!(r&&x&&x.id===r.nodeId),T=w||!!(x!=null&&x.settingsSnapshot),A=b.useMemo(()=>l_(m==null?void 0:m.packages),[m==null?void 0:m.packages]),E=((C=m==null?void 0:m.startupRequirements)==null?void 0:C.components)??(m==null?void 0:m.components)??{};async function N(P){if(!x)return;const ne=`${x.id}:${P.id}`;v(ne);try{const ee=await ow(x.id,P.id);Ya.info(`${P.label} upgrade started on ${x.name}`);const ae=await t_(ee);ae.status==="succeeded"?(Ya.success(`${P.label} upgrade finished on ${x.name}`),i==null||i()):ae.status==="failed"?Ya.error(n_(ae)??`${P.label} upgrade failed`):Ya.info(`${P.label} upgrade is still running on ${x.name}`)}catch(ee){Ya.error(ee instanceof Error?ee.message:`${P.label} upgrade failed`)}finally{v(null)}}return!x||!m?y.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):y.jsxs("div",{className:"space-y-4",children:[y.jsx("section",{className:"rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:y.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[y.jsx(cy,{status:x.status}),y.jsx("span",{className:"font-medium text-foreground",children:x.name})]}),y.jsx(cT,{role:x.role}),y.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:x.transportType??m.transportType??"direct"}),y.jsx(St,{variant:w?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:w?"Live local session":"Leader-synced snapshot"})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),y.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),y.jsx("p",{className:"mt-1 max-w-2xl text-[11px] text-muted-foreground",children:"Inspect the selected node's runtime environment, connectivity surface, and packaged build metadata from one place."})]}),u.length>1&&y.jsxs("div",{className:"max-w-md space-y-1.5",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),y.jsxs(mR,{value:x.id,onValueChange:d,children:[y.jsx(eb,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:y.jsx(hR,{placeholder:"Choose a node"})}),y.jsx(ab,{children:u.map(P=>y.jsx(lb,{value:P.id,children:i_(P,r==null?void 0:r.nodeId)},P.id))})]})]})]}),y.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[y.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[y.jsx(qv,{className:"h-3 w-3"}),o?"Live link connected":"Live link reconnecting"]}),y.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",JR(m.uptime)]}),!w&&y.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Updated ",qa((j=x.settingsSnapshot)==null?void 0:j.collectedAt)]})]})]})}),!T&&y.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),y.jsxs(DR,{defaultValue:"session",className:"space-y-2",children:[y.jsxs(Tb,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[y.jsx(ps,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),y.jsx(ps,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),y.jsx(ps,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),y.jsxs(gs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Fw,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),y.jsx(Dn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Node ID",value:m.nodeId,mono:!0}),y.jsx(ze,{label:"Status",value:x.status}),y.jsx(ze,{label:"Role",value:x.role}),y.jsx(ze,{label:"Endpoint",value:x.endpoint,mono:!0}),y.jsx(ze,{label:"Joined",value:qa(x.joinedAt)}),y.jsx(ze,{label:"Heartbeat",value:qa(x.lastHeartbeat)}),y.jsx(ze,{label:"Capabilities",value:x.capabilities.length>0?x.capabilities.join(", "):"None"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Lw,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),y.jsx(Dn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Host",value:((D=m.os)==null?void 0:D.hostname)??"Unavailable"}),y.jsx(ze,{label:"Platform",value:m.os?`${m.os.platform} ${m.os.release}`:"Unavailable"}),y.jsx(ze,{label:"Arch",value:((B=m.os)==null?void 0:B.arch)??"Unavailable"}),y.jsx(ze,{label:"CPU",value:((Z=m.os)==null?void 0:Z.cpuModel)??"Unavailable"}),y.jsx(ze,{label:"Cores",value:String(((F=m.os)==null?void 0:F.cpuCount)??"Unavailable")}),y.jsx(ze,{label:"Memory",value:m.os?`${sv(m.os.freeMemoryBytes)} free / ${sv(m.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Vv,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),y.jsx(Dn,{className:"text-[10px]",children:w?"Live command availability for Codex and Claude Code on this node.":"Most recent agent availability snapshot synced from this node."})]}),y.jsx(jn,{className:"grid gap-2 px-3 pb-2.5 md:grid-cols-2",children:(m.agents??[]).map(P=>y.jsx(a_,{agent:P,nodeName:x.name,upgrading:h===`${x.id}:${P.id}`,onUpgrade:N},P.id))})]})]}),y.jsxs(gs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Ew,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),y.jsx(Dn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Transport",value:x.transportType??m.transportType??"direct"}),y.jsx(ze,{label:"Node URL",value:x.endpoint,mono:!0}),y.jsx(ze,{label:"Node tunnel",value:x.devtunnelEndpoint??"Disabled",mono:!!x.devtunnelEndpoint}),y.jsx(ze,{label:"Dashboard URL",value:x.dashboardOrigin??m.localDashboardOrigin??"Unavailable",mono:!!(x.dashboardOrigin||m.localDashboardOrigin)}),y.jsx(ze,{label:"Local dashboard",value:m.localDashboardOrigin??"Unavailable",mono:!!m.localDashboardOrigin})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(tE,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),y.jsx(Dn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Enabled",value:(q=m.auth)!=null&&q.enabled?"Yes":"No"}),y.jsx(ze,{label:"Same tenant",value:(V=m.auth)!=null&&V.allowSameTenant?"Allowed":"Off"}),y.jsx(ze,{label:"Allowed users",value:(le=m.auth)!=null&&le.allowedUsers.length?m.auth.allowedUsers.join(", "):"None"})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Vw,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),y.jsx(Dn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),y.jsxs(jn,{className:"space-y-0 px-3 pb-2.5",children:[y.jsx(ze,{label:"Work dir",value:((he=m.runtime)==null?void 0:he.workDir)??m.workDir??"Unavailable",mono:!!(((pe=m.runtime)==null?void 0:pe.workDir)??m.workDir)}),y.jsx(ze,{label:"Storage",value:((fe=m.runtime)==null?void 0:fe.storagePath)??"Unavailable",mono:!!((me=m.runtime)!=null&&me.storagePath)}),y.jsx(ze,{label:"Process cwd",value:((ge=m.runtime)==null?void 0:ge.cwd)??"Unavailable",mono:!!((ue=m.runtime)!=null&&ue.cwd)}),y.jsx(ze,{label:"Started",value:qa((O=m.runtime)==null?void 0:O.startedAt)}),y.jsx(ze,{label:"PID",value:m.runtime?String(m.runtime.pid):"Unavailable",mono:!!m.runtime})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(Hv,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),y.jsx(Dn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),y.jsxs(jn,{className:"space-y-3 px-3 pb-2.5",children:[y.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),y.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:qa((Y=m.startupRequirements)==null?void 0:Y.lastCheckedAt)})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx(cs,{name:"Azure CLI",status:E.az}),y.jsx(cs,{name:"DevTunnel",status:E.devtunnel}),y.jsx(cs,{name:"Claude Code",status:E.claude}),y.jsx(cs,{name:"Codex",status:E.codex})]})]})]})]}),y.jsxs(gs,{value:"about",className:"mt-0 grid gap-2 xl:grid-cols-[0.92fr_1.08fr]",children:[y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(xw,{className:"h-3.5 w-3.5 text-primary"}),"Repository"]}),y.jsx(Dn,{className:"text-[10px]",children:"Source-of-truth repository metadata for this running node."})]}),y.jsxs(jn,{className:"space-y-3 px-3 pb-2.5",children:[(J=m.repository)!=null&&J.url?y.jsxs("a",{href:m.repository.url,target:"_blank",rel:"noreferrer",className:"group flex items-center justify-between rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[y.jsx("span",{className:"font-mono text-[10px]",children:m.repository.url}),y.jsx(Bw,{className:"h-3.5 w-3.5 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):y.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),y.jsxs("div",{className:"space-y-0",children:[y.jsx(ze,{label:"Branch",value:((re=m.repository)==null?void 0:re.branch)??"Unavailable",mono:!!((I=m.repository)!=null&&I.branch)}),y.jsx(ze,{label:"Commit",value:((_=m.repository)==null?void 0:_.commit)??"Unavailable",mono:!!((G=m.repository)!=null&&G.commit)}),y.jsx(ze,{label:"Runtime",value:`${m.packageName??"meshy"} ${m.version}`,mono:!0}),y.jsx(ze,{label:"Node.js",value:((X=m.runtime)==null?void 0:X.nodeVersion)??"Unavailable",mono:!!((W=m.runtime)!=null&&W.nodeVersion)})]})]})]}),y.jsxs(_n,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[y.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[y.jsxs(Mn,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx(qw,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),y.jsx(Dn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),y.jsx(jn,{className:"space-y-1.5 px-3 pb-2.5",children:A.map(P=>{var ne,ee;return y.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] font-medium text-foreground",children:P.label}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:(ne=P.value)==null?void 0:ne.name})]}),y.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px]",children:(ee=P.value)==null?void 0:ee.version})]},P.key)})})]})]})]})]})}function c_(){const{cluster:a,systemInfo:r,sseConnected:o,refresh:i}=Uv(),[u,f]=b.useState(!1);return y.jsxs(hC,{open:u,onOpenChange:f,children:[y.jsx(pC,{asChild:!0,children:y.jsx(wl,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"rounded-full border border-border/70 bg-background/70 shadow-sm",children:y.jsx(Ww,{className:"h-4 w-4"})})}),y.jsxs(Xy,{className:"grid h-[min(82vh,42rem)] max-h-[82vh] max-w-[min(90vw,56rem)] grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-2xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[y.jsxs(Qy,{className:"shrink-0 border-b border-border/60 px-3 py-2 sm:px-4",children:[y.jsxs(Zy,{className:"flex items-center gap-1.5 text-[12px]",children:[y.jsx($w,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),y.jsx(Ky,{className:"text-[11px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),y.jsx("div",{className:"min-h-0 overflow-y-auto px-3 py-2.5 sm:px-4 sm:py-3",children:y.jsx(s_,{cluster:a,systemInfo:r,sseConnected:o,onRefresh:i})})]})]})}const p5="bypass",u_=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],g5=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],v5=new Set(u_.filter(a=>a.supportsFollowUp).map(a=>a.value)),y5=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],b5=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],f_=new Set(["pending","assigned"]),d_=new Set(["running"]),m_=new Set(["completed","failed","cancelled"]);function x5(a,r){switch(r){case"running":return d_.has(a.status);case"waiting":return f_.has(a.status);case"closed":return m_.has(a.status);case"shared":return!!a.activeShare;case"archived":return a.status==="archived";case"active":default:return a.status!=="archived"}}function S5(a,r){if(r==="all")return!0;const o=a.conversationKind==="nativeSession";return r==="native"?o:!o}function w5(a,r){const o=r.trim().toLowerCase();return o?[a.title,a.description,a.id,a.agent,a.assignedTo??"",a.assignedNodeName??"",a.project??"",a.effectiveProjectPath??"",a.conversationKind==="nativeSession"?"native session":"meshy chat",a.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function h_(a,r,o){if(!a)return"unassigned";const i=r==null?void 0:r.find(u=>u.id===a);return(i==null?void 0:i.name)??o??a.slice(0,8)}function E5(a,r,o){return h_(a,r,o).toLowerCase()}function T5(a,r){return[...a].sort((o,i)=>o.id===r?-1:i.id===r?1:o.name.localeCompare(i.name))}function N5(a){if(!a||typeof a!="object")return null;const r=a,o=r.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:r.draftNewTask===!0,returnRoute:typeof r.returnRoute=="string"?r.returnRoute:void 0,returnTaskId:typeof r.returnTaskId=="string"||r.returnTaskId===null?r.returnTaskId:void 0,createMode:i}}function C5(a){switch(a){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function A5(a){return a==="default workspace"?a:a.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??a}function R5(a){const r=Date.now()-a;return r<6e4?"just now":r<36e5?`${Math.floor(r/6e4)}m`:r<864e5?`${Math.floor(r/36e5)}h`:`${Math.floor(r/864e5)}d`}function _5(a){return new Date(a).toLocaleString()}function O5(a){const r=Math.floor(a/1e3),o=Math.floor(r/3600),i=Math.floor(r%3600/60),u=r%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function p_(a,r="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(a),Ya.success(r),!0;const f=globalThis.document,d=(u=f==null?void 0:f.execCommand)==null?void 0:u.bind(f);if(!(f!=null&&f.body)||typeof f.createElement!="function"||typeof d!="function")throw new Error("Clipboard access is unavailable");const h=f.createElement("textarea"),v=f.activeElement,p=v&&typeof v.focus=="function"?v:null;h.value=a,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",f.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=d("copy");if(f.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Ya.success(r),!0}catch(f){return Ya.error(f instanceof Error?f.message:"Failed to copy"),!1}}function M5(a,r){const o=new Map;for(const u of a){const f=u.assignedTo??null,d=f??"__unassigned__",h=f?r.get(f)??u.assignedNodeName??f.slice(0,8):"Unassigned",v=u.effectiveProjectPath??u.project??"default workspace";o.has(d)||o.set(d,{nodeId:f,nodeName:h,dirMap:new Map});const p=o.get(d);p.dirMap.has(v)||p.dirMap.set(v,[]),p.dirMap.get(v).push(u)}const i=Array.from(o.values()).map(({nodeId:u,nodeName:f,dirMap:d})=>{const h=Array.from(d.entries()).map(([v,p])=>({path:v,tasks:p})).sort((v,p)=>p.tasks.length-v.tasks.length||v.path.localeCompare(p.path));return{nodeId:u,nodeName:f,dirs:h}});return i.sort((u,f)=>u.nodeId===null?1:f.nodeId===null?-1:u.nodeName.localeCompare(f.nodeName)),i}const g_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"};function v_(a){return a.split(".")[0]??"unknown"}function y_(a){return new Date(a).toLocaleTimeString("en-US",{hour12:!1})}function br(a,r){return(r==null?void 0:r.get(a))??a}function b_(a,r){const o=a.data,i=o.operation;switch(a.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${br(o.nodeId,r)} left (${o.reason})`;case"node.status":return`${br(o.nodeId,r)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${br(i==null?void 0:i.nodeId,r)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${br(i==null?void 0:i.nodeId,r)}`;case"transport.changed":return`${br(o.nodeId,r)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${br(o.nodeId,r)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function x_(a){return JSON.stringify(a,null,2)}function S_({events:a,maxHeight:r="400px",emptyTitle:o="No live events yet",emptyDescription:i="Cluster activity appears here as it happens.",nodeNameById:u,onDismiss:f}){return a.length===0?y.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] text-muted-foreground",children:o}),y.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground/70",children:i})]})}):y.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:r},children:y.jsx("div",{className:"space-y-1.5",children:a.map(d=>{const h=v_(d.type);return y.jsx("div",{className:"rounded-xl border border-border/60 bg-background/45 px-2 py-1.5 transition-colors hover:border-border hover:bg-background/65",children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:y_(d.timestamp)}),y.jsx(St,{variant:"outline",className:Ne("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",g_[h]),children:d.type})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[y.jsx(wl,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-muted-foreground",onClick:()=>void p_(x_(d),"Event copied"),"aria-label":`Copy ${d.type} event`,title:"Copy event",children:y.jsx(zw,{className:"h-3 w-3"})}),f&&y.jsx(wl,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>f(d.id),"aria-label":`Dismiss ${d.type} event`,title:"Dismiss event",children:y.jsx(Gv,{className:"h-3 w-3"})})]})]}),y.jsx("div",{className:"text-[11px] leading-snug text-foreground/85",children:b_(d,u)})]})},d.id)})})})}const w_=["node.","election.","transport."],Wb="cluster.state";function E_(a){return w_.some(r=>a.type.startsWith(r))}function T_(a){return new Date(a).toLocaleTimeString("en-US",{hour12:!1})}function uv(a,r){return typeof a=="string"?(r==null?void 0:r.get(a))??a:null}function N_(a,r){if(a.type===Wb)return uv(a.data.leaderId,r);const o=a.data.operation;return uv(a.data.nodeId??(o==null?void 0:o.nodeId)??a.data.leaderId??a.data.candidateId,r)}function C_(a,r){return a?`${N_(a,r)??a.type}: ${T_(a.timestamp)}`:"Waiting for cluster activity"}function A_({connected:a,events:r,nodeNameById:o,defaultOpen:i=!1}){const[u,f]=b.useState(i),[d,h]=b.useState(new Set),v=b.useRef(null),p=b.useMemo(()=>{const m=r.filter(T=>E_(T)&&!d.has(T.id)),w=new Set;return m.filter(T=>{if(T.type!=="node.status")return!0;const A=typeof T.data.nodeId=="string"?T.data.nodeId:T.type;return w.has(A)?!1:(w.add(A),!0)})},[r,d]),x=b.useMemo(()=>r.find(m=>m.type===Wb)??p[0],[r,p]);return b.useEffect(()=>{h(m=>{if(m.size===0)return m;const w=new Set(r.map(A=>A.id)),T=new Set(Array.from(m).filter(A=>w.has(A)));return T.size===m.size?m:T})},[r]),b.useEffect(()=>{if(!u)return;const m=T=>{var A;(A=v.current)!=null&&A.contains(T.target)||f(!1)},w=T=>{T.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",w)}},[u]),y.jsxs("div",{ref:v,className:"relative",children:[y.jsxs("button",{type:"button","aria-expanded":u,"aria-haspopup":"dialog",onClick:()=>f(m=>!m),className:Ne("flex items-center gap-1.5 rounded-full border px-2 py-1.5 text-[11px] transition-all sm:gap-2 sm:px-3 sm:py-2 sm:text-xs",a?"border-emerald-500/25 bg-emerald-500/8 text-muted-foreground hover:border-emerald-500/40 hover:bg-emerald-500/12":"border-destructive/25 bg-destructive/8 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/12",u&&"shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]"),title:a?"Live link connected":"Live link reconnecting",children:[y.jsx(qv,{className:Ne("h-3.5 w-3.5",a?"text-emerald-500":"text-destructive")}),a?"Live link":"Reconnecting"]}),u&&y.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[20rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[y.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-3 py-2",children:y.jsxs("div",{className:"flex items-start justify-between gap-3",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[a?y.jsx(Hv,{className:"h-3.5 w-3.5 text-emerald-500"}):y.jsx(rE,{className:"h-3.5 w-3.5 text-destructive"}),"Live link"]}),y.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:a?"SSE stream is connected":"SSE stream is reconnecting"})]}),y.jsx("div",{className:Ne("rounded-full border px-2 py-0.5 text-[9px] font-medium uppercase tracking-[0.14em]",a?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:a?"Connected":"Retrying"})]})}),y.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[y.jsxs("div",{className:"border-r border-border/60 px-3 py-2",children:[y.jsx("div",{className:"text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Connection events"}),y.jsx("div",{className:"mt-0.5 text-lg font-semibold tracking-tight text-foreground",children:p.length})]}),y.jsxs("div",{className:"min-w-0 px-3 py-2",children:[y.jsx("div",{className:"text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Latest"}),y.jsx("div",{className:"mt-1 truncate font-mono text-[9px] text-foreground/80",children:C_(x,o)})]})]}),y.jsx("div",{className:"px-2 py-2",children:y.jsx(S_,{events:p,maxHeight:"16rem",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:o,onDismiss:m=>h(w=>new Set(w).add(m))})}),y.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/60 px-3 py-2 text-[10px] text-muted-foreground",children:[y.jsx("span",{className:"truncate",children:"Node, election, and system activity."}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[y.jsx(wl,{type:"button",variant:"ghost",size:"sm",className:"h-6 rounded-full px-2 text-[10px]",onClick:()=>h(new Set(r.map(m=>m.id))),disabled:p.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),y.jsx(wl,{type:"button",variant:"ghost",size:"sm",className:"h-6 rounded-full px-2 text-[10px]",onClick:()=>f(!1),children:"Close"})]})]})]})]})}function R_(){var x,m;const{cluster:a,events:r,sseConnected:o}=Uv(),{theme:i,setTheme:u}=oT(),f=Bn(),d=f.pathname==="/"||/^\/tasks\/[^/]+$/.test(f.pathname),h=b.useMemo(()=>{const w=new Map;for(const T of(a==null?void 0:a.nodes)??[])w.set(T.id,T.name);return w},[a==null?void 0:a.nodes]),v=i==="dark"?Kw:i==="light"?aE:Qw,p=()=>{const w=["light","dark","system"],T=w.indexOf(i);u(w[(T+1)%w.length])};return y.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[y.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),y.jsx("div",{className:"pointer-events-none absolute left-[-12rem] top-[-10rem] h-[28rem] w-[28rem] rounded-full bg-primary/14 blur-3xl"}),y.jsx("div",{className:"pointer-events-none absolute right-[-10rem] top-[10%] h-[24rem] w-[24rem] rounded-full bg-emerald-500/10 blur-3xl dark:bg-emerald-300/8"}),y.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[y.jsx("header",{className:"relative z-50 shrink-0 px-2 pb-2 pt-3 sm:px-5 sm:pb-3 sm:pt-4 lg:px-6",children:y.jsxs("div",{className:"mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-2xl border border-border/60 bg-background/78 px-3 py-2 shadow-[0_20px_80px_-48px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl sm:gap-3 sm:rounded-[24px] sm:px-4 sm:py-3",children:[y.jsx("div",{className:"flex min-w-0 items-center gap-4",children:y.jsxs(jv,{to:"/",className:"flex items-center gap-3",children:[y.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background sm:h-11 sm:w-11 sm:rounded-2xl sm:text-sm",children:"M"}),y.jsxs("div",{className:"hidden min-w-0 sm:block",children:[y.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),y.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),y.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[y.jsxs("div",{className:"hidden items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground sm:flex",children:[y.jsxs("span",{className:"flex items-center gap-2",children:[(a==null?void 0:a.self)&&y.jsx(cy,{status:a.self.status}),y.jsx("span",{className:"font-medium text-foreground",children:((x=a==null?void 0:a.self)==null?void 0:x.name)??"offline"})]}),y.jsx("span",{className:"text-border",children:"/"}),y.jsx("span",{className:"capitalize",children:((m=a==null?void 0:a.self)==null?void 0:m.role)??"node"})]}),y.jsx(A_,{connected:o,events:r,nodeNameById:h}),y.jsx(c_,{}),y.jsx(wl,{variant:"ghost",size:"icon",onClick:p,className:"rounded-full border border-border/60 bg-background/70",title:`Theme: ${i}`,children:y.jsx(v,{className:"h-4 w-4"})})]})]})}),y.jsx("main",{className:Ne("min-h-0 flex-1 px-3 pb-3 sm:px-5 lg:px-6",d?"overflow-hidden":"overflow-y-auto"),children:y.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:y.jsx(x2,{})})})]})]})}const fv=b.lazy(async()=>({default:(await hv(()=>import("./DashboardPage-DQjLt2wn.js").then(r=>r.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),__=b.lazy(async()=>({default:(await hv(()=>import("./SharedConversationPage-CDFyo1wW.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function O_(){return y.jsx(Q2,{children:y.jsx(b.Suspense,{fallback:y.jsx(M_,{}),children:y.jsxs(w2,{children:[y.jsx(Sl,{path:"/shared/tasks/:shareId",element:y.jsx(__,{})}),y.jsxs(Sl,{element:y.jsx(fw,{children:y.jsx(R_,{})}),children:[y.jsx(Sl,{path:"/",element:y.jsx(fv,{})}),y.jsx(Sl,{path:"/nodes",element:y.jsx(Tg,{to:"/",replace:!0})}),y.jsx(Sl,{path:"/tasks",element:y.jsx(Tg,{to:"/",replace:!0})}),y.jsx(Sl,{path:"/tasks/:id",element:y.jsx(fv,{})})]})]})})})}function M_(){return y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function D_(a){return y.jsx(BT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...a})}xS.createRoot(document.getElementById("root")).render(y.jsx(b.StrictMode,{children:y.jsxs(rT,{children:[y.jsx(O_,{}),y.jsx(D_,{})]})}));export{hv as $,X_ as A,St as B,Nw as C,Xy as D,hC as E,Vw as F,zw as G,p_ as H,h_ as I,DR as J,d5 as K,Tb as L,ps as M,_5 as N,gs as O,m5 as P,XR as Q,Xb as R,lb as S,g5 as T,Qb as U,Kb as V,Pb as W,Gv as X,Zb as Y,Fb as Z,Jb as _,cE as a,f5 as a$,T5 as a0,qv as a1,S_ as a2,cy as a3,Bw as a4,cT as a5,O5 as a6,f_ as a7,Lo as a8,Be as a9,E5 as aA,w5 as aB,$_ as aC,v5 as aD,d_ as aE,I_ as aF,P_ as aG,J_ as aH,K_ as aI,Z_ as aJ,k_ as aK,U_ as aL,z_ as aM,B_ as aN,r5 as aO,l5 as aP,a5 as aQ,t5 as aR,n5 as aS,o5 as aT,Rw as aU,dv as aV,c5 as aW,s5 as aX,i5 as aY,u5 as aZ,h5 as a_,Oo as aa,Ie as ab,ke as ac,LA as ad,NA as ae,Rl as af,M5 as ag,Dw as ah,y5 as ai,b5 as aj,A5 as ak,C5 as al,R5 as am,QR as an,W_ as ao,e5 as ap,G_ as aq,sw as ar,F_ as as,j_ as at,Bn as au,Nv as av,Uv as aw,N5 as ax,x5 as ay,S5 as az,Ne as b,We as c,Zv as d,L_ as e,Qy as f,Zy as g,vC as h,wl as i,y as j,V_ as k,q_ as l,rw as m,H_ as n,p5 as o,Y_ as p,Q_ as q,b as r,mR as s,Ya as t,eb as u,hR as v,ab as w,Vv as x,Yv as y,u_ as z};
@@ -1 +1 @@
1
- import{r as i,j as s,b as n}from"./index-D8EsMsvI.js";const f=i.forwardRef(({className:e,type:r,...o},t)=>s.jsx("input",{type:r,className:n("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 file:text-foreground 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",e),ref:t,...o}));f.displayName="Input";export{f as I};
1
+ import{r as i,j as s,b as n}from"./index-Cpz4J5-T.js";const f=i.forwardRef(({className:e,type:r,...o},t)=>s.jsx("input",{type:r,className:n("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 file:text-foreground 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",e),ref:t,...o}));f.displayName="Input";export{f as I};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Meshy Dashboard</title>
7
7
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>&#x1F578;</text></svg>" />
8
- <script type="module" crossorigin src="/assets/index-D8EsMsvI.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-Cpz4J5-T.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DvQBsfbb.css">
10
10
  </head>
11
11
  <body>