meshy-node 0.6.7 → 0.6.8

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
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CUhdRokR.js","assets/DashboardShared-BohLaqeo.js","assets/folder-BMmcfsyZ.js","assets/play-Dc8Adtxz.js","assets/DashboardPage-DWXbz1IY.css","assets/SharedConversationPage-Bh9Bn_0B.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CdCiYD4R.js","assets/DashboardShared-HvdlVE0E.js","assets/folder-DzQ8M7ZQ.js","assets/play-BN9wGxuQ.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-FgVTiQ2B.js"])))=>i.map(i=>d[i]);
2
2
  function aw(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in n)){const d=Object.getOwnPropertyDescriptor(i,u);d&&Object.defineProperty(n,u,d.get?d:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function o(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(u){if(u.ep)return;u.ep=!0;const d=o(u);fetch(u.href,d)}})();function Pv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xd={exports:{}},Mo={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -298,4 +298,4 @@ You can add a description to the \`${Ar}\` by passing a \`${gx}\` component as a
298
298
 
299
299
  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 \`${Ar}\`. 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.
300
300
 
301
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},ZR=cx,IR=ux,FR=dx,Sx=fx,wx=mx,Ex=yx,Nx=xx,Tx=px,Cx=vx;const rf=ZR,of=IR,JR=FR,Ax=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{className:se("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",n),...l,ref:o}));Ax.displayName=Sx.displayName;const Hs=v.forwardRef(({className:n,...l},o)=>m.jsxs(JR,{children:[m.jsx(Ax,{}),m.jsx(wx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] 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%]",n),...l})]}));Hs.displayName=wx.displayName;const Vs=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const Ys=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ys.displayName="AlertDialogFooter";const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(Tx,{ref:o,className:se("text-lg font-semibold",n),...l}));$s.displayName=Tx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(Cx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Cx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>m.jsx(Ex,{ref:o,className:se(xf(),n),...l}));Gs.displayName=Ex.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>m.jsx(Nx,{ref:o,className:se(xf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Nx.displayName;function WR(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function e_({formatDateTime:n,viewInfo:l}){var i,u,d,f,h,y,p,x;const o=WR(l.packages);return m.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(CE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(zn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(Ln,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?m.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 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:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),m.jsx(PE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.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."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),m.jsx(Sr,{label:"Commit",value:((f=l.repository)==null?void 0:f.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),m.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),m.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),m.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(IE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(zn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(Ln,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),m.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var ic="Checkbox",[t_]=Fa(ic),[n_,Xf]=t_(ic);function a_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Rr({prop:o,defaultProp:u??!1,onChange:y,caller:ic}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!f||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:M,bubbleInput:C,setBubbleInput:A};return m.jsx(n_,{scope:l,...k,children:l_(g)?g(k):i})}var Rx="CheckboxTrigger",_x=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Xf(Rx,n),E=Ie(u,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const _=()=>g(C.current);return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[d,g]),m.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":Pa(y)?"mixed":y,"aria-required":p,"data-state":kx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Oe(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Oe(o,A=>{g(_=>Pa(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});_x.displayName=Rx;var Pf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(a_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(_x,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(Dx,{__scopeCheckbox:o})]})})});Pf.displayName=ic;var jx="CheckboxIndicator",Ox=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Xf(jx,o);return m.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:m.jsx(ze.span,{"data-state":kx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Ox.displayName=jx;var Mx="CheckboxBubbleInput",Dx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Xf(Mx,n),T=Ie(o,N),E=tb(d),C=Gy(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&Y){const B=new Event("click",{bubbles:G});_.indeterminate=Pa(d),Y.call(_,Pa(d)?!1:d),_.dispatchEvent(B)}},[w,E,d,u]);const A=v.useRef(Pa(d)?!1:d);return m.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Dx.displayName=Mx;function l_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function kx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const zx=v.forwardRef(({className:n,...l},o)=>m.jsx(Pf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Ox,{className:se("flex items-center justify-center text-current"),children:m.jsx(_s,{className:"h-3.5 w-3.5"})})}));zx.displayName=Pf.displayName;const Lx=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Lx.displayName="Input";const $v=["queued","running"];function r_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function o_(n){return n==="claude"||n==="codex"||n==="copilot"}function Ux(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return o_(l)?`${n.nodeId}:${l}`:null}function i_(n){return n.status==="succeeded"||n.status==="failed"}async function Bx(n,l={}){const o=l.getOperation??J2,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!i_(f)&&Date.now()<d;)await c_(i),f=await o(n.id);return f}async function s_(n,l=W2){const o=new Set(n),i=await Promise.all($v.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!$v.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Ux(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function c_(n){return new Promise(l=>setTimeout(l,n))}const u_=1500,d_=1e3,f_=9e4;async function m_(n={}){const l=n.fetchHealth??h_,o=n.initialDelayMs??u_,i=n.pollIntervalMs??d_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??g_,h=n.timeoutMs??f_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=p_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function h_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function p_(n){return typeof n=="boolean"?{ok:n}:n}function g_(n){return new Promise(l=>window.setTimeout(l,n))}function v_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function y_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=v_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[_,M]=v.useState(!1),[k,Y]=v.useState(!1);v.useEffect(()=>{E(qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||C||_)return;const re=p.updateAvailable?"update":"restart",pe=S_(T);if(T.port.trim()&&(pe==null?void 0:pe.port)===void 0){ft.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:re,startArgs:pe}:{reason:re};A(!0);try{if(i){const O=await Z2(me);N({...O,pid:O.pid??h,status:"accepted"}),ft.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),m_({previousPid:O.pid??h}).then(q=>{q||(A(!1),ft.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(q=>{A(!1),ft.error(q instanceof Error?q.message:"Runtime restart recovery failed")});return}const ue=await tE(u,me);N({operationId:ue.id,pid:h,status:ue.status}),ft.info(`Restart requested on ${d}. Operation ${$d(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Bx(ue,{timeoutMs:6e4}),le=x_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ft.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ft.error(de.error??`Restart failed on ${d}`):ft.info(`Restart operation ${$d(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),ft.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||C||_)){M(!0);try{const re=await I2();ft.info(`Stopping Meshy process ${re.pid}`)}catch(re){M(!1),ft.error(re instanceof Error?re.message:"Runtime stop failed")}}}const V=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:"ghost",disabled:C||_,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(nN,{className:se("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),m.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsx($s,{className:"text-sm",children:"Stop runtime?"}),m.jsx(qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(rN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),m.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsxs($s,{className:"text-sm",children:[g,"?"]}),m.jsxs(qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(b_,{value:T,onChange:E}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>Y(re=>!re),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(T0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Zs,{className:se("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?$d(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function b_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(Lo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(Bb,{value:l.transport,onValueChange:i=>o("transport",Hx(i)),children:[m.jsx($f,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(Hb,{placeholder:"Transport"})}),m.jsxs(qf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(Lo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(zx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:se("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Lx,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function x_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function qv(n){return{port:w_(n.endpoint),name:n.nodeName,join:"",transport:Hx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function S_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function Hx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function w_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function $d(n){return n.length<=8?n:n.slice(0,8)}function Uo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.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:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(pt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Gt(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function E_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Gv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function N_(n){return n.available?m.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):m.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function T_(n){return n.update?n.update.updateAvailable?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function C_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function A_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({label:n,value:l,mono:o=!1}){return m.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:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:se("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function R_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=T_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(x0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[N_(n),n.metadataStatus&&m.jsx(pt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&m.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),m.jsx(Bo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,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:d})}),m.jsxs(Hs,{children:[m.jsxs(Vs,{children:[m.jsxs($s,{children:["Upgrade ",n.label,"?"]}),m.jsxs(qs,{children:["This runs ",C_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Ys,{children:[m.jsx(Xs,{children:"Cancel"}),m.jsx(Gs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function __(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function j_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.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,runtimeUpdate:o==null?void 0:o.runtimeUpdate,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 O_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function M_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function D_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function k_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,re,pe,me,ue,de,le,O,q,I,ce,F,j,X,Q,W,ee,oe,te,ie;const d=v.useMemo(()=>__(n,l),[n,l]),[f,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===f)??w,T=N?j_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,_=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=r_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(J,xe)=>{const ye=Ux(J);if(!ye||x.current.has(J.id))return;const Se=D_(J),Ye=(xe==null?void 0:xe.agentLabel)??(Se?M_(Se):"Agent"),Le=(xe==null?void 0:xe.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(ye,J));try{const $e=await Bx(J);if($e.status==="succeeded")await(u==null?void 0:u()),g.current.has($e.id)||(ft.success(`${Ye} upgrade finished on ${Le}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(ft.error(A_($e)??`${Ye} upgrade failed`),g.current.add($e.id));else{p(gt=>new Map(gt).set(ye,$e)),ft.info(`${Ye} upgrade is still ${$e.status} on ${Le}`);return}p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===$e.id)&&rt.delete(ye),rt})}catch($e){p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===J.id)&&rt.delete(ye),rt}),ft.error($e instanceof Error?$e.message:`${Ye} upgrade failed`)}finally{x.current.delete(J.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function xe(){let ye;try{ye=await s_(M)}catch{return}if(!J){p(Se=>{const Ye=new Map(Se);for(const[Le,$e]of ye)Ye.set(Le,$e);return Ye});for(const Se of ye.values())B(Se)}}return xe(),()=>{J=!0}},[B,k]);async function V(J){if(N)try{const xe=await eE(N.id,J.id);ft.info(`${J.label} upgrade started on ${N.name}`),await B(xe,{agentLabel:J.label,nodeName:N.name})}catch(xe){ft.error(xe instanceof Error?xe.message:`${J.label} upgrade failed`)}}return!N||!T?m.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..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 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:[!E&&m.jsxs(pt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Gt((re=N.settingsSnapshot)==null?void 0:re.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.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:[m.jsx(G0,{status:N.status}),m.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),m.jsx(uT,{role:N.role}),m.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),m.jsx(pt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(Bb,{value:N.id,onValueChange:h,children:[m.jsx($f,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(Hb,{placeholder:"Choose a node"})}),m.jsx(qf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>m.jsx(Nr,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:O_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(E0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",E_(T.uptime)]})]})]})]}),!C&&m.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."}),m.jsxs(HR,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ix,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(iN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(zn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Node ID",value:T.nodeId,mono:!0}),m.jsx(Ze,{label:"Status",value:N.status}),m.jsx(Ze,{label:"Role",value:N.role}),m.jsx(Ze,{label:"Endpoint",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Joined",value:Gt(N.joinedAt)}),m.jsx(Ze,{label:"Heartbeat",value:Gt(N.lastHeartbeat)}),m.jsx(Ze,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(zn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Host",value:((pe=T.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ze,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),m.jsx(Ze,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ze,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ze,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ze,{label:"Memory",value:T.os?`${Gv(T.os.freeMemoryBytes)} free / ${Gv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&m.jsx("div",{className:"xl:col-span-2",children:m.jsx(y_,{checkedLabel:Gt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:u,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:((q=T.runtime)==null?void 0:q.workDir)??N.workDir})}),m.jsxs(Mn,{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:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(x0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(zn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(Ln,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>m.jsx(R_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),m.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(_E,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(zn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Transport",value:N.transportType??T.transportType??"direct"}),m.jsx(Ze,{label:"Node URL",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),m.jsx(Ze,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),m.jsx(Ze,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(dN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(zn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),m.jsx(Ze,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),m.jsx(Ze,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(zn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((X=T.runtime)==null?void 0:X.workDir)??T.workDir)}),m.jsx(Ze,{label:"Storage",value:((Q=T.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),m.jsx(Ze,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),m.jsx(Ze,{label:"Started",value:Gt((te=T.runtime)==null?void 0:te.startedAt)}),m.jsx(Ze,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(zn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(Ln,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Gt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:_.az,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:_.devtunnel,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:_.claude,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:_.codex,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:_.copilot,statusVariant:Er})]})]})]})]}),m.jsx(e_,{formatDateTime:Gt,viewInfo:T})]})]})}function z_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=y0();return m.jsx(R5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(k_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const Tj="bypass",L_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Cj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Aj=new Set(L_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Rj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],_j=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],U_=new Set(["pending","assigned"]),B_=new Set(["running"]),H_=new Set(["completed","failed","cancelled"]);function jj(n,l){switch(l){case"running":return B_.has(n.status);case"waiting":return U_.has(n.status);case"closed":return H_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Oj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function Mj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function V_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function Dj(n,l,o){return V_(n,l,o).toLowerCase()}function kj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function zj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Lj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Uj(n){switch(n){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 Bj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Hj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Vj(n){return new Date(n).toLocaleString()}function Yj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function Y_(n,l="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(n),ft.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ft.success(l),!0}catch(d){return ft.error(d instanceof Error?d.message:"Failed to copy"),!1}}function $j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const $_={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"},q_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function G_(n){return n.split(".")[0]??"unknown"}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Vx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;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 P_(n){return JSON.stringify(n,null,2)}function Q_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=G_(f.type);return m.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:X_(f.timestamp)}),d?m.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",q_[h]),children:f.type}):m.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",$_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void Y_(P_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx($E,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(C0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Vx(f,o)})]})},f.id)})})})}const K_=["node.","election.","transport."],Z_="cluster.state";function I_(n){return n.type==="node.status"?!1:K_.some(l=>n.type.startsWith(l))}function F_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function J_(n,l){return n?{time:F_(n.timestamp),text:Vx(n,l)}:null}function W_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function e3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function t3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function n3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function a3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function l3({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>I_(k)&&!p.has(k.id)),[l,p]),N=v.useMemo(()=>l.find(k=>k.type===Z_)??w[0],[l,w]),T=v.useMemo(()=>J_(N,i),[N,i]),E=v.useMemo(()=>o.filter(W_),[o]),C=E.some(k=>{var Y;return k.status==="offline"||((Y=k.devtunnelHealth)==null?void 0:Y.status)==="failed"}),A=o.some(k=>k.status==="offline"),_=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const Y=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>Y.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},Y=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",Y)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-label":n?"Live link connected":"Live link reconnecting","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:se("flex h-10 items-center gap-1.5 rounded-sm px-2 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:text-xs",n?"bg-emerald-500/8 text-muted-foreground hover:bg-emerald-500/12":"bg-destructive/8 text-muted-foreground hover:bg-destructive/12",d&&(n?"bg-emerald-500/12 shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]":"bg-destructive/12 shadow-[0_14px_40px_-26px_hsl(var(--destructive)/0.9)]")),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(E0,{className:se("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(vN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),T?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:T.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:T.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[A?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):_?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:se("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",A?"border-destructive/30 bg-destructive/10 text-destructive":_?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:n3(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:Y,status:G}=a3(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Y} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[C?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",C?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:e3(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var re;const{label:Y,status:G}=t3(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(re=k.devtunnelHealth)!=null&&re.reason?`${Y} ${G}: ${k.devtunnelHealth.reason}`:`${Y} ${G}`;return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(DE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx(Q_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x(Y=>new Set(Y).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const jr="fluent",r3="clean",qd="meshy-layout-default-migrated-to-compact",sf="true",o3="compact",i3=new Set(["airy","clean","fluent"]);function s3(n){return n!==null&&i3.has(n)}function Qf(n){return n===o3?"fluent":s3(n)?n:null}function c3(n,l){const o=Qf(n);return o===r3&&l!==sf?jr:o??jr}const Yo="finsight",Yx="default",u3=new Set(["light","dark","system"]),d3=new Set(["porcelain","warm","finsight","edge"]),$x=v.createContext(null);function f3(n){const l=new URLSearchParams(n).get("theme");return qx(l)?l:null}function m3(n){const l=new URLSearchParams(n).get("palette");return Kf(l)}function h3(n){const l=new URLSearchParams(n).get("layout");return Qf(l)}function p3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Kf(n.getAttribute("data-palette"))??Yo,layout:Qf(n.getAttribute("data-layout"))??jr}}function qj(n,l=p3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function g3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?f3(window.location.search)??b3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?m3(window.location.search)??x3(localStorage.getItem("meshy-palette"))??Yo:Yo),[d,f]=v.useState(()=>{if(typeof window<"u"){const h=h3(window.location.search);if(h)return localStorage.setItem(qd,sf),h;const y=c3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,sf),y}return jr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===Yo?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),m.jsx($x.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:f},children:n})}function v3(){const n=v.useContext($x);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function qx(n){return n!==null&&u3.has(n)}function y3(n){return n!==null&&d3.has(n)}function b3(n){return qx(n)?n:null}function Kf(n){return n===Yx?"porcelain":y3(n)?n:null}function x3(n){return n===Yx?null:Kf(n)}const S3=[{value:"light",label:"Light",icon:N0},{value:"dark",label:"Dark",icon:w0},{value:"system",label:"System",icon:S0}],Gx=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}],Xx=[{value:"fluent",label:"Fluent",hint:"Compact neutral"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"}];function w3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=v3(),[f,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?w0:n==="light"?N0:S0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!f)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]),v.useEffect(()=>()=>g(),[]),m.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("rounded-sm border bg-background/70",o!==Yo||u!==jr?"border-primary/60 text-primary":"border-border/60"),title:"Appearance","aria-haspopup":"menu","aria-expanded":f,children:m.jsx(x,{className:"h-4 w-4"})}),f&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 w-[calc(100vw-1rem)] max-w-[28rem] rounded-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:w-[28rem]",children:[m.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),m.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[E3(u)," / ",N3(o)]})]}),m.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] font-medium capitalize text-muted-foreground",children:n})]}),m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:S3.map(({value:N,label:T,icon:E})=>{const C=n===N;return m.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[m.jsx(E,{className:"h-3.5 w-3.5"}),T]},N)})}),m.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[m.jsxs("div",{children:[m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),m.jsx("div",{className:"space-y-1",children:Xx.map(({value:N,label:T,hint:E})=>{const C=u===N;return m.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(mN,{className:"h-2.5 w-2.5"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:Gx.map(({value:N,label:T,hint:E})=>{const C=o===N;return m.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsx(T3,{value:N}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function E3(n){var l;return((l=Xx.find(o=>o.value===n))==null?void 0:l.label)??n}function N3(n){var l;return((l=Gx.find(o=>o.value===n))==null?void 0:l.label)??n}function T3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:se("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function C3(){var y,p;const{cluster:n,events:l,sseConnected:o}=y0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 py-2",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-xl px-3 py-2 sm:gap-3 sm:rounded-xl sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(h0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-sm border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-sm sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden h-10 items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-3 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(G0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(l3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",u&&"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.08)]"),children:m.jsx(T0,{className:"h-4 w-4"})}),m.jsx(z_,{}),m.jsx(w3,{})]})]})}),m.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(d2,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const Xv=v.lazy(async()=>({default:(await Kv(()=>import("./DashboardPage-CUhdRokR.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),A3=v.lazy(async()=>({default:(await Kv(()=>import("./SharedConversationPage-Bh9Bn_0B.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function R3(){return m.jsx(U2,{children:m.jsx(v.Suspense,{fallback:m.jsx(_3,{}),children:m.jsxs(m2,{children:[m.jsx(Tl,{path:"/shared/tasks/:shareId",element:m.jsx(A3,{})}),m.jsxs(Tl,{element:m.jsx(vE,{children:m.jsx(C3,{})}),children:[m.jsx(Tl,{path:"/",element:m.jsx(Xv,{})}),m.jsx(Tl,{path:"/nodes",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks/:id",element:m.jsx(Xv,{})})]})]})})})}function _3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function j3(n){return m.jsx(HT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}fw.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(g3,{children:[m.jsx(R3,{}),m.jsx(j3,{})]})}));export{Gs as $,$E as A,Yn as B,_s as C,Tj as D,Y_ as E,KE as F,V_ as G,x0 as H,Lx as I,HR as J,pt as K,wj as L,ix as M,Cs as N,Vj as O,Ej as P,Bs as Q,rf as R,iN as S,Cj as T,Hs as U,Vs as V,$s as W,C0 as X,qs as Y,Ys as Z,Xs as _,qT as a,tj as a$,Kv as a0,z3 as a1,Ry as a2,A5 as a3,K3 as a4,T0 as a5,Ho as a6,VE as a7,Q3 as a8,Z3 as a9,mE as aA,lj as aB,H3 as aC,U3 as aD,jy as aE,B3 as aF,V3 as aG,W2 as aH,z_ as aI,rj as aJ,oj as aK,M3 as aL,$n as aM,r0 as aN,O3 as aO,y0 as aP,Lj as aQ,kj as aR,jj as aS,Oj as aT,Dj as aU,Mj as aV,F3 as aW,Aj as aX,B_ as aY,nj as aZ,aj as a_,P3 as aa,cN as ab,JE as ac,zj as ad,E0 as ae,Q_ as af,G0 as ag,PE as ah,uT as ai,Yj as aj,U_ as ak,$j as al,Rj as am,_j as an,zx as ao,Bj as ap,Uj as aq,Hj as ar,of as as,ij as at,sj as au,I3 as av,uE as aw,lE as ax,Sj as ay,xj as az,se as b,ej as b0,k3 as b1,L3 as b2,D3 as b3,Y3 as b4,mj as b5,fj as b6,dj as b7,cj as b8,uj as b9,hj as ba,L_ as bb,Pv as bc,zE as bd,vj as be,gj as bf,pj as bg,rN as bh,yj as bi,Nj as bj,bj as bk,Ve as c,q0 as d,X3 as e,J2 as f,q3 as g,$3 as h,DE as i,m as j,Nr as k,G3 as l,W3 as m,Bb as n,$f as o,Hb as p,qf as q,v as r,Zs as s,ft as t,mN as u,J3 as v,N5 as w,Ay as x,_y as y,qj as z};
301
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},ZR=cx,IR=ux,FR=dx,Sx=fx,wx=mx,Ex=yx,Nx=xx,Tx=px,Cx=vx;const rf=ZR,of=IR,JR=FR,Ax=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{className:se("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",n),...l,ref:o}));Ax.displayName=Sx.displayName;const Hs=v.forwardRef(({className:n,...l},o)=>m.jsxs(JR,{children:[m.jsx(Ax,{}),m.jsx(wx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] 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%]",n),...l})]}));Hs.displayName=wx.displayName;const Vs=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const Ys=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ys.displayName="AlertDialogFooter";const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(Tx,{ref:o,className:se("text-lg font-semibold",n),...l}));$s.displayName=Tx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(Cx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Cx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>m.jsx(Ex,{ref:o,className:se(xf(),n),...l}));Gs.displayName=Ex.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>m.jsx(Nx,{ref:o,className:se(xf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Nx.displayName;function WR(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function e_({formatDateTime:n,viewInfo:l}){var i,u,d,f,h,y,p,x;const o=WR(l.packages);return m.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(CE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(zn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(Ln,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?m.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 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:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),m.jsx(PE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.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."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),m.jsx(Sr,{label:"Commit",value:((f=l.repository)==null?void 0:f.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),m.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),m.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),m.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(IE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(zn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(Ln,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),m.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var ic="Checkbox",[t_]=Fa(ic),[n_,Xf]=t_(ic);function a_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Rr({prop:o,defaultProp:u??!1,onChange:y,caller:ic}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!f||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:M,bubbleInput:C,setBubbleInput:A};return m.jsx(n_,{scope:l,...k,children:l_(g)?g(k):i})}var Rx="CheckboxTrigger",_x=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Xf(Rx,n),E=Ie(u,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const _=()=>g(C.current);return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[d,g]),m.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":Pa(y)?"mixed":y,"aria-required":p,"data-state":kx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Oe(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Oe(o,A=>{g(_=>Pa(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});_x.displayName=Rx;var Pf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(a_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(_x,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(Dx,{__scopeCheckbox:o})]})})});Pf.displayName=ic;var jx="CheckboxIndicator",Ox=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Xf(jx,o);return m.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:m.jsx(ze.span,{"data-state":kx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Ox.displayName=jx;var Mx="CheckboxBubbleInput",Dx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Xf(Mx,n),T=Ie(o,N),E=tb(d),C=Gy(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&Y){const B=new Event("click",{bubbles:G});_.indeterminate=Pa(d),Y.call(_,Pa(d)?!1:d),_.dispatchEvent(B)}},[w,E,d,u]);const A=v.useRef(Pa(d)?!1:d);return m.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Dx.displayName=Mx;function l_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function kx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const zx=v.forwardRef(({className:n,...l},o)=>m.jsx(Pf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Ox,{className:se("flex items-center justify-center text-current"),children:m.jsx(_s,{className:"h-3.5 w-3.5"})})}));zx.displayName=Pf.displayName;const Lx=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Lx.displayName="Input";const $v=["queued","running"];function r_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function o_(n){return n==="claude"||n==="codex"||n==="copilot"}function Ux(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return o_(l)?`${n.nodeId}:${l}`:null}function i_(n){return n.status==="succeeded"||n.status==="failed"}async function Bx(n,l={}){const o=l.getOperation??J2,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!i_(f)&&Date.now()<d;)await c_(i),f=await o(n.id);return f}async function s_(n,l=W2){const o=new Set(n),i=await Promise.all($v.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!$v.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Ux(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function c_(n){return new Promise(l=>setTimeout(l,n))}const u_=1500,d_=1e3,f_=9e4;async function m_(n={}){const l=n.fetchHealth??h_,o=n.initialDelayMs??u_,i=n.pollIntervalMs??d_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??g_,h=n.timeoutMs??f_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=p_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function h_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function p_(n){return typeof n=="boolean"?{ok:n}:n}function g_(n){return new Promise(l=>window.setTimeout(l,n))}function v_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function y_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=v_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[_,M]=v.useState(!1),[k,Y]=v.useState(!1);v.useEffect(()=>{E(qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||C||_)return;const re=p.updateAvailable?"update":"restart",pe=S_(T);if(T.port.trim()&&(pe==null?void 0:pe.port)===void 0){ft.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:re,startArgs:pe}:{reason:re};A(!0);try{if(i){const O=await Z2(me);N({...O,pid:O.pid??h,status:"accepted"}),ft.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),m_({previousPid:O.pid??h}).then(q=>{q||(A(!1),ft.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(q=>{A(!1),ft.error(q instanceof Error?q.message:"Runtime restart recovery failed")});return}const ue=await tE(u,me);N({operationId:ue.id,pid:h,status:ue.status}),ft.info(`Restart requested on ${d}. Operation ${$d(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Bx(ue,{timeoutMs:6e4}),le=x_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ft.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ft.error(de.error??`Restart failed on ${d}`):ft.info(`Restart operation ${$d(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),ft.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||C||_)){M(!0);try{const re=await I2();ft.info(`Stopping Meshy process ${re.pid}`)}catch(re){M(!1),ft.error(re instanceof Error?re.message:"Runtime stop failed")}}}const V=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:"ghost",disabled:C||_,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(nN,{className:se("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),m.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsx($s,{className:"text-sm",children:"Stop runtime?"}),m.jsx(qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(rN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),m.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsxs($s,{className:"text-sm",children:[g,"?"]}),m.jsxs(qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(b_,{value:T,onChange:E}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>Y(re=>!re),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(T0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Zs,{className:se("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?$d(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function b_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(Lo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(Bb,{value:l.transport,onValueChange:i=>o("transport",Hx(i)),children:[m.jsx($f,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(Hb,{placeholder:"Transport"})}),m.jsxs(qf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(Lo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(zx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:se("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Lx,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function x_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function qv(n){return{port:w_(n.endpoint),name:n.nodeName,join:"",transport:Hx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function S_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function Hx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function w_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function $d(n){return n.length<=8?n:n.slice(0,8)}function Uo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.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:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(pt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Gt(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function E_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Gv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function N_(n){return n.available?m.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):m.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function T_(n){return n.update?n.update.updateAvailable?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function C_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function A_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({label:n,value:l,mono:o=!1}){return m.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:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:se("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function R_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=T_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(x0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[N_(n),n.metadataStatus&&m.jsx(pt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&m.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),m.jsx(Bo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,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:d})}),m.jsxs(Hs,{children:[m.jsxs(Vs,{children:[m.jsxs($s,{children:["Upgrade ",n.label,"?"]}),m.jsxs(qs,{children:["This runs ",C_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Ys,{children:[m.jsx(Xs,{children:"Cancel"}),m.jsx(Gs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function __(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function j_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.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,runtimeUpdate:o==null?void 0:o.runtimeUpdate,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 O_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function M_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function D_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function k_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,re,pe,me,ue,de,le,O,q,I,ce,F,j,X,Q,W,ee,oe,te,ie;const d=v.useMemo(()=>__(n,l),[n,l]),[f,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===f)??w,T=N?j_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,_=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=r_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(J,xe)=>{const ye=Ux(J);if(!ye||x.current.has(J.id))return;const Se=D_(J),Ye=(xe==null?void 0:xe.agentLabel)??(Se?M_(Se):"Agent"),Le=(xe==null?void 0:xe.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(ye,J));try{const $e=await Bx(J);if($e.status==="succeeded")await(u==null?void 0:u()),g.current.has($e.id)||(ft.success(`${Ye} upgrade finished on ${Le}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(ft.error(A_($e)??`${Ye} upgrade failed`),g.current.add($e.id));else{p(gt=>new Map(gt).set(ye,$e)),ft.info(`${Ye} upgrade is still ${$e.status} on ${Le}`);return}p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===$e.id)&&rt.delete(ye),rt})}catch($e){p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===J.id)&&rt.delete(ye),rt}),ft.error($e instanceof Error?$e.message:`${Ye} upgrade failed`)}finally{x.current.delete(J.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function xe(){let ye;try{ye=await s_(M)}catch{return}if(!J){p(Se=>{const Ye=new Map(Se);for(const[Le,$e]of ye)Ye.set(Le,$e);return Ye});for(const Se of ye.values())B(Se)}}return xe(),()=>{J=!0}},[B,k]);async function V(J){if(N)try{const xe=await eE(N.id,J.id);ft.info(`${J.label} upgrade started on ${N.name}`),await B(xe,{agentLabel:J.label,nodeName:N.name})}catch(xe){ft.error(xe instanceof Error?xe.message:`${J.label} upgrade failed`)}}return!N||!T?m.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..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 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:[!E&&m.jsxs(pt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Gt((re=N.settingsSnapshot)==null?void 0:re.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.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:[m.jsx(G0,{status:N.status}),m.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),m.jsx(uT,{role:N.role}),m.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),m.jsx(pt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(Bb,{value:N.id,onValueChange:h,children:[m.jsx($f,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(Hb,{placeholder:"Choose a node"})}),m.jsx(qf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>m.jsx(Nr,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:O_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(E0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",E_(T.uptime)]})]})]})]}),!C&&m.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."}),m.jsxs(HR,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ix,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(iN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(zn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Node ID",value:T.nodeId,mono:!0}),m.jsx(Ze,{label:"Status",value:N.status}),m.jsx(Ze,{label:"Role",value:N.role}),m.jsx(Ze,{label:"Endpoint",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Joined",value:Gt(N.joinedAt)}),m.jsx(Ze,{label:"Heartbeat",value:Gt(N.lastHeartbeat)}),m.jsx(Ze,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(zn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Host",value:((pe=T.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ze,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),m.jsx(Ze,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ze,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ze,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ze,{label:"Memory",value:T.os?`${Gv(T.os.freeMemoryBytes)} free / ${Gv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&m.jsx("div",{className:"xl:col-span-2",children:m.jsx(y_,{checkedLabel:Gt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:u,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:((q=T.runtime)==null?void 0:q.workDir)??N.workDir})}),m.jsxs(Mn,{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:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(x0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(zn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(Ln,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>m.jsx(R_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),m.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(_E,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(zn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Transport",value:N.transportType??T.transportType??"direct"}),m.jsx(Ze,{label:"Node URL",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),m.jsx(Ze,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),m.jsx(Ze,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(dN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(zn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),m.jsx(Ze,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),m.jsx(Ze,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(zn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((X=T.runtime)==null?void 0:X.workDir)??T.workDir)}),m.jsx(Ze,{label:"Storage",value:((Q=T.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),m.jsx(Ze,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),m.jsx(Ze,{label:"Started",value:Gt((te=T.runtime)==null?void 0:te.startedAt)}),m.jsx(Ze,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(zn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(Ln,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Gt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:_.az,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:_.devtunnel,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:_.claude,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:_.codex,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:_.copilot,statusVariant:Er})]})]})]})]}),m.jsx(e_,{formatDateTime:Gt,viewInfo:T})]})]})}function z_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=y0();return m.jsx(R5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(k_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const Tj="bypass",L_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Cj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Aj=new Set(L_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Rj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],_j=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],U_=new Set(["pending","assigned"]),B_=new Set(["running"]),H_=new Set(["completed","failed","cancelled"]);function jj(n,l){switch(l){case"running":return B_.has(n.status);case"waiting":return U_.has(n.status);case"closed":return H_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Oj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function Mj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function V_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function Dj(n,l,o){return V_(n,l,o).toLowerCase()}function kj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function zj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Lj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Uj(n){switch(n){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 Bj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Hj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Vj(n){return new Date(n).toLocaleString()}function Yj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function Y_(n,l="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(n),ft.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ft.success(l),!0}catch(d){return ft.error(d instanceof Error?d.message:"Failed to copy"),!1}}function $j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const $_={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"},q_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function G_(n){return n.split(".")[0]??"unknown"}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Vx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;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 P_(n){return JSON.stringify(n,null,2)}function Q_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=G_(f.type);return m.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:X_(f.timestamp)}),d?m.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",q_[h]),children:f.type}):m.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",$_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void Y_(P_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx($E,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(C0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Vx(f,o)})]})},f.id)})})})}const K_=["node.","election.","transport."],Z_="cluster.state";function I_(n){return n.type==="node.status"?!1:K_.some(l=>n.type.startsWith(l))}function F_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function J_(n,l){return n?{time:F_(n.timestamp),text:Vx(n,l)}:null}function W_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function e3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function t3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function n3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function a3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function l3({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>I_(k)&&!p.has(k.id)),[l,p]),N=v.useMemo(()=>l.find(k=>k.type===Z_)??w[0],[l,w]),T=v.useMemo(()=>J_(N,i),[N,i]),E=v.useMemo(()=>o.filter(W_),[o]),C=E.some(k=>{var Y;return k.status==="offline"||((Y=k.devtunnelHealth)==null?void 0:Y.status)==="failed"}),A=o.some(k=>k.status==="offline"),_=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const Y=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>Y.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},Y=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",Y)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-label":n?"Live link connected":"Live link reconnecting","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:se("flex h-10 items-center gap-1.5 rounded-sm px-2 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:text-xs",n?"bg-emerald-500/8 text-muted-foreground hover:bg-emerald-500/12":"bg-destructive/8 text-muted-foreground hover:bg-destructive/12",d&&(n?"bg-emerald-500/12 shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]":"bg-destructive/12 shadow-[0_14px_40px_-26px_hsl(var(--destructive)/0.9)]")),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(E0,{className:se("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(vN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),T?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:T.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:T.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[A?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):_?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:se("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",A?"border-destructive/30 bg-destructive/10 text-destructive":_?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:n3(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:Y,status:G}=a3(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Y} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[C?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",C?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:e3(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var re;const{label:Y,status:G}=t3(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(re=k.devtunnelHealth)!=null&&re.reason?`${Y} ${G}: ${k.devtunnelHealth.reason}`:`${Y} ${G}`;return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(DE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx(Q_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x(Y=>new Set(Y).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const jr="airy",r3="clean",qd="meshy-layout-default-migrated-to-compact",sf="true",o3="compact",i3=new Set(["airy","clean","fluent"]);function s3(n){return n!==null&&i3.has(n)}function Qf(n){return n===o3?"fluent":s3(n)?n:null}function c3(n,l){const o=Qf(n);return o===r3&&l!==sf?jr:o??jr}const Yo="finsight",Yx="default",u3=new Set(["light","dark","system"]),d3=new Set(["porcelain","warm","finsight","edge"]),$x=v.createContext(null);function f3(n){const l=new URLSearchParams(n).get("theme");return qx(l)?l:null}function m3(n){const l=new URLSearchParams(n).get("palette");return Kf(l)}function h3(n){const l=new URLSearchParams(n).get("layout");return Qf(l)}function p3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Kf(n.getAttribute("data-palette"))??Yo,layout:Qf(n.getAttribute("data-layout"))??jr}}function qj(n,l=p3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function g3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?f3(window.location.search)??b3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?m3(window.location.search)??x3(localStorage.getItem("meshy-palette"))??Yo:Yo),[d,f]=v.useState(()=>{if(typeof window<"u"){const h=h3(window.location.search);if(h)return localStorage.setItem(qd,sf),h;const y=c3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,sf),y}return jr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===Yo?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),m.jsx($x.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:f},children:n})}function v3(){const n=v.useContext($x);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function qx(n){return n!==null&&u3.has(n)}function y3(n){return n!==null&&d3.has(n)}function b3(n){return qx(n)?n:null}function Kf(n){return n===Yx?"porcelain":y3(n)?n:null}function x3(n){return n===Yx?null:Kf(n)}const S3=[{value:"light",label:"Light",icon:N0},{value:"dark",label:"Dark",icon:w0},{value:"system",label:"System",icon:S0}],Gx=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}],Xx=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function w3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=v3(),[f,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?w0:n==="light"?N0:S0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!f)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]),v.useEffect(()=>()=>g(),[]),m.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("rounded-sm border bg-background/70",o!==Yo||u!==jr?"border-primary/60 text-primary":"border-border/60"),title:"Appearance","aria-haspopup":"menu","aria-expanded":f,children:m.jsx(x,{className:"h-4 w-4"})}),f&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 w-[calc(100vw-1rem)] max-w-[28rem] rounded-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:w-[28rem]",children:[m.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),m.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[E3(u)," / ",N3(o)]})]}),m.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] font-medium capitalize text-muted-foreground",children:n})]}),m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:S3.map(({value:N,label:T,icon:E})=>{const C=n===N;return m.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[m.jsx(E,{className:"h-3.5 w-3.5"}),T]},N)})}),m.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[m.jsxs("div",{children:[m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),m.jsx("div",{className:"space-y-1",children:Xx.map(({value:N,label:T,hint:E})=>{const C=u===N;return m.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(mN,{className:"h-2.5 w-2.5"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:Gx.map(({value:N,label:T,hint:E})=>{const C=o===N;return m.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsx(T3,{value:N}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function E3(n){var l;return((l=Xx.find(o=>o.value===n))==null?void 0:l.label)??n}function N3(n){var l;return((l=Gx.find(o=>o.value===n))==null?void 0:l.label)??n}function T3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:se("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function C3(){var y,p;const{cluster:n,events:l,sseConnected:o}=y0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 py-2",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-xl px-3 py-2 sm:gap-3 sm:rounded-xl sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(h0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-sm border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-sm sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden h-10 items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-3 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(G0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(l3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",u&&"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.08)]"),children:m.jsx(T0,{className:"h-4 w-4"})}),m.jsx(z_,{}),m.jsx(w3,{})]})]})}),m.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(d2,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const Xv=v.lazy(async()=>({default:(await Kv(()=>import("./DashboardPage-CdCiYD4R.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),A3=v.lazy(async()=>({default:(await Kv(()=>import("./SharedConversationPage-FgVTiQ2B.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function R3(){return m.jsx(U2,{children:m.jsx(v.Suspense,{fallback:m.jsx(_3,{}),children:m.jsxs(m2,{children:[m.jsx(Tl,{path:"/shared/tasks/:shareId",element:m.jsx(A3,{})}),m.jsxs(Tl,{element:m.jsx(vE,{children:m.jsx(C3,{})}),children:[m.jsx(Tl,{path:"/",element:m.jsx(Xv,{})}),m.jsx(Tl,{path:"/nodes",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks/:id",element:m.jsx(Xv,{})})]})]})})})}function _3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function j3(n){return m.jsx(HT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}fw.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(g3,{children:[m.jsx(R3,{}),m.jsx(j3,{})]})}));export{Gs as $,$E as A,Yn as B,_s as C,Tj as D,Y_ as E,KE as F,V_ as G,x0 as H,Lx as I,HR as J,pt as K,wj as L,ix as M,Cs as N,Vj as O,Ej as P,Bs as Q,rf as R,iN as S,Cj as T,Hs as U,Vs as V,$s as W,C0 as X,qs as Y,Ys as Z,Xs as _,qT as a,tj as a$,Kv as a0,z3 as a1,Ry as a2,A5 as a3,K3 as a4,T0 as a5,Ho as a6,VE as a7,Q3 as a8,Z3 as a9,mE as aA,lj as aB,H3 as aC,U3 as aD,jy as aE,B3 as aF,V3 as aG,W2 as aH,z_ as aI,rj as aJ,oj as aK,M3 as aL,$n as aM,r0 as aN,O3 as aO,y0 as aP,Lj as aQ,kj as aR,jj as aS,Oj as aT,Dj as aU,Mj as aV,F3 as aW,Aj as aX,B_ as aY,nj as aZ,aj as a_,P3 as aa,cN as ab,JE as ac,zj as ad,E0 as ae,Q_ as af,G0 as ag,PE as ah,uT as ai,Yj as aj,U_ as ak,$j as al,Rj as am,_j as an,zx as ao,Bj as ap,Uj as aq,Hj as ar,of as as,ij as at,sj as au,I3 as av,uE as aw,lE as ax,Sj as ay,xj as az,se as b,ej as b0,k3 as b1,L3 as b2,D3 as b3,Y3 as b4,mj as b5,fj as b6,dj as b7,cj as b8,uj as b9,hj as ba,L_ as bb,Pv as bc,zE as bd,vj as be,gj as bf,pj as bg,rN as bh,yj as bi,Nj as bj,bj as bk,Ve as c,q0 as d,X3 as e,J2 as f,q3 as g,$3 as h,DE as i,m as j,Nr as k,G3 as l,W3 as m,Bb as n,$f as o,Hb as p,qf as q,v as r,Zs as s,ft as t,mN as u,J3 as v,N5 as w,Ay as x,_y as y,qj as z};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Dcj0nR-j.js";/**
1
+ import{c as a}from"./index-XMBEftiF.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -5,8 +5,8 @@
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-Dcj0nR-j.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-CXPXpidI.css">
8
+ <script type="module" crossorigin src="/assets/index-XMBEftiF.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-DG1iTjAc.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-node",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "packageName": "meshy-node",
3
- "packageVersion": "0.6.7",
3
+ "packageVersion": "0.6.8",
4
4
  "packages": {
5
5
  "workspace": {
6
6
  "name": "meshy",
7
- "version": "0.6.7"
7
+ "version": "0.6.8"
8
8
  },
9
9
  "node": {
10
10
  "name": "meshy-node",
11
- "version": "0.6.7"
11
+ "version": "0.6.8"
12
12
  },
13
13
  "core": {
14
14
  "name": "@meshy/core",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "repository": {
27
27
  "url": "https://github.com/ai-microsoft/meshy",
28
- "branch": "release0525",
29
- "commit": "f3ca6c2"
28
+ "branch": "SpinEffect",
29
+ "commit": "d53087f"
30
30
  }
31
31
  }
@@ -1 +0,0 @@
1
- .agent-progress-terminal-spinner{display:inline-grid;place-items:center;color:hsl(var(--primary) / .72);font-family:var(--font-mono);font-size:13px;line-height:1}.agent-progress-terminal-spinner:before{content:"⠋";animation:agent-progress-terminal-spin .96s steps(1,end) infinite}.agent-progress-sweep-text{color:transparent;background-image:linear-gradient(90deg,hsl(var(--muted-foreground) / .44),hsl(var(--muted-foreground) / .44) 36%,hsl(var(--primary) / .92) 45%,hsl(var(--foreground) / .96),hsl(var(--primary) / .92) 55%,hsl(var(--muted-foreground) / .44) 64%,hsl(var(--muted-foreground) / .44));background-size:260% 100%;background-position:120% 50%;background-clip:text;-webkit-background-clip:text;animation:agent-progress-sweep 2.1s linear infinite}@keyframes agent-progress-terminal-spin{0%{content:"⠋"}12.5%{content:"⠙"}25%{content:"⠹"}37.5%{content:"⠸"}50%{content:"⠼"}62.5%{content:"⠴"}75%{content:"⠦"}87.5%{content:"⠧"}}@keyframes agent-progress-sweep{0%{background-position:120% 50%}to{background-position:-120% 50%}}@media(prefers-reduced-motion:reduce){.agent-progress-terminal-spinner:before{animation:none}.agent-progress-sweep-text{color:hsl(var(--muted-foreground) / .7);background-image:none;animation:none}}