meshy-node 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-DNHPWPPy.js","assets/DashboardShared-BoDrxtnK.js","assets/folder-Kz9sjqeH.js","assets/play-Cn7XF9Ny.js","assets/DashboardPage-DWXbz1IY.css","assets/SharedConversationPage-BxtmKE6F.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CdCiYD4R.js","assets/DashboardShared-HvdlVE0E.js","assets/folder-DzQ8M7ZQ.js","assets/play-BN9wGxuQ.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-FgVTiQ2B.js"])))=>i.map(i=>d[i]);
2
2
  function aw(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in n)){const d=Object.getOwnPropertyDescriptor(i,u);d&&Object.defineProperty(n,u,d.get?d:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function o(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(u){if(u.ep)return;u.ep=!0;const d=o(u);fetch(u.href,d)}})();function Pv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xd={exports:{}},Mo={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -292,10 +292,10 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
292
292
 
293
293
  If you want to hide the \`${l.titleName}\`, you can wrap it with our VisuallyHidden component.
294
294
 
295
- 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},w5="DialogDescriptionWarning",E5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wy(w5).contentName}}.`;return v.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&u&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},Ey=sy,Ny=uy,Ty=fy,Rf=my,_f=hy,jf=gy,Of=yy,Js=xy;const N5=Ey,T5=Ny,C5=Ty,Nj=Js,Cy=v.forwardRef(({className:n,...l},o)=>m.jsx(Rf,{ref:o,className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l}));Cy.displayName=Rf.displayName;const Ay=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(C5,{children:[m.jsx(Cy,{}),m.jsxs(_f,{ref:i,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...o,children:[l,m.jsxs(Js,{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:[m.jsx(C0,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ay.displayName=_f.displayName;const Ry=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});Ry.displayName="DialogHeader";const A5=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});A5.displayName="DialogFooter";const _y=v.forwardRef(({className:n,...l},o)=>m.jsx(jf,{ref:o,className:se("text-lg font-semibold leading-none tracking-tight",n),...l}));_y.displayName=jf.displayName;const jy=v.forwardRef(({className:n,...l},o)=>m.jsx(Of,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));jy.displayName=Of.displayName;function R5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[u,d]=v.useState(!1),f=l??u,h=v.useCallback(y=>{l===void 0&&d(y),o==null||o(y)},[l,o]);return m.jsxs(N5,{open:f,onOpenChange:h,children:[i&&m.jsx(T5,{asChild:!0,children:m.jsx(Yn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",children:m.jsx(cN,{className:"h-4 w-4"})})}),m.jsxs(Ay,{className:"grid h-[min(82vh,42rem)] max-h-[82vh] max-w-[min(90vw,56rem)] 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:[m.jsxs(Ry,{className:"shrink-0 border-b border-border/60 px-3 py-2 sm:px-4",children:[m.jsxs(_y,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(JE,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),m.jsx(jy,{className:"text-[11px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),m.jsx("div",{className:"min-h-0 overflow-y-auto px-3 pb-2.5 pt-0 sm:px-4 sm:pb-3",children:n})]})]})}function jv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Oy(n){const l=n+"CollectionProvider",[o,i]=Fa(l),[u,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:C,children:A}=E,_=ne.useRef(null),M=ne.useRef(new Map).current;return m.jsx(u,{scope:C,itemMap:M,collectionRef:_,children:A})};f.displayName=l;const h=n+"CollectionSlot",y=qo(h),p=ne.forwardRef((E,C)=>{const{scope:A,children:_}=E,M=d(h,A),k=Ie(C,M.collectionRef);return m.jsx(y,{ref:k,children:_})});p.displayName=h;const x=n+"CollectionItemSlot",g="data-radix-collection-item",w=qo(x),N=ne.forwardRef((E,C)=>{const{scope:A,children:_,...M}=E,k=ne.useRef(null),Y=Ie(C,k),G=d(x,A);return ne.useEffect(()=>(G.itemMap.set(k,{ref:k,...M}),()=>void G.itemMap.delete(k))),m.jsx(w,{[g]:"",ref:Y,children:_})});N.displayName=x;function T(E){const C=d(n+"CollectionConsumer",E);return ne.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const M=Array.from(_.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((G,B)=>M.indexOf(G.ref.current)-M.indexOf(B.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:f,Slot:p,ItemSlot:N},T,i]}var _5=v.createContext(void 0);function Mf(n){const l=v.useContext(_5);return n||l||"ltr"}const j5=["top","right","bottom","left"],Ka=Math.min,en=Math.max,Ds=Math.round,xs=Math.floor,Vn=n=>({x:n,y:n}),O5={left:"right",right:"left",bottom:"top",top:"bottom"};function Id(n,l,o){return en(n,Ka(l,o))}function da(n,l){return typeof n=="function"?n(l):n}function fa(n){return n.split("-")[0]}function zr(n){return n.split("-")[1]}function Df(n){return n==="x"?"y":"x"}function kf(n){return n==="y"?"height":"width"}function Bn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function zf(n){return Df(Bn(n))}function M5(n,l,o){o===void 0&&(o=!1);const i=zr(n),u=zf(n),d=kf(u);let f=u==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(f=ks(f)),[f,ks(f)]}function D5(n){const l=ks(n);return[Fd(n),l,Fd(l)]}function Fd(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const Ov=["left","right"],Mv=["right","left"],k5=["top","bottom"],z5=["bottom","top"];function L5(n,l,o){switch(n){case"top":case"bottom":return o?l?Mv:Ov:l?Ov:Mv;case"left":case"right":return l?k5:z5;default:return[]}}function U5(n,l,o,i){const u=zr(n);let d=L5(fa(n),o==="start",i);return u&&(d=d.map(f=>f+"-"+u),l&&(d=d.concat(d.map(Fd)))),d}function ks(n){const l=fa(n);return O5[l]+n.slice(l.length)}function B5(n){return{top:0,right:0,bottom:0,left:0,...n}}function My(n){return typeof n!="number"?B5(n):{top:n,right:n,bottom:n,left:n}}function zs(n){const{x:l,y:o,width:i,height:u}=n;return{width:i,height:u,top:o,left:l,right:l+i,bottom:o+u,x:l,y:o}}function Dv(n,l,o){let{reference:i,floating:u}=n;const d=Bn(l),f=zf(l),h=kf(f),y=fa(l),p=d==="y",x=i.x+i.width/2-u.width/2,g=i.y+i.height/2-u.height/2,w=i[h]/2-u[h]/2;let N;switch(y){case"top":N={x,y:i.y-u.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-u.width,y:g};break;default:N={x:i.x,y:i.y}}switch(zr(l)){case"start":N[f]-=w*(o&&p?-1:1);break;case"end":N[f]+=w*(o&&p?-1:1);break}return N}async function H5(n,l){var o;l===void 0&&(l={});const{x:i,y:u,platform:d,rects:f,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:g="floating",altBoundary:w=!1,padding:N=0}=da(l,n),T=My(N),C=h[w?g==="floating"?"reference":"floating":g],A=zs(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})),_=g==="floating"?{x:i,y:u,width:f.floating.width,height:f.floating.height}:f.reference,M=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),k=await(d.isElement==null?void 0:d.isElement(M))?await(d.getScale==null?void 0:d.getScale(M))||{x:1,y:1}:{x:1,y:1},Y=zs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:_,offsetParent:M,strategy:y}):_);return{top:(A.top-Y.top+T.top)/k.y,bottom:(Y.bottom-A.bottom+T.bottom)/k.y,left:(A.left-Y.left+T.left)/k.x,right:(Y.right-A.right+T.right)/k.x}}const V5=50,Y5=async(n,l,o)=>{const{placement:i="bottom",strategy:u="absolute",middleware:d=[],platform:f}=o,h=f.detectOverflow?f:{...f,detectOverflow:H5},y=await(f.isRTL==null?void 0:f.isRTL(l));let p=await f.getElementRects({reference:n,floating:l,strategy:u}),{x,y:g}=Dv(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:_}=C,{x:M,y:k,data:Y,reset:G}=await _({x,y:g,initialPlacement:i,placement:w,strategy:u,middlewareData:T,rects:p,platform:h,elements:{reference:n,floating:l}});x=M??x,g=k??g,T[A]={...T[A],...Y},G&&N<V5&&(N++,typeof G=="object"&&(G.placement&&(w=G.placement),G.rects&&(p=G.rects===!0?await f.getElementRects({reference:n,floating:l,strategy:u}):G.rects),{x,y:g}=Dv(p,w,y)),E=-1)}return{x,y:g,placement:w,strategy:u,middlewareData:T}},$5=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:u,rects:d,platform:f,elements:h,middlewareData:y}=l,{element:p,padding:x=0}=da(n,l)||{};if(p==null)return{};const g=My(x),w={x:o,y:i},N=zf(u),T=kf(N),E=await f.getDimensions(p),C=N==="y",A=C?"top":"left",_=C?"bottom":"right",M=C?"clientHeight":"clientWidth",k=d.reference[T]+d.reference[N]-w[N]-d.floating[T],Y=w[N]-d.reference[N],G=await(f.getOffsetParent==null?void 0:f.getOffsetParent(p));let B=G?G[M]:0;(!B||!await(f.isElement==null?void 0:f.isElement(G)))&&(B=h.floating[M]||d.floating[T]);const V=k/2-Y/2,ae=B/2-E[T]/2-1,re=Ka(g[A],ae),pe=Ka(g[_],ae),me=re,ue=B-E[T]-pe,de=B/2-E[T]/2+V,le=Id(me,de,ue),O=!y.arrow&&zr(u)!=null&&de!==le&&d.reference[T]/2-(de<me?re:pe)-E[T]/2<0,q=O?de<me?de-me:de-ue:0;return{[N]:w[N]+q,data:{[N]:le,centerOffset:de-le-q,...O&&{alignmentOffset:q}},reset:O}}}),q5=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:u,middlewareData:d,rects:f,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}=da(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const A=fa(u),_=Bn(h),M=fa(h)===h,k=await(y.isRTL==null?void 0:y.isRTL(p.floating)),Y=w||(M||!E?[ks(h)]:D5(h)),G=T!=="none";!w&&G&&Y.push(...U5(h,E,T,k));const B=[h,...Y],V=await y.detectOverflow(l,C),ae=[];let re=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&ae.push(V[A]),g){const de=M5(u,f,k);ae.push(V[de[0]],V[de[1]])}if(re=[...re,{placement:u,overflows:ae}],!ae.every(de=>de<=0)){var pe,me;const de=(((pe=d.flip)==null?void 0:pe.index)||0)+1,le=B[de];if(le&&(!(g==="alignment"?_!==Bn(le):!1)||re.every(I=>Bn(I.placement)===_?I.overflows[0]>0:!0)))return{data:{index:de,overflows:re},reset:{placement:le}};let O=(me=re.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:me.placement;if(!O)switch(N){case"bestFit":{var ue;const q=(ue=re.filter(I=>{if(G){const ce=Bn(I.placement);return ce===_||ce==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(ce=>ce>0).reduce((ce,F)=>ce+F,0)]).sort((I,ce)=>I[1]-ce[1])[0])==null?void 0:ue[0];q&&(O=q);break}case"initialPlacement":O=h;break}if(u!==O)return{reset:{placement:O}}}return{}}}};function kv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function zv(n){return j5.some(l=>n[l]>=0)}const G5=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:u="referenceHidden",...d}=da(n,l);switch(u){case"referenceHidden":{const f=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=kv(f,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:zv(h)}}}case"escaped":{const f=await i.detectOverflow(l,{...d,altBoundary:!0}),h=kv(f,o.floating);return{data:{escapedOffsets:h,escaped:zv(h)}}}default:return{}}}}},Dy=new Set(["left","top"]);async function X5(n,l){const{placement:o,platform:i,elements:u}=n,d=await(i.isRTL==null?void 0:i.isRTL(u.floating)),f=fa(o),h=zr(o),y=Bn(o)==="y",p=Dy.has(f)?-1:1,x=d&&y?-1:1,g=da(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 P5=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:u,y:d,placement:f,middlewareData:h}=l,y=await X5(l,n);return f===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:u+y.x,y:d+y.y,data:{...y,placement:f}}}}},Q5=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:u,platform:d}=l,{mainAxis:f=!0,crossAxis:h=!1,limiter:y={fn:A=>{let{x:_,y:M}=A;return{x:_,y:M}}},...p}=da(n,l),x={x:o,y:i},g=await d.detectOverflow(l,p),w=Bn(fa(u)),N=Df(w);let T=x[N],E=x[w];if(f){const A=N==="y"?"top":"left",_=N==="y"?"bottom":"right",M=T+g[A],k=T-g[_];T=Id(M,T,k)}if(h){const A=w==="y"?"top":"left",_=w==="y"?"bottom":"right",M=E+g[A],k=E-g[_];E=Id(M,E,k)}const C=y.fn({...l,[N]:T,[w]:E});return{...C,data:{x:C.x-o,y:C.y-i,enabled:{[N]:f,[w]:h}}}}}},K5=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:u,rects:d,middlewareData:f}=l,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=da(n,l),x={x:o,y:i},g=Bn(u),w=Df(g);let N=x[w],T=x[g];const E=da(h,l),C=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(y){const M=w==="y"?"height":"width",k=d.reference[w]-d.floating[M]+C.mainAxis,Y=d.reference[w]+d.reference[M]-C.mainAxis;N<k?N=k:N>Y&&(N=Y)}if(p){var A,_;const M=w==="y"?"width":"height",k=Dy.has(fa(u)),Y=d.reference[g]-d.floating[M]+(k&&((A=f.offset)==null?void 0:A[g])||0)+(k?0:C.crossAxis),G=d.reference[g]+d.reference[M]+(k?0:((_=f.offset)==null?void 0:_[g])||0)-(k?C.crossAxis:0);T<Y?T=Y:T>G&&(T=G)}return{[w]:N,[g]:T}}}},Z5=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:u,rects:d,platform:f,elements:h}=l,{apply:y=()=>{},...p}=da(n,l),x=await f.detectOverflow(l,p),g=fa(u),w=zr(u),N=Bn(u)==="y",{width:T,height:E}=d.floating;let C,A;g==="top"||g==="bottom"?(C=g,A=w===(await(f.isRTL==null?void 0:f.isRTL(h.floating))?"start":"end")?"left":"right"):(A=g,C=w==="end"?"top":"bottom");const _=E-x.top-x.bottom,M=T-x.left-x.right,k=Ka(E-x[C],_),Y=Ka(T-x[A],M),G=!l.middlewareData.shift;let B=k,V=Y;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(V=M),(i=l.middlewareData.shift)!=null&&i.enabled.y&&(B=_),G&&!w){const re=en(x.left,0),pe=en(x.right,0),me=en(x.top,0),ue=en(x.bottom,0);N?V=T-2*(re!==0||pe!==0?re+pe:en(x.left,x.right)):B=E-2*(me!==0||ue!==0?me+ue:en(x.top,x.bottom))}await y({...l,availableWidth:V,availableHeight:B});const ae=await f.getDimensions(h.floating);return T!==ae.width||E!==ae.height?{reset:{rects:!0}}:{}}}};function Ws(){return typeof window<"u"}function Lr(n){return ky(n)?(n.nodeName||"").toLowerCase():"#document"}function tn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function qn(n){var l;return(l=(ky(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function ky(n){return Ws()?n instanceof Node||n instanceof tn(n).Node:!1}function wn(n){return Ws()?n instanceof Element||n instanceof tn(n).Element:!1}function ma(n){return Ws()?n instanceof HTMLElement||n instanceof tn(n).HTMLElement:!1}function Lv(n){return!Ws()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof tn(n).ShadowRoot}function Ko(n){const{overflow:l,overflowX:o,overflowY:i,display:u}=En(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&u!=="inline"&&u!=="contents"}function I5(n){return/^(table|td|th)$/.test(Lr(n))}function ec(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const F5=/transform|translate|scale|rotate|perspective|filter/,J5=/paint|layout|strict|content/,El=n=>!!n&&n!=="none";let Bd;function Lf(n){const l=wn(n)?En(n):n;return El(l.transform)||El(l.translate)||El(l.scale)||El(l.rotate)||El(l.perspective)||!Uf()&&(El(l.backdropFilter)||El(l.filter))||F5.test(l.willChange||"")||J5.test(l.contain||"")}function W5(n){let l=Za(n);for(;ma(l)&&!_r(l);){if(Lf(l))return l;if(ec(l))return null;l=Za(l)}return null}function Uf(){return Bd==null&&(Bd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bd}function _r(n){return/^(html|body|#document)$/.test(Lr(n))}function En(n){return tn(n).getComputedStyle(n)}function tc(n){return wn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Za(n){if(Lr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Lv(n)&&n.host||qn(n);return Lv(l)?l.host:l}function zy(n){const l=Za(n);return _r(l)?n.ownerDocument?n.ownerDocument.body:n.body:ma(l)&&Ko(l)?l:zy(l)}function Go(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=zy(n),d=u===((i=n.ownerDocument)==null?void 0:i.body),f=tn(u);if(d){const h=Jd(f);return l.concat(f,f.visualViewport||[],Ko(u)?u:[],h&&o?Go(h):[])}else return l.concat(u,Go(u,[],o))}function Jd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ly(n){const l=En(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const u=ma(n),d=u?n.offsetWidth:o,f=u?n.offsetHeight:i,h=Ds(o)!==d||Ds(i)!==f;return h&&(o=d,i=f),{width:o,height:i,$:h}}function Bf(n){return wn(n)?n:n.contextElement}function Cr(n){const l=Bf(n);if(!ma(l))return Vn(1);const o=l.getBoundingClientRect(),{width:i,height:u,$:d}=Ly(l);let f=(d?Ds(o.width):o.width)/i,h=(d?Ds(o.height):o.height)/u;return(!f||!Number.isFinite(f))&&(f=1),(!h||!Number.isFinite(h))&&(h=1),{x:f,y:h}}const eA=Vn(0);function Uy(n){const l=tn(n);return!Uf()||!l.visualViewport?eA:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function tA(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==tn(n)?!1:l}function Al(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),d=Bf(n);let f=Vn(1);l&&(i?wn(i)&&(f=Cr(i)):f=Cr(n));const h=tA(d,o,i)?Uy(d):Vn(0);let y=(u.left+h.x)/f.x,p=(u.top+h.y)/f.y,x=u.width/f.x,g=u.height/f.y;if(d){const w=tn(d),N=i&&wn(i)?tn(i):i;let T=w,E=Jd(T);for(;E&&i&&N!==T;){const C=Cr(E),A=E.getBoundingClientRect(),_=En(E),M=A.left+(E.clientLeft+parseFloat(_.paddingLeft))*C.x,k=A.top+(E.clientTop+parseFloat(_.paddingTop))*C.y;y*=C.x,p*=C.y,x*=C.x,g*=C.y,y+=M,p+=k,T=tn(E),E=Jd(T)}}return zs({width:x,height:g,x:y,y:p})}function nc(n,l){const o=tc(n).scrollLeft;return l?l.left+o:Al(qn(n)).left+o}function By(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-nc(n,o),u=o.top+l.scrollTop;return{x:i,y:u}}function nA(n){let{elements:l,rect:o,offsetParent:i,strategy:u}=n;const d=u==="fixed",f=qn(i),h=l?ec(l.floating):!1;if(i===f||h&&d)return o;let y={scrollLeft:0,scrollTop:0},p=Vn(1);const x=Vn(0),g=ma(i);if((g||!g&&!d)&&((Lr(i)!=="body"||Ko(f))&&(y=tc(i)),g)){const N=Al(i);p=Cr(i),x.x=N.x+i.clientLeft,x.y=N.y+i.clientTop}const w=f&&!g&&!d?By(f,y):Vn(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 aA(n){return Array.from(n.getClientRects())}function lA(n){const l=qn(n),o=tc(n),i=n.ownerDocument.body,u=en(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=en(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let f=-o.scrollLeft+nc(n);const h=-o.scrollTop;return En(i).direction==="rtl"&&(f+=en(l.clientWidth,i.clientWidth)-u),{width:u,height:d,x:f,y:h}}const Uv=25;function rA(n,l){const o=tn(n),i=qn(n),u=o.visualViewport;let d=i.clientWidth,f=i.clientHeight,h=0,y=0;if(u){d=u.width,f=u.height;const x=Uf();(!x||x&&l==="fixed")&&(h=u.offsetLeft,y=u.offsetTop)}const p=nc(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<=Uv&&(d-=T)}else p<=Uv&&(d+=p);return{width:d,height:f,x:h,y}}function oA(n,l){const o=Al(n,!0,l==="fixed"),i=o.top+n.clientTop,u=o.left+n.clientLeft,d=ma(n)?Cr(n):Vn(1),f=n.clientWidth*d.x,h=n.clientHeight*d.y,y=u*d.x,p=i*d.y;return{width:f,height:h,x:y,y:p}}function Bv(n,l,o){let i;if(l==="viewport")i=rA(n,o);else if(l==="document")i=lA(qn(n));else if(wn(l))i=oA(l,o);else{const u=Uy(n);i={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return zs(i)}function Hy(n,l){const o=Za(n);return o===l||!wn(o)||_r(o)?!1:En(o).position==="fixed"||Hy(o,l)}function iA(n,l){const o=l.get(n);if(o)return o;let i=Go(n,[],!1).filter(h=>wn(h)&&Lr(h)!=="body"),u=null;const d=En(n).position==="fixed";let f=d?Za(n):n;for(;wn(f)&&!_r(f);){const h=En(f),y=Lf(f);!y&&h.position==="fixed"&&(u=null),(d?!y&&!u:!y&&h.position==="static"&&!!u&&(u.position==="absolute"||u.position==="fixed")||Ko(f)&&!y&&Hy(n,f))?i=i.filter(x=>x!==f):u=h,f=Za(f)}return l.set(n,i),i}function sA(n){let{element:l,boundary:o,rootBoundary:i,strategy:u}=n;const f=[...o==="clippingAncestors"?ec(l)?[]:iA(l,this._c):[].concat(o),i],h=Bv(l,f[0],u);let y=h.top,p=h.right,x=h.bottom,g=h.left;for(let w=1;w<f.length;w++){const N=Bv(l,f[w],u);y=en(N.top,y),p=Ka(N.right,p),x=Ka(N.bottom,x),g=en(N.left,g)}return{width:p-g,height:x-y,x:g,y}}function cA(n){const{width:l,height:o}=Ly(n);return{width:l,height:o}}function uA(n,l,o){const i=ma(l),u=qn(l),d=o==="fixed",f=Al(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const y=Vn(0);function p(){y.x=nc(u)}if(i||!i&&!d)if((Lr(l)!=="body"||Ko(u))&&(h=tc(l)),i){const N=Al(l,!0,d,l);y.x=N.x+l.clientLeft,y.y=N.y+l.clientTop}else u&&p();d&&!i&&u&&p();const x=u&&!i&&!d?By(u,h):Vn(0),g=f.left+h.scrollLeft-y.x-x.x,w=f.top+h.scrollTop-y.y-x.y;return{x:g,y:w,width:f.width,height:f.height}}function Hd(n){return En(n).position==="static"}function Hv(n,l){if(!ma(n)||En(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return qn(n)===o&&(o=o.ownerDocument.body),o}function Vy(n,l){const o=tn(n);if(ec(n))return o;if(!ma(n)){let u=Za(n);for(;u&&!_r(u);){if(wn(u)&&!Hd(u))return u;u=Za(u)}return o}let i=Hv(n,l);for(;i&&I5(i)&&Hd(i);)i=Hv(i,l);return i&&_r(i)&&Hd(i)&&!Lf(i)?o:i||W5(n)||o}const dA=async function(n){const l=this.getOffsetParent||Vy,o=this.getDimensions,i=await o(n.floating);return{reference:uA(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function fA(n){return En(n).direction==="rtl"}const mA={convertOffsetParentRelativeRectToViewportRelativeRect:nA,getDocumentElement:qn,getClippingRect:sA,getOffsetParent:Vy,getElementRects:dA,getClientRects:aA,getDimensions:cA,getScale:Cr,isElement:wn,isRTL:fA};function Yy(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function hA(n,l){let o=null,i;const u=qn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function f(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=xs(g),E=xs(u.clientWidth-(x+w)),C=xs(u.clientHeight-(g+N)),A=xs(x),M={rootMargin:-T+"px "+-E+"px "+-C+"px "+-A+"px",threshold:en(0,Ka(1,y))||1};let k=!0;function Y(G){const B=G[0].intersectionRatio;if(B!==y){if(!k)return f();B?f(!1,B):i=setTimeout(()=>{f(!1,1e-7)},1e3)}B===1&&!Yy(p,n.getBoundingClientRect())&&f(),k=!1}try{o=new IntersectionObserver(Y,{...M,root:u.ownerDocument})}catch{o=new IntersectionObserver(Y,M)}o.observe(n)}return f(!0),d}function pA(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:u=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=Bf(n),x=u||d?[...p?Go(p):[],...l?Go(l):[]]:[];x.forEach(A=>{u&&A.addEventListener("scroll",o,{passive:!0}),d&&A.addEventListener("resize",o)});const g=p&&h?hA(p,o):null;let w=-1,N=null;f&&(N=new ResizeObserver(A=>{let[_]=A;_&&_.target===p&&N&&l&&(N.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var M;(M=N)==null||M.observe(l)})),o()}),p&&!y&&N.observe(p),l&&N.observe(l));let T,E=y?Al(n):null;y&&C();function C(){const A=Al(n);E&&!Yy(E,A)&&o(),E=A,T=requestAnimationFrame(C)}return o(),()=>{var A;x.forEach(_=>{u&&_.removeEventListener("scroll",o),d&&_.removeEventListener("resize",o)}),g==null||g(),(A=N)==null||A.disconnect(),N=null,y&&cancelAnimationFrame(T)}}const gA=P5,vA=Q5,yA=q5,bA=Z5,xA=G5,Vv=$5,SA=K5,wA=(n,l,o)=>{const i=new Map,u={platform:mA,...o},d={...u.platform,_c:i};return Y5(n,l,{...u,platform:d})};var EA=typeof document<"u",NA=function(){},Ts=EA?v.useLayoutEffect:NA;function Ls(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,u;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(!Ls(n[i],l[i]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,u[i]))return!1;for(i=o;i--!==0;){const d=u[i];if(!(d==="_owner"&&n.$$typeof)&&!Ls(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function $y(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Yv(n,l){const o=$y(n);return Math.round(l*o)/o}function Vd(n){const l=v.useRef(n);return Ts(()=>{l.current=n}),l}function TA(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:u,elements:{reference:d,floating:f}={},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);Ls(w,i)||N(i);const[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useCallback(I=>{I!==G.current&&(G.current=I,E(I))},[]),M=v.useCallback(I=>{I!==B.current&&(B.current=I,A(I))},[]),k=d||T,Y=f||C,G=v.useRef(null),B=v.useRef(null),V=v.useRef(x),ae=y!=null,re=Vd(y),pe=Vd(u),me=Vd(p),ue=v.useCallback(()=>{if(!G.current||!B.current)return;const I={placement:l,strategy:o,middleware:w};pe.current&&(I.platform=pe.current),wA(G.current,B.current,I).then(ce=>{const F={...ce,isPositioned:me.current!==!1};de.current&&!Ls(V.current,F)&&(V.current=F,Qo.flushSync(()=>{g(F)}))})},[w,l,o,pe,me]);Ts(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,g(I=>({...I,isPositioned:!1})))},[p]);const de=v.useRef(!1);Ts(()=>(de.current=!0,()=>{de.current=!1}),[]),Ts(()=>{if(k&&(G.current=k),Y&&(B.current=Y),k&&Y){if(re.current)return re.current(k,Y,ue);ue()}},[k,Y,ue,re,ae]);const le=v.useMemo(()=>({reference:G,floating:B,setReference:_,setFloating:M}),[_,M]),O=v.useMemo(()=>({reference:k,floating:Y}),[k,Y]),q=v.useMemo(()=>{const I={position:o,left:0,top:0};if(!O.floating)return I;const ce=Yv(O.floating,x.x),F=Yv(O.floating,x.y);return h?{...I,transform:"translate("+ce+"px, "+F+"px)",...$y(O.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:ce,top:F}},[o,h,O.floating,x.x,x.y]);return v.useMemo(()=>({...x,update:ue,refs:le,elements:O,floatingStyles:q}),[x,ue,le,O,q])}const CA=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:u}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?Vv({element:i.current,padding:u}).fn(o):{}:i?Vv({element:i,padding:u}).fn(o):{}}}},AA=(n,l)=>{const o=gA(n);return{name:o.name,fn:o.fn,options:[n,l]}},RA=(n,l)=>{const o=vA(n);return{name:o.name,fn:o.fn,options:[n,l]}},_A=(n,l)=>({fn:SA(n).fn,options:[n,l]}),jA=(n,l)=>{const o=yA(n);return{name:o.name,fn:o.fn,options:[n,l]}},OA=(n,l)=>{const o=bA(n);return{name:o.name,fn:o.fn,options:[n,l]}},MA=(n,l)=>{const o=xA(n);return{name:o.name,fn:o.fn,options:[n,l]}},DA=(n,l)=>{const o=CA(n);return{name:o.name,fn:o.fn,options:[n,l]}};var kA="Arrow",qy=v.forwardRef((n,l)=>{const{children:o,width:i=10,height:u=5,...d}=n;return m.jsx(ze.svg,{...d,ref:l,width:i,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});qy.displayName=kA;var zA=qy;function Gy(n){const[l,o]=v.useState(void 0);return _t(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const d=u[0];let f,h;if("borderBoxSize"in d){const y=d.borderBoxSize,p=Array.isArray(y)?y[0]:y;f=p.inlineSize,h=p.blockSize}else f=n.offsetWidth,h=n.offsetHeight;o({width:f,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var Hf="Popper",[Xy,Py]=Fa(Hf),[LA,Qy]=Xy(Hf),Ky=n=>{const{__scopePopper:l,children:o}=n,[i,u]=v.useState(null);return m.jsx(LA,{scope:l,anchor:i,onAnchorChange:u,children:o})};Ky.displayName=Hf;var Zy="PopperAnchor",Iy=v.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...u}=n,d=Qy(Zy,o),f=v.useRef(null),h=Ie(l,f),y=v.useRef(null);return v.useEffect(()=>{const p=y.current;y.current=(i==null?void 0:i.current)||f.current,p!==y.current&&d.onAnchorChange(y.current)}),i?null:m.jsx(ze.div,{...u,ref:h})});Iy.displayName=Zy;var Vf="PopperContent",[UA,BA]=Xy(Vf),Fy=v.forwardRef((n,l)=>{var te,ie,J,xe,ye,Se;const{__scopePopper:o,side:i="bottom",sideOffset:u=0,align:d="center",alignOffset:f=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=Qy(Vf,o),[A,_]=v.useState(null),M=Ie(l,Ye=>_(Ye)),[k,Y]=v.useState(null),G=Gy(k),B=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ae=i+(d!=="center"?"-"+d:""),re=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},pe=Array.isArray(p)?p:[p],me=pe.length>0,ue={padding:re,boundary:pe.filter(VA),altBoundary:me},{refs:de,floatingStyles:le,placement:O,isPositioned:q,middlewareData:I}=TA({strategy:"fixed",placement:ae,whileElementsMounted:(...Ye)=>pA(...Ye,{animationFrame:N==="always"}),elements:{reference:C.anchor},middleware:[AA({mainAxis:u+V,alignmentAxis:f}),y&&RA({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?_A():void 0,...ue}),y&&jA({...ue}),OA({...ue,apply:({elements:Ye,rects:Le,availableWidth:$e,availableHeight:gt})=>{const{width:rt,height:Pt}=Le.reference,vt=Ye.floating.style;vt.setProperty("--radix-popper-available-width",`${$e}px`),vt.setProperty("--radix-popper-available-height",`${gt}px`),vt.setProperty("--radix-popper-anchor-width",`${rt}px`),vt.setProperty("--radix-popper-anchor-height",`${Pt}px`)}}),k&&DA({element:k,padding:h}),YA({arrowWidth:B,arrowHeight:V}),w&&MA({strategy:"referenceHidden",...ue})]}),[ce,F]=eb(O),j=Qa(T);_t(()=>{q&&(j==null||j())},[q,j]);const X=(te=I.arrow)==null?void 0:te.x,Q=(ie=I.arrow)==null?void 0:ie.y,W=((J=I.arrow)==null?void 0:J.centerOffset)!==0,[ee,oe]=v.useState();return _t(()=>{A&&oe(window.getComputedStyle(A).zIndex)},[A]),m.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...le,transform:q?le.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(xe=I.transformOrigin)==null?void 0:xe.x,(ye=I.transformOrigin)==null?void 0:ye.y].join(" "),...((Se=I.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:m.jsx(UA,{scope:o,placedSide:ce,onArrowChange:Y,arrowX:X,arrowY:Q,shouldHideArrow:W,children:m.jsx(ze.div,{"data-side":ce,"data-align":F,...E,ref:M,style:{...E.style,animation:q?void 0:"none"}})})})});Fy.displayName=Vf;var Jy="PopperArrow",HA={top:"bottom",right:"left",bottom:"top",left:"right"},Wy=v.forwardRef(function(l,o){const{__scopePopper:i,...u}=l,d=BA(Jy,i),f=HA[d.placedSide];return m.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]: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:m.jsx(zA,{...u,ref:o,style:{...u.style,display:"block"}})})});Wy.displayName=Jy;function VA(n){return n!==null}var YA=n=>({name:"transformOrigin",options:n,fn(l){var C,A,_;const{placement:o,rects:i,middlewareData:u}=l,f=((C=u.arrow)==null?void 0:C.centerOffset)!==0,h=f?0:n.arrowWidth,y=f?0:n.arrowHeight,[p,x]=eb(o),g={start:"0%",center:"50%",end:"100%"}[x],w=(((A=u.arrow)==null?void 0:A.x)??0)+h/2,N=(((_=u.arrow)==null?void 0:_.y)??0)+y/2;let T="",E="";return p==="bottom"?(T=f?g:`${w}px`,E=`${-y}px`):p==="top"?(T=f?g:`${w}px`,E=`${i.floating.height+y}px`):p==="right"?(T=`${-y}px`,E=f?g:`${N}px`):p==="left"&&(T=`${i.floating.width+y}px`,E=f?g:`${N}px`),{data:{x:T,y:E}}}});function eb(n){const[l,o="center"]=n.split("-");return[l,o]}var $A=Ky,qA=Iy,GA=Fy,XA=Wy;function tb(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 nb=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"}),PA="VisuallyHidden",QA=v.forwardRef((n,l)=>m.jsx(ze.span,{...n,ref:l,style:{...nb,...n.style}}));QA.displayName=PA;var KA=[" ","Enter","ArrowUp","ArrowDown"],ZA=[" ","Enter"],Rl="Select",[ac,lc,IA]=Oy(Rl),[Ur]=Fa(Rl,[IA,Py]),rc=Py(),[FA,Ja]=Ur(Rl),[JA,WA]=Ur(Rl),ab=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:u,onOpenChange:d,value:f,defaultValue:h,onValueChange:y,dir:p,name:x,autoComplete:g,disabled:w,required:N,form:T}=n,E=rc(l),[C,A]=v.useState(null),[_,M]=v.useState(null),[k,Y]=v.useState(!1),G=Mf(p),[B,V]=Rr({prop:i,defaultProp:u??!1,onChange:d,caller:Rl}),[ae,re]=Rr({prop:f,defaultProp:h,onChange:y,caller:Rl}),pe=v.useRef(null),me=C?T||!!C.closest("form"):!0,[ue,de]=v.useState(new Set),le=Array.from(ue).map(O=>O.props.value).join(";");return m.jsx($A,{...E,children:m.jsxs(FA,{required:N,scope:l,trigger:C,onTriggerChange:A,valueNode:_,onValueNodeChange:M,valueNodeHasChildren:k,onValueNodeHasChildrenChange:Y,contentId:Xa(),value:ae,onValueChange:re,open:B,onOpenChange:V,dir:G,triggerPointerDownPosRef:pe,disabled:w,children:[m.jsx(ac.Provider,{scope:l,children:m.jsx(JA,{scope:n.__scopeSelect,onNativeOptionAdd:v.useCallback(O=>{de(q=>new Set(q).add(O))},[]),onNativeOptionRemove:v.useCallback(O=>{de(q=>{const I=new Set(q);return I.delete(O),I})},[]),children:o})}),me?m.jsxs(Ab,{"aria-hidden":!0,required:N,tabIndex:-1,name:x,autoComplete:g,value:ae,onChange:O=>re(O.target.value),disabled:w,form:T,children:[ae===void 0?m.jsx("option",{value:""}):null,Array.from(ue)]},le):null]})})};ab.displayName=Rl;var lb="SelectTrigger",rb=v.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...u}=n,d=rc(o),f=Ja(lb,o),h=f.disabled||i,y=Ie(l,f.onTriggerChange),p=lc(o),x=v.useRef("touch"),[g,w,N]=_b(E=>{const C=p().filter(M=>!M.disabled),A=C.find(M=>M.value===f.value),_=jb(C,E,A);_!==void 0&&f.onValueChange(_.value)}),T=E=>{h||(f.onOpenChange(!0),N()),E&&(f.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return m.jsx(qA,{asChild:!0,...d,children:m.jsx(ze.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":Rb(f.value)?"":void 0,...u,ref:y,onClick:Oe(u.onClick,E=>{E.currentTarget.focus(),x.current!=="mouse"&&T(E)}),onPointerDown:Oe(u.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:Oe(u.onKeyDown,E=>{const C=g.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&w(E.key),!(C&&E.key===" ")&&KA.includes(E.key)&&(T(),E.preventDefault())})})})});rb.displayName=lb;var ob="SelectValue",ib=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,children:d,placeholder:f="",...h}=n,y=Ja(ob,o),{onValueNodeHasChildrenChange:p}=y,x=d!==void 0,g=Ie(l,y.onValueNodeChange);return _t(()=>{p(x)},[p,x]),m.jsx(ze.span,{...h,ref:g,style:{pointerEvents:"none"},children:Rb(y.value)?m.jsx(m.Fragment,{children:f}):d})});ib.displayName=ob;var eR="SelectIcon",sb=v.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...u}=n;return m.jsx(ze.span,{"aria-hidden":!0,...u,ref:l,children:i||"▼"})});sb.displayName=eR;var tR="SelectPortal",cb=n=>m.jsx(Ef,{asChild:!0,...n});cb.displayName=tR;var _l="SelectContent",ub=v.forwardRef((n,l)=>{const o=Ja(_l,n.__scopeSelect),[i,u]=v.useState();if(_t(()=>{u(new DocumentFragment)},[]),!o.open){const d=i;return d?Qo.createPortal(m.jsx(db,{scope:n.__scopeSelect,children:m.jsx(ac.Slot,{scope:n.__scopeSelect,children:m.jsx("div",{children:n.children})})}),d):null}return m.jsx(fb,{...n,ref:l})});ub.displayName=_l;var xn=10,[db,Wa]=Ur(_l),nR="SelectContentImpl",aR=qo("SelectContent.RemoveScroll"),fb=v.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C,...A}=n,_=Ja(_l,o),[M,k]=v.useState(null),[Y,G]=v.useState(null),B=Ie(l,te=>k(te)),[V,ae]=v.useState(null),[re,pe]=v.useState(null),me=lc(o),[ue,de]=v.useState(!1),le=v.useRef(!1);v.useEffect(()=>{if(M)return ry(M)},[M]),I0();const O=v.useCallback(te=>{const[ie,...J]=me().map(Se=>Se.ref.current),[xe]=J.slice(-1),ye=document.activeElement;for(const Se of te)if(Se===ye||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ie&&Y&&(Y.scrollTop=0),Se===xe&&Y&&(Y.scrollTop=Y.scrollHeight),Se==null||Se.focus(),document.activeElement!==ye))return},[me,Y]),q=v.useCallback(()=>O([V,M]),[O,V,M]);v.useEffect(()=>{ue&&q()},[ue,q]);const{onOpenChange:I,triggerPointerDownPosRef:ce}=_;v.useEffect(()=>{if(M){let te={x:0,y:0};const ie=xe=>{var ye,Se;te={x:Math.abs(Math.round(xe.pageX)-(((ye=ce.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Se=ce.current)==null?void 0:Se.y)??0))}},J=xe=>{te.x<=10&&te.y<=10?xe.preventDefault():M.contains(xe.target)||I(!1),document.removeEventListener("pointermove",ie),ce.current=null};return ce.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",J,{capture:!0})}}},[M,I,ce]),v.useEffect(()=>{const te=()=>I(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[I]);const[F,j]=_b(te=>{const ie=me().filter(ye=>!ye.disabled),J=ie.find(ye=>ye.ref.current===document.activeElement),xe=jb(ie,te,J);xe&&setTimeout(()=>xe.ref.current.focus())}),X=v.useCallback((te,ie,J)=>{const xe=!le.current&&!J;(_.value!==void 0&&_.value===ie||xe)&&(ae(te),xe&&(le.current=!0))},[_.value]),Q=v.useCallback(()=>M==null?void 0:M.focus(),[M]),W=v.useCallback((te,ie,J)=>{const xe=!le.current&&!J;(_.value!==void 0&&_.value===ie||xe)&&pe(te)},[_.value]),ee=i==="popper"?Wd:mb,oe=ee===Wd?{side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C}:{};return m.jsx(db,{scope:o,content:M,viewport:Y,onViewportChange:G,itemRefCallback:X,selectedItem:V,onItemLeave:Q,itemTextRefCallback:W,focusSelectedItem:q,selectedItemText:re,position:i,isPositioned:ue,searchRef:F,children:m.jsx(Nf,{as:aR,allowPinchZoom:!0,children:m.jsx(wf,{asChild:!0,trapped:_.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Oe(u,te=>{var ie;(ie=_.trigger)==null||ie.focus({preventScroll:!0}),te.preventDefault()}),children:m.jsx(Sf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:m.jsx(ee,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:te=>te.preventDefault(),...A,...oe,onPlaced:()=>de(!0),ref:B,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:Oe(A.onKeyDown,te=>{const ie=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ie&&te.key.length===1&&j(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let xe=me().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(te.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const ye=te.target,Se=xe.indexOf(ye);xe=xe.slice(Se+1)}setTimeout(()=>O(xe)),te.preventDefault()}})})})})})})});fb.displayName=nR;var lR="SelectItemAlignedPosition",mb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...u}=n,d=Ja(_l,o),f=Wa(_l,o),[h,y]=v.useState(null),[p,x]=v.useState(null),g=Ie(l,B=>x(B)),w=lc(o),N=v.useRef(!1),T=v.useRef(!0),{viewport:E,selectedItem:C,selectedItemText:A,focusSelectedItem:_}=f,M=v.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&E&&C&&A){const B=d.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),re=A.getBoundingClientRect();if(d.dir!=="rtl"){const ye=re.left-V.left,Se=ae.left-ye,Ye=B.left-Se,Le=B.width+Ye,$e=Math.max(Le,V.width),gt=window.innerWidth-xn,rt=jv(Se,[xn,Math.max(xn,gt-$e)]);h.style.minWidth=Le+"px",h.style.left=rt+"px"}else{const ye=V.right-re.right,Se=window.innerWidth-ae.right-ye,Ye=window.innerWidth-B.right-Se,Le=B.width+Ye,$e=Math.max(Le,V.width),gt=window.innerWidth-xn,rt=jv(Se,[xn,Math.max(xn,gt-$e)]);h.style.minWidth=Le+"px",h.style.right=rt+"px"}const pe=w(),me=window.innerHeight-xn*2,ue=E.scrollHeight,de=window.getComputedStyle(p),le=parseInt(de.borderTopWidth,10),O=parseInt(de.paddingTop,10),q=parseInt(de.borderBottomWidth,10),I=parseInt(de.paddingBottom,10),ce=le+O+ue+I+q,F=Math.min(C.offsetHeight*5,ce),j=window.getComputedStyle(E),X=parseInt(j.paddingTop,10),Q=parseInt(j.paddingBottom,10),W=B.top+B.height/2-xn,ee=me-W,oe=C.offsetHeight/2,te=C.offsetTop+oe,ie=le+O+te,J=ce-ie;if(ie<=W){const ye=pe.length>0&&C===pe[pe.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-E.offsetTop-E.offsetHeight,Ye=Math.max(ee,oe+(ye?Q:0)+Se+q),Le=ie+Ye;h.style.height=Le+"px"}else{const ye=pe.length>0&&C===pe[0].ref.current;h.style.top="0px";const Ye=Math.max(W,le+E.offsetTop+(ye?X:0)+oe)+J;h.style.height=Ye+"px",E.scrollTop=ie-W+E.offsetTop}h.style.margin=`${xn}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]);_t(()=>M(),[M]);const[k,Y]=v.useState();_t(()=>{p&&Y(window.getComputedStyle(p).zIndex)},[p]);const G=v.useCallback(B=>{B&&T.current===!0&&(M(),_==null||_(),T.current=!1)},[M,_]);return m.jsx(oR,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:N,onScrollButtonChange:G,children:m.jsx("div",{ref:y,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:m.jsx(ze.div,{...u,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...u.style}})})})});mb.displayName=lR;var rR="SelectPopperPosition",Wd=v.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:u=xn,...d}=n,f=rc(o);return m.jsx(GA,{...f,...d,ref:l,align:i,collisionPadding:u,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)"}})});Wd.displayName=rR;var[oR,Yf]=Ur(_l,{}),ef="SelectViewport",hb=v.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...u}=n,d=Wa(ef,o),f=Yf(ef,o),h=Ie(l,d.onViewportChange),y=v.useRef(0);return m.jsxs(m.Fragment,{children:[m.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}),m.jsx(ac.Slot,{scope:o,children:m.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...u,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...u.style},onScroll:Oe(u.onScroll,p=>{const x=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=f;if(w!=null&&w.current&&g){const N=Math.abs(y.current-x.scrollTop);if(N>0){const T=window.innerHeight-xn*2,E=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),A=Math.max(E,C);if(A<T){const _=A+N,M=Math.min(T,_),k=_-M;g.style.height=M+"px",g.style.bottom==="0px"&&(x.scrollTop=k>0?k:0,g.style.justifyContent="flex-end")}}}y.current=x.scrollTop})})})]})});hb.displayName=ef;var pb="SelectGroup",[iR,sR]=Ur(pb),cR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=Xa();return m.jsx(iR,{scope:o,id:u,children:m.jsx(ze.div,{role:"group","aria-labelledby":u,...i,ref:l})})});cR.displayName=pb;var gb="SelectLabel",vb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=sR(gb,o);return m.jsx(ze.div,{id:u.id,...i,ref:l})});vb.displayName=gb;var Us="SelectItem",[uR,yb]=Ur(Us),bb=v.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:u=!1,textValue:d,...f}=n,h=Ja(Us,o),y=Wa(Us,o),p=h.value===i,[x,g]=v.useState(d??""),[w,N]=v.useState(!1),T=Ie(l,_=>{var M;return(M=y.itemRefCallback)==null?void 0:M.call(y,_,i,u)}),E=Xa(),C=v.useRef("touch"),A=()=>{u||(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 m.jsx(uR,{scope:o,value:i,disabled:u,textId:E,isSelected:p,onItemTextChange:v.useCallback(_=>{g(M=>M||((_==null?void 0:_.textContent)??"").trim())},[]),children:m.jsx(ac.ItemSlot,{scope:o,value:i,disabled:u,textValue:x,children:m.jsx(ze.div,{role:"option","aria-labelledby":E,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":u||void 0,"data-disabled":u?"":void 0,tabIndex:u?void 0:-1,...f,ref:T,onFocus:Oe(f.onFocus,()=>N(!0)),onBlur:Oe(f.onBlur,()=>N(!1)),onClick:Oe(f.onClick,()=>{C.current!=="mouse"&&A()}),onPointerUp:Oe(f.onPointerUp,()=>{C.current==="mouse"&&A()}),onPointerDown:Oe(f.onPointerDown,_=>{C.current=_.pointerType}),onPointerMove:Oe(f.onPointerMove,_=>{var M;C.current=_.pointerType,u?(M=y.onItemLeave)==null||M.call(y):C.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Oe(f.onPointerLeave,_=>{var M;_.currentTarget===document.activeElement&&((M=y.onItemLeave)==null||M.call(y))}),onKeyDown:Oe(f.onKeyDown,_=>{var k;((k=y.searchRef)==null?void 0:k.current)!==""&&_.key===" "||(ZA.includes(_.key)&&A(),_.key===" "&&_.preventDefault())})})})})});bb.displayName=Us;var Vo="SelectItemText",xb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,...d}=n,f=Ja(Vo,o),h=Wa(Vo,o),y=yb(Vo,o),p=WA(Vo,o),[x,g]=v.useState(null),w=Ie(l,A=>g(A),y.onItemTextChange,A=>{var _;return(_=h.itemTextRefCallback)==null?void 0:_.call(h,A,y.value,y.disabled)}),N=x==null?void 0:x.textContent,T=v.useMemo(()=>m.jsx("option",{value:y.value,disabled:y.disabled,children:N},y.value),[y.disabled,y.value,N]),{onNativeOptionAdd:E,onNativeOptionRemove:C}=p;return _t(()=>(E(T),()=>C(T)),[E,C,T]),m.jsxs(m.Fragment,{children:[m.jsx(ze.span,{id:y.textId,...d,ref:w}),y.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Qo.createPortal(d.children,f.valueNode):null]})});xb.displayName=Vo;var Sb="SelectItemIndicator",wb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return yb(Sb,o).isSelected?m.jsx(ze.span,{"aria-hidden":!0,...i,ref:l}):null});wb.displayName=Sb;var tf="SelectScrollUpButton",Eb=v.forwardRef((n,l)=>{const o=Wa(tf,n.__scopeSelect),i=Yf(tf,n.__scopeSelect),[u,d]=v.useState(!1),f=Ie(l,i.onScrollButtonChange);return _t(()=>{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]),u?m.jsx(Tb,{...n,ref:f,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop-y.offsetHeight)}}):null});Eb.displayName=tf;var nf="SelectScrollDownButton",Nb=v.forwardRef((n,l)=>{const o=Wa(nf,n.__scopeSelect),i=Yf(nf,n.__scopeSelect),[u,d]=v.useState(!1),f=Ie(l,i.onScrollButtonChange);return _t(()=>{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]),u?m.jsx(Tb,{...n,ref:f,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop+y.offsetHeight)}}):null});Nb.displayName=nf;var Tb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...u}=n,d=Wa("SelectScrollButton",o),f=v.useRef(null),h=lc(o),y=v.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return v.useEffect(()=>()=>y(),[y]),_t(()=>{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]),m.jsx(ze.div,{"aria-hidden":!0,...u,ref:l,style:{flexShrink:0,...u.style},onPointerDown:Oe(u.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:Oe(u.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:Oe(u.onPointerLeave,()=>{y()})})}),dR="SelectSeparator",Cb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return m.jsx(ze.div,{"aria-hidden":!0,...i,ref:l})});Cb.displayName=dR;var af="SelectArrow",fR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=rc(o),d=Ja(af,o),f=Wa(af,o);return d.open&&f.position==="popper"?m.jsx(XA,{...u,...i,ref:l}):null});fR.displayName=af;var mR="SelectBubbleInput",Ab=v.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const u=v.useRef(null),d=Ie(i,u),f=tb(l);return v.useEffect(()=>{const h=u.current;if(!h)return;const y=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(y,"value").set;if(f!==l&&x){const g=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(g)}},[f,l]),m.jsx(ze.select,{...o,style:{...nb,...o.style},ref:d,defaultValue:l})});Ab.displayName=mR;function Rb(n){return n===""||n===void 0}function _b(n){const l=Qa(n),o=v.useRef(""),i=v.useRef(0),u=v.useCallback(f=>{const h=o.current+f;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,u,d]}function jb(n,l,o){const u=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let f=hR(n,Math.max(d,0));u.length===1&&(f=f.filter(p=>p!==o));const y=f.find(p=>p.textValue.toLowerCase().startsWith(u.toLowerCase()));return y!==o?y:void 0}function hR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var pR=ab,Ob=rb,gR=ib,vR=sb,yR=cb,Mb=ub,bR=hb,Db=vb,kb=bb,xR=xb,SR=wb,zb=Eb,Lb=Nb,Ub=Cb;const Bb=pR,Hb=gR,$f=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(Ob,{ref:i,className:se("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,m.jsx(vR,{asChild:!0,children:m.jsx(Zs,{className:"h-4 w-4 opacity-50"})})]}));$f.displayName=Ob.displayName;const Vb=v.forwardRef(({className:n,...l},o)=>m.jsx(zb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:m.jsx(zE,{className:"h-4 w-4"})}));Vb.displayName=zb.displayName;const Yb=v.forwardRef(({className:n,...l},o)=>m.jsx(Lb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:m.jsx(Zs,{className:"h-4 w-4"})}));Yb.displayName=Lb.displayName;const qf=v.forwardRef(({className:n,children:l,position:o="popper",...i},u)=>m.jsx(yR,{children:m.jsxs(Mb,{ref:u,className:se("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:[m.jsx(Vb,{}),m.jsx(bR,{className:se("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),m.jsx(Yb,{})]})}));qf.displayName=Mb.displayName;const wR=v.forwardRef(({className:n,...l},o)=>m.jsx(Db,{ref:o,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));wR.displayName=Db.displayName;const Nr=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(kb,{ref:i,className:se("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:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(SR,{children:m.jsx(_s,{className:"h-4 w-4"})})}),m.jsx(xR,{children:l})]}));Nr.displayName=kb.displayName;const ER=v.forwardRef(({className:n,...l},o)=>m.jsx(Ub,{ref:o,className:se("-mx-1 my-1 h-px bg-muted",n),...l}));ER.displayName=Ub.displayName;var Yd="rovingFocusGroup.onEntryFocus",NR={bubbles:!1,cancelable:!0},Zo="RovingFocusGroup",[lf,$b,TR]=Oy(Zo),[CR,qb]=Fa(Zo,[TR]),[AR,RR]=CR(Zo),Gb=v.forwardRef((n,l)=>m.jsx(lf.Provider,{scope:n.__scopeRovingFocusGroup,children:m.jsx(lf.Slot,{scope:n.__scopeRovingFocusGroup,children:m.jsx(_R,{...n,ref:l})})}));Gb.displayName=Zo;var _R=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:u=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=n,w=v.useRef(null),N=Ie(l,w),T=Mf(d),[E,C]=Rr({prop:f,defaultProp:h??null,onChange:y,caller:Zo}),[A,_]=v.useState(!1),M=Qa(p),k=$b(o),Y=v.useRef(!1),[G,B]=v.useState(0);return v.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(Yd,M),()=>V.removeEventListener(Yd,M)},[M]),m.jsx(AR,{scope:o,orientation:i,dir:T,loop:u,currentTabStopId:E,onItemFocus:v.useCallback(V=>C(V),[C]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>B(V=>V+1),[]),onFocusableItemRemove:v.useCallback(()=>B(V=>V-1),[]),children:m.jsx(ze.div,{tabIndex:A||G===0?-1:0,"data-orientation":i,...g,ref:N,style:{outline:"none",...n.style},onMouseDown:Oe(n.onMouseDown,()=>{Y.current=!0}),onFocus:Oe(n.onFocus,V=>{const ae=!Y.current;if(V.target===V.currentTarget&&ae&&!A){const re=new CustomEvent(Yd,NR);if(V.currentTarget.dispatchEvent(re),!re.defaultPrevented){const pe=k().filter(O=>O.focusable),me=pe.find(O=>O.active),ue=pe.find(O=>O.id===E),le=[me,ue,...pe].filter(Boolean).map(O=>O.ref.current);Qb(le,x)}}Y.current=!1}),onBlur:Oe(n.onBlur,()=>_(!1))})})}),Xb="RovingFocusGroupItem",Pb=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:u=!1,tabStopId:d,children:f,...h}=n,y=Xa(),p=d||y,x=RR(Xb,o),g=x.currentTabStopId===p,w=$b(o),{onFocusableItemAdd:N,onFocusableItemRemove:T,currentTabStopId:E}=x;return v.useEffect(()=>{if(i)return N(),()=>T()},[i,N,T]),m.jsx(lf.ItemSlot,{scope:o,id:p,focusable:i,active:u,children:m.jsx(ze.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:Oe(n.onMouseDown,C=>{i?x.onItemFocus(p):C.preventDefault()}),onFocus:Oe(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Oe(n.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){x.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const A=MR(C,x.orientation,x.dir);if(A!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let M=w().filter(k=>k.focusable).map(k=>k.ref.current);if(A==="last")M.reverse();else if(A==="prev"||A==="next"){A==="prev"&&M.reverse();const k=M.indexOf(C.currentTarget);M=x.loop?DR(M,k+1):M.slice(k+1)}setTimeout(()=>Qb(M))}}),children:typeof f=="function"?f({isCurrentTabStop:g,hasTabStop:E!=null}):f})})});Pb.displayName=Xb;var jR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function OR(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function MR(n,l,o){const i=OR(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return jR[i]}function Qb(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function DR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var kR=Gb,zR=Pb,oc="Tabs",[LR]=Fa(oc,[qb]),Kb=qb(),[UR,Gf]=LR(oc),Zb=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:u,defaultValue:d,orientation:f="horizontal",dir:h,activationMode:y="automatic",...p}=n,x=Mf(h),[g,w]=Rr({prop:i,onChange:u,defaultProp:d??"",caller:oc});return m.jsx(UR,{scope:o,baseId:Xa(),value:g,onValueChange:w,orientation:f,dir:x,activationMode:y,children:m.jsx(ze.div,{dir:x,"data-orientation":f,...p,ref:l})})});Zb.displayName=oc;var Ib="TabsList",Fb=v.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...u}=n,d=Gf(Ib,o),f=Kb(o);return m.jsx(kR,{asChild:!0,...f,orientation:d.orientation,dir:d.dir,loop:i,children:m.jsx(ze.div,{role:"tablist","aria-orientation":d.orientation,...u,ref:l})})});Fb.displayName=Ib;var Jb="TabsTrigger",Wb=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:u=!1,...d}=n,f=Gf(Jb,o),h=Kb(o),y=nx(f.baseId,i),p=ax(f.baseId,i),x=i===f.value;return m.jsx(zR,{asChild:!0,...h,focusable:!u,active:x,children:m.jsx(ze.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:y,...d,ref:l,onMouseDown:Oe(n.onMouseDown,g=>{!u&&g.button===0&&g.ctrlKey===!1?f.onValueChange(i):g.preventDefault()}),onKeyDown:Oe(n.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&f.onValueChange(i)}),onFocus:Oe(n.onFocus,()=>{const g=f.activationMode!=="manual";!x&&!u&&g&&f.onValueChange(i)})})})});Wb.displayName=Jb;var ex="TabsContent",tx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:u,children:d,...f}=n,h=Gf(ex,o),y=nx(h.baseId,i),p=ax(h.baseId,i),x=i===h.value,g=v.useRef(x);return v.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),m.jsx(kr,{present:u||x,children:({present:w})=>m.jsx(ze.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":y,hidden:!w,id:p,tabIndex:0,...f,ref:l,style:{...n.style,animationDuration:g.current?"0s":void 0},children:w&&d})})});tx.displayName=ex;function nx(n,l){return`${n}-trigger-${l}`}function ax(n,l){return`${n}-content-${l}`}var BR=Zb,lx=Fb,rx=Wb,ox=tx;const HR=BR,ix=v.forwardRef(({className:n,...l},o)=>m.jsx(lx,{ref:o,className:se("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}));ix.displayName=lx.displayName;const Cs=v.forwardRef(({className:n,...l},o)=>m.jsx(rx,{ref:o,className:se("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)] data-[state=active]:ring-1 data-[state=active]:ring-primary/22",n),...l}));Cs.displayName=rx.displayName;const Bs=v.forwardRef(({className:n,...l},o)=>m.jsx(ox,{ref:o,className:se("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}));Bs.displayName=ox.displayName;var sx="AlertDialog",[VR]=Fa(sx,[iy]),ha=iy(),cx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return m.jsx(Ey,{...i,...o,modal:!0})};cx.displayName=sx;var YR="AlertDialogTrigger",ux=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Ny,{...u,...i,ref:l})});ux.displayName=YR;var $R="AlertDialogPortal",dx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return m.jsx(Ty,{...i,...o})};dx.displayName=$R;var qR="AlertDialogOverlay",fx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Rf,{...u,...i,ref:l})});fx.displayName=qR;var Ar="AlertDialogContent",[GR,XR]=VR(Ar),PR=lC("AlertDialogContent"),mx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...u}=n,d=ha(o),f=v.useRef(null),h=Ie(l,f),y=v.useRef(null);return m.jsx(x5,{contentName:Ar,titleName:hx,docsSlug:"alert-dialog",children:m.jsx(GR,{scope:o,cancelRef:y,children:m.jsxs(_f,{role:"alertdialog",...d,...u,ref:h,onOpenAutoFocus:Oe(u.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=y.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[m.jsx(PR,{children:i}),m.jsx(KR,{contentRef:f})]})})})});mx.displayName=Ar;var hx="AlertDialogTitle",px=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(jf,{...u,...i,ref:l})});px.displayName=hx;var gx="AlertDialogDescription",vx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Of,{...u,...i,ref:l})});vx.displayName=gx;var QR="AlertDialogAction",yx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Js,{...u,...i,ref:l})});yx.displayName=QR;var bx="AlertDialogCancel",xx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:u}=XR(bx,o),d=ha(o),f=Ie(l,u);return m.jsx(Js,{...d,...i,ref:f})});xx.displayName=bx;var KR=({contentRef:n})=>{const l=`\`${Ar}\` requires a description for the component to be accessible for screen reader users.
295
+ 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},w5="DialogDescriptionWarning",E5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wy(w5).contentName}}.`;return v.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&u&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},Ey=sy,Ny=uy,Ty=fy,Rf=my,_f=hy,jf=gy,Of=yy,Js=xy;const N5=Ey,T5=Ny,C5=Ty,Nj=Js,Cy=v.forwardRef(({className:n,...l},o)=>m.jsx(Rf,{ref:o,className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l}));Cy.displayName=Rf.displayName;const Ay=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(C5,{children:[m.jsx(Cy,{}),m.jsxs(_f,{ref:i,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...o,children:[l,m.jsxs(Js,{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:[m.jsx(C0,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ay.displayName=_f.displayName;const Ry=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});Ry.displayName="DialogHeader";const A5=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});A5.displayName="DialogFooter";const _y=v.forwardRef(({className:n,...l},o)=>m.jsx(jf,{ref:o,className:se("text-lg font-semibold leading-none tracking-tight",n),...l}));_y.displayName=jf.displayName;const jy=v.forwardRef(({className:n,...l},o)=>m.jsx(Of,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));jy.displayName=Of.displayName;function R5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[u,d]=v.useState(!1),f=l??u,h=v.useCallback(y=>{l===void 0&&d(y),o==null||o(y)},[l,o]);return m.jsxs(N5,{open:f,onOpenChange:h,children:[i&&m.jsx(T5,{asChild:!0,children:m.jsx(Yn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",children:m.jsx(cN,{className:"h-4 w-4"})})}),m.jsxs(Ay,{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:[m.jsxs(Ry,{className:"shrink-0 border-b border-border/60 px-3 py-1.5 sm:px-3.5",children:[m.jsxs(_y,{className:"flex items-center gap-1.5 text-[11px]",children:[m.jsx(JE,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),m.jsx(jy,{className:"text-[10px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),m.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 jv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Oy(n){const l=n+"CollectionProvider",[o,i]=Fa(l),[u,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:C,children:A}=E,_=ne.useRef(null),M=ne.useRef(new Map).current;return m.jsx(u,{scope:C,itemMap:M,collectionRef:_,children:A})};f.displayName=l;const h=n+"CollectionSlot",y=qo(h),p=ne.forwardRef((E,C)=>{const{scope:A,children:_}=E,M=d(h,A),k=Ie(C,M.collectionRef);return m.jsx(y,{ref:k,children:_})});p.displayName=h;const x=n+"CollectionItemSlot",g="data-radix-collection-item",w=qo(x),N=ne.forwardRef((E,C)=>{const{scope:A,children:_,...M}=E,k=ne.useRef(null),Y=Ie(C,k),G=d(x,A);return ne.useEffect(()=>(G.itemMap.set(k,{ref:k,...M}),()=>void G.itemMap.delete(k))),m.jsx(w,{[g]:"",ref:Y,children:_})});N.displayName=x;function T(E){const C=d(n+"CollectionConsumer",E);return ne.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const M=Array.from(_.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((G,B)=>M.indexOf(G.ref.current)-M.indexOf(B.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:f,Slot:p,ItemSlot:N},T,i]}var _5=v.createContext(void 0);function Mf(n){const l=v.useContext(_5);return n||l||"ltr"}const j5=["top","right","bottom","left"],Ka=Math.min,en=Math.max,Ds=Math.round,xs=Math.floor,Vn=n=>({x:n,y:n}),O5={left:"right",right:"left",bottom:"top",top:"bottom"};function Id(n,l,o){return en(n,Ka(l,o))}function da(n,l){return typeof n=="function"?n(l):n}function fa(n){return n.split("-")[0]}function zr(n){return n.split("-")[1]}function Df(n){return n==="x"?"y":"x"}function kf(n){return n==="y"?"height":"width"}function Bn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function zf(n){return Df(Bn(n))}function M5(n,l,o){o===void 0&&(o=!1);const i=zr(n),u=zf(n),d=kf(u);let f=u==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(f=ks(f)),[f,ks(f)]}function D5(n){const l=ks(n);return[Fd(n),l,Fd(l)]}function Fd(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const Ov=["left","right"],Mv=["right","left"],k5=["top","bottom"],z5=["bottom","top"];function L5(n,l,o){switch(n){case"top":case"bottom":return o?l?Mv:Ov:l?Ov:Mv;case"left":case"right":return l?k5:z5;default:return[]}}function U5(n,l,o,i){const u=zr(n);let d=L5(fa(n),o==="start",i);return u&&(d=d.map(f=>f+"-"+u),l&&(d=d.concat(d.map(Fd)))),d}function ks(n){const l=fa(n);return O5[l]+n.slice(l.length)}function B5(n){return{top:0,right:0,bottom:0,left:0,...n}}function My(n){return typeof n!="number"?B5(n):{top:n,right:n,bottom:n,left:n}}function zs(n){const{x:l,y:o,width:i,height:u}=n;return{width:i,height:u,top:o,left:l,right:l+i,bottom:o+u,x:l,y:o}}function Dv(n,l,o){let{reference:i,floating:u}=n;const d=Bn(l),f=zf(l),h=kf(f),y=fa(l),p=d==="y",x=i.x+i.width/2-u.width/2,g=i.y+i.height/2-u.height/2,w=i[h]/2-u[h]/2;let N;switch(y){case"top":N={x,y:i.y-u.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-u.width,y:g};break;default:N={x:i.x,y:i.y}}switch(zr(l)){case"start":N[f]-=w*(o&&p?-1:1);break;case"end":N[f]+=w*(o&&p?-1:1);break}return N}async function H5(n,l){var o;l===void 0&&(l={});const{x:i,y:u,platform:d,rects:f,elements:h,strategy:y}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:g="floating",altBoundary:w=!1,padding:N=0}=da(l,n),T=My(N),C=h[w?g==="floating"?"reference":"floating":g],A=zs(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})),_=g==="floating"?{x:i,y:u,width:f.floating.width,height:f.floating.height}:f.reference,M=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),k=await(d.isElement==null?void 0:d.isElement(M))?await(d.getScale==null?void 0:d.getScale(M))||{x:1,y:1}:{x:1,y:1},Y=zs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:_,offsetParent:M,strategy:y}):_);return{top:(A.top-Y.top+T.top)/k.y,bottom:(Y.bottom-A.bottom+T.bottom)/k.y,left:(A.left-Y.left+T.left)/k.x,right:(Y.right-A.right+T.right)/k.x}}const V5=50,Y5=async(n,l,o)=>{const{placement:i="bottom",strategy:u="absolute",middleware:d=[],platform:f}=o,h=f.detectOverflow?f:{...f,detectOverflow:H5},y=await(f.isRTL==null?void 0:f.isRTL(l));let p=await f.getElementRects({reference:n,floating:l,strategy:u}),{x,y:g}=Dv(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:_}=C,{x:M,y:k,data:Y,reset:G}=await _({x,y:g,initialPlacement:i,placement:w,strategy:u,middlewareData:T,rects:p,platform:h,elements:{reference:n,floating:l}});x=M??x,g=k??g,T[A]={...T[A],...Y},G&&N<V5&&(N++,typeof G=="object"&&(G.placement&&(w=G.placement),G.rects&&(p=G.rects===!0?await f.getElementRects({reference:n,floating:l,strategy:u}):G.rects),{x,y:g}=Dv(p,w,y)),E=-1)}return{x,y:g,placement:w,strategy:u,middlewareData:T}},$5=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:u,rects:d,platform:f,elements:h,middlewareData:y}=l,{element:p,padding:x=0}=da(n,l)||{};if(p==null)return{};const g=My(x),w={x:o,y:i},N=zf(u),T=kf(N),E=await f.getDimensions(p),C=N==="y",A=C?"top":"left",_=C?"bottom":"right",M=C?"clientHeight":"clientWidth",k=d.reference[T]+d.reference[N]-w[N]-d.floating[T],Y=w[N]-d.reference[N],G=await(f.getOffsetParent==null?void 0:f.getOffsetParent(p));let B=G?G[M]:0;(!B||!await(f.isElement==null?void 0:f.isElement(G)))&&(B=h.floating[M]||d.floating[T]);const V=k/2-Y/2,ae=B/2-E[T]/2-1,re=Ka(g[A],ae),pe=Ka(g[_],ae),me=re,ue=B-E[T]-pe,de=B/2-E[T]/2+V,le=Id(me,de,ue),O=!y.arrow&&zr(u)!=null&&de!==le&&d.reference[T]/2-(de<me?re:pe)-E[T]/2<0,q=O?de<me?de-me:de-ue:0;return{[N]:w[N]+q,data:{[N]:le,centerOffset:de-le-q,...O&&{alignmentOffset:q}},reset:O}}}),q5=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:u,middlewareData:d,rects:f,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}=da(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const A=fa(u),_=Bn(h),M=fa(h)===h,k=await(y.isRTL==null?void 0:y.isRTL(p.floating)),Y=w||(M||!E?[ks(h)]:D5(h)),G=T!=="none";!w&&G&&Y.push(...U5(h,E,T,k));const B=[h,...Y],V=await y.detectOverflow(l,C),ae=[];let re=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&ae.push(V[A]),g){const de=M5(u,f,k);ae.push(V[de[0]],V[de[1]])}if(re=[...re,{placement:u,overflows:ae}],!ae.every(de=>de<=0)){var pe,me;const de=(((pe=d.flip)==null?void 0:pe.index)||0)+1,le=B[de];if(le&&(!(g==="alignment"?_!==Bn(le):!1)||re.every(I=>Bn(I.placement)===_?I.overflows[0]>0:!0)))return{data:{index:de,overflows:re},reset:{placement:le}};let O=(me=re.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:me.placement;if(!O)switch(N){case"bestFit":{var ue;const q=(ue=re.filter(I=>{if(G){const ce=Bn(I.placement);return ce===_||ce==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(ce=>ce>0).reduce((ce,F)=>ce+F,0)]).sort((I,ce)=>I[1]-ce[1])[0])==null?void 0:ue[0];q&&(O=q);break}case"initialPlacement":O=h;break}if(u!==O)return{reset:{placement:O}}}return{}}}};function kv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function zv(n){return j5.some(l=>n[l]>=0)}const G5=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:u="referenceHidden",...d}=da(n,l);switch(u){case"referenceHidden":{const f=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=kv(f,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:zv(h)}}}case"escaped":{const f=await i.detectOverflow(l,{...d,altBoundary:!0}),h=kv(f,o.floating);return{data:{escapedOffsets:h,escaped:zv(h)}}}default:return{}}}}},Dy=new Set(["left","top"]);async function X5(n,l){const{placement:o,platform:i,elements:u}=n,d=await(i.isRTL==null?void 0:i.isRTL(u.floating)),f=fa(o),h=zr(o),y=Bn(o)==="y",p=Dy.has(f)?-1:1,x=d&&y?-1:1,g=da(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 P5=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:u,y:d,placement:f,middlewareData:h}=l,y=await X5(l,n);return f===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:u+y.x,y:d+y.y,data:{...y,placement:f}}}}},Q5=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:u,platform:d}=l,{mainAxis:f=!0,crossAxis:h=!1,limiter:y={fn:A=>{let{x:_,y:M}=A;return{x:_,y:M}}},...p}=da(n,l),x={x:o,y:i},g=await d.detectOverflow(l,p),w=Bn(fa(u)),N=Df(w);let T=x[N],E=x[w];if(f){const A=N==="y"?"top":"left",_=N==="y"?"bottom":"right",M=T+g[A],k=T-g[_];T=Id(M,T,k)}if(h){const A=w==="y"?"top":"left",_=w==="y"?"bottom":"right",M=E+g[A],k=E-g[_];E=Id(M,E,k)}const C=y.fn({...l,[N]:T,[w]:E});return{...C,data:{x:C.x-o,y:C.y-i,enabled:{[N]:f,[w]:h}}}}}},K5=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:u,rects:d,middlewareData:f}=l,{offset:h=0,mainAxis:y=!0,crossAxis:p=!0}=da(n,l),x={x:o,y:i},g=Bn(u),w=Df(g);let N=x[w],T=x[g];const E=da(h,l),C=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(y){const M=w==="y"?"height":"width",k=d.reference[w]-d.floating[M]+C.mainAxis,Y=d.reference[w]+d.reference[M]-C.mainAxis;N<k?N=k:N>Y&&(N=Y)}if(p){var A,_;const M=w==="y"?"width":"height",k=Dy.has(fa(u)),Y=d.reference[g]-d.floating[M]+(k&&((A=f.offset)==null?void 0:A[g])||0)+(k?0:C.crossAxis),G=d.reference[g]+d.reference[M]+(k?0:((_=f.offset)==null?void 0:_[g])||0)-(k?C.crossAxis:0);T<Y?T=Y:T>G&&(T=G)}return{[w]:N,[g]:T}}}},Z5=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:u,rects:d,platform:f,elements:h}=l,{apply:y=()=>{},...p}=da(n,l),x=await f.detectOverflow(l,p),g=fa(u),w=zr(u),N=Bn(u)==="y",{width:T,height:E}=d.floating;let C,A;g==="top"||g==="bottom"?(C=g,A=w===(await(f.isRTL==null?void 0:f.isRTL(h.floating))?"start":"end")?"left":"right"):(A=g,C=w==="end"?"top":"bottom");const _=E-x.top-x.bottom,M=T-x.left-x.right,k=Ka(E-x[C],_),Y=Ka(T-x[A],M),G=!l.middlewareData.shift;let B=k,V=Y;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(V=M),(i=l.middlewareData.shift)!=null&&i.enabled.y&&(B=_),G&&!w){const re=en(x.left,0),pe=en(x.right,0),me=en(x.top,0),ue=en(x.bottom,0);N?V=T-2*(re!==0||pe!==0?re+pe:en(x.left,x.right)):B=E-2*(me!==0||ue!==0?me+ue:en(x.top,x.bottom))}await y({...l,availableWidth:V,availableHeight:B});const ae=await f.getDimensions(h.floating);return T!==ae.width||E!==ae.height?{reset:{rects:!0}}:{}}}};function Ws(){return typeof window<"u"}function Lr(n){return ky(n)?(n.nodeName||"").toLowerCase():"#document"}function tn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function qn(n){var l;return(l=(ky(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function ky(n){return Ws()?n instanceof Node||n instanceof tn(n).Node:!1}function wn(n){return Ws()?n instanceof Element||n instanceof tn(n).Element:!1}function ma(n){return Ws()?n instanceof HTMLElement||n instanceof tn(n).HTMLElement:!1}function Lv(n){return!Ws()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof tn(n).ShadowRoot}function Ko(n){const{overflow:l,overflowX:o,overflowY:i,display:u}=En(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&u!=="inline"&&u!=="contents"}function I5(n){return/^(table|td|th)$/.test(Lr(n))}function ec(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const F5=/transform|translate|scale|rotate|perspective|filter/,J5=/paint|layout|strict|content/,El=n=>!!n&&n!=="none";let Bd;function Lf(n){const l=wn(n)?En(n):n;return El(l.transform)||El(l.translate)||El(l.scale)||El(l.rotate)||El(l.perspective)||!Uf()&&(El(l.backdropFilter)||El(l.filter))||F5.test(l.willChange||"")||J5.test(l.contain||"")}function W5(n){let l=Za(n);for(;ma(l)&&!_r(l);){if(Lf(l))return l;if(ec(l))return null;l=Za(l)}return null}function Uf(){return Bd==null&&(Bd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bd}function _r(n){return/^(html|body|#document)$/.test(Lr(n))}function En(n){return tn(n).getComputedStyle(n)}function tc(n){return wn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Za(n){if(Lr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Lv(n)&&n.host||qn(n);return Lv(l)?l.host:l}function zy(n){const l=Za(n);return _r(l)?n.ownerDocument?n.ownerDocument.body:n.body:ma(l)&&Ko(l)?l:zy(l)}function Go(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=zy(n),d=u===((i=n.ownerDocument)==null?void 0:i.body),f=tn(u);if(d){const h=Jd(f);return l.concat(f,f.visualViewport||[],Ko(u)?u:[],h&&o?Go(h):[])}else return l.concat(u,Go(u,[],o))}function Jd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ly(n){const l=En(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const u=ma(n),d=u?n.offsetWidth:o,f=u?n.offsetHeight:i,h=Ds(o)!==d||Ds(i)!==f;return h&&(o=d,i=f),{width:o,height:i,$:h}}function Bf(n){return wn(n)?n:n.contextElement}function Cr(n){const l=Bf(n);if(!ma(l))return Vn(1);const o=l.getBoundingClientRect(),{width:i,height:u,$:d}=Ly(l);let f=(d?Ds(o.width):o.width)/i,h=(d?Ds(o.height):o.height)/u;return(!f||!Number.isFinite(f))&&(f=1),(!h||!Number.isFinite(h))&&(h=1),{x:f,y:h}}const eA=Vn(0);function Uy(n){const l=tn(n);return!Uf()||!l.visualViewport?eA:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function tA(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==tn(n)?!1:l}function Al(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),d=Bf(n);let f=Vn(1);l&&(i?wn(i)&&(f=Cr(i)):f=Cr(n));const h=tA(d,o,i)?Uy(d):Vn(0);let y=(u.left+h.x)/f.x,p=(u.top+h.y)/f.y,x=u.width/f.x,g=u.height/f.y;if(d){const w=tn(d),N=i&&wn(i)?tn(i):i;let T=w,E=Jd(T);for(;E&&i&&N!==T;){const C=Cr(E),A=E.getBoundingClientRect(),_=En(E),M=A.left+(E.clientLeft+parseFloat(_.paddingLeft))*C.x,k=A.top+(E.clientTop+parseFloat(_.paddingTop))*C.y;y*=C.x,p*=C.y,x*=C.x,g*=C.y,y+=M,p+=k,T=tn(E),E=Jd(T)}}return zs({width:x,height:g,x:y,y:p})}function nc(n,l){const o=tc(n).scrollLeft;return l?l.left+o:Al(qn(n)).left+o}function By(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-nc(n,o),u=o.top+l.scrollTop;return{x:i,y:u}}function nA(n){let{elements:l,rect:o,offsetParent:i,strategy:u}=n;const d=u==="fixed",f=qn(i),h=l?ec(l.floating):!1;if(i===f||h&&d)return o;let y={scrollLeft:0,scrollTop:0},p=Vn(1);const x=Vn(0),g=ma(i);if((g||!g&&!d)&&((Lr(i)!=="body"||Ko(f))&&(y=tc(i)),g)){const N=Al(i);p=Cr(i),x.x=N.x+i.clientLeft,x.y=N.y+i.clientTop}const w=f&&!g&&!d?By(f,y):Vn(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 aA(n){return Array.from(n.getClientRects())}function lA(n){const l=qn(n),o=tc(n),i=n.ownerDocument.body,u=en(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=en(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let f=-o.scrollLeft+nc(n);const h=-o.scrollTop;return En(i).direction==="rtl"&&(f+=en(l.clientWidth,i.clientWidth)-u),{width:u,height:d,x:f,y:h}}const Uv=25;function rA(n,l){const o=tn(n),i=qn(n),u=o.visualViewport;let d=i.clientWidth,f=i.clientHeight,h=0,y=0;if(u){d=u.width,f=u.height;const x=Uf();(!x||x&&l==="fixed")&&(h=u.offsetLeft,y=u.offsetTop)}const p=nc(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<=Uv&&(d-=T)}else p<=Uv&&(d+=p);return{width:d,height:f,x:h,y}}function oA(n,l){const o=Al(n,!0,l==="fixed"),i=o.top+n.clientTop,u=o.left+n.clientLeft,d=ma(n)?Cr(n):Vn(1),f=n.clientWidth*d.x,h=n.clientHeight*d.y,y=u*d.x,p=i*d.y;return{width:f,height:h,x:y,y:p}}function Bv(n,l,o){let i;if(l==="viewport")i=rA(n,o);else if(l==="document")i=lA(qn(n));else if(wn(l))i=oA(l,o);else{const u=Uy(n);i={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return zs(i)}function Hy(n,l){const o=Za(n);return o===l||!wn(o)||_r(o)?!1:En(o).position==="fixed"||Hy(o,l)}function iA(n,l){const o=l.get(n);if(o)return o;let i=Go(n,[],!1).filter(h=>wn(h)&&Lr(h)!=="body"),u=null;const d=En(n).position==="fixed";let f=d?Za(n):n;for(;wn(f)&&!_r(f);){const h=En(f),y=Lf(f);!y&&h.position==="fixed"&&(u=null),(d?!y&&!u:!y&&h.position==="static"&&!!u&&(u.position==="absolute"||u.position==="fixed")||Ko(f)&&!y&&Hy(n,f))?i=i.filter(x=>x!==f):u=h,f=Za(f)}return l.set(n,i),i}function sA(n){let{element:l,boundary:o,rootBoundary:i,strategy:u}=n;const f=[...o==="clippingAncestors"?ec(l)?[]:iA(l,this._c):[].concat(o),i],h=Bv(l,f[0],u);let y=h.top,p=h.right,x=h.bottom,g=h.left;for(let w=1;w<f.length;w++){const N=Bv(l,f[w],u);y=en(N.top,y),p=Ka(N.right,p),x=Ka(N.bottom,x),g=en(N.left,g)}return{width:p-g,height:x-y,x:g,y}}function cA(n){const{width:l,height:o}=Ly(n);return{width:l,height:o}}function uA(n,l,o){const i=ma(l),u=qn(l),d=o==="fixed",f=Al(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const y=Vn(0);function p(){y.x=nc(u)}if(i||!i&&!d)if((Lr(l)!=="body"||Ko(u))&&(h=tc(l)),i){const N=Al(l,!0,d,l);y.x=N.x+l.clientLeft,y.y=N.y+l.clientTop}else u&&p();d&&!i&&u&&p();const x=u&&!i&&!d?By(u,h):Vn(0),g=f.left+h.scrollLeft-y.x-x.x,w=f.top+h.scrollTop-y.y-x.y;return{x:g,y:w,width:f.width,height:f.height}}function Hd(n){return En(n).position==="static"}function Hv(n,l){if(!ma(n)||En(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return qn(n)===o&&(o=o.ownerDocument.body),o}function Vy(n,l){const o=tn(n);if(ec(n))return o;if(!ma(n)){let u=Za(n);for(;u&&!_r(u);){if(wn(u)&&!Hd(u))return u;u=Za(u)}return o}let i=Hv(n,l);for(;i&&I5(i)&&Hd(i);)i=Hv(i,l);return i&&_r(i)&&Hd(i)&&!Lf(i)?o:i||W5(n)||o}const dA=async function(n){const l=this.getOffsetParent||Vy,o=this.getDimensions,i=await o(n.floating);return{reference:uA(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function fA(n){return En(n).direction==="rtl"}const mA={convertOffsetParentRelativeRectToViewportRelativeRect:nA,getDocumentElement:qn,getClippingRect:sA,getOffsetParent:Vy,getElementRects:dA,getClientRects:aA,getDimensions:cA,getScale:Cr,isElement:wn,isRTL:fA};function Yy(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function hA(n,l){let o=null,i;const u=qn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function f(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=xs(g),E=xs(u.clientWidth-(x+w)),C=xs(u.clientHeight-(g+N)),A=xs(x),M={rootMargin:-T+"px "+-E+"px "+-C+"px "+-A+"px",threshold:en(0,Ka(1,y))||1};let k=!0;function Y(G){const B=G[0].intersectionRatio;if(B!==y){if(!k)return f();B?f(!1,B):i=setTimeout(()=>{f(!1,1e-7)},1e3)}B===1&&!Yy(p,n.getBoundingClientRect())&&f(),k=!1}try{o=new IntersectionObserver(Y,{...M,root:u.ownerDocument})}catch{o=new IntersectionObserver(Y,M)}o.observe(n)}return f(!0),d}function pA(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:u=!0,ancestorResize:d=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:y=!1}=i,p=Bf(n),x=u||d?[...p?Go(p):[],...l?Go(l):[]]:[];x.forEach(A=>{u&&A.addEventListener("scroll",o,{passive:!0}),d&&A.addEventListener("resize",o)});const g=p&&h?hA(p,o):null;let w=-1,N=null;f&&(N=new ResizeObserver(A=>{let[_]=A;_&&_.target===p&&N&&l&&(N.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var M;(M=N)==null||M.observe(l)})),o()}),p&&!y&&N.observe(p),l&&N.observe(l));let T,E=y?Al(n):null;y&&C();function C(){const A=Al(n);E&&!Yy(E,A)&&o(),E=A,T=requestAnimationFrame(C)}return o(),()=>{var A;x.forEach(_=>{u&&_.removeEventListener("scroll",o),d&&_.removeEventListener("resize",o)}),g==null||g(),(A=N)==null||A.disconnect(),N=null,y&&cancelAnimationFrame(T)}}const gA=P5,vA=Q5,yA=q5,bA=Z5,xA=G5,Vv=$5,SA=K5,wA=(n,l,o)=>{const i=new Map,u={platform:mA,...o},d={...u.platform,_c:i};return Y5(n,l,{...u,platform:d})};var EA=typeof document<"u",NA=function(){},Ts=EA?v.useLayoutEffect:NA;function Ls(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,u;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(!Ls(n[i],l[i]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,u[i]))return!1;for(i=o;i--!==0;){const d=u[i];if(!(d==="_owner"&&n.$$typeof)&&!Ls(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function $y(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Yv(n,l){const o=$y(n);return Math.round(l*o)/o}function Vd(n){const l=v.useRef(n);return Ts(()=>{l.current=n}),l}function TA(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:u,elements:{reference:d,floating:f}={},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);Ls(w,i)||N(i);const[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useCallback(I=>{I!==G.current&&(G.current=I,E(I))},[]),M=v.useCallback(I=>{I!==B.current&&(B.current=I,A(I))},[]),k=d||T,Y=f||C,G=v.useRef(null),B=v.useRef(null),V=v.useRef(x),ae=y!=null,re=Vd(y),pe=Vd(u),me=Vd(p),ue=v.useCallback(()=>{if(!G.current||!B.current)return;const I={placement:l,strategy:o,middleware:w};pe.current&&(I.platform=pe.current),wA(G.current,B.current,I).then(ce=>{const F={...ce,isPositioned:me.current!==!1};de.current&&!Ls(V.current,F)&&(V.current=F,Qo.flushSync(()=>{g(F)}))})},[w,l,o,pe,me]);Ts(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,g(I=>({...I,isPositioned:!1})))},[p]);const de=v.useRef(!1);Ts(()=>(de.current=!0,()=>{de.current=!1}),[]),Ts(()=>{if(k&&(G.current=k),Y&&(B.current=Y),k&&Y){if(re.current)return re.current(k,Y,ue);ue()}},[k,Y,ue,re,ae]);const le=v.useMemo(()=>({reference:G,floating:B,setReference:_,setFloating:M}),[_,M]),O=v.useMemo(()=>({reference:k,floating:Y}),[k,Y]),q=v.useMemo(()=>{const I={position:o,left:0,top:0};if(!O.floating)return I;const ce=Yv(O.floating,x.x),F=Yv(O.floating,x.y);return h?{...I,transform:"translate("+ce+"px, "+F+"px)",...$y(O.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:ce,top:F}},[o,h,O.floating,x.x,x.y]);return v.useMemo(()=>({...x,update:ue,refs:le,elements:O,floatingStyles:q}),[x,ue,le,O,q])}const CA=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:u}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?Vv({element:i.current,padding:u}).fn(o):{}:i?Vv({element:i,padding:u}).fn(o):{}}}},AA=(n,l)=>{const o=gA(n);return{name:o.name,fn:o.fn,options:[n,l]}},RA=(n,l)=>{const o=vA(n);return{name:o.name,fn:o.fn,options:[n,l]}},_A=(n,l)=>({fn:SA(n).fn,options:[n,l]}),jA=(n,l)=>{const o=yA(n);return{name:o.name,fn:o.fn,options:[n,l]}},OA=(n,l)=>{const o=bA(n);return{name:o.name,fn:o.fn,options:[n,l]}},MA=(n,l)=>{const o=xA(n);return{name:o.name,fn:o.fn,options:[n,l]}},DA=(n,l)=>{const o=CA(n);return{name:o.name,fn:o.fn,options:[n,l]}};var kA="Arrow",qy=v.forwardRef((n,l)=>{const{children:o,width:i=10,height:u=5,...d}=n;return m.jsx(ze.svg,{...d,ref:l,width:i,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});qy.displayName=kA;var zA=qy;function Gy(n){const[l,o]=v.useState(void 0);return _t(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const d=u[0];let f,h;if("borderBoxSize"in d){const y=d.borderBoxSize,p=Array.isArray(y)?y[0]:y;f=p.inlineSize,h=p.blockSize}else f=n.offsetWidth,h=n.offsetHeight;o({width:f,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var Hf="Popper",[Xy,Py]=Fa(Hf),[LA,Qy]=Xy(Hf),Ky=n=>{const{__scopePopper:l,children:o}=n,[i,u]=v.useState(null);return m.jsx(LA,{scope:l,anchor:i,onAnchorChange:u,children:o})};Ky.displayName=Hf;var Zy="PopperAnchor",Iy=v.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...u}=n,d=Qy(Zy,o),f=v.useRef(null),h=Ie(l,f),y=v.useRef(null);return v.useEffect(()=>{const p=y.current;y.current=(i==null?void 0:i.current)||f.current,p!==y.current&&d.onAnchorChange(y.current)}),i?null:m.jsx(ze.div,{...u,ref:h})});Iy.displayName=Zy;var Vf="PopperContent",[UA,BA]=Xy(Vf),Fy=v.forwardRef((n,l)=>{var te,ie,J,xe,ye,Se;const{__scopePopper:o,side:i="bottom",sideOffset:u=0,align:d="center",alignOffset:f=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=Qy(Vf,o),[A,_]=v.useState(null),M=Ie(l,Ye=>_(Ye)),[k,Y]=v.useState(null),G=Gy(k),B=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ae=i+(d!=="center"?"-"+d:""),re=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},pe=Array.isArray(p)?p:[p],me=pe.length>0,ue={padding:re,boundary:pe.filter(VA),altBoundary:me},{refs:de,floatingStyles:le,placement:O,isPositioned:q,middlewareData:I}=TA({strategy:"fixed",placement:ae,whileElementsMounted:(...Ye)=>pA(...Ye,{animationFrame:N==="always"}),elements:{reference:C.anchor},middleware:[AA({mainAxis:u+V,alignmentAxis:f}),y&&RA({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?_A():void 0,...ue}),y&&jA({...ue}),OA({...ue,apply:({elements:Ye,rects:Le,availableWidth:$e,availableHeight:gt})=>{const{width:rt,height:Pt}=Le.reference,vt=Ye.floating.style;vt.setProperty("--radix-popper-available-width",`${$e}px`),vt.setProperty("--radix-popper-available-height",`${gt}px`),vt.setProperty("--radix-popper-anchor-width",`${rt}px`),vt.setProperty("--radix-popper-anchor-height",`${Pt}px`)}}),k&&DA({element:k,padding:h}),YA({arrowWidth:B,arrowHeight:V}),w&&MA({strategy:"referenceHidden",...ue})]}),[ce,F]=eb(O),j=Qa(T);_t(()=>{q&&(j==null||j())},[q,j]);const X=(te=I.arrow)==null?void 0:te.x,Q=(ie=I.arrow)==null?void 0:ie.y,W=((J=I.arrow)==null?void 0:J.centerOffset)!==0,[ee,oe]=v.useState();return _t(()=>{A&&oe(window.getComputedStyle(A).zIndex)},[A]),m.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...le,transform:q?le.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(xe=I.transformOrigin)==null?void 0:xe.x,(ye=I.transformOrigin)==null?void 0:ye.y].join(" "),...((Se=I.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:m.jsx(UA,{scope:o,placedSide:ce,onArrowChange:Y,arrowX:X,arrowY:Q,shouldHideArrow:W,children:m.jsx(ze.div,{"data-side":ce,"data-align":F,...E,ref:M,style:{...E.style,animation:q?void 0:"none"}})})})});Fy.displayName=Vf;var Jy="PopperArrow",HA={top:"bottom",right:"left",bottom:"top",left:"right"},Wy=v.forwardRef(function(l,o){const{__scopePopper:i,...u}=l,d=BA(Jy,i),f=HA[d.placedSide];return m.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[f]: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:m.jsx(zA,{...u,ref:o,style:{...u.style,display:"block"}})})});Wy.displayName=Jy;function VA(n){return n!==null}var YA=n=>({name:"transformOrigin",options:n,fn(l){var C,A,_;const{placement:o,rects:i,middlewareData:u}=l,f=((C=u.arrow)==null?void 0:C.centerOffset)!==0,h=f?0:n.arrowWidth,y=f?0:n.arrowHeight,[p,x]=eb(o),g={start:"0%",center:"50%",end:"100%"}[x],w=(((A=u.arrow)==null?void 0:A.x)??0)+h/2,N=(((_=u.arrow)==null?void 0:_.y)??0)+y/2;let T="",E="";return p==="bottom"?(T=f?g:`${w}px`,E=`${-y}px`):p==="top"?(T=f?g:`${w}px`,E=`${i.floating.height+y}px`):p==="right"?(T=`${-y}px`,E=f?g:`${N}px`):p==="left"&&(T=`${i.floating.width+y}px`,E=f?g:`${N}px`),{data:{x:T,y:E}}}});function eb(n){const[l,o="center"]=n.split("-");return[l,o]}var $A=Ky,qA=Iy,GA=Fy,XA=Wy;function tb(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 nb=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"}),PA="VisuallyHidden",QA=v.forwardRef((n,l)=>m.jsx(ze.span,{...n,ref:l,style:{...nb,...n.style}}));QA.displayName=PA;var KA=[" ","Enter","ArrowUp","ArrowDown"],ZA=[" ","Enter"],Rl="Select",[ac,lc,IA]=Oy(Rl),[Ur]=Fa(Rl,[IA,Py]),rc=Py(),[FA,Ja]=Ur(Rl),[JA,WA]=Ur(Rl),ab=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:u,onOpenChange:d,value:f,defaultValue:h,onValueChange:y,dir:p,name:x,autoComplete:g,disabled:w,required:N,form:T}=n,E=rc(l),[C,A]=v.useState(null),[_,M]=v.useState(null),[k,Y]=v.useState(!1),G=Mf(p),[B,V]=Rr({prop:i,defaultProp:u??!1,onChange:d,caller:Rl}),[ae,re]=Rr({prop:f,defaultProp:h,onChange:y,caller:Rl}),pe=v.useRef(null),me=C?T||!!C.closest("form"):!0,[ue,de]=v.useState(new Set),le=Array.from(ue).map(O=>O.props.value).join(";");return m.jsx($A,{...E,children:m.jsxs(FA,{required:N,scope:l,trigger:C,onTriggerChange:A,valueNode:_,onValueNodeChange:M,valueNodeHasChildren:k,onValueNodeHasChildrenChange:Y,contentId:Xa(),value:ae,onValueChange:re,open:B,onOpenChange:V,dir:G,triggerPointerDownPosRef:pe,disabled:w,children:[m.jsx(ac.Provider,{scope:l,children:m.jsx(JA,{scope:n.__scopeSelect,onNativeOptionAdd:v.useCallback(O=>{de(q=>new Set(q).add(O))},[]),onNativeOptionRemove:v.useCallback(O=>{de(q=>{const I=new Set(q);return I.delete(O),I})},[]),children:o})}),me?m.jsxs(Ab,{"aria-hidden":!0,required:N,tabIndex:-1,name:x,autoComplete:g,value:ae,onChange:O=>re(O.target.value),disabled:w,form:T,children:[ae===void 0?m.jsx("option",{value:""}):null,Array.from(ue)]},le):null]})})};ab.displayName=Rl;var lb="SelectTrigger",rb=v.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...u}=n,d=rc(o),f=Ja(lb,o),h=f.disabled||i,y=Ie(l,f.onTriggerChange),p=lc(o),x=v.useRef("touch"),[g,w,N]=_b(E=>{const C=p().filter(M=>!M.disabled),A=C.find(M=>M.value===f.value),_=jb(C,E,A);_!==void 0&&f.onValueChange(_.value)}),T=E=>{h||(f.onOpenChange(!0),N()),E&&(f.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return m.jsx(qA,{asChild:!0,...d,children:m.jsx(ze.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":Rb(f.value)?"":void 0,...u,ref:y,onClick:Oe(u.onClick,E=>{E.currentTarget.focus(),x.current!=="mouse"&&T(E)}),onPointerDown:Oe(u.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:Oe(u.onKeyDown,E=>{const C=g.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&w(E.key),!(C&&E.key===" ")&&KA.includes(E.key)&&(T(),E.preventDefault())})})})});rb.displayName=lb;var ob="SelectValue",ib=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,children:d,placeholder:f="",...h}=n,y=Ja(ob,o),{onValueNodeHasChildrenChange:p}=y,x=d!==void 0,g=Ie(l,y.onValueNodeChange);return _t(()=>{p(x)},[p,x]),m.jsx(ze.span,{...h,ref:g,style:{pointerEvents:"none"},children:Rb(y.value)?m.jsx(m.Fragment,{children:f}):d})});ib.displayName=ob;var eR="SelectIcon",sb=v.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...u}=n;return m.jsx(ze.span,{"aria-hidden":!0,...u,ref:l,children:i||"▼"})});sb.displayName=eR;var tR="SelectPortal",cb=n=>m.jsx(Ef,{asChild:!0,...n});cb.displayName=tR;var _l="SelectContent",ub=v.forwardRef((n,l)=>{const o=Ja(_l,n.__scopeSelect),[i,u]=v.useState();if(_t(()=>{u(new DocumentFragment)},[]),!o.open){const d=i;return d?Qo.createPortal(m.jsx(db,{scope:n.__scopeSelect,children:m.jsx(ac.Slot,{scope:n.__scopeSelect,children:m.jsx("div",{children:n.children})})}),d):null}return m.jsx(fb,{...n,ref:l})});ub.displayName=_l;var xn=10,[db,Wa]=Ur(_l),nR="SelectContentImpl",aR=qo("SelectContent.RemoveScroll"),fb=v.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C,...A}=n,_=Ja(_l,o),[M,k]=v.useState(null),[Y,G]=v.useState(null),B=Ie(l,te=>k(te)),[V,ae]=v.useState(null),[re,pe]=v.useState(null),me=lc(o),[ue,de]=v.useState(!1),le=v.useRef(!1);v.useEffect(()=>{if(M)return ry(M)},[M]),I0();const O=v.useCallback(te=>{const[ie,...J]=me().map(Se=>Se.ref.current),[xe]=J.slice(-1),ye=document.activeElement;for(const Se of te)if(Se===ye||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ie&&Y&&(Y.scrollTop=0),Se===xe&&Y&&(Y.scrollTop=Y.scrollHeight),Se==null||Se.focus(),document.activeElement!==ye))return},[me,Y]),q=v.useCallback(()=>O([V,M]),[O,V,M]);v.useEffect(()=>{ue&&q()},[ue,q]);const{onOpenChange:I,triggerPointerDownPosRef:ce}=_;v.useEffect(()=>{if(M){let te={x:0,y:0};const ie=xe=>{var ye,Se;te={x:Math.abs(Math.round(xe.pageX)-(((ye=ce.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Se=ce.current)==null?void 0:Se.y)??0))}},J=xe=>{te.x<=10&&te.y<=10?xe.preventDefault():M.contains(xe.target)||I(!1),document.removeEventListener("pointermove",ie),ce.current=null};return ce.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",J,{capture:!0})}}},[M,I,ce]),v.useEffect(()=>{const te=()=>I(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[I]);const[F,j]=_b(te=>{const ie=me().filter(ye=>!ye.disabled),J=ie.find(ye=>ye.ref.current===document.activeElement),xe=jb(ie,te,J);xe&&setTimeout(()=>xe.ref.current.focus())}),X=v.useCallback((te,ie,J)=>{const xe=!le.current&&!J;(_.value!==void 0&&_.value===ie||xe)&&(ae(te),xe&&(le.current=!0))},[_.value]),Q=v.useCallback(()=>M==null?void 0:M.focus(),[M]),W=v.useCallback((te,ie,J)=>{const xe=!le.current&&!J;(_.value!==void 0&&_.value===ie||xe)&&pe(te)},[_.value]),ee=i==="popper"?Wd:mb,oe=ee===Wd?{side:h,sideOffset:y,align:p,alignOffset:x,arrowPadding:g,collisionBoundary:w,collisionPadding:N,sticky:T,hideWhenDetached:E,avoidCollisions:C}:{};return m.jsx(db,{scope:o,content:M,viewport:Y,onViewportChange:G,itemRefCallback:X,selectedItem:V,onItemLeave:Q,itemTextRefCallback:W,focusSelectedItem:q,selectedItemText:re,position:i,isPositioned:ue,searchRef:F,children:m.jsx(Nf,{as:aR,allowPinchZoom:!0,children:m.jsx(wf,{asChild:!0,trapped:_.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Oe(u,te=>{var ie;(ie=_.trigger)==null||ie.focus({preventScroll:!0}),te.preventDefault()}),children:m.jsx(Sf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:m.jsx(ee,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:te=>te.preventDefault(),...A,...oe,onPlaced:()=>de(!0),ref:B,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:Oe(A.onKeyDown,te=>{const ie=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ie&&te.key.length===1&&j(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let xe=me().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(te.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const ye=te.target,Se=xe.indexOf(ye);xe=xe.slice(Se+1)}setTimeout(()=>O(xe)),te.preventDefault()}})})})})})})});fb.displayName=nR;var lR="SelectItemAlignedPosition",mb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...u}=n,d=Ja(_l,o),f=Wa(_l,o),[h,y]=v.useState(null),[p,x]=v.useState(null),g=Ie(l,B=>x(B)),w=lc(o),N=v.useRef(!1),T=v.useRef(!0),{viewport:E,selectedItem:C,selectedItemText:A,focusSelectedItem:_}=f,M=v.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&E&&C&&A){const B=d.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),re=A.getBoundingClientRect();if(d.dir!=="rtl"){const ye=re.left-V.left,Se=ae.left-ye,Ye=B.left-Se,Le=B.width+Ye,$e=Math.max(Le,V.width),gt=window.innerWidth-xn,rt=jv(Se,[xn,Math.max(xn,gt-$e)]);h.style.minWidth=Le+"px",h.style.left=rt+"px"}else{const ye=V.right-re.right,Se=window.innerWidth-ae.right-ye,Ye=window.innerWidth-B.right-Se,Le=B.width+Ye,$e=Math.max(Le,V.width),gt=window.innerWidth-xn,rt=jv(Se,[xn,Math.max(xn,gt-$e)]);h.style.minWidth=Le+"px",h.style.right=rt+"px"}const pe=w(),me=window.innerHeight-xn*2,ue=E.scrollHeight,de=window.getComputedStyle(p),le=parseInt(de.borderTopWidth,10),O=parseInt(de.paddingTop,10),q=parseInt(de.borderBottomWidth,10),I=parseInt(de.paddingBottom,10),ce=le+O+ue+I+q,F=Math.min(C.offsetHeight*5,ce),j=window.getComputedStyle(E),X=parseInt(j.paddingTop,10),Q=parseInt(j.paddingBottom,10),W=B.top+B.height/2-xn,ee=me-W,oe=C.offsetHeight/2,te=C.offsetTop+oe,ie=le+O+te,J=ce-ie;if(ie<=W){const ye=pe.length>0&&C===pe[pe.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-E.offsetTop-E.offsetHeight,Ye=Math.max(ee,oe+(ye?Q:0)+Se+q),Le=ie+Ye;h.style.height=Le+"px"}else{const ye=pe.length>0&&C===pe[0].ref.current;h.style.top="0px";const Ye=Math.max(W,le+E.offsetTop+(ye?X:0)+oe)+J;h.style.height=Ye+"px",E.scrollTop=ie-W+E.offsetTop}h.style.margin=`${xn}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]);_t(()=>M(),[M]);const[k,Y]=v.useState();_t(()=>{p&&Y(window.getComputedStyle(p).zIndex)},[p]);const G=v.useCallback(B=>{B&&T.current===!0&&(M(),_==null||_(),T.current=!1)},[M,_]);return m.jsx(oR,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:N,onScrollButtonChange:G,children:m.jsx("div",{ref:y,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:m.jsx(ze.div,{...u,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...u.style}})})})});mb.displayName=lR;var rR="SelectPopperPosition",Wd=v.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:u=xn,...d}=n,f=rc(o);return m.jsx(GA,{...f,...d,ref:l,align:i,collisionPadding:u,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)"}})});Wd.displayName=rR;var[oR,Yf]=Ur(_l,{}),ef="SelectViewport",hb=v.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...u}=n,d=Wa(ef,o),f=Yf(ef,o),h=Ie(l,d.onViewportChange),y=v.useRef(0);return m.jsxs(m.Fragment,{children:[m.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}),m.jsx(ac.Slot,{scope:o,children:m.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...u,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...u.style},onScroll:Oe(u.onScroll,p=>{const x=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=f;if(w!=null&&w.current&&g){const N=Math.abs(y.current-x.scrollTop);if(N>0){const T=window.innerHeight-xn*2,E=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),A=Math.max(E,C);if(A<T){const _=A+N,M=Math.min(T,_),k=_-M;g.style.height=M+"px",g.style.bottom==="0px"&&(x.scrollTop=k>0?k:0,g.style.justifyContent="flex-end")}}}y.current=x.scrollTop})})})]})});hb.displayName=ef;var pb="SelectGroup",[iR,sR]=Ur(pb),cR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=Xa();return m.jsx(iR,{scope:o,id:u,children:m.jsx(ze.div,{role:"group","aria-labelledby":u,...i,ref:l})})});cR.displayName=pb;var gb="SelectLabel",vb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=sR(gb,o);return m.jsx(ze.div,{id:u.id,...i,ref:l})});vb.displayName=gb;var Us="SelectItem",[uR,yb]=Ur(Us),bb=v.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:u=!1,textValue:d,...f}=n,h=Ja(Us,o),y=Wa(Us,o),p=h.value===i,[x,g]=v.useState(d??""),[w,N]=v.useState(!1),T=Ie(l,_=>{var M;return(M=y.itemRefCallback)==null?void 0:M.call(y,_,i,u)}),E=Xa(),C=v.useRef("touch"),A=()=>{u||(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 m.jsx(uR,{scope:o,value:i,disabled:u,textId:E,isSelected:p,onItemTextChange:v.useCallback(_=>{g(M=>M||((_==null?void 0:_.textContent)??"").trim())},[]),children:m.jsx(ac.ItemSlot,{scope:o,value:i,disabled:u,textValue:x,children:m.jsx(ze.div,{role:"option","aria-labelledby":E,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":u||void 0,"data-disabled":u?"":void 0,tabIndex:u?void 0:-1,...f,ref:T,onFocus:Oe(f.onFocus,()=>N(!0)),onBlur:Oe(f.onBlur,()=>N(!1)),onClick:Oe(f.onClick,()=>{C.current!=="mouse"&&A()}),onPointerUp:Oe(f.onPointerUp,()=>{C.current==="mouse"&&A()}),onPointerDown:Oe(f.onPointerDown,_=>{C.current=_.pointerType}),onPointerMove:Oe(f.onPointerMove,_=>{var M;C.current=_.pointerType,u?(M=y.onItemLeave)==null||M.call(y):C.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Oe(f.onPointerLeave,_=>{var M;_.currentTarget===document.activeElement&&((M=y.onItemLeave)==null||M.call(y))}),onKeyDown:Oe(f.onKeyDown,_=>{var k;((k=y.searchRef)==null?void 0:k.current)!==""&&_.key===" "||(ZA.includes(_.key)&&A(),_.key===" "&&_.preventDefault())})})})})});bb.displayName=Us;var Vo="SelectItemText",xb=v.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,...d}=n,f=Ja(Vo,o),h=Wa(Vo,o),y=yb(Vo,o),p=WA(Vo,o),[x,g]=v.useState(null),w=Ie(l,A=>g(A),y.onItemTextChange,A=>{var _;return(_=h.itemTextRefCallback)==null?void 0:_.call(h,A,y.value,y.disabled)}),N=x==null?void 0:x.textContent,T=v.useMemo(()=>m.jsx("option",{value:y.value,disabled:y.disabled,children:N},y.value),[y.disabled,y.value,N]),{onNativeOptionAdd:E,onNativeOptionRemove:C}=p;return _t(()=>(E(T),()=>C(T)),[E,C,T]),m.jsxs(m.Fragment,{children:[m.jsx(ze.span,{id:y.textId,...d,ref:w}),y.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Qo.createPortal(d.children,f.valueNode):null]})});xb.displayName=Vo;var Sb="SelectItemIndicator",wb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return yb(Sb,o).isSelected?m.jsx(ze.span,{"aria-hidden":!0,...i,ref:l}):null});wb.displayName=Sb;var tf="SelectScrollUpButton",Eb=v.forwardRef((n,l)=>{const o=Wa(tf,n.__scopeSelect),i=Yf(tf,n.__scopeSelect),[u,d]=v.useState(!1),f=Ie(l,i.onScrollButtonChange);return _t(()=>{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]),u?m.jsx(Tb,{...n,ref:f,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop-y.offsetHeight)}}):null});Eb.displayName=tf;var nf="SelectScrollDownButton",Nb=v.forwardRef((n,l)=>{const o=Wa(nf,n.__scopeSelect),i=Yf(nf,n.__scopeSelect),[u,d]=v.useState(!1),f=Ie(l,i.onScrollButtonChange);return _t(()=>{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]),u?m.jsx(Tb,{...n,ref:f,onAutoScroll:()=>{const{viewport:h,selectedItem:y}=o;h&&y&&(h.scrollTop=h.scrollTop+y.offsetHeight)}}):null});Nb.displayName=nf;var Tb=v.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...u}=n,d=Wa("SelectScrollButton",o),f=v.useRef(null),h=lc(o),y=v.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return v.useEffect(()=>()=>y(),[y]),_t(()=>{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]),m.jsx(ze.div,{"aria-hidden":!0,...u,ref:l,style:{flexShrink:0,...u.style},onPointerDown:Oe(u.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:Oe(u.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:Oe(u.onPointerLeave,()=>{y()})})}),dR="SelectSeparator",Cb=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return m.jsx(ze.div,{"aria-hidden":!0,...i,ref:l})});Cb.displayName=dR;var af="SelectArrow",fR=v.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=rc(o),d=Ja(af,o),f=Wa(af,o);return d.open&&f.position==="popper"?m.jsx(XA,{...u,...i,ref:l}):null});fR.displayName=af;var mR="SelectBubbleInput",Ab=v.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const u=v.useRef(null),d=Ie(i,u),f=tb(l);return v.useEffect(()=>{const h=u.current;if(!h)return;const y=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(y,"value").set;if(f!==l&&x){const g=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(g)}},[f,l]),m.jsx(ze.select,{...o,style:{...nb,...o.style},ref:d,defaultValue:l})});Ab.displayName=mR;function Rb(n){return n===""||n===void 0}function _b(n){const l=Qa(n),o=v.useRef(""),i=v.useRef(0),u=v.useCallback(f=>{const h=o.current+f;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,u,d]}function jb(n,l,o){const u=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let f=hR(n,Math.max(d,0));u.length===1&&(f=f.filter(p=>p!==o));const y=f.find(p=>p.textValue.toLowerCase().startsWith(u.toLowerCase()));return y!==o?y:void 0}function hR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var pR=ab,Ob=rb,gR=ib,vR=sb,yR=cb,Mb=ub,bR=hb,Db=vb,kb=bb,xR=xb,SR=wb,zb=Eb,Lb=Nb,Ub=Cb;const Bb=pR,Hb=gR,$f=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(Ob,{ref:i,className:se("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,m.jsx(vR,{asChild:!0,children:m.jsx(Zs,{className:"h-4 w-4 opacity-50"})})]}));$f.displayName=Ob.displayName;const Vb=v.forwardRef(({className:n,...l},o)=>m.jsx(zb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:m.jsx(zE,{className:"h-4 w-4"})}));Vb.displayName=zb.displayName;const Yb=v.forwardRef(({className:n,...l},o)=>m.jsx(Lb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:m.jsx(Zs,{className:"h-4 w-4"})}));Yb.displayName=Lb.displayName;const qf=v.forwardRef(({className:n,children:l,position:o="popper",...i},u)=>m.jsx(yR,{children:m.jsxs(Mb,{ref:u,className:se("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:[m.jsx(Vb,{}),m.jsx(bR,{className:se("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),m.jsx(Yb,{})]})}));qf.displayName=Mb.displayName;const wR=v.forwardRef(({className:n,...l},o)=>m.jsx(Db,{ref:o,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));wR.displayName=Db.displayName;const Nr=v.forwardRef(({className:n,children:l,...o},i)=>m.jsxs(kb,{ref:i,className:se("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:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(SR,{children:m.jsx(_s,{className:"h-4 w-4"})})}),m.jsx(xR,{children:l})]}));Nr.displayName=kb.displayName;const ER=v.forwardRef(({className:n,...l},o)=>m.jsx(Ub,{ref:o,className:se("-mx-1 my-1 h-px bg-muted",n),...l}));ER.displayName=Ub.displayName;var Yd="rovingFocusGroup.onEntryFocus",NR={bubbles:!1,cancelable:!0},Zo="RovingFocusGroup",[lf,$b,TR]=Oy(Zo),[CR,qb]=Fa(Zo,[TR]),[AR,RR]=CR(Zo),Gb=v.forwardRef((n,l)=>m.jsx(lf.Provider,{scope:n.__scopeRovingFocusGroup,children:m.jsx(lf.Slot,{scope:n.__scopeRovingFocusGroup,children:m.jsx(_R,{...n,ref:l})})}));Gb.displayName=Zo;var _R=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:u=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:y,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=n,w=v.useRef(null),N=Ie(l,w),T=Mf(d),[E,C]=Rr({prop:f,defaultProp:h??null,onChange:y,caller:Zo}),[A,_]=v.useState(!1),M=Qa(p),k=$b(o),Y=v.useRef(!1),[G,B]=v.useState(0);return v.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(Yd,M),()=>V.removeEventListener(Yd,M)},[M]),m.jsx(AR,{scope:o,orientation:i,dir:T,loop:u,currentTabStopId:E,onItemFocus:v.useCallback(V=>C(V),[C]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>B(V=>V+1),[]),onFocusableItemRemove:v.useCallback(()=>B(V=>V-1),[]),children:m.jsx(ze.div,{tabIndex:A||G===0?-1:0,"data-orientation":i,...g,ref:N,style:{outline:"none",...n.style},onMouseDown:Oe(n.onMouseDown,()=>{Y.current=!0}),onFocus:Oe(n.onFocus,V=>{const ae=!Y.current;if(V.target===V.currentTarget&&ae&&!A){const re=new CustomEvent(Yd,NR);if(V.currentTarget.dispatchEvent(re),!re.defaultPrevented){const pe=k().filter(O=>O.focusable),me=pe.find(O=>O.active),ue=pe.find(O=>O.id===E),le=[me,ue,...pe].filter(Boolean).map(O=>O.ref.current);Qb(le,x)}}Y.current=!1}),onBlur:Oe(n.onBlur,()=>_(!1))})})}),Xb="RovingFocusGroupItem",Pb=v.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:u=!1,tabStopId:d,children:f,...h}=n,y=Xa(),p=d||y,x=RR(Xb,o),g=x.currentTabStopId===p,w=$b(o),{onFocusableItemAdd:N,onFocusableItemRemove:T,currentTabStopId:E}=x;return v.useEffect(()=>{if(i)return N(),()=>T()},[i,N,T]),m.jsx(lf.ItemSlot,{scope:o,id:p,focusable:i,active:u,children:m.jsx(ze.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:Oe(n.onMouseDown,C=>{i?x.onItemFocus(p):C.preventDefault()}),onFocus:Oe(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Oe(n.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){x.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const A=MR(C,x.orientation,x.dir);if(A!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let M=w().filter(k=>k.focusable).map(k=>k.ref.current);if(A==="last")M.reverse();else if(A==="prev"||A==="next"){A==="prev"&&M.reverse();const k=M.indexOf(C.currentTarget);M=x.loop?DR(M,k+1):M.slice(k+1)}setTimeout(()=>Qb(M))}}),children:typeof f=="function"?f({isCurrentTabStop:g,hasTabStop:E!=null}):f})})});Pb.displayName=Xb;var jR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function OR(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function MR(n,l,o){const i=OR(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return jR[i]}function Qb(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function DR(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var kR=Gb,zR=Pb,oc="Tabs",[LR]=Fa(oc,[qb]),Kb=qb(),[UR,Gf]=LR(oc),Zb=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:u,defaultValue:d,orientation:f="horizontal",dir:h,activationMode:y="automatic",...p}=n,x=Mf(h),[g,w]=Rr({prop:i,onChange:u,defaultProp:d??"",caller:oc});return m.jsx(UR,{scope:o,baseId:Xa(),value:g,onValueChange:w,orientation:f,dir:x,activationMode:y,children:m.jsx(ze.div,{dir:x,"data-orientation":f,...p,ref:l})})});Zb.displayName=oc;var Ib="TabsList",Fb=v.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...u}=n,d=Gf(Ib,o),f=Kb(o);return m.jsx(kR,{asChild:!0,...f,orientation:d.orientation,dir:d.dir,loop:i,children:m.jsx(ze.div,{role:"tablist","aria-orientation":d.orientation,...u,ref:l})})});Fb.displayName=Ib;var Jb="TabsTrigger",Wb=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:u=!1,...d}=n,f=Gf(Jb,o),h=Kb(o),y=nx(f.baseId,i),p=ax(f.baseId,i),x=i===f.value;return m.jsx(zR,{asChild:!0,...h,focusable:!u,active:x,children:m.jsx(ze.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:y,...d,ref:l,onMouseDown:Oe(n.onMouseDown,g=>{!u&&g.button===0&&g.ctrlKey===!1?f.onValueChange(i):g.preventDefault()}),onKeyDown:Oe(n.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&f.onValueChange(i)}),onFocus:Oe(n.onFocus,()=>{const g=f.activationMode!=="manual";!x&&!u&&g&&f.onValueChange(i)})})})});Wb.displayName=Jb;var ex="TabsContent",tx=v.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:u,children:d,...f}=n,h=Gf(ex,o),y=nx(h.baseId,i),p=ax(h.baseId,i),x=i===h.value,g=v.useRef(x);return v.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),m.jsx(kr,{present:u||x,children:({present:w})=>m.jsx(ze.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":y,hidden:!w,id:p,tabIndex:0,...f,ref:l,style:{...n.style,animationDuration:g.current?"0s":void 0},children:w&&d})})});tx.displayName=ex;function nx(n,l){return`${n}-trigger-${l}`}function ax(n,l){return`${n}-content-${l}`}var BR=Zb,lx=Fb,rx=Wb,ox=tx;const HR=BR,ix=v.forwardRef(({className:n,...l},o)=>m.jsx(lx,{ref:o,className:se("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}));ix.displayName=lx.displayName;const Cs=v.forwardRef(({className:n,...l},o)=>m.jsx(rx,{ref:o,className:se("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)] data-[state=active]:ring-1 data-[state=active]:ring-primary/22",n),...l}));Cs.displayName=rx.displayName;const Bs=v.forwardRef(({className:n,...l},o)=>m.jsx(ox,{ref:o,className:se("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}));Bs.displayName=ox.displayName;var sx="AlertDialog",[VR]=Fa(sx,[iy]),ha=iy(),cx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return m.jsx(Ey,{...i,...o,modal:!0})};cx.displayName=sx;var YR="AlertDialogTrigger",ux=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Ny,{...u,...i,ref:l})});ux.displayName=YR;var $R="AlertDialogPortal",dx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return m.jsx(Ty,{...i,...o})};dx.displayName=$R;var qR="AlertDialogOverlay",fx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Rf,{...u,...i,ref:l})});fx.displayName=qR;var Ar="AlertDialogContent",[GR,XR]=VR(Ar),PR=lC("AlertDialogContent"),mx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...u}=n,d=ha(o),f=v.useRef(null),h=Ie(l,f),y=v.useRef(null);return m.jsx(x5,{contentName:Ar,titleName:hx,docsSlug:"alert-dialog",children:m.jsx(GR,{scope:o,cancelRef:y,children:m.jsxs(_f,{role:"alertdialog",...d,...u,ref:h,onOpenAutoFocus:Oe(u.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=y.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[m.jsx(PR,{children:i}),m.jsx(KR,{contentRef:f})]})})})});mx.displayName=Ar;var hx="AlertDialogTitle",px=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(jf,{...u,...i,ref:l})});px.displayName=hx;var gx="AlertDialogDescription",vx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Of,{...u,...i,ref:l})});vx.displayName=gx;var QR="AlertDialogAction",yx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return m.jsx(Js,{...u,...i,ref:l})});yx.displayName=QR;var bx="AlertDialogCancel",xx=v.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:u}=XR(bx,o),d=ha(o),f=Ie(l,u);return m.jsx(Js,{...d,...i,ref:f})});xx.displayName=bx;var KR=({contentRef:n})=>{const l=`\`${Ar}\` requires a description for the component to be accessible for screen reader users.
296
296
 
297
297
  You can add a description to the \`${Ar}\` by passing a \`${gx}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
298
298
 
299
299
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ar}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
300
300
 
301
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},ZR=cx,IR=ux,FR=dx,Sx=fx,wx=mx,Ex=yx,Nx=xx,Tx=px,Cx=vx;const rf=ZR,of=IR,JR=FR,Ax=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Ax.displayName=Sx.displayName;const Hs=v.forwardRef(({className:n,...l},o)=>m.jsxs(JR,{children:[m.jsx(Ax,{}),m.jsx(wx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Hs.displayName=wx.displayName;const Vs=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const Ys=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ys.displayName="AlertDialogFooter";const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(Tx,{ref:o,className:se("text-lg font-semibold",n),...l}));$s.displayName=Tx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(Cx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Cx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>m.jsx(Ex,{ref:o,className:se(xf(),n),...l}));Gs.displayName=Ex.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>m.jsx(Nx,{ref:o,className:se(xf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Nx.displayName;function WR(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function e_({formatDateTime:n,viewInfo:l}){var i,u,d,f,h,y,p,x;const o=WR(l.packages);return m.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(CE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(zn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(Ln,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?m.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),m.jsx(PE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),m.jsx(Sr,{label:"Commit",value:((f=l.repository)==null?void 0:f.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),m.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),m.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),m.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(IE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(zn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(Ln,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),m.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var ic="Checkbox",[t_]=Fa(ic),[n_,Xf]=t_(ic);function a_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Rr({prop:o,defaultProp:u??!1,onChange:y,caller:ic}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!f||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:M,bubbleInput:C,setBubbleInput:A};return m.jsx(n_,{scope:l,...k,children:l_(g)?g(k):i})}var Rx="CheckboxTrigger",_x=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Xf(Rx,n),E=Ie(u,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const _=()=>g(C.current);return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[d,g]),m.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":Pa(y)?"mixed":y,"aria-required":p,"data-state":kx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Oe(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Oe(o,A=>{g(_=>Pa(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});_x.displayName=Rx;var Pf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(a_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(_x,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(Dx,{__scopeCheckbox:o})]})})});Pf.displayName=ic;var jx="CheckboxIndicator",Ox=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Xf(jx,o);return m.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:m.jsx(ze.span,{"data-state":kx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Ox.displayName=jx;var Mx="CheckboxBubbleInput",Dx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Xf(Mx,n),T=Ie(o,N),E=tb(d),C=Gy(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&Y){const B=new Event("click",{bubbles:G});_.indeterminate=Pa(d),Y.call(_,Pa(d)?!1:d),_.dispatchEvent(B)}},[w,E,d,u]);const A=v.useRef(Pa(d)?!1:d);return m.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Dx.displayName=Mx;function l_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function kx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const zx=v.forwardRef(({className:n,...l},o)=>m.jsx(Pf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Ox,{className:se("flex items-center justify-center text-current"),children:m.jsx(_s,{className:"h-3.5 w-3.5"})})}));zx.displayName=Pf.displayName;const Lx=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Lx.displayName="Input";const $v=["queued","running"];function r_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function o_(n){return n==="claude"||n==="codex"||n==="copilot"}function Ux(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return o_(l)?`${n.nodeId}:${l}`:null}function i_(n){return n.status==="succeeded"||n.status==="failed"}async function Bx(n,l={}){const o=l.getOperation??J2,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!i_(f)&&Date.now()<d;)await c_(i),f=await o(n.id);return f}async function s_(n,l=W2){const o=new Set(n),i=await Promise.all($v.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!$v.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Ux(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function c_(n){return new Promise(l=>setTimeout(l,n))}const u_=1500,d_=1e3,f_=9e4;async function m_(n={}){const l=n.fetchHealth??h_,o=n.initialDelayMs??u_,i=n.pollIntervalMs??d_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??g_,h=n.timeoutMs??f_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=p_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function h_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function p_(n){return typeof n=="boolean"?{ok:n}:n}function g_(n){return new Promise(l=>window.setTimeout(l,n))}function v_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function y_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=v_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[_,M]=v.useState(!1),[k,Y]=v.useState(!1);v.useEffect(()=>{E(qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||C||_)return;const re=p.updateAvailable?"update":"restart",pe=S_(T);if(T.port.trim()&&(pe==null?void 0:pe.port)===void 0){ft.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:re,startArgs:pe}:{reason:re};A(!0);try{if(i){const O=await Z2(me);N({...O,pid:O.pid??h,status:"accepted"}),ft.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),m_({previousPid:O.pid??h}).then(q=>{q||(A(!1),ft.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(q=>{A(!1),ft.error(q instanceof Error?q.message:"Runtime restart recovery failed")});return}const ue=await tE(u,me);N({operationId:ue.id,pid:h,status:ue.status}),ft.info(`Restart requested on ${d}. Operation ${$d(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Bx(ue,{timeoutMs:6e4}),le=x_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ft.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ft.error(de.error??`Restart failed on ${d}`):ft.info(`Restart operation ${$d(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),ft.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||C||_)){M(!0);try{const re=await I2();ft.info(`Stopping Meshy process ${re.pid}`)}catch(re){M(!1),ft.error(re instanceof Error?re.message:"Runtime stop failed")}}}const V=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:"ghost",disabled:C||_,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(nN,{className:se("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),m.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsx($s,{className:"text-sm",children:"Stop runtime?"}),m.jsx(qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(rN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),m.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsxs($s,{className:"text-sm",children:[g,"?"]}),m.jsxs(qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(b_,{value:T,onChange:E}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>Y(re=>!re),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(T0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Zs,{className:se("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?$d(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function b_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(Lo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(Bb,{value:l.transport,onValueChange:i=>o("transport",Hx(i)),children:[m.jsx($f,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(Hb,{placeholder:"Transport"})}),m.jsxs(qf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(Lo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(zx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:se("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Lx,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function x_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function qv(n){return{port:w_(n.endpoint),name:n.nodeName,join:"",transport:Hx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function S_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function Hx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function w_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function $d(n){return n.length<=8?n:n.slice(0,8)}function Uo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(pt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Gt(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function E_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Gv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function N_(n){return n.available?m.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):m.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function T_(n){return n.update?n.update.updateAvailable?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function C_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function A_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:se("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function R_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=T_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(x0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[N_(n),n.metadataStatus&&m.jsx(pt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&m.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),m.jsx(Bo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:d})}),m.jsxs(Hs,{children:[m.jsxs(Vs,{children:[m.jsxs($s,{children:["Upgrade ",n.label,"?"]}),m.jsxs(qs,{children:["This runs ",C_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Ys,{children:[m.jsx(Xs,{children:"Cancel"}),m.jsx(Gs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function __(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function j_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,runtimeUpdate:o==null?void 0:o.runtimeUpdate,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function O_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function M_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function D_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function k_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,re,pe,me,ue,de,le,O,q,I,ce,F,j,X,Q,W,ee,oe,te,ie;const d=v.useMemo(()=>__(n,l),[n,l]),[f,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===f)??w,T=N?j_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,_=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=r_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(J,xe)=>{const ye=Ux(J);if(!ye||x.current.has(J.id))return;const Se=D_(J),Ye=(xe==null?void 0:xe.agentLabel)??(Se?M_(Se):"Agent"),Le=(xe==null?void 0:xe.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(ye,J));try{const $e=await Bx(J);if($e.status==="succeeded")await(u==null?void 0:u()),g.current.has($e.id)||(ft.success(`${Ye} upgrade finished on ${Le}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(ft.error(A_($e)??`${Ye} upgrade failed`),g.current.add($e.id));else{p(gt=>new Map(gt).set(ye,$e)),ft.info(`${Ye} upgrade is still ${$e.status} on ${Le}`);return}p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===$e.id)&&rt.delete(ye),rt})}catch($e){p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===J.id)&&rt.delete(ye),rt}),ft.error($e instanceof Error?$e.message:`${Ye} upgrade failed`)}finally{x.current.delete(J.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function xe(){let ye;try{ye=await s_(M)}catch{return}if(!J){p(Se=>{const Ye=new Map(Se);for(const[Le,$e]of ye)Ye.set(Le,$e);return Ye});for(const Se of ye.values())B(Se)}}return xe(),()=>{J=!0}},[B,k]);async function V(J){if(N)try{const xe=await eE(N.id,J.id);ft.info(`${J.label} upgrade started on ${N.name}`),await B(xe,{agentLabel:J.label,nodeName:N.name})}catch(xe){ft.error(xe instanceof Error?xe.message:`${J.label} upgrade failed`)}}return!N||!T?m.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&m.jsxs(pt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Gt((re=N.settingsSnapshot)==null?void 0:re.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[m.jsx(G0,{status:N.status}),m.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),m.jsx(uT,{role:N.role}),m.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),m.jsx(pt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(Bb,{value:N.id,onValueChange:h,children:[m.jsx($f,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(Hb,{placeholder:"Choose a node"})}),m.jsx(qf,{children:d.map(J=>m.jsx(Nr,{value:J.id,children:O_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(E0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",E_(T.uptime)]})]})]})]}),!C&&m.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),m.jsxs(HR,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ix,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(iN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(zn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Node ID",value:T.nodeId,mono:!0}),m.jsx(Ze,{label:"Status",value:N.status}),m.jsx(Ze,{label:"Role",value:N.role}),m.jsx(Ze,{label:"Endpoint",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Joined",value:Gt(N.joinedAt)}),m.jsx(Ze,{label:"Heartbeat",value:Gt(N.lastHeartbeat)}),m.jsx(Ze,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(zn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Host",value:((pe=T.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ze,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),m.jsx(Ze,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ze,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ze,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ze,{label:"Memory",value:T.os?`${Gv(T.os.freeMemoryBytes)} free / ${Gv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&m.jsx("div",{className:"xl:col-span-2",children:m.jsx(y_,{checkedLabel:Gt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:u,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:((q=T.runtime)==null?void 0:q.workDir)??N.workDir})}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(x0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(zn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(Ln,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>m.jsx(R_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),m.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(_E,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(zn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Transport",value:N.transportType??T.transportType??"direct"}),m.jsx(Ze,{label:"Node URL",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),m.jsx(Ze,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),m.jsx(Ze,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(dN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(zn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),m.jsx(Ze,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),m.jsx(Ze,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(zn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((X=T.runtime)==null?void 0:X.workDir)??T.workDir)}),m.jsx(Ze,{label:"Storage",value:((Q=T.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),m.jsx(Ze,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),m.jsx(Ze,{label:"Started",value:Gt((te=T.runtime)==null?void 0:te.startedAt)}),m.jsx(Ze,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(zn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(Ln,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Gt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:_.az,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:_.devtunnel,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:_.claude,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:_.codex,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:_.copilot,statusVariant:Er})]})]})]})]}),m.jsx(e_,{formatDateTime:Gt,viewInfo:T})]})]})}function z_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=y0();return m.jsx(R5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(k_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const Tj="bypass",L_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Cj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Aj=new Set(L_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Rj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],_j=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],U_=new Set(["pending","assigned"]),B_=new Set(["running"]),H_=new Set(["completed","failed","cancelled"]);function jj(n,l){switch(l){case"running":return B_.has(n.status);case"waiting":return U_.has(n.status);case"closed":return H_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Oj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function Mj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function V_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function Dj(n,l,o){return V_(n,l,o).toLowerCase()}function kj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function zj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Lj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Uj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Bj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Hj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Vj(n){return new Date(n).toLocaleString()}function Yj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function Y_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),ft.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ft.success(l),!0}catch(d){return ft.error(d instanceof Error?d.message:"Failed to copy"),!1}}function $j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const $_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"},q_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function G_(n){return n.split(".")[0]??"unknown"}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Vx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function P_(n){return JSON.stringify(n,null,2)}function Q_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=G_(f.type);return m.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:X_(f.timestamp)}),d?m.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",q_[h]),children:f.type}):m.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",$_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void Y_(P_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx($E,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(C0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Vx(f,o)})]})},f.id)})})})}const K_=["node.","election.","transport."],Z_="cluster.state";function I_(n){return n.type==="node.status"?!1:K_.some(l=>n.type.startsWith(l))}function F_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function J_(n,l){return n?{time:F_(n.timestamp),text:Vx(n,l)}:null}function W_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function e3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function t3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function n3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function a3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function l3({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>I_(k)&&!p.has(k.id)),[l,p]),N=v.useMemo(()=>l.find(k=>k.type===Z_)??w[0],[l,w]),T=v.useMemo(()=>J_(N,i),[N,i]),E=v.useMemo(()=>o.filter(W_),[o]),C=E.some(k=>{var Y;return k.status==="offline"||((Y=k.devtunnelHealth)==null?void 0:Y.status)==="failed"}),A=o.some(k=>k.status==="offline"),_=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const Y=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>Y.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},Y=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",Y)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-label":n?"Live link connected":"Live link reconnecting","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:se("flex h-10 items-center gap-1.5 rounded-sm px-2 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:text-xs",n?"bg-emerald-500/8 text-muted-foreground hover:bg-emerald-500/12":"bg-destructive/8 text-muted-foreground hover:bg-destructive/12",d&&(n?"bg-emerald-500/12 shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]":"bg-destructive/12 shadow-[0_14px_40px_-26px_hsl(var(--destructive)/0.9)]")),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(E0,{className:se("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(vN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),T?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:T.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:T.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[A?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):_?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:se("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",A?"border-destructive/30 bg-destructive/10 text-destructive":_?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:n3(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:Y,status:G}=a3(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Y} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[C?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",C?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:e3(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var re;const{label:Y,status:G}=t3(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(re=k.devtunnelHealth)!=null&&re.reason?`${Y} ${G}: ${k.devtunnelHealth.reason}`:`${Y} ${G}`;return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(DE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx(Q_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x(Y=>new Set(Y).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const jr="fluent",r3="clean",qd="meshy-layout-default-migrated-to-compact",sf="true",o3="compact",i3=new Set(["airy","clean","fluent"]);function s3(n){return n!==null&&i3.has(n)}function Qf(n){return n===o3?"fluent":s3(n)?n:null}function c3(n,l){const o=Qf(n);return o===r3&&l!==sf?jr:o??jr}const Yo="finsight",Yx="default",u3=new Set(["light","dark","system"]),d3=new Set(["porcelain","warm","finsight","edge"]),$x=v.createContext(null);function f3(n){const l=new URLSearchParams(n).get("theme");return qx(l)?l:null}function m3(n){const l=new URLSearchParams(n).get("palette");return Kf(l)}function h3(n){const l=new URLSearchParams(n).get("layout");return Qf(l)}function p3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Kf(n.getAttribute("data-palette"))??Yo,layout:Qf(n.getAttribute("data-layout"))??jr}}function qj(n,l=p3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function g3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?f3(window.location.search)??b3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?m3(window.location.search)??x3(localStorage.getItem("meshy-palette"))??Yo:Yo),[d,f]=v.useState(()=>{if(typeof window<"u"){const h=h3(window.location.search);if(h)return localStorage.setItem(qd,sf),h;const y=c3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,sf),y}return jr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===Yo?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),m.jsx($x.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:f},children:n})}function v3(){const n=v.useContext($x);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function qx(n){return n!==null&&u3.has(n)}function y3(n){return n!==null&&d3.has(n)}function b3(n){return qx(n)?n:null}function Kf(n){return n===Yx?"porcelain":y3(n)?n:null}function x3(n){return n===Yx?null:Kf(n)}const S3=[{value:"light",label:"Light",icon:N0},{value:"dark",label:"Dark",icon:w0},{value:"system",label:"System",icon:S0}],Gx=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}],Xx=[{value:"fluent",label:"Fluent",hint:"Compact neutral"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"}];function w3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=v3(),[f,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?w0:n==="light"?N0:S0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!f)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]),v.useEffect(()=>()=>g(),[]),m.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("rounded-sm border bg-background/70",o!==Yo||u!==jr?"border-primary/60 text-primary":"border-border/60"),title:"Appearance","aria-haspopup":"menu","aria-expanded":f,children:m.jsx(x,{className:"h-4 w-4"})}),f&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 w-[calc(100vw-1rem)] max-w-[28rem] rounded-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:w-[28rem]",children:[m.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),m.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[E3(u)," / ",N3(o)]})]}),m.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] font-medium capitalize text-muted-foreground",children:n})]}),m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:S3.map(({value:N,label:T,icon:E})=>{const C=n===N;return m.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[m.jsx(E,{className:"h-3.5 w-3.5"}),T]},N)})}),m.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[m.jsxs("div",{children:[m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),m.jsx("div",{className:"space-y-1",children:Xx.map(({value:N,label:T,hint:E})=>{const C=u===N;return m.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(mN,{className:"h-2.5 w-2.5"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:Gx.map(({value:N,label:T,hint:E})=>{const C=o===N;return m.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsx(T3,{value:N}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function E3(n){var l;return((l=Xx.find(o=>o.value===n))==null?void 0:l.label)??n}function N3(n){var l;return((l=Gx.find(o=>o.value===n))==null?void 0:l.label)??n}function T3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:se("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function C3(){var y,p;const{cluster:n,events:l,sseConnected:o}=y0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 pb-2 pt-3 sm:px-5 sm:pb-3 sm:pt-4 lg:px-6",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-xl px-3 py-2 sm:gap-3 sm:rounded-xl sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(h0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-sm border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-sm sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden h-10 items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-3 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(G0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(l3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",u&&"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.08)]"),children:m.jsx(T0,{className:"h-4 w-4"})}),m.jsx(z_,{}),m.jsx(w3,{})]})]})}),m.jsx("main",{className:se("min-h-0 flex-1 px-3 pb-3 sm:px-5 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(d2,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const Xv=v.lazy(async()=>({default:(await Kv(()=>import("./DashboardPage-DNHPWPPy.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),A3=v.lazy(async()=>({default:(await Kv(()=>import("./SharedConversationPage-BxtmKE6F.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function R3(){return m.jsx(U2,{children:m.jsx(v.Suspense,{fallback:m.jsx(_3,{}),children:m.jsxs(m2,{children:[m.jsx(Tl,{path:"/shared/tasks/:shareId",element:m.jsx(A3,{})}),m.jsxs(Tl,{element:m.jsx(vE,{children:m.jsx(C3,{})}),children:[m.jsx(Tl,{path:"/",element:m.jsx(Xv,{})}),m.jsx(Tl,{path:"/nodes",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks/:id",element:m.jsx(Xv,{})})]})]})})})}function _3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function j3(n){return m.jsx(HT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}fw.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(g3,{children:[m.jsx(R3,{}),m.jsx(j3,{})]})}));export{Gs as $,$E as A,Yn as B,_s as C,Tj as D,Y_ as E,KE as F,V_ as G,x0 as H,Lx as I,HR as J,pt as K,wj as L,ix as M,Cs as N,Vj as O,Ej as P,Bs as Q,rf as R,iN as S,Cj as T,Hs as U,Vs as V,$s as W,C0 as X,qs as Y,Ys as Z,Xs as _,qT as a,tj as a$,Kv as a0,z3 as a1,Ry as a2,A5 as a3,K3 as a4,T0 as a5,Ho as a6,VE as a7,Q3 as a8,Z3 as a9,mE as aA,lj as aB,H3 as aC,U3 as aD,jy as aE,B3 as aF,V3 as aG,W2 as aH,z_ as aI,rj as aJ,oj as aK,M3 as aL,$n as aM,r0 as aN,O3 as aO,y0 as aP,Lj as aQ,kj as aR,jj as aS,Oj as aT,Dj as aU,Mj as aV,F3 as aW,Aj as aX,B_ as aY,nj as aZ,aj as a_,P3 as aa,cN as ab,JE as ac,zj as ad,E0 as ae,Q_ as af,G0 as ag,PE as ah,uT as ai,Yj as aj,U_ as ak,$j as al,Rj as am,_j as an,zx as ao,Bj as ap,Uj as aq,Hj as ar,of as as,ij as at,sj as au,I3 as av,uE as aw,lE as ax,Sj as ay,xj as az,se as b,ej as b0,k3 as b1,L3 as b2,D3 as b3,Y3 as b4,mj as b5,fj as b6,dj as b7,cj as b8,uj as b9,hj as ba,L_ as bb,Pv as bc,zE as bd,vj as be,gj as bf,pj as bg,rN as bh,yj as bi,Nj as bj,bj as bk,Ve as c,q0 as d,X3 as e,J2 as f,q3 as g,$3 as h,DE as i,m as j,Nr as k,G3 as l,W3 as m,Bb as n,$f as o,Hb as p,qf as q,v as r,Zs as s,ft as t,mN as u,J3 as v,N5 as w,Ay as x,_y as y,qj as z};
301
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},ZR=cx,IR=ux,FR=dx,Sx=fx,wx=mx,Ex=yx,Nx=xx,Tx=px,Cx=vx;const rf=ZR,of=IR,JR=FR,Ax=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{className:se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Ax.displayName=Sx.displayName;const Hs=v.forwardRef(({className:n,...l},o)=>m.jsxs(JR,{children:[m.jsx(Ax,{}),m.jsx(wx,{ref:o,className:se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Hs.displayName=wx.displayName;const Vs=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const Ys=({className:n,...l})=>m.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Ys.displayName="AlertDialogFooter";const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(Tx,{ref:o,className:se("text-lg font-semibold",n),...l}));$s.displayName=Tx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(Cx,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Cx.displayName;const Gs=v.forwardRef(({className:n,...l},o)=>m.jsx(Ex,{ref:o,className:se(xf(),n),...l}));Gs.displayName=Ex.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>m.jsx(Nx,{ref:o,className:se(xf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Nx.displayName;function WR(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function e_({formatDateTime:n,viewInfo:l}){var i,u,d,f,h,y,p,x;const o=WR(l.packages);return m.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(CE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(zn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(Ln,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?m.jsxs("a",{href:l.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),m.jsx(PE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),m.jsx(Sr,{label:"Commit",value:((f=l.repository)==null?void 0:f.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),m.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),m.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),m.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(IE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(zn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(Ln,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),m.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var ic="Checkbox",[t_]=Fa(ic),[n_,Xf]=t_(ic);function a_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Rr({prop:o,defaultProp:u??!1,onChange:y,caller:ic}),[T,E]=v.useState(null),[C,A]=v.useState(null),_=v.useRef(!1),M=T?!!f||!!T.closest("form"):!0,k={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:_,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:M,bubbleInput:C,setBubbleInput:A};return m.jsx(n_,{scope:l,...k,children:l_(g)?g(k):i})}var Rx="CheckboxTrigger",_x=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=Xf(Rx,n),E=Ie(u,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const _=()=>g(C.current);return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[d,g]),m.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":Pa(y)?"mixed":y,"aria-required":p,"data-state":kx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Oe(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Oe(o,A=>{g(_=>Pa(_)?!0:!_),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});_x.displayName=Rx;var Pf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(a_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(_x,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(Dx,{__scopeCheckbox:o})]})})});Pf.displayName=ic;var jx="CheckboxIndicator",Ox=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Xf(jx,o);return m.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:m.jsx(ze.span,{"data-state":kx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Ox.displayName=jx;var Mx="CheckboxBubbleInput",Dx=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=Xf(Mx,n),T=Ie(o,N),E=tb(d),C=Gy(i);v.useEffect(()=>{const _=w;if(!_)return;const M=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&Y){const B=new Event("click",{bubbles:G});_.indeterminate=Pa(d),Y.call(_,Pa(d)?!1:d),_.dispatchEvent(B)}},[w,E,d,u]);const A=v.useRef(Pa(d)?!1:d);return m.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Dx.displayName=Mx;function l_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function kx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const zx=v.forwardRef(({className:n,...l},o)=>m.jsx(Pf,{ref:o,className:se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Ox,{className:se("flex items-center justify-center text-current"),children:m.jsx(_s,{className:"h-3.5 w-3.5"})})}));zx.displayName=Pf.displayName;const Lx=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:se("flex h-10 w-full rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Lx.displayName="Input";const $v=["queued","running"];function r_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function o_(n){return n==="claude"||n==="codex"||n==="copilot"}function Ux(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return o_(l)?`${n.nodeId}:${l}`:null}function i_(n){return n.status==="succeeded"||n.status==="failed"}async function Bx(n,l={}){const o=l.getOperation??J2,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!i_(f)&&Date.now()<d;)await c_(i),f=await o(n.id);return f}async function s_(n,l=W2){const o=new Set(n),i=await Promise.all($v.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!$v.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Ux(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function c_(n){return new Promise(l=>setTimeout(l,n))}const u_=1500,d_=1e3,f_=9e4;async function m_(n={}){const l=n.fetchHealth??h_,o=n.initialDelayMs??u_,i=n.pollIntervalMs??d_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??g_,h=n.timeoutMs??f_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=p_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function h_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function p_(n){return typeof n=="boolean"?{ok:n}:n}function g_(n){return new Promise(l=>window.setTimeout(l,n))}function v_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function y_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=v_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[_,M]=v.useState(!1),[k,Y]=v.useState(!1);v.useEffect(()=>{E(qv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||C||_)return;const re=p.updateAvailable?"update":"restart",pe=S_(T);if(T.port.trim()&&(pe==null?void 0:pe.port)===void 0){ft.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:re,startArgs:pe}:{reason:re};A(!0);try{if(i){const O=await Z2(me);N({...O,pid:O.pid??h,status:"accepted"}),ft.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),m_({previousPid:O.pid??h}).then(q=>{q||(A(!1),ft.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(q=>{A(!1),ft.error(q instanceof Error?q.message:"Runtime restart recovery failed")});return}const ue=await tE(u,me);N({operationId:ue.id,pid:h,status:ue.status}),ft.info(`Restart requested on ${d}. Operation ${$d(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Bx(ue,{timeoutMs:6e4}),le=x_(de);N({command:le==null?void 0:le.command,logPath:le==null?void 0:le.logPath,mode:le==null?void 0:le.mode,operationId:de.id,pid:(le==null?void 0:le.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ft.success(`Restart handoff accepted on ${d}. Follow ${(le==null?void 0:le.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ft.error(de.error??`Restart failed on ${d}`):ft.info(`Restart operation ${$d(de.id)} is still ${de.status}. More details will update after the node reports back.`),A(!1)}catch(ue){A(!1),ft.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||C||_)){M(!0);try{const re=await I2();ft.info(`Stopping Meshy process ${re.pid}`)}catch(re){M(!1),ft.error(re instanceof Error?re.message:"Runtime stop failed")}}}const V=C?"restarting":_?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:"ghost",disabled:C||_,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(nN,{className:se("mr-1 h-3.5 w-3.5",_&&"animate-pulse")}),_?"Stopping":"Stop"]})}),m.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsx($s,{className:"text-sm",children:"Stop runtime?"}),m.jsx(qs,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsxs(Yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||C||_,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(rN,{className:se("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),m.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Vs,{className:"space-y-1",children:[m.jsxs($s,{className:"text-sm",children:[g,"?"]}),m.jsxs(qs,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(b_,{value:T,onChange:E}),m.jsxs(Ys,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>Y(re=>!re),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(T0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Zs,{className:se("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?$d(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function b_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(Lo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(Bb,{value:l.transport,onValueChange:i=>o("transport",Hx(i)),children:[m.jsx($f,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(Hb,{placeholder:"Transport"})}),m.jsxs(qf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(Lo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(zx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:se("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Lx,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function x_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function qv(n){return{port:w_(n.endpoint),name:n.nodeName,join:"",transport:Hx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function S_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function Hx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function w_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function $d(n){return n.length<=8?n:n.slice(0,8)}function Uo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(pt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Gt(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function E_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Gv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function N_(n){return n.available?m.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):m.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function T_(n){return n.update?n.update.updateAvailable?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function C_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function A_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:se("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function R_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=T_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(x0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[N_(n),n.metadataStatus&&m.jsx(pt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&m.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),m.jsx(Bo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(rf,{children:[m.jsx(of,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:d})}),m.jsxs(Hs,{children:[m.jsxs(Vs,{children:[m.jsxs($s,{children:["Upgrade ",n.label,"?"]}),m.jsxs(qs,{children:["This runs ",C_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Ys,{children:[m.jsx(Xs,{children:"Cancel"}),m.jsx(Gs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function __(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function j_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,runtimeUpdate:o==null?void 0:o.runtimeUpdate,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function O_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function M_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function D_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function k_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,re,pe,me,ue,de,le,O,q,I,ce,F,j,X,Q,W,ee,oe,te,ie;const d=v.useMemo(()=>__(n,l),[n,l]),[f,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,N=d.find(J=>J.id===f)??w,T=N?j_(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,_=((ae=T==null?void 0:T.startupRequirements)==null?void 0:ae.components)??(T==null?void 0:T.components)??{},M=v.useMemo(()=>d.map(J=>J.id),[d]),k=M.join("\0"),Y=r_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[Y]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(J,xe)=>{const ye=Ux(J);if(!ye||x.current.has(J.id))return;const Se=D_(J),Ye=(xe==null?void 0:xe.agentLabel)??(Se?M_(Se):"Agent"),Le=(xe==null?void 0:xe.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(ye,J));try{const $e=await Bx(J);if($e.status==="succeeded")await(u==null?void 0:u()),g.current.has($e.id)||(ft.success(`${Ye} upgrade finished on ${Le}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(ft.error(A_($e)??`${Ye} upgrade failed`),g.current.add($e.id));else{p(gt=>new Map(gt).set(ye,$e)),ft.info(`${Ye} upgrade is still ${$e.status} on ${Le}`);return}p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===$e.id)&&rt.delete(ye),rt})}catch($e){p(gt=>{const rt=new Map(gt),Pt=rt.get(ye);return(!Pt||Pt.id===J.id)&&rt.delete(ye),rt}),ft.error($e instanceof Error?$e.message:`${Ye} upgrade failed`)}finally{x.current.delete(J.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let J=!1;async function xe(){let ye;try{ye=await s_(M)}catch{return}if(!J){p(Se=>{const Ye=new Map(Se);for(const[Le,$e]of ye)Ye.set(Le,$e);return Ye});for(const Se of ye.values())B(Se)}}return xe(),()=>{J=!0}},[B,k]);async function V(J){if(N)try{const xe=await eE(N.id,J.id);ft.info(`${J.label} upgrade started on ${N.name}`),await B(xe,{agentLabel:J.label,nodeName:N.name})}catch(xe){ft.error(xe instanceof Error?xe.message:`${J.label} upgrade failed`)}}return!N||!T?m.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&m.jsxs(pt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Gt((re=N.settingsSnapshot)==null?void 0:re.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[m.jsx(G0,{status:N.status}),m.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),m.jsx(uT,{role:N.role}),m.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),m.jsx(pt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(Bb,{value:N.id,onValueChange:h,children:[m.jsx($f,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(Hb,{placeholder:"Choose a node"})}),m.jsx(qf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>m.jsx(Nr,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:O_(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(E0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",E_(T.uptime)]})]})]})]}),!C&&m.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),m.jsxs(HR,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ix,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(iN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(zn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Node ID",value:T.nodeId,mono:!0}),m.jsx(Ze,{label:"Status",value:N.status}),m.jsx(Ze,{label:"Role",value:N.role}),m.jsx(Ze,{label:"Endpoint",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Joined",value:Gt(N.joinedAt)}),m.jsx(Ze,{label:"Heartbeat",value:Gt(N.lastHeartbeat)}),m.jsx(Ze,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(zn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Host",value:((pe=T.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ze,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),m.jsx(Ze,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ze,{label:"CPU",value:((ue=T.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ze,{label:"Cores",value:String(((de=T.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ze,{label:"Memory",value:T.os?`${Gv(T.os.freeMemoryBytes)} free / ${Gv(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&m.jsx("div",{className:"xl:col-span-2",children:m.jsx(y_,{checkedLabel:Gt(A.checkedAt),disableAuthDefault:((le=T.auth)==null?void 0:le.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:u,pid:(O=T.runtime)==null?void 0:O.pid,transportType:N.transportType,update:A,workDir:((q=T.runtime)==null?void 0:q.workDir)??N.workDir})}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(x0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(zn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(Ln,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>m.jsx(R_,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:V},J.id))})]})]}),m.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(_E,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(zn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Transport",value:N.transportType??T.transportType??"direct"}),m.jsx(Ze,{label:"Node URL",value:N.endpoint,mono:!0}),m.jsx(Ze,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),m.jsx(Ze,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),m.jsx(Ze,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(dN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(zn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),m.jsx(Ze,{label:"Same tenant",value:(ce=T.auth)!=null&&ce.allowSameTenant?"Allowed":"Off"}),m.jsx(Ze,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(zn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(Ln,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ze,{label:"Work dir",value:((j=T.runtime)==null?void 0:j.workDir)??T.workDir??"Unavailable",mono:!!(((X=T.runtime)==null?void 0:X.workDir)??T.workDir)}),m.jsx(Ze,{label:"Storage",value:((Q=T.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),m.jsx(Ze,{label:"Process cwd",value:((ee=T.runtime)==null?void 0:ee.cwd)??"Unavailable",mono:!!((oe=T.runtime)!=null&&oe.cwd)}),m.jsx(Ze,{label:"Started",value:Gt((te=T.runtime)==null?void 0:te.startedAt)}),m.jsx(Ze,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(Dn,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(kn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(zn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(Ln,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Gt((ie=T.startupRequirements)==null?void 0:ie.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:_.az,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:_.devtunnel,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:_.claude,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:_.codex,statusVariant:Er}),m.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:_.copilot,statusVariant:Er})]})]})]})]}),m.jsx(e_,{formatDateTime:Gt,viewInfo:T})]})]})}function z_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=y0();return m.jsx(R5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(k_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const Tj="bypass",L_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Cj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Aj=new Set(L_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Rj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],_j=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],U_=new Set(["pending","assigned"]),B_=new Set(["running"]),H_=new Set(["completed","failed","cancelled"]);function jj(n,l){switch(l){case"running":return B_.has(n.status);case"waiting":return U_.has(n.status);case"closed":return H_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Oj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function Mj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function V_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function Dj(n,l,o){return V_(n,l,o).toLowerCase()}function kj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function zj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Lj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Uj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Bj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Hj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Vj(n){return new Date(n).toLocaleString()}function Yj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function Y_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),ft.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ft.success(l),!0}catch(d){return ft.error(d instanceof Error?d.message:"Failed to copy"),!1}}function $j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const $_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"},q_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function G_(n){return n.split(".")[0]??"unknown"}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Vx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function P_(n){return JSON.stringify(n,null,2)}function Q_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=G_(f.type);return m.jsx("div",{className:se("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:X_(f.timestamp)}),d?m.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",q_[h]),children:f.type}):m.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",$_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void Y_(P_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx($E,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Yn,{type:"button",variant:"ghost",size:"icon",className:se("rounded-sm text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(C0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Vx(f,o)})]})},f.id)})})})}const K_=["node.","election.","transport."],Z_="cluster.state";function I_(n){return n.type==="node.status"?!1:K_.some(l=>n.type.startsWith(l))}function F_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function J_(n,l){return n?{time:F_(n.timestamp),text:Vx(n,l)}:null}function W_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function e3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function t3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function n3(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function a3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function l3({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>I_(k)&&!p.has(k.id)),[l,p]),N=v.useMemo(()=>l.find(k=>k.type===Z_)??w[0],[l,w]),T=v.useMemo(()=>J_(N,i),[N,i]),E=v.useMemo(()=>o.filter(W_),[o]),C=E.some(k=>{var Y;return k.status==="offline"||((Y=k.devtunnelHealth)==null?void 0:Y.status)==="failed"}),A=o.some(k=>k.status==="offline"),_=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const Y=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>Y.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},Y=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",Y)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-label":n?"Live link connected":"Live link reconnecting","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:se("flex h-10 items-center gap-1.5 rounded-sm px-2 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:text-xs",n?"bg-emerald-500/8 text-muted-foreground hover:bg-emerald-500/12":"bg-destructive/8 text-muted-foreground hover:bg-destructive/12",d&&(n?"bg-emerald-500/12 shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]":"bg-destructive/12 shadow-[0_14px_40px_-26px_hsl(var(--destructive)/0.9)]")),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(E0,{className:se("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(vN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:se("rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),T?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:T.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:T.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[A?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):_?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:se("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",A?"border-destructive/30 bg-destructive/10 text-destructive":_?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:n3(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:Y,status:G}=a3(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Y} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[C?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",C?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:e3(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var re;const{label:Y,status:G}=t3(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(re=k.devtunnelHealth)!=null&&re.reason?`${Y} ${G}: ${k.devtunnelHealth.reason}`:`${Y} ${G}`;return m.jsxs("div",{"aria-label":`${Y} ${G}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Y}),B?m.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(ov,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(DE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx(Q_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x(Y=>new Set(Y).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const jr="airy",r3="clean",qd="meshy-layout-default-migrated-to-compact",sf="true",o3="compact",i3=new Set(["airy","clean","fluent"]);function s3(n){return n!==null&&i3.has(n)}function Qf(n){return n===o3?"fluent":s3(n)?n:null}function c3(n,l){const o=Qf(n);return o===r3&&l!==sf?jr:o??jr}const Yo="finsight",Yx="default",u3=new Set(["light","dark","system"]),d3=new Set(["porcelain","warm","finsight","edge"]),$x=v.createContext(null);function f3(n){const l=new URLSearchParams(n).get("theme");return qx(l)?l:null}function m3(n){const l=new URLSearchParams(n).get("palette");return Kf(l)}function h3(n){const l=new URLSearchParams(n).get("layout");return Qf(l)}function p3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Kf(n.getAttribute("data-palette"))??Yo,layout:Qf(n.getAttribute("data-layout"))??jr}}function qj(n,l=p3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function g3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?f3(window.location.search)??b3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?m3(window.location.search)??x3(localStorage.getItem("meshy-palette"))??Yo:Yo),[d,f]=v.useState(()=>{if(typeof window<"u"){const h=h3(window.location.search);if(h)return localStorage.setItem(qd,sf),h;const y=c3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,sf),y}return jr});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>y("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{const h=document.documentElement;i===Yo?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),m.jsx($x.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:f},children:n})}function v3(){const n=v.useContext($x);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function qx(n){return n!==null&&u3.has(n)}function y3(n){return n!==null&&d3.has(n)}function b3(n){return qx(n)?n:null}function Kf(n){return n===Yx?"porcelain":y3(n)?n:null}function x3(n){return n===Yx?null:Kf(n)}const S3=[{value:"light",label:"Light",icon:N0},{value:"dark",label:"Dark",icon:w0},{value:"system",label:"System",icon:S0}],Gx=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}],Xx=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function w3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=v3(),[f,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?w0:n==="light"?N0:S0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!f)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]),v.useEffect(()=>()=>g(),[]),m.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:se("rounded-sm border bg-background/70",o!==Yo||u!==jr?"border-primary/60 text-primary":"border-border/60"),title:"Appearance","aria-haspopup":"menu","aria-expanded":f,children:m.jsx(x,{className:"h-4 w-4"})}),f&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 w-[calc(100vw-1rem)] max-w-[28rem] rounded-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:w-[28rem]",children:[m.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),m.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[E3(u)," / ",N3(o)]})]}),m.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] font-medium capitalize text-muted-foreground",children:n})]}),m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:S3.map(({value:N,label:T,icon:E})=>{const C=n===N;return m.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[m.jsx(E,{className:"h-3.5 w-3.5"}),T]},N)})}),m.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[m.jsxs("div",{children:[m.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),m.jsx("div",{className:"space-y-1",children:Xx.map(({value:N,label:T,hint:E})=>{const C=u===N;return m.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(mN,{className:"h-2.5 w-2.5"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:Gx.map(({value:N,label:T,hint:E})=>{const C=o===N;return m.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",C?"border-primary/55 bg-primary/10 shadow-[inset_3px_0_0_hsl(var(--primary))]":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[m.jsx(T3,{value:N}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:se("text-[11px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),m.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:E})]}),C&&m.jsx(_s,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function E3(n){var l;return((l=Xx.find(o=>o.value===n))==null?void 0:l.label)??n}function N3(n){var l;return((l=Gx.find(o=>o.value===n))==null?void 0:l.label)??n}function T3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:se("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function C3(){var y,p;const{cluster:n,events:l,sseConnected:o}=y0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 py-2",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-xl px-3 py-2 sm:gap-3 sm:rounded-xl sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(h0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-sm border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-sm sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden h-10 items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-3 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(G0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(l3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Yn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("rounded-sm bg-background/70 text-muted-foreground shadow-sm hover:bg-accent/72 hover:text-foreground",u&&"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.08)]"),children:m.jsx(T0,{className:"h-4 w-4"})}),m.jsx(z_,{}),m.jsx(w3,{})]})]})}),m.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(d2,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const Xv=v.lazy(async()=>({default:(await Kv(()=>import("./DashboardPage-CdCiYD4R.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),A3=v.lazy(async()=>({default:(await Kv(()=>import("./SharedConversationPage-FgVTiQ2B.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function R3(){return m.jsx(U2,{children:m.jsx(v.Suspense,{fallback:m.jsx(_3,{}),children:m.jsxs(m2,{children:[m.jsx(Tl,{path:"/shared/tasks/:shareId",element:m.jsx(A3,{})}),m.jsxs(Tl,{element:m.jsx(vE,{children:m.jsx(C3,{})}),children:[m.jsx(Tl,{path:"/",element:m.jsx(Xv,{})}),m.jsx(Tl,{path:"/nodes",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks",element:m.jsx(av,{to:"/",replace:!0})}),m.jsx(Tl,{path:"/tasks/:id",element:m.jsx(Xv,{})})]})]})})})}function _3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function j3(n){return m.jsx(HT,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}fw.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(g3,{children:[m.jsx(R3,{}),m.jsx(j3,{})]})}));export{Gs as $,$E as A,Yn as B,_s as C,Tj as D,Y_ as E,KE as F,V_ as G,x0 as H,Lx as I,HR as J,pt as K,wj as L,ix as M,Cs as N,Vj as O,Ej as P,Bs as Q,rf as R,iN as S,Cj as T,Hs as U,Vs as V,$s as W,C0 as X,qs as Y,Ys as Z,Xs as _,qT as a,tj as a$,Kv as a0,z3 as a1,Ry as a2,A5 as a3,K3 as a4,T0 as a5,Ho as a6,VE as a7,Q3 as a8,Z3 as a9,mE as aA,lj as aB,H3 as aC,U3 as aD,jy as aE,B3 as aF,V3 as aG,W2 as aH,z_ as aI,rj as aJ,oj as aK,M3 as aL,$n as aM,r0 as aN,O3 as aO,y0 as aP,Lj as aQ,kj as aR,jj as aS,Oj as aT,Dj as aU,Mj as aV,F3 as aW,Aj as aX,B_ as aY,nj as aZ,aj as a_,P3 as aa,cN as ab,JE as ac,zj as ad,E0 as ae,Q_ as af,G0 as ag,PE as ah,uT as ai,Yj as aj,U_ as ak,$j as al,Rj as am,_j as an,zx as ao,Bj as ap,Uj as aq,Hj as ar,of as as,ij as at,sj as au,I3 as av,uE as aw,lE as ax,Sj as ay,xj as az,se as b,ej as b0,k3 as b1,L3 as b2,D3 as b3,Y3 as b4,mj as b5,fj as b6,dj as b7,cj as b8,uj as b9,hj as ba,L_ as bb,Pv as bc,zE as bd,vj as be,gj as bf,pj as bg,rN as bh,yj as bi,Nj as bj,bj as bk,Ve as c,q0 as d,X3 as e,J2 as f,q3 as g,$3 as h,DE as i,m as j,Nr as k,G3 as l,W3 as m,Bb as n,$f as o,Hb as p,qf as q,v as r,Zs as s,ft as t,mN as u,J3 as v,N5 as w,Ay as x,_y as y,qj as z};