meshy-node 0.8.5 → 0.8.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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-SPgMQP8H.js","assets/DashboardShared-CNEt96B1.js","assets/play-DKbfL1lN.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-Cd0hBNE_.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-Du4ZFTCW.js","assets/DashboardShared-Dyy5Gg2W.js","assets/play-DOP4Sb9t.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-CiA3IWeo.js"])))=>i.map(i=>d[i]);
2
2
  function S2(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 s0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Nd={exports:{}},zo={};/**
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 sv="popstate";function cv(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function D2(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 Fd("",{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:Xo(c)}return z2(l,o,null,n)}function ot(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Cn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function k2(){return Math.random().toString(36).substring(2,10)}function uv(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 Fd(n,l,o=null,i,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?Ur(l):l,state:o,key:l&&l.key||i||k2(),unstable_mask:c}}function Xo({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 Ur(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 z2(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 j=cv(C)?C:Fd(E.location,C,A);p=x()+1;let O=uv(j,p),z=E.createHref(j.unstable_mask||j);try{m.pushState(O,"",z)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;c.location.assign(z)}d&&y&&y({action:h,location:E.location,delta:1})}function N(C,A){h="REPLACE";let j=cv(C)?C:Fd(E.location,C,A);p=x();let O=uv(j,p),z=E.createHref(j.unstable_mask||j);m.replaceState(O,"",z),d&&y&&y({action:h,location:E.location,delta:0})}function T(C){return L2(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(sv,g),y=C,()=>{c.removeEventListener(sv,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 L2(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:Xo(n);return i=i.replace(/ $/,"%20"),!l&&i.startsWith("//")&&(i=o+i),new URL(i,o)}function d0(n,l,o="/"){return U2(n,l,o,!1)}function U2(n,l,o,i){let c=typeof l=="string"?Ur(l):l,d=ya(c.pathname||"/",o);if(d==null)return null;let m=f0(n);B2(m);let h=null;for(let y=0;h==null&&y<m.length;++y){let p=Z2(d);h=K2(m[y],p,i)}return h}function f0(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=Zn([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}".`),f0(m.children,l,w,g,y)),!(m.path==null&&!m.index)&&l.push({path:g,score:P2(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 m0(m.path))d(m,h,!0,p)}),l}function m0(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=m0(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 B2(n){n.sort((l,o)=>l.score!==o.score?o.score-l.score:X2(l.routesMeta.map(i=>i.childrenIndex),o.routesMeta.map(i=>i.childrenIndex)))}var H2=/^:[\w-]+$/,V2=3,$2=2,Y2=1,q2=10,G2=-2,dv=n=>n==="*";function P2(n,l){let o=n.split("/"),i=o.length;return o.some(dv)&&(i+=G2),l&&(i+=$2),o.filter(c=>!dv(c)).reduce((c,d)=>c+(H2.test(d)?V2:d===""?Y2:q2),i)}function X2(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 K2(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=Os({path:y.relativePath,caseSensitive:y.caseSensitive,end:p},x),w=y.route;if(!g&&p&&o&&!i[i.length-1].route.index&&(g=Os({path:y.relativePath,caseSensitive:y.caseSensitive,end:!1},x)),!g)return null;Object.assign(c,g.params),m.push({params:c,pathname:Zn([d,g.pathname]),pathnameBase:W2(Zn([d,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(d=Zn([d,g.pathnameBase]))}return m}function Os(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[o,i]=Q2(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 Q2(n,l=!1,o=!0){Cn(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 Z2(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Cn(!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 ya(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 I2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function F2(n,l="/"){let{pathname:o,search:i="",hash:c=""}=typeof n=="string"?Ur(n):n,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=fv(o.substring(1),"/"):d=fv(o,l)):d=l,{pathname:d,search:ew(i),hash:tw(c)}}function fv(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 jd(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 J2(n){return n.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function Sf(n){let l=J2(n);return l.map((o,i)=>i===l.length-1?o.pathname:o.pathnameBase)}function Js(n,l,o,i=!1){let c;typeof n=="string"?c=Ur(n):(c={...n},ot(!c.pathname||!c.pathname.includes("?"),jd("?","pathname","search",c)),ot(!c.pathname||!c.pathname.includes("#"),jd("#","pathname","hash",c)),ot(!c.search||!c.search.includes("#"),jd("#","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=F2(c,h),p=m&&m!=="/"&&m.endsWith("/"),x=(d||m===".")&&o.endsWith("/");return!y.pathname.endsWith("/")&&(p||x)&&(y.pathname+="/"),y}var Zn=n=>n.join("/").replace(/\/\/+/g,"/"),W2=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),ew=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,tw=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,nw=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 aw(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function lw(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var h0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function p0(n,l){let o=n;if(typeof o!="string"||!I2.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let i=o,c=!1;if(h0)try{let d=new URL(window.location.href),m=o.startsWith("//")?new URL(d.protocol+o):new URL(o),h=ya(m.pathname,l);m.origin===d.origin&&h!=null?o=h+m.search+m.hash:c=!0}catch{Cn(!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 g0=["POST","PUT","PATCH","DELETE"];new Set(g0);var rw=["GET",...g0];new Set(rw);var Br=v.createContext(null);Br.displayName="DataRouter";var Ws=v.createContext(null);Ws.displayName="DataRouterState";var ow=v.createContext(!1),v0=v.createContext({isTransitioning:!1});v0.displayName="ViewTransition";var iw=v.createContext(new Map);iw.displayName="Fetchers";var sw=v.createContext(null);sw.displayName="Await";var on=v.createContext(null);on.displayName="Navigation";var Io=v.createContext(null);Io.displayName="Location";var bn=v.createContext({outlet:null,matches:[],isDataRoute:!1});bn.displayName="Route";var wf=v.createContext(null);wf.displayName="RouteError";var y0="REACT_ROUTER_ERROR",cw="REDIRECT",uw="ROUTE_ERROR_RESPONSE";function dw(n){if(n.startsWith(`${y0}:${cw}:{`))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 fw(n){if(n.startsWith(`${y0}:${uw}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new nw(l.status,l.statusText,l.data)}catch{}}function mw(n,{relative:l}={}){ot(Hr(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:i}=v.useContext(on),{hash:c,pathname:d,search:m}=Fo(n,{relative:l}),h=d;return o!=="/"&&(h=d==="/"?o:Zn([o,d])),i.createHref({pathname:h,search:m,hash:c})}function Hr(){return v.useContext(Io)!=null}function Fn(){return ot(Hr(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Io).location}var b0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function x0(n){v.useContext(on).static||v.useLayoutEffect(n)}function S0(){let{isDataRoute:n}=v.useContext(bn);return n?Aw():hw()}function hw(){ot(Hr(),"useNavigate() may be used only in the context of a <Router> component.");let n=v.useContext(Br),{basename:l,navigator:o}=v.useContext(on),{matches:i}=v.useContext(bn),{pathname:c}=Fn(),d=JSON.stringify(Sf(i)),m=v.useRef(!1);return x0(()=>{m.current=!0}),v.useCallback((y,p={})=>{if(Cn(m.current,b0),!m.current)return;if(typeof y=="number"){o.go(y);return}let x=Js(y,JSON.parse(d),c,p.relative==="path");n==null&&l!=="/"&&(x.pathname=x.pathname==="/"?l:Zn([l,x.pathname])),(p.replace?o.replace:o.push)(x,p.state,p)},[l,o,d,c,n])}var w0=v.createContext(null);function ij(){return v.useContext(w0)}function pw(n){let l=v.useContext(bn).outlet;return v.useMemo(()=>l&&v.createElement(w0.Provider,{value:n},l),[l,n])}function sj(){let{matches:n}=v.useContext(bn),l=n[n.length-1];return l?l.params:{}}function Fo(n,{relative:l}={}){let{matches:o}=v.useContext(bn),{pathname:i}=Fn(),c=JSON.stringify(Sf(o));return v.useMemo(()=>Js(n,JSON.parse(c),i,l==="path"),[n,c,i,l])}function gw(n,l){return E0(n,l)}function E0(n,l,o){var C;ot(Hr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(on),{matches:c}=v.useContext(bn),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||"";T0(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=Fn(),g;if(l){let A=typeof l=="string"?Ur(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=d0(n,{pathname:N});Cn(p||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cn(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=Sw(T&&T.map(A=>Object.assign({},A,{params:Object.assign({},m,A.params),pathname:Zn([y,i.encodeLocation?i.encodeLocation(A.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:Zn([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(Io.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},E):E}function vw(){let n=Cw(),l=aw(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 yw=v.createElement(vw,null),N0=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=fw(n.digest);o&&(n=o)}let l=n!==void 0?v.createElement(bn.Provider,{value:this.props.routeContext},v.createElement(wf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?v.createElement(bw,{error:n},l):l}};N0.contextType=ow;var Md=new WeakMap;function bw({children:n,error:l}){let{basename:o}=v.useContext(on);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=dw(l.digest);if(i){let c=Md.get(l);if(c)throw c;let d=p0(i.location,o);if(h0&&!Md.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 Md.set(l,m),m}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function xw({routeContext:n,match:l,children:o}){let i=v.useContext(Br);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),v.createElement(bn.Provider,{value:n},o)}function Sw(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:lw(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||yw,m&&(h<0&&w===0?(T0("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)),j=()=>{let O;return N?O=E:T?O=C:g.route.Component?O=v.createElement(g.route.Component,null):g.route.element?O=g.route.element:O=x,v.createElement(xw,{match:g,routeContext:{outlet:x,matches:A,isDataRoute:i!=null},children:O})};return i&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(N0,{location:i.location,revalidation:i.revalidation,component:E,error:N,children:j(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:p}):j()},null)}function Ef(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ww(n){let l=v.useContext(Br);return ot(l,Ef(n)),l}function Ew(n){let l=v.useContext(Ws);return ot(l,Ef(n)),l}function Nw(n){let l=v.useContext(bn);return ot(l,Ef(n)),l}function Nf(n){let l=Nw(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 Tw(){return Nf("useRouteId")}function Cw(){var i;let n=v.useContext(wf),l=Ew("useRouteError"),o=Nf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function Aw(){let{router:n}=ww("useNavigate"),l=Nf("useNavigate"),o=v.useRef(!1);return x0(()=>{o.current=!0}),v.useCallback(async(c,d={})=>{Cn(o.current,b0),o.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...d}))},[n,l])}var mv={};function T0(n,l,o){!l&&!mv[n]&&(mv[n]=!0,Cn(!1,o))}v.memo(Rw);function Rw({routes:n,future:l,state:o,isStatic:i,onError:c}){return E0(n,void 0,{state:o,isStatic:i,onError:c})}function hv({to:n,replace:l,state:o,relative:i}){ot(Hr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=v.useContext(on);Cn(!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(bn),{pathname:m}=Fn(),h=S0(),y=Js(n,Sf(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 _w(n){return pw(n.context)}function jl(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 jw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:c,static:d=!1,unstable_useTransitions:m}){ot(!Hr(),"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=Ur(o));let{pathname:p="/",search:x="",hash:g="",state:w=null,key:N="default",unstable_mask:T}=o,E=v.useMemo(()=>{let C=ya(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 Cn(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(on.Provider,{value:y},v.createElement(Io.Provider,{children:l,value:E}))}function Mw({children:n,location:l}){return gw(Jd(n),l)}function Jd(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,Jd(i.props.children,d));return}ot(i.type===jl,`[${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=Jd(i.props.children,d)),o.push(m)}),o}var Ts="get",Cs="application/x-www-form-urlencoded";function ec(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Ow(n){return ec(n)&&n.tagName.toLowerCase()==="button"}function Dw(n){return ec(n)&&n.tagName.toLowerCase()==="form"}function kw(n){return ec(n)&&n.tagName.toLowerCase()==="input"}function zw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Lw(n,l){return n.button===0&&(!l||l==="_self")&&!zw(n)}var ms=null;function Uw(){if(ms===null)try{new FormData(document.createElement("form"),0),ms=!1}catch{ms=!0}return ms}var Bw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Od(n){return n!=null&&!Bw.has(n)?(Cn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cs}"`),null):n}function Hw(n,l){let o,i,c,d,m;if(Dw(n)){let h=n.getAttribute("action");i=h?ya(h,l):null,o=n.getAttribute("method")||Ts,c=Od(n.getAttribute("enctype"))||Cs,d=new FormData(n)}else if(Ow(n)||kw(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?ya(y,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Ts,c=Od(n.getAttribute("formenctype"))||Od(h.getAttribute("enctype"))||Cs,d=new FormData(h,n),!Uw()){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(ec(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Ts,i=null,c=Cs,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 Tf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Vw(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&&ya(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${i}`,c}async function $w(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 Yw(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 qw(n,l,o){let i=await Promise.all(n.map(async c=>{let d=l.routes[c.route.id];if(d){let m=await $w(d,o);return m.links?m.links():[]}return[]}));return Kw(i.flat(1).filter(Yw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function pv(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 Gw(n,l,{includeHydrateFallback:o}={}){return Pw(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 Pw(n){return[...new Set(n)]}function Xw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function Kw(n,l){let o=new Set;return new Set(l),n.reduce((i,c)=>{let d=JSON.stringify(Xw(c));return o.has(d)||(o.add(d),i.push({key:d,link:c})),i},[])}function C0(){let n=v.useContext(Br);return Tf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Qw(){let n=v.useContext(Ws);return Tf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Cf=v.createContext(void 0);Cf.displayName="FrameworkContext";function A0(){let n=v.useContext(Cf);return Tf(n,"You must render this element inside a <HydratedRouter> element"),n}function Zw(n,l){let o=v.useContext(Cf),[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(j=>{m(j.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:Uo(h,N),onBlur:Uo(y,T),onMouseEnter:Uo(p,N),onMouseLeave:Uo(x,T),onTouchStart:Uo(g,N)}]:[!1,w,{}]}function Uo(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function Iw({page:n,...l}){let{router:o}=C0(),i=v.useMemo(()=>d0(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?v.createElement(Jw,{page:n,matches:i,...l}):null}function Fw(n){let{manifest:l,routeModules:o}=A0(),[i,c]=v.useState([]);return v.useEffect(()=>{let d=!1;return qw(n,l,o).then(m=>{d||c(m)}),()=>{d=!0}},[n,l,o]),i}function Jw({page:n,matches:l,...o}){let i=Fn(),{future:c,manifest:d,routeModules:m}=A0(),{basename:h}=C0(),{loaderData:y,matches:p}=Qw(),x=v.useMemo(()=>pv(n,l,p,d,i,"data"),[n,l,p,d,i]),g=v.useMemo(()=>pv(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(j=>{var z;let O=d.routes[j.route.id];!O||!O.hasLoader||(!x.some(B=>B.route.id===j.route.id)&&j.route.id in y&&((z=m[j.route.id])!=null&&z.shouldRevalidate)||O.hasClientLoader?C=!0:E.add(j.route.id))}),E.size===0)return[];let A=Vw(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&E.size>0&&A.searchParams.set("_routes",l.filter(j=>E.has(j.route.id)).map(j=>j.route.id).join(",")),[A.pathname+A.search]},[h,c.unstable_trailingSlashAwareDataRequests,y,i,d,x,l,n,m]),N=v.useMemo(()=>Gw(g,d),[g,d]),T=Fw(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 Ww(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var eE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{eE&&(window.__reactRouterVersion="7.13.2")}catch{}function tE({basename:n,children:l,unstable_useTransitions:o,window:i}){let c=v.useRef();c.current==null&&(c.current=D2({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(jw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var R0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_0=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:j}=v.useContext(on),O=typeof x=="string"&&R0.test(x),z=p0(x,C);x=z.to;let B=mw(x,{relative:c}),G=Fn(),$=null;if(h){let oe=Js(h,[],G.unstable_mask?G.unstable_mask.pathname:"/",!0);C!=="/"&&(oe.pathname=oe.pathname==="/"?C:Zn([C,oe.pathname])),$=A.createHref(oe)}let[V,ne,le]=Zw(i,T),fe=lE(x,{replace:m,unstable_mask:h,state:y,target:p,preventScrollReset:g,relative:c,viewTransition:w,unstable_defaultShouldRevalidate:N,unstable_useTransitions:j});function me(oe){l&&l(oe),oe.defaultPrevented||fe(oe)}let ie=!(z.isExternal||d),ue=v.createElement("a",{...T,...le,href:(ie?$:void 0)||z.absoluteURL||B,onClick:ie?me:l,ref:Ww(E,ne),target:p,"data-discover":!O&&o==="render"?"true":void 0});return V&&!O?v.createElement(v.Fragment,null,ue,v.createElement(Iw,{page:B})):ue});_0.displayName="Link";var Wd=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=Fo(m,{relative:p.relative}),w=Fn(),N=v.useContext(Ws),{navigator:T,basename:E}=v.useContext(on),C=N!=null&&cE(g)&&h===!0,A=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,j=w.pathname,O=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;o||(j=j.toLowerCase(),O=O?O.toLowerCase():null,A=A.toLowerCase()),O&&E&&(O=ya(O,E)||O);const z=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let B=j===A||!c&&j.startsWith(A)&&j.charAt(z)==="/",G=O!=null&&(O===A||!c&&O.startsWith(A)&&O.charAt(A.length)==="/"),$={isActive:B,isPending:G,isTransitioning:C},V=B?l:void 0,ne;typeof i=="function"?ne=i($):ne=[i,B?"active":null,G?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let le=typeof d=="function"?d($):d;return v.createElement(_0,{...p,"aria-current":V,className:ne,ref:x,style:le,to:m,viewTransition:h},typeof y=="function"?y($):y)});Wd.displayName="NavLink";var nE=v.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:c,state:d,method:m=Ts,action:h,onSubmit:y,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w,...N},T)=>{let{unstable_useTransitions:E}=v.useContext(on),C=iE(),A=sE(h,{relative:p}),j=m.toLowerCase()==="get"?"get":"post",O=typeof h=="string"&&R0.test(h),z=B=>{if(y&&y(B),B.defaultPrevented)return;B.preventDefault();let G=B.nativeEvent.submitter,$=(G==null?void 0:G.getAttribute("formmethod"))||m,V=()=>C(G||B.currentTarget,{fetcherKey:l,method:$,navigate:o,replace:c,state:d,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w});E&&o!==!1?v.startTransition(()=>V()):V()};return v.createElement("form",{ref:T,method:j,action:A,onSubmit:i?y:z,...N,"data-discover":!O&&n==="render"?"true":void 0})});nE.displayName="Form";function aE(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j0(n){let l=v.useContext(Br);return ot(l,aE(n)),l}function lE(n,{target:l,replace:o,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p}={}){let x=S0(),g=Fn(),w=Fo(n,{relative:m});return v.useCallback(N=>{if(Lw(N,l)){N.preventDefault();let T=o!==void 0?o:Xo(g)===Xo(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 rE=0,oE=()=>`__${String(++rE)}__`;function iE(){let{router:n}=j0("useSubmit"),{basename:l}=v.useContext(on),o=Tw(),i=n.fetch,c=n.navigate;return v.useCallback(async(d,m={})=>{let{action:h,method:y,encType:p,formData:x,body:g}=Hw(d,l);if(m.navigate===!1){let w=m.fetcherKey||oE();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 sE(n,{relative:l}={}){let{basename:o}=v.useContext(on),i=v.useContext(bn);ot(i,"useFormAction must be used inside a RouteContext");let[c]=i.matches.slice(-1),d={...Fo(n||".",{relative:l})},m=Fn();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:Zn([o,d.pathname])),Xo(d)}function cE(n,{relative:l}={}){let o=v.useContext(v0);ot(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=j0("useViewTransitionState"),c=Fo(n,{relative:l});if(!o.isTransitioning)return!1;let d=ya(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=ya(o.nextLocation.pathname,i)||o.nextLocation.pathname;return Os(c.pathname,m)!=null||Os(c.pathname,d)!=null}var Jo=c0();const M0=s0(Jo),uE="/api";function dE(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 Ee(n,l){const o=await fetch(`${uE}${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(dE(i,`HTTP ${o.status}`))}return o.json()}function fE(){return Ee("/system/info")}function cj(n){return Ee("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function O0(n){return Ee("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function mE(){return Ee("/system/runtime/stop",{method:"POST"})}function hE(){return Ee("/cluster/state")}function uj(){return Ee("/cluster/promote",{method:"POST"})}function dj(n){return Ee("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function fj(){return Ee("/cluster/disconnect",{method:"POST"})}function pE(n){return Ee(`/node-operations/${n}`)}async function gE(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 Ee(`/node-operations${o?`?${o}`:""}`)).operations}function vE(n,l){return Ee(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function yE(n,l){return Ee(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function mj(){return(await Ee("/devboxes")).devboxes}function hj(n,l){return Ee(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function pj(n){return Ee(`/nodes/${n}/devbox/status`)}function gj(n){return Ee(`/nodes/${n}/devbox/start`,{method:"POST"})}function vj(n,l){return Ee(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function yj(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 Ee(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function bj(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 Ee(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function xj(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ee(`/nodes/${n}/native-sessions?${o.toString()}`)}function Sj(n,l){return Ee(`/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 wj(n,l){return Ee(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function Ej(n){return Ee(`/nodes/${n}/terminal/sessions`)}function Nj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}`)}function Tj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function Cj(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 Ee(`/tasks${o?`?${o}`:""}`)}function Aj(n){return Ee(`/tasks/${n}`)}function Rj(n){return Ee("/tasks",{method:"POST",body:JSON.stringify(n)})}function _j(n){return Ee("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function jj(n){return Ee("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function Mj(n){return Ee("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function Oj(n){return Ee(`/tasks/${n}/cancel`,{method:"POST"})}function Dj(n){return Ee(`/tasks/${n}/retry`,{method:"POST"})}function kj(n,l){return Ee(`/tasks/${n}/logs`)}function zj(n,l){return Ee(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function Lj(n,l){return Ee(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function Uj(n,l){return Ee(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function Bj(n){return Ee(`/tasks/${n}/share`,{method:"DELETE"})}function Hj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}`)}function Vj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function $j(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output`)}function Yj(n,l="."){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function qj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function Gj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function bE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Pj(n){return Ee(`/tasks/${n}/output`)}function Xj(n,l="."){return Ee(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Kj(n,l){return Ee(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Qj(n,l){return Ee(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(bE(l))})}function Zj(n){return Ee(`/tasks/${n}/output/diff`)}function xE({hasStarted:n,enabled:l}){return l&&!n}function SE(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();xE({hasStarted:c.current,enabled:o})&&(c.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let wE=0;function EE(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(++wE),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 NE=1e4,TE=6e4,CE=NE,AE=250,RE=new Set(["node.joined","node.left","task.created","task.assigned","task.deleted"]),_E=new Set(["task.created","task.assigned","task.status","task.deleted"]);function jE(n){return n?TE:CE}function Ij(n){return RE.has(n)}function ME(n){return _E.has(n)}function OE(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 DE(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 Fj(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 D0=v.createContext(null);function kE({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}=EE(),E=v.useCallback(async()=>{var A;try{const[j,O]=await Promise.all([hE(),fE()]),z=j,B=O.nodeId??O.id,G=z.nodes??[],$=G.find(le=>le.id===B)??{id:B,name:O.name,endpoint:O.endpoint,role:O.role,status:O.status,capabilities:O.capabilities,joinedAt:O.joinedAt,lastHeartbeat:O.lastHeartbeat},V=z.leaderId?G.find(le=>le.id===z.leaderId)??null:null,ne={leader:V?{id:V.id,name:V.name,endpoint:V.endpoint,...V.dashboardOrigin?{dashboardOrigin:V.dashboardOrigin}:{}}:null,term:z.term??0,nodes:G,self:$,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((A=ne.leader)==null?void 0:A.id)??null,term:ne.term,nodeCount:ne.nodes.length},g.current=new Map(ne.nodes.map(le=>[le.id,le.status])),g.current.set(ne.self.id,ne.self.status),o(ne),c(O),y(null)}catch(j){y(j instanceof Error?j.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),C=v.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,E()},AE))},[E]);return SE(E,jE(N)),v.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),v.useEffect(()=>{const A=[T("cluster",j=>{OE(j.data,x.current)&&C()}),T("election",C),T("node",j=>{DE(j.type,j.data,g.current)&&C()}),T("transport",C),T("task",j=>{ME(j.type)&&C()})];return()=>A.forEach(j=>j())},[T,C]),f.jsx(D0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:N,subscribe:T,refresh:E,loading:d,error:h},children:n})}function k0(){const n=v.useContext(D0);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=Fn(),g;if(l){let A=typeof l=="string"?Ur(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=d0(n,{pathname:N});Cn(p||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cn(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=Sw(T&&T.map(A=>Object.assign({},A,{params:Object.assign({},m,A.params),pathname:Zn([y,i.encodeLocation?i.encodeLocation(A.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:Zn([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(Io.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},E):E}function vw(){let n=Cw(),l=aw(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 yw=v.createElement(vw,null),N0=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=fw(n.digest);o&&(n=o)}let l=n!==void 0?v.createElement(bn.Provider,{value:this.props.routeContext},v.createElement(wf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?v.createElement(bw,{error:n},l):l}};N0.contextType=ow;var Md=new WeakMap;function bw({children:n,error:l}){let{basename:o}=v.useContext(on);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=dw(l.digest);if(i){let c=Md.get(l);if(c)throw c;let d=p0(i.location,o);if(h0&&!Md.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 Md.set(l,m),m}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function xw({routeContext:n,match:l,children:o}){let i=v.useContext(Br);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),v.createElement(bn.Provider,{value:n},o)}function Sw(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:lw(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||yw,m&&(h<0&&w===0?(T0("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)),j=()=>{let O;return N?O=E:T?O=C:g.route.Component?O=v.createElement(g.route.Component,null):g.route.element?O=g.route.element:O=x,v.createElement(xw,{match:g,routeContext:{outlet:x,matches:A,isDataRoute:i!=null},children:O})};return i&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(N0,{location:i.location,revalidation:i.revalidation,component:E,error:N,children:j(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:p}):j()},null)}function Ef(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ww(n){let l=v.useContext(Br);return ot(l,Ef(n)),l}function Ew(n){let l=v.useContext(Ws);return ot(l,Ef(n)),l}function Nw(n){let l=v.useContext(bn);return ot(l,Ef(n)),l}function Nf(n){let l=Nw(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 Tw(){return Nf("useRouteId")}function Cw(){var i;let n=v.useContext(wf),l=Ew("useRouteError"),o=Nf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function Aw(){let{router:n}=ww("useNavigate"),l=Nf("useNavigate"),o=v.useRef(!1);return x0(()=>{o.current=!0}),v.useCallback(async(c,d={})=>{Cn(o.current,b0),o.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...d}))},[n,l])}var mv={};function T0(n,l,o){!l&&!mv[n]&&(mv[n]=!0,Cn(!1,o))}v.memo(Rw);function Rw({routes:n,future:l,state:o,isStatic:i,onError:c}){return E0(n,void 0,{state:o,isStatic:i,onError:c})}function hv({to:n,replace:l,state:o,relative:i}){ot(Hr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=v.useContext(on);Cn(!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(bn),{pathname:m}=Fn(),h=S0(),y=Js(n,Sf(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 _w(n){return pw(n.context)}function jl(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 jw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:c,static:d=!1,unstable_useTransitions:m}){ot(!Hr(),"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=Ur(o));let{pathname:p="/",search:x="",hash:g="",state:w=null,key:N="default",unstable_mask:T}=o,E=v.useMemo(()=>{let C=ya(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 Cn(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(on.Provider,{value:y},v.createElement(Io.Provider,{children:l,value:E}))}function Mw({children:n,location:l}){return gw(Jd(n),l)}function Jd(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,Jd(i.props.children,d));return}ot(i.type===jl,`[${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=Jd(i.props.children,d)),o.push(m)}),o}var Ts="get",Cs="application/x-www-form-urlencoded";function ec(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Ow(n){return ec(n)&&n.tagName.toLowerCase()==="button"}function Dw(n){return ec(n)&&n.tagName.toLowerCase()==="form"}function kw(n){return ec(n)&&n.tagName.toLowerCase()==="input"}function zw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Lw(n,l){return n.button===0&&(!l||l==="_self")&&!zw(n)}var ms=null;function Uw(){if(ms===null)try{new FormData(document.createElement("form"),0),ms=!1}catch{ms=!0}return ms}var Bw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Od(n){return n!=null&&!Bw.has(n)?(Cn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cs}"`),null):n}function Hw(n,l){let o,i,c,d,m;if(Dw(n)){let h=n.getAttribute("action");i=h?ya(h,l):null,o=n.getAttribute("method")||Ts,c=Od(n.getAttribute("enctype"))||Cs,d=new FormData(n)}else if(Ow(n)||kw(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?ya(y,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Ts,c=Od(n.getAttribute("formenctype"))||Od(h.getAttribute("enctype"))||Cs,d=new FormData(h,n),!Uw()){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(ec(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Ts,i=null,c=Cs,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 Tf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Vw(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&&ya(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${i}`,c}async function $w(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 Yw(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 qw(n,l,o){let i=await Promise.all(n.map(async c=>{let d=l.routes[c.route.id];if(d){let m=await $w(d,o);return m.links?m.links():[]}return[]}));return Kw(i.flat(1).filter(Yw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function pv(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 Gw(n,l,{includeHydrateFallback:o}={}){return Pw(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 Pw(n){return[...new Set(n)]}function Xw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function Kw(n,l){let o=new Set;return new Set(l),n.reduce((i,c)=>{let d=JSON.stringify(Xw(c));return o.has(d)||(o.add(d),i.push({key:d,link:c})),i},[])}function C0(){let n=v.useContext(Br);return Tf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Qw(){let n=v.useContext(Ws);return Tf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Cf=v.createContext(void 0);Cf.displayName="FrameworkContext";function A0(){let n=v.useContext(Cf);return Tf(n,"You must render this element inside a <HydratedRouter> element"),n}function Zw(n,l){let o=v.useContext(Cf),[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(j=>{m(j.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:Uo(h,N),onBlur:Uo(y,T),onMouseEnter:Uo(p,N),onMouseLeave:Uo(x,T),onTouchStart:Uo(g,N)}]:[!1,w,{}]}function Uo(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function Iw({page:n,...l}){let{router:o}=C0(),i=v.useMemo(()=>d0(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?v.createElement(Jw,{page:n,matches:i,...l}):null}function Fw(n){let{manifest:l,routeModules:o}=A0(),[i,c]=v.useState([]);return v.useEffect(()=>{let d=!1;return qw(n,l,o).then(m=>{d||c(m)}),()=>{d=!0}},[n,l,o]),i}function Jw({page:n,matches:l,...o}){let i=Fn(),{future:c,manifest:d,routeModules:m}=A0(),{basename:h}=C0(),{loaderData:y,matches:p}=Qw(),x=v.useMemo(()=>pv(n,l,p,d,i,"data"),[n,l,p,d,i]),g=v.useMemo(()=>pv(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(j=>{var z;let O=d.routes[j.route.id];!O||!O.hasLoader||(!x.some(B=>B.route.id===j.route.id)&&j.route.id in y&&((z=m[j.route.id])!=null&&z.shouldRevalidate)||O.hasClientLoader?C=!0:E.add(j.route.id))}),E.size===0)return[];let A=Vw(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&E.size>0&&A.searchParams.set("_routes",l.filter(j=>E.has(j.route.id)).map(j=>j.route.id).join(",")),[A.pathname+A.search]},[h,c.unstable_trailingSlashAwareDataRequests,y,i,d,x,l,n,m]),N=v.useMemo(()=>Gw(g,d),[g,d]),T=Fw(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 Ww(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var eE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{eE&&(window.__reactRouterVersion="7.13.2")}catch{}function tE({basename:n,children:l,unstable_useTransitions:o,window:i}){let c=v.useRef();c.current==null&&(c.current=D2({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(jw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var R0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_0=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:j}=v.useContext(on),O=typeof x=="string"&&R0.test(x),z=p0(x,C);x=z.to;let B=mw(x,{relative:c}),G=Fn(),$=null;if(h){let oe=Js(h,[],G.unstable_mask?G.unstable_mask.pathname:"/",!0);C!=="/"&&(oe.pathname=oe.pathname==="/"?C:Zn([C,oe.pathname])),$=A.createHref(oe)}let[V,ne,le]=Zw(i,T),fe=lE(x,{replace:m,unstable_mask:h,state:y,target:p,preventScrollReset:g,relative:c,viewTransition:w,unstable_defaultShouldRevalidate:N,unstable_useTransitions:j});function me(oe){l&&l(oe),oe.defaultPrevented||fe(oe)}let ie=!(z.isExternal||d),ue=v.createElement("a",{...T,...le,href:(ie?$:void 0)||z.absoluteURL||B,onClick:ie?me:l,ref:Ww(E,ne),target:p,"data-discover":!O&&o==="render"?"true":void 0});return V&&!O?v.createElement(v.Fragment,null,ue,v.createElement(Iw,{page:B})):ue});_0.displayName="Link";var Wd=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=Fo(m,{relative:p.relative}),w=Fn(),N=v.useContext(Ws),{navigator:T,basename:E}=v.useContext(on),C=N!=null&&cE(g)&&h===!0,A=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,j=w.pathname,O=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;o||(j=j.toLowerCase(),O=O?O.toLowerCase():null,A=A.toLowerCase()),O&&E&&(O=ya(O,E)||O);const z=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let B=j===A||!c&&j.startsWith(A)&&j.charAt(z)==="/",G=O!=null&&(O===A||!c&&O.startsWith(A)&&O.charAt(A.length)==="/"),$={isActive:B,isPending:G,isTransitioning:C},V=B?l:void 0,ne;typeof i=="function"?ne=i($):ne=[i,B?"active":null,G?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let le=typeof d=="function"?d($):d;return v.createElement(_0,{...p,"aria-current":V,className:ne,ref:x,style:le,to:m,viewTransition:h},typeof y=="function"?y($):y)});Wd.displayName="NavLink";var nE=v.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:c,state:d,method:m=Ts,action:h,onSubmit:y,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w,...N},T)=>{let{unstable_useTransitions:E}=v.useContext(on),C=iE(),A=sE(h,{relative:p}),j=m.toLowerCase()==="get"?"get":"post",O=typeof h=="string"&&R0.test(h),z=B=>{if(y&&y(B),B.defaultPrevented)return;B.preventDefault();let G=B.nativeEvent.submitter,$=(G==null?void 0:G.getAttribute("formmethod"))||m,V=()=>C(G||B.currentTarget,{fetcherKey:l,method:$,navigate:o,replace:c,state:d,relative:p,preventScrollReset:x,viewTransition:g,unstable_defaultShouldRevalidate:w});E&&o!==!1?v.startTransition(()=>V()):V()};return v.createElement("form",{ref:T,method:j,action:A,onSubmit:i?y:z,...N,"data-discover":!O&&n==="render"?"true":void 0})});nE.displayName="Form";function aE(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j0(n){let l=v.useContext(Br);return ot(l,aE(n)),l}function lE(n,{target:l,replace:o,unstable_mask:i,state:c,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p}={}){let x=S0(),g=Fn(),w=Fo(n,{relative:m});return v.useCallback(N=>{if(Lw(N,l)){N.preventDefault();let T=o!==void 0?o:Xo(g)===Xo(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 rE=0,oE=()=>`__${String(++rE)}__`;function iE(){let{router:n}=j0("useSubmit"),{basename:l}=v.useContext(on),o=Tw(),i=n.fetch,c=n.navigate;return v.useCallback(async(d,m={})=>{let{action:h,method:y,encType:p,formData:x,body:g}=Hw(d,l);if(m.navigate===!1){let w=m.fetcherKey||oE();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 sE(n,{relative:l}={}){let{basename:o}=v.useContext(on),i=v.useContext(bn);ot(i,"useFormAction must be used inside a RouteContext");let[c]=i.matches.slice(-1),d={...Fo(n||".",{relative:l})},m=Fn();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:Zn([o,d.pathname])),Xo(d)}function cE(n,{relative:l}={}){let o=v.useContext(v0);ot(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=j0("useViewTransitionState"),c=Fo(n,{relative:l});if(!o.isTransitioning)return!1;let d=ya(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=ya(o.nextLocation.pathname,i)||o.nextLocation.pathname;return Os(c.pathname,m)!=null||Os(c.pathname,d)!=null}var Jo=c0();const M0=s0(Jo),uE="/api";function dE(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 Ee(n,l){const o=await fetch(`${uE}${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(dE(i,`HTTP ${o.status}`))}return o.json()}function fE(){return Ee("/system/info")}function cj(n){return Ee("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function O0(n){return Ee("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function mE(){return Ee("/system/runtime/stop",{method:"POST"})}function hE(){return Ee("/cluster/state")}function uj(){return Ee("/cluster/promote",{method:"POST"})}function dj(n){return Ee("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function fj(){return Ee("/cluster/disconnect",{method:"POST"})}function pE(n){return Ee(`/node-operations/${n}`)}async function gE(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 Ee(`/node-operations${o?`?${o}`:""}`)).operations}function vE(n,l){return Ee(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function yE(n,l){return Ee(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function mj(){return(await Ee("/devboxes")).devboxes}function hj(n,l){return Ee(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function pj(n){return Ee(`/nodes/${n}/devbox/status`)}function gj(n){return Ee(`/nodes/${n}/devbox/start`,{method:"POST"})}function vj(n,l){return Ee(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function yj(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 Ee(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function bj(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 Ee(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function xj(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ee(`/nodes/${n}/native-sessions?${o.toString()}`)}function Sj(n,l){return Ee(`/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 wj(n,l){return Ee(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function Ej(n){return Ee(`/nodes/${n}/terminal/sessions`)}function Nj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}`)}function Tj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function Cj(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 Ee(`/tasks${o?`?${o}`:""}`)}function Aj(n){return Ee(`/tasks/${n}`)}function Rj(n){return Ee("/tasks",{method:"POST",body:JSON.stringify(n)})}function _j(n){return Ee("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function jj(n){return Ee("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function Mj(n){return Ee("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function Oj(n){return Ee(`/tasks/${n}/cancel`,{method:"POST"})}function Dj(n){return Ee(`/tasks/${n}/retry`,{method:"POST"})}function kj(n,l){return Ee(`/tasks/${n}/logs`)}function zj(n,l){return Ee(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function Lj(n,l){return Ee(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function Uj(n,l){return Ee(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function Bj(n){return Ee(`/tasks/${n}/share`,{method:"DELETE"})}function Hj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}`)}function Vj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function $j(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output`)}function Yj(n,l="."){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function qj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function Gj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function bE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Pj(n){return Ee(`/tasks/${n}/output`)}function Xj(n,l="."){return Ee(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Kj(n,l){return Ee(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Qj(n,l){return Ee(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(bE(l))})}function Zj(n){return Ee(`/tasks/${n}/output/diff`)}function xE({hasStarted:n,enabled:l}){return l&&!n}function SE(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();xE({hasStarted:c.current,enabled:o})&&(c.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let wE=0;function EE(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(++wE),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 NE=1e4,TE=6e4,CE=NE,AE=250,RE=new Set(["node.joined","node.left","task.created","task.assigned","task.deleted"]),_E=new Set(["task.created","task.assigned","task.status","task.deleted"]);function jE(n){return n?TE:CE}function Ij(n){return RE.has(n)}function ME(n){return _E.has(n)}function OE(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 DE(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 Fj(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}function Jj(n,l){const o=l.taskId;if(typeof o!="string")return n;const i=n.filter(c=>c.id!==o);return i.length===n.length?n:i}const D0=v.createContext(null);function kE({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}=EE(),E=v.useCallback(async()=>{var A;try{const[j,O]=await Promise.all([hE(),fE()]),z=j,B=O.nodeId??O.id,G=z.nodes??[],$=G.find(le=>le.id===B)??{id:B,name:O.name,endpoint:O.endpoint,role:O.role,status:O.status,capabilities:O.capabilities,joinedAt:O.joinedAt,lastHeartbeat:O.lastHeartbeat},V=z.leaderId?G.find(le=>le.id===z.leaderId)??null:null,ne={leader:V?{id:V.id,name:V.name,endpoint:V.endpoint,...V.dashboardOrigin?{dashboardOrigin:V.dashboardOrigin}:{}}:null,term:z.term??0,nodes:G,self:$,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((A=ne.leader)==null?void 0:A.id)??null,term:ne.term,nodeCount:ne.nodes.length},g.current=new Map(ne.nodes.map(le=>[le.id,le.status])),g.current.set(ne.self.id,ne.self.status),o(ne),c(O),y(null)}catch(j){y(j instanceof Error?j.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),C=v.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,E()},AE))},[E]);return SE(E,jE(N)),v.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),v.useEffect(()=>{const A=[T("cluster",j=>{OE(j.data,x.current)&&C()}),T("election",C),T("node",j=>{DE(j.type,j.data,g.current)&&C()}),T("transport",C),T("task",j=>{ME(j.type)&&C()})];return()=>A.forEach(j=>j())},[T,C]),f.jsx(D0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:N,subscribe:T,refresh:E,loading:d,error:h},children:n})}function k0(){const n=v.useContext(D0);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.
@@ -307,10 +307,10 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
307
307
 
308
308
  If you want to hide the \`${l.titleName}\`, you can wrap it with our VisuallyHidden component.
309
309
 
310
- For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return v.useEffect(()=>{n&&(document.getElementById(n)||console.error(o))},[o,n]),null},B5="DialogDescriptionWarning",H5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Uy(B5).contentName}}.`;return v.useEffect(()=>{var d;const c=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},By=Ey,Hy=Ty,Vy=Ay,Bf=Ry,Hf=_y,Vf=My,$f=Dy,ac=zy;const V5=By,$5=Hy,Y5=Vy,Jj=ac,$y=v.forwardRef(({className:n,...l},o)=>f.jsx(Bf,{ref:o,className:re("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}));$y.displayName=Bf.displayName;const Yy=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Y5,{children:[f.jsx($y,{}),f.jsxs(Hf,{ref:i,className:re("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),...o,children:[l,f.jsxs(ac,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Y0,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yy.displayName=Hf.displayName;const qy=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});qy.displayName="DialogHeader";const q5=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});q5.displayName="DialogFooter";const Gy=v.forwardRef(({className:n,...l},o)=>f.jsx(Vf,{ref:o,className:re("text-lg font-semibold leading-none tracking-tight",n),...l}));Gy.displayName=Vf.displayName;const Py=v.forwardRef(({className:n,...l},o)=>f.jsx($f,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Py.displayName=$f.displayName;function G5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[c,d]=v.useState(!1),m=l??c,h=v.useCallback(y=>{l===void 0&&d(y),o==null||o(y)},[l,o]);return f.jsxs(V5,{open:m,onOpenChange:h,children:[i&&f.jsx($5,{asChild:!0,children:f.jsx(yn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",children:f.jsx(_N,{className:"h-4 w-4"})})}),f.jsxs(Yy,{className:"settings-dialog-content grid h-[min(78vh,38rem)] max-h-[78vh] max-w-[min(86vw,50rem)] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden rounded-xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[f.jsxs(qy,{className:"shrink-0 border-b border-border/60 px-3 py-1.5 sm:px-3.5",children:[f.jsxs(Gy,{className:"flex items-center gap-1.5 text-[11px]",children:[f.jsx(gN,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),f.jsx(Py,{className:"text-[10px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-2.5 pb-2 pt-0 sm:px-3 sm:pb-2.5",children:n})]})]})}function Yv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Xy(n){const l=n+"CollectionProvider",[o,i]=al(l),[c,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),m=E=>{const{scope:C,children:A}=E,j=ae.useRef(null),O=ae.useRef(new Map).current;return f.jsx(c,{scope:C,itemMap:O,collectionRef:j,children:A})};m.displayName=l;const h=n+"CollectionSlot",y=Qo(h),p=ae.forwardRef((E,C)=>{const{scope:A,children:j}=E,O=d(h,A),z=tt(C,O.collectionRef);return f.jsx(y,{ref:z,children:j})});p.displayName=h;const x=n+"CollectionItemSlot",g="data-radix-collection-item",w=Qo(x),N=ae.forwardRef((E,C)=>{const{scope:A,children:j,...O}=E,z=ae.useRef(null),B=tt(C,z),G=d(x,A);return ae.useEffect(()=>(G.itemMap.set(z,{ref:z,...O}),()=>void G.itemMap.delete(z))),f.jsx(w,{[g]:"",ref:B,children:j})});N.displayName=x;function T(E){const C=d(n+"CollectionConsumer",E);return ae.useCallback(()=>{const j=C.collectionRef.current;if(!j)return[];const O=Array.from(j.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((G,$)=>O.indexOf(G.ref.current)-O.indexOf($.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:m,Slot:p,ItemSlot:N},T,i]}var P5=v.createContext(void 0);function Yf(n){const l=v.useContext(P5);return n||l||"ltr"}const X5=["top","right","bottom","left"],el=Math.min,ln=Math.max,Bs=Math.round,Es=Math.floor,In=n=>({x:n,y:n}),K5={left:"right",right:"left",bottom:"top",top:"bottom"};function of(n,l,o){return ln(n,el(l,o))}function ba(n,l){return typeof n=="function"?n(l):n}function xa(n){return n.split("-")[0]}function $r(n){return n.split("-")[1]}function qf(n){return n==="x"?"y":"x"}function Gf(n){return n==="y"?"height":"width"}function Qn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function Pf(n){return qf(Qn(n))}function Q5(n,l,o){o===void 0&&(o=!1);const i=$r(n),c=Pf(n),d=Gf(c);let m=c==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(m=Hs(m)),[m,Hs(m)]}function Z5(n){const l=Hs(n);return[sf(n),l,sf(l)]}function sf(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const qv=["left","right"],Gv=["right","left"],I5=["top","bottom"],F5=["bottom","top"];function J5(n,l,o){switch(n){case"top":case"bottom":return o?l?Gv:qv:l?qv:Gv;case"left":case"right":return l?I5:F5;default:return[]}}function W5(n,l,o,i){const c=$r(n);let d=J5(xa(n),o==="start",i);return c&&(d=d.map(m=>m+"-"+c),l&&(d=d.concat(d.map(sf)))),d}function Hs(n){const l=xa(n);return K5[l]+n.slice(l.length)}function eA(n){return{top:0,right:0,bottom:0,left:0,...n}}function Ky(n){return typeof n!="number"?eA(n):{top:n,right:n,bottom:n,left:n}}function Vs(n){const{x:l,y:o,width:i,height:c}=n;return{width:i,height:c,top:o,left:l,right:l+i,bottom:o+c,x:l,y:o}}function Pv(n,l,o){let{reference:i,floating:c}=n;const d=Qn(l),m=Pf(l),h=Gf(m),y=xa(l),p=d==="y",x=i.x+i.width/2-c.width/2,g=i.y+i.height/2-c.height/2,w=i[h]/2-c[h]/2;let N;switch(y){case"top":N={x,y:i.y-c.height};break;case"bottom":N={x,y:i.y+i.height};break;case"right":N={x:i.x+i.width,y:g};break;case"left":N={x:i.x-c.width,y:g};break;default:N={x:i.x,y:i.y}}switch($r(l)){case"start":N[m]-=w*(o&&p?-1:1);break;case"end":N[m]+=w*(o&&p?-1:1);break}return N}async function tA(n,l){var o;l===void 0&&(l={});const{x:i,y:c,platform:d,rects:m,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:g="floating",altBoundary:w=!1,padding:N=0}=ba(l,n),T=Ky(N),C=h[w?g==="floating"?"reference":"floating":g],A=Vs(await d.getClippingRect({element:(o=await(d.isElement==null?void 0:d.isElement(C)))==null||o?C:C.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:y})),j=g==="floating"?{x:i,y:c,width:m.floating.width,height:m.floating.height}:m.reference,O=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),z=await(d.isElement==null?void 0:d.isElement(O))?await(d.getScale==null?void 0:d.getScale(O))||{x:1,y:1}:{x:1,y:1},B=Vs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:O,strategy:y}):j);return{top:(A.top-B.top+T.top)/z.y,bottom:(B.bottom-A.bottom+T.bottom)/z.y,left:(A.left-B.left+T.left)/z.x,right:(B.right-A.right+T.right)/z.x}}const nA=50,aA=async(n,l,o)=>{const{placement:i="bottom",strategy:c="absolute",middleware:d=[],platform:m}=o,h=m.detectOverflow?m:{...m,detectOverflow:tA},y=await(m.isRTL==null?void 0:m.isRTL(l));let p=await m.getElementRects({reference:n,floating:l,strategy:c}),{x,y:g}=Pv(p,i,y),w=i,N=0;const T={};for(let E=0;E<d.length;E++){const C=d[E];if(!C)continue;const{name:A,fn:j}=C,{x:O,y:z,data:B,reset:G}=await j({x,y:g,initialPlacement:i,placement:w,strategy:c,middlewareData:T,rects:p,platform:h,elements:{reference:n,floating:l}});x=O??x,g=z??g,T[A]={...T[A],...B},G&&N<nA&&(N++,typeof G=="object"&&(G.placement&&(w=G.placement),G.rects&&(p=G.rects===!0?await m.getElementRects({reference:n,floating:l,strategy:c}):G.rects),{x,y:g}=Pv(p,w,y)),E=-1)}return{x,y:g,placement:w,strategy:c,middlewareData:T}},lA=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:c,rects:d,platform:m,elements:h,middlewareData:y}=l,{element:p,padding:x=0}=ba(n,l)||{};if(p==null)return{};const g=Ky(x),w={x:o,y:i},N=Pf(c),T=Gf(N),E=await m.getDimensions(p),C=N==="y",A=C?"top":"left",j=C?"bottom":"right",O=C?"clientHeight":"clientWidth",z=d.reference[T]+d.reference[N]-w[N]-d.floating[T],B=w[N]-d.reference[N],G=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let $=G?G[O]:0;(!$||!await(m.isElement==null?void 0:m.isElement(G)))&&($=h.floating[O]||d.floating[T]);const V=z/2-B/2,ne=$/2-E[T]/2-1,le=el(g[A],ne),fe=el(g[j],ne),me=le,ie=$-E[T]-fe,ue=$/2-E[T]/2+V,oe=of(me,ue,ie),M=!y.arrow&&$r(c)!=null&&ue!==oe&&d.reference[T]/2-(ue<me?le:fe)-E[T]/2<0,Y=M?ue<me?ue-me:ue-ie:0;return{[N]:w[N]+Y,data:{[N]:oe,centerOffset:ue-oe-Y,...M&&{alignmentOffset:Y}},reset:M}}}),rA=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:c,middlewareData:d,rects:m,initialPlacement:h,platform:y,elements:p}=l,{mainAxis:x=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:N="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:E=!0,...C}=ba(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const A=xa(c),j=Qn(h),O=xa(h)===h,z=await(y.isRTL==null?void 0:y.isRTL(p.floating)),B=w||(O||!E?[Hs(h)]:Z5(h)),G=T!=="none";!w&&G&&B.push(...W5(h,E,T,z));const $=[h,...B],V=await y.detectOverflow(l,C),ne=[];let le=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&ne.push(V[A]),g){const ue=Q5(c,m,z);ne.push(V[ue[0]],V[ue[1]])}if(le=[...le,{placement:c,overflows:ne}],!ne.every(ue=>ue<=0)){var fe,me;const ue=(((fe=d.flip)==null?void 0:fe.index)||0)+1,oe=$[ue];if(oe&&(!(g==="alignment"?j!==Qn(oe):!1)||le.every(I=>Qn(I.placement)===j?I.overflows[0]>0:!0)))return{data:{index:ue,overflows:le},reset:{placement:oe}};let M=(me=le.filter(Y=>Y.overflows[0]<=0).sort((Y,I)=>Y.overflows[1]-I.overflows[1])[0])==null?void 0:me.placement;if(!M)switch(N){case"bestFit":{var ie;const Y=(ie=le.filter(I=>{if(G){const de=Qn(I.placement);return de===j||de==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(de=>de>0).reduce((de,F)=>de+F,0)]).sort((I,de)=>I[1]-de[1])[0])==null?void 0:ie[0];Y&&(M=Y);break}case"initialPlacement":M=h;break}if(c!==M)return{reset:{placement:M}}}return{}}}};function Xv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function Kv(n){return X5.some(l=>n[l]>=0)}const oA=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:c="referenceHidden",...d}=ba(n,l);switch(c){case"referenceHidden":{const m=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=Xv(m,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Kv(h)}}}case"escaped":{const m=await i.detectOverflow(l,{...d,altBoundary:!0}),h=Xv(m,o.floating);return{data:{escapedOffsets:h,escaped:Kv(h)}}}default:return{}}}}},Qy=new Set(["left","top"]);async function iA(n,l){const{placement:o,platform:i,elements:c}=n,d=await(i.isRTL==null?void 0:i.isRTL(c.floating)),m=xa(o),h=$r(o),y=Qn(o)==="y",p=Qy.has(m)?-1:1,x=d&&y?-1:1,g=ba(l,n);let{mainAxis:w,crossAxis:N,alignmentAxis:T}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return h&&typeof T=="number"&&(N=h==="end"?T*-1:T),y?{x:N*x,y:w*p}:{x:w*p,y:N*x}}const sA=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:c,y:d,placement:m,middlewareData:h}=l,y=await iA(l,n);return m===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:c+y.x,y:d+y.y,data:{...y,placement:m}}}}},cA=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:c,platform:d}=l,{mainAxis:m=!0,crossAxis:h=!1,limiter:y={fn:A=>{let{x:j,y:O}=A;return{x:j,y:O}}},...p}=ba(n,l),x={x:o,y:i},g=await d.detectOverflow(l,p),w=Qn(xa(c)),N=qf(w);let T=x[N],E=x[w];if(m){const A=N==="y"?"top":"left",j=N==="y"?"bottom":"right",O=T+g[A],z=T-g[j];T=of(O,T,z)}if(h){const A=w==="y"?"top":"left",j=w==="y"?"bottom":"right",O=E+g[A],z=E-g[j];E=of(O,E,z)}const C=y.fn({...l,[N]:T,[w]:E});return{...C,data:{x:C.x-o,y:C.y-i,enabled:{[N]:m,[w]:h}}}}}},uA=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:c,rects:d,middlewareData:m}=l,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=ba(n,l),x={x:o,y:i},g=Qn(c),w=qf(g);let N=x[w],T=x[g];const E=ba(h,l),C=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(y){const O=w==="y"?"height":"width",z=d.reference[w]-d.floating[O]+C.mainAxis,B=d.reference[w]+d.reference[O]-C.mainAxis;N<z?N=z:N>B&&(N=B)}if(p){var A,j;const O=w==="y"?"width":"height",z=Qy.has(xa(c)),B=d.reference[g]-d.floating[O]+(z&&((A=m.offset)==null?void 0:A[g])||0)+(z?0:C.crossAxis),G=d.reference[g]+d.reference[O]+(z?0:((j=m.offset)==null?void 0:j[g])||0)-(z?C.crossAxis:0);T<B?T=B:T>G&&(T=G)}return{[w]:N,[g]:T}}}},dA=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:c,rects:d,platform:m,elements:h}=l,{apply:y=()=>{},...p}=ba(n,l),x=await m.detectOverflow(l,p),g=xa(c),w=$r(c),N=Qn(c)==="y",{width:T,height:E}=d.floating;let C,A;g==="top"||g==="bottom"?(C=g,A=w===(await(m.isRTL==null?void 0:m.isRTL(h.floating))?"start":"end")?"left":"right"):(A=g,C=w==="end"?"top":"bottom");const j=E-x.top-x.bottom,O=T-x.left-x.right,z=el(E-x[C],j),B=el(T-x[A],O),G=!l.middlewareData.shift;let $=z,V=B;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(V=O),(i=l.middlewareData.shift)!=null&&i.enabled.y&&($=j),G&&!w){const le=ln(x.left,0),fe=ln(x.right,0),me=ln(x.top,0),ie=ln(x.bottom,0);N?V=T-2*(le!==0||fe!==0?le+fe:ln(x.left,x.right)):$=E-2*(me!==0||ie!==0?me+ie:ln(x.top,x.bottom))}await y({...l,availableWidth:V,availableHeight:$});const ne=await m.getDimensions(h.floating);return T!==ne.width||E!==ne.height?{reset:{rects:!0}}:{}}}};function lc(){return typeof window<"u"}function Yr(n){return Zy(n)?(n.nodeName||"").toLowerCase():"#document"}function rn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function Jn(n){var l;return(l=(Zy(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function Zy(n){return lc()?n instanceof Node||n instanceof rn(n).Node:!1}function An(n){return lc()?n instanceof Element||n instanceof rn(n).Element:!1}function Sa(n){return lc()?n instanceof HTMLElement||n instanceof rn(n).HTMLElement:!1}function Qv(n){return!lc()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof rn(n).ShadowRoot}function Wo(n){const{overflow:l,overflowX:o,overflowY:i,display:c}=Rn(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&c!=="inline"&&c!=="contents"}function fA(n){return/^(table|td|th)$/.test(Yr(n))}function rc(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const mA=/transform|translate|scale|rotate|perspective|filter/,hA=/paint|layout|strict|content/,Rl=n=>!!n&&n!=="none";let Yd;function Xf(n){const l=An(n)?Rn(n):n;return Rl(l.transform)||Rl(l.translate)||Rl(l.scale)||Rl(l.rotate)||Rl(l.perspective)||!Kf()&&(Rl(l.backdropFilter)||Rl(l.filter))||mA.test(l.willChange||"")||hA.test(l.contain||"")}function pA(n){let l=tl(n);for(;Sa(l)&&!zr(l);){if(Xf(l))return l;if(rc(l))return null;l=tl(l)}return null}function Kf(){return Yd==null&&(Yd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yd}function zr(n){return/^(html|body|#document)$/.test(Yr(n))}function Rn(n){return rn(n).getComputedStyle(n)}function oc(n){return An(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tl(n){if(Yr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Qv(n)&&n.host||Jn(n);return Qv(l)?l.host:l}function Iy(n){const l=tl(n);return zr(l)?n.ownerDocument?n.ownerDocument.body:n.body:Sa(l)&&Wo(l)?l:Iy(l)}function Zo(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const c=Iy(n),d=c===((i=n.ownerDocument)==null?void 0:i.body),m=rn(c);if(d){const h=cf(m);return l.concat(m,m.visualViewport||[],Wo(c)?c:[],h&&o?Zo(h):[])}else return l.concat(c,Zo(c,[],o))}function cf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Fy(n){const l=Rn(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const c=Sa(n),d=c?n.offsetWidth:o,m=c?n.offsetHeight:i,h=Bs(o)!==d||Bs(i)!==m;return h&&(o=d,i=m),{width:o,height:i,$:h}}function Qf(n){return An(n)?n:n.contextElement}function Or(n){const l=Qf(n);if(!Sa(l))return In(1);const o=l.getBoundingClientRect(),{width:i,height:c,$:d}=Fy(l);let m=(d?Bs(o.width):o.width)/i,h=(d?Bs(o.height):o.height)/c;return(!m||!Number.isFinite(m))&&(m=1),(!h||!Number.isFinite(h))&&(h=1),{x:m,y:h}}const gA=In(0);function Jy(n){const l=rn(n);return!Kf()||!l.visualViewport?gA:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function vA(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==rn(n)?!1:l}function Ol(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const c=n.getBoundingClientRect(),d=Qf(n);let m=In(1);l&&(i?An(i)&&(m=Or(i)):m=Or(n));const h=vA(d,o,i)?Jy(d):In(0);let y=(c.left+h.x)/m.x,p=(c.top+h.y)/m.y,x=c.width/m.x,g=c.height/m.y;if(d){const w=rn(d),N=i&&An(i)?rn(i):i;let T=w,E=cf(T);for(;E&&i&&N!==T;){const C=Or(E),A=E.getBoundingClientRect(),j=Rn(E),O=A.left+(E.clientLeft+parseFloat(j.paddingLeft))*C.x,z=A.top+(E.clientTop+parseFloat(j.paddingTop))*C.y;y*=C.x,p*=C.y,x*=C.x,g*=C.y,y+=O,p+=z,T=rn(E),E=cf(T)}}return Vs({width:x,height:g,x:y,y:p})}function ic(n,l){const o=oc(n).scrollLeft;return l?l.left+o:Ol(Jn(n)).left+o}function Wy(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-ic(n,o),c=o.top+l.scrollTop;return{x:i,y:c}}function yA(n){let{elements:l,rect:o,offsetParent:i,strategy:c}=n;const d=c==="fixed",m=Jn(i),h=l?rc(l.floating):!1;if(i===m||h&&d)return o;let y={scrollLeft:0,scrollTop:0},p=In(1);const x=In(0),g=Sa(i);if((g||!g&&!d)&&((Yr(i)!=="body"||Wo(m))&&(y=oc(i)),g)){const N=Ol(i);p=Or(i),x.x=N.x+i.clientLeft,x.y=N.y+i.clientTop}const w=m&&!g&&!d?Wy(m,y):In(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-y.scrollLeft*p.x+x.x+w.x,y:o.y*p.y-y.scrollTop*p.y+x.y+w.y}}function bA(n){return Array.from(n.getClientRects())}function xA(n){const l=Jn(n),o=oc(n),i=n.ownerDocument.body,c=ln(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=ln(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let m=-o.scrollLeft+ic(n);const h=-o.scrollTop;return Rn(i).direction==="rtl"&&(m+=ln(l.clientWidth,i.clientWidth)-c),{width:c,height:d,x:m,y:h}}const Zv=25;function SA(n,l){const o=rn(n),i=Jn(n),c=o.visualViewport;let d=i.clientWidth,m=i.clientHeight,h=0,y=0;if(c){d=c.width,m=c.height;const x=Kf();(!x||x&&l==="fixed")&&(h=c.offsetLeft,y=c.offsetTop)}const p=ic(i);if(p<=0){const x=i.ownerDocument,g=x.body,w=getComputedStyle(g),N=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,T=Math.abs(i.clientWidth-g.clientWidth-N);T<=Zv&&(d-=T)}else p<=Zv&&(d+=p);return{width:d,height:m,x:h,y}}function wA(n,l){const o=Ol(n,!0,l==="fixed"),i=o.top+n.clientTop,c=o.left+n.clientLeft,d=Sa(n)?Or(n):In(1),m=n.clientWidth*d.x,h=n.clientHeight*d.y,y=c*d.x,p=i*d.y;return{width:m,height:h,x:y,y:p}}function Iv(n,l,o){let i;if(l==="viewport")i=SA(n,o);else if(l==="document")i=xA(Jn(n));else if(An(l))i=wA(l,o);else{const c=Jy(n);i={x:l.x-c.x,y:l.y-c.y,width:l.width,height:l.height}}return Vs(i)}function eb(n,l){const o=tl(n);return o===l||!An(o)||zr(o)?!1:Rn(o).position==="fixed"||eb(o,l)}function EA(n,l){const o=l.get(n);if(o)return o;let i=Zo(n,[],!1).filter(h=>An(h)&&Yr(h)!=="body"),c=null;const d=Rn(n).position==="fixed";let m=d?tl(n):n;for(;An(m)&&!zr(m);){const h=Rn(m),y=Xf(m);!y&&h.position==="fixed"&&(c=null),(d?!y&&!c:!y&&h.position==="static"&&!!c&&(c.position==="absolute"||c.position==="fixed")||Wo(m)&&!y&&eb(n,m))?i=i.filter(x=>x!==m):c=h,m=tl(m)}return l.set(n,i),i}function NA(n){let{element:l,boundary:o,rootBoundary:i,strategy:c}=n;const m=[...o==="clippingAncestors"?rc(l)?[]:EA(l,this._c):[].concat(o),i],h=Iv(l,m[0],c);let y=h.top,p=h.right,x=h.bottom,g=h.left;for(let w=1;w<m.length;w++){const N=Iv(l,m[w],c);y=ln(N.top,y),p=el(N.right,p),x=el(N.bottom,x),g=ln(N.left,g)}return{width:p-g,height:x-y,x:g,y}}function TA(n){const{width:l,height:o}=Fy(n);return{width:l,height:o}}function CA(n,l,o){const i=Sa(l),c=Jn(l),d=o==="fixed",m=Ol(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const y=In(0);function p(){y.x=ic(c)}if(i||!i&&!d)if((Yr(l)!=="body"||Wo(c))&&(h=oc(l)),i){const N=Ol(l,!0,d,l);y.x=N.x+l.clientLeft,y.y=N.y+l.clientTop}else c&&p();d&&!i&&c&&p();const x=c&&!i&&!d?Wy(c,h):In(0),g=m.left+h.scrollLeft-y.x-x.x,w=m.top+h.scrollTop-y.y-x.y;return{x:g,y:w,width:m.width,height:m.height}}function qd(n){return Rn(n).position==="static"}function Fv(n,l){if(!Sa(n)||Rn(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return Jn(n)===o&&(o=o.ownerDocument.body),o}function tb(n,l){const o=rn(n);if(rc(n))return o;if(!Sa(n)){let c=tl(n);for(;c&&!zr(c);){if(An(c)&&!qd(c))return c;c=tl(c)}return o}let i=Fv(n,l);for(;i&&fA(i)&&qd(i);)i=Fv(i,l);return i&&zr(i)&&qd(i)&&!Xf(i)?o:i||pA(n)||o}const AA=async function(n){const l=this.getOffsetParent||tb,o=this.getDimensions,i=await o(n.floating);return{reference:CA(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function RA(n){return Rn(n).direction==="rtl"}const _A={convertOffsetParentRelativeRectToViewportRelativeRect:yA,getDocumentElement:Jn,getClippingRect:NA,getOffsetParent:tb,getElementRects:AA,getClientRects:bA,getDimensions:TA,getScale:Or,isElement:An,isRTL:RA};function nb(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function jA(n,l){let o=null,i;const c=Jn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function m(h,y){h===void 0&&(h=!1),y===void 0&&(y=1),d();const p=n.getBoundingClientRect(),{left:x,top:g,width:w,height:N}=p;if(h||l(),!w||!N)return;const T=Es(g),E=Es(c.clientWidth-(x+w)),C=Es(c.clientHeight-(g+N)),A=Es(x),O={rootMargin:-T+"px "+-E+"px "+-C+"px "+-A+"px",threshold:ln(0,el(1,y))||1};let z=!0;function B(G){const $=G[0].intersectionRatio;if($!==y){if(!z)return m();$?m(!1,$):i=setTimeout(()=>{m(!1,1e-7)},1e3)}$===1&&!nb(p,n.getBoundingClientRect())&&m(),z=!1}try{o=new IntersectionObserver(B,{...O,root:c.ownerDocument})}catch{o=new IntersectionObserver(B,O)}o.observe(n)}return m(!0),d}function MA(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=Qf(n),x=c||d?[...p?Zo(p):[],...l?Zo(l):[]]:[];x.forEach(A=>{c&&A.addEventListener("scroll",o,{passive:!0}),d&&A.addEventListener("resize",o)});const g=p&&h?jA(p,o):null;let w=-1,N=null;m&&(N=new ResizeObserver(A=>{let[j]=A;j&&j.target===p&&N&&l&&(N.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=N)==null||O.observe(l)})),o()}),p&&!y&&N.observe(p),l&&N.observe(l));let T,E=y?Ol(n):null;y&&C();function C(){const A=Ol(n);E&&!nb(E,A)&&o(),E=A,T=requestAnimationFrame(C)}return o(),()=>{var A;x.forEach(j=>{c&&j.removeEventListener("scroll",o),d&&j.removeEventListener("resize",o)}),g==null||g(),(A=N)==null||A.disconnect(),N=null,y&&cancelAnimationFrame(T)}}const OA=sA,DA=cA,kA=rA,zA=dA,LA=oA,Jv=lA,UA=uA,BA=(n,l,o)=>{const i=new Map,c={platform:_A,...o},d={...c.platform,_c:i};return aA(n,l,{...c,platform:d})};var HA=typeof document<"u",VA=function(){},_s=HA?v.useLayoutEffect:VA;function $s(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,i,c;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(i=o;i--!==0;)if(!$s(n[i],l[i]))return!1;return!0}if(c=Object.keys(n),o=c.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,c[i]))return!1;for(i=o;i--!==0;){const d=c[i];if(!(d==="_owner"&&n.$$typeof)&&!$s(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function ab(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Wv(n,l){const o=ab(n);return Math.round(l*o)/o}function Gd(n){const l=v.useRef(n);return _s(()=>{l.current=n}),l}function $A(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:c,elements:{reference:d,floating:m}={},transform:h=!0,whileElementsMounted:y,open:p}=n,[x,g]=v.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[w,N]=v.useState(i);$s(w,i)||N(i);const[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useCallback(I=>{I!==G.current&&(G.current=I,E(I))},[]),O=v.useCallback(I=>{I!==$.current&&($.current=I,A(I))},[]),z=d||T,B=m||C,G=v.useRef(null),$=v.useRef(null),V=v.useRef(x),ne=y!=null,le=Gd(y),fe=Gd(c),me=Gd(p),ie=v.useCallback(()=>{if(!G.current||!$.current)return;const I={placement:l,strategy:o,middleware:w};fe.current&&(I.platform=fe.current),BA(G.current,$.current,I).then(de=>{const F={...de,isPositioned:me.current!==!1};ue.current&&!$s(V.current,F)&&(V.current=F,Jo.flushSync(()=>{g(F)}))})},[w,l,o,fe,me]);_s(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,g(I=>({...I,isPositioned:!1})))},[p]);const ue=v.useRef(!1);_s(()=>(ue.current=!0,()=>{ue.current=!1}),[]),_s(()=>{if(z&&(G.current=z),B&&($.current=B),z&&B){if(le.current)return le.current(z,B,ie);ie()}},[z,B,ie,le,ne]);const oe=v.useMemo(()=>({reference:G,floating:$,setReference:j,setFloating:O}),[j,O]),M=v.useMemo(()=>({reference:z,floating:B}),[z,B]),Y=v.useMemo(()=>{const I={position:o,left:0,top:0};if(!M.floating)return I;const de=Wv(M.floating,x.x),F=Wv(M.floating,x.y);return h?{...I,transform:"translate("+de+"px, "+F+"px)",...ab(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:de,top:F}},[o,h,M.floating,x.x,x.y]);return v.useMemo(()=>({...x,update:ie,refs:oe,elements:M,floatingStyles:Y}),[x,ie,oe,M,Y])}const YA=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:c}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?Jv({element:i.current,padding:c}).fn(o):{}:i?Jv({element:i,padding:c}).fn(o):{}}}},qA=(n,l)=>{const o=OA(n);return{name:o.name,fn:o.fn,options:[n,l]}},GA=(n,l)=>{const o=DA(n);return{name:o.name,fn:o.fn,options:[n,l]}},PA=(n,l)=>({fn:UA(n).fn,options:[n,l]}),XA=(n,l)=>{const o=kA(n);return{name:o.name,fn:o.fn,options:[n,l]}},KA=(n,l)=>{const o=zA(n);return{name:o.name,fn:o.fn,options:[n,l]}},QA=(n,l)=>{const o=LA(n);return{name:o.name,fn:o.fn,options:[n,l]}},ZA=(n,l)=>{const o=YA(n);return{name:o.name,fn:o.fn,options:[n,l]}};var IA="Arrow",lb=v.forwardRef((n,l)=>{const{children:o,width:i=10,height:c=5,...d}=n;return f.jsx(Ue.svg,{...d,ref:l,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});lb.displayName=IA;var FA=lb;function rb(n){const[l,o]=v.useState(void 0);return zt(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const d=c[0];let m,h;if("borderBoxSize"in d){const y=d.borderBoxSize,p=Array.isArray(y)?y[0]:y;m=p.inlineSize,h=p.blockSize}else m=n.offsetWidth,h=n.offsetHeight;o({width:m,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var Zf="Popper",[ob,ib]=al(Zf),[JA,sb]=ob(Zf),cb=n=>{const{__scopePopper:l,children:o}=n,[i,c]=v.useState(null);return f.jsx(JA,{scope:l,anchor:i,onAnchorChange:c,children:o})};cb.displayName=Zf;var ub="PopperAnchor",db=v.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...c}=n,d=sb(ub,o),m=v.useRef(null),h=tt(l,m),y=v.useRef(null);return v.useEffect(()=>{const p=y.current;y.current=(i==null?void 0:i.current)||m.current,p!==y.current&&d.onAnchorChange(y.current)}),i?null:f.jsx(Ue.div,{...c,ref:h})});db.displayName=ub;var If="PopperContent",[WA,eR]=ob(If),fb=v.forwardRef((n,l)=>{var ee,ce,J,ve,be,Se;const{__scopePopper:o,side:i="bottom",sideOffset:c=0,align:d="center",alignOffset:m=0,arrowPadding:h=0,avoidCollisions:y=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:N="optimized",onPlaced:T,...E}=n,C=sb(If,o),[A,j]=v.useState(null),O=tt(l,He=>j(He)),[z,B]=v.useState(null),G=rb(z),$=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ne=i+(d!=="center"?"-"+d:""),le=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},fe=Array.isArray(p)?p:[p],me=fe.length>0,ie={padding:le,boundary:fe.filter(nR),altBoundary:me},{refs:ue,floatingStyles:oe,placement:M,isPositioned:Y,middlewareData:I}=$A({strategy:"fixed",placement:ne,whileElementsMounted:(...He)=>MA(...He,{animationFrame:N==="always"}),elements:{reference:C.anchor},middleware:[qA({mainAxis:c+V,alignmentAxis:m}),y&&GA({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?PA():void 0,...ie}),y&&XA({...ie}),KA({...ie,apply:({elements:He,rects:je,availableWidth:Ve,availableHeight:dt})=>{const{width:Pe,height:Lt}=je.reference,ht=He.floating.style;ht.setProperty("--radix-popper-available-width",`${Ve}px`),ht.setProperty("--radix-popper-available-height",`${dt}px`),ht.setProperty("--radix-popper-anchor-width",`${Pe}px`),ht.setProperty("--radix-popper-anchor-height",`${Lt}px`)}}),z&&ZA({element:z,padding:h}),aR({arrowWidth:$,arrowHeight:V}),w&&QA({strategy:"referenceHidden",...ie})]}),[de,F]=pb(M),R=Wa(T);zt(()=>{Y&&(R==null||R())},[Y,R]);const P=(ee=I.arrow)==null?void 0:ee.x,K=(ce=I.arrow)==null?void 0:ce.y,W=((J=I.arrow)==null?void 0:J.centerOffset)!==0,[te,se]=v.useState();return zt(()=>{A&&se(window.getComputedStyle(A).zIndex)},[A]),f.jsx("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:Y?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(ve=I.transformOrigin)==null?void 0:ve.x,(be=I.transformOrigin)==null?void 0:be.y].join(" "),...((Se=I.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:f.jsx(WA,{scope:o,placedSide:de,onArrowChange:B,arrowX:P,arrowY:K,shouldHideArrow:W,children:f.jsx(Ue.div,{"data-side":de,"data-align":F,...E,ref:O,style:{...E.style,animation:Y?void 0:"none"}})})})});fb.displayName=If;var mb="PopperArrow",tR={top:"bottom",right:"left",bottom:"top",left:"right"},hb=v.forwardRef(function(l,o){const{__scopePopper:i,...c}=l,d=eR(mb,i),m=tR[d.placedSide];return f.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:f.jsx(FA,{...c,ref:o,style:{...c.style,display:"block"}})})});hb.displayName=mb;function nR(n){return n!==null}var aR=n=>({name:"transformOrigin",options:n,fn(l){var C,A,j;const{placement:o,rects:i,middlewareData:c}=l,m=((C=c.arrow)==null?void 0:C.centerOffset)!==0,h=m?0:n.arrowWidth,y=m?0:n.arrowHeight,[p,x]=pb(o),g={start:"0%",center:"50%",end:"100%"}[x],w=(((A=c.arrow)==null?void 0:A.x)??0)+h/2,N=(((j=c.arrow)==null?void 0:j.y)??0)+y/2;let T="",E="";return p==="bottom"?(T=m?g:`${w}px`,E=`${-y}px`):p==="top"?(T=m?g:`${w}px`,E=`${i.floating.height+y}px`):p==="right"?(T=`${-y}px`,E=m?g:`${N}px`):p==="left"&&(T=`${i.floating.width+y}px`,E=m?g:`${N}px`),{data:{x:T,y:E}}}});function pb(n){const[l,o="center"]=n.split("-");return[l,o]}var lR=cb,rR=db,oR=fb,iR=hb;function gb(n){const l=v.useRef({value:n,previous:n});return v.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}var vb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),sR="VisuallyHidden",cR=v.forwardRef((n,l)=>f.jsx(Ue.span,{...n,ref:l,style:{...vb,...n.style}}));cR.displayName=sR;var uR=[" ","Enter","ArrowUp","ArrowDown"],dR=[" ","Enter"],Dl="Select",[sc,cc,fR]=Xy(Dl),[qr]=al(Dl,[fR,ib]),uc=ib(),[mR,ll]=qr(Dl),[hR,pR]=qr(Dl),yb=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:c,onOpenChange:d,value:m,defaultValue:h,onValueChange:y,dir:p,name:x,autoComplete:g,disabled:w,required:N,form:T}=n,E=uc(l),[C,A]=v.useState(null),[j,O]=v.useState(null),[z,B]=v.useState(!1),G=Yf(p),[$,V]=kr({prop:i,defaultProp:c??!1,onChange:d,caller:Dl}),[ne,le]=kr({prop:m,defaultProp:h,onChange:y,caller:Dl}),fe=v.useRef(null),me=C?T||!!C.closest("form"):!0,[ie,ue]=v.useState(new Set),oe=Array.from(ie).map(M=>M.props.value).join(";");return f.jsx(lR,{...E,children:f.jsxs(mR,{required:N,scope:l,trigger:C,onTriggerChange:A,valueNode:j,onValueNodeChange:O,valueNodeHasChildren:z,onValueNodeHasChildrenChange:B,contentId:Fa(),value:ne,onValueChange:le,open:$,onOpenChange:V,dir:G,triggerPointerDownPosRef:fe,disabled:w,children:[f.jsx(sc.Provider,{scope:l,children:f.jsx(hR,{scope:n.__scopeSelect,onNativeOptionAdd:v.useCallback(M=>{ue(Y=>new Set(Y).add(M))},[]),onNativeOptionRemove:v.useCallback(M=>{ue(Y=>{const I=new Set(Y);return I.delete(M),I})},[]),children:o})}),me?f.jsxs(Yb,{"aria-hidden":!0,required:N,tabIndex:-1,name:x,autoComplete:g,value:ne,onChange:M=>le(M.target.value),disabled:w,form:T,children:[ne===void 0?f.jsx("option",{value:""}):null,Array.from(ie)]},oe):null]})})};yb.displayName=Dl;var bb="SelectTrigger",xb=v.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...c}=n,d=uc(o),m=ll(bb,o),h=m.disabled||i,y=tt(l,m.onTriggerChange),p=cc(o),x=v.useRef("touch"),[g,w,N]=Gb(E=>{const C=p().filter(O=>!O.disabled),A=C.find(O=>O.value===m.value),j=Pb(C,E,A);j!==void 0&&m.onValueChange(j.value)}),T=E=>{h||(m.onOpenChange(!0),N()),E&&(m.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return f.jsx(rR,{asChild:!0,...d,children:f.jsx(Ue.button,{type:"button",role:"combobox","aria-controls":m.contentId,"aria-expanded":m.open,"aria-required":m.required,"aria-autocomplete":"none",dir:m.dir,"data-state":m.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":qb(m.value)?"":void 0,...c,ref:y,onClick:De(c.onClick,E=>{E.currentTarget.focus(),x.current!=="mouse"&&T(E)}),onPointerDown:De(c.onPointerDown,E=>{x.current=E.pointerType;const C=E.target;C.hasPointerCapture(E.pointerId)&&C.releasePointerCapture(E.pointerId),E.button===0&&E.ctrlKey===!1&&E.pointerType==="mouse"&&(T(E),E.preventDefault())}),onKeyDown:De(c.onKeyDown,E=>{const C=g.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&w(E.key),!(C&&E.key===" ")&&uR.includes(E.key)&&(T(),E.preventDefault())})})})});xb.displayName=bb;var Sb="SelectValue",wb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:c,children:d,placeholder:m="",...h}=n,y=ll(Sb,o),{onValueNodeHasChildrenChange:p}=y,x=d!==void 0,g=tt(l,y.onValueNodeChange);return zt(()=>{p(x)},[p,x]),f.jsx(Ue.span,{...h,ref:g,style:{pointerEvents:"none"},children:qb(y.value)?f.jsx(f.Fragment,{children:m}):d})});wb.displayName=Sb;var gR="SelectIcon",Eb=v.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...c}=n;return f.jsx(Ue.span,{"aria-hidden":!0,...c,ref:l,children:i||"▼"})});Eb.displayName=gR;var vR="SelectPortal",Nb=n=>f.jsx(Df,{asChild:!0,...n});Nb.displayName=vR;var kl="SelectContent",Tb=v.forwardRef((n,l)=>{const o=ll(kl,n.__scopeSelect),[i,c]=v.useState();if(zt(()=>{c(new DocumentFragment)},[]),!o.open){const d=i;return d?Jo.createPortal(f.jsx(Cb,{scope:n.__scopeSelect,children:f.jsx(sc.Slot,{scope:n.__scopeSelect,children:f.jsx("div",{children:n.children})})}),d):null}return f.jsx(Ab,{...n,ref:l})});Tb.displayName=kl;var Tn=10,[Cb,rl]=qr(kl),yR="SelectContentImpl",bR=Qo("SelectContent.RemoveScroll"),Ab=v.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:d,onPointerDownOutside:m,side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C,...A}=n,j=ll(kl,o),[O,z]=v.useState(null),[B,G]=v.useState(null),$=tt(l,ee=>z(ee)),[V,ne]=v.useState(null),[le,fe]=v.useState(null),me=cc(o),[ie,ue]=v.useState(!1),oe=v.useRef(!1);v.useEffect(()=>{if(O)return xy(O)},[O]),dy();const M=v.useCallback(ee=>{const[ce,...J]=me().map(Se=>Se.ref.current),[ve]=J.slice(-1),be=document.activeElement;for(const Se of ee)if(Se===be||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ce&&B&&(B.scrollTop=0),Se===ve&&B&&(B.scrollTop=B.scrollHeight),Se==null||Se.focus(),document.activeElement!==be))return},[me,B]),Y=v.useCallback(()=>M([V,O]),[M,V,O]);v.useEffect(()=>{ie&&Y()},[ie,Y]);const{onOpenChange:I,triggerPointerDownPosRef:de}=j;v.useEffect(()=>{if(O){let ee={x:0,y:0};const ce=ve=>{var be,Se;ee={x:Math.abs(Math.round(ve.pageX)-(((be=de.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(ve.pageY)-(((Se=de.current)==null?void 0:Se.y)??0))}},J=ve=>{ee.x<=10&&ee.y<=10?ve.preventDefault():O.contains(ve.target)||I(!1),document.removeEventListener("pointermove",ce),de.current=null};return de.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",J,{capture:!0})}}},[O,I,de]),v.useEffect(()=>{const ee=()=>I(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[I]);const[F,R]=Gb(ee=>{const ce=me().filter(be=>!be.disabled),J=ce.find(be=>be.ref.current===document.activeElement),ve=Pb(ce,ee,J);ve&&setTimeout(()=>ve.ref.current.focus())}),P=v.useCallback((ee,ce,J)=>{const ve=!oe.current&&!J;(j.value!==void 0&&j.value===ce||ve)&&(ne(ee),ve&&(oe.current=!0))},[j.value]),K=v.useCallback(()=>O==null?void 0:O.focus(),[O]),W=v.useCallback((ee,ce,J)=>{const ve=!oe.current&&!J;(j.value!==void 0&&j.value===ce||ve)&&fe(ee)},[j.value]),te=i==="popper"?uf:Rb,se=te===uf?{side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C}:{};return f.jsx(Cb,{scope:o,content:O,viewport:B,onViewportChange:G,itemRefCallback:P,selectedItem:V,onItemLeave:K,itemTextRefCallback:W,focusSelectedItem:Y,selectedItemText:le,position:i,isPositioned:ie,searchRef:F,children:f.jsx(kf,{as:bR,allowPinchZoom:!0,children:f.jsx(Of,{asChild:!0,trapped:j.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:De(c,ee=>{var ce;(ce=j.trigger)==null||ce.focus({preventScroll:!0}),ee.preventDefault()}),children:f.jsx(Mf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:f.jsx(te,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:ee=>ee.preventDefault(),...A,...se,onPlaced:()=>ue(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:De(A.onKeyDown,ee=>{const ce=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ce&&ee.key.length===1&&R(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let ve=me().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(ve=ve.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const be=ee.target,Se=ve.indexOf(be);ve=ve.slice(Se+1)}setTimeout(()=>M(ve)),ee.preventDefault()}})})})})})})});Ab.displayName=yR;var xR="SelectItemAlignedPosition",Rb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...c}=n,d=ll(kl,o),m=rl(kl,o),[h,y]=v.useState(null),[p,x]=v.useState(null),g=tt(l,$=>x($)),w=cc(o),N=v.useRef(!1),T=v.useRef(!0),{viewport:E,selectedItem:C,selectedItemText:A,focusSelectedItem:j}=m,O=v.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&E&&C&&A){const $=d.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),ne=d.valueNode.getBoundingClientRect(),le=A.getBoundingClientRect();if(d.dir!=="rtl"){const be=le.left-V.left,Se=ne.left-be,He=$.left-Se,je=$.width+He,Ve=Math.max(je,V.width),dt=window.innerWidth-Tn,Pe=Yv(Se,[Tn,Math.max(Tn,dt-Ve)]);h.style.minWidth=je+"px",h.style.left=Pe+"px"}else{const be=V.right-le.right,Se=window.innerWidth-ne.right-be,He=window.innerWidth-$.right-Se,je=$.width+He,Ve=Math.max(je,V.width),dt=window.innerWidth-Tn,Pe=Yv(Se,[Tn,Math.max(Tn,dt-Ve)]);h.style.minWidth=je+"px",h.style.right=Pe+"px"}const fe=w(),me=window.innerHeight-Tn*2,ie=E.scrollHeight,ue=window.getComputedStyle(p),oe=parseInt(ue.borderTopWidth,10),M=parseInt(ue.paddingTop,10),Y=parseInt(ue.borderBottomWidth,10),I=parseInt(ue.paddingBottom,10),de=oe+M+ie+I+Y,F=Math.min(C.offsetHeight*5,de),R=window.getComputedStyle(E),P=parseInt(R.paddingTop,10),K=parseInt(R.paddingBottom,10),W=$.top+$.height/2-Tn,te=me-W,se=C.offsetHeight/2,ee=C.offsetTop+se,ce=oe+M+ee,J=de-ce;if(ce<=W){const be=fe.length>0&&C===fe[fe.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-E.offsetTop-E.offsetHeight,He=Math.max(te,se+(be?K:0)+Se+Y),je=ce+He;h.style.height=je+"px"}else{const be=fe.length>0&&C===fe[0].ref.current;h.style.top="0px";const He=Math.max(W,oe+E.offsetTop+(be?P:0)+se)+J;h.style.height=He+"px",E.scrollTop=ce-W+E.offsetTop}h.style.margin=`${Tn}px 0`,h.style.minHeight=F+"px",h.style.maxHeight=me+"px",i==null||i(),requestAnimationFrame(()=>N.current=!0)}},[w,d.trigger,d.valueNode,h,p,E,C,A,d.dir,i]);zt(()=>O(),[O]);const[z,B]=v.useState();zt(()=>{p&&B(window.getComputedStyle(p).zIndex)},[p]);const G=v.useCallback($=>{$&&T.current===!0&&(O(),j==null||j(),T.current=!1)},[O,j]);return f.jsx(wR,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:N,onScrollButtonChange:G,children:f.jsx("div",{ref:y,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:f.jsx(Ue.div,{...c,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});Rb.displayName=xR;var SR="SelectPopperPosition",uf=v.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:c=Tn,...d}=n,m=uc(o);return f.jsx(oR,{...m,...d,ref:l,align:i,collisionPadding:c,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uf.displayName=SR;var[wR,Ff]=qr(kl,{}),df="SelectViewport",_b=v.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...c}=n,d=rl(df,o),m=Ff(df,o),h=tt(l,d.onViewportChange),y=v.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(sc.Slot,{scope:o,children:f.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:De(c.onScroll,p=>{const x=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=m;if(w!=null&&w.current&&g){const N=Math.abs(y.current-x.scrollTop);if(N>0){const T=window.innerHeight-Tn*2,E=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),A=Math.max(E,C);if(A<T){const j=A+N,O=Math.min(T,j),z=j-O;g.style.height=O+"px",g.style.bottom==="0px"&&(x.scrollTop=z>0?z:0,g.style.justifyContent="flex-end")}}}y.current=x.scrollTop})})})]})});_b.displayName=df;var jb="SelectGroup",[ER,NR]=qr(jb),TR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=Fa();return f.jsx(ER,{scope:o,id:c,children:f.jsx(Ue.div,{role:"group","aria-labelledby":c,...i,ref:l})})});TR.displayName=jb;var Mb="SelectLabel",Ob=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=NR(Mb,o);return f.jsx(Ue.div,{id:c.id,...i,ref:l})});Ob.displayName=Mb;var Ys="SelectItem",[CR,Db]=qr(Ys),kb=v.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:d,...m}=n,h=ll(Ys,o),y=rl(Ys,o),p=h.value===i,[x,g]=v.useState(d??""),[w,N]=v.useState(!1),T=tt(l,j=>{var O;return(O=y.itemRefCallback)==null?void 0:O.call(y,j,i,c)}),E=Fa(),C=v.useRef("touch"),A=()=>{c||(h.onValueChange(i),h.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(CR,{scope:o,value:i,disabled:c,textId:E,isSelected:p,onItemTextChange:v.useCallback(j=>{g(O=>O||((j==null?void 0:j.textContent)??"").trim())},[]),children:f.jsx(sc.ItemSlot,{scope:o,value:i,disabled:c,textValue:x,children:f.jsx(Ue.div,{role:"option","aria-labelledby":E,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...m,ref:T,onFocus:De(m.onFocus,()=>N(!0)),onBlur:De(m.onBlur,()=>N(!1)),onClick:De(m.onClick,()=>{C.current!=="mouse"&&A()}),onPointerUp:De(m.onPointerUp,()=>{C.current==="mouse"&&A()}),onPointerDown:De(m.onPointerDown,j=>{C.current=j.pointerType}),onPointerMove:De(m.onPointerMove,j=>{var O;C.current=j.pointerType,c?(O=y.onItemLeave)==null||O.call(y):C.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:De(m.onPointerLeave,j=>{var O;j.currentTarget===document.activeElement&&((O=y.onItemLeave)==null||O.call(y))}),onKeyDown:De(m.onKeyDown,j=>{var z;((z=y.searchRef)==null?void 0:z.current)!==""&&j.key===" "||(dR.includes(j.key)&&A(),j.key===" "&&j.preventDefault())})})})})});kb.displayName=Ys;var qo="SelectItemText",zb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:c,...d}=n,m=ll(qo,o),h=rl(qo,o),y=Db(qo,o),p=pR(qo,o),[x,g]=v.useState(null),w=tt(l,A=>g(A),y.onItemTextChange,A=>{var j;return(j=h.itemTextRefCallback)==null?void 0:j.call(h,A,y.value,y.disabled)}),N=x==null?void 0:x.textContent,T=v.useMemo(()=>f.jsx("option",{value:y.value,disabled:y.disabled,children:N},y.value),[y.disabled,y.value,N]),{onNativeOptionAdd:E,onNativeOptionRemove:C}=p;return zt(()=>(E(T),()=>C(T)),[E,C,T]),f.jsxs(f.Fragment,{children:[f.jsx(Ue.span,{id:y.textId,...d,ref:w}),y.isSelected&&m.valueNode&&!m.valueNodeHasChildren?Jo.createPortal(d.children,m.valueNode):null]})});zb.displayName=qo;var Lb="SelectItemIndicator",Ub=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return Db(Lb,o).isSelected?f.jsx(Ue.span,{"aria-hidden":!0,...i,ref:l}):null});Ub.displayName=Lb;var ff="SelectScrollUpButton",Bb=v.forwardRef((n,l)=>{const o=rl(ff,n.__scopeSelect),i=Ff(ff,n.__scopeSelect),[c,d]=v.useState(!1),m=tt(l,i.onScrollButtonChange);return zt(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=y.scrollTop>0;d(p)};const y=o.viewport;return h(),y.addEventListener("scroll",h),()=>y.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),c?f.jsx(Vb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop-y.offsetHeight)}}):null});Bb.displayName=ff;var mf="SelectScrollDownButton",Hb=v.forwardRef((n,l)=>{const o=rl(mf,n.__scopeSelect),i=Ff(mf,n.__scopeSelect),[c,d]=v.useState(!1),m=tt(l,i.onScrollButtonChange);return zt(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=y.scrollHeight-y.clientHeight,x=Math.ceil(y.scrollTop)<p;d(x)};const y=o.viewport;return h(),y.addEventListener("scroll",h),()=>y.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),c?f.jsx(Vb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop+y.offsetHeight)}}):null});Hb.displayName=mf;var Vb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...c}=n,d=rl("SelectScrollButton",o),m=v.useRef(null),h=cc(o),y=v.useCallback(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null)},[]);return v.useEffect(()=>()=>y(),[y]),zt(()=>{var x;const p=h().find(g=>g.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[h]),f.jsx(Ue.div,{"aria-hidden":!0,...c,ref:l,style:{flexShrink:0,...c.style},onPointerDown:De(c.onPointerDown,()=>{m.current===null&&(m.current=window.setInterval(i,50))}),onPointerMove:De(c.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),m.current===null&&(m.current=window.setInterval(i,50))}),onPointerLeave:De(c.onPointerLeave,()=>{y()})})}),AR="SelectSeparator",$b=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return f.jsx(Ue.div,{"aria-hidden":!0,...i,ref:l})});$b.displayName=AR;var hf="SelectArrow",RR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=uc(o),d=ll(hf,o),m=rl(hf,o);return d.open&&m.position==="popper"?f.jsx(iR,{...c,...i,ref:l}):null});RR.displayName=hf;var _R="SelectBubbleInput",Yb=v.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const c=v.useRef(null),d=tt(i,c),m=gb(l);return v.useEffect(()=>{const h=c.current;if(!h)return;const y=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(y,"value").set;if(m!==l&&x){const g=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(g)}},[m,l]),f.jsx(Ue.select,{...o,style:{...vb,...o.style},ref:d,defaultValue:l})});Yb.displayName=_R;function qb(n){return n===""||n===void 0}function Gb(n){const l=Wa(n),o=v.useRef(""),i=v.useRef(0),c=v.useCallback(m=>{const h=o.current+m;l(h),(function y(p){o.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>y(""),1e3))})(h)},[l]),d=v.useCallback(()=>{o.current="",window.clearTimeout(i.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(i.current),[]),[o,c,d]}function Pb(n,l,o){const c=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let m=jR(n,Math.max(d,0));c.length===1&&(m=m.filter(p=>p!==o));const y=m.find(p=>p.textValue.toLowerCase().startsWith(c.toLowerCase()));return y!==o?y:void 0}function jR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var MR=yb,Xb=xb,OR=wb,DR=Eb,kR=Nb,Kb=Tb,zR=_b,Qb=Ob,Zb=kb,LR=zb,UR=Ub,Ib=Bb,Fb=Hb,Jb=$b;const Wb=MR,ex=OR,Jf=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Xb,{ref:i,className:re("flex h-10 w-full items-center justify-between rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 placeholder:text-muted-foreground focus:border-primary/45 focus:bg-background/90 focus:outline-none focus:ring-2 focus:ring-ring/45 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...o,children:[l,f.jsx(DR,{asChild:!0,children:f.jsx(Ko,{className:"h-4 w-4 opacity-50"})})]}));Jf.displayName=Xb.displayName;const tx=v.forwardRef(({className:n,...l},o)=>f.jsx(Ib,{ref:o,className:re("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(FE,{className:"h-4 w-4"})}));tx.displayName=Ib.displayName;const nx=v.forwardRef(({className:n,...l},o)=>f.jsx(Fb,{ref:o,className:re("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(Ko,{className:"h-4 w-4"})}));nx.displayName=Fb.displayName;const Wf=v.forwardRef(({className:n,children:l,position:o="popper",...i},c)=>f.jsx(kR,{children:f.jsxs(Kb,{ref:c,className:re("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border/70 bg-popover/96 text-popover-foreground shadow-[0_20px_70px_-36px_rgba(0,0,0,0.45)] backdrop-blur-xl 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o,...i,children:[f.jsx(tx,{}),f.jsx(zR,{className:re("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),f.jsx(nx,{})]})}));Wf.displayName=Kb.displayName;const BR=v.forwardRef(({className:n,...l},o)=>f.jsx(Qb,{ref:o,className:re("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));BR.displayName=Qb.displayName;const jr=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Zb,{ref:i,className:re("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...o,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(UR,{children:f.jsx(ks,{className:"h-4 w-4"})})}),f.jsx(LR,{children:l})]}));jr.displayName=Zb.displayName;const HR=v.forwardRef(({className:n,...l},o)=>f.jsx(Jb,{ref:o,className:re("-mx-1 my-1 h-px bg-muted",n),...l}));HR.displayName=Jb.displayName;var Pd="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},ei="RovingFocusGroup",[pf,ax,$R]=Xy(ei),[YR,lx]=al(ei,[$R]),[qR,GR]=YR(ei),rx=v.forwardRef((n,l)=>f.jsx(pf.Provider,{scope:n.__scopeRovingFocusGroup,children:f.jsx(pf.Slot,{scope:n.__scopeRovingFocusGroup,children:f.jsx(PR,{...n,ref:l})})}));rx.displayName=ei;var PR=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:c=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=n,w=v.useRef(null),N=tt(l,w),T=Yf(d),[E,C]=kr({prop:m,defaultProp:h??null,onChange:y,caller:ei}),[A,j]=v.useState(!1),O=Wa(p),z=ax(o),B=v.useRef(!1),[G,$]=v.useState(0);return v.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(Pd,O),()=>V.removeEventListener(Pd,O)},[O]),f.jsx(qR,{scope:o,orientation:i,dir:T,loop:c,currentTabStopId:E,onItemFocus:v.useCallback(V=>C(V),[C]),onItemShiftTab:v.useCallback(()=>j(!0),[]),onFocusableItemAdd:v.useCallback(()=>$(V=>V+1),[]),onFocusableItemRemove:v.useCallback(()=>$(V=>V-1),[]),children:f.jsx(Ue.div,{tabIndex:A||G===0?-1:0,"data-orientation":i,...g,ref:N,style:{outline:"none",...n.style},onMouseDown:De(n.onMouseDown,()=>{B.current=!0}),onFocus:De(n.onFocus,V=>{const ne=!B.current;if(V.target===V.currentTarget&&ne&&!A){const le=new CustomEvent(Pd,VR);if(V.currentTarget.dispatchEvent(le),!le.defaultPrevented){const fe=z().filter(M=>M.focusable),me=fe.find(M=>M.active),ie=fe.find(M=>M.id===E),oe=[me,ie,...fe].filter(Boolean).map(M=>M.ref.current);sx(oe,x)}}B.current=!1}),onBlur:De(n.onBlur,()=>j(!1))})})}),ox="RovingFocusGroupItem",ix=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:c=!1,tabStopId:d,children:m,...h}=n,y=Fa(),p=d||y,x=GR(ox,o),g=x.currentTabStopId===p,w=ax(o),{onFocusableItemAdd:N,onFocusableItemRemove:T,currentTabStopId:E}=x;return v.useEffect(()=>{if(i)return N(),()=>T()},[i,N,T]),f.jsx(pf.ItemSlot,{scope:o,id:p,focusable:i,active:c,children:f.jsx(Ue.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:De(n.onMouseDown,C=>{i?x.onItemFocus(p):C.preventDefault()}),onFocus:De(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:De(n.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){x.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const A=QR(C,x.orientation,x.dir);if(A!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let O=w().filter(z=>z.focusable).map(z=>z.ref.current);if(A==="last")O.reverse();else if(A==="prev"||A==="next"){A==="prev"&&O.reverse();const z=O.indexOf(C.currentTarget);O=x.loop?ZR(O,z+1):O.slice(z+1)}setTimeout(()=>sx(O))}}),children:typeof m=="function"?m({isCurrentTabStop:g,hasTabStop:E!=null}):m})})});ix.displayName=ox;var XR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KR(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function QR(n,l,o){const i=KR(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return XR[i]}function sx(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function ZR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var IR=rx,FR=ix,dc="Tabs",[JR]=al(dc,[lx]),cx=lx(),[WR,em]=JR(dc),ux=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:c,defaultValue:d,orientation:m="horizontal",dir:h,activationMode:y="automatic",...p}=n,x=Yf(h),[g,w]=kr({prop:i,onChange:c,defaultProp:d??"",caller:dc});return f.jsx(WR,{scope:o,baseId:Fa(),value:g,onValueChange:w,orientation:m,dir:x,activationMode:y,children:f.jsx(Ue.div,{dir:x,"data-orientation":m,...p,ref:l})})});ux.displayName=dc;var dx="TabsList",fx=v.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...c}=n,d=em(dx,o),m=cx(o);return f.jsx(IR,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:i,children:f.jsx(Ue.div,{role:"tablist","aria-orientation":d.orientation,...c,ref:l})})});fx.displayName=dx;var mx="TabsTrigger",hx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:c=!1,...d}=n,m=em(mx,o),h=cx(o),y=vx(m.baseId,i),p=yx(m.baseId,i),x=i===m.value;return f.jsx(FR,{asChild:!0,...h,focusable:!c,active:x,children:f.jsx(Ue.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:y,...d,ref:l,onMouseDown:De(n.onMouseDown,g=>{!c&&g.button===0&&g.ctrlKey===!1?m.onValueChange(i):g.preventDefault()}),onKeyDown:De(n.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&m.onValueChange(i)}),onFocus:De(n.onFocus,()=>{const g=m.activationMode!=="manual";!x&&!c&&g&&m.onValueChange(i)})})})});hx.displayName=mx;var px="TabsContent",gx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:c,children:d,...m}=n,h=em(px,o),y=vx(h.baseId,i),p=yx(h.baseId,i),x=i===h.value,g=v.useRef(x);return v.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),f.jsx(Vr,{present:c||x,children:({present:w})=>f.jsx(Ue.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":y,hidden:!w,id:p,tabIndex:0,...m,ref:l,style:{...n.style,animationDuration:g.current?"0s":void 0},children:w&&d})})});gx.displayName=px;function vx(n,l){return`${n}-trigger-${l}`}function yx(n,l){return`${n}-content-${l}`}var e_=ux,bx=fx,xx=hx,Sx=gx;const t_=e_,wx=v.forwardRef(({className:n,...l},o)=>f.jsx(bx,{ref:o,className:re("inline-flex h-10 items-center justify-center rounded-lg bg-muted/72 p-1 text-muted-foreground shadow-inner shadow-background/40",n),...l}));wx.displayName=bx.displayName;const js=v.forwardRef(({className:n,...l},o)=>f.jsx(xx,{ref:o,className:re("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-semibold ring-offset-background transition-all duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/12 data-[state=active]:text-primary data-[state=active]:shadow-[0_10px_28px_-18px_hsl(var(--primary)/0.85)]",n),...l}));js.displayName=xx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Sx,{ref:o,className:re("mt-2 ring-offset-background data-[state=inactive]:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...l}));qs.displayName=Sx.displayName;var Ex="AlertDialog",[n_]=al(Ex,[wy]),wa=wy(),Nx=n=>{const{__scopeAlertDialog:l,...o}=n,i=wa(l);return f.jsx(By,{...i,...o,modal:!0})};Nx.displayName=Ex;var a_="AlertDialogTrigger",Tx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Hy,{...c,...i,ref:l})});Tx.displayName=a_;var l_="AlertDialogPortal",Cx=n=>{const{__scopeAlertDialog:l,...o}=n,i=wa(l);return f.jsx(Vy,{...i,...o})};Cx.displayName=l_;var r_="AlertDialogOverlay",Ax=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Bf,{...c,...i,ref:l})});Ax.displayName=r_;var Dr="AlertDialogContent",[o_,i_]=n_(Dr),s_=xC("AlertDialogContent"),Rx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...c}=n,d=wa(o),m=v.useRef(null),h=tt(l,m),y=v.useRef(null);return f.jsx(L5,{contentName:Dr,titleName:_x,docsSlug:"alert-dialog",children:f.jsx(o_,{scope:o,cancelRef:y,children:f.jsxs(Hf,{role:"alertdialog",...d,...c,ref:h,onOpenAutoFocus:De(c.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=y.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[f.jsx(s_,{children:i}),f.jsx(u_,{contentRef:m})]})})})});Rx.displayName=Dr;var _x="AlertDialogTitle",jx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Vf,{...c,...i,ref:l})});jx.displayName=_x;var Mx="AlertDialogDescription",Ox=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx($f,{...c,...i,ref:l})});Ox.displayName=Mx;var c_="AlertDialogAction",Dx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(ac,{...c,...i,ref:l})});Dx.displayName=c_;var kx="AlertDialogCancel",zx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:c}=i_(kx,o),d=wa(o),m=tt(l,c);return f.jsx(ac,{...d,...i,ref:m})});zx.displayName=kx;var u_=({contentRef:n})=>{const l=`\`${Dr}\` requires a description for the component to be accessible for screen reader users.
310
+ For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return v.useEffect(()=>{n&&(document.getElementById(n)||console.error(o))},[o,n]),null},B5="DialogDescriptionWarning",H5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Uy(B5).contentName}}.`;return v.useEffect(()=>{var d;const c=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},By=Ey,Hy=Ty,Vy=Ay,Bf=Ry,Hf=_y,Vf=My,$f=Dy,ac=zy;const V5=By,$5=Hy,Y5=Vy,Wj=ac,$y=v.forwardRef(({className:n,...l},o)=>f.jsx(Bf,{ref:o,className:re("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}));$y.displayName=Bf.displayName;const Yy=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Y5,{children:[f.jsx($y,{}),f.jsxs(Hf,{ref:i,className:re("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),...o,children:[l,f.jsxs(ac,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Y0,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yy.displayName=Hf.displayName;const qy=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});qy.displayName="DialogHeader";const q5=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});q5.displayName="DialogFooter";const Gy=v.forwardRef(({className:n,...l},o)=>f.jsx(Vf,{ref:o,className:re("text-lg font-semibold leading-none tracking-tight",n),...l}));Gy.displayName=Vf.displayName;const Py=v.forwardRef(({className:n,...l},o)=>f.jsx($f,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Py.displayName=$f.displayName;function G5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[c,d]=v.useState(!1),m=l??c,h=v.useCallback(y=>{l===void 0&&d(y),o==null||o(y)},[l,o]);return f.jsxs(V5,{open:m,onOpenChange:h,children:[i&&f.jsx($5,{asChild:!0,children:f.jsx(yn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",children:f.jsx(_N,{className:"h-4 w-4"})})}),f.jsxs(Yy,{className:"settings-dialog-content grid h-[min(78vh,38rem)] max-h-[78vh] max-w-[min(86vw,50rem)] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden rounded-xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[f.jsxs(qy,{className:"shrink-0 border-b border-border/60 px-3 py-1.5 sm:px-3.5",children:[f.jsxs(Gy,{className:"flex items-center gap-1.5 text-[11px]",children:[f.jsx(gN,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),f.jsx(Py,{className:"text-[10px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-2.5 pb-2 pt-0 sm:px-3 sm:pb-2.5",children:n})]})]})}function Yv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Xy(n){const l=n+"CollectionProvider",[o,i]=al(l),[c,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),m=E=>{const{scope:C,children:A}=E,j=ae.useRef(null),O=ae.useRef(new Map).current;return f.jsx(c,{scope:C,itemMap:O,collectionRef:j,children:A})};m.displayName=l;const h=n+"CollectionSlot",y=Qo(h),p=ae.forwardRef((E,C)=>{const{scope:A,children:j}=E,O=d(h,A),z=tt(C,O.collectionRef);return f.jsx(y,{ref:z,children:j})});p.displayName=h;const x=n+"CollectionItemSlot",g="data-radix-collection-item",w=Qo(x),N=ae.forwardRef((E,C)=>{const{scope:A,children:j,...O}=E,z=ae.useRef(null),B=tt(C,z),G=d(x,A);return ae.useEffect(()=>(G.itemMap.set(z,{ref:z,...O}),()=>void G.itemMap.delete(z))),f.jsx(w,{[g]:"",ref:B,children:j})});N.displayName=x;function T(E){const C=d(n+"CollectionConsumer",E);return ae.useCallback(()=>{const j=C.collectionRef.current;if(!j)return[];const O=Array.from(j.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((G,$)=>O.indexOf(G.ref.current)-O.indexOf($.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:m,Slot:p,ItemSlot:N},T,i]}var P5=v.createContext(void 0);function Yf(n){const l=v.useContext(P5);return n||l||"ltr"}const X5=["top","right","bottom","left"],el=Math.min,ln=Math.max,Bs=Math.round,Es=Math.floor,In=n=>({x:n,y:n}),K5={left:"right",right:"left",bottom:"top",top:"bottom"};function of(n,l,o){return ln(n,el(l,o))}function ba(n,l){return typeof n=="function"?n(l):n}function xa(n){return n.split("-")[0]}function $r(n){return n.split("-")[1]}function qf(n){return n==="x"?"y":"x"}function Gf(n){return n==="y"?"height":"width"}function Qn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function Pf(n){return qf(Qn(n))}function Q5(n,l,o){o===void 0&&(o=!1);const i=$r(n),c=Pf(n),d=Gf(c);let m=c==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(m=Hs(m)),[m,Hs(m)]}function Z5(n){const l=Hs(n);return[sf(n),l,sf(l)]}function sf(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const qv=["left","right"],Gv=["right","left"],I5=["top","bottom"],F5=["bottom","top"];function J5(n,l,o){switch(n){case"top":case"bottom":return o?l?Gv:qv:l?qv:Gv;case"left":case"right":return l?I5:F5;default:return[]}}function W5(n,l,o,i){const c=$r(n);let d=J5(xa(n),o==="start",i);return c&&(d=d.map(m=>m+"-"+c),l&&(d=d.concat(d.map(sf)))),d}function Hs(n){const l=xa(n);return K5[l]+n.slice(l.length)}function eA(n){return{top:0,right:0,bottom:0,left:0,...n}}function Ky(n){return typeof n!="number"?eA(n):{top:n,right:n,bottom:n,left:n}}function Vs(n){const{x:l,y:o,width:i,height:c}=n;return{width:i,height:c,top:o,left:l,right:l+i,bottom:o+c,x:l,y:o}}function Pv(n,l,o){let{reference:i,floating:c}=n;const d=Qn(l),m=Pf(l),h=Gf(m),y=xa(l),p=d==="y",x=i.x+i.width/2-c.width/2,g=i.y+i.height/2-c.height/2,w=i[h]/2-c[h]/2;let N;switch(y){case"top":N={x,y:i.y-c.height};break;case"bottom":N={x,y:i.y+i.height};break;case"right":N={x:i.x+i.width,y:g};break;case"left":N={x:i.x-c.width,y:g};break;default:N={x:i.x,y:i.y}}switch($r(l)){case"start":N[m]-=w*(o&&p?-1:1);break;case"end":N[m]+=w*(o&&p?-1:1);break}return N}async function tA(n,l){var o;l===void 0&&(l={});const{x:i,y:c,platform:d,rects:m,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:g="floating",altBoundary:w=!1,padding:N=0}=ba(l,n),T=Ky(N),C=h[w?g==="floating"?"reference":"floating":g],A=Vs(await d.getClippingRect({element:(o=await(d.isElement==null?void 0:d.isElement(C)))==null||o?C:C.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:y})),j=g==="floating"?{x:i,y:c,width:m.floating.width,height:m.floating.height}:m.reference,O=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),z=await(d.isElement==null?void 0:d.isElement(O))?await(d.getScale==null?void 0:d.getScale(O))||{x:1,y:1}:{x:1,y:1},B=Vs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:O,strategy:y}):j);return{top:(A.top-B.top+T.top)/z.y,bottom:(B.bottom-A.bottom+T.bottom)/z.y,left:(A.left-B.left+T.left)/z.x,right:(B.right-A.right+T.right)/z.x}}const nA=50,aA=async(n,l,o)=>{const{placement:i="bottom",strategy:c="absolute",middleware:d=[],platform:m}=o,h=m.detectOverflow?m:{...m,detectOverflow:tA},y=await(m.isRTL==null?void 0:m.isRTL(l));let p=await m.getElementRects({reference:n,floating:l,strategy:c}),{x,y:g}=Pv(p,i,y),w=i,N=0;const T={};for(let E=0;E<d.length;E++){const C=d[E];if(!C)continue;const{name:A,fn:j}=C,{x:O,y:z,data:B,reset:G}=await j({x,y:g,initialPlacement:i,placement:w,strategy:c,middlewareData:T,rects:p,platform:h,elements:{reference:n,floating:l}});x=O??x,g=z??g,T[A]={...T[A],...B},G&&N<nA&&(N++,typeof G=="object"&&(G.placement&&(w=G.placement),G.rects&&(p=G.rects===!0?await m.getElementRects({reference:n,floating:l,strategy:c}):G.rects),{x,y:g}=Pv(p,w,y)),E=-1)}return{x,y:g,placement:w,strategy:c,middlewareData:T}},lA=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:c,rects:d,platform:m,elements:h,middlewareData:y}=l,{element:p,padding:x=0}=ba(n,l)||{};if(p==null)return{};const g=Ky(x),w={x:o,y:i},N=Pf(c),T=Gf(N),E=await m.getDimensions(p),C=N==="y",A=C?"top":"left",j=C?"bottom":"right",O=C?"clientHeight":"clientWidth",z=d.reference[T]+d.reference[N]-w[N]-d.floating[T],B=w[N]-d.reference[N],G=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let $=G?G[O]:0;(!$||!await(m.isElement==null?void 0:m.isElement(G)))&&($=h.floating[O]||d.floating[T]);const V=z/2-B/2,ne=$/2-E[T]/2-1,le=el(g[A],ne),fe=el(g[j],ne),me=le,ie=$-E[T]-fe,ue=$/2-E[T]/2+V,oe=of(me,ue,ie),M=!y.arrow&&$r(c)!=null&&ue!==oe&&d.reference[T]/2-(ue<me?le:fe)-E[T]/2<0,Y=M?ue<me?ue-me:ue-ie:0;return{[N]:w[N]+Y,data:{[N]:oe,centerOffset:ue-oe-Y,...M&&{alignmentOffset:Y}},reset:M}}}),rA=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:c,middlewareData:d,rects:m,initialPlacement:h,platform:y,elements:p}=l,{mainAxis:x=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:N="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:E=!0,...C}=ba(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const A=xa(c),j=Qn(h),O=xa(h)===h,z=await(y.isRTL==null?void 0:y.isRTL(p.floating)),B=w||(O||!E?[Hs(h)]:Z5(h)),G=T!=="none";!w&&G&&B.push(...W5(h,E,T,z));const $=[h,...B],V=await y.detectOverflow(l,C),ne=[];let le=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&ne.push(V[A]),g){const ue=Q5(c,m,z);ne.push(V[ue[0]],V[ue[1]])}if(le=[...le,{placement:c,overflows:ne}],!ne.every(ue=>ue<=0)){var fe,me;const ue=(((fe=d.flip)==null?void 0:fe.index)||0)+1,oe=$[ue];if(oe&&(!(g==="alignment"?j!==Qn(oe):!1)||le.every(I=>Qn(I.placement)===j?I.overflows[0]>0:!0)))return{data:{index:ue,overflows:le},reset:{placement:oe}};let M=(me=le.filter(Y=>Y.overflows[0]<=0).sort((Y,I)=>Y.overflows[1]-I.overflows[1])[0])==null?void 0:me.placement;if(!M)switch(N){case"bestFit":{var ie;const Y=(ie=le.filter(I=>{if(G){const de=Qn(I.placement);return de===j||de==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(de=>de>0).reduce((de,F)=>de+F,0)]).sort((I,de)=>I[1]-de[1])[0])==null?void 0:ie[0];Y&&(M=Y);break}case"initialPlacement":M=h;break}if(c!==M)return{reset:{placement:M}}}return{}}}};function Xv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function Kv(n){return X5.some(l=>n[l]>=0)}const oA=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:c="referenceHidden",...d}=ba(n,l);switch(c){case"referenceHidden":{const m=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=Xv(m,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Kv(h)}}}case"escaped":{const m=await i.detectOverflow(l,{...d,altBoundary:!0}),h=Xv(m,o.floating);return{data:{escapedOffsets:h,escaped:Kv(h)}}}default:return{}}}}},Qy=new Set(["left","top"]);async function iA(n,l){const{placement:o,platform:i,elements:c}=n,d=await(i.isRTL==null?void 0:i.isRTL(c.floating)),m=xa(o),h=$r(o),y=Qn(o)==="y",p=Qy.has(m)?-1:1,x=d&&y?-1:1,g=ba(l,n);let{mainAxis:w,crossAxis:N,alignmentAxis:T}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return h&&typeof T=="number"&&(N=h==="end"?T*-1:T),y?{x:N*x,y:w*p}:{x:w*p,y:N*x}}const sA=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:c,y:d,placement:m,middlewareData:h}=l,y=await iA(l,n);return m===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:c+y.x,y:d+y.y,data:{...y,placement:m}}}}},cA=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:c,platform:d}=l,{mainAxis:m=!0,crossAxis:h=!1,limiter:y={fn:A=>{let{x:j,y:O}=A;return{x:j,y:O}}},...p}=ba(n,l),x={x:o,y:i},g=await d.detectOverflow(l,p),w=Qn(xa(c)),N=qf(w);let T=x[N],E=x[w];if(m){const A=N==="y"?"top":"left",j=N==="y"?"bottom":"right",O=T+g[A],z=T-g[j];T=of(O,T,z)}if(h){const A=w==="y"?"top":"left",j=w==="y"?"bottom":"right",O=E+g[A],z=E-g[j];E=of(O,E,z)}const C=y.fn({...l,[N]:T,[w]:E});return{...C,data:{x:C.x-o,y:C.y-i,enabled:{[N]:m,[w]:h}}}}}},uA=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:c,rects:d,middlewareData:m}=l,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=ba(n,l),x={x:o,y:i},g=Qn(c),w=qf(g);let N=x[w],T=x[g];const E=ba(h,l),C=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(y){const O=w==="y"?"height":"width",z=d.reference[w]-d.floating[O]+C.mainAxis,B=d.reference[w]+d.reference[O]-C.mainAxis;N<z?N=z:N>B&&(N=B)}if(p){var A,j;const O=w==="y"?"width":"height",z=Qy.has(xa(c)),B=d.reference[g]-d.floating[O]+(z&&((A=m.offset)==null?void 0:A[g])||0)+(z?0:C.crossAxis),G=d.reference[g]+d.reference[O]+(z?0:((j=m.offset)==null?void 0:j[g])||0)-(z?C.crossAxis:0);T<B?T=B:T>G&&(T=G)}return{[w]:N,[g]:T}}}},dA=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:c,rects:d,platform:m,elements:h}=l,{apply:y=()=>{},...p}=ba(n,l),x=await m.detectOverflow(l,p),g=xa(c),w=$r(c),N=Qn(c)==="y",{width:T,height:E}=d.floating;let C,A;g==="top"||g==="bottom"?(C=g,A=w===(await(m.isRTL==null?void 0:m.isRTL(h.floating))?"start":"end")?"left":"right"):(A=g,C=w==="end"?"top":"bottom");const j=E-x.top-x.bottom,O=T-x.left-x.right,z=el(E-x[C],j),B=el(T-x[A],O),G=!l.middlewareData.shift;let $=z,V=B;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(V=O),(i=l.middlewareData.shift)!=null&&i.enabled.y&&($=j),G&&!w){const le=ln(x.left,0),fe=ln(x.right,0),me=ln(x.top,0),ie=ln(x.bottom,0);N?V=T-2*(le!==0||fe!==0?le+fe:ln(x.left,x.right)):$=E-2*(me!==0||ie!==0?me+ie:ln(x.top,x.bottom))}await y({...l,availableWidth:V,availableHeight:$});const ne=await m.getDimensions(h.floating);return T!==ne.width||E!==ne.height?{reset:{rects:!0}}:{}}}};function lc(){return typeof window<"u"}function Yr(n){return Zy(n)?(n.nodeName||"").toLowerCase():"#document"}function rn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function Jn(n){var l;return(l=(Zy(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function Zy(n){return lc()?n instanceof Node||n instanceof rn(n).Node:!1}function An(n){return lc()?n instanceof Element||n instanceof rn(n).Element:!1}function Sa(n){return lc()?n instanceof HTMLElement||n instanceof rn(n).HTMLElement:!1}function Qv(n){return!lc()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof rn(n).ShadowRoot}function Wo(n){const{overflow:l,overflowX:o,overflowY:i,display:c}=Rn(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&c!=="inline"&&c!=="contents"}function fA(n){return/^(table|td|th)$/.test(Yr(n))}function rc(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const mA=/transform|translate|scale|rotate|perspective|filter/,hA=/paint|layout|strict|content/,Rl=n=>!!n&&n!=="none";let Yd;function Xf(n){const l=An(n)?Rn(n):n;return Rl(l.transform)||Rl(l.translate)||Rl(l.scale)||Rl(l.rotate)||Rl(l.perspective)||!Kf()&&(Rl(l.backdropFilter)||Rl(l.filter))||mA.test(l.willChange||"")||hA.test(l.contain||"")}function pA(n){let l=tl(n);for(;Sa(l)&&!zr(l);){if(Xf(l))return l;if(rc(l))return null;l=tl(l)}return null}function Kf(){return Yd==null&&(Yd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yd}function zr(n){return/^(html|body|#document)$/.test(Yr(n))}function Rn(n){return rn(n).getComputedStyle(n)}function oc(n){return An(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tl(n){if(Yr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Qv(n)&&n.host||Jn(n);return Qv(l)?l.host:l}function Iy(n){const l=tl(n);return zr(l)?n.ownerDocument?n.ownerDocument.body:n.body:Sa(l)&&Wo(l)?l:Iy(l)}function Zo(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const c=Iy(n),d=c===((i=n.ownerDocument)==null?void 0:i.body),m=rn(c);if(d){const h=cf(m);return l.concat(m,m.visualViewport||[],Wo(c)?c:[],h&&o?Zo(h):[])}else return l.concat(c,Zo(c,[],o))}function cf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Fy(n){const l=Rn(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const c=Sa(n),d=c?n.offsetWidth:o,m=c?n.offsetHeight:i,h=Bs(o)!==d||Bs(i)!==m;return h&&(o=d,i=m),{width:o,height:i,$:h}}function Qf(n){return An(n)?n:n.contextElement}function Or(n){const l=Qf(n);if(!Sa(l))return In(1);const o=l.getBoundingClientRect(),{width:i,height:c,$:d}=Fy(l);let m=(d?Bs(o.width):o.width)/i,h=(d?Bs(o.height):o.height)/c;return(!m||!Number.isFinite(m))&&(m=1),(!h||!Number.isFinite(h))&&(h=1),{x:m,y:h}}const gA=In(0);function Jy(n){const l=rn(n);return!Kf()||!l.visualViewport?gA:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function vA(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==rn(n)?!1:l}function Ol(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const c=n.getBoundingClientRect(),d=Qf(n);let m=In(1);l&&(i?An(i)&&(m=Or(i)):m=Or(n));const h=vA(d,o,i)?Jy(d):In(0);let y=(c.left+h.x)/m.x,p=(c.top+h.y)/m.y,x=c.width/m.x,g=c.height/m.y;if(d){const w=rn(d),N=i&&An(i)?rn(i):i;let T=w,E=cf(T);for(;E&&i&&N!==T;){const C=Or(E),A=E.getBoundingClientRect(),j=Rn(E),O=A.left+(E.clientLeft+parseFloat(j.paddingLeft))*C.x,z=A.top+(E.clientTop+parseFloat(j.paddingTop))*C.y;y*=C.x,p*=C.y,x*=C.x,g*=C.y,y+=O,p+=z,T=rn(E),E=cf(T)}}return Vs({width:x,height:g,x:y,y:p})}function ic(n,l){const o=oc(n).scrollLeft;return l?l.left+o:Ol(Jn(n)).left+o}function Wy(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-ic(n,o),c=o.top+l.scrollTop;return{x:i,y:c}}function yA(n){let{elements:l,rect:o,offsetParent:i,strategy:c}=n;const d=c==="fixed",m=Jn(i),h=l?rc(l.floating):!1;if(i===m||h&&d)return o;let y={scrollLeft:0,scrollTop:0},p=In(1);const x=In(0),g=Sa(i);if((g||!g&&!d)&&((Yr(i)!=="body"||Wo(m))&&(y=oc(i)),g)){const N=Ol(i);p=Or(i),x.x=N.x+i.clientLeft,x.y=N.y+i.clientTop}const w=m&&!g&&!d?Wy(m,y):In(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-y.scrollLeft*p.x+x.x+w.x,y:o.y*p.y-y.scrollTop*p.y+x.y+w.y}}function bA(n){return Array.from(n.getClientRects())}function xA(n){const l=Jn(n),o=oc(n),i=n.ownerDocument.body,c=ln(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=ln(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let m=-o.scrollLeft+ic(n);const h=-o.scrollTop;return Rn(i).direction==="rtl"&&(m+=ln(l.clientWidth,i.clientWidth)-c),{width:c,height:d,x:m,y:h}}const Zv=25;function SA(n,l){const o=rn(n),i=Jn(n),c=o.visualViewport;let d=i.clientWidth,m=i.clientHeight,h=0,y=0;if(c){d=c.width,m=c.height;const x=Kf();(!x||x&&l==="fixed")&&(h=c.offsetLeft,y=c.offsetTop)}const p=ic(i);if(p<=0){const x=i.ownerDocument,g=x.body,w=getComputedStyle(g),N=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,T=Math.abs(i.clientWidth-g.clientWidth-N);T<=Zv&&(d-=T)}else p<=Zv&&(d+=p);return{width:d,height:m,x:h,y}}function wA(n,l){const o=Ol(n,!0,l==="fixed"),i=o.top+n.clientTop,c=o.left+n.clientLeft,d=Sa(n)?Or(n):In(1),m=n.clientWidth*d.x,h=n.clientHeight*d.y,y=c*d.x,p=i*d.y;return{width:m,height:h,x:y,y:p}}function Iv(n,l,o){let i;if(l==="viewport")i=SA(n,o);else if(l==="document")i=xA(Jn(n));else if(An(l))i=wA(l,o);else{const c=Jy(n);i={x:l.x-c.x,y:l.y-c.y,width:l.width,height:l.height}}return Vs(i)}function eb(n,l){const o=tl(n);return o===l||!An(o)||zr(o)?!1:Rn(o).position==="fixed"||eb(o,l)}function EA(n,l){const o=l.get(n);if(o)return o;let i=Zo(n,[],!1).filter(h=>An(h)&&Yr(h)!=="body"),c=null;const d=Rn(n).position==="fixed";let m=d?tl(n):n;for(;An(m)&&!zr(m);){const h=Rn(m),y=Xf(m);!y&&h.position==="fixed"&&(c=null),(d?!y&&!c:!y&&h.position==="static"&&!!c&&(c.position==="absolute"||c.position==="fixed")||Wo(m)&&!y&&eb(n,m))?i=i.filter(x=>x!==m):c=h,m=tl(m)}return l.set(n,i),i}function NA(n){let{element:l,boundary:o,rootBoundary:i,strategy:c}=n;const m=[...o==="clippingAncestors"?rc(l)?[]:EA(l,this._c):[].concat(o),i],h=Iv(l,m[0],c);let y=h.top,p=h.right,x=h.bottom,g=h.left;for(let w=1;w<m.length;w++){const N=Iv(l,m[w],c);y=ln(N.top,y),p=el(N.right,p),x=el(N.bottom,x),g=ln(N.left,g)}return{width:p-g,height:x-y,x:g,y}}function TA(n){const{width:l,height:o}=Fy(n);return{width:l,height:o}}function CA(n,l,o){const i=Sa(l),c=Jn(l),d=o==="fixed",m=Ol(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const y=In(0);function p(){y.x=ic(c)}if(i||!i&&!d)if((Yr(l)!=="body"||Wo(c))&&(h=oc(l)),i){const N=Ol(l,!0,d,l);y.x=N.x+l.clientLeft,y.y=N.y+l.clientTop}else c&&p();d&&!i&&c&&p();const x=c&&!i&&!d?Wy(c,h):In(0),g=m.left+h.scrollLeft-y.x-x.x,w=m.top+h.scrollTop-y.y-x.y;return{x:g,y:w,width:m.width,height:m.height}}function qd(n){return Rn(n).position==="static"}function Fv(n,l){if(!Sa(n)||Rn(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return Jn(n)===o&&(o=o.ownerDocument.body),o}function tb(n,l){const o=rn(n);if(rc(n))return o;if(!Sa(n)){let c=tl(n);for(;c&&!zr(c);){if(An(c)&&!qd(c))return c;c=tl(c)}return o}let i=Fv(n,l);for(;i&&fA(i)&&qd(i);)i=Fv(i,l);return i&&zr(i)&&qd(i)&&!Xf(i)?o:i||pA(n)||o}const AA=async function(n){const l=this.getOffsetParent||tb,o=this.getDimensions,i=await o(n.floating);return{reference:CA(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function RA(n){return Rn(n).direction==="rtl"}const _A={convertOffsetParentRelativeRectToViewportRelativeRect:yA,getDocumentElement:Jn,getClippingRect:NA,getOffsetParent:tb,getElementRects:AA,getClientRects:bA,getDimensions:TA,getScale:Or,isElement:An,isRTL:RA};function nb(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function jA(n,l){let o=null,i;const c=Jn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function m(h,y){h===void 0&&(h=!1),y===void 0&&(y=1),d();const p=n.getBoundingClientRect(),{left:x,top:g,width:w,height:N}=p;if(h||l(),!w||!N)return;const T=Es(g),E=Es(c.clientWidth-(x+w)),C=Es(c.clientHeight-(g+N)),A=Es(x),O={rootMargin:-T+"px "+-E+"px "+-C+"px "+-A+"px",threshold:ln(0,el(1,y))||1};let z=!0;function B(G){const $=G[0].intersectionRatio;if($!==y){if(!z)return m();$?m(!1,$):i=setTimeout(()=>{m(!1,1e-7)},1e3)}$===1&&!nb(p,n.getBoundingClientRect())&&m(),z=!1}try{o=new IntersectionObserver(B,{...O,root:c.ownerDocument})}catch{o=new IntersectionObserver(B,O)}o.observe(n)}return m(!0),d}function MA(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=Qf(n),x=c||d?[...p?Zo(p):[],...l?Zo(l):[]]:[];x.forEach(A=>{c&&A.addEventListener("scroll",o,{passive:!0}),d&&A.addEventListener("resize",o)});const g=p&&h?jA(p,o):null;let w=-1,N=null;m&&(N=new ResizeObserver(A=>{let[j]=A;j&&j.target===p&&N&&l&&(N.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=N)==null||O.observe(l)})),o()}),p&&!y&&N.observe(p),l&&N.observe(l));let T,E=y?Ol(n):null;y&&C();function C(){const A=Ol(n);E&&!nb(E,A)&&o(),E=A,T=requestAnimationFrame(C)}return o(),()=>{var A;x.forEach(j=>{c&&j.removeEventListener("scroll",o),d&&j.removeEventListener("resize",o)}),g==null||g(),(A=N)==null||A.disconnect(),N=null,y&&cancelAnimationFrame(T)}}const OA=sA,DA=cA,kA=rA,zA=dA,LA=oA,Jv=lA,UA=uA,BA=(n,l,o)=>{const i=new Map,c={platform:_A,...o},d={...c.platform,_c:i};return aA(n,l,{...c,platform:d})};var HA=typeof document<"u",VA=function(){},_s=HA?v.useLayoutEffect:VA;function $s(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,i,c;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(i=o;i--!==0;)if(!$s(n[i],l[i]))return!1;return!0}if(c=Object.keys(n),o=c.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,c[i]))return!1;for(i=o;i--!==0;){const d=c[i];if(!(d==="_owner"&&n.$$typeof)&&!$s(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function ab(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Wv(n,l){const o=ab(n);return Math.round(l*o)/o}function Gd(n){const l=v.useRef(n);return _s(()=>{l.current=n}),l}function $A(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:c,elements:{reference:d,floating:m}={},transform:h=!0,whileElementsMounted:y,open:p}=n,[x,g]=v.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[w,N]=v.useState(i);$s(w,i)||N(i);const[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useCallback(I=>{I!==G.current&&(G.current=I,E(I))},[]),O=v.useCallback(I=>{I!==$.current&&($.current=I,A(I))},[]),z=d||T,B=m||C,G=v.useRef(null),$=v.useRef(null),V=v.useRef(x),ne=y!=null,le=Gd(y),fe=Gd(c),me=Gd(p),ie=v.useCallback(()=>{if(!G.current||!$.current)return;const I={placement:l,strategy:o,middleware:w};fe.current&&(I.platform=fe.current),BA(G.current,$.current,I).then(de=>{const F={...de,isPositioned:me.current!==!1};ue.current&&!$s(V.current,F)&&(V.current=F,Jo.flushSync(()=>{g(F)}))})},[w,l,o,fe,me]);_s(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,g(I=>({...I,isPositioned:!1})))},[p]);const ue=v.useRef(!1);_s(()=>(ue.current=!0,()=>{ue.current=!1}),[]),_s(()=>{if(z&&(G.current=z),B&&($.current=B),z&&B){if(le.current)return le.current(z,B,ie);ie()}},[z,B,ie,le,ne]);const oe=v.useMemo(()=>({reference:G,floating:$,setReference:j,setFloating:O}),[j,O]),M=v.useMemo(()=>({reference:z,floating:B}),[z,B]),Y=v.useMemo(()=>{const I={position:o,left:0,top:0};if(!M.floating)return I;const de=Wv(M.floating,x.x),F=Wv(M.floating,x.y);return h?{...I,transform:"translate("+de+"px, "+F+"px)",...ab(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:de,top:F}},[o,h,M.floating,x.x,x.y]);return v.useMemo(()=>({...x,update:ie,refs:oe,elements:M,floatingStyles:Y}),[x,ie,oe,M,Y])}const YA=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:c}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?Jv({element:i.current,padding:c}).fn(o):{}:i?Jv({element:i,padding:c}).fn(o):{}}}},qA=(n,l)=>{const o=OA(n);return{name:o.name,fn:o.fn,options:[n,l]}},GA=(n,l)=>{const o=DA(n);return{name:o.name,fn:o.fn,options:[n,l]}},PA=(n,l)=>({fn:UA(n).fn,options:[n,l]}),XA=(n,l)=>{const o=kA(n);return{name:o.name,fn:o.fn,options:[n,l]}},KA=(n,l)=>{const o=zA(n);return{name:o.name,fn:o.fn,options:[n,l]}},QA=(n,l)=>{const o=LA(n);return{name:o.name,fn:o.fn,options:[n,l]}},ZA=(n,l)=>{const o=YA(n);return{name:o.name,fn:o.fn,options:[n,l]}};var IA="Arrow",lb=v.forwardRef((n,l)=>{const{children:o,width:i=10,height:c=5,...d}=n;return f.jsx(Ue.svg,{...d,ref:l,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});lb.displayName=IA;var FA=lb;function rb(n){const[l,o]=v.useState(void 0);return zt(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const d=c[0];let m,h;if("borderBoxSize"in d){const y=d.borderBoxSize,p=Array.isArray(y)?y[0]:y;m=p.inlineSize,h=p.blockSize}else m=n.offsetWidth,h=n.offsetHeight;o({width:m,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var Zf="Popper",[ob,ib]=al(Zf),[JA,sb]=ob(Zf),cb=n=>{const{__scopePopper:l,children:o}=n,[i,c]=v.useState(null);return f.jsx(JA,{scope:l,anchor:i,onAnchorChange:c,children:o})};cb.displayName=Zf;var ub="PopperAnchor",db=v.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...c}=n,d=sb(ub,o),m=v.useRef(null),h=tt(l,m),y=v.useRef(null);return v.useEffect(()=>{const p=y.current;y.current=(i==null?void 0:i.current)||m.current,p!==y.current&&d.onAnchorChange(y.current)}),i?null:f.jsx(Ue.div,{...c,ref:h})});db.displayName=ub;var If="PopperContent",[WA,eR]=ob(If),fb=v.forwardRef((n,l)=>{var ee,ce,J,ve,be,Se;const{__scopePopper:o,side:i="bottom",sideOffset:c=0,align:d="center",alignOffset:m=0,arrowPadding:h=0,avoidCollisions:y=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:N="optimized",onPlaced:T,...E}=n,C=sb(If,o),[A,j]=v.useState(null),O=tt(l,He=>j(He)),[z,B]=v.useState(null),G=rb(z),$=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ne=i+(d!=="center"?"-"+d:""),le=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},fe=Array.isArray(p)?p:[p],me=fe.length>0,ie={padding:le,boundary:fe.filter(nR),altBoundary:me},{refs:ue,floatingStyles:oe,placement:M,isPositioned:Y,middlewareData:I}=$A({strategy:"fixed",placement:ne,whileElementsMounted:(...He)=>MA(...He,{animationFrame:N==="always"}),elements:{reference:C.anchor},middleware:[qA({mainAxis:c+V,alignmentAxis:m}),y&&GA({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?PA():void 0,...ie}),y&&XA({...ie}),KA({...ie,apply:({elements:He,rects:je,availableWidth:Ve,availableHeight:dt})=>{const{width:Pe,height:Lt}=je.reference,ht=He.floating.style;ht.setProperty("--radix-popper-available-width",`${Ve}px`),ht.setProperty("--radix-popper-available-height",`${dt}px`),ht.setProperty("--radix-popper-anchor-width",`${Pe}px`),ht.setProperty("--radix-popper-anchor-height",`${Lt}px`)}}),z&&ZA({element:z,padding:h}),aR({arrowWidth:$,arrowHeight:V}),w&&QA({strategy:"referenceHidden",...ie})]}),[de,F]=pb(M),R=Wa(T);zt(()=>{Y&&(R==null||R())},[Y,R]);const P=(ee=I.arrow)==null?void 0:ee.x,K=(ce=I.arrow)==null?void 0:ce.y,W=((J=I.arrow)==null?void 0:J.centerOffset)!==0,[te,se]=v.useState();return zt(()=>{A&&se(window.getComputedStyle(A).zIndex)},[A]),f.jsx("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:Y?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(ve=I.transformOrigin)==null?void 0:ve.x,(be=I.transformOrigin)==null?void 0:be.y].join(" "),...((Se=I.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:f.jsx(WA,{scope:o,placedSide:de,onArrowChange:B,arrowX:P,arrowY:K,shouldHideArrow:W,children:f.jsx(Ue.div,{"data-side":de,"data-align":F,...E,ref:O,style:{...E.style,animation:Y?void 0:"none"}})})})});fb.displayName=If;var mb="PopperArrow",tR={top:"bottom",right:"left",bottom:"top",left:"right"},hb=v.forwardRef(function(l,o){const{__scopePopper:i,...c}=l,d=eR(mb,i),m=tR[d.placedSide];return f.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:f.jsx(FA,{...c,ref:o,style:{...c.style,display:"block"}})})});hb.displayName=mb;function nR(n){return n!==null}var aR=n=>({name:"transformOrigin",options:n,fn(l){var C,A,j;const{placement:o,rects:i,middlewareData:c}=l,m=((C=c.arrow)==null?void 0:C.centerOffset)!==0,h=m?0:n.arrowWidth,y=m?0:n.arrowHeight,[p,x]=pb(o),g={start:"0%",center:"50%",end:"100%"}[x],w=(((A=c.arrow)==null?void 0:A.x)??0)+h/2,N=(((j=c.arrow)==null?void 0:j.y)??0)+y/2;let T="",E="";return p==="bottom"?(T=m?g:`${w}px`,E=`${-y}px`):p==="top"?(T=m?g:`${w}px`,E=`${i.floating.height+y}px`):p==="right"?(T=`${-y}px`,E=m?g:`${N}px`):p==="left"&&(T=`${i.floating.width+y}px`,E=m?g:`${N}px`),{data:{x:T,y:E}}}});function pb(n){const[l,o="center"]=n.split("-");return[l,o]}var lR=cb,rR=db,oR=fb,iR=hb;function gb(n){const l=v.useRef({value:n,previous:n});return v.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}var vb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),sR="VisuallyHidden",cR=v.forwardRef((n,l)=>f.jsx(Ue.span,{...n,ref:l,style:{...vb,...n.style}}));cR.displayName=sR;var uR=[" ","Enter","ArrowUp","ArrowDown"],dR=[" ","Enter"],Dl="Select",[sc,cc,fR]=Xy(Dl),[qr]=al(Dl,[fR,ib]),uc=ib(),[mR,ll]=qr(Dl),[hR,pR]=qr(Dl),yb=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:c,onOpenChange:d,value:m,defaultValue:h,onValueChange:y,dir:p,name:x,autoComplete:g,disabled:w,required:N,form:T}=n,E=uc(l),[C,A]=v.useState(null),[j,O]=v.useState(null),[z,B]=v.useState(!1),G=Yf(p),[$,V]=kr({prop:i,defaultProp:c??!1,onChange:d,caller:Dl}),[ne,le]=kr({prop:m,defaultProp:h,onChange:y,caller:Dl}),fe=v.useRef(null),me=C?T||!!C.closest("form"):!0,[ie,ue]=v.useState(new Set),oe=Array.from(ie).map(M=>M.props.value).join(";");return f.jsx(lR,{...E,children:f.jsxs(mR,{required:N,scope:l,trigger:C,onTriggerChange:A,valueNode:j,onValueNodeChange:O,valueNodeHasChildren:z,onValueNodeHasChildrenChange:B,contentId:Fa(),value:ne,onValueChange:le,open:$,onOpenChange:V,dir:G,triggerPointerDownPosRef:fe,disabled:w,children:[f.jsx(sc.Provider,{scope:l,children:f.jsx(hR,{scope:n.__scopeSelect,onNativeOptionAdd:v.useCallback(M=>{ue(Y=>new Set(Y).add(M))},[]),onNativeOptionRemove:v.useCallback(M=>{ue(Y=>{const I=new Set(Y);return I.delete(M),I})},[]),children:o})}),me?f.jsxs(Yb,{"aria-hidden":!0,required:N,tabIndex:-1,name:x,autoComplete:g,value:ne,onChange:M=>le(M.target.value),disabled:w,form:T,children:[ne===void 0?f.jsx("option",{value:""}):null,Array.from(ie)]},oe):null]})})};yb.displayName=Dl;var bb="SelectTrigger",xb=v.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...c}=n,d=uc(o),m=ll(bb,o),h=m.disabled||i,y=tt(l,m.onTriggerChange),p=cc(o),x=v.useRef("touch"),[g,w,N]=Gb(E=>{const C=p().filter(O=>!O.disabled),A=C.find(O=>O.value===m.value),j=Pb(C,E,A);j!==void 0&&m.onValueChange(j.value)}),T=E=>{h||(m.onOpenChange(!0),N()),E&&(m.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return f.jsx(rR,{asChild:!0,...d,children:f.jsx(Ue.button,{type:"button",role:"combobox","aria-controls":m.contentId,"aria-expanded":m.open,"aria-required":m.required,"aria-autocomplete":"none",dir:m.dir,"data-state":m.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":qb(m.value)?"":void 0,...c,ref:y,onClick:De(c.onClick,E=>{E.currentTarget.focus(),x.current!=="mouse"&&T(E)}),onPointerDown:De(c.onPointerDown,E=>{x.current=E.pointerType;const C=E.target;C.hasPointerCapture(E.pointerId)&&C.releasePointerCapture(E.pointerId),E.button===0&&E.ctrlKey===!1&&E.pointerType==="mouse"&&(T(E),E.preventDefault())}),onKeyDown:De(c.onKeyDown,E=>{const C=g.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&w(E.key),!(C&&E.key===" ")&&uR.includes(E.key)&&(T(),E.preventDefault())})})})});xb.displayName=bb;var Sb="SelectValue",wb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:c,children:d,placeholder:m="",...h}=n,y=ll(Sb,o),{onValueNodeHasChildrenChange:p}=y,x=d!==void 0,g=tt(l,y.onValueNodeChange);return zt(()=>{p(x)},[p,x]),f.jsx(Ue.span,{...h,ref:g,style:{pointerEvents:"none"},children:qb(y.value)?f.jsx(f.Fragment,{children:m}):d})});wb.displayName=Sb;var gR="SelectIcon",Eb=v.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...c}=n;return f.jsx(Ue.span,{"aria-hidden":!0,...c,ref:l,children:i||"▼"})});Eb.displayName=gR;var vR="SelectPortal",Nb=n=>f.jsx(Df,{asChild:!0,...n});Nb.displayName=vR;var kl="SelectContent",Tb=v.forwardRef((n,l)=>{const o=ll(kl,n.__scopeSelect),[i,c]=v.useState();if(zt(()=>{c(new DocumentFragment)},[]),!o.open){const d=i;return d?Jo.createPortal(f.jsx(Cb,{scope:n.__scopeSelect,children:f.jsx(sc.Slot,{scope:n.__scopeSelect,children:f.jsx("div",{children:n.children})})}),d):null}return f.jsx(Ab,{...n,ref:l})});Tb.displayName=kl;var Tn=10,[Cb,rl]=qr(kl),yR="SelectContentImpl",bR=Qo("SelectContent.RemoveScroll"),Ab=v.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:d,onPointerDownOutside:m,side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C,...A}=n,j=ll(kl,o),[O,z]=v.useState(null),[B,G]=v.useState(null),$=tt(l,ee=>z(ee)),[V,ne]=v.useState(null),[le,fe]=v.useState(null),me=cc(o),[ie,ue]=v.useState(!1),oe=v.useRef(!1);v.useEffect(()=>{if(O)return xy(O)},[O]),dy();const M=v.useCallback(ee=>{const[ce,...J]=me().map(Se=>Se.ref.current),[ve]=J.slice(-1),be=document.activeElement;for(const Se of ee)if(Se===be||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ce&&B&&(B.scrollTop=0),Se===ve&&B&&(B.scrollTop=B.scrollHeight),Se==null||Se.focus(),document.activeElement!==be))return},[me,B]),Y=v.useCallback(()=>M([V,O]),[M,V,O]);v.useEffect(()=>{ie&&Y()},[ie,Y]);const{onOpenChange:I,triggerPointerDownPosRef:de}=j;v.useEffect(()=>{if(O){let ee={x:0,y:0};const ce=ve=>{var be,Se;ee={x:Math.abs(Math.round(ve.pageX)-(((be=de.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(ve.pageY)-(((Se=de.current)==null?void 0:Se.y)??0))}},J=ve=>{ee.x<=10&&ee.y<=10?ve.preventDefault():O.contains(ve.target)||I(!1),document.removeEventListener("pointermove",ce),de.current=null};return de.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",J,{capture:!0})}}},[O,I,de]),v.useEffect(()=>{const ee=()=>I(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[I]);const[F,R]=Gb(ee=>{const ce=me().filter(be=>!be.disabled),J=ce.find(be=>be.ref.current===document.activeElement),ve=Pb(ce,ee,J);ve&&setTimeout(()=>ve.ref.current.focus())}),P=v.useCallback((ee,ce,J)=>{const ve=!oe.current&&!J;(j.value!==void 0&&j.value===ce||ve)&&(ne(ee),ve&&(oe.current=!0))},[j.value]),K=v.useCallback(()=>O==null?void 0:O.focus(),[O]),W=v.useCallback((ee,ce,J)=>{const ve=!oe.current&&!J;(j.value!==void 0&&j.value===ce||ve)&&fe(ee)},[j.value]),te=i==="popper"?uf:Rb,se=te===uf?{side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C}:{};return f.jsx(Cb,{scope:o,content:O,viewport:B,onViewportChange:G,itemRefCallback:P,selectedItem:V,onItemLeave:K,itemTextRefCallback:W,focusSelectedItem:Y,selectedItemText:le,position:i,isPositioned:ie,searchRef:F,children:f.jsx(kf,{as:bR,allowPinchZoom:!0,children:f.jsx(Of,{asChild:!0,trapped:j.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:De(c,ee=>{var ce;(ce=j.trigger)==null||ce.focus({preventScroll:!0}),ee.preventDefault()}),children:f.jsx(Mf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:f.jsx(te,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:ee=>ee.preventDefault(),...A,...se,onPlaced:()=>ue(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:De(A.onKeyDown,ee=>{const ce=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ce&&ee.key.length===1&&R(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let ve=me().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(ve=ve.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const be=ee.target,Se=ve.indexOf(be);ve=ve.slice(Se+1)}setTimeout(()=>M(ve)),ee.preventDefault()}})})})})})})});Ab.displayName=yR;var xR="SelectItemAlignedPosition",Rb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...c}=n,d=ll(kl,o),m=rl(kl,o),[h,y]=v.useState(null),[p,x]=v.useState(null),g=tt(l,$=>x($)),w=cc(o),N=v.useRef(!1),T=v.useRef(!0),{viewport:E,selectedItem:C,selectedItemText:A,focusSelectedItem:j}=m,O=v.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&E&&C&&A){const $=d.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),ne=d.valueNode.getBoundingClientRect(),le=A.getBoundingClientRect();if(d.dir!=="rtl"){const be=le.left-V.left,Se=ne.left-be,He=$.left-Se,je=$.width+He,Ve=Math.max(je,V.width),dt=window.innerWidth-Tn,Pe=Yv(Se,[Tn,Math.max(Tn,dt-Ve)]);h.style.minWidth=je+"px",h.style.left=Pe+"px"}else{const be=V.right-le.right,Se=window.innerWidth-ne.right-be,He=window.innerWidth-$.right-Se,je=$.width+He,Ve=Math.max(je,V.width),dt=window.innerWidth-Tn,Pe=Yv(Se,[Tn,Math.max(Tn,dt-Ve)]);h.style.minWidth=je+"px",h.style.right=Pe+"px"}const fe=w(),me=window.innerHeight-Tn*2,ie=E.scrollHeight,ue=window.getComputedStyle(p),oe=parseInt(ue.borderTopWidth,10),M=parseInt(ue.paddingTop,10),Y=parseInt(ue.borderBottomWidth,10),I=parseInt(ue.paddingBottom,10),de=oe+M+ie+I+Y,F=Math.min(C.offsetHeight*5,de),R=window.getComputedStyle(E),P=parseInt(R.paddingTop,10),K=parseInt(R.paddingBottom,10),W=$.top+$.height/2-Tn,te=me-W,se=C.offsetHeight/2,ee=C.offsetTop+se,ce=oe+M+ee,J=de-ce;if(ce<=W){const be=fe.length>0&&C===fe[fe.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-E.offsetTop-E.offsetHeight,He=Math.max(te,se+(be?K:0)+Se+Y),je=ce+He;h.style.height=je+"px"}else{const be=fe.length>0&&C===fe[0].ref.current;h.style.top="0px";const He=Math.max(W,oe+E.offsetTop+(be?P:0)+se)+J;h.style.height=He+"px",E.scrollTop=ce-W+E.offsetTop}h.style.margin=`${Tn}px 0`,h.style.minHeight=F+"px",h.style.maxHeight=me+"px",i==null||i(),requestAnimationFrame(()=>N.current=!0)}},[w,d.trigger,d.valueNode,h,p,E,C,A,d.dir,i]);zt(()=>O(),[O]);const[z,B]=v.useState();zt(()=>{p&&B(window.getComputedStyle(p).zIndex)},[p]);const G=v.useCallback($=>{$&&T.current===!0&&(O(),j==null||j(),T.current=!1)},[O,j]);return f.jsx(wR,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:N,onScrollButtonChange:G,children:f.jsx("div",{ref:y,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:f.jsx(Ue.div,{...c,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});Rb.displayName=xR;var SR="SelectPopperPosition",uf=v.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:c=Tn,...d}=n,m=uc(o);return f.jsx(oR,{...m,...d,ref:l,align:i,collisionPadding:c,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uf.displayName=SR;var[wR,Ff]=qr(kl,{}),df="SelectViewport",_b=v.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...c}=n,d=rl(df,o),m=Ff(df,o),h=tt(l,d.onViewportChange),y=v.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(sc.Slot,{scope:o,children:f.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:De(c.onScroll,p=>{const x=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=m;if(w!=null&&w.current&&g){const N=Math.abs(y.current-x.scrollTop);if(N>0){const T=window.innerHeight-Tn*2,E=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),A=Math.max(E,C);if(A<T){const j=A+N,O=Math.min(T,j),z=j-O;g.style.height=O+"px",g.style.bottom==="0px"&&(x.scrollTop=z>0?z:0,g.style.justifyContent="flex-end")}}}y.current=x.scrollTop})})})]})});_b.displayName=df;var jb="SelectGroup",[ER,NR]=qr(jb),TR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=Fa();return f.jsx(ER,{scope:o,id:c,children:f.jsx(Ue.div,{role:"group","aria-labelledby":c,...i,ref:l})})});TR.displayName=jb;var Mb="SelectLabel",Ob=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=NR(Mb,o);return f.jsx(Ue.div,{id:c.id,...i,ref:l})});Ob.displayName=Mb;var Ys="SelectItem",[CR,Db]=qr(Ys),kb=v.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:d,...m}=n,h=ll(Ys,o),y=rl(Ys,o),p=h.value===i,[x,g]=v.useState(d??""),[w,N]=v.useState(!1),T=tt(l,j=>{var O;return(O=y.itemRefCallback)==null?void 0:O.call(y,j,i,c)}),E=Fa(),C=v.useRef("touch"),A=()=>{c||(h.onValueChange(i),h.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(CR,{scope:o,value:i,disabled:c,textId:E,isSelected:p,onItemTextChange:v.useCallback(j=>{g(O=>O||((j==null?void 0:j.textContent)??"").trim())},[]),children:f.jsx(sc.ItemSlot,{scope:o,value:i,disabled:c,textValue:x,children:f.jsx(Ue.div,{role:"option","aria-labelledby":E,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...m,ref:T,onFocus:De(m.onFocus,()=>N(!0)),onBlur:De(m.onBlur,()=>N(!1)),onClick:De(m.onClick,()=>{C.current!=="mouse"&&A()}),onPointerUp:De(m.onPointerUp,()=>{C.current==="mouse"&&A()}),onPointerDown:De(m.onPointerDown,j=>{C.current=j.pointerType}),onPointerMove:De(m.onPointerMove,j=>{var O;C.current=j.pointerType,c?(O=y.onItemLeave)==null||O.call(y):C.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:De(m.onPointerLeave,j=>{var O;j.currentTarget===document.activeElement&&((O=y.onItemLeave)==null||O.call(y))}),onKeyDown:De(m.onKeyDown,j=>{var z;((z=y.searchRef)==null?void 0:z.current)!==""&&j.key===" "||(dR.includes(j.key)&&A(),j.key===" "&&j.preventDefault())})})})})});kb.displayName=Ys;var qo="SelectItemText",zb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:c,...d}=n,m=ll(qo,o),h=rl(qo,o),y=Db(qo,o),p=pR(qo,o),[x,g]=v.useState(null),w=tt(l,A=>g(A),y.onItemTextChange,A=>{var j;return(j=h.itemTextRefCallback)==null?void 0:j.call(h,A,y.value,y.disabled)}),N=x==null?void 0:x.textContent,T=v.useMemo(()=>f.jsx("option",{value:y.value,disabled:y.disabled,children:N},y.value),[y.disabled,y.value,N]),{onNativeOptionAdd:E,onNativeOptionRemove:C}=p;return zt(()=>(E(T),()=>C(T)),[E,C,T]),f.jsxs(f.Fragment,{children:[f.jsx(Ue.span,{id:y.textId,...d,ref:w}),y.isSelected&&m.valueNode&&!m.valueNodeHasChildren?Jo.createPortal(d.children,m.valueNode):null]})});zb.displayName=qo;var Lb="SelectItemIndicator",Ub=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return Db(Lb,o).isSelected?f.jsx(Ue.span,{"aria-hidden":!0,...i,ref:l}):null});Ub.displayName=Lb;var ff="SelectScrollUpButton",Bb=v.forwardRef((n,l)=>{const o=rl(ff,n.__scopeSelect),i=Ff(ff,n.__scopeSelect),[c,d]=v.useState(!1),m=tt(l,i.onScrollButtonChange);return zt(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=y.scrollTop>0;d(p)};const y=o.viewport;return h(),y.addEventListener("scroll",h),()=>y.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),c?f.jsx(Vb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop-y.offsetHeight)}}):null});Bb.displayName=ff;var mf="SelectScrollDownButton",Hb=v.forwardRef((n,l)=>{const o=rl(mf,n.__scopeSelect),i=Ff(mf,n.__scopeSelect),[c,d]=v.useState(!1),m=tt(l,i.onScrollButtonChange);return zt(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=y.scrollHeight-y.clientHeight,x=Math.ceil(y.scrollTop)<p;d(x)};const y=o.viewport;return h(),y.addEventListener("scroll",h),()=>y.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),c?f.jsx(Vb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop+y.offsetHeight)}}):null});Hb.displayName=mf;var Vb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...c}=n,d=rl("SelectScrollButton",o),m=v.useRef(null),h=cc(o),y=v.useCallback(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null)},[]);return v.useEffect(()=>()=>y(),[y]),zt(()=>{var x;const p=h().find(g=>g.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[h]),f.jsx(Ue.div,{"aria-hidden":!0,...c,ref:l,style:{flexShrink:0,...c.style},onPointerDown:De(c.onPointerDown,()=>{m.current===null&&(m.current=window.setInterval(i,50))}),onPointerMove:De(c.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),m.current===null&&(m.current=window.setInterval(i,50))}),onPointerLeave:De(c.onPointerLeave,()=>{y()})})}),AR="SelectSeparator",$b=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return f.jsx(Ue.div,{"aria-hidden":!0,...i,ref:l})});$b.displayName=AR;var hf="SelectArrow",RR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,c=uc(o),d=ll(hf,o),m=rl(hf,o);return d.open&&m.position==="popper"?f.jsx(iR,{...c,...i,ref:l}):null});RR.displayName=hf;var _R="SelectBubbleInput",Yb=v.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const c=v.useRef(null),d=tt(i,c),m=gb(l);return v.useEffect(()=>{const h=c.current;if(!h)return;const y=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(y,"value").set;if(m!==l&&x){const g=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(g)}},[m,l]),f.jsx(Ue.select,{...o,style:{...vb,...o.style},ref:d,defaultValue:l})});Yb.displayName=_R;function qb(n){return n===""||n===void 0}function Gb(n){const l=Wa(n),o=v.useRef(""),i=v.useRef(0),c=v.useCallback(m=>{const h=o.current+m;l(h),(function y(p){o.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>y(""),1e3))})(h)},[l]),d=v.useCallback(()=>{o.current="",window.clearTimeout(i.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(i.current),[]),[o,c,d]}function Pb(n,l,o){const c=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let m=jR(n,Math.max(d,0));c.length===1&&(m=m.filter(p=>p!==o));const y=m.find(p=>p.textValue.toLowerCase().startsWith(c.toLowerCase()));return y!==o?y:void 0}function jR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var MR=yb,Xb=xb,OR=wb,DR=Eb,kR=Nb,Kb=Tb,zR=_b,Qb=Ob,Zb=kb,LR=zb,UR=Ub,Ib=Bb,Fb=Hb,Jb=$b;const Wb=MR,ex=OR,Jf=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Xb,{ref:i,className:re("flex h-10 w-full items-center justify-between rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 placeholder:text-muted-foreground focus:border-primary/45 focus:bg-background/90 focus:outline-none focus:ring-2 focus:ring-ring/45 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...o,children:[l,f.jsx(DR,{asChild:!0,children:f.jsx(Ko,{className:"h-4 w-4 opacity-50"})})]}));Jf.displayName=Xb.displayName;const tx=v.forwardRef(({className:n,...l},o)=>f.jsx(Ib,{ref:o,className:re("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(FE,{className:"h-4 w-4"})}));tx.displayName=Ib.displayName;const nx=v.forwardRef(({className:n,...l},o)=>f.jsx(Fb,{ref:o,className:re("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(Ko,{className:"h-4 w-4"})}));nx.displayName=Fb.displayName;const Wf=v.forwardRef(({className:n,children:l,position:o="popper",...i},c)=>f.jsx(kR,{children:f.jsxs(Kb,{ref:c,className:re("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border/70 bg-popover/96 text-popover-foreground shadow-[0_20px_70px_-36px_rgba(0,0,0,0.45)] backdrop-blur-xl 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o,...i,children:[f.jsx(tx,{}),f.jsx(zR,{className:re("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),f.jsx(nx,{})]})}));Wf.displayName=Kb.displayName;const BR=v.forwardRef(({className:n,...l},o)=>f.jsx(Qb,{ref:o,className:re("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));BR.displayName=Qb.displayName;const jr=v.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Zb,{ref:i,className:re("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...o,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(UR,{children:f.jsx(ks,{className:"h-4 w-4"})})}),f.jsx(LR,{children:l})]}));jr.displayName=Zb.displayName;const HR=v.forwardRef(({className:n,...l},o)=>f.jsx(Jb,{ref:o,className:re("-mx-1 my-1 h-px bg-muted",n),...l}));HR.displayName=Jb.displayName;var Pd="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},ei="RovingFocusGroup",[pf,ax,$R]=Xy(ei),[YR,lx]=al(ei,[$R]),[qR,GR]=YR(ei),rx=v.forwardRef((n,l)=>f.jsx(pf.Provider,{scope:n.__scopeRovingFocusGroup,children:f.jsx(pf.Slot,{scope:n.__scopeRovingFocusGroup,children:f.jsx(PR,{...n,ref:l})})}));rx.displayName=ei;var PR=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:c=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=n,w=v.useRef(null),N=tt(l,w),T=Yf(d),[E,C]=kr({prop:m,defaultProp:h??null,onChange:y,caller:ei}),[A,j]=v.useState(!1),O=Wa(p),z=ax(o),B=v.useRef(!1),[G,$]=v.useState(0);return v.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(Pd,O),()=>V.removeEventListener(Pd,O)},[O]),f.jsx(qR,{scope:o,orientation:i,dir:T,loop:c,currentTabStopId:E,onItemFocus:v.useCallback(V=>C(V),[C]),onItemShiftTab:v.useCallback(()=>j(!0),[]),onFocusableItemAdd:v.useCallback(()=>$(V=>V+1),[]),onFocusableItemRemove:v.useCallback(()=>$(V=>V-1),[]),children:f.jsx(Ue.div,{tabIndex:A||G===0?-1:0,"data-orientation":i,...g,ref:N,style:{outline:"none",...n.style},onMouseDown:De(n.onMouseDown,()=>{B.current=!0}),onFocus:De(n.onFocus,V=>{const ne=!B.current;if(V.target===V.currentTarget&&ne&&!A){const le=new CustomEvent(Pd,VR);if(V.currentTarget.dispatchEvent(le),!le.defaultPrevented){const fe=z().filter(M=>M.focusable),me=fe.find(M=>M.active),ie=fe.find(M=>M.id===E),oe=[me,ie,...fe].filter(Boolean).map(M=>M.ref.current);sx(oe,x)}}B.current=!1}),onBlur:De(n.onBlur,()=>j(!1))})})}),ox="RovingFocusGroupItem",ix=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:c=!1,tabStopId:d,children:m,...h}=n,y=Fa(),p=d||y,x=GR(ox,o),g=x.currentTabStopId===p,w=ax(o),{onFocusableItemAdd:N,onFocusableItemRemove:T,currentTabStopId:E}=x;return v.useEffect(()=>{if(i)return N(),()=>T()},[i,N,T]),f.jsx(pf.ItemSlot,{scope:o,id:p,focusable:i,active:c,children:f.jsx(Ue.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:De(n.onMouseDown,C=>{i?x.onItemFocus(p):C.preventDefault()}),onFocus:De(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:De(n.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){x.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const A=QR(C,x.orientation,x.dir);if(A!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let O=w().filter(z=>z.focusable).map(z=>z.ref.current);if(A==="last")O.reverse();else if(A==="prev"||A==="next"){A==="prev"&&O.reverse();const z=O.indexOf(C.currentTarget);O=x.loop?ZR(O,z+1):O.slice(z+1)}setTimeout(()=>sx(O))}}),children:typeof m=="function"?m({isCurrentTabStop:g,hasTabStop:E!=null}):m})})});ix.displayName=ox;var XR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KR(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function QR(n,l,o){const i=KR(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return XR[i]}function sx(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function ZR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var IR=rx,FR=ix,dc="Tabs",[JR]=al(dc,[lx]),cx=lx(),[WR,em]=JR(dc),ux=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:c,defaultValue:d,orientation:m="horizontal",dir:h,activationMode:y="automatic",...p}=n,x=Yf(h),[g,w]=kr({prop:i,onChange:c,defaultProp:d??"",caller:dc});return f.jsx(WR,{scope:o,baseId:Fa(),value:g,onValueChange:w,orientation:m,dir:x,activationMode:y,children:f.jsx(Ue.div,{dir:x,"data-orientation":m,...p,ref:l})})});ux.displayName=dc;var dx="TabsList",fx=v.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...c}=n,d=em(dx,o),m=cx(o);return f.jsx(IR,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:i,children:f.jsx(Ue.div,{role:"tablist","aria-orientation":d.orientation,...c,ref:l})})});fx.displayName=dx;var mx="TabsTrigger",hx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:c=!1,...d}=n,m=em(mx,o),h=cx(o),y=vx(m.baseId,i),p=yx(m.baseId,i),x=i===m.value;return f.jsx(FR,{asChild:!0,...h,focusable:!c,active:x,children:f.jsx(Ue.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:y,...d,ref:l,onMouseDown:De(n.onMouseDown,g=>{!c&&g.button===0&&g.ctrlKey===!1?m.onValueChange(i):g.preventDefault()}),onKeyDown:De(n.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&m.onValueChange(i)}),onFocus:De(n.onFocus,()=>{const g=m.activationMode!=="manual";!x&&!c&&g&&m.onValueChange(i)})})})});hx.displayName=mx;var px="TabsContent",gx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:c,children:d,...m}=n,h=em(px,o),y=vx(h.baseId,i),p=yx(h.baseId,i),x=i===h.value,g=v.useRef(x);return v.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),f.jsx(Vr,{present:c||x,children:({present:w})=>f.jsx(Ue.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":y,hidden:!w,id:p,tabIndex:0,...m,ref:l,style:{...n.style,animationDuration:g.current?"0s":void 0},children:w&&d})})});gx.displayName=px;function vx(n,l){return`${n}-trigger-${l}`}function yx(n,l){return`${n}-content-${l}`}var e_=ux,bx=fx,xx=hx,Sx=gx;const t_=e_,wx=v.forwardRef(({className:n,...l},o)=>f.jsx(bx,{ref:o,className:re("inline-flex h-10 items-center justify-center rounded-lg bg-muted/72 p-1 text-muted-foreground shadow-inner shadow-background/40",n),...l}));wx.displayName=bx.displayName;const js=v.forwardRef(({className:n,...l},o)=>f.jsx(xx,{ref:o,className:re("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-semibold ring-offset-background transition-all duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/12 data-[state=active]:text-primary data-[state=active]:shadow-[0_10px_28px_-18px_hsl(var(--primary)/0.85)]",n),...l}));js.displayName=xx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>f.jsx(Sx,{ref:o,className:re("mt-2 ring-offset-background data-[state=inactive]:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...l}));qs.displayName=Sx.displayName;var Ex="AlertDialog",[n_]=al(Ex,[wy]),wa=wy(),Nx=n=>{const{__scopeAlertDialog:l,...o}=n,i=wa(l);return f.jsx(By,{...i,...o,modal:!0})};Nx.displayName=Ex;var a_="AlertDialogTrigger",Tx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Hy,{...c,...i,ref:l})});Tx.displayName=a_;var l_="AlertDialogPortal",Cx=n=>{const{__scopeAlertDialog:l,...o}=n,i=wa(l);return f.jsx(Vy,{...i,...o})};Cx.displayName=l_;var r_="AlertDialogOverlay",Ax=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Bf,{...c,...i,ref:l})});Ax.displayName=r_;var Dr="AlertDialogContent",[o_,i_]=n_(Dr),s_=xC("AlertDialogContent"),Rx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...c}=n,d=wa(o),m=v.useRef(null),h=tt(l,m),y=v.useRef(null);return f.jsx(L5,{contentName:Dr,titleName:_x,docsSlug:"alert-dialog",children:f.jsx(o_,{scope:o,cancelRef:y,children:f.jsxs(Hf,{role:"alertdialog",...d,...c,ref:h,onOpenAutoFocus:De(c.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=y.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[f.jsx(s_,{children:i}),f.jsx(u_,{contentRef:m})]})})})});Rx.displayName=Dr;var _x="AlertDialogTitle",jx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(Vf,{...c,...i,ref:l})});jx.displayName=_x;var Mx="AlertDialogDescription",Ox=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx($f,{...c,...i,ref:l})});Ox.displayName=Mx;var c_="AlertDialogAction",Dx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,c=wa(o);return f.jsx(ac,{...c,...i,ref:l})});Dx.displayName=c_;var kx="AlertDialogCancel",zx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:c}=i_(kx,o),d=wa(o),m=tt(l,c);return f.jsx(ac,{...d,...i,ref:m})});zx.displayName=kx;var u_=({contentRef:n})=>{const l=`\`${Dr}\` requires a description for the component to be accessible for screen reader users.
311
311
 
312
312
  You can add a description to the \`${Dr}\` by passing a \`${Mx}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
313
313
 
314
314
  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 \`${Dr}\`. 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.
315
315
 
316
- 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_=Nx,f_=Tx,m_=Cx,Lx=Ax,Ux=Rx,Bx=Dx,Hx=zx,Vx=jx,$x=Ox;const gf=d_,vf=f_,h_=m_,Yx=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{className:re("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Yx.displayName=Lx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>f.jsxs(h_,{children:[f.jsx(Yx,{}),f.jsx(Ux,{ref:o,className:re("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})]}));Gs.displayName=Ux.displayName;const Ps=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-2 text-center sm:text-left",n),...l});Ps.displayName="AlertDialogHeader";const Xs=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Xs.displayName="AlertDialogFooter";const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx(Vx,{ref:o,className:re("text-lg font-semibold",n),...l}));Ks.displayName=Vx.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx($x,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Qs.displayName=$x.displayName;const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:re(jf(),n),...l}));Zs.displayName=Bx.displayName;const Is=v.forwardRef(({className:n,...l},o)=>f.jsx(Hx,{ref:o,className:re(jf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Is.displayName=Hx.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:re("relative inline-flex h-2.5 w-2.5 rounded-full",p_[n])})]})}function v_({role:n,size:l="default"}){return f.jsx(St,{variant:n==="leader"?"default":"secondary",className:re(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const qx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function Wj({status:n,size:l="default"}){const o=qx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(St,{variant:o.variant,className:re("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:re("rounded-full",o.dotClass)}),n]})}function eM({status:n,isNative:l=!1,size:o="default",className:i}){const c=qx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:re("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:re("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:re("rounded-full bg-sky-500",m),title:"native"})]})}const y_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function tM({priority:n}){const l=y_[n];return f.jsx(St,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function b_(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 Ar({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 x_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=b_(l.packages);return f.jsxs(qs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Pn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Xn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(sN,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):f.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Ar,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Ar,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Ar,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Ar,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Ar,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Ar,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(hN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Pn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Xn,{"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(St,{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 fc="Checkbox",[S_]=al(fc),[w_,tm]=S_(fc);function E_(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]=kr({prop:o,defaultProp:c??!1,onChange:y,caller:fc}),[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useRef(!1),O=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Ja(c)?!1:c,isFormControl:O,bubbleInput:C,setBubbleInput:A};return f.jsx(w_,{scope:l,...z,children:N_(g)?g(z):i})}var Gx="CheckboxTrigger",Px=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=tm(Gx,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const j=()=>g(C.current);return A.addEventListener("reset",j),()=>A.removeEventListener("reset",j)}},[d,g]),f.jsx(Ue.button,{type:"button",role:"checkbox","aria-checked":Ja(y)?"mixed":y,"aria-required":p,"data-state":Ix(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(j=>Ja(j)?!0:!j),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});Px.displayName=Gx;var nm=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(E_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Px,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Zx,{__scopeCheckbox:o})]})})});nm.displayName=fc;var Xx="CheckboxIndicator",Kx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=tm(Xx,o);return f.jsx(Vr,{present:i||Ja(d.checked)||d.checked===!0,children:f.jsx(Ue.span,{"data-state":Ix(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});Kx.displayName=Xx;var Qx="CheckboxBubbleInput",Zx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=tm(Qx,n),T=tt(o,N),E=gb(d),C=rb(i);v.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,B=Object.getOwnPropertyDescriptor(O,"checked").set,G=!c.current;if(E!==d&&B){const $=new Event("click",{bubbles:G});j.indeterminate=Ja(d),B.call(j,Ja(d)?!1:d),j.dispatchEvent($)}},[w,E,d,c]);const A=v.useRef(Ja(d)?!1:d);return f.jsx(Ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Zx.displayName=Qx;function N_(n){return typeof n=="function"}function Ja(n){return n==="indeterminate"}function Ix(n){return Ja(n)?"indeterminate":n?"checked":"unchecked"}const Fx=v.forwardRef(({className:n,...l},o)=>f.jsx(nm,{ref:o,className:re("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:f.jsx(Kx,{className:re("flex items-center justify-center text-current"),children:f.jsx(ks,{className:"h-3.5 w-3.5"})})}));Fx.displayName=nm.displayName;const am=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:re("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}));am.displayName="Input";const e0=["queued","running"];function T_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function C_(n){return n==="claude"||n==="codex"||n==="copilot"}function Jx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return C_(l)?`${n.nodeId}:${l}`:null}function A_(n){return n.status==="succeeded"||n.status==="failed"}async function Wx(n,l={}){const o=l.getOperation??pE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!A_(m)&&Date.now()<d;)await __(i),m=await o(n.id);return m}async function R_(n,l=gE){const o=new Set(n),i=await Promise.all(e0.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!e0.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Jx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function __(n){return new Promise(l=>setTimeout(l,n))}const j_=1500,M_=1e3,O_=9e4;async function e1(n={}){const l=n.fetchHealth??D_,o=n.initialDelayMs??j_,i=n.pollIntervalMs??M_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??z_,h=n.timeoutMs??O_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=k_(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 D_(){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 k_(n){return typeof n=="boolean"?{ok:n}:n}function z_(n){return new Promise(l=>window.setTimeout(l,n))}function L_(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 U_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=L_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>t0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[j,O]=v.useState(!1),[z,B]=v.useState(!1);v.useEffect(()=>{E(t0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!c||C||j)return;const le=p.updateAvailable?"update":"restart",fe=V_(T);if(T.port.trim()&&(fe==null?void 0:fe.port)===void 0){Ge.error("Runtime restart port must be a positive integer");return}const me=fe?{reason:le,startArgs:fe}:{reason:le};A(!0);try{if(i){const M=await O0(me);N({...M,pid:M.pid??h,status:"accepted"}),Ge.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.`),e1({previousPid:M.pid??h}).then(Y=>{Y||(A(!1),Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{A(!1),Ge.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ie=await yE(c,me);N({operationId:ie.id,pid:h,status:ie.status}),Ge.info(`Restart requested on ${d}. Operation ${Xd(ie.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const ue=await Wx(ie,{timeoutMs:6e4}),oe=H_(ue);N({command:oe==null?void 0:oe.command,logPath:oe==null?void 0:oe.logPath,mode:oe==null?void 0:oe.mode,operationId:ue.id,pid:(oe==null?void 0:oe.pid)??h,status:ue.status}),ue.status==="succeeded"?(await(m==null?void 0:m()),Ge.success(`Restart handoff accepted on ${d}. Follow ${(oe==null?void 0:oe.logPath)??"the node restart log"} for launch output.`)):ue.status==="failed"?Ge.error(ue.error??`Restart failed on ${d}`):Ge.info(`Restart operation ${Xd(ue.id)} is still ${ue.status}. More details will update after the node reports back.`),A(!1)}catch(ie){A(!1),Ge.error(ie instanceof Error?ie.message:"Runtime restart failed")}}async function $(){if(!(!i||C||j)){O(!0);try{const le=await mE();Ge.info(`Stopping Meshy process ${le.pid}`)}catch(le){O(!1),Ge.error(le instanceof Error?le.message:"Runtime stop failed")}}}const V=C?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ds,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(St,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),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(gf,{children:[f.jsx(vf,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:"ghost",disabled:C||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(xN,{className:re("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Gs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Ps,{className:"space-y-1",children:[f.jsx(Ks,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),f.jsxs(Xs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Is,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Zs,{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(gf,{children:[f.jsx(vf,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(tf,{className:re("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Gs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Ps,{className:"space-y-1",children:[f.jsxs(Ks,{className:"text-sm",children:[g,"?"]}),f.jsxs(Qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),f.jsx(B_,{value:T,onChange:E}),f.jsxs(Xs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Is,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>B(le=>!le),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx($0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Ko,{className:re("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(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Xd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function B_({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(Ho,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Ho,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Ho,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(Wb,{value:l.transport,onValueChange:i=>o("transport",t1(i)),children:[f.jsx(Jf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ex,{placeholder:"Transport"})}),f.jsxs(Wf,{children:[f.jsx(jr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Ho,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Ho,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[f.jsx(Fx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Ho({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:re("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(am,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function H_(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 t0(n){return{port:$_(n.endpoint),name:n.nodeName,join:"",transport:t1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function V_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function t1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function $_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Xd(n){return n.length<=8?n:n.slice(0,8)}function Vo({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(St,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(St,{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 Zt(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 Y_(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 n0(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 _r(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function q_(n){return n.available?f.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Yo,{className:"h-3 w-3"}),"Available"]}):f.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(nN,{className:"h-3 w-3"}),"Unavailable"]})}function G_(n){return n.update?n.update.updateAvailable?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function P_(n){return n.available?null:n.metadataStatus??null}function X_(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 K_(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:re("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function $o({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:re("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:re("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function Q_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=G_(n),m=!!o,h=P_(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(L0,{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:[q_(n),h&&f.jsx(St,{variant:_r(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($o,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx($o,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx($o,{label:"Checked",value:Zt(n.checkedAt)}),n.update&&f.jsx($o,{label:"Update check",value:Zt(n.update.checkedAt)}),f.jsx($o,{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(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(gf,{children:[f.jsx(vf,{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(Gs,{children:[f.jsxs(Ps,{children:[f.jsxs(Ks,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Qs,{children:["This runs ",X_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Xs,{children:[f.jsx(Is,{children:"Cancel"}),f.jsx(Zs,{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 Z_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function I_(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 F_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function J_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function W_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function e3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,le,fe,me,ie,ue,oe,M,Y,I,de,F,R,P,K,W,te,se,ee,ce;const d=v.useMemo(()=>Z_(n,l),[n,l]),[m,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===m)??w,T=N?I_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,j=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},O=v.useMemo(()=>d.map(J=>J.id),[d]),z=O.join("\0"),B=T_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[B]);v.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const $=v.useCallback(async(J,ve)=>{const be=Jx(J);if(!be||x.current.has(J.id))return;const Se=W_(J),He=(ve==null?void 0:ve.agentLabel)??(Se?J_(Se):"Agent"),je=(ve==null?void 0:ve.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p(Ve=>new Map(Ve).set(be,J));try{const Ve=await Wx(J);if(Ve.status==="succeeded")await(c==null?void 0:c()),g.current.has(Ve.id)||(Ge.success(`${He} upgrade finished on ${je}`),g.current.add(Ve.id));else if(Ve.status==="failed")g.current.has(Ve.id)||(Ge.error(K_(Ve)??`${He} upgrade failed`),g.current.add(Ve.id));else{p(dt=>new Map(dt).set(be,Ve)),Ge.info(`${He} upgrade is still ${Ve.status} on ${je}`);return}p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===Ve.id)&&Pe.delete(be),Pe})}catch(Ve){p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===J.id)&&Pe.delete(be),Pe}),Ge.error(Ve instanceof Error?Ve.message:`${He} upgrade failed`)}finally{x.current.delete(J.id)}},[c,G]);v.useEffect(()=>{if(O.length===0)return;let J=!1;async function ve(){let be;try{be=await R_(O)}catch{return}if(!J){p(Se=>{const He=new Map(Se);for(const[je,Ve]of be)He.set(je,Ve);return He});for(const Se of be.values())$(Se)}}return ve(),()=>{J=!0}},[$,z]);async function V(J){if(N)try{const ve=await vE(N.id,J.id);Ge.info(`${J.label} upgrade started on ${N.name}`),await $(ve,{agentLabel:J.label,nodeName:N.name})}catch(ve){Ge.error(ve instanceof Error?ve.message:`${J.label} upgrade failed`)}}return!N||!T?f.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):f.jsxs("div",{className:"space-y-3",children:[f.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&f.jsxs(St,{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 ",Zt((le=N.settingsSnapshot)==null?void 0:le.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(St,{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(St,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(Wb,{value:N.id,onValueChange:h,children:[f.jsx(Jf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ex,{placeholder:"Choose a node"})}),f.jsx(Wf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(jr,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:F_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(wN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",Y_(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(wx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(js,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(js,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(js,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(qs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(H0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Pn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Xn,{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:Zt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Zt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Pn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((fe=T.os)==null?void 0:fe.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ie=T.os)==null?void 0:ie.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((ue=T.os)==null?void 0:ue.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${n0(T.os.freeMemoryBytes)} free / ${n0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(U_,{checkedLabel:Zt(A.checkedAt),disableAuthDefault:((oe=T.auth)==null?void 0:oe.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:((Y=T.runtime)==null?void 0:Y.workDir)??N.workDir})}),f.jsxs(Yn,{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(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(L0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Pn,{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(Xn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(Q_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),f.jsxs(qs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(XE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Pn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Xn,{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(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{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(Pn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Pn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((R=T.runtime)==null?void 0:R.workDir)??T.workDir??"Unavailable",mono:!!(((P=T.runtime)==null?void 0:P.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(et,{label:"Process cwd",value:((te=T.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((se=T.runtime)!=null&&se.cwd)}),f.jsx(et,{label:"Started",value:Zt((ee=T.runtime)==null?void 0:ee.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Ds,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Pn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Xn,{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:Zt((ce=T.startupRequirements)==null?void 0:ce.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Vo,{formatDateTime:Zt,name:"Azure CLI",status:j.az,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"DevTunnel",status:j.devtunnel,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Claude Code",status:j.claude,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Codex",status:j.codex,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Copilot CLI",status:j.copilot,statusVariant:_r})]})]})]})]}),f.jsx(x_,{formatDateTime:Zt,viewInfo:T})]})]})}function t3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=k0();return f.jsx(G5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(e3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const nM="codex",aM="bypass",n3=[{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],lM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],rM=new Set(n3.filter(n=>n.supportsFollowUp).map(n=>n.value)),oM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],iM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],a3=new Set(["pending","assigned"]),l3=new Set(["running"]),r3=new Set(["completed","failed","cancelled"]),sM=10;function cM(n,l){switch(l){case"running":return l3.has(n.status);case"waiting":return a3.has(n.status);case"closed":return r3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function uM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function dM(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function o3(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(c=>c.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function fM(n,l,o){return o3(n,l,o).toLowerCase()}function mM(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function hM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function pM(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0,c=l.createDefaults,d=c&&typeof c=="object"&&!Array.isArray(c)?c:null,m=d?{assignTo:typeof d.assignTo=="string"||d.assignTo===null?d.assignTo:void 0,project:typeof d.project=="string"||d.project===null?d.project:void 0}: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,createDefaults:m}}function gM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function vM(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function yM(n){return new Date(n).toLocaleString()}function bM(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),c=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}async function i3(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),Ge.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 Ge.success(l),!0}catch(d){return Ge.error(d instanceof Error?d.message:"Failed to copy"),!1}}const s3="default workspace";function Ms(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function c3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function u3(n,l){const o=Ms(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function d3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return Ms(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return s3;if(c3(i)||!n.assignedTo)return Ms(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?u3(c,i):Ms(i)}function xM(n,l,o,i){const c=new Map;for(const m of n){const h=m.assignedTo??null,y=h??"__unassigned__",p=h?l.get(h)??m.assignedNodeName??h.slice(0,8):"Unassigned",x=d3(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 f3={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"},m3={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 h3(n){return n.split(".")[0]??"unknown"}function p3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Rr(n,l){return(l==null?void 0:l.get(n))??n}function n1(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${Rr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Rr(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 ${Rr(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 ${Rr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Rr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Rr(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 g3(n){return JSON.stringify(n,null,2)}function v3({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=h3(m.type);return f.jsx("div",{className:re("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:re("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:p3(m.timestamp)}),d?f.jsx("span",{className:re("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",m3[h]),children:m.type}):f.jsx(St,{variant:"outline",className:re("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",f3[h]),children:m.type})]}),f.jsxs("div",{className:re("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("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 i3(g3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(lN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(Y0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:n1(m,o)})]})},m.id)})})})}const y3=["node.","election.","transport."],b3="cluster.state";function x3(n){return n.type==="node.status"?!1:y3.some(l=>n.type.startsWith(l))}function S3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function w3(n,l){return n?{time:S3(n.timestamp),text:n1(n,l)}:null}function E3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function N3(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 T3(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 C3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function A3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function R3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onDesktopRestart:p,onReload:x,onRestart:g}){const[w,N]=v.useState(m),[T,E]=v.useState(h),[C,A]=v.useState(!0),[j,O]=v.useState(new Set),[z,B]=v.useState(!1),[G,$]=v.useState(!1),V=v.useRef(null),ne=v.useRef(null),le=v.useMemo(()=>l.filter(Ne=>x3(Ne)&&!j.has(Ne.id)),[l,j]),fe=v.useMemo(()=>l.find(Ne=>Ne.type===b3)??le[0],[l,le]),me=v.useMemo(()=>w3(fe,c),[fe,c]),ie=v.useMemo(()=>{const Ne=new Map(o.map(Xe=>[Xe.id,Xe]));return i&&Ne.set(i.id,i),Array.from(Ne.values())},[i,o]),ue=v.useMemo(()=>ie.filter(E3),[ie]),oe=ue.some(Ne=>{var Xe;return Ne.status==="offline"||((Xe=Ne.devtunnelHealth)==null?void 0:Xe.status)==="failed"}),M=ie.some(Ne=>Ne.status==="offline"),Y=ie.some(Ne=>Ne.status==="busy"),I=ie.length>0,de=(i==null?void 0:i.name)??"offline",F=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",R=d!==null,P=!!(R&&(d!=null&&d.updateAvailable)&&d.latestVersion),K=(d==null?void 0:d.latestVersion)??null,W=!!(R&&!P&&!K&&(d!=null&&d.detail)),te=z?"Relaunching runtime...":"Relaunch to apply update",se=G?"Downloading and installing desktop update...":P&&K?`Available version ${K}`:W?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",ee=!!x,ce=!!(R&&p),J=ee||ce,ve=R||!!g,be=R||!!g||ee,Se=ve?R?"Update":"Relaunch":"Reload",He=ve?R?se:te:"Reload dashboard page",je=ve?R?G:z:!1,Ve=ve?R?je||!P||!y:je:!1,dt=R?P&&K?`Install desktop update ${K}`:W?"Desktop update unavailable":"Desktop is current":ve?z?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function Pe(){ne.current&&(clearTimeout(ne.current),ne.current=null)}function Lt(){Pe(),N(!0)}function ht(){Pe(),ne.current=setTimeout(()=>{N(!1),ne.current=null},180)}function ol(){Pe()}function il(){Pe(),E(!1),N(!1)}async function Tt(){if(!(!g||z)){B(!0);try{await g()}finally{B(!1)}}}async function jn(){if(!(!P||!y||G)){$(!0);try{await y()}finally{$(!1)}}}async function Ct(){if(!(!p||z)){E(!1),B(!0);try{await p()}finally{B(!1)}}}async function Ll(){if(!ve){await Mn();return}if(R){await jn();return}await Tt()}async function Mn(){x&&(E(!1),await x())}return v.useEffect(()=>()=>{Pe()},[]),v.useEffect(()=>{O(Ne=>{if(Ne.size===0)return Ne;const Xe=new Set(l.map(st=>st.id)),We=new Set(Array.from(Ne).filter(st=>Xe.has(st)));return We.size===Ne.size?Ne:We})},[l]),v.useEffect(()=>{w||E(!1)},[w]),v.useEffect(()=>{if(!w)return;const Ne=We=>{var st;(st=V.current)!=null&&st.contains(We.target)||(Pe(),E(!1),N(!1))},Xe=We=>{We.key==="Escape"&&(Pe(),E(!1),N(!1))};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",Xe),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",Xe)}},[w]),f.jsxs("div",{ref:V,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":w,"aria-haspopup":"dialog",onClick:()=>N(Ne=>!Ne),onMouseEnter:Lt,onMouseLeave:ht,className:re("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",w&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:re("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:re("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:re("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:F})]})]}),w&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:ol,onMouseLeave:il,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(Ds,{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:re("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:le.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[M?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):Y?f.jsx(Ds,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Yo,{className:re("h-3 w-3 shrink-0",I?"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:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",M?"border-destructive/30 bg-destructive/10 text-destructive":Y?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":I?"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:C3(ie)})]}),ie.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ie.map(Ne=>{const{label:Xe,status:We}=A3(Ne,c),st=We==="offline",On=We==="busy";return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Xe} ${We}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(vv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Yo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[oe?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Yo,{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:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",oe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:N3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(Ne=>{var kn;const{label:Xe,status:We}=T3(Ne,c),st=We==="failed"||We==="offline",On=We!=="healthy"&&We!=="failed"&&We!=="offline",Dn=(kn=Ne.devtunnelHealth)!=null&&kn.reason?`${Xe} ${We}: ${Ne.devtunnelHealth.reason}`:`${Xe} ${We}`;return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-muted/30":"bg-emerald-500/5"),title:Dn,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(vv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Yo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>A(Ne=>!Ne),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 ",le.length>0&&`(${le.length})`]}),C?f.jsx(Ko,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(ef,{className:"h-3 w-3 text-muted-foreground"})]}),C&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(v3,{events:le,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:Ne=>O(Xe=>new Set(Xe).add(Ne))})})]}),R&&(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:be&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void Ll(),disabled:Ve,"aria-label":dt,"aria-describedby":"live-link-restart-hint",title:He,children:[f.jsx(yv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),J&&f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>E(Ne=>!Ne),"aria-label":"Open live link actions","aria-expanded":T,title:"Live link actions",children:f.jsx(Ko,{className:"h-2.5 w-2.5"})})]}),J&&T&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ll(),disabled:Ve,"aria-label":dt,children:[f.jsx(yv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),ce&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ct(),disabled:z,"aria-label":"Restart Meshy Desktop",children:[f.jsx(tf,{className:re("h-2.5 w-2.5",z&&"animate-spin")}),f.jsx("span",{children:"Restart"})]}),ee&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Mn(),"aria-label":"Reload dashboard page",children:[f.jsx(tf,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:He})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>O(new Set(l.map(Ne=>Ne.id))),disabled:le.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>N(!1),children:"Close"})]})]})]})]})}const a0="dark",Lr="fluent",_3="clean",Kd="meshy-layout-default-migrated-to-compact",yf="true",j3="compact",M3=new Set(["airy","clean","fluent"]);function O3(n){return n!==null&&M3.has(n)}function lm(n){return n===j3?"fluent":O3(n)?n:null}function D3(n,l){const o=lm(n);return o===_3&&l!==yf?Lr:o??Lr}const Fs="symphony",a1="default",k3=new Set(["light","dark","system"]),z3=new Set(["porcelain","warm","finsight","edge","symphony","launcher"]),l1=v.createContext(null);function L3(n){const l=new URLSearchParams(n).get("theme");return r1(l)?l:null}function U3(n){const l=new URLSearchParams(n).get("palette");return rm(l)}function B3(n){const l=new URLSearchParams(n).get("layout");return lm(l)}function H3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:rm(n.getAttribute("data-palette"))??Fs,layout:lm(n.getAttribute("data-layout"))??Lr}}function SM(n,l=H3()){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 V3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?L3(window.location.search)??q3(localStorage.getItem("meshy-theme"))??a0:a0),[i,c]=v.useState(()=>typeof window<"u"?U3(window.location.search)??G3(localStorage.getItem("meshy-palette"))??Fs:Fs),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=B3(window.location.search);if(h)return localStorage.setItem(Kd,yf),h;const y=D3(localStorage.getItem("meshy-layout"),localStorage.getItem(Kd));return localStorage.setItem(Kd,yf),y}return Lr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===Lr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(l1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function $3(){const n=v.useContext(l1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function r1(n){return n!==null&&k3.has(n)}function Y3(n){return n!==null&&z3.has(n)}function q3(n){return r1(n)?n:null}function rm(n){return n===a1?"porcelain":Y3(n)?n:null}function G3(n){return n===a1?null:rm(n)}const P3=[{value:"light",label:"Light",icon:V0},{value:"dark",label:"Dark",icon:B0},{value:"system",label:"System",icon:U0}],o1=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"},{value:"launcher",label:"Launcher",hint:"Desktop startup blue"}],i1=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function X3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=$3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?B0:n==="light"?V0:U0,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(yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:re("h-8 w-8 rounded-sm",o!==Fs||c!==Lr?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none rounded-md border border-border/70 bg-popover/95 p-2 text-popover-foreground shadow-[0_24px_70px_-32px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[23rem] sm:max-w-[23rem]",children:[f.jsxs("div",{className:"mb-2 flex items-end justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[10px] font-medium text-foreground",children:[K3(c)," / ",Q3(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-1.5 py-0.5 text-[8px] font-medium capitalize text-muted-foreground",children:n})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-0.5",children:P3.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:re("flex min-h-[2.1rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-1.5 py-1 text-[9px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[f.jsx(E,{className:"h-3 w-3"}),T]},N)})}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:i1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(ks,{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:o1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(Z3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(ks,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function K3(n){var l;return((l=i1.find(o=>o.value===n))==null?void 0:l.label)??n}function Q3(n){var l;return((l=o1.find(o=>o.value===n))==null?void 0:l.label)??n}function Z3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"],launcher:["hsl(213 77% 49%)","hsl(60 10% 96%)","hsl(0 0% 100%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:re("flex h-5 w-5 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const Go={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},s1="meshy-dashboard-panel-state-v2",c1="meshy-dashboard-terminal-open-v1";function wM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Go.tasks.defaultSize,operations:Go.operations.defaultSize,terminal:Go.terminal.defaultSize}}}function Qd(n){return typeof n=="object"&&n!==null}function l0(n,l){return typeof n=="boolean"?n:l}function Zd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Po(n,l):o}function Po(n,l){const o=Go[n];return Math.min(o.max,Math.max(o.min,l))}function EM(n,l){if(!n)return l;try{const o=n.getItem(s1);if(!o)return l;const i=JSON.parse(o);if(!Qd(i))return l;const c=Qd(i.layout)?i.layout:{},d=Qd(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:l0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:l0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:Zd("tasks",d.tasks,l.sizes.tasks),operations:Zd("operations",d.operations,l.sizes.operations),terminal:Zd("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function NM(n,l){if(n)try{n.setItem(s1,JSON.stringify(l))}catch{}}function I3(n,l){if(!n)return l;try{const o=n.getItem(c1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function F3(n,l){if(n)try{n.setItem(c1,String(l))}catch{}}function r0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function TM(n){return`${Number(n.toFixed(2))}rem`}function CM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Po(n,l+(c-o)/h):n==="operations"?Po(n,l+(o-c)/h):Po(n,l+(i-d)/h)}function AM(n,l,o){const i=o===0?0:o>0?-1:1;return Po(n,l+i*Go[n].wheelStep)}const J3=7200*1e3;function W3(){return f.jsxs("svg",{"data-meshy-app-icon":"header",viewBox:"0 0 1024 1024",className:"h-8 w-8","aria-hidden":"true",children:[f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"meshy-header-icon-bg",x1:"160",y1:"128",x2:"864",y2:"896",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#182033"}),f.jsx("stop",{offset:"1",stopColor:"#0a0f1f"})]}),f.jsxs("linearGradient",{id:"meshy-header-icon-edge",x1:"260",y1:"244",x2:"768",y2:"780",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#66e3ff"}),f.jsx("stop",{offset:"0.52",stopColor:"#8fd56b"}),f.jsx("stop",{offset:"1",stopColor:"#ffcb5b"})]})]}),f.jsx("rect",{width:"1024",height:"1024",rx:"224",fill:"url(#meshy-header-icon-bg)"}),f.jsx("path",{d:"M308 652V372l204 174 204-174v280",fill:"none",stroke:"url(#meshy-header-icon-edge)",strokeWidth:"86",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("circle",{cx:"308",cy:"372",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"512",cy:"546",r:"58",fill:"#8fd56b"}),f.jsx("circle",{cx:"716",cy:"372",r:"58",fill:"#ffcb5b"}),f.jsx("circle",{cx:"308",cy:"652",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"716",cy:"652",r:"58",fill:"#ffcb5b"})]})}function Ns(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function o0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function Id(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function ej(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function tj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=k0(),c=Fn(),[d,m]=v.useState(()=>I3(r0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Ns(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const B=new Map;for(const G of(n==null?void 0:n.nodes)??[])B.set(G.id,G.name);return n!=null&&n.self&&B.set(n.self.id,n.self.name),B},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(B=>{m(G=>typeof B=="function"?B(G):B)},[]);v.useEffect(()=>{F3(r0(),d)},[d]),v.useEffect(()=>{const B=Ns();if(!B){w(null);return}let G=!1,$=!1;const V=le=>{$||($=!0,le&&w(o0("Checking desktop update...")),B("check_desktop_update").then(fe=>{G||w(fe)}).catch(fe=>{if(!G){const me=Id(fe,"Desktop update check failed");w(ie=>ie!=null&&ie.updateAvailable?ie:o0(me))}}).finally(()=>{$=!1}))};V(!0);const ne=window.setInterval(()=>V(!1),J3);return()=>{G=!0,window.clearInterval(ne)}},[i==null?void 0:i.version]);async function j(){try{const B=await O0({reason:"restart"});Ge.info(`Restarting runtime. Follow ${B.logPath} for launch output.`),await e1({previousPid:B.pid})||Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(B){Ge.error(B instanceof Error?B.message:"Runtime restart failed")}}async function O(){const B=Ns();if(!B){Ge.error("Desktop updater is not available in this window");return}try{Ge.info("Downloading desktop update...");const G=await B("install_desktop_update");Ge.info(ej(G))}catch(G){Ge.error(Id(G,"Desktop update failed"))}}async function z(){const B=Ns();if(!B){Ge.error("Desktop restart is not available in this window");return}try{Ge.info("Restarting Meshy Desktop..."),await B("restart_desktop_app")}catch(G){Ge.error(Id(G,"Desktop restart 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:re("dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Wd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx(W3,{}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(H0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(ef,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(fN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(ef,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Wd,{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(am,{"aria-label":"Search tasks",value:h,onChange:B=>y(B.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>A(B=>!B),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:re("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx($0,{className:"h-4 w-4"})}),f.jsx(t3,{}),f.jsx(X3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(R3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?O:void 0,onDesktopRestart:N?z:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:j})]})]})}),f.jsx("main",{className:re("min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:re("mx-auto h-full min-h-0",T),children:f.jsx(_w,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const i0=v.lazy(async()=>({default:(await u0(()=>import("./DashboardPage-SPgMQP8H.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),nj=v.lazy(async()=>({default:(await u0(()=>import("./SharedConversationPage-Cd0hBNE_.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function aj(){return f.jsx(tE,{children:f.jsx(v.Suspense,{fallback:f.jsx(lj,{}),children:f.jsxs(Mw,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(nj,{})}),f.jsxs(jl,{element:f.jsx(kE,{children:f.jsx(tj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(i0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(hv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(hv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(i0,{})})]})]})})})}function lj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function rj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function oj(n){return f.jsx(eC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}rj();j2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(V3,{children:[f.jsx(aj,{}),f.jsx(oj,{})]})}));export{Qs as $,Yy as A,yn as B,ks as C,aM as D,Gy as E,uN as F,SM as G,lN as H,am as I,i3 as J,o3 as K,L0 as L,t_ as M,eM as N,wx as O,tM as P,js as Q,St as R,H0 as S,lM as T,yM as U,qs as V,gf as W,Y0 as X,Gs as Y,Ps as Z,Ks as _,rC as a,mM as a$,Xs as a0,Is as a1,Zs as a2,u0 as a3,dj as a4,qy as a5,q5 as a6,Nj as a7,$0 as a8,Yo as a9,r0 as aA,NM as aB,AM as aC,TM as aD,CM as aE,Cj as aF,AE as aG,SE as aH,Fj as aI,Ij as aJ,jE as aK,kj as aL,pj as aM,mj as aN,Py as aO,hj as aP,gj as aQ,gE as aR,t3 as aS,zj as aT,Lj as aU,sj as aV,Fn as aW,S0 as aX,ij as aY,k0 as aZ,pM as a_,nN as aa,Ej as ab,Tj as ac,wj as ad,_N as ae,gN as af,hM as ag,wN as ah,v3 as ai,g_ as aj,sN as ak,v_ as al,bM as am,a3 as an,sM as ao,xM as ap,oM as aq,iM as ar,gM as as,Fx as at,vM as au,vf as av,Uj as aw,Bj as ax,EM as ay,wM as az,re as b,cM as b0,uM as b1,fM as b2,dM as b3,Aj as b4,rM as b5,l3 as b6,Oj as b7,Dj as b8,Mj as b9,jj as ba,uj as bb,fj as bc,cj as bd,vj as be,Wj as bf,qj as bg,Yj as bh,$j as bi,Hj as bj,Vj as bk,Gj as bl,n3 as bm,s0 as bn,FE as bo,Kj as bp,Xj as bq,Pj as br,tf as bs,Qj as bt,Jj as bu,Zj as bv,Be as c,ry as d,Sj as e,pE as f,bj as g,yj as h,fN as i,f as j,ef as k,jr as l,xj as m,_j as n,Wb as o,Jf as p,ex as q,v as r,Wf as s,Ge as t,CN as u,Ko as v,DN as w,nM as x,Rj as y,V5 as z};
316
+ 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_=Nx,f_=Tx,m_=Cx,Lx=Ax,Ux=Rx,Bx=Dx,Hx=zx,Vx=jx,$x=Ox;const gf=d_,vf=f_,h_=m_,Yx=v.forwardRef(({className:n,...l},o)=>f.jsx(Lx,{className:re("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Yx.displayName=Lx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>f.jsxs(h_,{children:[f.jsx(Yx,{}),f.jsx(Ux,{ref:o,className:re("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})]}));Gs.displayName=Ux.displayName;const Ps=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-2 text-center sm:text-left",n),...l});Ps.displayName="AlertDialogHeader";const Xs=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Xs.displayName="AlertDialogFooter";const Ks=v.forwardRef(({className:n,...l},o)=>f.jsx(Vx,{ref:o,className:re("text-lg font-semibold",n),...l}));Ks.displayName=Vx.displayName;const Qs=v.forwardRef(({className:n,...l},o)=>f.jsx($x,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Qs.displayName=$x.displayName;const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Bx,{ref:o,className:re(jf(),n),...l}));Zs.displayName=Bx.displayName;const Is=v.forwardRef(({className:n,...l},o)=>f.jsx(Hx,{ref:o,className:re(jf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Is.displayName=Hx.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:re("relative inline-flex h-2.5 w-2.5 rounded-full",p_[n])})]})}function v_({role:n,size:l="default"}){return f.jsx(St,{variant:n==="leader"?"default":"secondary",className:re(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const qx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function eM({status:n,size:l="default"}){const o=qx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(St,{variant:o.variant,className:re("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:re("rounded-full",o.dotClass)}),n]})}function tM({status:n,isNative:l=!1,size:o="default",className:i}){const c=qx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:re("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:re("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:re("rounded-full bg-sky-500",m),title:"native"})]})}const y_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function nM({priority:n}){const l=y_[n];return f.jsx(St,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function b_(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 Ar({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 x_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=b_(l.packages);return f.jsxs(qs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Pn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Xn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(sN,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):f.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Ar,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Ar,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Ar,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Ar,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Ar,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Ar,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(hN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Pn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Xn,{"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(St,{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 fc="Checkbox",[S_]=al(fc),[w_,tm]=S_(fc);function E_(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]=kr({prop:o,defaultProp:c??!1,onChange:y,caller:fc}),[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useRef(!1),O=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Ja(c)?!1:c,isFormControl:O,bubbleInput:C,setBubbleInput:A};return f.jsx(w_,{scope:l,...z,children:N_(g)?g(z):i})}var Gx="CheckboxTrigger",Px=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=tm(Gx,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const j=()=>g(C.current);return A.addEventListener("reset",j),()=>A.removeEventListener("reset",j)}},[d,g]),f.jsx(Ue.button,{type:"button",role:"checkbox","aria-checked":Ja(y)?"mixed":y,"aria-required":p,"data-state":Ix(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(j=>Ja(j)?!0:!j),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});Px.displayName=Gx;var nm=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(E_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Px,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(Zx,{__scopeCheckbox:o})]})})});nm.displayName=fc;var Xx="CheckboxIndicator",Kx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=tm(Xx,o);return f.jsx(Vr,{present:i||Ja(d.checked)||d.checked===!0,children:f.jsx(Ue.span,{"data-state":Ix(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});Kx.displayName=Xx;var Qx="CheckboxBubbleInput",Zx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=tm(Qx,n),T=tt(o,N),E=gb(d),C=rb(i);v.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,B=Object.getOwnPropertyDescriptor(O,"checked").set,G=!c.current;if(E!==d&&B){const $=new Event("click",{bubbles:G});j.indeterminate=Ja(d),B.call(j,Ja(d)?!1:d),j.dispatchEvent($)}},[w,E,d,c]);const A=v.useRef(Ja(d)?!1:d);return f.jsx(Ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Zx.displayName=Qx;function N_(n){return typeof n=="function"}function Ja(n){return n==="indeterminate"}function Ix(n){return Ja(n)?"indeterminate":n?"checked":"unchecked"}const Fx=v.forwardRef(({className:n,...l},o)=>f.jsx(nm,{ref:o,className:re("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:f.jsx(Kx,{className:re("flex items-center justify-center text-current"),children:f.jsx(ks,{className:"h-3.5 w-3.5"})})}));Fx.displayName=nm.displayName;const am=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:re("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}));am.displayName="Input";const e0=["queued","running"];function T_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function C_(n){return n==="claude"||n==="codex"||n==="copilot"}function Jx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return C_(l)?`${n.nodeId}:${l}`:null}function A_(n){return n.status==="succeeded"||n.status==="failed"}async function Wx(n,l={}){const o=l.getOperation??pE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!A_(m)&&Date.now()<d;)await __(i),m=await o(n.id);return m}async function R_(n,l=gE){const o=new Set(n),i=await Promise.all(e0.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!e0.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Jx(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function __(n){return new Promise(l=>setTimeout(l,n))}const j_=1500,M_=1e3,O_=9e4;async function e1(n={}){const l=n.fetchHealth??D_,o=n.initialDelayMs??j_,i=n.pollIntervalMs??M_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??z_,h=n.timeoutMs??O_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=k_(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 D_(){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 k_(n){return typeof n=="boolean"?{ok:n}:n}function z_(n){return new Promise(l=>window.setTimeout(l,n))}function L_(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 U_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=L_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>t0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[j,O]=v.useState(!1),[z,B]=v.useState(!1);v.useEffect(()=>{E(t0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!c||C||j)return;const le=p.updateAvailable?"update":"restart",fe=V_(T);if(T.port.trim()&&(fe==null?void 0:fe.port)===void 0){Ge.error("Runtime restart port must be a positive integer");return}const me=fe?{reason:le,startArgs:fe}:{reason:le};A(!0);try{if(i){const M=await O0(me);N({...M,pid:M.pid??h,status:"accepted"}),Ge.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.`),e1({previousPid:M.pid??h}).then(Y=>{Y||(A(!1),Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{A(!1),Ge.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ie=await yE(c,me);N({operationId:ie.id,pid:h,status:ie.status}),Ge.info(`Restart requested on ${d}. Operation ${Xd(ie.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const ue=await Wx(ie,{timeoutMs:6e4}),oe=H_(ue);N({command:oe==null?void 0:oe.command,logPath:oe==null?void 0:oe.logPath,mode:oe==null?void 0:oe.mode,operationId:ue.id,pid:(oe==null?void 0:oe.pid)??h,status:ue.status}),ue.status==="succeeded"?(await(m==null?void 0:m()),Ge.success(`Restart handoff accepted on ${d}. Follow ${(oe==null?void 0:oe.logPath)??"the node restart log"} for launch output.`)):ue.status==="failed"?Ge.error(ue.error??`Restart failed on ${d}`):Ge.info(`Restart operation ${Xd(ue.id)} is still ${ue.status}. More details will update after the node reports back.`),A(!1)}catch(ie){A(!1),Ge.error(ie instanceof Error?ie.message:"Runtime restart failed")}}async function $(){if(!(!i||C||j)){O(!0);try{const le=await mE();Ge.info(`Stopping Meshy process ${le.pid}`)}catch(le){O(!1),Ge.error(le instanceof Error?le.message:"Runtime stop failed")}}}const V=C?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ds,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(St,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),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(gf,{children:[f.jsx(vf,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:"ghost",disabled:C||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(xN,{className:re("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Gs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Ps,{className:"space-y-1",children:[f.jsx(Ks,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),f.jsxs(Xs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Is,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Zs,{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(gf,{children:[f.jsx(vf,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(tf,{className:re("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Gs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Ps,{className:"space-y-1",children:[f.jsxs(Ks,{className:"text-sm",children:[g,"?"]}),f.jsxs(Qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),f.jsx(B_,{value:T,onChange:E}),f.jsxs(Xs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Is,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Zs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>B(le=>!le),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx($0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Ko,{className:re("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(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Xd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function B_({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(Ho,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Ho,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Ho,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(Wb,{value:l.transport,onValueChange:i=>o("transport",t1(i)),children:[f.jsx(Jf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ex,{placeholder:"Transport"})}),f.jsxs(Wf,{children:[f.jsx(jr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(jr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Ho,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Ho,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[f.jsx(Fx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Ho({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:re("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(am,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function H_(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 t0(n){return{port:$_(n.endpoint),name:n.nodeName,join:"",transport:t1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function V_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function t1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function $_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Xd(n){return n.length<=8?n:n.slice(0,8)}function Vo({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(St,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(St,{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 Zt(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 Y_(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 n0(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 _r(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function q_(n){return n.available?f.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Yo,{className:"h-3 w-3"}),"Available"]}):f.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(nN,{className:"h-3 w-3"}),"Unavailable"]})}function G_(n){return n.update?n.update.updateAvailable?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function P_(n){return n.available?null:n.metadataStatus??null}function X_(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 K_(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:re("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function $o({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:re("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:re("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function Q_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=G_(n),m=!!o,h=P_(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(L0,{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:[q_(n),h&&f.jsx(St,{variant:_r(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($o,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx($o,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx($o,{label:"Checked",value:Zt(n.checkedAt)}),n.update&&f.jsx($o,{label:"Update check",value:Zt(n.update.checkedAt)}),f.jsx($o,{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(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(gf,{children:[f.jsx(vf,{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(Gs,{children:[f.jsxs(Ps,{children:[f.jsxs(Ks,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Qs,{children:["This runs ",X_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Xs,{children:[f.jsx(Is,{children:"Cancel"}),f.jsx(Zs,{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 Z_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function I_(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 F_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function J_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function W_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function e3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,le,fe,me,ie,ue,oe,M,Y,I,de,F,R,P,K,W,te,se,ee,ce;const d=v.useMemo(()=>Z_(n,l),[n,l]),[m,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===m)??w,T=N?I_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,j=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},O=v.useMemo(()=>d.map(J=>J.id),[d]),z=O.join("\0"),B=T_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[B]);v.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const $=v.useCallback(async(J,ve)=>{const be=Jx(J);if(!be||x.current.has(J.id))return;const Se=W_(J),He=(ve==null?void 0:ve.agentLabel)??(Se?J_(Se):"Agent"),je=(ve==null?void 0:ve.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p(Ve=>new Map(Ve).set(be,J));try{const Ve=await Wx(J);if(Ve.status==="succeeded")await(c==null?void 0:c()),g.current.has(Ve.id)||(Ge.success(`${He} upgrade finished on ${je}`),g.current.add(Ve.id));else if(Ve.status==="failed")g.current.has(Ve.id)||(Ge.error(K_(Ve)??`${He} upgrade failed`),g.current.add(Ve.id));else{p(dt=>new Map(dt).set(be,Ve)),Ge.info(`${He} upgrade is still ${Ve.status} on ${je}`);return}p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===Ve.id)&&Pe.delete(be),Pe})}catch(Ve){p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===J.id)&&Pe.delete(be),Pe}),Ge.error(Ve instanceof Error?Ve.message:`${He} upgrade failed`)}finally{x.current.delete(J.id)}},[c,G]);v.useEffect(()=>{if(O.length===0)return;let J=!1;async function ve(){let be;try{be=await R_(O)}catch{return}if(!J){p(Se=>{const He=new Map(Se);for(const[je,Ve]of be)He.set(je,Ve);return He});for(const Se of be.values())$(Se)}}return ve(),()=>{J=!0}},[$,z]);async function V(J){if(N)try{const ve=await vE(N.id,J.id);Ge.info(`${J.label} upgrade started on ${N.name}`),await $(ve,{agentLabel:J.label,nodeName:N.name})}catch(ve){Ge.error(ve instanceof Error?ve.message:`${J.label} upgrade failed`)}}return!N||!T?f.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):f.jsxs("div",{className:"space-y-3",children:[f.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&f.jsxs(St,{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 ",Zt((le=N.settingsSnapshot)==null?void 0:le.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(St,{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(St,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(Wb,{value:N.id,onValueChange:h,children:[f.jsx(Jf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ex,{placeholder:"Choose a node"})}),f.jsx(Wf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(jr,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:F_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(wN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",Y_(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(wx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(js,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(js,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(js,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(qs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(H0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Pn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Xn,{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:Zt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Zt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(oN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Pn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((fe=T.os)==null?void 0:fe.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ie=T.os)==null?void 0:ie.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((ue=T.os)==null?void 0:ue.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${n0(T.os.freeMemoryBytes)} free / ${n0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(U_,{checkedLabel:Zt(A.checkedAt),disableAuthDefault:((oe=T.auth)==null?void 0:oe.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:((Y=T.runtime)==null?void 0:Y.workDir)??N.workDir})}),f.jsxs(Yn,{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(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(L0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Pn,{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(Xn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(Q_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),f.jsxs(qs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(XE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Pn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Xn,{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(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{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(Pn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(uN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Pn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((R=T.runtime)==null?void 0:R.workDir)??T.workDir??"Unavailable",mono:!!(((P=T.runtime)==null?void 0:P.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(et,{label:"Process cwd",value:((te=T.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((se=T.runtime)!=null&&se.cwd)}),f.jsx(et,{label:"Started",value:Zt((ee=T.runtime)==null?void 0:ee.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Ds,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Pn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Xn,{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:Zt((ce=T.startupRequirements)==null?void 0:ce.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Vo,{formatDateTime:Zt,name:"Azure CLI",status:j.az,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"DevTunnel",status:j.devtunnel,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Claude Code",status:j.claude,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Codex",status:j.codex,statusVariant:_r}),f.jsx(Vo,{formatDateTime:Zt,name:"Copilot CLI",status:j.copilot,statusVariant:_r})]})]})]})]}),f.jsx(x_,{formatDateTime:Zt,viewInfo:T})]})]})}function t3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=k0();return f.jsx(G5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(e3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const aM="codex",lM="bypass",n3=[{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"}],rM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],oM=new Set(n3.filter(n=>n.supportsFollowUp).map(n=>n.value)),iM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],sM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],a3=new Set(["pending","assigned"]),l3=new Set(["running"]),r3=new Set(["completed","failed","cancelled"]),cM=10;function uM(n,l){switch(l){case"running":return l3.has(n.status);case"waiting":return a3.has(n.status);case"closed":return r3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function dM(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function fM(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 o3(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 mM(n,l,o){return o3(n,l,o).toLowerCase()}function hM(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 pM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function gM(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0,c=l.createDefaults,d=c&&typeof c=="object"&&!Array.isArray(c)?c:null,m=d?{assignTo:typeof d.assignTo=="string"||d.assignTo===null?d.assignTo:void 0,project:typeof d.project=="string"||d.project===null?d.project:void 0}: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,createDefaults:m}}function vM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function yM(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 bM(n){return new Date(n).toLocaleString()}function xM(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 i3(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),Ge.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 Ge.success(l),!0}catch(d){return Ge.error(d instanceof Error?d.message:"Failed to copy"),!1}}const s3="default workspace";function Ms(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function c3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function u3(n,l){const o=Ms(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function d3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return Ms(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return s3;if(c3(i)||!n.assignedTo)return Ms(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?u3(c,i):Ms(i)}function SM(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=d3(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 f3={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"},m3={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 h3(n){return n.split(".")[0]??"unknown"}function p3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function Rr(n,l){return(l==null?void 0:l.get(n))??n}function n1(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${Rr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${Rr(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 ${Rr(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 ${Rr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${Rr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${Rr(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 g3(n){return JSON.stringify(n,null,2)}function v3({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=h3(m.type);return f.jsx("div",{className:re("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:re("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:p3(m.timestamp)}),d?f.jsx("span",{className:re("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",m3[h]),children:m.type}):f.jsx(St,{variant:"outline",className:re("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",f3[h]),children:m.type})]}),f.jsxs("div",{className:re("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("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 i3(g3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(lN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(Y0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:n1(m,o)})]})},m.id)})})})}const y3=["node.","election.","transport."],b3="cluster.state";function x3(n){return n.type==="node.status"?!1:y3.some(l=>n.type.startsWith(l))}function S3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function w3(n,l){return n?{time:S3(n.timestamp),text:n1(n,l)}:null}function E3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function N3(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 T3(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 C3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function A3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function R3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onDesktopRestart:p,onReload:x,onRestart:g}){const[w,N]=v.useState(m),[T,E]=v.useState(h),[C,A]=v.useState(!0),[j,O]=v.useState(new Set),[z,B]=v.useState(!1),[G,$]=v.useState(!1),V=v.useRef(null),ne=v.useRef(null),le=v.useMemo(()=>l.filter(Ne=>x3(Ne)&&!j.has(Ne.id)),[l,j]),fe=v.useMemo(()=>l.find(Ne=>Ne.type===b3)??le[0],[l,le]),me=v.useMemo(()=>w3(fe,c),[fe,c]),ie=v.useMemo(()=>{const Ne=new Map(o.map(Xe=>[Xe.id,Xe]));return i&&Ne.set(i.id,i),Array.from(Ne.values())},[i,o]),ue=v.useMemo(()=>ie.filter(E3),[ie]),oe=ue.some(Ne=>{var Xe;return Ne.status==="offline"||((Xe=Ne.devtunnelHealth)==null?void 0:Xe.status)==="failed"}),M=ie.some(Ne=>Ne.status==="offline"),Y=ie.some(Ne=>Ne.status==="busy"),I=ie.length>0,de=(i==null?void 0:i.name)??"offline",F=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",R=d!==null,P=!!(R&&(d!=null&&d.updateAvailable)&&d.latestVersion),K=(d==null?void 0:d.latestVersion)??null,W=!!(R&&!P&&!K&&(d!=null&&d.detail)),te=z?"Relaunching runtime...":"Relaunch to apply update",se=G?"Downloading and installing desktop update...":P&&K?`Available version ${K}`:W?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",ee=!!x,ce=!!(R&&p),J=ee||ce,ve=R||!!g,be=R||!!g||ee,Se=ve?R?"Update":"Relaunch":"Reload",He=ve?R?se:te:"Reload dashboard page",je=ve?R?G:z:!1,Ve=ve?R?je||!P||!y:je:!1,dt=R?P&&K?`Install desktop update ${K}`:W?"Desktop update unavailable":"Desktop is current":ve?z?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function Pe(){ne.current&&(clearTimeout(ne.current),ne.current=null)}function Lt(){Pe(),N(!0)}function ht(){Pe(),ne.current=setTimeout(()=>{N(!1),ne.current=null},180)}function ol(){Pe()}function il(){Pe(),E(!1),N(!1)}async function Tt(){if(!(!g||z)){B(!0);try{await g()}finally{B(!1)}}}async function jn(){if(!(!P||!y||G)){$(!0);try{await y()}finally{$(!1)}}}async function Ct(){if(!(!p||z)){E(!1),B(!0);try{await p()}finally{B(!1)}}}async function Ll(){if(!ve){await Mn();return}if(R){await jn();return}await Tt()}async function Mn(){x&&(E(!1),await x())}return v.useEffect(()=>()=>{Pe()},[]),v.useEffect(()=>{O(Ne=>{if(Ne.size===0)return Ne;const Xe=new Set(l.map(st=>st.id)),We=new Set(Array.from(Ne).filter(st=>Xe.has(st)));return We.size===Ne.size?Ne:We})},[l]),v.useEffect(()=>{w||E(!1)},[w]),v.useEffect(()=>{if(!w)return;const Ne=We=>{var st;(st=V.current)!=null&&st.contains(We.target)||(Pe(),E(!1),N(!1))},Xe=We=>{We.key==="Escape"&&(Pe(),E(!1),N(!1))};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",Xe),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",Xe)}},[w]),f.jsxs("div",{ref:V,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":w,"aria-haspopup":"dialog",onClick:()=>N(Ne=>!Ne),onMouseEnter:Lt,onMouseLeave:ht,className:re("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",w&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:re("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:re("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:re("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:F})]})]}),w&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:ol,onMouseLeave:il,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(Ds,{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:re("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:le.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[M?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):Y?f.jsx(Ds,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Yo,{className:re("h-3 w-3 shrink-0",I?"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:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",M?"border-destructive/30 bg-destructive/10 text-destructive":Y?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":I?"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:C3(ie)})]}),ie.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ie.map(Ne=>{const{label:Xe,status:We}=A3(Ne,c),st=We==="offline",On=We==="busy";return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Xe} ${We}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(vv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Yo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[oe?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Yo,{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:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",oe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:N3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(Ne=>{var kn;const{label:Xe,status:We}=T3(Ne,c),st=We==="failed"||We==="offline",On=We!=="healthy"&&We!=="failed"&&We!=="offline",Dn=(kn=Ne.devtunnelHealth)!=null&&kn.reason?`${Xe} ${We}: ${Ne.devtunnelHealth.reason}`:`${Xe} ${We}`;return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-muted/30":"bg-emerald-500/5"),title:Dn,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(hs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(vv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Yo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>A(Ne=>!Ne),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 ",le.length>0&&`(${le.length})`]}),C?f.jsx(Ko,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(ef,{className:"h-3 w-3 text-muted-foreground"})]}),C&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(v3,{events:le,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:Ne=>O(Xe=>new Set(Xe).add(Ne))})})]}),R&&(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:be&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void Ll(),disabled:Ve,"aria-label":dt,"aria-describedby":"live-link-restart-hint",title:He,children:[f.jsx(yv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),J&&f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>E(Ne=>!Ne),"aria-label":"Open live link actions","aria-expanded":T,title:"Live link actions",children:f.jsx(Ko,{className:"h-2.5 w-2.5"})})]}),J&&T&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ll(),disabled:Ve,"aria-label":dt,children:[f.jsx(yv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),ce&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ct(),disabled:z,"aria-label":"Restart Meshy Desktop",children:[f.jsx(tf,{className:re("h-2.5 w-2.5",z&&"animate-spin")}),f.jsx("span",{children:"Restart"})]}),ee&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Mn(),"aria-label":"Reload dashboard page",children:[f.jsx(tf,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:He})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>O(new Set(l.map(Ne=>Ne.id))),disabled:le.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>N(!1),children:"Close"})]})]})]})]})}const a0="dark",Lr="fluent",_3="clean",Kd="meshy-layout-default-migrated-to-compact",yf="true",j3="compact",M3=new Set(["airy","clean","fluent"]);function O3(n){return n!==null&&M3.has(n)}function lm(n){return n===j3?"fluent":O3(n)?n:null}function D3(n,l){const o=lm(n);return o===_3&&l!==yf?Lr:o??Lr}const Fs="symphony",a1="default",k3=new Set(["light","dark","system"]),z3=new Set(["porcelain","warm","finsight","edge","symphony","launcher"]),l1=v.createContext(null);function L3(n){const l=new URLSearchParams(n).get("theme");return r1(l)?l:null}function U3(n){const l=new URLSearchParams(n).get("palette");return rm(l)}function B3(n){const l=new URLSearchParams(n).get("layout");return lm(l)}function H3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:rm(n.getAttribute("data-palette"))??Fs,layout:lm(n.getAttribute("data-layout"))??Lr}}function wM(n,l=H3()){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 V3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?L3(window.location.search)??q3(localStorage.getItem("meshy-theme"))??a0:a0),[i,c]=v.useState(()=>typeof window<"u"?U3(window.location.search)??G3(localStorage.getItem("meshy-palette"))??Fs:Fs),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=B3(window.location.search);if(h)return localStorage.setItem(Kd,yf),h;const y=D3(localStorage.getItem("meshy-layout"),localStorage.getItem(Kd));return localStorage.setItem(Kd,yf),y}return Lr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===Lr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(l1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function $3(){const n=v.useContext(l1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function r1(n){return n!==null&&k3.has(n)}function Y3(n){return n!==null&&z3.has(n)}function q3(n){return r1(n)?n:null}function rm(n){return n===a1?"porcelain":Y3(n)?n:null}function G3(n){return n===a1?null:rm(n)}const P3=[{value:"light",label:"Light",icon:V0},{value:"dark",label:"Dark",icon:B0},{value:"system",label:"System",icon:U0}],o1=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"},{value:"launcher",label:"Launcher",hint:"Desktop startup blue"}],i1=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function X3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=$3(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?B0:n==="light"?V0:U0,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(yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:re("h-8 w-8 rounded-sm",o!==Fs||c!==Lr?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none rounded-md border border-border/70 bg-popover/95 p-2 text-popover-foreground shadow-[0_24px_70px_-32px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[23rem] sm:max-w-[23rem]",children:[f.jsxs("div",{className:"mb-2 flex items-end justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[10px] font-medium text-foreground",children:[K3(c)," / ",Q3(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-1.5 py-0.5 text-[8px] font-medium capitalize text-muted-foreground",children:n})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-0.5",children:P3.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:re("flex min-h-[2.1rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-1.5 py-1 text-[9px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[f.jsx(E,{className:"h-3 w-3"}),T]},N)})}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:i1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(ks,{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:o1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(Z3,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(ks,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function K3(n){var l;return((l=i1.find(o=>o.value===n))==null?void 0:l.label)??n}function Q3(n){var l;return((l=o1.find(o=>o.value===n))==null?void 0:l.label)??n}function Z3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"],launcher:["hsl(213 77% 49%)","hsl(60 10% 96%)","hsl(0 0% 100%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:re("flex h-5 w-5 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const Go={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},s1="meshy-dashboard-panel-state-v2",c1="meshy-dashboard-terminal-open-v1";function EM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Go.tasks.defaultSize,operations:Go.operations.defaultSize,terminal:Go.terminal.defaultSize}}}function Qd(n){return typeof n=="object"&&n!==null}function l0(n,l){return typeof n=="boolean"?n:l}function Zd(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Po(n,l):o}function Po(n,l){const o=Go[n];return Math.min(o.max,Math.max(o.min,l))}function NM(n,l){if(!n)return l;try{const o=n.getItem(s1);if(!o)return l;const i=JSON.parse(o);if(!Qd(i))return l;const c=Qd(i.layout)?i.layout:{},d=Qd(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:l0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:l0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:Zd("tasks",d.tasks,l.sizes.tasks),operations:Zd("operations",d.operations,l.sizes.operations),terminal:Zd("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function TM(n,l){if(n)try{n.setItem(s1,JSON.stringify(l))}catch{}}function I3(n,l){if(!n)return l;try{const o=n.getItem(c1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function F3(n,l){if(n)try{n.setItem(c1,String(l))}catch{}}function r0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function CM(n){return`${Number(n.toFixed(2))}rem`}function AM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Po(n,l+(c-o)/h):n==="operations"?Po(n,l+(o-c)/h):Po(n,l+(i-d)/h)}function RM(n,l,o){const i=o===0?0:o>0?-1:1;return Po(n,l+i*Go[n].wheelStep)}const J3=7200*1e3;function W3(){return f.jsxs("svg",{"data-meshy-app-icon":"header",viewBox:"0 0 1024 1024",className:"h-8 w-8","aria-hidden":"true",children:[f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"meshy-header-icon-bg",x1:"160",y1:"128",x2:"864",y2:"896",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#182033"}),f.jsx("stop",{offset:"1",stopColor:"#0a0f1f"})]}),f.jsxs("linearGradient",{id:"meshy-header-icon-edge",x1:"260",y1:"244",x2:"768",y2:"780",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#66e3ff"}),f.jsx("stop",{offset:"0.52",stopColor:"#8fd56b"}),f.jsx("stop",{offset:"1",stopColor:"#ffcb5b"})]})]}),f.jsx("rect",{width:"1024",height:"1024",rx:"224",fill:"url(#meshy-header-icon-bg)"}),f.jsx("path",{d:"M308 652V372l204 174 204-174v280",fill:"none",stroke:"url(#meshy-header-icon-edge)",strokeWidth:"86",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("circle",{cx:"308",cy:"372",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"512",cy:"546",r:"58",fill:"#8fd56b"}),f.jsx("circle",{cx:"716",cy:"372",r:"58",fill:"#ffcb5b"}),f.jsx("circle",{cx:"308",cy:"652",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"716",cy:"652",r:"58",fill:"#ffcb5b"})]})}function Ns(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function o0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function Id(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function ej(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function tj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=k0(),c=Fn(),[d,m]=v.useState(()=>I3(r0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Ns(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const B=new Map;for(const G of(n==null?void 0:n.nodes)??[])B.set(G.id,G.name);return n!=null&&n.self&&B.set(n.self.id,n.self.name),B},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(B=>{m(G=>typeof B=="function"?B(G):B)},[]);v.useEffect(()=>{F3(r0(),d)},[d]),v.useEffect(()=>{const B=Ns();if(!B){w(null);return}let G=!1,$=!1;const V=le=>{$||($=!0,le&&w(o0("Checking desktop update...")),B("check_desktop_update").then(fe=>{G||w(fe)}).catch(fe=>{if(!G){const me=Id(fe,"Desktop update check failed");w(ie=>ie!=null&&ie.updateAvailable?ie:o0(me))}}).finally(()=>{$=!1}))};V(!0);const ne=window.setInterval(()=>V(!1),J3);return()=>{G=!0,window.clearInterval(ne)}},[i==null?void 0:i.version]);async function j(){try{const B=await O0({reason:"restart"});Ge.info(`Restarting runtime. Follow ${B.logPath} for launch output.`),await e1({previousPid:B.pid})||Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(B){Ge.error(B instanceof Error?B.message:"Runtime restart failed")}}async function O(){const B=Ns();if(!B){Ge.error("Desktop updater is not available in this window");return}try{Ge.info("Downloading desktop update...");const G=await B("install_desktop_update");Ge.info(ej(G))}catch(G){Ge.error(Id(G,"Desktop update failed"))}}async function z(){const B=Ns();if(!B){Ge.error("Desktop restart is not available in this window");return}try{Ge.info("Restarting Meshy Desktop..."),await B("restart_desktop_app")}catch(G){Ge.error(Id(G,"Desktop restart 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:re("dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Wd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx(W3,{}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(H0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(ef,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(fN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(ef,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Wd,{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(am,{"aria-label":"Search tasks",value:h,onChange:B=>y(B.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>A(B=>!B),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:re("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx($0,{className:"h-4 w-4"})}),f.jsx(t3,{}),f.jsx(X3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(R3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?O:void 0,onDesktopRestart:N?z:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:j})]})]})}),f.jsx("main",{className:re("min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:re("mx-auto h-full min-h-0",T),children:f.jsx(_w,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const i0=v.lazy(async()=>({default:(await u0(()=>import("./DashboardPage-Du4ZFTCW.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),nj=v.lazy(async()=>({default:(await u0(()=>import("./SharedConversationPage-CiA3IWeo.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function aj(){return f.jsx(tE,{children:f.jsx(v.Suspense,{fallback:f.jsx(lj,{}),children:f.jsxs(Mw,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(nj,{})}),f.jsxs(jl,{element:f.jsx(kE,{children:f.jsx(tj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(i0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(hv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(hv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(i0,{})})]})]})})})}function lj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function rj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function oj(n){return f.jsx(eC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}rj();j2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(V3,{children:[f.jsx(aj,{}),f.jsx(oj,{})]})}));export{Qs as $,Yy as A,yn as B,ks as C,lM as D,Gy as E,uN as F,wM as G,lN as H,am as I,i3 as J,o3 as K,L0 as L,t_ as M,tM as N,wx as O,nM as P,js as Q,St as R,H0 as S,rM as T,bM as U,qs as V,gf as W,Y0 as X,Gs as Y,Ps as Z,Ks as _,rC as a,gM as a$,Xs as a0,Is as a1,Zs as a2,u0 as a3,dj as a4,qy as a5,q5 as a6,Nj as a7,$0 as a8,Yo as a9,r0 as aA,TM as aB,RM as aC,CM as aD,AM as aE,Cj as aF,AE as aG,SE as aH,Fj as aI,Ij as aJ,Jj as aK,jE as aL,kj as aM,pj as aN,mj as aO,Py as aP,hj as aQ,gj as aR,gE as aS,t3 as aT,zj as aU,Lj as aV,sj as aW,Fn as aX,S0 as aY,ij as aZ,k0 as a_,nN as aa,Ej as ab,Tj as ac,wj as ad,_N as ae,gN as af,pM as ag,wN as ah,v3 as ai,g_ as aj,sN as ak,v_ as al,xM as am,a3 as an,cM as ao,SM as ap,iM as aq,sM as ar,vM as as,Fx as at,yM as au,vf as av,Uj as aw,Bj as ax,NM as ay,EM as az,re as b,hM as b0,uM as b1,dM as b2,mM as b3,fM as b4,Aj as b5,oM as b6,l3 as b7,Oj as b8,Dj as b9,Mj as ba,jj as bb,uj as bc,fj as bd,cj as be,vj as bf,eM as bg,qj as bh,Yj as bi,$j as bj,Hj as bk,Vj as bl,Gj as bm,n3 as bn,s0 as bo,FE as bp,Kj as bq,Xj as br,Pj as bs,tf as bt,Qj as bu,Wj as bv,Zj as bw,Be as c,ry as d,Sj as e,pE as f,bj as g,yj as h,fN as i,f as j,ef as k,jr as l,xj as m,_j as n,Wb as o,Jf as p,ex as q,v as r,Wf as s,Ge as t,CN as u,Ko as v,DN as w,aM as x,Rj as y,V5 as z};