meshy-node 0.7.4 → 0.7.7
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-sar7hm_X.js → DashboardPage-DdLZ5kNg.js} +11 -11
- package/dashboard/assets/{DashboardShared-Cp5VKVZe.js → DashboardShared-DwUEwS5O.js} +1 -1
- package/dashboard/assets/{DiffTab-Cj3YBqb-.js → DiffTab-DgQBxAMA.js} +1 -1
- package/dashboard/assets/{FilesTab-CzSgUcKM.js → FilesTab-7VhmWBPa.js} +1 -1
- package/dashboard/assets/{PreviewTab-BWEoYKz6.js → PreviewTab-DDHIhmOg.js} +1 -1
- package/dashboard/assets/{SharedConversationPage-zis7MeLt.js → SharedConversationPage-DOsbPRos.js} +3 -3
- package/dashboard/assets/{file-RDQpd-AJ.js → file-DIJqepXR.js} +1 -1
- package/dashboard/assets/{index-BXl4UERo.js → index-DE6c1T0K.js} +3 -3
- package/dashboard/assets/{play-D78vVDvf.js → play-DvMzbBUB.js} +1 -1
- package/dashboard/index.html +1 -1
- package/package.json +1 -1
- package/runtime-metadata.json +4 -4
|
@@ -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-DdLZ5kNg.js","assets/DashboardShared-DwUEwS5O.js","assets/play-DvMzbBUB.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-DOsbPRos.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function v2(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 r0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ed={exports:{}},Oo={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -58,7 +58,7 @@ Error generating stack: `+r.message+`
|
|
|
58
58
|
* @license MIT
|
|
59
59
|
*/var rv="popstate";function ov(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function _2(n={}){function l(i,c){var p;let d=(p=c.state)==null?void 0:p.masked,{pathname:m,search:h,hash:y}=d||i.location;return Zd("",{pathname:m,search:h,hash:y},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function o(i,c){return typeof c=="string"?c:Go(c)}return M2(l,o,null,n)}function ot(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function En(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function j2(){return Math.random().toString(36).substring(2,10)}function iv(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Zd(n,l,o=null,i,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?Dr(l):l,state:o,key:l&&l.key||i||j2(),unstable_mask:c}}function Go({pathname:n="/",search:l="",hash:o=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(n+=o.charAt(0)==="#"?o:"#"+o),n}function Dr(n){let l={};if(n){let o=n.indexOf("#");o>=0&&(l.hash=n.substring(o),n=n.substring(0,o));let i=n.indexOf("?");i>=0&&(l.search=n.substring(i),n=n.substring(0,i)),n&&(l.pathname=n)}return l}function M2(n,l,o,i={}){let{window:c=document.defaultView,v5Compat:d=!1}=i,m=c.history,h="POP",y=null,p=x();p==null&&(p=0,m.replaceState({...m.state,idx:p},""));function x(){return(m.state||{idx:null}).idx}function g(){h="POP";let C=x(),A=C==null?null:C-p;p=C,y&&y({action:h,location:E.location,delta:A})}function w(C,A){h="PUSH";let R=ov(C)?C:Zd(E.location,C,A);p=x()+1;let _=iv(R,p),z=E.createHref(R.unstable_mask||R);try{m.pushState(_,"",z)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;c.location.assign(z)}d&&y&&y({action:h,location:E.location,delta:1})}function N(C,A){h="REPLACE";let R=ov(C)?C:Zd(E.location,C,A);p=x();let _=iv(R,p),z=E.createHref(R.unstable_mask||R);m.replaceState(_,"",z),d&&y&&y({action:h,location:E.location,delta:0})}function T(C){return O2(C)}let E={get action(){return h},get location(){return n(c,m)},listen(C){if(y)throw new Error("A history only accepts one active listener");return c.addEventListener(rv,g),y=C,()=>{c.removeEventListener(rv,g),y=null}},createHref(C){return l(c,C)},createURL:T,encodeLocation(C){let A=T(C);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:w,replace:N,go(C){return m.go(C)}};return E}function O2(n,l=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),ot(o,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Go(n);return i=i.replace(/ $/,"%20"),!l&&i.startsWith("//")&&(i=o+i),new URL(i,o)}function s0(n,l,o="/"){return D2(n,l,o,!1)}function D2(n,l,o,i){let c=typeof l=="string"?Dr(l):l,d=da(c.pathname||"/",o);if(d==null)return null;let m=c0(n);k2(m);let h=null;for(let y=0;h==null&&y<m.length;++y){let p=P2(d);h=q2(m[y],p,i)}return h}function c0(n,l=[],o=[],i="",c=!1){let d=(m,h,y=c,p)=>{let x={relativePath:p===void 0?m.path||"":p,caseSensitive:m.caseSensitive===!0,childrenIndex:h,route:m};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(i)&&y)return;ot(x.relativePath.startsWith(i),`Absolute route path "${x.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(i.length)}let g=$n([i,x.relativePath]),w=o.concat(x);m.children&&m.children.length>0&&(ot(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),c0(m.children,l,w,g,y)),!(m.path==null&&!m.index)&&l.push({path:g,score:$2(g,m.index),routesMeta:w})};return n.forEach((m,h)=>{var y;if(m.path===""||!((y=m.path)!=null&&y.includes("?")))d(m,h);else for(let p of u0(m.path))d(m,h,!0,p)}),l}function u0(n){let l=n.split("/");if(l.length===0)return[];let[o,...i]=l,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(i.length===0)return c?[d,""]:[d];let m=u0(i.join("/")),h=[];return h.push(...m.map(y=>y===""?d:[d,y].join("/"))),c&&h.push(...m),h.map(y=>n.startsWith("/")&&y===""?"/":y)}function k2(n){n.sort((l,o)=>l.score!==o.score?o.score-l.score:Y2(l.routesMeta.map(i=>i.childrenIndex),o.routesMeta.map(i=>i.childrenIndex)))}var z2=/^:[\w-]+$/,L2=3,U2=2,B2=1,H2=10,V2=-2,sv=n=>n==="*";function $2(n,l){let o=n.split("/"),i=o.length;return o.some(sv)&&(i+=V2),l&&(i+=U2),o.filter(c=>!sv(c)).reduce((c,d)=>c+(z2.test(d)?L2:d===""?B2:H2),i)}function Y2(n,l){return n.length===l.length&&n.slice(0,-1).every((i,c)=>i===l[c])?n[n.length-1]-l[l.length-1]:0}function q2(n,l,o=!1){let{routesMeta:i}=n,c={},d="/",m=[];for(let h=0;h<i.length;++h){let y=i[h],p=h===i.length-1,x=d==="/"?l:l.slice(d.length)||"/",g=js({path:y.relativePath,caseSensitive:y.caseSensitive,end:p},x),w=y.route;if(!g&&p&&o&&!i[i.length-1].route.index&&(g=js({path:y.relativePath,caseSensitive:y.caseSensitive,end:!1},x)),!g)return null;Object.assign(c,g.params),m.push({params:c,pathname:$n([d,g.pathname]),pathnameBase:Z2($n([d,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(d=$n([d,g.pathnameBase]))}return m}function js(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[o,i]=G2(n.path,n.caseSensitive,n.end),c=l.match(o);if(!c)return null;let d=c[0],m=d.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:i.reduce((p,{paramName:x,isOptional:g},w)=>{if(x==="*"){let T=h[w]||"";m=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const N=h[w];return g&&!N?p[x]=void 0:p[x]=(N||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:m,pattern:n}}function G2(n,l=!1,o=!0){En(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let i=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,h,y,p,x)=>{if(i.push({paramName:h,isOptional:y!=null}),y){let g=x.charAt(p+m.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(i.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,l?void 0:"i"),i]}function P2(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return En(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function da(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,i=n.charAt(o);return i&&i!=="/"?null:n.slice(o)||"/"}var X2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function K2(n,l="/"){let{pathname:o,search:i="",hash:c=""}=typeof n=="string"?Dr(n):n,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=cv(o.substring(1),"/"):d=cv(o,l)):d=l,{pathname:d,search:I2(i),hash:F2(c)}}function cv(n,l){let o=l.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function _d(n,l,o,i){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Q2(n){return n.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function yf(n){let l=Q2(n);return l.map((o,i)=>i===l.length-1?o.pathname:o.pathnameBase)}function Zs(n,l,o,i=!1){let c;typeof n=="string"?c=Dr(n):(c={...n},ot(!c.pathname||!c.pathname.includes("?"),_d("?","pathname","search",c)),ot(!c.pathname||!c.pathname.includes("#"),_d("#","pathname","hash",c)),ot(!c.search||!c.search.includes("#"),_d("#","search","hash",c)));let d=n===""||c.pathname==="",m=d?"/":c.pathname,h;if(m==null)h=o;else{let g=l.length-1;if(!i&&m.startsWith("..")){let w=m.split("/");for(;w[0]==="..";)w.shift(),g-=1;c.pathname=w.join("/")}h=g>=0?l[g]:"/"}let y=K2(c,h),p=m&&m!=="/"&&m.endsWith("/"),x=(d||m===".")&&o.endsWith("/");return!y.pathname.endsWith("/")&&(p||x)&&(y.pathname+="/"),y}var $n=n=>n.join("/").replace(/\/\/+/g,"/"),Z2=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),I2=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,F2=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,J2=class{constructor(n,l,o,i=!1){this.status=n,this.statusText=l||"",this.internal=i,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function W2(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function ew(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var d0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function f0(n,l){let o=n;if(typeof o!="string"||!X2.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let i=o,c=!1;if(d0)try{let d=new URL(window.location.href),m=o.startsWith("//")?new URL(d.protocol+o):new URL(o),h=da(m.pathname,l);m.origin===d.origin&&h!=null?o=h+m.search+m.hash:c=!0}catch{En(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var m0=["POST","PUT","PATCH","DELETE"];new Set(m0);var tw=["GET",...m0];new Set(tw);var kr=v.createContext(null);kr.displayName="DataRouter";var Is=v.createContext(null);Is.displayName="DataRouterState";var nw=v.createContext(!1),h0=v.createContext({isTransitioning:!1});h0.displayName="ViewTransition";var aw=v.createContext(new Map);aw.displayName="Fetchers";var lw=v.createContext(null);lw.displayName="Await";var nn=v.createContext(null);nn.displayName="Navigation";var Ko=v.createContext(null);Ko.displayName="Location";var hn=v.createContext({outlet:null,matches:[],isDataRoute:!1});hn.displayName="Route";var bf=v.createContext(null);bf.displayName="RouteError";var p0="REACT_ROUTER_ERROR",rw="REDIRECT",ow="ROUTE_ERROR_RESPONSE";function iw(n){if(n.startsWith(`${p0}:${rw}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function sw(n){if(n.startsWith(`${p0}:${ow}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new J2(l.status,l.statusText,l.data)}catch{}}function cw(n,{relative:l}={}){ot(zr(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:i}=v.useContext(nn),{hash:c,pathname:d,search:m}=Qo(n,{relative:l}),h=d;return o!=="/"&&(h=d==="/"?o:$n([o,d])),i.createHref({pathname:h,search:m,hash:c})}function zr(){return v.useContext(Ko)!=null}function qn(){return ot(zr(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Ko).location}var g0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function v0(n){v.useContext(nn).static||v.useLayoutEffect(n)}function y0(){let{isDataRoute:n}=v.useContext(hn);return n?Ew():uw()}function uw(){ot(zr(),"useNavigate() may be used only in the context of a <Router> component.");let n=v.useContext(kr),{basename:l,navigator:o}=v.useContext(nn),{matches:i}=v.useContext(hn),{pathname:c}=qn(),d=JSON.stringify(yf(i)),m=v.useRef(!1);return v0(()=>{m.current=!0}),v.useCallback((y,p={})=>{if(En(m.current,g0),!m.current)return;if(typeof y=="number"){o.go(y);return}let x=Zs(y,JSON.parse(d),c,p.relative==="path");n==null&&l!=="/"&&(x.pathname=x.pathname==="/"?l:$n([l,x.pathname])),(p.replace?o.replace:o.push)(x,p.state,p)},[l,o,d,c,n])}var b0=v.createContext(null);function lj(){return v.useContext(b0)}function dw(n){let l=v.useContext(hn).outlet;return v.useMemo(()=>l&&v.createElement(b0.Provider,{value:n},l),[l,n])}function rj(){let{matches:n}=v.useContext(hn),l=n[n.length-1];return l?l.params:{}}function Qo(n,{relative:l}={}){let{matches:o}=v.useContext(hn),{pathname:i}=qn(),c=JSON.stringify(yf(o));return v.useMemo(()=>Zs(n,JSON.parse(c),i,l==="path"),[n,c,i,l])}function fw(n,l){return x0(n,l)}function x0(n,l,o){var C;ot(zr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(nn),{matches:c}=v.useContext(hn),d=c[c.length-1],m=d?d.params:{},h=d?d.pathname:"/",y=d?d.pathnameBase:"/",p=d&&d.route;{let A=p&&p.path||"";w0(h,!p||A.endsWith("*")||A.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${A}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
60
|
|
|
61
|
-
Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}/*`}">.`)}let x=qn(),g;if(l){let A=typeof l=="string"?Dr(l):l;ot(y==="/"||((C=A.pathname)==null?void 0:C.startsWith(y)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${y}" but pathname "${A.pathname}" was given in the \`location\` prop.`),g=A}else g=x;let w=g.pathname||"/",N=w;if(y!=="/"){let A=y.replace(/^\//,"").split("/");N="/"+w.replace(/^\//,"").split("/").slice(A.length).join("/")}let T=s0(n,{pathname:N});En(p||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),En(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=vw(T&&T.map(A=>Object.assign({},A,{params:Object.assign({},m,A.params),pathname:$n([y,i.encodeLocation?i.encodeLocation(A.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:$n([y,i.encodeLocation?i.encodeLocation(A.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),c,o);return l&&E?v.createElement(Ko.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},E):E}function mw(){let n=ww(),l=W2(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),o=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:i},d={padding:"2px 4px",backgroundColor:i},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:d},"ErrorBoundary")," or"," ",v.createElement("code",{style:d},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},l),o?v.createElement("pre",{style:c},o):null,m)}var hw=v.createElement(mw,null),S0=class extends v.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const o=sw(n.digest);o&&(n=o)}let l=n!==void 0?v.createElement(hn.Provider,{value:this.props.routeContext},v.createElement(bf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?v.createElement(pw,{error:n},l):l}};S0.contextType=nw;var jd=new WeakMap;function pw({children:n,error:l}){let{basename:o}=v.useContext(nn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=iw(l.digest);if(i){let c=jd.get(l);if(c)throw c;let d=f0(i.location,o);if(d0&&!jd.get(l))if(d.isExternal||i.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:i.replace}));throw jd.set(l,m),m}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function gw({routeContext:n,match:l,children:o}){let i=v.useContext(kr);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),v.createElement(hn.Provider,{value:n},o)}function vw(n,l=[],o){let i=o==null?void 0:o.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let c=n,d=i==null?void 0:i.errors;if(d!=null){let x=c.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);ot(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,x+1))}let m=!1,h=-1;if(o&&i){m=i.renderFallback;for(let x=0;x<c.length;x++){let g=c[x];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(h=x),g.route.id){let{loaderData:w,errors:N}=i,T=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!N||N[g.route.id]===void 0);if(g.route.lazy||T){o.isStatic&&(m=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let y=o==null?void 0:o.onError,p=i&&y?(x,g)=>{var w,N;y(x,{location:i.location,params:((N=(w=i.matches)==null?void 0:w[0])==null?void 0:N.params)??{},unstable_pattern:ew(i.matches),errorInfo:g})}:void 0;return c.reduceRight((x,g,w)=>{let N,T=!1,E=null,C=null;i&&(N=d&&g.route.id?d[g.route.id]:void 0,E=g.route.errorElement||hw,m&&(h<0&&w===0?(w0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,C=null):h===w&&(T=!0,C=g.route.hydrateFallbackElement||null)));let A=l.concat(c.slice(0,w+1)),R=()=>{let _;return N?_=E:T?_=C:g.route.Component?_=v.createElement(g.route.Component,null):g.route.element?_=g.route.element:_=x,v.createElement(gw,{match:g,routeContext:{outlet:x,matches:A,isDataRoute:i!=null},children:_})};return i&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(S0,{location:i.location,revalidation:i.revalidation,component:E,error:N,children:R(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:p}):R()},null)}function xf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yw(n){let l=v.useContext(kr);return ot(l,xf(n)),l}function bw(n){let l=v.useContext(Is);return ot(l,xf(n)),l}function xw(n){let l=v.useContext(hn);return ot(l,xf(n)),l}function Sf(n){let l=xw(n),o=l.matches[l.matches.length-1];return ot(o.route.id,`${n} can only be used on routes that contain a unique "id"`),o.route.id}function Sw(){return Sf("useRouteId")}function ww(){var i;let n=v.useContext(bf),l=bw("useRouteError"),o=Sf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function Ew(){let{router:n}=yw("useNavigate"),l=Sf("useNavigate"),o=v.useRef(!1);return v0(()=>{o.current=!0}),v.useCallback(async(c,d={})=>{En(o.current,g0),o.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...d}))},[n,l])}var uv={};function w0(n,l,o){!l&&!uv[n]&&(uv[n]=!0,En(!1,o))}v.memo(Nw);function Nw({routes:n,future:l,state:o,isStatic:i,onError:c}){return x0(n,void 0,{state:o,isStatic:i,onError:c})}function dv({to:n,replace:l,state:o,relative:i}){ot(zr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=v.useContext(nn);En(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=v.useContext(hn),{pathname:m}=qn(),h=y0(),y=Zs(n,yf(d),m,i==="path"),p=JSON.stringify(y);return v.useEffect(()=>{h(JSON.parse(p),{replace:l,state:o,relative:i})},[h,p,i,l,o]),null}function Tw(n){return dw(n.context)}function Al(n){ot(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Cw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:c,static:d=!1,unstable_useTransitions:m}){ot(!zr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),y=v.useMemo(()=>({basename:h,navigator:c,static:d,unstable_useTransitions:m,future:{}}),[h,c,d,m]);typeof o=="string"&&(o=Dr(o));let{pathname:p="/",search:x="",hash:g="",state:w=null,key:N="default",unstable_mask:T}=o,E=v.useMemo(()=>{let C=da(p,h);return C==null?null:{location:{pathname:C,search:x,hash:g,state:w,key:N,unstable_mask:T},navigationType:i}},[h,p,x,g,w,N,i,T]);return En(E!=null,`<Router basename="${h}"> is not able to match the URL "${p}${x}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:v.createElement(nn.Provider,{value:y},v.createElement(Ko.Provider,{children:l,value:E}))}function Aw({children:n,location:l}){return fw(Id(n),l)}function Id(n,l=[]){let o=[];return v.Children.forEach(n,(i,c)=>{if(!v.isValidElement(i))return;let d=[...l,c];if(i.type===v.Fragment){o.push.apply(o,Id(i.props.children,d));return}ot(i.type===Al,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ot(!i.props.index||!i.props.children,"An index route cannot have child routes.");let m={id:i.props.id||d.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(m.children=Id(i.props.children,d)),o.push(m)}),o}var Es="get",Ns="application/x-www-form-urlencoded";function Fs(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Rw(n){return Fs(n)&&n.tagName.toLowerCase()==="button"}function _w(n){return Fs(n)&&n.tagName.toLowerCase()==="form"}function jw(n){return Fs(n)&&n.tagName.toLowerCase()==="input"}function Mw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ow(n,l){return n.button===0&&(!l||l==="_self")&&!Mw(n)}var fs=null;function Dw(){if(fs===null)try{new FormData(document.createElement("form"),0),fs=!1}catch{fs=!0}return fs}var kw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Md(n){return n!=null&&!kw.has(n)?(En(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ns}"`),null):n}function zw(n,l){let o,i,c,d,m;if(_w(n)){let h=n.getAttribute("action");i=h?da(h,l):null,o=n.getAttribute("method")||Es,c=Md(n.getAttribute("enctype"))||Ns,d=new FormData(n)}else if(Rw(n)||jw(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=n.getAttribute("formaction")||h.getAttribute("action");if(i=y?da(y,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Es,c=Md(n.getAttribute("formenctype"))||Md(h.getAttribute("enctype"))||Ns,d=new FormData(h,n),!Dw()){let{name:p,type:x,value:g}=n;if(x==="image"){let w=p?`${p}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else p&&d.append(p,g)}}else{if(Fs(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Es,i=null,c=Ns,m=n}return d&&c==="text/plain"&&(m=d,d=void 0),{action:i,method:o.toLowerCase(),encType:c,formData:d,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function wf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Lw(n,l,o,i){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${i}`:c.pathname=`${c.pathname}.${i}`:c.pathname==="/"?c.pathname=`_root.${i}`:l&&da(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${i}`,c}async function Uw(n,l){if(n.id in l)return l[n.id];try{let o=await import(n.module);return l[n.id]=o,o}catch(o){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Bw(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Hw(n,l,o){let i=await Promise.all(n.map(async c=>{let d=l.routes[c.route.id];if(d){let m=await Uw(d,o);return m.links?m.links():[]}return[]}));return qw(i.flat(1).filter(Bw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function fv(n,l,o,i,c,d){let m=(y,p)=>o[p]?y.route.id!==o[p].route.id:!0,h=(y,p)=>{var x;return o[p].pathname!==y.pathname||((x=o[p].route.path)==null?void 0:x.endsWith("*"))&&o[p].params["*"]!==y.params["*"]};return d==="assets"?l.filter((y,p)=>m(y,p)||h(y,p)):d==="data"?l.filter((y,p)=>{var g;let x=i.routes[y.route.id];if(!x||!x.hasLoader)return!1;if(m(y,p)||h(y,p))return!0;if(y.route.shouldRevalidate){let w=y.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((g=o[0])==null?void 0:g.params)||{},nextUrl:new URL(n,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function Vw(n,l,{includeHydrateFallback:o}={}){return $w(n.map(i=>{let c=l.routes[i.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function $w(n){return[...new Set(n)]}function Yw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function qw(n,l){let o=new Set;return new Set(l),n.reduce((i,c)=>{let d=JSON.stringify(Yw(c));return o.has(d)||(o.add(d),i.push({key:d,link:c})),i},[])}function E0(){let n=v.useContext(kr);return wf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Gw(){let n=v.useContext(Is);return wf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Ef=v.createContext(void 0);Ef.displayName="FrameworkContext";function N0(){let n=v.useContext(Ef);return wf(n,"You must render this element inside a <HydratedRouter> element"),n}function Pw(n,l){let o=v.useContext(Ef),[i,c]=v.useState(!1),[d,m]=v.useState(!1),{onFocus:h,onBlur:y,onMouseEnter:p,onMouseLeave:x,onTouchStart:g}=l,w=v.useRef(null);v.useEffect(()=>{if(n==="render"&&m(!0),n==="viewport"){let E=A=>{A.forEach(R=>{m(R.isIntersecting)})},C=new IntersectionObserver(E,{threshold:.5});return w.current&&C.observe(w.current),()=>{C.disconnect()}}},[n]),v.useEffect(()=>{if(i){let E=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(E)}}},[i]);let N=()=>{c(!0)},T=()=>{c(!1),m(!1)};return o?n!=="intent"?[d,w,{}]:[d,w,{onFocus:ko(h,N),onBlur:ko(y,T),onMouseEnter:ko(p,N),onMouseLeave:ko(x,T),onTouchStart:ko(g,N)}]:[!1,w,{}]}function ko(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function Xw({page:n,...l}){let{router:o}=E0(),i=v.useMemo(()=>s0(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?v.createElement(Qw,{page:n,matches:i,...l}):null}function Kw(n){let{manifest:l,routeModules:o}=N0(),[i,c]=v.useState([]);return v.useEffect(()=>{let d=!1;return Hw(n,l,o).then(m=>{d||c(m)}),()=>{d=!0}},[n,l,o]),i}function Qw({page:n,matches:l,...o}){let i=qn(),{future:c,manifest:d,routeModules:m}=N0(),{basename:h}=E0(),{loaderData:y,matches:p}=Gw(),x=v.useMemo(()=>fv(n,l,p,d,i,"data"),[n,l,p,d,i]),g=v.useMemo(()=>fv(n,l,p,d,i,"assets"),[n,l,p,d,i]),w=v.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let E=new Set,C=!1;if(l.forEach(R=>{var z;let _=d.routes[R.route.id];!_||!_.hasLoader||(!x.some(q=>q.route.id===R.route.id)&&R.route.id in y&&((z=m[R.route.id])!=null&&z.shouldRevalidate)||_.hasClientLoader?C=!0:E.add(R.route.id))}),E.size===0)return[];let A=Lw(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&E.size>0&&A.searchParams.set("_routes",l.filter(R=>E.has(R.route.id)).map(R=>R.route.id).join(",")),[A.pathname+A.search]},[h,c.unstable_trailingSlashAwareDataRequests,y,i,d,x,l,n,m]),N=v.useMemo(()=>Vw(g,d),[g,d]),T=Kw(g);return v.createElement(v.Fragment,null,w.map(E=>v.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...o})),N.map(E=>v.createElement("link",{key:E,rel:"modulepreload",href:E,...o})),T.map(({key:E,link:C})=>v.createElement("link",{key:E,nonce:o.nonce,...C,crossOrigin:C.crossOrigin??o.crossOrigin})))}function Zw(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var Iw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Iw&&(window.__reactRouterVersion="7.13.2")}catch{}function Fw({basename:n,children:l,unstable_useTransitions:o,window:i}){let c=v.useRef();c.current==null&&(c.current=_2({window:i,v5Compat:!0}));let d=c.current,[m,h]=v.useState({action:d.action,location:d.location}),y=v.useCallback(p=>{o===!1?h(p):v.startTransition(()=>h(p))},[o]);return v.useLayoutEffect(()=>d.listen(y),[d,y]),v.createElement(Cw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var T0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C0=v.forwardRef(function({onClick:l,discover:o="render",prefetch:i="none",relative:c,reloadDocument:d,replace:m,unstable_mask:h,state:y,target:p,to:x,preventScrollReset:g,viewTransition:w,unstable_defaultShouldRevalidate:N,...T},E){let{basename:C,navigator:A,unstable_useTransitions:R}=v.useContext(nn),_=typeof x=="string"&&T0.test(x),z=f0(x,C);x=z.to;let q=cw(x,{relative:c}),K=qn(),$=null;if(h){let le=Zs(h,[],K.unstable_mask?K.unstable_mask.pathname:"/",!0);C!=="/"&&(le.pathname=le.pathname==="/"?C:$n([C,le.pathname])),$=A.createHref(le)}let[H,ae,ie]=Pw(i,T),me=eE(x,{replace:m,unstable_mask:h,state:y,target:p,preventScrollReset:g,relative:c,viewTransition:w,unstable_defaultShouldRevalidate:N,unstable_useTransitions:R});function fe(le){l&&l(le),le.defaultPrevented||me(le)}let ue=!(z.isExternal||d),de=v.createElement("a",{...T,...ie,href:(ue?$:void 0)||z.absoluteURL||q,onClick:ue?fe:l,ref:Zw(E,ae),target:p,"data-discover":!_&&o==="render"?"true":void 0});return H&&!_?v.createElement(v.Fragment,null,de,v.createElement(Xw,{page:q})):de});C0.displayName="Link";var Fd=v.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:i="",end:c=!1,style:d,to:m,viewTransition:h,children:y,...p},x){let g=Qo(m,{relative:p.relative}),w=qn(),N=v.useContext(Is),{navigator:T,basename:E}=v.useContext(nn),C=N!=null&&rE(g)&&h===!0,A=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,R=w.pathname,_=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;o||(R=R.toLowerCase(),_=_?_.toLowerCase():null,A=A.toLowerCase()),_&&E&&(_=da(_,E)||_);const z=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let q=R===A||!c&&R.startsWith(A)&&R.charAt(z)==="/",K=_!=null&&(_===A||!c&&_.startsWith(A)&&_.charAt(A.length)==="/"),$={isActive:q,isPending:K,isTransitioning:C},H=q?l:void 0,ae;typeof i=="function"?ae=i($):ae=[i,q?"active":null,K?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ie=typeof d=="function"?d($):d;return v.createElement(C0,{...p,"aria-current":H,className:ae,ref:x,style:ie,to:m,viewTransition:h},typeof y=="function"?y($):y)});Fd.displayName="NavLink";var Jw=v.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:c,state:d,method:m=Es,action:h,onSubmit:y,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w,...N},T)=>{let{unstable_useTransitions:E}=v.useContext(nn),C=aE(),A=lE(h,{relative:p}),R=m.toLowerCase()==="get"?"get":"post",_=typeof h=="string"&&T0.test(h),z=q=>{if(y&&y(q),q.defaultPrevented)return;q.preventDefault();let K=q.nativeEvent.submitter,$=(K==null?void 0:K.getAttribute("formmethod"))||m,H=()=>C(K||q.currentTarget,{fetcherKey:l,method:$,navigate:o,replace:c,state:d,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w});E&&o!==!1?v.startTransition(()=>H()):H()};return v.createElement("form",{ref:T,method:R,action:A,onSubmit:i?y:z,...N,"data-discover":!_&&n==="render"?"true":void 0})});Jw.displayName="Form";function Ww(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function A0(n){let l=v.useContext(kr);return ot(l,Ww(n)),l}function eE(n,{target:l,replace:o,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p}={}){let x=y0(),g=qn(),w=Qo(n,{relative:m});return v.useCallback(N=>{if(Ow(N,l)){N.preventDefault();let T=o!==void 0?o:Go(g)===Go(w),E=()=>x(n,{replace:T,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y});p?v.startTransition(()=>E()):E()}},[g,x,w,o,i,c,l,n,d,m,h,y,p])}var tE=0,nE=()=>`__${String(++tE)}__`;function aE(){let{router:n}=A0("useSubmit"),{basename:l}=v.useContext(nn),o=Sw(),i=n.fetch,c=n.navigate;return v.useCallback(async(d,m={})=>{let{action:h,method:y,encType:p,formData:x,body:g}=zw(d,l);if(m.navigate===!1){let w=m.fetcherKey||nE();await i(w,o,m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:g,formMethod:m.method||y,formEncType:m.encType||p,flushSync:m.flushSync})}else await c(m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:g,formMethod:m.method||y,formEncType:m.encType||p,replace:m.replace,state:m.state,fromRouteId:o,flushSync:m.flushSync,viewTransition:m.viewTransition})},[i,c,l,o])}function lE(n,{relative:l}={}){let{basename:o}=v.useContext(nn),i=v.useContext(hn);ot(i,"useFormAction must be used inside a RouteContext");let[c]=i.matches.slice(-1),d={...Qo(n||".",{relative:l})},m=qn();if(n==null){d.search=m.search;let h=new URLSearchParams(d.search),y=h.getAll("index");if(y.some(x=>x==="")){h.delete("index"),y.filter(g=>g).forEach(g=>h.append("index",g));let x=h.toString();d.search=x?`?${x}`:""}}return(!n||n===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:$n([o,d.pathname])),Go(d)}function rE(n,{relative:l}={}){let o=v.useContext(h0);ot(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=A0("useViewTransitionState"),c=Qo(n,{relative:l});if(!o.isTransitioning)return!1;let d=da(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=da(o.nextLocation.pathname,i)||o.nextLocation.pathname;return js(c.pathname,m)!=null||js(c.pathname,d)!=null}var Zo=o0();const R0=r0(Zo),oE="/api";function iE(n,l){if(typeof n=="string"&&n)return n;if(n&&typeof n=="object"){const o=n,i=typeof o.error=="object"&&o.error!==null?o.error:void 0;if(typeof o.error=="string"&&o.error)return o.error;if(typeof(i==null?void 0:i.message)=="string"&&i.message)return i.message;if(typeof o.message=="string"&&o.message)return o.message}return l}async function Ne(n,l){const o=await fetch(`${oE}${n}`,{...l,headers:{"Content-Type":"application/json",...l==null?void 0:l.headers}});if(!o.ok){const i=await o.json().catch(()=>o.statusText);throw new Error(iE(i,`HTTP ${o.status}`))}return o.json()}function sE(){return Ne("/system/info")}function oj(n){return Ne("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function _0(n){return Ne("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function cE(){return Ne("/system/runtime/stop",{method:"POST"})}function uE(){return Ne("/cluster/state")}function ij(){return Ne("/cluster/promote",{method:"POST"})}function sj(n){return Ne("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function cj(){return Ne("/cluster/disconnect",{method:"POST"})}function dE(n){return Ne(`/node-operations/${n}`)}async function fE(n={}){const l=new URLSearchParams;n.nodeId&&l.set("nodeId",n.nodeId),n.status&&l.set("status",n.status),n.kind&&l.set("kind",n.kind);const o=l.toString();return(await Ne(`/node-operations${o?`?${o}`:""}`)).operations}function mE(n,l){return Ne(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function hE(n,l){return Ne(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function uj(){return(await Ne("/devboxes")).devboxes}function dj(n,l){return Ne(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function fj(n){return Ne(`/nodes/${n}/devbox/status`)}function mj(n){return Ne(`/nodes/${n}/devbox/start`,{method:"POST"})}function hj(n,l){return Ne(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function pj(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),100))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.directoriesOnly!==void 0&&o.set("directoriesOnly",String(l.directoriesOnly)),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ne(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function gj(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),20))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ne(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function vj(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ne(`/nodes/${n}/native-sessions?${o.toString()}`)}function yj(n,l){return Ne(`/nodes/${n}/workdir/branch`,{method:"POST",body:JSON.stringify({path:l.path,branchName:l.branchName,startPoint:l.startPoint,limit:l.limit,offset:l.offset,allowAbsolute:l.allowAbsolute})})}function bj(n,l){return Ne(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function xj(n){return Ne(`/nodes/${n}/terminal/sessions`)}function Sj(n,l){return Ne(`/nodes/${n}/terminal/sessions/${l}`)}function wj(n,l){return Ne(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function Ej(n){const l=new URLSearchParams;if(n!=null&&n.status&&l.set("status",n.status),n!=null&&n.assignedTo&&l.set("assignedTo",n.assignedTo),n!=null&&n.priority&&l.set("priority",n.priority),n!=null&&n.limit){const i=Math.min(Math.max(1,n.limit),100);l.set("limit",String(i))}if(n!=null&&n.offset&&l.set("offset",String(n.offset)),n!=null&&n.projectPath&&l.set("projectPath",n.projectPath),n!=null&&n.cursor&&l.set("cursor",n.cursor),(n==null?void 0:n.completedLimitPerProject)!==void 0){const i=Math.min(Math.max(1,n.completedLimitPerProject),100);l.set("completedLimitPerProject",String(i))}const o=l.toString();return Ne(`/tasks${o?`?${o}`:""}`)}function Nj(n){return Ne(`/tasks/${n}`)}function Tj(n){return Ne("/tasks",{method:"POST",body:JSON.stringify(n)})}function Cj(n){return Ne("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function Aj(n){return Ne("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function Rj(n){return Ne("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function _j(n){return Ne(`/tasks/${n}/cancel`,{method:"POST"})}function jj(n){return Ne(`/tasks/${n}/retry`,{method:"POST"})}function Mj(n,l){return Ne(`/tasks/${n}/logs`)}function Oj(n,l){return Ne(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function Dj(n,l){return Ne(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function kj(n,l){return Ne(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function zj(n){return Ne(`/tasks/${n}/share`,{method:"DELETE"})}function Lj(n){return Ne(`/shared/conversations/${encodeURIComponent(n)}`)}function Uj(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function Bj(n){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output`)}function Hj(n,l="."){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function Vj(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function $j(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function pE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Yj(n){return Ne(`/tasks/${n}/output`)}function qj(n,l="."){return Ne(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Gj(n,l){return Ne(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Pj(n,l){return Ne(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(pE(l))})}function Xj(n){return Ne(`/tasks/${n}/output/diff`)}function gE({hasStarted:n,enabled:l}){return l&&!n}function vE(n,l,o=!0){const i=v.useRef(n),c=v.useRef(!1);v.useEffect(()=>{i.current=n},[n]),v.useEffect(()=>{if(!o)return;const d=()=>i.current();gE({hasStarted:c.current,enabled:o})&&(c.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let yE=0;function bE(n=50){const[l,o]=v.useState([]),[i,c]=v.useState(!1),d=v.useRef(null),m=v.useRef(0),h=v.useRef(new Map);v.useEffect(()=>{const x=new EventSource("/api/events");d.current=x,x.onopen=()=>c(!0),x.onerror=()=>c(!1);const g=["node.joined","node.left","node.status","node.operation.created","node.operation.updated","task.created","task.assigned","task.status","task.updated","task.deleted","task.output","election.started","election.complete","cluster.state","transport.changed"];for(const w of g)x.addEventListener(w,N=>{const T={id:String(++yE),type:w,data:JSON.parse(N.data),timestamp:Date.now()};o(E=>[T,...E].slice(0,n));for(const[,{pattern:E,callback:C}]of h.current)w.startsWith(E)&&C(T)});return()=>{x.close(),d.current=null,c(!1)}},[n]);const y=v.useCallback((x,g)=>{const w=++m.current;return h.current.set(w,{pattern:x,callback:g}),()=>{h.current.delete(w)}},[]),p=v.useCallback(()=>o([]),[]);return{events:l,connected:i,subscribe:y,clearEvents:p}}const xE=1e4,SE=6e4,wE=xE,EE=250,NE=new Set(["task.created","task.assigned","task.deleted"]),TE=new Set(["task.created","task.assigned","task.status","task.deleted"]);function CE(n){return n?SE:wE}function Kj(n){return NE.has(n)}function AE(n){return TE.has(n)}function RE(n,l){if(!l)return!0;const o=n.leaderId,i=n.term,c=n.nodeCount;return typeof o!="string"&&o!==null||typeof i!="number"||typeof c!="number"?!0:l.leaderId!==o||l.term!==i||l.nodeCount!==c}function _E(n,l,o){if(n==="node.joined"||n==="node.left"||n!=="node.status")return!0;const i=l.nodeId,c=l.status;return typeof i!="string"||typeof c!="string"?!0:o.get(i)!==c}function Qj(n,l){const o=l.taskId,i=l.status;if(typeof o!="string"||typeof i!="string")return n;let c=!1;const d=n.map(m=>{if(m.id!==o)return m;c=!0;const h="result"in l?l.result:i==="completed"?null:m.result,y="error"in l?l.error:i==="completed"?null:m.error;return{...m,status:i,result:h,error:y}});return c?d:n}const j0=v.createContext(null);function jE({children:n}){const[l,o]=v.useState(null),[i,c]=v.useState(null),[d,m]=v.useState(!0),[h,y]=v.useState(null),p=v.useRef(null),x=v.useRef(null),g=v.useRef(new Map),{events:w,connected:N,subscribe:T}=bE(),E=v.useCallback(async()=>{var A;try{const[R,_]=await Promise.all([uE(),sE()]),z=R,q=_.nodeId??_.id,K=z.nodes??[],$=K.find(ie=>ie.id===q)??{id:q,name:_.name,endpoint:_.endpoint,role:_.role,status:_.status,capabilities:_.capabilities,joinedAt:_.joinedAt,lastHeartbeat:_.lastHeartbeat},H=z.leaderId?K.find(ie=>ie.id===z.leaderId)??null:null,ae={leader:H?{id:H.id,name:H.name,endpoint:H.endpoint,...H.dashboardOrigin?{dashboardOrigin:H.dashboardOrigin}:{}}:null,term:z.term??0,nodes:K,self:$,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((A=ae.leader)==null?void 0:A.id)??null,term:ae.term,nodeCount:ae.nodes.length},g.current=new Map(ae.nodes.map(ie=>[ie.id,ie.status])),g.current.set(ae.self.id,ae.self.status),o(ae),c(_),y(null)}catch(R){y(R instanceof Error?R.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),C=v.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,E()},EE))},[E]);return vE(E,CE(N)),v.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),v.useEffect(()=>{const A=[T("cluster",R=>{RE(R.data,x.current)&&C()}),T("election",C),T("node",R=>{_E(R.type,R.data,g.current)&&C()}),T("transport",C),T("task",R=>{AE(R.type)&&C()})];return()=>A.forEach(R=>R())},[T,C]),f.jsx(j0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:N,subscribe:T,refresh:E,loading:d,error:h},children:n})}function M0(){const n=v.useContext(j0);if(!n)throw new Error("useCluster must be used within ClusterProvider");return n}/**
|
|
61
|
+
Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}/*`}">.`)}let x=qn(),g;if(l){let A=typeof l=="string"?Dr(l):l;ot(y==="/"||((C=A.pathname)==null?void 0:C.startsWith(y)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${y}" but pathname "${A.pathname}" was given in the \`location\` prop.`),g=A}else g=x;let w=g.pathname||"/",N=w;if(y!=="/"){let A=y.replace(/^\//,"").split("/");N="/"+w.replace(/^\//,"").split("/").slice(A.length).join("/")}let T=s0(n,{pathname:N});En(p||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),En(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=vw(T&&T.map(A=>Object.assign({},A,{params:Object.assign({},m,A.params),pathname:$n([y,i.encodeLocation?i.encodeLocation(A.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:$n([y,i.encodeLocation?i.encodeLocation(A.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),c,o);return l&&E?v.createElement(Ko.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},E):E}function mw(){let n=ww(),l=W2(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),o=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:i},d={padding:"2px 4px",backgroundColor:i},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:d},"ErrorBoundary")," or"," ",v.createElement("code",{style:d},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},l),o?v.createElement("pre",{style:c},o):null,m)}var hw=v.createElement(mw,null),S0=class extends v.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const o=sw(n.digest);o&&(n=o)}let l=n!==void 0?v.createElement(hn.Provider,{value:this.props.routeContext},v.createElement(bf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?v.createElement(pw,{error:n},l):l}};S0.contextType=nw;var jd=new WeakMap;function pw({children:n,error:l}){let{basename:o}=v.useContext(nn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=iw(l.digest);if(i){let c=jd.get(l);if(c)throw c;let d=f0(i.location,o);if(d0&&!jd.get(l))if(d.isExternal||i.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:i.replace}));throw jd.set(l,m),m}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function gw({routeContext:n,match:l,children:o}){let i=v.useContext(kr);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),v.createElement(hn.Provider,{value:n},o)}function vw(n,l=[],o){let i=o==null?void 0:o.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let c=n,d=i==null?void 0:i.errors;if(d!=null){let x=c.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);ot(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,x+1))}let m=!1,h=-1;if(o&&i){m=i.renderFallback;for(let x=0;x<c.length;x++){let g=c[x];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(h=x),g.route.id){let{loaderData:w,errors:N}=i,T=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!N||N[g.route.id]===void 0);if(g.route.lazy||T){o.isStatic&&(m=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let y=o==null?void 0:o.onError,p=i&&y?(x,g)=>{var w,N;y(x,{location:i.location,params:((N=(w=i.matches)==null?void 0:w[0])==null?void 0:N.params)??{},unstable_pattern:ew(i.matches),errorInfo:g})}:void 0;return c.reduceRight((x,g,w)=>{let N,T=!1,E=null,C=null;i&&(N=d&&g.route.id?d[g.route.id]:void 0,E=g.route.errorElement||hw,m&&(h<0&&w===0?(w0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,C=null):h===w&&(T=!0,C=g.route.hydrateFallbackElement||null)));let A=l.concat(c.slice(0,w+1)),R=()=>{let _;return N?_=E:T?_=C:g.route.Component?_=v.createElement(g.route.Component,null):g.route.element?_=g.route.element:_=x,v.createElement(gw,{match:g,routeContext:{outlet:x,matches:A,isDataRoute:i!=null},children:_})};return i&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(S0,{location:i.location,revalidation:i.revalidation,component:E,error:N,children:R(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:p}):R()},null)}function xf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yw(n){let l=v.useContext(kr);return ot(l,xf(n)),l}function bw(n){let l=v.useContext(Is);return ot(l,xf(n)),l}function xw(n){let l=v.useContext(hn);return ot(l,xf(n)),l}function Sf(n){let l=xw(n),o=l.matches[l.matches.length-1];return ot(o.route.id,`${n} can only be used on routes that contain a unique "id"`),o.route.id}function Sw(){return Sf("useRouteId")}function ww(){var i;let n=v.useContext(bf),l=bw("useRouteError"),o=Sf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function Ew(){let{router:n}=yw("useNavigate"),l=Sf("useNavigate"),o=v.useRef(!1);return v0(()=>{o.current=!0}),v.useCallback(async(c,d={})=>{En(o.current,g0),o.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...d}))},[n,l])}var uv={};function w0(n,l,o){!l&&!uv[n]&&(uv[n]=!0,En(!1,o))}v.memo(Nw);function Nw({routes:n,future:l,state:o,isStatic:i,onError:c}){return x0(n,void 0,{state:o,isStatic:i,onError:c})}function dv({to:n,replace:l,state:o,relative:i}){ot(zr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=v.useContext(nn);En(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=v.useContext(hn),{pathname:m}=qn(),h=y0(),y=Zs(n,yf(d),m,i==="path"),p=JSON.stringify(y);return v.useEffect(()=>{h(JSON.parse(p),{replace:l,state:o,relative:i})},[h,p,i,l,o]),null}function Tw(n){return dw(n.context)}function Al(n){ot(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Cw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:c,static:d=!1,unstable_useTransitions:m}){ot(!zr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),y=v.useMemo(()=>({basename:h,navigator:c,static:d,unstable_useTransitions:m,future:{}}),[h,c,d,m]);typeof o=="string"&&(o=Dr(o));let{pathname:p="/",search:x="",hash:g="",state:w=null,key:N="default",unstable_mask:T}=o,E=v.useMemo(()=>{let C=da(p,h);return C==null?null:{location:{pathname:C,search:x,hash:g,state:w,key:N,unstable_mask:T},navigationType:i}},[h,p,x,g,w,N,i,T]);return En(E!=null,`<Router basename="${h}"> is not able to match the URL "${p}${x}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:v.createElement(nn.Provider,{value:y},v.createElement(Ko.Provider,{children:l,value:E}))}function Aw({children:n,location:l}){return fw(Id(n),l)}function Id(n,l=[]){let o=[];return v.Children.forEach(n,(i,c)=>{if(!v.isValidElement(i))return;let d=[...l,c];if(i.type===v.Fragment){o.push.apply(o,Id(i.props.children,d));return}ot(i.type===Al,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ot(!i.props.index||!i.props.children,"An index route cannot have child routes.");let m={id:i.props.id||d.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(m.children=Id(i.props.children,d)),o.push(m)}),o}var Es="get",Ns="application/x-www-form-urlencoded";function Fs(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Rw(n){return Fs(n)&&n.tagName.toLowerCase()==="button"}function _w(n){return Fs(n)&&n.tagName.toLowerCase()==="form"}function jw(n){return Fs(n)&&n.tagName.toLowerCase()==="input"}function Mw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ow(n,l){return n.button===0&&(!l||l==="_self")&&!Mw(n)}var fs=null;function Dw(){if(fs===null)try{new FormData(document.createElement("form"),0),fs=!1}catch{fs=!0}return fs}var kw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Md(n){return n!=null&&!kw.has(n)?(En(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ns}"`),null):n}function zw(n,l){let o,i,c,d,m;if(_w(n)){let h=n.getAttribute("action");i=h?da(h,l):null,o=n.getAttribute("method")||Es,c=Md(n.getAttribute("enctype"))||Ns,d=new FormData(n)}else if(Rw(n)||jw(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=n.getAttribute("formaction")||h.getAttribute("action");if(i=y?da(y,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Es,c=Md(n.getAttribute("formenctype"))||Md(h.getAttribute("enctype"))||Ns,d=new FormData(h,n),!Dw()){let{name:p,type:x,value:g}=n;if(x==="image"){let w=p?`${p}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else p&&d.append(p,g)}}else{if(Fs(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Es,i=null,c=Ns,m=n}return d&&c==="text/plain"&&(m=d,d=void 0),{action:i,method:o.toLowerCase(),encType:c,formData:d,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function wf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Lw(n,l,o,i){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${i}`:c.pathname=`${c.pathname}.${i}`:c.pathname==="/"?c.pathname=`_root.${i}`:l&&da(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${i}`,c}async function Uw(n,l){if(n.id in l)return l[n.id];try{let o=await import(n.module);return l[n.id]=o,o}catch(o){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Bw(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Hw(n,l,o){let i=await Promise.all(n.map(async c=>{let d=l.routes[c.route.id];if(d){let m=await Uw(d,o);return m.links?m.links():[]}return[]}));return qw(i.flat(1).filter(Bw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function fv(n,l,o,i,c,d){let m=(y,p)=>o[p]?y.route.id!==o[p].route.id:!0,h=(y,p)=>{var x;return o[p].pathname!==y.pathname||((x=o[p].route.path)==null?void 0:x.endsWith("*"))&&o[p].params["*"]!==y.params["*"]};return d==="assets"?l.filter((y,p)=>m(y,p)||h(y,p)):d==="data"?l.filter((y,p)=>{var g;let x=i.routes[y.route.id];if(!x||!x.hasLoader)return!1;if(m(y,p)||h(y,p))return!0;if(y.route.shouldRevalidate){let w=y.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((g=o[0])==null?void 0:g.params)||{},nextUrl:new URL(n,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function Vw(n,l,{includeHydrateFallback:o}={}){return $w(n.map(i=>{let c=l.routes[i.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function $w(n){return[...new Set(n)]}function Yw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function qw(n,l){let o=new Set;return new Set(l),n.reduce((i,c)=>{let d=JSON.stringify(Yw(c));return o.has(d)||(o.add(d),i.push({key:d,link:c})),i},[])}function E0(){let n=v.useContext(kr);return wf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Gw(){let n=v.useContext(Is);return wf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Ef=v.createContext(void 0);Ef.displayName="FrameworkContext";function N0(){let n=v.useContext(Ef);return wf(n,"You must render this element inside a <HydratedRouter> element"),n}function Pw(n,l){let o=v.useContext(Ef),[i,c]=v.useState(!1),[d,m]=v.useState(!1),{onFocus:h,onBlur:y,onMouseEnter:p,onMouseLeave:x,onTouchStart:g}=l,w=v.useRef(null);v.useEffect(()=>{if(n==="render"&&m(!0),n==="viewport"){let E=A=>{A.forEach(R=>{m(R.isIntersecting)})},C=new IntersectionObserver(E,{threshold:.5});return w.current&&C.observe(w.current),()=>{C.disconnect()}}},[n]),v.useEffect(()=>{if(i){let E=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(E)}}},[i]);let N=()=>{c(!0)},T=()=>{c(!1),m(!1)};return o?n!=="intent"?[d,w,{}]:[d,w,{onFocus:ko(h,N),onBlur:ko(y,T),onMouseEnter:ko(p,N),onMouseLeave:ko(x,T),onTouchStart:ko(g,N)}]:[!1,w,{}]}function ko(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function Xw({page:n,...l}){let{router:o}=E0(),i=v.useMemo(()=>s0(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?v.createElement(Qw,{page:n,matches:i,...l}):null}function Kw(n){let{manifest:l,routeModules:o}=N0(),[i,c]=v.useState([]);return v.useEffect(()=>{let d=!1;return Hw(n,l,o).then(m=>{d||c(m)}),()=>{d=!0}},[n,l,o]),i}function Qw({page:n,matches:l,...o}){let i=qn(),{future:c,manifest:d,routeModules:m}=N0(),{basename:h}=E0(),{loaderData:y,matches:p}=Gw(),x=v.useMemo(()=>fv(n,l,p,d,i,"data"),[n,l,p,d,i]),g=v.useMemo(()=>fv(n,l,p,d,i,"assets"),[n,l,p,d,i]),w=v.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let E=new Set,C=!1;if(l.forEach(R=>{var z;let _=d.routes[R.route.id];!_||!_.hasLoader||(!x.some(q=>q.route.id===R.route.id)&&R.route.id in y&&((z=m[R.route.id])!=null&&z.shouldRevalidate)||_.hasClientLoader?C=!0:E.add(R.route.id))}),E.size===0)return[];let A=Lw(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&E.size>0&&A.searchParams.set("_routes",l.filter(R=>E.has(R.route.id)).map(R=>R.route.id).join(",")),[A.pathname+A.search]},[h,c.unstable_trailingSlashAwareDataRequests,y,i,d,x,l,n,m]),N=v.useMemo(()=>Vw(g,d),[g,d]),T=Kw(g);return v.createElement(v.Fragment,null,w.map(E=>v.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...o})),N.map(E=>v.createElement("link",{key:E,rel:"modulepreload",href:E,...o})),T.map(({key:E,link:C})=>v.createElement("link",{key:E,nonce:o.nonce,...C,crossOrigin:C.crossOrigin??o.crossOrigin})))}function Zw(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var Iw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Iw&&(window.__reactRouterVersion="7.13.2")}catch{}function Fw({basename:n,children:l,unstable_useTransitions:o,window:i}){let c=v.useRef();c.current==null&&(c.current=_2({window:i,v5Compat:!0}));let d=c.current,[m,h]=v.useState({action:d.action,location:d.location}),y=v.useCallback(p=>{o===!1?h(p):v.startTransition(()=>h(p))},[o]);return v.useLayoutEffect(()=>d.listen(y),[d,y]),v.createElement(Cw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var T0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C0=v.forwardRef(function({onClick:l,discover:o="render",prefetch:i="none",relative:c,reloadDocument:d,replace:m,unstable_mask:h,state:y,target:p,to:x,preventScrollReset:g,viewTransition:w,unstable_defaultShouldRevalidate:N,...T},E){let{basename:C,navigator:A,unstable_useTransitions:R}=v.useContext(nn),_=typeof x=="string"&&T0.test(x),z=f0(x,C);x=z.to;let q=cw(x,{relative:c}),K=qn(),$=null;if(h){let le=Zs(h,[],K.unstable_mask?K.unstable_mask.pathname:"/",!0);C!=="/"&&(le.pathname=le.pathname==="/"?C:$n([C,le.pathname])),$=A.createHref(le)}let[H,ae,ie]=Pw(i,T),me=eE(x,{replace:m,unstable_mask:h,state:y,target:p,preventScrollReset:g,relative:c,viewTransition:w,unstable_defaultShouldRevalidate:N,unstable_useTransitions:R});function fe(le){l&&l(le),le.defaultPrevented||me(le)}let ue=!(z.isExternal||d),de=v.createElement("a",{...T,...ie,href:(ue?$:void 0)||z.absoluteURL||q,onClick:ue?fe:l,ref:Zw(E,ae),target:p,"data-discover":!_&&o==="render"?"true":void 0});return H&&!_?v.createElement(v.Fragment,null,de,v.createElement(Xw,{page:q})):de});C0.displayName="Link";var Fd=v.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:i="",end:c=!1,style:d,to:m,viewTransition:h,children:y,...p},x){let g=Qo(m,{relative:p.relative}),w=qn(),N=v.useContext(Is),{navigator:T,basename:E}=v.useContext(nn),C=N!=null&&rE(g)&&h===!0,A=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,R=w.pathname,_=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;o||(R=R.toLowerCase(),_=_?_.toLowerCase():null,A=A.toLowerCase()),_&&E&&(_=da(_,E)||_);const z=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let q=R===A||!c&&R.startsWith(A)&&R.charAt(z)==="/",K=_!=null&&(_===A||!c&&_.startsWith(A)&&_.charAt(A.length)==="/"),$={isActive:q,isPending:K,isTransitioning:C},H=q?l:void 0,ae;typeof i=="function"?ae=i($):ae=[i,q?"active":null,K?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ie=typeof d=="function"?d($):d;return v.createElement(C0,{...p,"aria-current":H,className:ae,ref:x,style:ie,to:m,viewTransition:h},typeof y=="function"?y($):y)});Fd.displayName="NavLink";var Jw=v.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:c,state:d,method:m=Es,action:h,onSubmit:y,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w,...N},T)=>{let{unstable_useTransitions:E}=v.useContext(nn),C=aE(),A=lE(h,{relative:p}),R=m.toLowerCase()==="get"?"get":"post",_=typeof h=="string"&&T0.test(h),z=q=>{if(y&&y(q),q.defaultPrevented)return;q.preventDefault();let K=q.nativeEvent.submitter,$=(K==null?void 0:K.getAttribute("formmethod"))||m,H=()=>C(K||q.currentTarget,{fetcherKey:l,method:$,navigate:o,replace:c,state:d,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w});E&&o!==!1?v.startTransition(()=>H()):H()};return v.createElement("form",{ref:T,method:R,action:A,onSubmit:i?y:z,...N,"data-discover":!_&&n==="render"?"true":void 0})});Jw.displayName="Form";function Ww(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function A0(n){let l=v.useContext(kr);return ot(l,Ww(n)),l}function eE(n,{target:l,replace:o,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p}={}){let x=y0(),g=qn(),w=Qo(n,{relative:m});return v.useCallback(N=>{if(Ow(N,l)){N.preventDefault();let T=o!==void 0?o:Go(g)===Go(w),E=()=>x(n,{replace:T,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y});p?v.startTransition(()=>E()):E()}},[g,x,w,o,i,c,l,n,d,m,h,y,p])}var tE=0,nE=()=>`__${String(++tE)}__`;function aE(){let{router:n}=A0("useSubmit"),{basename:l}=v.useContext(nn),o=Sw(),i=n.fetch,c=n.navigate;return v.useCallback(async(d,m={})=>{let{action:h,method:y,encType:p,formData:x,body:g}=zw(d,l);if(m.navigate===!1){let w=m.fetcherKey||nE();await i(w,o,m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:g,formMethod:m.method||y,formEncType:m.encType||p,flushSync:m.flushSync})}else await c(m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:g,formMethod:m.method||y,formEncType:m.encType||p,replace:m.replace,state:m.state,fromRouteId:o,flushSync:m.flushSync,viewTransition:m.viewTransition})},[i,c,l,o])}function lE(n,{relative:l}={}){let{basename:o}=v.useContext(nn),i=v.useContext(hn);ot(i,"useFormAction must be used inside a RouteContext");let[c]=i.matches.slice(-1),d={...Qo(n||".",{relative:l})},m=qn();if(n==null){d.search=m.search;let h=new URLSearchParams(d.search),y=h.getAll("index");if(y.some(x=>x==="")){h.delete("index"),y.filter(g=>g).forEach(g=>h.append("index",g));let x=h.toString();d.search=x?`?${x}`:""}}return(!n||n===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:$n([o,d.pathname])),Go(d)}function rE(n,{relative:l}={}){let o=v.useContext(h0);ot(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=A0("useViewTransitionState"),c=Qo(n,{relative:l});if(!o.isTransitioning)return!1;let d=da(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=da(o.nextLocation.pathname,i)||o.nextLocation.pathname;return js(c.pathname,m)!=null||js(c.pathname,d)!=null}var Zo=o0();const R0=r0(Zo),oE="/api";function iE(n,l){if(typeof n=="string"&&n)return n;if(n&&typeof n=="object"){const o=n,i=typeof o.error=="object"&&o.error!==null?o.error:void 0;if(typeof o.error=="string"&&o.error)return o.error;if(typeof(i==null?void 0:i.message)=="string"&&i.message)return i.message;if(typeof o.message=="string"&&o.message)return o.message}return l}async function Ne(n,l){const o=await fetch(`${oE}${n}`,{...l,headers:{"Content-Type":"application/json",...l==null?void 0:l.headers}});if(!o.ok){const i=await o.json().catch(()=>o.statusText);throw new Error(iE(i,`HTTP ${o.status}`))}return o.json()}function sE(){return Ne("/system/info")}function oj(n){return Ne("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function _0(n){return Ne("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function cE(){return Ne("/system/runtime/stop",{method:"POST"})}function uE(){return Ne("/cluster/state")}function ij(){return Ne("/cluster/promote",{method:"POST"})}function sj(n){return Ne("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function cj(){return Ne("/cluster/disconnect",{method:"POST"})}function dE(n){return Ne(`/node-operations/${n}`)}async function fE(n={}){const l=new URLSearchParams;n.nodeId&&l.set("nodeId",n.nodeId),n.status&&l.set("status",n.status),n.kind&&l.set("kind",n.kind);const o=l.toString();return(await Ne(`/node-operations${o?`?${o}`:""}`)).operations}function mE(n,l){return Ne(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function hE(n,l){return Ne(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function uj(){return(await Ne("/devboxes")).devboxes}function dj(n,l){return Ne(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function fj(n){return Ne(`/nodes/${n}/devbox/status`)}function mj(n){return Ne(`/nodes/${n}/devbox/start`,{method:"POST"})}function hj(n,l){return Ne(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function pj(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),100))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.directoriesOnly!==void 0&&o.set("directoriesOnly",String(l.directoriesOnly)),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ne(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function gj(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),20))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ne(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function vj(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ne(`/nodes/${n}/native-sessions?${o.toString()}`)}function yj(n,l){return Ne(`/nodes/${n}/workdir/branch`,{method:"POST",body:JSON.stringify({path:l.path,branchName:l.branchName,startPoint:l.startPoint,limit:l.limit,offset:l.offset,allowAbsolute:l.allowAbsolute})})}function bj(n,l){return Ne(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function xj(n){return Ne(`/nodes/${n}/terminal/sessions`)}function Sj(n,l){return Ne(`/nodes/${n}/terminal/sessions/${l}`)}function wj(n,l){return Ne(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function Ej(n){const l=new URLSearchParams;if(n!=null&&n.status&&l.set("status",n.status),n!=null&&n.assignedTo&&l.set("assignedTo",n.assignedTo),n!=null&&n.priority&&l.set("priority",n.priority),n!=null&&n.limit){const i=Math.min(Math.max(1,n.limit),100);l.set("limit",String(i))}if(n!=null&&n.offset&&l.set("offset",String(n.offset)),n!=null&&n.projectPath&&l.set("projectPath",n.projectPath),n!=null&&n.cursor&&l.set("cursor",n.cursor),(n==null?void 0:n.completedLimitPerProject)!==void 0){const i=Math.min(Math.max(1,n.completedLimitPerProject),100);l.set("completedLimitPerProject",String(i))}const o=l.toString();return Ne(`/tasks${o?`?${o}`:""}`)}function Nj(n){return Ne(`/tasks/${n}`)}function Tj(n){return Ne("/tasks",{method:"POST",body:JSON.stringify(n)})}function Cj(n){return Ne("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function Aj(n){return Ne("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function Rj(n){return Ne("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function _j(n){return Ne(`/tasks/${n}/cancel`,{method:"POST"})}function jj(n){return Ne(`/tasks/${n}/retry`,{method:"POST"})}function Mj(n,l){return Ne(`/tasks/${n}/logs`)}function Oj(n,l){return Ne(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function Dj(n,l){return Ne(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function kj(n,l){return Ne(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function zj(n){return Ne(`/tasks/${n}/share`,{method:"DELETE"})}function Lj(n){return Ne(`/shared/conversations/${encodeURIComponent(n)}`)}function Uj(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function Bj(n){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output`)}function Hj(n,l="."){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function Vj(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function $j(n,l){return Ne(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function pE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Yj(n){return Ne(`/tasks/${n}/output`)}function qj(n,l="."){return Ne(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Gj(n,l){return Ne(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Pj(n,l){return Ne(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(pE(l))})}function Xj(n){return Ne(`/tasks/${n}/output/diff`)}function gE({hasStarted:n,enabled:l}){return l&&!n}function vE(n,l,o=!0){const i=v.useRef(n),c=v.useRef(!1);v.useEffect(()=>{i.current=n},[n]),v.useEffect(()=>{if(!o)return;const d=()=>i.current();gE({hasStarted:c.current,enabled:o})&&(c.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let yE=0;function bE(n=50){const[l,o]=v.useState([]),[i,c]=v.useState(!1),d=v.useRef(null),m=v.useRef(0),h=v.useRef(new Map);v.useEffect(()=>{const x=new EventSource("/api/events");d.current=x,x.onopen=()=>c(!0),x.onerror=()=>c(!1);const g=["node.joined","node.left","node.status","node.operation.created","node.operation.updated","task.created","task.assigned","task.status","task.updated","task.deleted","task.output","election.started","election.complete","cluster.state","transport.changed"];for(const w of g)x.addEventListener(w,N=>{const T={id:String(++yE),type:w,data:JSON.parse(N.data),timestamp:Date.now()};o(E=>[T,...E].slice(0,n));for(const[,{pattern:E,callback:C}]of h.current)w.startsWith(E)&&C(T)});return()=>{x.close(),d.current=null,c(!1)}},[n]);const y=v.useCallback((x,g)=>{const w=++m.current;return h.current.set(w,{pattern:x,callback:g}),()=>{h.current.delete(w)}},[]),p=v.useCallback(()=>o([]),[]);return{events:l,connected:i,subscribe:y,clearEvents:p}}const xE=1e4,SE=6e4,wE=xE,EE=250,NE=new Set(["node.joined","node.left","task.created","task.assigned","task.deleted"]),TE=new Set(["task.created","task.assigned","task.status","task.deleted"]);function CE(n){return n?SE:wE}function Kj(n){return NE.has(n)}function AE(n){return TE.has(n)}function RE(n,l){if(!l)return!0;const o=n.leaderId,i=n.term,c=n.nodeCount;return typeof o!="string"&&o!==null||typeof i!="number"||typeof c!="number"?!0:l.leaderId!==o||l.term!==i||l.nodeCount!==c}function _E(n,l,o){if(n==="node.joined"||n==="node.left"||n!=="node.status")return!0;const i=l.nodeId,c=l.status;return typeof i!="string"||typeof c!="string"?!0:o.get(i)!==c}function Qj(n,l){const o=l.taskId,i=l.status;if(typeof o!="string"||typeof i!="string")return n;let c=!1;const d=n.map(m=>{if(m.id!==o)return m;c=!0;const h="result"in l?l.result:i==="completed"?null:m.result,y="error"in l?l.error:i==="completed"?null:m.error;return{...m,status:i,result:h,error:y}});return c?d:n}const j0=v.createContext(null);function jE({children:n}){const[l,o]=v.useState(null),[i,c]=v.useState(null),[d,m]=v.useState(!0),[h,y]=v.useState(null),p=v.useRef(null),x=v.useRef(null),g=v.useRef(new Map),{events:w,connected:N,subscribe:T}=bE(),E=v.useCallback(async()=>{var A;try{const[R,_]=await Promise.all([uE(),sE()]),z=R,q=_.nodeId??_.id,K=z.nodes??[],$=K.find(ie=>ie.id===q)??{id:q,name:_.name,endpoint:_.endpoint,role:_.role,status:_.status,capabilities:_.capabilities,joinedAt:_.joinedAt,lastHeartbeat:_.lastHeartbeat},H=z.leaderId?K.find(ie=>ie.id===z.leaderId)??null:null,ae={leader:H?{id:H.id,name:H.name,endpoint:H.endpoint,...H.dashboardOrigin?{dashboardOrigin:H.dashboardOrigin}:{}}:null,term:z.term??0,nodes:K,self:$,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((A=ae.leader)==null?void 0:A.id)??null,term:ae.term,nodeCount:ae.nodes.length},g.current=new Map(ae.nodes.map(ie=>[ie.id,ie.status])),g.current.set(ae.self.id,ae.self.status),o(ae),c(_),y(null)}catch(R){y(R instanceof Error?R.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),C=v.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,E()},EE))},[E]);return vE(E,CE(N)),v.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),v.useEffect(()=>{const A=[T("cluster",R=>{RE(R.data,x.current)&&C()}),T("election",C),T("node",R=>{_E(R.type,R.data,g.current)&&C()}),T("transport",C),T("task",R=>{AE(R.type)&&C()})];return()=>A.forEach(R=>R())},[T,C]),f.jsx(j0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:N,subscribe:T,refresh:E,loading:d,error:h},children:n})}function M0(){const n=v.useContext(j0);if(!n)throw new Error("useCluster must be used within ClusterProvider");return n}/**
|
|
62
62
|
* @license lucide-react v1.7.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
@@ -318,4 +318,4 @@ You can add a description to the \`${_r}\` by passing a \`${Rx}\` 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 \`${_r}\`. 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},d_=Sx,f_=wx,m_=Ex,Dx=Nx,kx=Tx,zx=jx,Lx=Ox,Ux=Ax,Bx=_x;const mf=d_,hf=f_,h_=m_,Hx=v.forwardRef(({className:n,...l},o)=>f.jsx(Dx,{className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Hx.displayName=Dx.displayName;const Ys=v.forwardRef(({className:n,...l},o)=>f.jsxs(h_,{children:[f.jsx(Hx,{}),f.jsx(kx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Ys.displayName=kx.displayName;const qs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});qs.displayName="AlertDialogHeader";const Gs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Gs.displayName="AlertDialogFooter";const Ps=v.forwardRef(({className:n,...l},o)=>f.jsx(Ux,{ref:o,className:se("text-lg font-semibold",n),...l}));Ps.displayName=Ux.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));Xs.displayName=Bx.displayName;const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx(zx,{ref:o,className:se(Af(),n),...l}));Ks.displayName=zx.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{ref:o,className:se(Af({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Qs.displayName=Lx.displayName;const p_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function g_({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:se("relative inline-flex h-2.5 w-2.5 rounded-full",p_[n])})]})}function v_({role:n,size:l="default"}){return f.jsx(yt,{variant:n==="leader"?"default":"secondary",className:se(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const y_={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 Ij({status:n,size:l="default"}){const o=y_[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(yt,{variant:o.variant,className:se("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:se("rounded-full",o.dotClass)}),n]})}const b_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function Fj({priority:n}){const l=b_[n];return f.jsx(yt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function x_(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 Er({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 S_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=x_(l.packages);return f.jsxs($s,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(HE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Un,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Bn,{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(lN,{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(Er,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Er,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Er,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Er,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Er,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Er,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Un,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Bn,{"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(yt,{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 uc="Checkbox",[w_]=Ja(uc),[E_,Jf]=w_(uc);function N_(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]=jr({prop:o,defaultProp:c??!1,onChange:y,caller:uc}),[T,E]=v.useState(null),[C,A]=v.useState(null),R=v.useRef(!1),_=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:R,required:p,defaultChecked:Ka(c)?!1:c,isFormControl:_,bubbleInput:C,setBubbleInput:A};return f.jsx(E_,{scope:l,...z,children:T_(g)?g(z):i})}var Vx="CheckboxTrigger",$x=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}=Jf(Vx,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const R=()=>g(C.current);return A.addEventListener("reset",R),()=>A.removeEventListener("reset",R)}},[d,g]),f.jsx(Be.button,{type:"button",role:"checkbox","aria-checked":Ka(y)?"mixed":y,"aria-required":p,"data-state":Xx(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(R=>Ka(R)?!0:!R),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});$x.displayName=Vx;var Wf=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(N_,{__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($x,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Px,{__scopeCheckbox:o})]})})});Wf.displayName=uc;var Yx="CheckboxIndicator",qx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=Jf(Yx,o);return f.jsx(Lr,{present:i||Ka(d.checked)||d.checked===!0,children:f.jsx(Be.span,{"data-state":Xx(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});qx.displayName=Yx;var Gx="CheckboxBubbleInput",Px=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}=Jf(Gx,n),T=tt(o,N),E=mb(d),C=nb(i);v.useEffect(()=>{const R=w;if(!R)return;const _=window.HTMLInputElement.prototype,q=Object.getOwnPropertyDescriptor(_,"checked").set,K=!c.current;if(E!==d&&q){const $=new Event("click",{bubbles:K});R.indeterminate=Ka(d),q.call(R,Ka(d)?!1:d),R.dispatchEvent($)}},[w,E,d,c]);const A=v.useRef(Ka(d)?!1:d);return f.jsx(Be.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%)"}})});Px.displayName=Gx;function T_(n){return typeof n=="function"}function Ka(n){return n==="indeterminate"}function Xx(n){return Ka(n)?"indeterminate":n?"checked":"unchecked"}const Kx=v.forwardRef(({className:n,...l},o)=>f.jsx(Wf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:f.jsx(qx,{className:se("flex items-center justify-center text-current"),children:f.jsx(Os,{className:"h-3.5 w-3.5"})})}));Kx.displayName=Wf.displayName;const em=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));em.displayName="Input";const Iv=["queued","running"];function C_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function A_(n){return n==="claude"||n==="codex"||n==="copilot"}function Qx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return A_(l)?`${n.nodeId}:${l}`:null}function R_(n){return n.status==="succeeded"||n.status==="failed"}async function Zx(n,l={}){const o=l.getOperation??dE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!R_(m)&&Date.now()<d;)await j_(i),m=await o(n.id);return m}async function __(n,l=fE){const o=new Set(n),i=await Promise.all(Iv.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!Iv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Qx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function j_(n){return new Promise(l=>setTimeout(l,n))}const M_=1500,O_=1e3,D_=9e4;async function Ix(n={}){const l=n.fetchHealth??k_,o=n.initialDelayMs??M_,i=n.pollIntervalMs??O_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??L_,h=n.timeoutMs??D_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=z_(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 k_(){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 z_(n){return typeof n=="boolean"?{ok:n}:n}function L_(n){return new Promise(l=>window.setTimeout(l,n))}function U_(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 B_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=U_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>Fv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[R,_]=v.useState(!1),[z,q]=v.useState(!1);v.useEffect(()=>{E(Fv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function K(){if(!c||C||R)return;const ie=p.updateAvailable?"update":"restart",me=$_(T);if(T.port.trim()&&(me==null?void 0:me.port)===void 0){Je.error("Runtime restart port must be a positive integer");return}const fe=me?{reason:ie,startArgs:me}:{reason:ie};A(!0);try{if(i){const M=await _0(fe);N({...M,pid:M.pid??h,status:"accepted"}),Je.info(`Restarting ${d} from a detached helper. PID ${M.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${M.logPath} for launch output.`),Ix({previousPid:M.pid??h}).then(V=>{V||(A(!1),Je.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(V=>{A(!1),Je.error(V instanceof Error?V.message:"Runtime restart recovery failed")});return}const ue=await hE(c,fe);N({operationId:ue.id,pid:h,status:ue.status}),Je.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 de=await Zx(ue,{timeoutMs:6e4}),le=V_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(m==null?void 0:m()),Je.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?Je.error(de.error??`Restart failed on ${d}`):Je.info(`Restart operation ${Pd(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),Je.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function $(){if(!(!i||C||R)){_(!0);try{const ie=await cE();Je.info(`Stopping Meshy process ${ie.pid}`)}catch(ie){_(!1),Je.error(ie instanceof Error?ie.message:"Runtime stop failed")}}}const H=C?"restarting":R?"stopping":(w==null?void 0:w.status)??"idle",ae=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(Ms,{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:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(yt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),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(mf,{children:[f.jsx(hf,{asChild:!0,children:f.jsxs(wn,{type:"button",size:"sm",variant:"ghost",disabled:C||R,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(yN,{className:se("mr-1 h-3.5 w-3.5",R&&"animate-pulse")}),R?"Stopping":"Stop"]})}),f.jsxs(Ys,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(qs,{className:"space-y-1",children:[f.jsx(Ps,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Xs,{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(Gs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Ks,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void $(),children:"Stop runtime"})]})]})]}),f.jsxs(mf,{children:[f.jsx(hf,{asChild:!0,children:f.jsxs(wn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||R,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(wN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Ys,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(qs,{className:"space-y-1",children:[f.jsxs(Ps,{className:"text-sm",children:[g,"?"]}),f.jsxs(Xs,{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(H_,{value:T,onChange:E}),f.jsxs(Gs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Ks,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void K(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>q(ie=>!ie),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(B0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Js,{className:se("h-3 w-3 transition-transform duration-150",z&&"rotate-180")})]}),z&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(Cl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(Cl,{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(Cl,{label:"Operation",value:w!=null&&w.operationId?Pd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(Cl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(Cl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(Cl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(Cl,{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 H_({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(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Lo,{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(Ib,{value:l.transport,onValueChange:i=>o("transport",Fx(i)),children:[f.jsx(Zf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(Fb,{placeholder:"Transport"})}),f.jsxs(If,{children:[f.jsx(Cr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Lo,{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(Kx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:se("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(em,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function Cl({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:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function V_(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 Fv(n){return{port:Y_(n.endpoint),name:n.nodeName,join:"",transport:Fx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function $_(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 Fx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function Y_(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 Uo({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(yt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(yt,{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 Pt(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 q_(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 Jv(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 Tr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function G_(n){return n.available?f.jsxs(yt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):f.jsxs(yt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(JE,{className:"h-3 w-3"}),"Unavailable"]})}function P_(n){return n.update?n.update.updateAvailable?f.jsxs(yt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(yt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function X_(n){return n.available?null:n.metadataStatus??null}function K_(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 Q_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function et({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:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:se("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:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function Z_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=P_(n),m=!!o,h=X_(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(D0,{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:[G_(n),h&&f.jsx(yt,{variant:Tr(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(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Bo,{label:"Checked",value:Pt(n.checkedAt)}),n.update&&f.jsx(Bo,{label:"Update check",value:Pt(n.update.checkedAt)}),f.jsx(Bo,{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(yt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(mf,{children:[f.jsx(hf,{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(Ys,{children:[f.jsxs(qs,{children:[f.jsxs(Ps,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Xs,{children:["This runs ",K_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Gs,{children:[f.jsx(Qs,{children:"Cancel"}),f.jsx(Ks,{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 I_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function F_(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 J_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function W_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function e3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function t3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ae,ie,me,fe,ue,de,le,M,V,Z,ce,F,O,G,X,J,ee,oe,te,re;const d=v.useMemo(()=>I_(n,l),[n,l]),[m,h]=v.useState(()=>{var W;return i??(l==null?void 0:l.nodeId)??((W=n==null?void 0:n.self)==null?void 0:W.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(W=>W.id===m)??w,T=N?F_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,R=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},_=v.useMemo(()=>d.map(W=>W.id),[d]),z=_.join("\0"),q=C_(d),K=v.useMemo(()=>new Map(d.map(W=>[W.id,W.name])),[q]);v.useEffect(()=>{i&&_.includes(i)&&h(i)},[i,z]);const $=v.useCallback(async(W,xe)=>{const be=Qx(W);if(!be||x.current.has(W.id))return;const we=e3(W),$e=(xe==null?void 0:xe.agentLabel)??(we?W_(we):"Agent"),He=(xe==null?void 0:xe.nodeName)??K.get(W.nodeId)??W.nodeId;x.current.add(W.id),p(Ge=>new Map(Ge).set(be,W));try{const Ge=await Zx(W);if(Ge.status==="succeeded")await(c==null?void 0:c()),g.current.has(Ge.id)||(Je.success(`${$e} upgrade finished on ${He}`),g.current.add(Ge.id));else if(Ge.status==="failed")g.current.has(Ge.id)||(Je.error(Q_(Ge)??`${$e} upgrade failed`),g.current.add(Ge.id));else{p(ye=>new Map(ye).set(be,Ge)),Je.info(`${$e} upgrade is still ${Ge.status} on ${He}`);return}p(ye=>{const Ae=new Map(ye),Ve=Ae.get(be);return(!Ve||Ve.id===Ge.id)&&Ae.delete(be),Ae})}catch(Ge){p(ye=>{const Ae=new Map(ye),Ve=Ae.get(be);return(!Ve||Ve.id===W.id)&&Ae.delete(be),Ae}),Je.error(Ge instanceof Error?Ge.message:`${$e} upgrade failed`)}finally{x.current.delete(W.id)}},[c,K]);v.useEffect(()=>{if(_.length===0)return;let W=!1;async function xe(){let be;try{be=await __(_)}catch{return}if(!W){p(we=>{const $e=new Map(we);for(const[He,Ge]of be)$e.set(He,Ge);return $e});for(const we of be.values())$(we)}}return xe(),()=>{W=!0}},[$,z]);async function H(W){if(N)try{const xe=await mE(N.id,W.id);Je.info(`${W.label} upgrade started on ${N.name}`),await $(xe,{agentLabel:W.label,nodeName:N.name})}catch(xe){Je.error(xe instanceof Error?xe.message:`${W.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(yt,{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 ",Pt((ie=N.settingsSnapshot)==null?void 0:ie.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(g_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(v_,{role:N.role}),f.jsx(yt,{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(yt,{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(Ib,{value:N.id,onValueChange:h,children:[f.jsx(Zf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(Fb,{placeholder:"Choose a node"})}),f.jsx(If,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(W=>f.jsx(Cr,{value:W.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:J_(W,l==null?void 0:l.nodeId)},W.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(yt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(xN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(yt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",q_(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(t_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(bx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Rs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Rs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Rs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs($s,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(L0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Un,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(et,{label:"Status",value:N.status}),f.jsx(et,{label:"Role",value:N.role}),f.jsx(et,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Joined",value:Pt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Pt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(nN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Un,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((me=T.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((fe=T.os)==null?void 0:fe.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${Jv(T.os.freeMemoryBytes)} free / ${Jv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(B_,{checkedLabel:Pt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(M=T.runtime)==null?void 0:M.pid,transportType:N.transportType,update:A,workDir:((V=T.runtime)==null?void 0:V.workDir)??N.workDir})}),f.jsxs(kn,{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(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(D0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Un,{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(Bn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(W=>f.jsx(Z_,{agent:W,nodeName:N.name,activeOperation:y.get(`${N.id}:${W.id}`),onUpgrade:H},W.id))})]})]}),f.jsxs($s,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(YE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Un,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(et,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(et,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(et,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(MN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Un,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(Z=T.auth)!=null&&Z.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Un,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((O=T.runtime)==null?void 0:O.workDir)??T.workDir??"Unavailable",mono:!!(((G=T.runtime)==null?void 0:G.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((X=T.runtime)==null?void 0:X.storagePath)??"Unavailable",mono:!!((J=T.runtime)!=null&&J.storagePath)}),f.jsx(et,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),f.jsx(et,{label:"Started",value:Pt((te=T.runtime)==null?void 0:te.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Ms,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Un,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Bn,{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:Pt((re=T.startupRequirements)==null?void 0:re.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Uo,{formatDateTime:Pt,name:"Azure CLI",status:R.az,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"DevTunnel",status:R.devtunnel,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Claude Code",status:R.claude,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Codex",status:R.codex,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Copilot CLI",status:R.copilot,statusVariant:Tr})]})]})]})]}),f.jsx(S_,{formatDateTime:Pt,viewInfo:T})]})]})}function n3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=M0();return f.jsx(G5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(t3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const Jj="codex",Wj="bypass",a3=[{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"}],eM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],tM=new Set(a3.filter(n=>n.supportsFollowUp).map(n=>n.value)),nM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],aM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],l3=new Set(["pending","assigned"]),r3=new Set(["running"]),o3=new Set(["completed","failed","cancelled"]),lM=10;function rM(n,l){switch(l){case"running":return r3.has(n.status);case"waiting":return l3.has(n.status);case"closed":return o3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function oM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function iM(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 i3(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 sM(n,l,o){return i3(n,l,o).toLowerCase()}function cM(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 uM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function dM(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 fM(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function mM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function hM(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 pM(n){return new Date(n).toLocaleString()}function gM(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 s3(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),Je.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 Je.success(l),!0}catch(d){return Je.error(d instanceof Error?d.message:"Failed to copy"),!1}}const c3="default workspace";function _s(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function u3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function d3(n,l){const o=_s(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function f3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return _s(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return c3;if(u3(i)||!n.assignedTo)return _s(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?d3(c,i):_s(i)}function vM(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=f3(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 m3={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"},h3={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 p3(n){return n.split(".")[0]??"unknown"}function g3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Nr(n,l){return(l==null?void 0:l.get(n))??n}function Jx(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`${Nr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Nr(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 ${Nr(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 ${Nr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Nr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Nr(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 v3(n){return JSON.stringify(n,null,2)}function y3({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=p3(m.type);return f.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children: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:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:g3(m.timestamp)}),d?f.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",h3[h]),children:m.type}):f.jsx(yt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",m3[h]),children:m.type})]}),f.jsxs("div",{className:se("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(wn,{type:"button",variant:"ghost",size:"icon",className:se("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 s3(v3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(eN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(wn,{type:"button",variant:"ghost",size:"icon",className:se("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(H0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Jx(m,o)})]})},m.id)})})})}const b3=["node.","election.","transport."],x3="cluster.state";function S3(n){return n.type==="node.status"?!1:b3.some(l=>n.type.startsWith(l))}function w3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function E3(n,l){return n?{time:w3(n.timestamp),text:Jx(n,l)}:null}function N3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function T3(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 C3(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 A3(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 R3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function _3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,onDesktopUpdate:h,onRestart:y}){const[p,x]=v.useState(m),[g,w]=v.useState(!0),[N,T]=v.useState(new Set),[E,C]=v.useState(!1),[A,R]=v.useState(!1),_=v.useRef(null),z=v.useRef(null),q=v.useMemo(()=>l.filter(ye=>S3(ye)&&!N.has(ye.id)),[l,N]),K=v.useMemo(()=>l.find(ye=>ye.type===x3)??q[0],[l,q]),$=v.useMemo(()=>E3(K,c),[K,c]),H=v.useMemo(()=>{const ye=new Map(o.map(Ae=>[Ae.id,Ae]));return i&&ye.set(i.id,i),Array.from(ye.values())},[i,o]),ae=v.useMemo(()=>H.filter(N3),[H]),ie=ae.some(ye=>{var Ae;return ye.status==="offline"||((Ae=ye.devtunnelHealth)==null?void 0:Ae.status)==="failed"}),me=H.some(ye=>ye.status==="offline"),fe=H.some(ye=>ye.status==="busy"),ue=H.length>0,de=(i==null?void 0:i.name)??"offline",le=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",M=d!==null,V=!!(M&&(d!=null&&d.updateAvailable)&&d.latestVersion),Z=(d==null?void 0:d.latestVersion)??null,ce=!!(M&&!V&&!Z&&(d!=null&&d.detail)),F=E?"Relaunching runtime...":"Relaunch to apply update",O=A?"Installing desktop update...":V&&Z?`Desktop update ${Z} available`:ce?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",G=M?"Update":"Relaunch",X=M?O:F,J=M?A:E,ee=M?J||!V||!h:J,oe=M||!!y,te=M?V&&Z?`Install desktop update ${Z}`:ce?"Desktop update unavailable":"Desktop is current":E?"Relaunching runtime":"Relaunch runtime";function re(){z.current&&(clearTimeout(z.current),z.current=null)}function W(){re(),x(!0)}function xe(){re(),z.current=setTimeout(()=>{x(!1),z.current=null},180)}function be(){re()}function we(){re(),x(!1)}async function $e(){if(!(!y||E)){C(!0);try{await y()}finally{C(!1)}}}async function He(){if(!(!V||!h||A)){R(!0);try{await h()}finally{R(!1)}}}async function Ge(){if(M){await He();return}await $e()}return v.useEffect(()=>()=>{re()},[]),v.useEffect(()=>{T(ye=>{if(ye.size===0)return ye;const Ae=new Set(l.map(Pe=>Pe.id)),Ve=new Set(Array.from(ye).filter(Pe=>Ae.has(Pe)));return Ve.size===ye.size?ye:Ve})},[l]),v.useEffect(()=>{if(!p)return;const ye=Ve=>{var Pe;(Pe=_.current)!=null&&Pe.contains(Ve.target)||(re(),x(!1))},Ae=Ve=>{Ve.key==="Escape"&&(re(),x(!1))};return document.addEventListener("pointerdown",ye),document.addEventListener("keydown",Ae),()=>{document.removeEventListener("pointerdown",ye),document.removeEventListener("keydown",Ae)}},[p]),f.jsxs("div",{ref:_,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":p,"aria-haspopup":"dialog",onClick:()=>x(ye=>!ye),onMouseEnter:W,onMouseLeave:xe,className:se("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",p&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:se("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:se("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:de}),f.jsx("span",{className:se("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:le})]})]}),p&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:be,onMouseLeave:we,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(Ms,{className:"h-3 w-3 text-emerald-500"}):f.jsx(UN,{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:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),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:q.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"}),$?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:$.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:$.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:[me?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):fe?f.jsx(Ms,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:se("h-3 w-3 shrink-0",ue?"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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",me?"border-destructive/30 bg-destructive/10 text-destructive":fe?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":ue?"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:A3(H)})]}),H.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:H.map(ye=>{const{label:Ae,status:Ve}=R3(ye,c),Pe=Ve==="offline",pn=Ve==="busy";return f.jsxs("div",{"aria-label":`${Ae} ${Ve}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Pe?"bg-destructive/6":pn?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Ae} ${Ve}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Ae}),Pe?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):pn?f.jsx(hv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},ye.id)})})]}),ae.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:[ie?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Ho,{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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",ie?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:T3(ae)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ae.map(ye=>{var bt;const{label:Ae,status:Ve}=C3(ye,c),Pe=Ve==="failed"||Ve==="offline",pn=Ve!=="healthy"&&Ve!=="failed"&&Ve!=="offline",tl=(bt=ye.devtunnelHealth)!=null&&bt.reason?`${Ae} ${Ve}: ${ye.devtunnelHealth.reason}`:`${Ae} ${Ve}`;return f.jsxs("div",{"aria-label":`${Ae} ${Ve}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Pe?"bg-destructive/6":pn?"bg-muted/30":"bg-emerald-500/5"),title:tl,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Ae}),Pe?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):pn?f.jsx(hv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},ye.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>w(ye=>!ye),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 ",q.length>0&&`(${q.length})`]}),g?f.jsx(Js,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Jd,{className:"h-3 w-3 text-muted-foreground"})]}),g&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(y3,{events:q,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:ye=>T(Ae=>new Set(Ae).add(ye))})})]}),M&&(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:oe&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs(wn,{type:"button",variant:"ghost",size:"sm",className:se("h-5 rounded-sm border border-border/50 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",V?"bg-primary/12 text-primary hover:border-primary/35 hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:border-emerald-500/25 hover:bg-emerald-500/10"),onClick:()=>void Ge(),disabled:ee,"aria-label":te,"aria-describedby":"live-link-restart-hint",title:X,children:[f.jsx(NN,{className:se("h-2.5 w-2.5",J&&"animate-pulse")}),f.jsx("span",{children:G})]}),f.jsxs("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:[X,V&&(d!=null&&d.assetName)?` · ${d.assetName}`:""]})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(wn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>T(new Set(l.map(ye=>ye.id))),disabled:q.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(wn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(!1),children:"Close"})]})]})]})]})}const Or="fluent",j3="clean",Xd="meshy-layout-default-migrated-to-compact",pf="true",M3="compact",O3=new Set(["airy","clean","fluent"]);function D3(n){return n!==null&&O3.has(n)}function tm(n){return n===M3?"fluent":D3(n)?n:null}function k3(n,l){const o=tm(n);return o===j3&&l!==pf?Or:o??Or}const $o="finsight",Wx="default",z3=new Set(["light","dark","system"]),L3=new Set(["porcelain","warm","finsight","edge"]),e1=v.createContext(null);function U3(n){const l=new URLSearchParams(n).get("theme");return t1(l)?l:null}function B3(n){const l=new URLSearchParams(n).get("palette");return nm(l)}function H3(n){const l=new URLSearchParams(n).get("layout");return tm(l)}function V3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:nm(n.getAttribute("data-palette"))??$o,layout:tm(n.getAttribute("data-layout"))??Or}}function yM(n,l=V3()){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 $3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?U3(window.location.search)??G3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,c]=v.useState(()=>typeof window<"u"?B3(window.location.search)??P3(localStorage.getItem("meshy-palette"))??$o:$o),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=H3(window.location.search);if(h)return localStorage.setItem(Xd,pf),h;const y=k3(localStorage.getItem("meshy-layout"),localStorage.getItem(Xd));return localStorage.setItem(Xd,pf),y}return Or});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===$o?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===Or?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(e1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function Y3(){const n=v.useContext(e1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function t1(n){return n!==null&&z3.has(n)}function q3(n){return n!==null&&L3.has(n)}function G3(n){return t1(n)?n:null}function nm(n){return n===Wx?"porcelain":q3(n)?n:null}function P3(n){return n===Wx?null:nm(n)}const X3=[{value:"light",label:"Light",icon:U0},{value:"dark",label:"Dark",icon:z0},{value:"system",label:"System",icon:k0}],n1=[{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"}],a1=[{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 K3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=Y3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?z0:n==="light"?U0:k0,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(wn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("h-8 w-8 rounded-sm",o!==$o||c!==Or?"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:[Q3(c)," / ",Z3(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:X3.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:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[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:a1.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:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10":"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:se("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(Os,{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(DN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:n1.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:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(I3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:se("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(Os,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function Q3(n){var l;return((l=a1.find(o=>o.value===n))==null?void 0:l.label)??n}function Z3(n){var l;return((l=n1.find(o=>o.value===n))==null?void 0:l.label)??n}function I3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:se("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 Yo={tasks:{defaultSize:24,min:16,max:36,wheelStep:1},operations:{defaultSize:26,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},l1="meshy-dashboard-panel-state-v1",r1="meshy-dashboard-terminal-open-v1";function bM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Yo.tasks.defaultSize,operations:Yo.operations.defaultSize,terminal:Yo.terminal.defaultSize}}}function Kd(n){return typeof n=="object"&&n!==null}function Wv(n,l){return typeof n=="boolean"?n:l}function Qd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?qo(n,l):o}function qo(n,l){const o=Yo[n];return Math.min(o.max,Math.max(o.min,l))}function xM(n,l){if(!n)return l;try{const o=n.getItem(l1);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:Wv(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:Wv(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 SM(n,l){if(n)try{n.setItem(l1,JSON.stringify(l))}catch{}}function F3(n,l){if(!n)return l;try{const o=n.getItem(r1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function J3(n,l){if(n)try{n.setItem(r1,String(l))}catch{}}function e0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function wM(n){return`${Number(n.toFixed(2))}rem`}function EM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?qo(n,l+(c-o)/h):n==="operations"?qo(n,l+(o-c)/h):qo(n,l+(i-d)/h)}function NM(n,l,o){const i=o===0?0:o>0?-1:1;return qo(n,l+i*Yo[n].wheelStep)}function t0(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function n0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function a0(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 W3(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=M0(),c=qn(),[d,m]=v.useState(()=>F3(e0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),T=v.useMemo(()=>{const R=new Map;for(const _ of(n==null?void 0:n.nodes)??[])R.set(_.id,_.name);return n!=null&&n.self&&R.set(n.self.id,n.self.name),R},[n==null?void 0:n.nodes,n==null?void 0:n.self]),E=v.useCallback(R=>{m(_=>typeof R=="function"?R(_):R)},[]);v.useEffect(()=>{J3(e0(),d)},[d]),v.useEffect(()=>{const R=t0();if(!R){w(null);return}let _=!1;return w(n0("Checking desktop update...")),R("check_desktop_update").then(z=>{_||w(z)}).catch(z=>{_||w(n0(a0(z,"Desktop update check failed")))}),()=>{_=!0}},[i==null?void 0:i.version]);async function C(){try{const R=await _0({reason:"restart"});Je.info(`Restarting runtime. Follow ${R.logPath} for launch output.`),await Ix({previousPid:R.pid})||Je.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(R){Je.error(R instanceof Error?R.message:"Runtime restart failed")}}async function A(){const R=t0();if(!R){Je.error("Desktop updater is not available in this window");return}try{const _=await R("install_desktop_update");_.openedRelease?Je.info("Opened the latest Meshy release page."):_.installMethod==="tauri-updater"?Je.info(`Installing ${_.assetName??"desktop update"}. Meshy will relaunch to finish updating.`):Je.info(`Downloaded ${_.assetName??"desktop update"}${_.downloadPath?` to ${_.downloadPath}`:""}. Follow the installer to finish updating.`)}catch(_){Je.error(a0(_,"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:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] items-center gap-0 rounded-lg px-3 py-2",children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Fd,{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(gN,{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"}),N&&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(L0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(Jd,{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(sN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(Jd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Fd,{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(CN,{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(em,{"aria-label":"Search tasks",value:h,onChange:R=>y(R.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:[N&&f.jsx(wn,{variant:"ghost",size:"icon",onClick:()=>E(R=>!R),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:se("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(B0,{className:"h-4 w-4"})}),f.jsx(n3,{}),f.jsx(K3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(_3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:T,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?A:void 0,onRestart:C})]})]})}),f.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",N?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:f.jsx(Tw,{context:{terminalOpen:d,setTerminalOpen:E,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const l0=v.lazy(async()=>({default:(await i0(()=>import("./DashboardPage-sar7hm_X.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),ej=v.lazy(async()=>({default:(await i0(()=>import("./SharedConversationPage-zis7MeLt.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function tj(){return f.jsx(Fw,{children:f.jsx(v.Suspense,{fallback:f.jsx(nj,{}),children:f.jsxs(Aw,{children:[f.jsx(Al,{path:"/shared/tasks/:shareId",element:f.jsx(ej,{})}),f.jsxs(Al,{element:f.jsx(jE,{children:f.jsx(W3,{})}),children:[f.jsx(Al,{path:"/",element:f.jsx(l0,{})}),f.jsx(Al,{path:"/nodes",element:f.jsx(dv,{to:"/",replace:!0})}),f.jsx(Al,{path:"/tasks",element:f.jsx(dv,{to:"/",replace:!0})}),f.jsx(Al,{path:"/tasks/:id",element:f.jsx(l0,{})})]})]})})})}function nj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function aj(n){return f.jsx(eC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}C2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs($3,{children:[f.jsx(tj,{}),f.jsx(aj,{})]})}));export{Xs as $,Hy as A,wn as B,Os as C,Wj as D,$y as E,oN as F,yM as G,eN as H,em as I,s3 as J,i3 as K,D0 as L,t_ as M,yt as N,Ij as O,Fj as P,bx as Q,Rs as R,L0 as S,eM as T,pM as U,$s as V,mf as W,H0 as X,Ys as Y,qs as Z,Ps as _,rC as a,dM as a$,Gs as a0,Qs as a1,Ks as a2,i0 as a3,sj as a4,Vy as a5,q5 as a6,Sj as a7,B0 as a8,Ho as a9,bM as aA,e0 as aB,SM as aC,NM as aD,wM as aE,EM as aF,Ej as aG,EE as aH,vE as aI,Qj as aJ,Kj as aK,CE as aL,Mj as aM,fj as aN,uj as aO,Yy as aP,dj as aQ,mj as aR,fE as aS,n3 as aT,Oj as aU,Dj as aV,rj as aW,qn as aX,y0 as aY,lj as aZ,M0 as a_,JE as aa,xj as ab,wj as ac,bj as ad,_N as ae,fN as af,uM as ag,xN as ah,y3 as ai,g_ as aj,lN as ak,v_ as al,gM as am,l3 as an,vM as ao,nM as ap,aM as aq,Kx as ar,mM as as,fM as at,hM as au,hf as av,lM as aw,kj as ax,zj as ay,xM as az,se as b,cM as b0,rM as b1,oM as b2,sM as b3,iM as b4,Nj as b5,tM as b6,r3 as b7,_j as b8,jj as b9,Rj as ba,Aj as bb,ij as bc,cj as bd,oj as be,hj as bf,Vj as bg,Hj as bh,Bj as bi,Lj as bj,Uj as bk,$j as bl,a3 as bm,r0 as bn,KE as bo,Gj as bp,qj as bq,Yj as br,wN as bs,Pj as bt,Zj as bu,Xj as bv,Ue as c,ny as d,yj as e,dE as f,gj as g,pj as h,sN as i,f as j,Jd as k,Cr as l,vj as m,Cj as n,Ib as o,Zf as p,Fb as q,v as r,If as s,Je as t,CN as u,Js as v,DN as w,Jj as x,Tj as y,V5 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},d_=Sx,f_=wx,m_=Ex,Dx=Nx,kx=Tx,zx=jx,Lx=Ox,Ux=Ax,Bx=_x;const mf=d_,hf=f_,h_=m_,Hx=v.forwardRef(({className:n,...l},o)=>f.jsx(Dx,{className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Hx.displayName=Dx.displayName;const Ys=v.forwardRef(({className:n,...l},o)=>f.jsxs(h_,{children:[f.jsx(Hx,{}),f.jsx(kx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Ys.displayName=kx.displayName;const qs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});qs.displayName="AlertDialogHeader";const Gs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Gs.displayName="AlertDialogFooter";const Ps=v.forwardRef(({className:n,...l},o)=>f.jsx(Ux,{ref:o,className:se("text-lg font-semibold",n),...l}));Ps.displayName=Ux.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));Xs.displayName=Bx.displayName;const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx(zx,{ref:o,className:se(Af(),n),...l}));Ks.displayName=zx.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{ref:o,className:se(Af({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Qs.displayName=Lx.displayName;const p_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function g_({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:se("relative inline-flex h-2.5 w-2.5 rounded-full",p_[n])})]})}function v_({role:n,size:l="default"}){return f.jsx(yt,{variant:n==="leader"?"default":"secondary",className:se(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const y_={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 Ij({status:n,size:l="default"}){const o=y_[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(yt,{variant:o.variant,className:se("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:se("rounded-full",o.dotClass)}),n]})}const b_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function Fj({priority:n}){const l=b_[n];return f.jsx(yt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function x_(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 Er({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 S_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=x_(l.packages);return f.jsxs($s,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(HE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Un,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Bn,{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(lN,{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(Er,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Er,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Er,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Er,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Er,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Er,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Un,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Bn,{"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(yt,{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 uc="Checkbox",[w_]=Ja(uc),[E_,Jf]=w_(uc);function N_(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]=jr({prop:o,defaultProp:c??!1,onChange:y,caller:uc}),[T,E]=v.useState(null),[C,A]=v.useState(null),R=v.useRef(!1),_=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:R,required:p,defaultChecked:Ka(c)?!1:c,isFormControl:_,bubbleInput:C,setBubbleInput:A};return f.jsx(E_,{scope:l,...z,children:T_(g)?g(z):i})}var Vx="CheckboxTrigger",$x=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}=Jf(Vx,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const R=()=>g(C.current);return A.addEventListener("reset",R),()=>A.removeEventListener("reset",R)}},[d,g]),f.jsx(Be.button,{type:"button",role:"checkbox","aria-checked":Ka(y)?"mixed":y,"aria-required":p,"data-state":Xx(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(R=>Ka(R)?!0:!R),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});$x.displayName=Vx;var Wf=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(N_,{__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($x,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Px,{__scopeCheckbox:o})]})})});Wf.displayName=uc;var Yx="CheckboxIndicator",qx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=Jf(Yx,o);return f.jsx(Lr,{present:i||Ka(d.checked)||d.checked===!0,children:f.jsx(Be.span,{"data-state":Xx(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});qx.displayName=Yx;var Gx="CheckboxBubbleInput",Px=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}=Jf(Gx,n),T=tt(o,N),E=mb(d),C=nb(i);v.useEffect(()=>{const R=w;if(!R)return;const _=window.HTMLInputElement.prototype,q=Object.getOwnPropertyDescriptor(_,"checked").set,K=!c.current;if(E!==d&&q){const $=new Event("click",{bubbles:K});R.indeterminate=Ka(d),q.call(R,Ka(d)?!1:d),R.dispatchEvent($)}},[w,E,d,c]);const A=v.useRef(Ka(d)?!1:d);return f.jsx(Be.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%)"}})});Px.displayName=Gx;function T_(n){return typeof n=="function"}function Ka(n){return n==="indeterminate"}function Xx(n){return Ka(n)?"indeterminate":n?"checked":"unchecked"}const Kx=v.forwardRef(({className:n,...l},o)=>f.jsx(Wf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:f.jsx(qx,{className:se("flex items-center justify-center text-current"),children:f.jsx(Os,{className:"h-3.5 w-3.5"})})}));Kx.displayName=Wf.displayName;const em=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));em.displayName="Input";const Iv=["queued","running"];function C_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function A_(n){return n==="claude"||n==="codex"||n==="copilot"}function Qx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return A_(l)?`${n.nodeId}:${l}`:null}function R_(n){return n.status==="succeeded"||n.status==="failed"}async function Zx(n,l={}){const o=l.getOperation??dE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!R_(m)&&Date.now()<d;)await j_(i),m=await o(n.id);return m}async function __(n,l=fE){const o=new Set(n),i=await Promise.all(Iv.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!Iv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Qx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function j_(n){return new Promise(l=>setTimeout(l,n))}const M_=1500,O_=1e3,D_=9e4;async function Ix(n={}){const l=n.fetchHealth??k_,o=n.initialDelayMs??M_,i=n.pollIntervalMs??O_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??L_,h=n.timeoutMs??D_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=z_(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 k_(){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 z_(n){return typeof n=="boolean"?{ok:n}:n}function L_(n){return new Promise(l=>window.setTimeout(l,n))}function U_(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 B_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=U_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>Fv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[R,_]=v.useState(!1),[z,q]=v.useState(!1);v.useEffect(()=>{E(Fv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function K(){if(!c||C||R)return;const ie=p.updateAvailable?"update":"restart",me=$_(T);if(T.port.trim()&&(me==null?void 0:me.port)===void 0){Je.error("Runtime restart port must be a positive integer");return}const fe=me?{reason:ie,startArgs:me}:{reason:ie};A(!0);try{if(i){const M=await _0(fe);N({...M,pid:M.pid??h,status:"accepted"}),Je.info(`Restarting ${d} from a detached helper. PID ${M.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${M.logPath} for launch output.`),Ix({previousPid:M.pid??h}).then(V=>{V||(A(!1),Je.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(V=>{A(!1),Je.error(V instanceof Error?V.message:"Runtime restart recovery failed")});return}const ue=await hE(c,fe);N({operationId:ue.id,pid:h,status:ue.status}),Je.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 de=await Zx(ue,{timeoutMs:6e4}),le=V_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(m==null?void 0:m()),Je.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?Je.error(de.error??`Restart failed on ${d}`):Je.info(`Restart operation ${Pd(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),Je.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function $(){if(!(!i||C||R)){_(!0);try{const ie=await cE();Je.info(`Stopping Meshy process ${ie.pid}`)}catch(ie){_(!1),Je.error(ie instanceof Error?ie.message:"Runtime stop failed")}}}const H=C?"restarting":R?"stopping":(w==null?void 0:w.status)??"idle",ae=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(Ms,{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:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(yt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),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(mf,{children:[f.jsx(hf,{asChild:!0,children:f.jsxs(wn,{type:"button",size:"sm",variant:"ghost",disabled:C||R,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(yN,{className:se("mr-1 h-3.5 w-3.5",R&&"animate-pulse")}),R?"Stopping":"Stop"]})}),f.jsxs(Ys,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(qs,{className:"space-y-1",children:[f.jsx(Ps,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Xs,{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(Gs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Ks,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void $(),children:"Stop runtime"})]})]})]}),f.jsxs(mf,{children:[f.jsx(hf,{asChild:!0,children:f.jsxs(wn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||R,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(wN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Ys,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(qs,{className:"space-y-1",children:[f.jsxs(Ps,{className:"text-sm",children:[g,"?"]}),f.jsxs(Xs,{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(H_,{value:T,onChange:E}),f.jsxs(Gs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Qs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Ks,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void K(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>q(ie=>!ie),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(B0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Js,{className:se("h-3 w-3 transition-transform duration-150",z&&"rotate-180")})]}),z&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(Cl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(Cl,{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(Cl,{label:"Operation",value:w!=null&&w.operationId?Pd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(Cl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(Cl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(Cl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(Cl,{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 H_({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(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Lo,{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(Ib,{value:l.transport,onValueChange:i=>o("transport",Fx(i)),children:[f.jsx(Zf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(Fb,{placeholder:"Transport"})}),f.jsxs(If,{children:[f.jsx(Cr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Cr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Lo,{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(Kx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:se("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(em,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function Cl({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:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function V_(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 Fv(n){return{port:Y_(n.endpoint),name:n.nodeName,join:"",transport:Fx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function $_(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 Fx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function Y_(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 Uo({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(yt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(yt,{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 Pt(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 q_(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 Jv(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 Tr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function G_(n){return n.available?f.jsxs(yt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):f.jsxs(yt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(JE,{className:"h-3 w-3"}),"Unavailable"]})}function P_(n){return n.update?n.update.updateAvailable?f.jsxs(yt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(yt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function X_(n){return n.available?null:n.metadataStatus??null}function K_(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 Q_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function et({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:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:se("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:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function Z_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=P_(n),m=!!o,h=X_(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(D0,{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:[G_(n),h&&f.jsx(yt,{variant:Tr(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(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Bo,{label:"Checked",value:Pt(n.checkedAt)}),n.update&&f.jsx(Bo,{label:"Update check",value:Pt(n.update.checkedAt)}),f.jsx(Bo,{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(yt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(mf,{children:[f.jsx(hf,{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(Ys,{children:[f.jsxs(qs,{children:[f.jsxs(Ps,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Xs,{children:["This runs ",K_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Gs,{children:[f.jsx(Qs,{children:"Cancel"}),f.jsx(Ks,{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 I_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function F_(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 J_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function W_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function e3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function t3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ae,ie,me,fe,ue,de,le,M,V,Z,ce,F,O,G,X,J,ee,oe,te,re;const d=v.useMemo(()=>I_(n,l),[n,l]),[m,h]=v.useState(()=>{var W;return i??(l==null?void 0:l.nodeId)??((W=n==null?void 0:n.self)==null?void 0:W.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(W=>W.id===m)??w,T=N?F_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,R=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},_=v.useMemo(()=>d.map(W=>W.id),[d]),z=_.join("\0"),q=C_(d),K=v.useMemo(()=>new Map(d.map(W=>[W.id,W.name])),[q]);v.useEffect(()=>{i&&_.includes(i)&&h(i)},[i,z]);const $=v.useCallback(async(W,xe)=>{const be=Qx(W);if(!be||x.current.has(W.id))return;const we=e3(W),$e=(xe==null?void 0:xe.agentLabel)??(we?W_(we):"Agent"),He=(xe==null?void 0:xe.nodeName)??K.get(W.nodeId)??W.nodeId;x.current.add(W.id),p(Ge=>new Map(Ge).set(be,W));try{const Ge=await Zx(W);if(Ge.status==="succeeded")await(c==null?void 0:c()),g.current.has(Ge.id)||(Je.success(`${$e} upgrade finished on ${He}`),g.current.add(Ge.id));else if(Ge.status==="failed")g.current.has(Ge.id)||(Je.error(Q_(Ge)??`${$e} upgrade failed`),g.current.add(Ge.id));else{p(ye=>new Map(ye).set(be,Ge)),Je.info(`${$e} upgrade is still ${Ge.status} on ${He}`);return}p(ye=>{const Ae=new Map(ye),Ve=Ae.get(be);return(!Ve||Ve.id===Ge.id)&&Ae.delete(be),Ae})}catch(Ge){p(ye=>{const Ae=new Map(ye),Ve=Ae.get(be);return(!Ve||Ve.id===W.id)&&Ae.delete(be),Ae}),Je.error(Ge instanceof Error?Ge.message:`${$e} upgrade failed`)}finally{x.current.delete(W.id)}},[c,K]);v.useEffect(()=>{if(_.length===0)return;let W=!1;async function xe(){let be;try{be=await __(_)}catch{return}if(!W){p(we=>{const $e=new Map(we);for(const[He,Ge]of be)$e.set(He,Ge);return $e});for(const we of be.values())$(we)}}return xe(),()=>{W=!0}},[$,z]);async function H(W){if(N)try{const xe=await mE(N.id,W.id);Je.info(`${W.label} upgrade started on ${N.name}`),await $(xe,{agentLabel:W.label,nodeName:N.name})}catch(xe){Je.error(xe instanceof Error?xe.message:`${W.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(yt,{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 ",Pt((ie=N.settingsSnapshot)==null?void 0:ie.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(g_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(v_,{role:N.role}),f.jsx(yt,{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(yt,{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(Ib,{value:N.id,onValueChange:h,children:[f.jsx(Zf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(Fb,{placeholder:"Choose a node"})}),f.jsx(If,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(W=>f.jsx(Cr,{value:W.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:J_(W,l==null?void 0:l.nodeId)},W.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(yt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(xN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(yt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",q_(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(t_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(bx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Rs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Rs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Rs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs($s,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(L0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Un,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(et,{label:"Status",value:N.status}),f.jsx(et,{label:"Role",value:N.role}),f.jsx(et,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Joined",value:Pt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Pt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(nN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Un,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((me=T.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((fe=T.os)==null?void 0:fe.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${Jv(T.os.freeMemoryBytes)} free / ${Jv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(B_,{checkedLabel:Pt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(M=T.runtime)==null?void 0:M.pid,transportType:N.transportType,update:A,workDir:((V=T.runtime)==null?void 0:V.workDir)??N.workDir})}),f.jsxs(kn,{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(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(D0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Un,{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(Bn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(W=>f.jsx(Z_,{agent:W,nodeName:N.name,activeOperation:y.get(`${N.id}:${W.id}`),onUpgrade:H},W.id))})]})]}),f.jsxs($s,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(YE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Un,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(et,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(et,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(et,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(MN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Un,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(Z=T.auth)!=null&&Z.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Un,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Bn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((O=T.runtime)==null?void 0:O.workDir)??T.workDir??"Unavailable",mono:!!(((G=T.runtime)==null?void 0:G.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((X=T.runtime)==null?void 0:X.storagePath)??"Unavailable",mono:!!((J=T.runtime)!=null&&J.storagePath)}),f.jsx(et,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),f.jsx(et,{label:"Started",value:Pt((te=T.runtime)==null?void 0:te.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(kn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(zn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Ln,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Ms,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Un,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Bn,{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:Pt((re=T.startupRequirements)==null?void 0:re.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Uo,{formatDateTime:Pt,name:"Azure CLI",status:R.az,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"DevTunnel",status:R.devtunnel,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Claude Code",status:R.claude,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Codex",status:R.codex,statusVariant:Tr}),f.jsx(Uo,{formatDateTime:Pt,name:"Copilot CLI",status:R.copilot,statusVariant:Tr})]})]})]})]}),f.jsx(S_,{formatDateTime:Pt,viewInfo:T})]})]})}function n3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=M0();return f.jsx(G5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(t3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const Jj="codex",Wj="bypass",a3=[{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"}],eM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],tM=new Set(a3.filter(n=>n.supportsFollowUp).map(n=>n.value)),nM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],aM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],l3=new Set(["pending","assigned"]),r3=new Set(["running"]),o3=new Set(["completed","failed","cancelled"]),lM=10;function rM(n,l){switch(l){case"running":return r3.has(n.status);case"waiting":return l3.has(n.status);case"closed":return o3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function oM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function iM(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 i3(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 sM(n,l,o){return i3(n,l,o).toLowerCase()}function cM(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 uM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function dM(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 fM(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function mM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function hM(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 pM(n){return new Date(n).toLocaleString()}function gM(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 s3(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),Je.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 Je.success(l),!0}catch(d){return Je.error(d instanceof Error?d.message:"Failed to copy"),!1}}const c3="default workspace";function _s(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function u3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function d3(n,l){const o=_s(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function f3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return _s(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return c3;if(u3(i)||!n.assignedTo)return _s(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?d3(c,i):_s(i)}function vM(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=f3(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 m3={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"},h3={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 p3(n){return n.split(".")[0]??"unknown"}function g3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Nr(n,l){return(l==null?void 0:l.get(n))??n}function Jx(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`${Nr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Nr(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 ${Nr(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 ${Nr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Nr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Nr(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 v3(n){return JSON.stringify(n,null,2)}function y3({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=p3(m.type);return f.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children: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:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:g3(m.timestamp)}),d?f.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",h3[h]),children:m.type}):f.jsx(yt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",m3[h]),children:m.type})]}),f.jsxs("div",{className:se("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(wn,{type:"button",variant:"ghost",size:"icon",className:se("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 s3(v3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(eN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(wn,{type:"button",variant:"ghost",size:"icon",className:se("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(H0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Jx(m,o)})]})},m.id)})})})}const b3=["node.","election.","transport."],x3="cluster.state";function S3(n){return n.type==="node.status"?!1:b3.some(l=>n.type.startsWith(l))}function w3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function E3(n,l){return n?{time:w3(n.timestamp),text:Jx(n,l)}:null}function N3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function T3(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 C3(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 A3(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 R3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function _3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,onDesktopUpdate:h,onRestart:y}){const[p,x]=v.useState(m),[g,w]=v.useState(!0),[N,T]=v.useState(new Set),[E,C]=v.useState(!1),[A,R]=v.useState(!1),_=v.useRef(null),z=v.useRef(null),q=v.useMemo(()=>l.filter(ye=>S3(ye)&&!N.has(ye.id)),[l,N]),K=v.useMemo(()=>l.find(ye=>ye.type===x3)??q[0],[l,q]),$=v.useMemo(()=>E3(K,c),[K,c]),H=v.useMemo(()=>{const ye=new Map(o.map(Ae=>[Ae.id,Ae]));return i&&ye.set(i.id,i),Array.from(ye.values())},[i,o]),ae=v.useMemo(()=>H.filter(N3),[H]),ie=ae.some(ye=>{var Ae;return ye.status==="offline"||((Ae=ye.devtunnelHealth)==null?void 0:Ae.status)==="failed"}),me=H.some(ye=>ye.status==="offline"),fe=H.some(ye=>ye.status==="busy"),ue=H.length>0,de=(i==null?void 0:i.name)??"offline",le=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",M=d!==null,V=!!(M&&(d!=null&&d.updateAvailable)&&d.latestVersion),Z=(d==null?void 0:d.latestVersion)??null,ce=!!(M&&!V&&!Z&&(d!=null&&d.detail)),F=E?"Relaunching runtime...":"Relaunch to apply update",O=A?"Installing desktop update...":V&&Z?`Desktop update ${Z} available`:ce?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",G=M?"Update":"Relaunch",X=M?O:F,J=M?A:E,ee=M?J||!V||!h:J,oe=M||!!y,te=M?V&&Z?`Install desktop update ${Z}`:ce?"Desktop update unavailable":"Desktop is current":E?"Relaunching runtime":"Relaunch runtime";function re(){z.current&&(clearTimeout(z.current),z.current=null)}function W(){re(),x(!0)}function xe(){re(),z.current=setTimeout(()=>{x(!1),z.current=null},180)}function be(){re()}function we(){re(),x(!1)}async function $e(){if(!(!y||E)){C(!0);try{await y()}finally{C(!1)}}}async function He(){if(!(!V||!h||A)){R(!0);try{await h()}finally{R(!1)}}}async function Ge(){if(M){await He();return}await $e()}return v.useEffect(()=>()=>{re()},[]),v.useEffect(()=>{T(ye=>{if(ye.size===0)return ye;const Ae=new Set(l.map(Pe=>Pe.id)),Ve=new Set(Array.from(ye).filter(Pe=>Ae.has(Pe)));return Ve.size===ye.size?ye:Ve})},[l]),v.useEffect(()=>{if(!p)return;const ye=Ve=>{var Pe;(Pe=_.current)!=null&&Pe.contains(Ve.target)||(re(),x(!1))},Ae=Ve=>{Ve.key==="Escape"&&(re(),x(!1))};return document.addEventListener("pointerdown",ye),document.addEventListener("keydown",Ae),()=>{document.removeEventListener("pointerdown",ye),document.removeEventListener("keydown",Ae)}},[p]),f.jsxs("div",{ref:_,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":p,"aria-haspopup":"dialog",onClick:()=>x(ye=>!ye),onMouseEnter:W,onMouseLeave:xe,className:se("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",p&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:se("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:se("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:de}),f.jsx("span",{className:se("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:le})]})]}),p&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:be,onMouseLeave:we,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(Ms,{className:"h-3 w-3 text-emerald-500"}):f.jsx(UN,{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:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),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:q.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"}),$?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:$.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:$.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:[me?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):fe?f.jsx(Ms,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:se("h-3 w-3 shrink-0",ue?"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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",me?"border-destructive/30 bg-destructive/10 text-destructive":fe?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":ue?"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:A3(H)})]}),H.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:H.map(ye=>{const{label:Ae,status:Ve}=R3(ye,c),Pe=Ve==="offline",pn=Ve==="busy";return f.jsxs("div",{"aria-label":`${Ae} ${Ve}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Pe?"bg-destructive/6":pn?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Ae} ${Ve}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Ae}),Pe?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):pn?f.jsx(hv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},ye.id)})})]}),ae.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:[ie?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Ho,{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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",ie?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:T3(ae)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ae.map(ye=>{var bt;const{label:Ae,status:Ve}=C3(ye,c),Pe=Ve==="failed"||Ve==="offline",pn=Ve!=="healthy"&&Ve!=="failed"&&Ve!=="offline",tl=(bt=ye.devtunnelHealth)!=null&&bt.reason?`${Ae} ${Ve}: ${ye.devtunnelHealth.reason}`:`${Ae} ${Ve}`;return f.jsxs("div",{"aria-label":`${Ae} ${Ve}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Pe?"bg-destructive/6":pn?"bg-muted/30":"bg-emerald-500/5"),title:tl,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Ae}),Pe?f.jsx(ms,{className:"h-3 w-3 shrink-0 text-destructive"}):pn?f.jsx(hv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},ye.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>w(ye=>!ye),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 ",q.length>0&&`(${q.length})`]}),g?f.jsx(Js,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Jd,{className:"h-3 w-3 text-muted-foreground"})]}),g&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(y3,{events:q,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:ye=>T(Ae=>new Set(Ae).add(ye))})})]}),M&&(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:oe&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs(wn,{type:"button",variant:"ghost",size:"sm",className:se("h-5 rounded-sm border border-border/50 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",V?"bg-primary/12 text-primary hover:border-primary/35 hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:border-emerald-500/25 hover:bg-emerald-500/10"),onClick:()=>void Ge(),disabled:ee,"aria-label":te,"aria-describedby":"live-link-restart-hint",title:X,children:[f.jsx(NN,{className:se("h-2.5 w-2.5",J&&"animate-pulse")}),f.jsx("span",{children:G})]}),f.jsxs("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:[X,V&&(d!=null&&d.assetName)?` · ${d.assetName}`:""]})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(wn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>T(new Set(l.map(ye=>ye.id))),disabled:q.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(wn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(!1),children:"Close"})]})]})]})]})}const Or="fluent",j3="clean",Xd="meshy-layout-default-migrated-to-compact",pf="true",M3="compact",O3=new Set(["airy","clean","fluent"]);function D3(n){return n!==null&&O3.has(n)}function tm(n){return n===M3?"fluent":D3(n)?n:null}function k3(n,l){const o=tm(n);return o===j3&&l!==pf?Or:o??Or}const $o="finsight",Wx="default",z3=new Set(["light","dark","system"]),L3=new Set(["porcelain","warm","finsight","edge"]),e1=v.createContext(null);function U3(n){const l=new URLSearchParams(n).get("theme");return t1(l)?l:null}function B3(n){const l=new URLSearchParams(n).get("palette");return nm(l)}function H3(n){const l=new URLSearchParams(n).get("layout");return tm(l)}function V3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:nm(n.getAttribute("data-palette"))??$o,layout:tm(n.getAttribute("data-layout"))??Or}}function yM(n,l=V3()){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 $3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?U3(window.location.search)??G3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,c]=v.useState(()=>typeof window<"u"?B3(window.location.search)??P3(localStorage.getItem("meshy-palette"))??$o:$o),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=H3(window.location.search);if(h)return localStorage.setItem(Xd,pf),h;const y=k3(localStorage.getItem("meshy-layout"),localStorage.getItem(Xd));return localStorage.setItem(Xd,pf),y}return Or});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===$o?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===Or?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(e1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function Y3(){const n=v.useContext(e1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function t1(n){return n!==null&&z3.has(n)}function q3(n){return n!==null&&L3.has(n)}function G3(n){return t1(n)?n:null}function nm(n){return n===Wx?"porcelain":q3(n)?n:null}function P3(n){return n===Wx?null:nm(n)}const X3=[{value:"light",label:"Light",icon:U0},{value:"dark",label:"Dark",icon:z0},{value:"system",label:"System",icon:k0}],n1=[{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"}],a1=[{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 K3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=Y3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?z0:n==="light"?U0:k0,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(wn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("h-8 w-8 rounded-sm",o!==$o||c!==Or?"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:[Q3(c)," / ",Z3(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:X3.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:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[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:a1.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:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10":"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:se("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(Os,{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(DN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:n1.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:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(I3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:se("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(Os,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function Q3(n){var l;return((l=a1.find(o=>o.value===n))==null?void 0:l.label)??n}function Z3(n){var l;return((l=n1.find(o=>o.value===n))==null?void 0:l.label)??n}function I3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:se("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 Yo={tasks:{defaultSize:24,min:16,max:36,wheelStep:1},operations:{defaultSize:26,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},l1="meshy-dashboard-panel-state-v1",r1="meshy-dashboard-terminal-open-v1";function bM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Yo.tasks.defaultSize,operations:Yo.operations.defaultSize,terminal:Yo.terminal.defaultSize}}}function Kd(n){return typeof n=="object"&&n!==null}function Wv(n,l){return typeof n=="boolean"?n:l}function Qd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?qo(n,l):o}function qo(n,l){const o=Yo[n];return Math.min(o.max,Math.max(o.min,l))}function xM(n,l){if(!n)return l;try{const o=n.getItem(l1);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:Wv(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:Wv(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 SM(n,l){if(n)try{n.setItem(l1,JSON.stringify(l))}catch{}}function F3(n,l){if(!n)return l;try{const o=n.getItem(r1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function J3(n,l){if(n)try{n.setItem(r1,String(l))}catch{}}function e0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function wM(n){return`${Number(n.toFixed(2))}rem`}function EM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?qo(n,l+(c-o)/h):n==="operations"?qo(n,l+(o-c)/h):qo(n,l+(i-d)/h)}function NM(n,l,o){const i=o===0?0:o>0?-1:1;return qo(n,l+i*Yo[n].wheelStep)}function t0(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function n0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function a0(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 W3(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=M0(),c=qn(),[d,m]=v.useState(()=>F3(e0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),T=v.useMemo(()=>{const R=new Map;for(const _ of(n==null?void 0:n.nodes)??[])R.set(_.id,_.name);return n!=null&&n.self&&R.set(n.self.id,n.self.name),R},[n==null?void 0:n.nodes,n==null?void 0:n.self]),E=v.useCallback(R=>{m(_=>typeof R=="function"?R(_):R)},[]);v.useEffect(()=>{J3(e0(),d)},[d]),v.useEffect(()=>{const R=t0();if(!R){w(null);return}let _=!1;return w(n0("Checking desktop update...")),R("check_desktop_update").then(z=>{_||w(z)}).catch(z=>{_||w(n0(a0(z,"Desktop update check failed")))}),()=>{_=!0}},[i==null?void 0:i.version]);async function C(){try{const R=await _0({reason:"restart"});Je.info(`Restarting runtime. Follow ${R.logPath} for launch output.`),await Ix({previousPid:R.pid})||Je.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(R){Je.error(R instanceof Error?R.message:"Runtime restart failed")}}async function A(){const R=t0();if(!R){Je.error("Desktop updater is not available in this window");return}try{const _=await R("install_desktop_update");_.openedRelease?Je.info("Opened the latest Meshy release page."):_.installMethod==="tauri-updater"?Je.info(`Installing ${_.assetName??"desktop update"}. Meshy will relaunch to finish updating.`):Je.info(`Downloaded ${_.assetName??"desktop update"}${_.downloadPath?` to ${_.downloadPath}`:""}. Follow the installer to finish updating.`)}catch(_){Je.error(a0(_,"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:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] items-center gap-0 rounded-lg px-3 py-2",children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Fd,{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(gN,{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"}),N&&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(L0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(Jd,{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(sN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(Jd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Fd,{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(CN,{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(em,{"aria-label":"Search tasks",value:h,onChange:R=>y(R.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:[N&&f.jsx(wn,{variant:"ghost",size:"icon",onClick:()=>E(R=>!R),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:se("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(B0,{className:"h-4 w-4"})}),f.jsx(n3,{}),f.jsx(K3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(_3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:T,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?A:void 0,onRestart:C})]})]})}),f.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",N?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:f.jsx(Tw,{context:{terminalOpen:d,setTerminalOpen:E,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const l0=v.lazy(async()=>({default:(await i0(()=>import("./DashboardPage-DdLZ5kNg.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),ej=v.lazy(async()=>({default:(await i0(()=>import("./SharedConversationPage-DOsbPRos.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function tj(){return f.jsx(Fw,{children:f.jsx(v.Suspense,{fallback:f.jsx(nj,{}),children:f.jsxs(Aw,{children:[f.jsx(Al,{path:"/shared/tasks/:shareId",element:f.jsx(ej,{})}),f.jsxs(Al,{element:f.jsx(jE,{children:f.jsx(W3,{})}),children:[f.jsx(Al,{path:"/",element:f.jsx(l0,{})}),f.jsx(Al,{path:"/nodes",element:f.jsx(dv,{to:"/",replace:!0})}),f.jsx(Al,{path:"/tasks",element:f.jsx(dv,{to:"/",replace:!0})}),f.jsx(Al,{path:"/tasks/:id",element:f.jsx(l0,{})})]})]})})})}function nj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function aj(n){return f.jsx(eC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}C2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs($3,{children:[f.jsx(tj,{}),f.jsx(aj,{})]})}));export{Xs as $,Hy as A,wn as B,Os as C,Wj as D,$y as E,oN as F,yM as G,eN as H,em as I,s3 as J,i3 as K,D0 as L,t_ as M,yt as N,Ij as O,Fj as P,bx as Q,Rs as R,L0 as S,eM as T,pM as U,$s as V,mf as W,H0 as X,Ys as Y,qs as Z,Ps as _,rC as a,dM as a$,Gs as a0,Qs as a1,Ks as a2,i0 as a3,sj as a4,Vy as a5,q5 as a6,Sj as a7,B0 as a8,Ho as a9,bM as aA,e0 as aB,SM as aC,NM as aD,wM as aE,EM as aF,Ej as aG,EE as aH,vE as aI,Qj as aJ,Kj as aK,CE as aL,Mj as aM,fj as aN,uj as aO,Yy as aP,dj as aQ,mj as aR,fE as aS,n3 as aT,Oj as aU,Dj as aV,rj as aW,qn as aX,y0 as aY,lj as aZ,M0 as a_,JE as aa,xj as ab,wj as ac,bj as ad,_N as ae,fN as af,uM as ag,xN as ah,y3 as ai,g_ as aj,lN as ak,v_ as al,gM as am,l3 as an,vM as ao,nM as ap,aM as aq,Kx as ar,mM as as,fM as at,hM as au,hf as av,lM as aw,kj as ax,zj as ay,xM as az,se as b,cM as b0,rM as b1,oM as b2,sM as b3,iM as b4,Nj as b5,tM as b6,r3 as b7,_j as b8,jj as b9,Rj as ba,Aj as bb,ij as bc,cj as bd,oj as be,hj as bf,Vj as bg,Hj as bh,Bj as bi,Lj as bj,Uj as bk,$j as bl,a3 as bm,r0 as bn,KE as bo,Gj as bp,qj as bq,Yj as br,wN as bs,Pj as bt,Zj as bu,Xj as bv,Ue as c,ny as d,yj as e,dE as f,gj as g,pj as h,sN as i,f as j,Jd as k,Cr as l,vj as m,Cj as n,Ib as o,Zf as p,Fb as q,v as r,If as s,Je as t,CN as u,Js as v,DN as w,Jj as x,Tj as y,V5 as z};
|