meshy-node 0.7.12 → 0.7.13
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.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-2RXNOej0.js +134 -0
- package/dashboard/assets/{DashboardShared-B06oRGIL.js → DashboardShared-Btqjrg2m.js} +1 -1
- package/dashboard/assets/{DiffTab-DTCrMNo4.js → DiffTab-dDJwxCuZ.js} +1 -1
- package/dashboard/assets/FilesTab-BdrrZSEY.js +22 -0
- package/dashboard/assets/{PreviewTab-AkNVXGUv.js → PreviewTab-DS5OePrB.js} +1 -1
- package/dashboard/assets/{SharedConversationPage-DA0lmaQJ.js → SharedConversationPage-CcAmmobW.js} +3 -3
- package/dashboard/assets/{file-HNfXsNaN.js → file-3IW0g4J1.js} +1 -1
- package/dashboard/assets/index-CNJwYgC6.css +1 -0
- package/dashboard/assets/{index-Cei-Aled.js → index-DeGSlcwy.js} +2 -2
- package/dashboard/assets/{play-DBL83S4p.js → play-DCfyl9eW.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +76 -62
- package/package.json +1 -1
- package/runtime-metadata.json +4 -4
- package/dashboard/assets/DashboardPage-Buhvr58K.js +0 -134
- package/dashboard/assets/FilesTab-CpmnikP6.js +0 -22
- package/dashboard/assets/index-DagywPq_.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-2RXNOej0.js","assets/DashboardShared-Btqjrg2m.js","assets/play-DCfyl9eW.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-CcAmmobW.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Sw(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const c in i)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(i,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>i[c]})}}}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 c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();function i0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ed={exports:{}},ko={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -318,4 +318,4 @@ You can add a description to the \`${Or}\` by passing a \`${Mx}\` component as a
|
|
|
318
318
|
|
|
319
319
|
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 \`${Or}\`. 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.
|
|
320
320
|
|
|
321
|
-
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},m_=Nx,h_=Tx,p_=Cx,Lx=Ax,Ux=Rx,Bx=Dx,Hx=zx,Vx=jx,$x=Ox;const hf=m_,pf=h_,g_=p_,Yx=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{className:le("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}));Yx.displayName=Lx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>f.jsxs(g_,{children:[f.jsx(Yx,{}),f.jsx(Ux,{ref:o,className:le("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})]}));qs.displayName=Ux.displayName;const Gs=({className:n,...l})=>f.jsx("div",{className:le("flex flex-col space-y-2 text-center sm:text-left",n),...l});Gs.displayName="AlertDialogHeader";const Ps=({className:n,...l})=>f.jsx("div",{className:le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ps.displayName="AlertDialogFooter";const Xs=v.forwardRef(({className:n,...l},o)=>f.jsx(Vx,{ref:o,className:le("text-lg font-semibold",n),...l}));Xs.displayName=Vx.displayName;const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx($x,{ref:o,className:le("text-sm text-muted-foreground",n),...l}));Ks.displayName=$x.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:le(Rf(),n),...l}));Qs.displayName=Bx.displayName;const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Hx,{ref:o,className:le(Rf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Zs.displayName=Hx.displayName;const v_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function y_({status:n}){return f.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5",children:[n==="online"&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-30"}),f.jsx("span",{className:le("relative inline-flex h-2.5 w-2.5 rounded-full",v_[n])})]})}function b_({role:n,size:l="default"}){return f.jsx(xt,{variant:n==="leader"?"default":"secondary",className:le(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const qx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function Wj({status:n,size:l="default"}){const o=qx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(xt,{variant:o.variant,className:le("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:le("rounded-full",o.dotClass)}),n]})}function eM({status:n,isNative:l=!1,size:o="default",className:i}){const c=qx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:le("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:le("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:le("rounded-full bg-sky-500",m),title:"native"})]})}const x_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function tM({priority:n}){const l=x_[n];return f.jsx(xt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function S_(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 Cr({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.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 w_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=S_(l.packages);return f.jsxs(Ys,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Yn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(qn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.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:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(sN,{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"})]}):f.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."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Cr,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Cr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Cr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Cr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Cr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Cr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(hN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Yn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(qn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return f.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:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),f.jsx(xt,{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 dc="Checkbox",[E_]=tl(dc),[N_,Wf]=E_(dc);function T_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:c,disabled:d,form:m,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Dr({prop:o,defaultProp:c??!1,onChange:y,caller:dc}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!m||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Ia(c)?!1:c,isFormControl:M,bubbleInput:C,setBubbleInput:A};return f.jsx(N_,{scope:l,...k,children:C_(g)?g(k):i})}var Gx="CheckboxTrigger",Px=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Wf(Gx,n),E=We(c,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]),f.jsx(He.button,{type:"button",role:"checkbox","aria-checked":Ia(y)?"mixed":y,"aria-required":p,"data-state":Ix(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(_=>Ia(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});Px.displayName=Gx;var em=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:c,defaultChecked:d,required:m,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return f.jsx(T_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Px,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Zx,{__scopeCheckbox:o})]})})});em.displayName=dc;var Xx="CheckboxIndicator",Kx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=Wf(Xx,o);return f.jsx(Hr,{present:i||Ia(d.checked)||d.checked===!0,children:f.jsx(He.span,{"data-state":Ix(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});Kx.displayName=Xx;var Qx="CheckboxBubbleInput",Zx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Wf(Qx,n),T=We(o,N),E=gb(d),C=rb(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,X=!c.current;if(E!==d&&Y){const V=new Event("click",{bubbles:X});_.indeterminate=Ia(d),Y.call(_,Ia(d)?!1:d),_.dispatchEvent(V)}},[w,E,d,c]);const A=v.useRef(Ia(d)?!1:d);return f.jsx(He.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??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%)"}})});Zx.displayName=Qx;function C_(n){return typeof n=="function"}function Ia(n){return n==="indeterminate"}function Ix(n){return Ia(n)?"indeterminate":n?"checked":"unchecked"}const Fx=v.forwardRef(({className:n,...l},o)=>f.jsx(em,{ref:o,className:le("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:f.jsx(Kx,{className:le("flex items-center justify-center text-current"),children:f.jsx(Ds,{className:"h-3.5 w-3.5"})})}));Fx.displayName=em.displayName;const tm=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:le("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}));tm.displayName="Input";const Jv=["queued","running"];function A_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function R_(n){return n==="claude"||n==="codex"||n==="copilot"}function Jx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return R_(l)?`${n.nodeId}:${l}`:null}function __(n){return n.status==="succeeded"||n.status==="failed"}async function Wx(n,l={}){const o=l.getOperation??pE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!__(m)&&Date.now()<d;)await M_(i),m=await o(n.id);return m}async function j_(n,l=gE){const o=new Set(n),i=await Promise.all(Jv.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!Jv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Jx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function M_(n){return new Promise(l=>setTimeout(l,n))}const O_=1500,D_=1e3,k_=9e4;async function e1(n={}){const l=n.fetchHealth??z_,o=n.initialDelayMs??O_,i=n.pollIntervalMs??D_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??U_,h=n.timeoutMs??k_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=L_(await l());if(!x.ok){p=!0,await m(i);continue}if(c===void 0||x.pid!==void 0&&x.pid!==c||p)return d(),!0;await m(i)}return!1}async function z_(){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 L_(n){return typeof n=="boolean"?{ok:n}:n}function U_(n){return new Promise(l=>window.setTimeout(l,n))}function B_(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 H_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=B_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>Wv({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(Wv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function X(){if(!c||C||_)return;const se=p.updateAvailable?"update":"restart",me=Y_(T);if(T.port.trim()&&(me==null?void 0:me.port)===void 0){Fe.error("Runtime restart port must be a positive integer");return}const ce=me?{reason:se,startArgs:me}:{reason:se};A(!0);try{if(i){const O=await M0(ce);N({...O,pid:O.pid??h,status:"accepted"}),Fe.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.`),e1({previousPid:O.pid??h}).then($=>{$||(A(!1),Fe.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch($=>{A(!1),Fe.error($ instanceof Error?$.message:"Runtime restart recovery failed")});return}const ue=await yE(c,ce);N({operationId:ue.id,pid:h,status:ue.status}),Fe.info(`Restart requested on ${d}. Operation ${Pd(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const fe=await Wx(ue,{timeoutMs:6e4}),re=$_(fe);N({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:fe.id,pid:(re==null?void 0:re.pid)??h,status:fe.status}),fe.status==="succeeded"?(await(m==null?void 0:m()),Fe.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):fe.status==="failed"?Fe.error(fe.error??`Restart failed on ${d}`):Fe.info(`Restart operation ${Pd(fe.id)} is still ${fe.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),Fe.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function V(){if(!(!i||C||_)){M(!0);try{const se=await mE();Fe.info(`Stopping Meshy process ${se.pid}`)}catch(se){M(!1),Fe.error(se instanceof Error?se.message:"Runtime stop failed")}}}const H=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Os,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(xt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:H})]})]}),f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsxs(bn,{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:[f.jsx(wN,{className:le("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),f.jsxs(qs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Gs,{className:"space-y-1",children:[f.jsx(Xs,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Ks,{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."})]}),f.jsxs(Ps,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void V(),children:"Stop runtime"})]})]})]}),f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsxs(bn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(B0,{className:le("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(qs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Gs,{className:"space-y-1",children:[f.jsxs(Xs,{className:"text-sm",children:[g,"?"]}),f.jsxs(Ks,{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."]})]}),f.jsx(V_,{value:T,onChange:E}),f.jsxs(Ps,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void X(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>Y(se=>!se),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:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx($0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Xo,{className:le("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{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}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Pd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.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 V_({onChange:n,value:l}){const o=(i,c)=>{n({...l,[i]:c})};return f.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[f.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsx(Bo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Bo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Bo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(Wb,{value:l.transport,onValueChange:i=>o("transport",t1(i)),children:[f.jsx(If,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ex,{placeholder:"Transport"})}),f.jsxs(Ff,{children:[f.jsx(_r,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Bo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Bo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.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:[f.jsx(Fx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Bo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:le("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(tm,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:le("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function $_(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 Wv(n){return{port:q_(n.endpoint),name:n.nodeName,join:"",transport:t1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function Y_(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 t1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function q_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Pd(n){return n.length<=8?n:n.slice(0,8)}function Ho({formatDateTime:n,name:l,status:o,statusVariant:i}){return f.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:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),f.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&f.jsx(xt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(xt,{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 Qt(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 G_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),c=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${c}m`:`${c}m`}function e0(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 Rr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function P_(n){return n.available?f.jsxs(xt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx($o,{className:"h-3 w-3"}),"Available"]}):f.jsxs(xt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(nN,{className:"h-3 w-3"}),"Unavailable"]})}function X_(n){return n.update?n.update.updateAvailable?f.jsxs(xt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(xt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function K_(n){return n.available?null:n.metadataStatus??null}function Q_(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 Z_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Je({label:n,value:l,mono:o=!1}){return f.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:[f.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),f.jsx("span",{className:le("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Vo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:le("min-w-0 space-y-0.5",i),children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.jsx("div",{className:le("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function I_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=X_(n),m=!!o,h=K_(n);return f.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[f.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[f.jsxs("div",{className:"min-w-0 space-y-1.5",children:[f.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[f.jsx(z0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"truncate",children:n.label})]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",f.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[P_(n),h&&f.jsx(xt,{variant:Rr(h),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:h})]})]}),f.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[f.jsx(Vo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Vo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Vo,{label:"Checked",value:Qt(n.checkedAt)}),n.update&&f.jsx(Vo,{label:"Update check",value:Qt(n.update.checkedAt)}),f.jsx(Vo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),f.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?f.jsxs(xt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsx("button",{type:"button",disabled:m,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})}),f.jsxs(qs,{children:[f.jsxs(Gs,{children:[f.jsxs(Xs,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Ks,{children:["This runs ",Q_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Ps,{children:[f.jsx(Zs,{children:"Cancel"}),f.jsx(Qs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((p=n.update)==null?void 0:p.detail)&&f.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&&f.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 F_(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 W_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function e3(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function t3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function n3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,se,me,ce,ue,fe,re,O,$,F,de,Q,j,G,K,W,ee,oe,te,ie;const d=v.useMemo(()=>F_(n,l),[n,l]),[m,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===m)??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,_=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=A_(d),X=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const V=v.useCallback(async(J,be)=>{const ye=Jx(J);if(!ye||x.current.has(J.id))return;const Se=t3(J),Ve=(be==null?void 0:be.agentLabel)??(Se?e3(Se):"Agent"),Le=(be==null?void 0:be.nodeName)??X.get(J.nodeId)??J.nodeId;x.current.add(J.id),p(je=>new Map(je).set(ye,J));try{const je=await Wx(J);if(je.status==="succeeded")await(c==null?void 0:c()),g.current.has(je.id)||(Fe.success(`${Ve} upgrade finished on ${Le}`),g.current.add(je.id));else if(je.status==="failed")g.current.has(je.id)||(Fe.error(Z_(je)??`${Ve} upgrade failed`),g.current.add(je.id));else{p(ft=>new Map(ft).set(ye,je)),Fe.info(`${Ve} upgrade is still ${je.status} on ${Le}`);return}p(ft=>{const ot=new Map(ft),zt=ot.get(ye);return(!zt||zt.id===je.id)&&ot.delete(ye),ot})}catch(je){p(ft=>{const ot=new Map(ft),zt=ot.get(ye);return(!zt||zt.id===J.id)&&ot.delete(ye),ot}),Fe.error(je instanceof Error?je.message:`${Ve} upgrade failed`)}finally{x.current.delete(J.id)}},[c,X]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function be(){let ye;try{ye=await j_(M)}catch{return}if(!J){p(Se=>{const Ve=new Map(Se);for(const[Le,je]of ye)Ve.set(Le,je);return Ve});for(const Se of ye.values())V(Se)}}return be(),()=>{J=!0}},[V,k]);async function H(J){if(N)try{const be=await vE(N.id,J.id);Fe.info(`${J.label} upgrade started on ${N.name}`),await V(be,{agentLabel:J.label,nodeName:N.name})}catch(be){Fe.error(be instanceof Error?be.message:`${J.label} upgrade failed`)}}return!N||!T?f.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..."}):f.jsxs("div",{className:"space-y-3",children:[f.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&&f.jsxs(xt,{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 ",Qt((se=N.settingsSnapshot)==null?void 0:se.collectedAt)]}),f.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.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:[f.jsx(y_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(b_,{role:N.role}),f.jsx(xt,{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"}),f.jsx(xt,{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"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(Wb,{value:N.id,onValueChange:h,children:[f.jsx(If,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ex,{placeholder:"Choose a node"})}),f.jsx(Ff,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(_r,{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:W_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(xt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(NN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(xt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",G_(T.uptime)]})]})]})]}),!C&&f.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."}),f.jsxs(a_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(wx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(_s,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(_s,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(_s,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Ys,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(H0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Yn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(Je,{label:"Status",value:N.status}),f.jsx(Je,{label:"Role",value:N.role}),f.jsx(Je,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(Je,{label:"Joined",value:Qt(N.joinedAt)}),f.jsx(Je,{label:"Heartbeat",value:Qt(N.lastHeartbeat)}),f.jsx(Je,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Yn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Host",value:((me=T.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(Je,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(Je,{label:"Arch",value:((ce=T.os)==null?void 0:ce.arch)??"Unavailable"}),f.jsx(Je,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),f.jsx(Je,{label:"Cores",value:String(((fe=T.os)==null?void 0:fe.cpuCount)??"Unavailable")}),f.jsx(Je,{label:"Memory",value:T.os?`${e0(T.os.freeMemoryBytes)} free / ${e0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(H_,{checkedLabel:Qt(A.checkedAt),disableAuthDefault:((re=T.auth)==null?void 0:re.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:(($=T.runtime)==null?void 0:$.workDir)??N.workDir})}),f.jsxs(Hn,{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:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(z0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Yn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(qn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(I_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:H},J.id))})]})]}),f.jsxs(Ys,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(XE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Yn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(Je,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(Je,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(Je,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(Je,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(DN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Yn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Enabled",value:(F=T.auth)!=null&&F.enabled?"Yes":"No"}),f.jsx(Je,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(Je,{label:"Allowed users",value:(Q=T.auth)!=null&&Q.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Yn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((G=T.runtime)==null?void 0:G.workDir)??T.workDir)}),f.jsx(Je,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(Je,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),f.jsx(Je,{label:"Started",value:Qt((te=T.runtime)==null?void 0:te.startedAt)}),f.jsx(Je,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Os,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Yn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(qn,{className:"space-y-3 px-3 pb-2.5",children:[f.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Qt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Ho,{formatDateTime:Qt,name:"Azure CLI",status:_.az,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"DevTunnel",status:_.devtunnel,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Claude Code",status:_.claude,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Codex",status:_.codex,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Copilot CLI",status:_.copilot,statusVariant:Rr})]})]})]})]}),f.jsx(w_,{formatDateTime:Qt,viewInfo:T})]})]})}function a3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=D0();return f.jsx(X5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(n3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const nM="codex",aM="bypass",l3=[{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"claudecode",label:"Claude Code",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"}],lM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],rM=new Set(l3.filter(n=>n.supportsFollowUp).map(n=>n.value)),oM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],iM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],r3=new Set(["pending","assigned"]),o3=new Set(["running"]),i3=new Set(["completed","failed","cancelled"]),sM=10;function cM(n,l){switch(l){case"running":return o3.has(n.status);case"waiting":return r3.has(n.status);case"closed":return i3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function uM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function dM(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 s3(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(c=>c.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function fM(n,l,o){return s3(n,l,o).toLowerCase()}function mM(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 hM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function pM(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 gM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function vM(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 yM(n){return new Date(n).toLocaleString()}function bM(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),c=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}async function c3(n,l="Copied to clipboard"){var o,i,c;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),Fe.success(l),!0;const d=globalThis.document,m=(c=d==null?void 0:d.execCommand)==null?void 0:c.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof m!="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=m("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Fe.success(l),!0}catch(d){return Fe.error(d instanceof Error?d.message:"Failed to copy"),!1}}const u3="default workspace";function js(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function d3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function f3(n,l){const o=js(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function m3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return js(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return u3;if(d3(i)||!n.assignedTo)return js(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?f3(c,i):js(i)}function xM(n,l,o,i){const c=new Map;for(const m of n){const h=m.assignedTo??null,y=h??"__unassigned__",p=h?l.get(h)??m.assignedNodeName??h.slice(0,8):"Unassigned",x=m3(m,i);c.has(y)||c.set(y,{nodeId:h,nodeName:p,dirMap:new Map});const g=c.get(y);g.dirMap.has(x)||g.dirMap.set(x,[]),g.dirMap.get(x).push(m)}const d=Array.from(c.values()).map(({nodeId:m,nodeName:h,dirMap:y})=>{const p=Array.from(y.entries()).map(([x,g])=>({path:x,tasks:g})).sort((x,g)=>g.tasks.length-x.tasks.length||x.path.localeCompare(g.path));return{nodeId:m,nodeName:h,dirs:p}});return d.sort((m,h)=>{if(o){if(m.nodeId===o)return-1;if(h.nodeId===o)return 1}return m.nodeId===null?1:h.nodeId===null?-1:m.nodeName.localeCompare(h.nodeName)}),d}const h3={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"},p3={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 g3(n){return n.split(".")[0]??"unknown"}function v3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Ar(n,l){return(l==null?void 0:l.get(n))??n}function n1(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`${Ar(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Ar(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 ${Ar(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 ${Ar(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Ar(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Ar(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 y3(n){return JSON.stringify(n,null,2)}function b3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:c="default"}){if(n.length===0)return null;const d=c==="compact";return f.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:f.jsx("div",{className:"space-y-1.5",children:n.map(m=>{const h=g3(m.type);return f.jsx("div",{className:le("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.jsx("div",{className:le("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:v3(m.timestamp)}),d?f.jsx("span",{className:le("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",p3[h]),children:m.type}):f.jsx(xt,{variant:"outline",className:le("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",h3[h]),children:m.type})]}),f.jsxs("div",{className:le("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(bn,{type:"button",variant:"ghost",size:"icon",className:le("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>void c3(y3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(lN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(bn,{type:"button",variant:"ghost",size:"icon",className:le("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(Y0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:n1(m,o)})]})},m.id)})})})}const x3=["node.","election.","transport."],S3="cluster.state";function w3(n){return n.type==="node.status"?!1:x3.some(l=>n.type.startsWith(l))}function E3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function N3(n,l){return n?{time:E3(n.timestamp),text:n1(n,l)}:null}function T3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function C3(n){if(n.length===0)return"No node tunnel";const l=n.filter(c=>c.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(c=>{var d;return((d=c.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(c=>{var d;return c.status!=="offline"&&((d=c.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function A3(n,l){var c;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=((c=n.devtunnelHealth)==null?void 0:c.status)??"checking";return{label:o,status:i}}function R3(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 _3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function j3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onReload:p,onRestart:x}){const[g,w]=v.useState(m),[N,T]=v.useState(h),[E,C]=v.useState(!0),[A,_]=v.useState(new Set),[M,k]=v.useState(!1),[Y,X]=v.useState(!1),V=v.useRef(null),H=v.useRef(null),ne=v.useMemo(()=>l.filter(xe=>w3(xe)&&!A.has(xe.id)),[l,A]),se=v.useMemo(()=>l.find(xe=>xe.type===S3)??ne[0],[l,ne]),me=v.useMemo(()=>N3(se,c),[se,c]),ce=v.useMemo(()=>{const xe=new Map(o.map(et=>[et.id,et]));return i&&xe.set(i.id,i),Array.from(xe.values())},[i,o]),ue=v.useMemo(()=>ce.filter(T3),[ce]),fe=ue.some(xe=>{var et;return xe.status==="offline"||((et=xe.devtunnelHealth)==null?void 0:et.status)==="failed"}),re=ce.some(xe=>xe.status==="offline"),O=ce.some(xe=>xe.status==="busy"),$=ce.length>0,F=(i==null?void 0:i.name)??"offline",de=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",Q=d!==null,j=!!(Q&&(d!=null&&d.updateAvailable)&&d.latestVersion),G=(d==null?void 0:d.latestVersion)??null,K=!!(Q&&!j&&!G&&(d!=null&&d.detail)),W=M?"Relaunching runtime...":"Relaunch to apply update",ee=Y?"Downloading and installing desktop update...":j&&G?`Available version ${G}`:K?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",oe=!!p,te=oe,ie=Q||!!x,J=Q||!!x||oe,be=ie?Q?"Update":"Relaunch":"Reload",ye=ie?Q?ee:W:"Reload dashboard page",Se=ie?Q?Y:M:!1,Ve=ie?Q?Se||!j||!y:Se:!1,Le=Q?j&&G?`Install desktop update ${G}`:K?"Desktop update unavailable":"Desktop is current":ie?M?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function je(){H.current&&(clearTimeout(H.current),H.current=null)}function ft(){je(),w(!0)}function ot(){je(),H.current=setTimeout(()=>{w(!1),H.current=null},180)}function zt(){je()}function mt(){je(),T(!1),w(!1)}async function ll(){if(!(!x||M)){k(!0);try{await x()}finally{k(!1)}}}async function rl(){if(!(!j||!y||Y)){X(!0);try{await y()}finally{X(!1)}}}async function St(){if(!ie){await Sn();return}if(Q){await rl();return}await ll()}async function Sn(){p&&(T(!1),await p())}return v.useEffect(()=>()=>{je()},[]),v.useEffect(()=>{_(xe=>{if(xe.size===0)return xe;const et=new Set(l.map(Tt=>Tt.id)),Xe=new Set(Array.from(xe).filter(Tt=>et.has(Tt)));return Xe.size===xe.size?xe:Xe})},[l]),v.useEffect(()=>{g||T(!1)},[g]),v.useEffect(()=>{if(!g)return;const xe=Xe=>{var Tt;(Tt=V.current)!=null&&Tt.contains(Xe.target)||(je(),T(!1),w(!1))},et=Xe=>{Xe.key==="Escape"&&(je(),T(!1),w(!1))};return document.addEventListener("pointerdown",xe),document.addEventListener("keydown",et),()=>{document.removeEventListener("pointerdown",xe),document.removeEventListener("keydown",et)}},[g]),f.jsxs("div",{ref:V,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":g,"aria-haspopup":"dialog",onClick:()=>w(xe=>!xe),onMouseEnter:ft,onMouseLeave:ot,className:le("flex h-8 max-w-[18rem] items-center gap-1.5 rounded-sm px-2 text-[10px] transition-all sm:gap-2 sm:px-2.5 sm:text-[11px]",n?"bg-muted/40 text-muted-foreground hover:bg-muted/60 hover:text-foreground":"bg-destructive/8 text-destructive hover:bg-destructive/12",g&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:le("relative flex h-2 w-2 shrink-0"),children:[n&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),f.jsx("span",{className:le("relative inline-flex h-2 w-2 rounded-full",n?"bg-emerald-500":"bg-destructive")})]}),f.jsxs("span",{className:"hidden min-w-0 items-center gap-2 sm:flex",children:[f.jsx("span",{className:"truncate font-medium text-foreground",children:F}),f.jsx("span",{className:le("shrink-0 rounded border px-1 py-px text-[8px] font-semibold uppercase tracking-[0.1em]",n?"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:de})]})]}),g&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:zt,onMouseLeave:mt,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:[f.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[n?f.jsx(Os,{className:"h-3 w-3 text-emerald-500"}):f.jsx(HN,{className:"h-3 w-3 text-destructive"}),f.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),f.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),f.jsx("div",{className:le("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"})]})}),f.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[f.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),f.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:ne.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[re?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):O?f.jsx(Os,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx($o,{className:le("h-3 w-3 shrink-0",$?"text-emerald-500":"text-muted-foreground")}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),f.jsx("span",{className:le("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",re?"border-destructive/30 bg-destructive/10 text-destructive":O?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":$?"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:R3(ce)})]}),ce.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ce.map(xe=>{const{label:et,status:Xe}=_3(xe,c),Tt=Xe==="offline",It=Xe==="busy";return f.jsxs("div",{"aria-label":`${et} ${Xe}`,className:le("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Tt?"bg-destructive/6":It?"bg-amber-500/6":"bg-emerald-500/5"),title:`${et} ${Xe}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:et}),Tt?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):It?f.jsx(pv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},xe.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[fe?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),f.jsx("span",{className:le("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",fe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:C3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(xe=>{var sn;const{label:et,status:Xe}=A3(xe,c),Tt=Xe==="failed"||Xe==="offline",It=Xe!=="healthy"&&Xe!=="failed"&&Xe!=="offline",ol=(sn=xe.devtunnelHealth)!=null&&sn.reason?`${et} ${Xe}: ${xe.devtunnelHealth.reason}`:`${et} ${Xe}`;return f.jsxs("div",{"aria-label":`${et} ${Xe}`,className:le("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Tt?"bg-destructive/6":It?"bg-muted/30":"bg-emerald-500/5"),title:ol,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:et}),Tt?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):It?f.jsx(pv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},xe.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>C(xe=>!xe),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[f.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",ne.length>0&&`(${ne.length})`]}),E?f.jsx(Xo,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Wd,{className:"h-3 w-3 text-muted-foreground"})]}),E&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(b3,{events:ne,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:xe=>_(et=>new Set(et).add(xe))})})]}),Q&&(d==null?void 0:d.detail)&&f.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/60 px-2.5 py-1 text-[8px] text-muted-foreground",children:[f.jsx("span",{className:"shrink-0 font-medium uppercase tracking-[0.12em]",children:"Desktop update"}),f.jsx("span",{className:"truncate",title:d.detail,children:d.detail})]}),f.jsxs("div",{className:"flex items-center justify-between gap-1 border-t border-border/60 px-2.5 py-1",children:[f.jsx("div",{children:J&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(bn,{type:"button",variant:"ghost",size:"sm",className:le("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",j?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void St(),disabled:Ve,"aria-label":Le,"aria-describedby":"live-link-restart-hint",title:ye,children:[f.jsx(gv,{className:le("h-2.5 w-2.5",Se&&"animate-pulse")}),f.jsx("span",{children:be})]}),te&&f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:le("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",j?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>T(xe=>!xe),"aria-label":"Open live link actions","aria-expanded":N,title:"Live link actions",children:f.jsx(Xo,{className:"h-2.5 w-2.5"})})]}),te&&N&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void St(),disabled:Ve,"aria-label":Le,children:[f.jsx(gv,{className:le("h-2.5 w-2.5",Se&&"animate-pulse")}),f.jsx("span",{children:be})]}),f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Sn(),"aria-label":"Reload dashboard page",children:[f.jsx(B0,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:ye})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>_(new Set(l.map(xe=>xe.id))),disabled:ne.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>w(!1),children:"Close"})]})]})]})]})}const t0="dark",zr="fluent",M3="clean",Xd="meshy-layout-default-migrated-to-compact",gf="true",O3="compact",D3=new Set(["airy","clean","fluent"]);function k3(n){return n!==null&&D3.has(n)}function nm(n){return n===O3?"fluent":k3(n)?n:null}function z3(n,l){const o=nm(n);return o===M3&&l!==gf?zr:o??zr}const Is="symphony",a1="default",L3=new Set(["light","dark","system"]),U3=new Set(["porcelain","warm","finsight","edge","symphony"]),l1=v.createContext(null);function B3(n){const l=new URLSearchParams(n).get("theme");return r1(l)?l:null}function H3(n){const l=new URLSearchParams(n).get("palette");return am(l)}function V3(n){const l=new URLSearchParams(n).get("layout");return nm(l)}function $3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:am(n.getAttribute("data-palette"))??Is,layout:nm(n.getAttribute("data-layout"))??zr}}function SM(n,l=$3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",c=new URL(n,i);return c.searchParams.set("theme",l.theme),c.searchParams.set("palette",l.palette),c.searchParams.set("layout",l.layout),o?c.toString():`${c.pathname}${c.search}${c.hash}`}catch{return n}}function Y3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?B3(window.location.search)??P3(localStorage.getItem("meshy-theme"))??t0:t0),[i,c]=v.useState(()=>typeof window<"u"?H3(window.location.search)??X3(localStorage.getItem("meshy-palette"))??Is:Is),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=V3(window.location.search);if(h)return localStorage.setItem(Xd,gf),h;const y=z3(localStorage.getItem("meshy-layout"),localStorage.getItem(Xd));return localStorage.setItem(Xd,gf),y}return zr});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(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===zr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(l1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function q3(){const n=v.useContext(l1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function r1(n){return n!==null&&L3.has(n)}function G3(n){return n!==null&&U3.has(n)}function P3(n){return r1(n)?n:null}function am(n){return n===a1?"porcelain":G3(n)?n:null}function X3(n){return n===a1?null:am(n)}const K3=[{value:"light",label:"Light",icon:V0},{value:"dark",label:"Dark",icon:U0},{value:"system",label:"System",icon:L0}],o1=[{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"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"}],i1=[{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 Q3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=q3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?U0:n==="light"?V0:L0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!m)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),v.useEffect(()=>()=>g(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[f.jsx(bn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:le("h-8 w-8 rounded-sm",o!==Is||c!==zr?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none 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:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[28rem] sm:max-w-[28rem]",children:[f.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[Z3(c)," / ",I3(o)]})]}),f.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})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:K3.map(({value:N,label:T,icon:E})=>{const C=n===N;return f.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:le("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:[f.jsx(E,{className:"h-3.5 w-3.5"}),T]},N)})}),f.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:i1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:le("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":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:le("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ds,{className:"h-3 w-3 text-primary"})]},N)})})]}),f.jsxs("div",{children:[f.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:[f.jsx(zN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:o1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:le("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":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(F3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:le("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ds,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function Z3(n){var l;return((l=i1.find(o=>o.value===n))==null?void 0:l.label)??n}function I3(n){var l;return((l=o1.find(o=>o.value===n))==null?void 0:l.label)??n}function F3({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%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:le("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const qo={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},s1="meshy-dashboard-panel-state-v2",c1="meshy-dashboard-terminal-open-v1";function wM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:qo.tasks.defaultSize,operations:qo.operations.defaultSize,terminal:qo.terminal.defaultSize}}}function Kd(n){return typeof n=="object"&&n!==null}function n0(n,l){return typeof n=="boolean"?n:l}function Qd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Go(n,l):o}function Go(n,l){const o=qo[n];return Math.min(o.max,Math.max(o.min,l))}function EM(n,l){if(!n)return l;try{const o=n.getItem(s1);if(!o)return l;const i=JSON.parse(o);if(!Kd(i))return l;const c=Kd(i.layout)?i.layout:{},d=Kd(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:n0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:n0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:Qd("tasks",d.tasks,l.sizes.tasks),operations:Qd("operations",d.operations,l.sizes.operations),terminal:Qd("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function NM(n,l){if(n)try{n.setItem(s1,JSON.stringify(l))}catch{}}function J3(n,l){if(!n)return l;try{const o=n.getItem(c1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function W3(n,l){if(n)try{n.setItem(c1,String(l))}catch{}}function a0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function TM(n){return`${Number(n.toFixed(2))}rem`}function CM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Go(n,l+(c-o)/h):n==="operations"?Go(n,l+(o-c)/h):Go(n,l+(i-d)/h)}function AM(n,l,o){const i=o===0?0:o>0?-1:1;return Go(n,l+i*qo[n].wheelStep)}function Zd(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function l0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function r0(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function ej(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function tj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=D0(),c=Qn(),[d,m]=v.useState(()=>J3(a0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Zd(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const k=new Map;for(const Y of(n==null?void 0:n.nodes)??[])k.set(Y.id,Y.name);return n!=null&&n.self&&k.set(n.self.id,n.self.name),k},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(k=>{m(Y=>typeof k=="function"?k(Y):k)},[]);v.useEffect(()=>{W3(a0(),d)},[d]),v.useEffect(()=>{const k=Zd();if(!k){w(null);return}let Y=!1;return w(l0("Checking desktop update...")),k("check_desktop_update").then(X=>{Y||w(X)}).catch(X=>{Y||w(l0(r0(X,"Desktop update check failed")))}),()=>{Y=!0}},[i==null?void 0:i.version]);async function _(){try{const k=await M0({reason:"restart"});Fe.info(`Restarting runtime. Follow ${k.logPath} for launch output.`),await e1({previousPid:k.pid})||Fe.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(k){Fe.error(k instanceof Error?k.message:"Runtime restart failed")}}async function M(){const k=Zd();if(!k){Fe.error("Desktop updater is not available in this window");return}try{Fe.info("Downloading desktop update...");const Y=await k("install_desktop_update");Fe.info(ej(Y))}catch(Y){Fe.error(r0(Y,"Desktop update failed"))}}return f.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[f.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),f.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[f.jsx("header",{className:"relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:le("dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Jd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-sm border border-primary/20 bg-primary/10 text-primary shadow-sm",children:f.jsx(xN,{className:"h-3.5 w-3.5"})}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(H0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(Wd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(fN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(Wd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Jd,{to:`/tasks/${p.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:p.taskTitle,children:p.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(RN,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),f.jsx(tm,{"aria-label":"Search tasks",value:h,onChange:k=>y(k.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(bn,{variant:"ghost",size:"icon",onClick:()=>A(k=>!k),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:le("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx($0,{className:"h-4 w-4"})}),f.jsx(a3,{}),f.jsx(Q3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(j3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?M:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:_})]})]})}),f.jsx("main",{className:le("min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:le("mx-auto h-full min-h-0",T),children:f.jsx(_2,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const o0=v.lazy(async()=>({default:(await c0(()=>import("./DashboardPage-Buhvr58K.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),nj=v.lazy(async()=>({default:(await c0(()=>import("./SharedConversationPage-DA0lmaQJ.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function aj(){return f.jsx(tE,{children:f.jsx(v.Suspense,{fallback:f.jsx(lj,{}),children:f.jsxs(M2,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(nj,{})}),f.jsxs(jl,{element:f.jsx(kE,{children:f.jsx(tj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(o0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(fv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(fv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(o0,{})})]})]})})})}function lj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function rj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function oj(n){return f.jsx(nC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}rj();jw.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(Y3,{children:[f.jsx(aj,{}),f.jsx(oj,{})]})}));export{Ks as $,Yy as A,bn as B,Ds as C,aM as D,Gy as E,uN as F,SM as G,lN as H,tm as I,c3 as J,s3 as K,z0 as L,a_ as M,eM as N,wx as O,tM as P,_s as Q,xt as R,H0 as S,lM as T,yM as U,Ys as V,hf as W,Y0 as X,qs as Y,Gs as Z,Xs as _,iC as a,mM as a$,Ps as a0,Zs as a1,Qs as a2,c0 as a3,dj as a4,qy as a5,P5 as a6,Nj as a7,$0 as a8,$o as a9,a0 as aA,NM as aB,AM as aC,TM as aD,CM as aE,Cj as aF,AE as aG,SE as aH,Fj as aI,Ij as aJ,jE as aK,kj as aL,pj as aM,mj as aN,Py as aO,hj as aP,gj as aQ,gE as aR,a3 as aS,zj as aT,Lj as aU,sj as aV,Qn as aW,x0 as aX,ij as aY,D0 as aZ,pM as a_,nN as aa,Ej as ab,Tj as ac,wj as ad,MN as ae,gN as af,hM as ag,NN as ah,b3 as ai,y_ as aj,sN as ak,b_ as al,bM as am,r3 as an,xM as ao,oM as ap,iM as aq,Fx as ar,gM as as,vM as at,pf as au,sM as av,Uj as aw,Bj as ax,EM as ay,wM as az,le as b,cM as b0,uM as b1,fM as b2,dM as b3,Aj as b4,rM as b5,o3 as b6,Oj as b7,Dj as b8,Mj as b9,jj as ba,uj as bb,fj as bc,cj as bd,vj as be,Wj as bf,qj as bg,Yj as bh,$j as bi,Hj as bj,Vj as bk,Gj as bl,l3 as bm,i0 as bn,FE as bo,Kj as bp,Xj as bq,Pj as br,B0 as bs,Qj as bt,Jj as bu,Zj as bv,Be as c,ry as d,Sj as e,pE as f,bj as g,yj as h,fN as i,f as j,Wd as k,_r as l,xj as m,_j as n,Wb as o,If as p,ex as q,v as r,Ff as s,Fe as t,RN as u,Xo as v,zN as w,nM as x,Rj as y,Y5 as z};
|
|
321
|
+
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},m_=Nx,h_=Tx,p_=Cx,Lx=Ax,Ux=Rx,Bx=Dx,Hx=zx,Vx=jx,$x=Ox;const hf=m_,pf=h_,g_=p_,Yx=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{className:le("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}));Yx.displayName=Lx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>f.jsxs(g_,{children:[f.jsx(Yx,{}),f.jsx(Ux,{ref:o,className:le("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})]}));qs.displayName=Ux.displayName;const Gs=({className:n,...l})=>f.jsx("div",{className:le("flex flex-col space-y-2 text-center sm:text-left",n),...l});Gs.displayName="AlertDialogHeader";const Ps=({className:n,...l})=>f.jsx("div",{className:le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ps.displayName="AlertDialogFooter";const Xs=v.forwardRef(({className:n,...l},o)=>f.jsx(Vx,{ref:o,className:le("text-lg font-semibold",n),...l}));Xs.displayName=Vx.displayName;const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx($x,{ref:o,className:le("text-sm text-muted-foreground",n),...l}));Ks.displayName=$x.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:le(Rf(),n),...l}));Qs.displayName=Bx.displayName;const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Hx,{ref:o,className:le(Rf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Zs.displayName=Hx.displayName;const v_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function y_({status:n}){return f.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5",children:[n==="online"&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-30"}),f.jsx("span",{className:le("relative inline-flex h-2.5 w-2.5 rounded-full",v_[n])})]})}function b_({role:n,size:l="default"}){return f.jsx(xt,{variant:n==="leader"?"default":"secondary",className:le(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const qx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function Wj({status:n,size:l="default"}){const o=qx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(xt,{variant:o.variant,className:le("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:le("rounded-full",o.dotClass)}),n]})}function eM({status:n,isNative:l=!1,size:o="default",className:i}){const c=qx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:le("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:le("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:le("rounded-full bg-sky-500",m),title:"native"})]})}const x_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function tM({priority:n}){const l=x_[n];return f.jsx(xt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function S_(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 Cr({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.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 w_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=S_(l.packages);return f.jsxs(Ys,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Yn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(qn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.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:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(sN,{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"})]}):f.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."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Cr,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Cr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Cr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Cr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Cr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Cr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(hN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Yn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(qn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return f.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:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),f.jsx(xt,{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 dc="Checkbox",[E_]=tl(dc),[N_,Wf]=E_(dc);function T_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:c,disabled:d,form:m,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Dr({prop:o,defaultProp:c??!1,onChange:y,caller:dc}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!m||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Ia(c)?!1:c,isFormControl:M,bubbleInput:C,setBubbleInput:A};return f.jsx(N_,{scope:l,...k,children:C_(g)?g(k):i})}var Gx="CheckboxTrigger",Px=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Wf(Gx,n),E=We(c,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]),f.jsx(He.button,{type:"button",role:"checkbox","aria-checked":Ia(y)?"mixed":y,"aria-required":p,"data-state":Ix(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(_=>Ia(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});Px.displayName=Gx;var em=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:c,defaultChecked:d,required:m,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return f.jsx(T_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Px,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Zx,{__scopeCheckbox:o})]})})});em.displayName=dc;var Xx="CheckboxIndicator",Kx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=Wf(Xx,o);return f.jsx(Hr,{present:i||Ia(d.checked)||d.checked===!0,children:f.jsx(He.span,{"data-state":Ix(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});Kx.displayName=Xx;var Qx="CheckboxBubbleInput",Zx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Wf(Qx,n),T=We(o,N),E=gb(d),C=rb(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,X=!c.current;if(E!==d&&Y){const V=new Event("click",{bubbles:X});_.indeterminate=Ia(d),Y.call(_,Ia(d)?!1:d),_.dispatchEvent(V)}},[w,E,d,c]);const A=v.useRef(Ia(d)?!1:d);return f.jsx(He.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??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%)"}})});Zx.displayName=Qx;function C_(n){return typeof n=="function"}function Ia(n){return n==="indeterminate"}function Ix(n){return Ia(n)?"indeterminate":n?"checked":"unchecked"}const Fx=v.forwardRef(({className:n,...l},o)=>f.jsx(em,{ref:o,className:le("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:f.jsx(Kx,{className:le("flex items-center justify-center text-current"),children:f.jsx(Ds,{className:"h-3.5 w-3.5"})})}));Fx.displayName=em.displayName;const tm=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:le("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}));tm.displayName="Input";const Jv=["queued","running"];function A_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function R_(n){return n==="claude"||n==="codex"||n==="copilot"}function Jx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return R_(l)?`${n.nodeId}:${l}`:null}function __(n){return n.status==="succeeded"||n.status==="failed"}async function Wx(n,l={}){const o=l.getOperation??pE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!__(m)&&Date.now()<d;)await M_(i),m=await o(n.id);return m}async function j_(n,l=gE){const o=new Set(n),i=await Promise.all(Jv.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!Jv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Jx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function M_(n){return new Promise(l=>setTimeout(l,n))}const O_=1500,D_=1e3,k_=9e4;async function e1(n={}){const l=n.fetchHealth??z_,o=n.initialDelayMs??O_,i=n.pollIntervalMs??D_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??U_,h=n.timeoutMs??k_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=L_(await l());if(!x.ok){p=!0,await m(i);continue}if(c===void 0||x.pid!==void 0&&x.pid!==c||p)return d(),!0;await m(i)}return!1}async function z_(){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 L_(n){return typeof n=="boolean"?{ok:n}:n}function U_(n){return new Promise(l=>window.setTimeout(l,n))}function B_(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 H_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=B_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>Wv({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(Wv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function X(){if(!c||C||_)return;const se=p.updateAvailable?"update":"restart",me=Y_(T);if(T.port.trim()&&(me==null?void 0:me.port)===void 0){Fe.error("Runtime restart port must be a positive integer");return}const ce=me?{reason:se,startArgs:me}:{reason:se};A(!0);try{if(i){const O=await M0(ce);N({...O,pid:O.pid??h,status:"accepted"}),Fe.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.`),e1({previousPid:O.pid??h}).then($=>{$||(A(!1),Fe.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch($=>{A(!1),Fe.error($ instanceof Error?$.message:"Runtime restart recovery failed")});return}const ue=await yE(c,ce);N({operationId:ue.id,pid:h,status:ue.status}),Fe.info(`Restart requested on ${d}. Operation ${Pd(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const fe=await Wx(ue,{timeoutMs:6e4}),re=$_(fe);N({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:fe.id,pid:(re==null?void 0:re.pid)??h,status:fe.status}),fe.status==="succeeded"?(await(m==null?void 0:m()),Fe.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):fe.status==="failed"?Fe.error(fe.error??`Restart failed on ${d}`):Fe.info(`Restart operation ${Pd(fe.id)} is still ${fe.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),Fe.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function V(){if(!(!i||C||_)){M(!0);try{const se=await mE();Fe.info(`Stopping Meshy process ${se.pid}`)}catch(se){M(!1),Fe.error(se instanceof Error?se.message:"Runtime stop failed")}}}const H=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Os,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(xt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:H})]})]}),f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsxs(bn,{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:[f.jsx(wN,{className:le("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),f.jsxs(qs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Gs,{className:"space-y-1",children:[f.jsx(Xs,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Ks,{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."})]}),f.jsxs(Ps,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void V(),children:"Stop runtime"})]})]})]}),f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsxs(bn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(B0,{className:le("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(qs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Gs,{className:"space-y-1",children:[f.jsxs(Xs,{className:"text-sm",children:[g,"?"]}),f.jsxs(Ks,{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."]})]}),f.jsx(V_,{value:T,onChange:E}),f.jsxs(Ps,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void X(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>Y(se=>!se),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:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx($0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Xo,{className:le("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{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}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Pd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.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 V_({onChange:n,value:l}){const o=(i,c)=>{n({...l,[i]:c})};return f.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[f.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsx(Bo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Bo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Bo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(Wb,{value:l.transport,onValueChange:i=>o("transport",t1(i)),children:[f.jsx(If,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ex,{placeholder:"Transport"})}),f.jsxs(Ff,{children:[f.jsx(_r,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(_r,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Bo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Bo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.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:[f.jsx(Fx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Bo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:le("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(tm,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:le("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function $_(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 Wv(n){return{port:q_(n.endpoint),name:n.nodeName,join:"",transport:t1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function Y_(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 t1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function q_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Pd(n){return n.length<=8?n:n.slice(0,8)}function Ho({formatDateTime:n,name:l,status:o,statusVariant:i}){return f.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:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),f.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&f.jsx(xt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(xt,{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 Qt(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 G_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),c=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${c}m`:`${c}m`}function e0(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 Rr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function P_(n){return n.available?f.jsxs(xt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx($o,{className:"h-3 w-3"}),"Available"]}):f.jsxs(xt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(nN,{className:"h-3 w-3"}),"Unavailable"]})}function X_(n){return n.update?n.update.updateAvailable?f.jsxs(xt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(xt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function K_(n){return n.available?null:n.metadataStatus??null}function Q_(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 Z_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Je({label:n,value:l,mono:o=!1}){return f.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:[f.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),f.jsx("span",{className:le("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Vo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:le("min-w-0 space-y-0.5",i),children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.jsx("div",{className:le("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function I_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=X_(n),m=!!o,h=K_(n);return f.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[f.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[f.jsxs("div",{className:"min-w-0 space-y-1.5",children:[f.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[f.jsx(z0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"truncate",children:n.label})]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",f.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[P_(n),h&&f.jsx(xt,{variant:Rr(h),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:h})]})]}),f.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[f.jsx(Vo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Vo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Vo,{label:"Checked",value:Qt(n.checkedAt)}),n.update&&f.jsx(Vo,{label:"Update check",value:Qt(n.update.checkedAt)}),f.jsx(Vo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),f.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?f.jsxs(xt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(hf,{children:[f.jsx(pf,{asChild:!0,children:f.jsx("button",{type:"button",disabled:m,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})}),f.jsxs(qs,{children:[f.jsxs(Gs,{children:[f.jsxs(Xs,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Ks,{children:["This runs ",Q_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Ps,{children:[f.jsx(Zs,{children:"Cancel"}),f.jsx(Qs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((p=n.update)==null?void 0:p.detail)&&f.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&&f.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 F_(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 W_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function e3(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function t3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function n3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,se,me,ce,ue,fe,re,O,$,F,de,Q,j,G,K,W,ee,oe,te,ie;const d=v.useMemo(()=>F_(n,l),[n,l]),[m,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===m)??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,_=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=A_(d),X=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const V=v.useCallback(async(J,be)=>{const ye=Jx(J);if(!ye||x.current.has(J.id))return;const Se=t3(J),Ve=(be==null?void 0:be.agentLabel)??(Se?e3(Se):"Agent"),Le=(be==null?void 0:be.nodeName)??X.get(J.nodeId)??J.nodeId;x.current.add(J.id),p(je=>new Map(je).set(ye,J));try{const je=await Wx(J);if(je.status==="succeeded")await(c==null?void 0:c()),g.current.has(je.id)||(Fe.success(`${Ve} upgrade finished on ${Le}`),g.current.add(je.id));else if(je.status==="failed")g.current.has(je.id)||(Fe.error(Z_(je)??`${Ve} upgrade failed`),g.current.add(je.id));else{p(ft=>new Map(ft).set(ye,je)),Fe.info(`${Ve} upgrade is still ${je.status} on ${Le}`);return}p(ft=>{const ot=new Map(ft),zt=ot.get(ye);return(!zt||zt.id===je.id)&&ot.delete(ye),ot})}catch(je){p(ft=>{const ot=new Map(ft),zt=ot.get(ye);return(!zt||zt.id===J.id)&&ot.delete(ye),ot}),Fe.error(je instanceof Error?je.message:`${Ve} upgrade failed`)}finally{x.current.delete(J.id)}},[c,X]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function be(){let ye;try{ye=await j_(M)}catch{return}if(!J){p(Se=>{const Ve=new Map(Se);for(const[Le,je]of ye)Ve.set(Le,je);return Ve});for(const Se of ye.values())V(Se)}}return be(),()=>{J=!0}},[V,k]);async function H(J){if(N)try{const be=await vE(N.id,J.id);Fe.info(`${J.label} upgrade started on ${N.name}`),await V(be,{agentLabel:J.label,nodeName:N.name})}catch(be){Fe.error(be instanceof Error?be.message:`${J.label} upgrade failed`)}}return!N||!T?f.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..."}):f.jsxs("div",{className:"space-y-3",children:[f.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&&f.jsxs(xt,{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 ",Qt((se=N.settingsSnapshot)==null?void 0:se.collectedAt)]}),f.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.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:[f.jsx(y_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(b_,{role:N.role}),f.jsx(xt,{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"}),f.jsx(xt,{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"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(Wb,{value:N.id,onValueChange:h,children:[f.jsx(If,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ex,{placeholder:"Choose a node"})}),f.jsx(Ff,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(_r,{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:W_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(xt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(NN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(xt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",G_(T.uptime)]})]})]})]}),!C&&f.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."}),f.jsxs(a_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(wx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(_s,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(_s,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(_s,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Ys,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(H0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Yn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(Je,{label:"Status",value:N.status}),f.jsx(Je,{label:"Role",value:N.role}),f.jsx(Je,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(Je,{label:"Joined",value:Qt(N.joinedAt)}),f.jsx(Je,{label:"Heartbeat",value:Qt(N.lastHeartbeat)}),f.jsx(Je,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Yn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Host",value:((me=T.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(Je,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(Je,{label:"Arch",value:((ce=T.os)==null?void 0:ce.arch)??"Unavailable"}),f.jsx(Je,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),f.jsx(Je,{label:"Cores",value:String(((fe=T.os)==null?void 0:fe.cpuCount)??"Unavailable")}),f.jsx(Je,{label:"Memory",value:T.os?`${e0(T.os.freeMemoryBytes)} free / ${e0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(H_,{checkedLabel:Qt(A.checkedAt),disableAuthDefault:((re=T.auth)==null?void 0:re.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:(($=T.runtime)==null?void 0:$.workDir)??N.workDir})}),f.jsxs(Hn,{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:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(z0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Yn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(qn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(I_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:H},J.id))})]})]}),f.jsxs(Ys,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(XE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Yn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(Je,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(Je,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(Je,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(Je,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(DN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Yn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Enabled",value:(F=T.auth)!=null&&F.enabled?"Yes":"No"}),f.jsx(Je,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(Je,{label:"Allowed users",value:(Q=T.auth)!=null&&Q.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Yn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(qn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Je,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((G=T.runtime)==null?void 0:G.workDir)??T.workDir)}),f.jsx(Je,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(Je,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),f.jsx(Je,{label:"Started",value:Qt((te=T.runtime)==null?void 0:te.startedAt)}),f.jsx(Je,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Hn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(Vn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs($n,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Os,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Yn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(qn,{className:"space-y-3 px-3 pb-2.5",children:[f.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Qt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Ho,{formatDateTime:Qt,name:"Azure CLI",status:_.az,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"DevTunnel",status:_.devtunnel,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Claude Code",status:_.claude,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Codex",status:_.codex,statusVariant:Rr}),f.jsx(Ho,{formatDateTime:Qt,name:"Copilot CLI",status:_.copilot,statusVariant:Rr})]})]})]})]}),f.jsx(w_,{formatDateTime:Qt,viewInfo:T})]})]})}function a3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=D0();return f.jsx(X5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(n3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const nM="codex",aM="bypass",l3=[{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"claudecode",label:"Claude Code",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"}],lM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],rM=new Set(l3.filter(n=>n.supportsFollowUp).map(n=>n.value)),oM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],iM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],r3=new Set(["pending","assigned"]),o3=new Set(["running"]),i3=new Set(["completed","failed","cancelled"]),sM=10;function cM(n,l){switch(l){case"running":return o3.has(n.status);case"waiting":return r3.has(n.status);case"closed":return i3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function uM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function dM(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 s3(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(c=>c.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function fM(n,l,o){return s3(n,l,o).toLowerCase()}function mM(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 hM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function pM(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 gM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function vM(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 yM(n){return new Date(n).toLocaleString()}function bM(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),c=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}async function c3(n,l="Copied to clipboard"){var o,i,c;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),Fe.success(l),!0;const d=globalThis.document,m=(c=d==null?void 0:d.execCommand)==null?void 0:c.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof m!="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=m("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Fe.success(l),!0}catch(d){return Fe.error(d instanceof Error?d.message:"Failed to copy"),!1}}const u3="default workspace";function js(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function d3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function f3(n,l){const o=js(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function m3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return js(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return u3;if(d3(i)||!n.assignedTo)return js(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?f3(c,i):js(i)}function xM(n,l,o,i){const c=new Map;for(const m of n){const h=m.assignedTo??null,y=h??"__unassigned__",p=h?l.get(h)??m.assignedNodeName??h.slice(0,8):"Unassigned",x=m3(m,i);c.has(y)||c.set(y,{nodeId:h,nodeName:p,dirMap:new Map});const g=c.get(y);g.dirMap.has(x)||g.dirMap.set(x,[]),g.dirMap.get(x).push(m)}const d=Array.from(c.values()).map(({nodeId:m,nodeName:h,dirMap:y})=>{const p=Array.from(y.entries()).map(([x,g])=>({path:x,tasks:g})).sort((x,g)=>g.tasks.length-x.tasks.length||x.path.localeCompare(g.path));return{nodeId:m,nodeName:h,dirs:p}});return d.sort((m,h)=>{if(o){if(m.nodeId===o)return-1;if(h.nodeId===o)return 1}return m.nodeId===null?1:h.nodeId===null?-1:m.nodeName.localeCompare(h.nodeName)}),d}const h3={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"},p3={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 g3(n){return n.split(".")[0]??"unknown"}function v3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Ar(n,l){return(l==null?void 0:l.get(n))??n}function n1(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`${Ar(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Ar(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 ${Ar(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 ${Ar(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Ar(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Ar(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 y3(n){return JSON.stringify(n,null,2)}function b3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:c="default"}){if(n.length===0)return null;const d=c==="compact";return f.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:f.jsx("div",{className:"space-y-1.5",children:n.map(m=>{const h=g3(m.type);return f.jsx("div",{className:le("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.jsx("div",{className:le("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:v3(m.timestamp)}),d?f.jsx("span",{className:le("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",p3[h]),children:m.type}):f.jsx(xt,{variant:"outline",className:le("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",h3[h]),children:m.type})]}),f.jsxs("div",{className:le("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(bn,{type:"button",variant:"ghost",size:"icon",className:le("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>void c3(y3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(lN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(bn,{type:"button",variant:"ghost",size:"icon",className:le("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(Y0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:n1(m,o)})]})},m.id)})})})}const x3=["node.","election.","transport."],S3="cluster.state";function w3(n){return n.type==="node.status"?!1:x3.some(l=>n.type.startsWith(l))}function E3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function N3(n,l){return n?{time:E3(n.timestamp),text:n1(n,l)}:null}function T3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function C3(n){if(n.length===0)return"No node tunnel";const l=n.filter(c=>c.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(c=>{var d;return((d=c.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(c=>{var d;return c.status!=="offline"&&((d=c.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function A3(n,l){var c;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=((c=n.devtunnelHealth)==null?void 0:c.status)??"checking";return{label:o,status:i}}function R3(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 _3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function j3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onReload:p,onRestart:x}){const[g,w]=v.useState(m),[N,T]=v.useState(h),[E,C]=v.useState(!0),[A,_]=v.useState(new Set),[M,k]=v.useState(!1),[Y,X]=v.useState(!1),V=v.useRef(null),H=v.useRef(null),ne=v.useMemo(()=>l.filter(xe=>w3(xe)&&!A.has(xe.id)),[l,A]),se=v.useMemo(()=>l.find(xe=>xe.type===S3)??ne[0],[l,ne]),me=v.useMemo(()=>N3(se,c),[se,c]),ce=v.useMemo(()=>{const xe=new Map(o.map(et=>[et.id,et]));return i&&xe.set(i.id,i),Array.from(xe.values())},[i,o]),ue=v.useMemo(()=>ce.filter(T3),[ce]),fe=ue.some(xe=>{var et;return xe.status==="offline"||((et=xe.devtunnelHealth)==null?void 0:et.status)==="failed"}),re=ce.some(xe=>xe.status==="offline"),O=ce.some(xe=>xe.status==="busy"),$=ce.length>0,F=(i==null?void 0:i.name)??"offline",de=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",Q=d!==null,j=!!(Q&&(d!=null&&d.updateAvailable)&&d.latestVersion),G=(d==null?void 0:d.latestVersion)??null,K=!!(Q&&!j&&!G&&(d!=null&&d.detail)),W=M?"Relaunching runtime...":"Relaunch to apply update",ee=Y?"Downloading and installing desktop update...":j&&G?`Available version ${G}`:K?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",oe=!!p,te=oe,ie=Q||!!x,J=Q||!!x||oe,be=ie?Q?"Update":"Relaunch":"Reload",ye=ie?Q?ee:W:"Reload dashboard page",Se=ie?Q?Y:M:!1,Ve=ie?Q?Se||!j||!y:Se:!1,Le=Q?j&&G?`Install desktop update ${G}`:K?"Desktop update unavailable":"Desktop is current":ie?M?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function je(){H.current&&(clearTimeout(H.current),H.current=null)}function ft(){je(),w(!0)}function ot(){je(),H.current=setTimeout(()=>{w(!1),H.current=null},180)}function zt(){je()}function mt(){je(),T(!1),w(!1)}async function ll(){if(!(!x||M)){k(!0);try{await x()}finally{k(!1)}}}async function rl(){if(!(!j||!y||Y)){X(!0);try{await y()}finally{X(!1)}}}async function St(){if(!ie){await Sn();return}if(Q){await rl();return}await ll()}async function Sn(){p&&(T(!1),await p())}return v.useEffect(()=>()=>{je()},[]),v.useEffect(()=>{_(xe=>{if(xe.size===0)return xe;const et=new Set(l.map(Tt=>Tt.id)),Xe=new Set(Array.from(xe).filter(Tt=>et.has(Tt)));return Xe.size===xe.size?xe:Xe})},[l]),v.useEffect(()=>{g||T(!1)},[g]),v.useEffect(()=>{if(!g)return;const xe=Xe=>{var Tt;(Tt=V.current)!=null&&Tt.contains(Xe.target)||(je(),T(!1),w(!1))},et=Xe=>{Xe.key==="Escape"&&(je(),T(!1),w(!1))};return document.addEventListener("pointerdown",xe),document.addEventListener("keydown",et),()=>{document.removeEventListener("pointerdown",xe),document.removeEventListener("keydown",et)}},[g]),f.jsxs("div",{ref:V,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":g,"aria-haspopup":"dialog",onClick:()=>w(xe=>!xe),onMouseEnter:ft,onMouseLeave:ot,className:le("flex h-8 max-w-[18rem] items-center gap-1.5 rounded-sm px-2 text-[10px] transition-all sm:gap-2 sm:px-2.5 sm:text-[11px]",n?"bg-muted/40 text-muted-foreground hover:bg-muted/60 hover:text-foreground":"bg-destructive/8 text-destructive hover:bg-destructive/12",g&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:le("relative flex h-2 w-2 shrink-0"),children:[n&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),f.jsx("span",{className:le("relative inline-flex h-2 w-2 rounded-full",n?"bg-emerald-500":"bg-destructive")})]}),f.jsxs("span",{className:"hidden min-w-0 items-center gap-2 sm:flex",children:[f.jsx("span",{className:"truncate font-medium text-foreground",children:F}),f.jsx("span",{className:le("shrink-0 rounded border px-1 py-px text-[8px] font-semibold uppercase tracking-[0.1em]",n?"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:de})]})]}),g&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:zt,onMouseLeave:mt,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:[f.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[n?f.jsx(Os,{className:"h-3 w-3 text-emerald-500"}):f.jsx(HN,{className:"h-3 w-3 text-destructive"}),f.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),f.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),f.jsx("div",{className:le("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"})]})}),f.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[f.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),f.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:ne.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[re?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):O?f.jsx(Os,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx($o,{className:le("h-3 w-3 shrink-0",$?"text-emerald-500":"text-muted-foreground")}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),f.jsx("span",{className:le("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",re?"border-destructive/30 bg-destructive/10 text-destructive":O?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":$?"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:R3(ce)})]}),ce.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ce.map(xe=>{const{label:et,status:Xe}=_3(xe,c),Tt=Xe==="offline",It=Xe==="busy";return f.jsxs("div",{"aria-label":`${et} ${Xe}`,className:le("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Tt?"bg-destructive/6":It?"bg-amber-500/6":"bg-emerald-500/5"),title:`${et} ${Xe}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:et}),Tt?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):It?f.jsx(pv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},xe.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[fe?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),f.jsx("span",{className:le("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",fe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:C3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(xe=>{var sn;const{label:et,status:Xe}=A3(xe,c),Tt=Xe==="failed"||Xe==="offline",It=Xe!=="healthy"&&Xe!=="failed"&&Xe!=="offline",ol=(sn=xe.devtunnelHealth)!=null&&sn.reason?`${et} ${Xe}: ${xe.devtunnelHealth.reason}`:`${et} ${Xe}`;return f.jsxs("div",{"aria-label":`${et} ${Xe}`,className:le("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Tt?"bg-destructive/6":It?"bg-muted/30":"bg-emerald-500/5"),title:ol,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:et}),Tt?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):It?f.jsx(pv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx($o,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},xe.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>C(xe=>!xe),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[f.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",ne.length>0&&`(${ne.length})`]}),E?f.jsx(Xo,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Wd,{className:"h-3 w-3 text-muted-foreground"})]}),E&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(b3,{events:ne,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:xe=>_(et=>new Set(et).add(xe))})})]}),Q&&(d==null?void 0:d.detail)&&f.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/60 px-2.5 py-1 text-[8px] text-muted-foreground",children:[f.jsx("span",{className:"shrink-0 font-medium uppercase tracking-[0.12em]",children:"Desktop update"}),f.jsx("span",{className:"truncate",title:d.detail,children:d.detail})]}),f.jsxs("div",{className:"flex items-center justify-between gap-1 border-t border-border/60 px-2.5 py-1",children:[f.jsx("div",{children:J&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(bn,{type:"button",variant:"ghost",size:"sm",className:le("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",j?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void St(),disabled:Ve,"aria-label":Le,"aria-describedby":"live-link-restart-hint",title:ye,children:[f.jsx(gv,{className:le("h-2.5 w-2.5",Se&&"animate-pulse")}),f.jsx("span",{children:be})]}),te&&f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:le("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",j?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>T(xe=>!xe),"aria-label":"Open live link actions","aria-expanded":N,title:"Live link actions",children:f.jsx(Xo,{className:"h-2.5 w-2.5"})})]}),te&&N&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void St(),disabled:Ve,"aria-label":Le,children:[f.jsx(gv,{className:le("h-2.5 w-2.5",Se&&"animate-pulse")}),f.jsx("span",{children:be})]}),f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Sn(),"aria-label":"Reload dashboard page",children:[f.jsx(B0,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:ye})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>_(new Set(l.map(xe=>xe.id))),disabled:ne.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(bn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>w(!1),children:"Close"})]})]})]})]})}const t0="dark",zr="fluent",M3="clean",Xd="meshy-layout-default-migrated-to-compact",gf="true",O3="compact",D3=new Set(["airy","clean","fluent"]);function k3(n){return n!==null&&D3.has(n)}function nm(n){return n===O3?"fluent":k3(n)?n:null}function z3(n,l){const o=nm(n);return o===M3&&l!==gf?zr:o??zr}const Is="symphony",a1="default",L3=new Set(["light","dark","system"]),U3=new Set(["porcelain","warm","finsight","edge","symphony","launcher"]),l1=v.createContext(null);function B3(n){const l=new URLSearchParams(n).get("theme");return r1(l)?l:null}function H3(n){const l=new URLSearchParams(n).get("palette");return am(l)}function V3(n){const l=new URLSearchParams(n).get("layout");return nm(l)}function $3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:am(n.getAttribute("data-palette"))??Is,layout:nm(n.getAttribute("data-layout"))??zr}}function SM(n,l=$3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",c=new URL(n,i);return c.searchParams.set("theme",l.theme),c.searchParams.set("palette",l.palette),c.searchParams.set("layout",l.layout),o?c.toString():`${c.pathname}${c.search}${c.hash}`}catch{return n}}function Y3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?B3(window.location.search)??P3(localStorage.getItem("meshy-theme"))??t0:t0),[i,c]=v.useState(()=>typeof window<"u"?H3(window.location.search)??X3(localStorage.getItem("meshy-palette"))??Is:Is),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=V3(window.location.search);if(h)return localStorage.setItem(Xd,gf),h;const y=z3(localStorage.getItem("meshy-layout"),localStorage.getItem(Xd));return localStorage.setItem(Xd,gf),y}return zr});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(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===zr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(l1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function q3(){const n=v.useContext(l1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function r1(n){return n!==null&&L3.has(n)}function G3(n){return n!==null&&U3.has(n)}function P3(n){return r1(n)?n:null}function am(n){return n===a1?"porcelain":G3(n)?n:null}function X3(n){return n===a1?null:am(n)}const K3=[{value:"light",label:"Light",icon:V0},{value:"dark",label:"Dark",icon:U0},{value:"system",label:"System",icon:L0}],o1=[{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"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"},{value:"launcher",label:"Launcher",hint:"Desktop startup blue"}],i1=[{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 Q3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=q3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?U0:n==="light"?V0:L0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!m)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),v.useEffect(()=>()=>g(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[f.jsx(bn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:le("h-8 w-8 rounded-sm",o!==Is||c!==zr?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none rounded-md border border-border/70 bg-popover/95 p-2 text-popover-foreground shadow-[0_24px_70px_-32px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[23rem] sm:max-w-[23rem]",children:[f.jsxs("div",{className:"mb-2 flex items-end justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[10px] font-medium text-foreground",children:[Z3(c)," / ",I3(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-1.5 py-0.5 text-[8px] font-medium capitalize text-muted-foreground",children:n})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-0.5",children:K3.map(({value:N,label:T,icon:E})=>{const C=n===N;return f.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:le("flex min-h-[2.1rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-1.5 py-1 text-[9px] 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:[f.jsx(E,{className:"h-3 w-3"}),T]},N)})}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:i1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:le("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:le("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ds,{className:"h-3 w-3 text-primary"})]},N)})})]}),f.jsxs("div",{children:[f.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:[f.jsx(zN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:o1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:le("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(F3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:le("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ds,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function Z3(n){var l;return((l=i1.find(o=>o.value===n))==null?void 0:l.label)??n}function I3(n){var l;return((l=o1.find(o=>o.value===n))==null?void 0:l.label)??n}function F3({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%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"],launcher:["hsl(213 77% 49%)","hsl(60 10% 96%)","hsl(0 0% 100%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:le("flex h-5 w-5 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const qo={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},s1="meshy-dashboard-panel-state-v2",c1="meshy-dashboard-terminal-open-v1";function wM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:qo.tasks.defaultSize,operations:qo.operations.defaultSize,terminal:qo.terminal.defaultSize}}}function Kd(n){return typeof n=="object"&&n!==null}function n0(n,l){return typeof n=="boolean"?n:l}function Qd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Go(n,l):o}function Go(n,l){const o=qo[n];return Math.min(o.max,Math.max(o.min,l))}function EM(n,l){if(!n)return l;try{const o=n.getItem(s1);if(!o)return l;const i=JSON.parse(o);if(!Kd(i))return l;const c=Kd(i.layout)?i.layout:{},d=Kd(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:n0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:n0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:Qd("tasks",d.tasks,l.sizes.tasks),operations:Qd("operations",d.operations,l.sizes.operations),terminal:Qd("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function NM(n,l){if(n)try{n.setItem(s1,JSON.stringify(l))}catch{}}function J3(n,l){if(!n)return l;try{const o=n.getItem(c1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function W3(n,l){if(n)try{n.setItem(c1,String(l))}catch{}}function a0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function TM(n){return`${Number(n.toFixed(2))}rem`}function CM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Go(n,l+(c-o)/h):n==="operations"?Go(n,l+(o-c)/h):Go(n,l+(i-d)/h)}function AM(n,l,o){const i=o===0?0:o>0?-1:1;return Go(n,l+i*qo[n].wheelStep)}function Zd(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function l0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function r0(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function ej(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function tj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=D0(),c=Qn(),[d,m]=v.useState(()=>J3(a0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Zd(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const k=new Map;for(const Y of(n==null?void 0:n.nodes)??[])k.set(Y.id,Y.name);return n!=null&&n.self&&k.set(n.self.id,n.self.name),k},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(k=>{m(Y=>typeof k=="function"?k(Y):k)},[]);v.useEffect(()=>{W3(a0(),d)},[d]),v.useEffect(()=>{const k=Zd();if(!k){w(null);return}let Y=!1;return w(l0("Checking desktop update...")),k("check_desktop_update").then(X=>{Y||w(X)}).catch(X=>{Y||w(l0(r0(X,"Desktop update check failed")))}),()=>{Y=!0}},[i==null?void 0:i.version]);async function _(){try{const k=await M0({reason:"restart"});Fe.info(`Restarting runtime. Follow ${k.logPath} for launch output.`),await e1({previousPid:k.pid})||Fe.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(k){Fe.error(k instanceof Error?k.message:"Runtime restart failed")}}async function M(){const k=Zd();if(!k){Fe.error("Desktop updater is not available in this window");return}try{Fe.info("Downloading desktop update...");const Y=await k("install_desktop_update");Fe.info(ej(Y))}catch(Y){Fe.error(r0(Y,"Desktop update failed"))}}return f.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[f.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),f.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[f.jsx("header",{className:"relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:le("dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Jd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-sm border border-primary/20 bg-primary/10 text-primary shadow-sm",children:f.jsx(xN,{className:"h-3.5 w-3.5"})}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(H0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(Wd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(fN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(Wd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Jd,{to:`/tasks/${p.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:p.taskTitle,children:p.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(RN,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),f.jsx(tm,{"aria-label":"Search tasks",value:h,onChange:k=>y(k.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(bn,{variant:"ghost",size:"icon",onClick:()=>A(k=>!k),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:le("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx($0,{className:"h-4 w-4"})}),f.jsx(a3,{}),f.jsx(Q3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(j3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?M:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:_})]})]})}),f.jsx("main",{className:le("min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:le("mx-auto h-full min-h-0",T),children:f.jsx(_2,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const o0=v.lazy(async()=>({default:(await c0(()=>import("./DashboardPage-2RXNOej0.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),nj=v.lazy(async()=>({default:(await c0(()=>import("./SharedConversationPage-CcAmmobW.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function aj(){return f.jsx(tE,{children:f.jsx(v.Suspense,{fallback:f.jsx(lj,{}),children:f.jsxs(M2,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(nj,{})}),f.jsxs(jl,{element:f.jsx(kE,{children:f.jsx(tj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(o0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(fv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(fv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(o0,{})})]})]})})})}function lj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function rj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function oj(n){return f.jsx(nC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}rj();jw.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(Y3,{children:[f.jsx(aj,{}),f.jsx(oj,{})]})}));export{Ks as $,Yy as A,bn as B,Ds as C,aM as D,Gy as E,uN as F,SM as G,lN as H,tm as I,c3 as J,s3 as K,z0 as L,a_ as M,eM as N,wx as O,tM as P,_s as Q,xt as R,H0 as S,lM as T,yM as U,Ys as V,hf as W,Y0 as X,qs as Y,Gs as Z,Xs as _,iC as a,mM as a$,Ps as a0,Zs as a1,Qs as a2,c0 as a3,dj as a4,qy as a5,P5 as a6,Nj as a7,$0 as a8,$o as a9,a0 as aA,NM as aB,AM as aC,TM as aD,CM as aE,Cj as aF,AE as aG,SE as aH,Fj as aI,Ij as aJ,jE as aK,kj as aL,pj as aM,mj as aN,Py as aO,hj as aP,gj as aQ,gE as aR,a3 as aS,zj as aT,Lj as aU,sj as aV,Qn as aW,x0 as aX,ij as aY,D0 as aZ,pM as a_,nN as aa,Ej as ab,Tj as ac,wj as ad,MN as ae,gN as af,hM as ag,NN as ah,b3 as ai,y_ as aj,sN as ak,b_ as al,bM as am,r3 as an,sM as ao,xM as ap,oM as aq,iM as ar,gM as as,Fx as at,vM as au,pf as av,Uj as aw,Bj as ax,EM as ay,wM as az,le as b,cM as b0,uM as b1,fM as b2,dM as b3,Aj as b4,rM as b5,o3 as b6,Oj as b7,Dj as b8,Mj as b9,jj as ba,uj as bb,fj as bc,cj as bd,vj as be,Wj as bf,qj as bg,Yj as bh,$j as bi,Hj as bj,Vj as bk,Gj as bl,l3 as bm,i0 as bn,FE as bo,Kj as bp,Xj as bq,Pj as br,B0 as bs,Qj as bt,Jj as bu,Zj as bv,Be as c,ry as d,Sj as e,pE as f,bj as g,yj as h,fN as i,f as j,Wd as k,_r as l,xj as m,_j as n,Wb as o,If as p,ex as q,v as r,Ff as s,Fe as t,RN as u,Xo as v,zN as w,nM as x,Rj as y,Y5 as z};
|
package/dashboard/index.html
CHANGED
|
@@ -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'>🕸</text></svg>" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DeGSlcwy.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CNJwYgC6.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|