openrod 0.2.0-rc.4 → 0.2.1-rc.1
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.
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.esm-Cj6nXjOx.js","assets/index.esm-BqjC2fhp.js","assets/index.esm-Z1y-oluO.js","assets/terminal-view-DMLkPyDl.js","assets/terminal-view-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var MP=Object.defineProperty;var OP=(e,t,r)=>t in e?MP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ln=(e,t,r)=>OP(e,typeof t!="symbol"?t+"":t,r);function DP(e,t){for(var r=0;r<t.length;r++){const a=t[r];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(a,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function r(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(i){if(i.ep)return;i.ep=!0;const c=r(i);fetch(i.href,c)}})();function GR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nv={exports:{}},_d={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var JC;function zP(){if(JC)return _d;JC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,i,c){var u=null;if(c!==void 0&&(u=""+c),i.key!==void 0&&(u=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:c}}return _d.Fragment=t,_d.jsx=r,_d.jsxs=r,_d}var ek;function IP(){return ek||(ek=1,nv.exports=zP()),nv.exports}var n=IP(),sv={exports:{}},Dt={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var tk;function PP(){if(tk)return Dt;tk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(_){return _===null||typeof _!="object"?null:(_=v&&_[v]||_["@@iterator"],typeof _=="function"?_:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,N={};function E(_,V,G){this.props=_,this.context=V,this.refs=N,this.updater=G||C}E.prototype.isReactComponent={},E.prototype.setState=function(_,V){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,V,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function k(){}k.prototype=E.prototype;function A(_,V,G){this.props=_,this.context=V,this.refs=N,this.updater=G||C}var M=A.prototype=new k;M.constructor=A,S(M,E.prototype),M.isPureReactComponent=!0;var R=Array.isArray;function T(){}var O={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function B(_,V,G){var Y=G.ref;return{$$typeof:e,type:_,key:V,ref:Y!==void 0?Y:null,props:G}}function F(_,V){return B(_.type,V,_.props)}function K(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function $(_){var V={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(G){return V[G]})}var P=/\/+/g;function U(_,V){return typeof _=="object"&&_!==null&&_.key!=null?$(""+_.key):V.toString(36)}function H(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(T,T):(_.status="pending",_.then(function(V){_.status==="pending"&&(_.status="fulfilled",_.value=V)},function(V){_.status==="pending"&&(_.status="rejected",_.reason=V)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function W(_,V,G,Y,ne){var te=typeof _;(te==="undefined"||te==="boolean")&&(_=null);var ye=!1;if(_===null)ye=!0;else switch(te){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(_.$$typeof){case e:case t:ye=!0;break;case p:return ye=_._init,W(ye(_._payload),V,G,Y,ne)}}if(ye)return ne=ne(_),ye=Y===""?"."+U(_,0):Y,R(ne)?(G="",ye!=null&&(G=ye.replace(P,"$&/")+"/"),W(ne,V,G,"",function(se){return se})):ne!=null&&(K(ne)&&(ne=F(ne,G+(ne.key==null||_&&_.key===ne.key?"":(""+ne.key).replace(P,"$&/")+"/")+ye)),V.push(ne)),1;ye=0;var ae=Y===""?".":Y+":";if(R(_))for(var ue=0;ue<_.length;ue++)Y=_[ue],te=ae+U(Y,ue),ye+=W(Y,V,G,te,ne);else if(ue=w(_),typeof ue=="function")for(_=ue.call(_),ue=0;!(Y=_.next()).done;)Y=Y.value,te=ae+U(Y,ue++),ye+=W(Y,V,G,te,ne);else if(te==="object"){if(typeof _.then=="function")return W(H(_),V,G,Y,ne);throw V=String(_),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ye}function q(_,V,G){if(_==null)return _;var Y=[],ne=0;return W(_,Y,"","",function(te){return V.call(G,te,ne++)}),Y}function Z(_){if(_._status===-1){var V=_._result,G=V();G.then(function(Y){(_._status===0||_._status===-1)&&(_._status=1,_._result=Y,G.status===void 0&&(G.status="fulfilled",G.value=Y))},function(Y){(_._status===0||_._status===-1)&&(_._status=2,_._result=Y,G.status===void 0&&(G.status="rejected",G.reason=Y))}),_._status===-1&&(_._status=0,_._result=G)}if(_._status===1)return _._result.default;throw _._result}var z=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)};function L(_){var V=O.T,G={};G.types=V!==null?V.types:null,O.T=G;try{var Y=_(),ne=O.S;ne!==null&&ne(G,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(T,z)}catch(te){z(te)}finally{V!==null&&G.types!==null&&(V.types=G.types),O.T=V}}function X(_){var V=O.T;if(V!==null){var G=V.types;G===null?V.types=[_]:G.indexOf(_)===-1&&G.push(_)}else L(X.bind(null,_))}var ee={map:q,forEach:function(_,V,G){q(_,function(){V.apply(this,arguments)},G)},count:function(_){var V=0;return q(_,function(){V++}),V},toArray:function(_){return q(_,function(V){return V})||[]},only:function(_){if(!K(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Dt.Activity=g,Dt.Children=ee,Dt.Component=E,Dt.Fragment=r,Dt.Profiler=i,Dt.PureComponent=A,Dt.StrictMode=a,Dt.Suspense=h,Dt.ViewTransition=b,Dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Dt.__COMPILER_RUNTIME={__proto__:null,c:function(_){return O.H.useMemoCache(_)}},Dt.addTransitionType=X,Dt.cache=function(_){return function(){return _.apply(null,arguments)}},Dt.cacheSignal=function(){return null},Dt.cloneElement=function(_,V,G){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var Y=S({},_.props),ne=_.key;if(V!=null)for(te in V.key!==void 0&&(ne=""+V.key),V)!D.call(V,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&V.ref===void 0||(Y[te]=V[te]);var te=arguments.length-2;if(te===1)Y.children=G;else if(1<te){for(var ye=Array(te),ae=0;ae<te;ae++)ye[ae]=arguments[ae+2];Y.children=ye}return B(_.type,ne,Y)},Dt.createContext=function(_){return _={$$typeof:u,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:c,_context:_},_},Dt.createElement=function(_,V,G){var Y,ne={},te=null;if(V!=null)for(Y in V.key!==void 0&&(te=""+V.key),V)D.call(V,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ne[Y]=V[Y]);var ye=arguments.length-2;if(ye===1)ne.children=G;else if(1<ye){for(var ae=Array(ye),ue=0;ue<ye;ue++)ae[ue]=arguments[ue+2];ne.children=ae}if(_&&_.defaultProps)for(Y in ye=_.defaultProps,ye)ne[Y]===void 0&&(ne[Y]=ye[Y]);return B(_,te,ne)},Dt.createRef=function(){return{current:null}},Dt.forwardRef=function(_){return{$$typeof:f,render:_}},Dt.isValidElement=K,Dt.lazy=function(_){return{$$typeof:p,_payload:{_status:-1,_result:_},_init:Z}},Dt.memo=function(_,V){return{$$typeof:m,type:_,compare:V===void 0?null:V}},Dt.startTransition=L,Dt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Dt.use=function(_){return O.H.use(_)},Dt.useActionState=function(_,V,G){return O.H.useActionState(_,V,G)},Dt.useCallback=function(_,V){return O.H.useCallback(_,V)},Dt.useContext=function(_){return O.H.useContext(_)},Dt.useDebugValue=function(){},Dt.useDeferredValue=function(_,V){return O.H.useDeferredValue(_,V)},Dt.useEffect=function(_,V){return O.H.useEffect(_,V)},Dt.useEffectEvent=function(_){return O.H.useEffectEvent(_)},Dt.useId=function(){return O.H.useId()},Dt.useImperativeHandle=function(_,V,G){return O.H.useImperativeHandle(_,V,G)},Dt.useInsertionEffect=function(_,V){return O.H.useInsertionEffect(_,V)},Dt.useLayoutEffect=function(_,V){return O.H.useLayoutEffect(_,V)},Dt.useMemo=function(_,V){return O.H.useMemo(_,V)},Dt.useOptimistic=function(_,V){return O.H.useOptimistic(_,V)},Dt.useReducer=function(_,V,G){return O.H.useReducer(_,V,G)},Dt.useRef=function(_){return O.H.useRef(_)},Dt.useState=function(_){return O.H.useState(_)},Dt.useSyncExternalStore=function(_,V,G){return O.H.useSyncExternalStore(_,V,G)},Dt.useTransition=function(){return O.H.useTransition()},Dt.version="19.3.0",Dt}var nk;function Df(){return nk||(nk=1,sv.exports=PP()),sv.exports}var x=Df();const nt=GR(x),_P=DP({__proto__:null,default:nt},[x]);var LP=(e,t,r,a,i,c,u,f)=>{let h=document.documentElement,m=["light","dark"];function p(v){(Array.isArray(e)?e:[e]).forEach(w=>{let C=w==="class",S=C&&c?i.map(N=>c[N]||N):i;C?(h.classList.remove(...S),h.classList.add(c&&c[v]?c[v]:v)):h.setAttribute(w,v)}),g(v)}function g(v){f&&m.includes(v)&&(h.style.colorScheme=v)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)p(a);else try{let v=localStorage.getItem(t)||r,w=u&&v==="system"?b():v;p(w)}catch{}},sk=["light","dark"],qR="(prefers-color-scheme: dark)",$P=typeof window>"u",$1=x.createContext(void 0),BP={setTheme:e=>{},themes:[]},YR=()=>{var e;return(e=x.useContext($1))!=null?e:BP},VP=e=>x.useContext($1)?x.createElement(x.Fragment,null,e.children):x.createElement(HP,{...e}),UP=["light","dark"],HP=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:i="theme",themes:c=UP,defaultTheme:u=r?"system":"light",attribute:f="data-theme",value:h,children:m,nonce:p,scriptProps:g})=>{let[b,v]=x.useState(()=>GP(i,u)),[w,C]=x.useState(()=>b==="system"?rv():b),S=h?Object.values(h):c,N=x.useCallback(M=>{let R=M;if(!R)return;M==="system"&&r&&(R=rv());let T=h?h[R]:R,O=t?qP(p):null,D=document.documentElement,B=F=>{F==="class"?(D.classList.remove(...S),T&&D.classList.add(T)):F.startsWith("data-")&&(T?D.setAttribute(F,T):D.removeAttribute(F))};if(Array.isArray(f)?f.forEach(B):B(f),a){let F=sk.includes(u)?u:null,K=sk.includes(R)?R:F;D.style.colorScheme=K}O==null||O()},[p]),E=x.useCallback(M=>{let R=typeof M=="function"?M(b):M;v(R);try{localStorage.setItem(i,R)}catch{}},[b]),k=x.useCallback(M=>{let R=rv(M);C(R),b==="system"&&r&&!e&&N("system")},[b,e]);x.useEffect(()=>{let M=window.matchMedia(qR);return M.addListener(k),k(M),()=>M.removeListener(k)},[k]),x.useEffect(()=>{let M=R=>{R.key===i&&(R.newValue?v(R.newValue):E(u))};return window.addEventListener("storage",M),()=>window.removeEventListener("storage",M)},[E]),x.useEffect(()=>{N(e??b)},[e,b]);let A=x.useMemo(()=>({theme:b,setTheme:E,forcedTheme:e,resolvedTheme:b==="system"?w:b,themes:r?[...c,"system"]:c,systemTheme:r?w:void 0}),[b,E,e,w,r,c]);return x.createElement($1.Provider,{value:A},x.createElement(FP,{forcedTheme:e,storageKey:i,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:u,value:h,themes:c,nonce:p,scriptProps:g}),m)},FP=x.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:a,enableColorScheme:i,defaultTheme:c,value:u,themes:f,nonce:h,scriptProps:m})=>{let p=JSON.stringify([r,t,c,e,f,u,a,i]).slice(1,-1);return x.createElement("script",{...m,suppressHydrationWarning:!0,nonce:typeof window>"u"?h:"",dangerouslySetInnerHTML:{__html:`(${LP.toString()})(${p})`}})}),GP=(e,t)=>{if($P)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},qP=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},rv=e=>(e||(e=window.matchMedia(qR)),e.matches?"dark":"light"),ov={exports:{}},Ld={},av={exports:{}},iv={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var rk;function YP(){return rk||(rk=1,(function(e){function t(H,W){var q=H.length;H.push(W);e:for(;0<q;){var Z=q-1>>>1,z=H[Z];if(0<i(z,W))H[Z]=W,H[q]=z,q=Z;else break e}}function r(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var W=H[0],q=H.pop();if(q!==W){H[0]=q;e:for(var Z=0,z=H.length,L=z>>>1;Z<L;){var X=2*(Z+1)-1,ee=H[X],_=X+1,V=H[_];if(0>i(ee,q))_<z&&0>i(V,ee)?(H[Z]=V,H[_]=q,Z=_):(H[Z]=ee,H[X]=q,Z=X);else if(_<z&&0>i(V,q))H[Z]=V,H[_]=q,Z=_;else break e}}return W}function i(H,W){var q=H.sortIndex-W.sortIndex;return q!==0?q:H.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],m=[],p=1,g=null,b=3,v=!1,w=!1,C=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var W=r(m);W!==null;){if(W.callback===null)a(m);else if(W.startTime<=H)a(m),W.sortIndex=W.expirationTime,t(h,W);else break;W=r(m)}}function M(H){if(C=!1,A(H),!w)if(r(h)!==null)w=!0,R||(R=!0,K());else{var W=r(m);W!==null&&U(M,W.startTime-H)}}var R=!1,T=-1,O=5,D=-1;function B(){return S?!0:!(e.unstable_now()-D<O)}function F(){if(S=!1,R){var H=e.unstable_now();D=H;var W=!0;try{e:{w=!1,C&&(C=!1,E(T),T=-1),v=!0;var q=b;try{t:{for(A(H),g=r(h);g!==null&&!(g.expirationTime>H&&B());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,b=g.priorityLevel;var z=Z(g.expirationTime<=H);if(H=e.unstable_now(),typeof z=="function"){g.callback=z,A(H),W=!0;break t}g===r(h)&&a(h),A(H)}else a(h);g=r(h)}if(g!==null)W=!0;else{var L=r(m);L!==null&&U(M,L.startTime-H),W=!1}}break e}finally{g=null,b=q,v=!1}W=void 0}}finally{W?K():R=!1}}}var K;if(typeof k=="function")K=function(){k(F)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,P=$.port2;$.port1.onmessage=F,K=function(){P.postMessage(null)}}else K=function(){N(F,0)};function U(H,W){T=N(function(){H(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var W=3;break;default:W=b}var q=b;b=W;try{return H()}finally{b=q}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(H,W){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var q=b;b=H;try{return W()}finally{b=q}},e.unstable_scheduleCallback=function(H,W,q){var Z=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?Z+q:Z):q=Z,H){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=q+z,H={id:p++,callback:W,priorityLevel:H,startTime:q,expirationTime:z,sortIndex:-1},q>Z?(H.sortIndex=q,t(m,H),r(h)===null&&H===r(m)&&(C?(E(T),T=-1):C=!0,U(M,q-Z))):(H.sortIndex=z,t(h,H),w||v||(w=!0,R||(R=!0,K()))),H},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(H){var W=b;return function(){var q=b;b=W;try{return H.apply(this,arguments)}finally{b=q}}}})(iv)),iv}var ok;function KP(){return ok||(ok=1,av.exports=YP()),av.exports}var lv={exports:{}},Bs={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var ak;function XP(){if(ak)return Bs;ak=1;var e=Df();function t(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)g+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function f(p,g,b){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:v===u?u:""+v,children:p,containerInfo:g,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Bs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Bs.browser=function(p){return{$$typeof:c,_reason:p}},Bs.createPortal=function(p,g){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return f(p,g,null,b)},Bs.flushSync=function(p){var g=h.T,b=a.p;try{if(h.T=null,a.p=2,p)return p()}finally{h.T=g,a.p=b,a.d.f()}},Bs.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,a.d.C(p,g))},Bs.prefetchDNS=function(p){typeof p=="string"&&a.d.D(p)},Bs.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var b=g.as,v=m(b,g.crossOrigin),w=typeof g.integrity=="string"?g.integrity:void 0,C=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;b==="style"?a.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:C}):b==="script"&&a.d.X(p,{crossOrigin:v,integrity:w,fetchPriority:C,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Bs.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var b=m(g.as,g.crossOrigin);a.d.M(p,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0})}}else g==null&&a.d.M(p)},Bs.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var b=g.as,v=m(b,g.crossOrigin);a.d.L(p,b,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Bs.preloadModule=function(p,g){if(typeof p=="string")if(g){var b=m(g.as,g.crossOrigin);a.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0})}else a.d.m(p)},Bs.requestFormReset=function(p){a.d.r(p)},Bs.unstable_batchedUpdates=function(p,g){return p(g)},Bs.useFormState=function(p,g,b){return h.H.useFormState(p,g,b)},Bs.useFormStatus=function(){return h.H.useHostTransitionStatus()},Bs.version="19.3.0",Bs}var ik;function KR(){if(ik)return lv.exports;ik=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lv.exports=XP(),lv.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var lk;function WP(){if(lk)return Ld;lk=1;var e=KP(),t=Df(),r=KR();function a(s){var o="https://react.dev/errors/"+s;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){for(var o=s,l=o;l&&!l.alternate;)o=l,(o.flags&4098)!==0&&(s=o.return),l=o.return;for(;o.return;)o=o.return;return o.tag===3?s:null}function u(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function f(s){if(s.tag===31){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function h(s){if(c(s)!==s)throw Error(a(188))}function m(s){var o=s.alternate;if(!o){if(o=c(s),o===null)throw Error(a(188));return o!==s?null:s}for(var l=s,d=o;;){var y=l.return;if(y===null)break;var j=y.alternate;if(j===null){if(d=y.return,d!==null){l=d;continue}break}if(y.child===j.child){for(j=y.child;j;){if(j===l)return h(y),s;if(j===d)return h(y),o;j=j.sibling}throw Error(a(188))}if(l.return!==d.return)l=y,d=j;else{for(var I=!1,J=y.child;J;){if(J===l){I=!0,l=y,d=j;break}if(J===d){I=!0,d=y,l=j;break}J=J.sibling}if(!I){for(J=j.child;J;){if(J===l){I=!0,l=j,d=y;break}if(J===d){I=!0,d=j,l=y;break}J=J.sibling}if(!I)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?s:o}function p(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s;for(s=s.child;s!==null;){if(o=p(s),o!==null)return o;s=s.sibling}return null}function g(s,o,l,d,y,j){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&l(s,d,y,j)||(s.tag!==22||s.memoizedState===null)&&(o||s.tag!==5&&s.tag!==27)&&g(s.child,o,l,d,y,j))return!0;s=s.sibling}return!1}function b(s){for(s=s.return;s!==null;){if(s.tag===3||s.tag===5||s.tag===27)return s;s=s.return}return null}function v(s){var o=!1;for(s=s.return;s!==null&&(s.tag===4&&(o=!0),!(s.tag===3||s.tag===5||s.tag===27));)s=s.return;return o}function w(s){var o=[null,null],l=b(s);return l===null||C(o,s,l.child,{foundSelf:!1}),o}function C(s,o,l,d){for(;l!==null;){if(l===o)d.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(d.foundSelf)return s[1]=l,!0;s[0]=l}else if((l.tag!==22||l.memoizedState===null)&&C(s,o,l.child,d))return!0;l=l.sibling}return!1}function S(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(a(559))}}var N=null,E=null;function k(s,o,l){return s===l?!0:s===o?(N=s,!0):!1}function A(s,o,l){return s===l?(E=s,!1):s===o?(E!==null&&(N=s),!0):!1}function M(s){if(s===null)return null;do s=s===null?null:s.return;while(s&&s.tag!==5&&s.tag!==27&&s.tag!==3);return s||null}function R(s,o,l){for(var d=0,y=s;y;y=l(y))d++;y=0;for(var j=o;j;j=l(j))y++;for(;0<d-y;)s=l(s),d--;for(;0<y-d;)o=l(o),y--;for(;d--;){if(s===o||o!==null&&s===o.alternate)return s;s=l(s),o=l(o)}return null}var T=Object.assign,O=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),U=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),X=Symbol.for("react.legacy_hidden"),ee=Symbol.for("react.memo_cache_sentinel"),_=Symbol.for("react.view_transition"),V=Symbol.for("react.recoverable"),G=Symbol.iterator;function Y(s){return s===null||typeof s!="object"?null:(s=G&&s[G]||s["@@iterator"],typeof s=="function"?s:null)}var ne=Symbol.for("react.client.reference");function te(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ne?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case F:return"Fragment";case $:return"Profiler";case K:return"StrictMode";case W:return"Suspense";case q:return"SuspenseList";case L:return"Activity";case _:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case B:return"Portal";case U:return s.displayName||"Context";case P:return(s._context.displayName||"Context")+".Consumer";case H:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Z:return o=s.displayName||null,o!==null?o:te(s.type)||"Memo";case z:o=s._payload,s=s._init;try{return te(s(o))}catch{}}return null}var ye=Array.isArray,ae=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},Q=[],ie=-1;function oe(s){return{current:s}}function pe(s){0>ie||(s.current=Q[ie],Q[ie]=null,ie--)}function xe(s,o){ie++,Q[ie]=s.current,s.current=o}var je=oe(null),Ie=oe(null),ce=oe(null),Te=oe(null);function re(s,o){switch(xe(ce,o),xe(Ie,s),xe(je,null),o.nodeType){case 9:case 11:s=(s=o.documentElement)&&(s=s.namespaceURI)?lC(s):0;break;default:if(s=o.tagName,o=o.namespaceURI)o=lC(o),s=cC(o,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(je),xe(je,s)}function fe(){pe(je),pe(Ie),pe(ce)}function Re(s){var o=s.memoizedState;o!==null&&(nu._currentValue=o.memoizedState,xe(Te,s)),o=je.current;var l=cC(o,s.type);o!==l&&(xe(Ie,s),xe(je,l))}function Oe(s){Ie.current===s&&(pe(je),pe(Ie)),Te.current===s&&(pe(Te),nu._currentValue=se)}var ke,he;function Ae(s){if(ke===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);ke=o&&o[1]||"",he=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ke+s+he}var ge=!1;function Pe(s,o){if(!s||ge)return"";ge=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var $e=function(){throw Error()};if(Object.defineProperty($e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($e,[])}catch(ot){var we=ot}Reflect.construct(s,[],$e)}else{try{$e.call()}catch(ot){we=ot}$e=!1;try{var Me=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),$e=!0,new s}finally{$e&&(Me!==void 0?Object.defineProperty(s.prototype,"props",Me):delete s.prototype.props)}}}else{try{throw Error()}catch(ot){we=ot}($e=s())&&typeof $e.catch=="function"&&$e.catch(function(){})}}catch(ot){if(ot&&we&&typeof ot.stack=="string")return[ot.stack,we.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=d.DetermineComponentFrameRoot(),I=j[0],J=j[1];if(I&&J){var me=I.split(`
|
|
45
|
+
`),Ce=J.split(`
|
|
46
|
+
`);for(y=d=0;d<me.length&&!me[d].includes("DetermineComponentFrameRoot");)d++;for(;y<Ce.length&&!Ce[y].includes("DetermineComponentFrameRoot");)y++;if(d===me.length||y===Ce.length)for(d=me.length-1,y=Ce.length-1;1<=d&&0<=y&&me[d]!==Ce[y];)y--;for(;1<=d&&0<=y;d--,y--)if(me[d]!==Ce[y]){if(d!==1||y!==1)do if(d--,y--,0>y||me[d]!==Ce[y]){var ze=`
|
|
47
|
+
`+me[d].replace(" at new "," at ");return s.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",s.displayName)),ze}while(1<=d&&0<=y);break}}}finally{ge=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ae(l):""}function Fe(s,o){switch(s.tag){case 26:case 27:case 5:return Ae(s.type);case 16:return Ae("Lazy");case 13:return s.child!==o&&o!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Pe(s.type,!1);case 11:return Pe(s.type.render,!1);case 1:return Pe(s.type,!0);case 31:return Ae("Activity");case 30:return Ae("ViewTransition");default:return""}}function _e(s){try{var o="",l=null;do o+=Fe(s,l),l=s,s=s.return;while(s);return o}catch(d){return`
|
|
48
|
+
Error generating stack: `+d.message+`
|
|
49
|
+
`+d.stack}}var Xe=Object.prototype.hasOwnProperty,Je=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,At=e.unstable_shouldYield,rt=e.unstable_requestPaint,ve=e.unstable_now,Ue=e.unstable_getCurrentPriorityLevel,Qe=e.unstable_ImmediatePriority,xt=e.unstable_UserBlockingPriority,Ke=e.unstable_NormalPriority,Be=e.unstable_LowPriority,jt=e.unstable_IdlePriority,Ze=e.log,Tt=e.unstable_setDisableYieldValue,Se=null,Ye=null;function et(s){if(typeof Ze=="function"&&Tt(s),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(Se,s)}catch{}}var it=Math.clz32?Math.clz32:cn,lt=Math.log,wt=Math.LN2;function cn(s){return s>>>=0,s===0?32:31-(lt(s)/wt|0)|0}var Gt=256,fn=262144,Bn=4194304;function Kn(s){var o=s&42;if(o!==0)return o;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&-s;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function de(s,o,l){var d=s.pendingLanes;if(d===0)return 0;var y=0,j=s.suspendedLanes,I=s.pingedLanes;s=s.warmLanes;var J=d&134217727;return J!==0?(d=J&~j,d!==0?y=Kn(d):(I&=J,I!==0?y=Kn(I):l||(l=J&~s,l!==0&&(y=Kn(l))))):(J=d&~j,J!==0?y=Kn(J):I!==0?y=Kn(I):l||(l=d&~s,l!==0&&(y=Kn(l)))),y===0?0:o!==0&&o!==y&&(o&j)===0&&(j=y&-y,l=o&-o,j>=l||j===32&&(l&4194048)!==0)?o:y}function tt(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Et(s,o){(o&8)!==0&&(o|=o&32);var l=s.entangledLanes;if(l!==0)for(s=s.entanglements,l&=o;0<l;){var d=31-it(l),y=1<<d;o|=s[d],l&=~y}return o}function on(s,o){switch(s){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xn(){var s=Bn;return Bn<<=1,(Bn&62914560)===0&&(Bn=4194304),s}function Wt(s){for(var o=[],l=0;31>l;l++)o.push(s);return o}function un(s,o){s.pendingLanes|=o,o!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ns(s,o,l,d,y,j){var I=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var J=s.entanglements,me=s.expirationTimes,Ce=s.hiddenUpdates;for(l=I&~l;0<l;){var ze=31-it(l),$e=1<<ze;J[ze]=0,me[ze]=-1;var we=Ce[ze];if(we!==null)for(Ce[ze]=null,ze=0;ze<we.length;ze++){var Me=we[ze];Me!==null&&(Me.lane&=-536870913)}l&=~$e}d!==0&&Jn(s,d,0),j!==0&&y===0&&s.tag!==0&&(s.suspendedLanes|=j&~(I&~o))}function Jn(s,o,l){s.pendingLanes|=o,s.suspendedLanes&=~o;var d=31-it(o);s.entangledLanes|=o,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function wo(s,o){var l=s.entangledLanes|=o;for(s=s.entanglements;l;){var d=31-it(l),y=1<<d;y&o|s[d]&o&&(s[d]|=o),l&=~y}}function jo(s,o){var l=o&-o;return l=(l&42)!==0?1:cr(l),(l&(s.suspendedLanes|o))!==0?0:l}function cr(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Fs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function fs(){var s=ue.p;return s!==0?s:(s=window.event,s===void 0?32:qC(s.type))}function Ms(s,o){var l=ue.p;try{return ue.p=s,o()}finally{ue.p=l}}var _n=Math.random().toString(36).slice(2),Un="__reactFiber$"+_n,Os="__reactProps$"+_n,Nr="__reactContainer$"+_n,Gu="__reactEvents$"+_n,gc="__reactListeners$"+_n,xc="__reactHandles$"+_n,ai="__reactResources$"+_n,cl="__reactMarker$"+_n,bc="__reactLoad$"+_n;function vc(s){delete s[Un],delete s[Os],delete s[gc],delete s[xc]}function So(s){var o;if(o=s[Un])return o;for(var l=s.parentNode;l;){if(o=l[Nr]||l[Un]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(s=kC(s);s!==null;){if(l=s[Un])return l;s=kC(s)}return o}s=l,l=s.parentNode}return null}function ul(s){if(s=s[Un]||s[Nr]){var o=s.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return s}return null}function De(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s.stateNode;throw Error(a(33))}function Ge(s){var o=s[ai];return o||(o=s[ai]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function qe(s){s[cl]=!0}function bt(s){s[bc]=void 0}var zt=new Set,Mt={};function Bt(s,o){Nn(s,o),Nn(s+"Capture",o)}function Nn(s,o){for(Mt[s]=o,s=0;s<o.length;s++)zt.add(o[s])}var hn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),kt={},It={};function an(s){return Xe.call(It,s)?!0:Xe.call(kt,s)?!1:hn.test(s)?It[s]=!0:(kt[s]=!0,!1)}var St=!1;function hs(){var s=St;return St=!1,s}function Hn(s,o,l){if(an(o))if(l===null)s.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(o);return;case"boolean":var d=o.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(o);return}}s.setAttribute(o,l)}}function Cr(s,o,l){if(l===null)s.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttribute(o,l)}}function ss(s,o,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(o,l,d)}}function rs(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function yc(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function qu(s,o,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,o);if(!s.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,j=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return y.call(this)},set:function(I){l=""+I,j.call(this,I)}}),Object.defineProperty(s,o,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(I){l=""+I},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Sa(s){if(!s._valueTracker){var o=yc(s)?"checked":"value";s._valueTracker=qu(s,o,""+s[o])}}function wc(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var l=o.getValue(),d="";return s&&(d=yc(s)?s.checked?"true":"false":s.value),s=d,s!==l?(o.setValue(s),!0):!1}var dh=/[\n"\\]/g;function Ln(s){return s.replace(dh,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Gs(s,o,l,d,y,j,I,J){s.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.type=I:s.removeAttribute("type"),o!=null?I==="number"?(o===0&&s.value===""||s.value!=o)&&(s.value=""+rs(o)):s.value!==""+rs(o)&&(s.value=""+rs(o)):I!=="submit"&&I!=="reset"||s.removeAttribute("value"),o!=null?I==="number"&&s.value==o?jc(s,rs(s.value)):jc(s,rs(o)):l!=null?jc(s,rs(l)):d!=null&&s.removeAttribute("value"),y==null&&j!=null&&(s.defaultChecked=!!j),y!=null&&(s.checked=y&&typeof y!="function"&&typeof y!="symbol"),J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?s.name=""+rs(J):s.removeAttribute("name")}function ii(s,o,l,d,y,j,I,J){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.type=j),o!=null||l!=null){if(!(j!=="submit"&&j!=="reset"||o!=null)){Sa(s);return}l=l!=null?""+rs(l):"",o=o!=null?""+rs(o):l,J||o===s.value||(s.value=o),s.defaultValue=o}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=J?s.checked:!!d,s.defaultChecked=!!d,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(s.name=I),Sa(s)}function jc(s,o){s.defaultValue!==""+o&&(s.defaultValue=""+o)}function ur(s,o,l,d){if(s=s.options,o){o={};for(var y=0;y<l.length;y++)o["$"+l[y]]=!0;for(l=0;l<s.length;l++)y=o.hasOwnProperty("$"+s[l].value),s[l].selected!==y&&(s[l].selected=y),y&&d&&(s[l].defaultSelected=!0)}else{for(l=""+rs(l),o=null,y=0;y<s.length;y++){if(s[y].value===l){s[y].selected=!0,d&&(s[y].defaultSelected=!0);return}o!==null||s[y].disabled||(o=s[y])}o!==null&&(o.selected=!0)}}function Sc(s,o,l){if(o!=null&&(o=""+rs(o),o!==s.value&&(s.value=o),l==null)){s.defaultValue!==o&&(s.defaultValue=o);return}s.defaultValue=l!=null?""+rs(l):""}function kr(s,o,l,d){if(o==null){if(d!=null){if(l!=null)throw Error(a(92));if(ye(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),o=l}l=rs(o),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),Sa(s)}function Js(s,o){if(o){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=o;return}}s.textContent=o}var li=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Yu(s,o,l){var d=o.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(o,""):o==="float"?s.cssFloat="":s[o]="":d?s.setProperty(o,l):typeof l!="number"||l===0||li.has(o)?o==="float"?s.cssFloat=l:s[o]=(""+l).trim():s[o]=l+"px"}function Tr(s,o,l){if(o!=null&&typeof o!="object")throw Error(a(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||o!=null&&o.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",St=!0);for(var y in o)d=o[y],o.hasOwnProperty(y)&&l[y]!==d&&(Yu(s,y,d),St=!0)}else for(var j in o)o.hasOwnProperty(j)&&Yu(s,j,o[j])}function dl(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ku=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Xu=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ds(s){return Xu.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function er(){}var fl=null;function hl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Zt=null,Ss=null;function Zr(s){var o=ul(s);if(o&&(s=o.stateNode)){var l=s[Os]||null;e:switch(s=o.stateNode,o.type){case"input":if(Gs(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),o=l.name,l.type==="radio"&&o!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ln(""+o)+'"][type="radio"]'),o=0;o<l.length;o++){var d=l[o];if(d!==s&&d.form===s.form){var y=d[Os]||null;if(!y)throw Error(a(90));Gs(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(o=0;o<l.length;o++)d=l[o],d.form===s.form&&wc(d)}break e;case"textarea":Sc(s,l.value,l.defaultValue);break e;case"select":o=l.value,o!=null&&ur(s,!!l.multiple,o,!1)}}}var Er=!1;function ml(s,o,l){if(Er)return s(o,l);Er=!0;try{var d=s(o);return d}finally{if(Er=!1,(Zt!==null||Ss!==null)&&(dm(),Zt&&(o=Zt,s=Ss,Ss=Zt=null,Zr(o),s)))for(o=0;o<s.length;o++)Zr(s[o])}}function Na(s,o){var l=s.stateNode;if(l===null)return null;var d=l[Os]||null;if(d===null)return null;l=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(a(231,o,typeof l));return l}var zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pl=!1;if(zs)try{var Wu={};Object.defineProperty(Wu,"passive",{get:function(){pl=!0}}),window.addEventListener("test",Wu,Wu),window.removeEventListener("test",Wu,Wu)}catch{pl=!1}var ci=null,Bx=null,fh=null;function rj(){if(fh)return fh;var s,o=Bx,l=o.length,d,y="value"in ci?ci.value:ci.textContent,j=y.length;for(s=0;s<l&&o[s]===y[s];s++);var I=l-s;for(d=1;d<=I&&o[l-d]===y[j-d];d++);return fh=y.slice(s,1<d?1-d:void 0)}function hh(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function mh(){return!0}function oj(){return!1}function tr(s){function o(l,d,y,j,I){this._reactName=l,this._targetInst=y,this.type=d,this.nativeEvent=j,this.target=I,this.currentTarget=null;for(var J in s)s.hasOwnProperty(J)&&(l=s[J],this[J]=l?l(j):j[J]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?mh:oj,this.isPropagationStopped=oj,this}return T(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=mh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=mh)},persist:function(){},isPersistent:mh}),o}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ph=tr(ui),Qu=T({},ui,{view:0,detail:0}),nz=tr(Qu),Vx,Ux,Zu,gh=T({},Qu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fx,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Zu&&(Zu&&s.type==="mousemove"?(Vx=s.screenX-Zu.screenX,Ux=s.screenY-Zu.screenY):Ux=Vx=0,Zu=s),Vx)},movementY:function(s){return"movementY"in s?s.movementY:Ux}}),aj=tr(gh),sz=T({},gh,{dataTransfer:0}),rz=tr(sz),oz=T({},Qu,{relatedTarget:0}),Hx=tr(oz),az=T({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),iz=tr(az),lz=T({},ui,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),cz=tr(lz),uz=T({},ui,{data:0}),ij=tr(uz),dz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mz(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=hz[s])?!!o[s]:!1}function Fx(){return mz}var pz=T({},Qu,{key:function(s){if(s.key){var o=dz[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=hh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?fz[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fx,charCode:function(s){return s.type==="keypress"?hh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?hh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),gz=tr(pz),xz=T({},gh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lj=tr(xz),bz=T({},ui,{submitter:0}),vz=tr(bz),yz=T({},Qu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fx}),wz=tr(yz),jz=T({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sz=tr(jz),Nz=T({},gh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Cz=tr(Nz),kz=T({},ui,{newState:0,oldState:0,source:0}),Tz=tr(kz),Ez=[9,13,27,32],Gx=zs&&"CompositionEvent"in window,Ju=null;zs&&"documentMode"in document&&(Ju=document.documentMode);var Rz=zs&&"TextEvent"in window&&!Ju,cj=zs&&(!Gx||Ju&&8<Ju&&11>=Ju),uj=" ",dj=!1;function fj(s,o){switch(s){case"keyup":return Ez.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hj(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Nc=!1;function Az(s,o){switch(s){case"compositionend":return hj(o);case"keypress":return o.which!==32?null:(dj=!0,uj);case"textInput":return s=o.data,s===uj&&dj?null:s;default:return null}}function Mz(s,o){if(Nc)return s==="compositionend"||!Gx&&fj(s,o)?(s=rj(),fh=Bx=ci=null,Nc=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return cj&&o.locale!=="ko"?null:o.data;default:return null}}var Oz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function mj(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!Oz[s.type]:o==="textarea"}function pj(s,o,l,d){Zt?Ss?Ss.push(d):Ss=[d]:Zt=d,o=xm(o,"onChange"),0<o.length&&(l=new ph("onChange","change",null,l,d),s.push({event:l,listeners:o}))}var ed=null,td=null;function Dz(s){nC(s,0)}function xh(s){var o=De(s);if(wc(o))return s}function gj(s,o){if(s==="change")return o}var xj=!1;if(zs){var qx;if(zs){var Yx="oninput"in document;if(!Yx){var bj=document.createElement("div");bj.setAttribute("oninput","return;"),Yx=typeof bj.oninput=="function"}qx=Yx}else qx=!1;xj=qx&&(!document.documentMode||9<document.documentMode)}function vj(){ed&&(ed.detachEvent("onpropertychange",yj),td=ed=null)}function yj(s){if(s.propertyName==="value"&&xh(td)){var o=[];pj(o,td,s,hl(s)),ml(Dz,o)}}function zz(s,o,l){s==="focusin"?(vj(),ed=o,td=l,ed.attachEvent("onpropertychange",yj)):s==="focusout"&&vj()}function Iz(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return xh(td)}function Pz(s,o){if(s==="click")return xh(o)}function _z(s,o){if(s==="input"||s==="change")return xh(o)}function Lz(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Rr=typeof Object.is=="function"?Object.is:Lz;function nd(s,o){if(Rr(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var l=Object.keys(s),d=Object.keys(o);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var y=l[d];if(!Xe.call(o,y)||!Rr(s[y],o[y]))return!1}return!0}function Kx(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function wj(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function jj(s,o){var l=wj(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=o&&d>=o)return{node:l,offset:o-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=wj(l)}}function Sj(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?Sj(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function Nj(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var o=Kx(s.document);o instanceof s.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)s=o.contentWindow;else break;o=Kx(s.document)}return o}function Xx(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}var $z=zs&&"documentMode"in document&&11>=document.documentMode,Cc=null,Wx=null,sd=null,Qx=!1;function Cj(s,o,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Qx||Cc==null||Cc!==Kx(d)||(d=Cc,"selectionStart"in d&&Xx(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),sd&&nd(sd,d)||(sd=d,d=xm(Wx,"onSelect"),0<d.length&&(o=new ph("onSelect","select",null,o,l),s.push({event:o,listeners:d}),o.target=Cc)))}function gl(s,o){var l={};return l[s.toLowerCase()]=o.toLowerCase(),l["Webkit"+s]="webkit"+o,l["Moz"+s]="moz"+o,l}var kc={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionrun:gl("Transition","TransitionRun"),transitionstart:gl("Transition","TransitionStart"),transitioncancel:gl("Transition","TransitionCancel"),transitionend:gl("Transition","TransitionEnd")},Zx={},kj={};zs&&(kj=document.createElement("div").style,"AnimationEvent"in window||(delete kc.animationend.animation,delete kc.animationiteration.animation,delete kc.animationstart.animation),"TransitionEvent"in window||delete kc.transitionend.transition);function xl(s){if(Zx[s])return Zx[s];if(!kc[s])return s;var o=kc[s],l;for(l in o)if(o.hasOwnProperty(l)&&l in kj)return Zx[s]=o[l];return s}var Tj=xl("animationend"),Ej=xl("animationiteration"),Rj=xl("animationstart"),Bz=xl("transitionrun"),Vz=xl("transitionstart"),Uz=xl("transitioncancel"),Aj=xl("transitionend"),Mj=new Map,Jx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Jx.push("scrollEnd");function No(s,o){Mj.set(s,o),Bt(o,[s])}var Hz=0;function Ca(s,o){if(s.name!=null&&s.name!=="auto")return s.name;if(o.autoName!==null)return o.autoName;s=Eo.identifierPrefix;var l=Hz++;return s="_"+s+"t_"+l.toString(32)+"_",o.autoName=s}function Oj(s){if(s==null||typeof s=="string")return s;var o=null,l=qc;if(l!==null)for(var d=0;d<l.length;d++){var y=s[l[d]];if(y!=null){if(y==="none")return"none";o=o==null?y:o+(" "+y)}}return o??s.default}function ka(s,o){return s=Oj(s),o=Oj(o),o==null?s==="auto"?null:s:o==="auto"?null:o}var bh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Jr=[],Tc=0,eb=0;function vh(){for(var s=Tc,o=eb=Tc=0;o<s;){var l=Jr[o];Jr[o++]=null;var d=Jr[o];Jr[o++]=null;var y=Jr[o];Jr[o++]=null;var j=Jr[o];if(Jr[o++]=null,d!==null&&y!==null){var I=d.pending;I===null?y.next=y:(y.next=I.next,I.next=y),d.pending=y}j!==0&&Dj(l,y,j)}}function yh(s,o,l,d){Jr[Tc++]=s,Jr[Tc++]=o,Jr[Tc++]=l,Jr[Tc++]=d,eb|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function tb(s,o,l,d){return yh(s,o,l,d),wh(s)}function bl(s,o){return yh(s,null,null,o),wh(s)}function Dj(s,o,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var y=!1,j=s.return;j!==null;)j.childLanes|=l,d=j.alternate,d!==null&&(d.childLanes|=l),j.tag===22&&(s=j.stateNode,s===null||s._visibility&1||(y=!0)),s=j,j=j.return;return s.tag===3?(j=s.stateNode,y&&o!==null&&(y=31-it(l),s=j.hiddenUpdates,d=s[y],d===null?s[y]=[o]:d.push(o),o.lane=l|536870912),j):null}function wh(s){if(50<Cd)throw Cd=0,um=null,Error(a(185));for(var o=s.return;o!==null;)s=o,o=s.return;return s.tag===3?s.stateNode:null}var Ec={};function Fz(s,o,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dr(s,o,l,d){return new Fz(s,o,l,d)}function nb(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ta(s,o){var l=s.alternate;return l===null?(l=dr(s.tag,o,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=o,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&1206910976,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,o=s.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function zj(s,o){s.flags&=1206910978;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=o,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,o=l.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),s}function jh(s,o,l,d,y,j){var I=0;if(d=s,typeof d=="function")nb(d)&&(I=1);else if(typeof d=="string")I=bP(s,l,je.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case L:return s=dr(31,l,o,y),s.elementType=L,s.lanes=j,s;case F:return vl(l.children,y,j,o);case K:I=8,y|=24;break;case $:return s=dr(12,l,o,y|2),s.elementType=$,s.lanes=j,s;case W:return s=dr(13,l,o,y),s.elementType=W,s.lanes=j,s;case q:return s=dr(19,l,o,y),s.elementType=q,s.lanes=j,s;case X:case _:return s=y|32,s=dr(30,l,o,s),s.elementType=_,s.lanes=j,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case U:I=10;break e;case P:I=9;break e;case H:I=11;break e;case Z:I=14;break e;case z:I=16,d=null;break e}I=29,l=Error(a(130,s===null?"null":typeof s,"")),d=null}return o=dr(I,l,o,y),o.elementType=s,o.type=d,o.lanes=j,o}function vl(s,o,l,d){return s=dr(7,s,d,o),s.lanes=l,s}function sb(s,o,l){return s=dr(6,s,null,o),s.lanes=l,s}function Ij(s){var o=dr(18,null,null,0);return o.stateNode=s,o}function rb(s,o,l){return o=dr(4,s.children!==null?s.children:[],s.key,o),o.lanes=l,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}var Pj=new WeakMap;function eo(s,o){if(typeof s=="object"&&s!==null){var l=Pj.get(s);return l!==void 0?l:(o={value:s,source:o,stack:_e(o)},Pj.set(s,o),o)}return{value:s,source:o,stack:_e(o)}}var Rc=[],Ac=0,Sh=null,rd=0,to=[],no=0,di=null,Vo=1,Uo="";function Ea(s,o){Rc[Ac++]=rd,Rc[Ac++]=Sh,Sh=s,rd=o}function _j(s,o,l){to[no++]=Vo,to[no++]=Uo,to[no++]=di,di=s;var d=Vo;s=Uo;var y=32-it(d)-1;d&=~(1<<y),l+=1;var j=32-it(o)+y;if(30<j){var I=y-y%5;j=(d&(1<<I)-1).toString(32),d>>=I,y-=I,Vo=1<<32-it(o)+y|l<<y|d,Uo=j+s}else Vo=1<<j|l<<y|d,Uo=s}function Nh(s){s.return!==null&&(Ea(s,1),_j(s,1,0))}function ob(s){for(;s===Sh;)Sh=Rc[--Ac],Rc[Ac]=null,rd=Rc[--Ac],Rc[Ac]=null;for(;s===di;)di=to[--no],to[no]=null,Uo=to[--no],to[no]=null,Vo=to[--no],to[no]=null}function Lj(s,o){to[no++]=Vo,to[no++]=Uo,to[no++]=di,Vo=o.id,Uo=o.overflow,di=s}var Ns=null,Mn=null,Vt=!1,fi=null,so=!1,ab=Error(a(519));function hi(s){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw od(eo(o,s)),ab}function $j(s){var o=s.stateNode,l=s.type,d=s.memoizedProps;switch(o[Un]=s,o[Os]=d,l){case"dialog":Yt("cancel",o),Yt("close",o);break;case"iframe":case"object":case"embed":Yt("load",o);break;case"video":case"audio":for(l=0;l<Td.length;l++)Yt(Td[l],o);break;case"source":Yt("error",o);break;case"img":case"image":case"link":Yt("error",o),Yt("load",o);break;case"details":Yt("toggle",o);break;case"input":Yt("invalid",o),ii(o,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Yt("invalid",o);break;case"textarea":Yt("invalid",o),kr(o,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||o.textContent===""+l||d.suppressHydrationWarning===!0||aC(o.textContent,l)?(d.popover!=null&&(Yt("beforetoggle",o),Yt("toggle",o)),d.onScroll!=null&&Yt("scroll",o),d.onScrollEnd!=null&&Yt("scrollend",o),d.onClick!=null&&(o.onclick=er),o=!0):o=!1,o||hi(s,!0)}function Ch(s){for(Ns=s.return;Ns;)switch(Ns.tag){case 5:case 31:case 13:so=!1;return;case 27:case 3:so=!0;return;default:Ns=Ns.return}}function Mc(s){if(s!==Ns)return!1;if(!Vt)return Ch(s),Vt=!0,!1;var o=s.tag,l;if((l=o!==3&&o!==27)&&((l=o===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||P0(s.type,s.memoizedProps)),l=!l),l&&Mn&&hi(s),Ch(s),o===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Mn=CC(s)}else if(o===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Mn=CC(s)}else o===27?(o=Mn,Ri(s.type)?(s=G0,G0=null,Mn=s):Mn=o):Mn=Ns?oo(s.stateNode.nextSibling):null;return!0}function yl(){Mn=Ns=null,Vt=!1}function ib(){var s=fi;return s!==null&&(mr===null?mr=s:mr.push.apply(mr,s),fi=null),s}function od(s){fi===null?fi=[s]:fi.push(s)}var lb=oe(null),wl=null,Ra=null;function mi(s,o,l){xe(lb,o._currentValue),o._currentValue=l}function Aa(s){s._currentValue=lb.current,pe(lb)}function kh(s,o,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),s===l)break;s=s.return}}function cb(s,o,l,d){var y=s.child;for(y!==null&&(y.return=s);y!==null;){var j=y.dependencies;if(j!==null){var I=y.child;j=j.firstContext;e:for(;j!==null;){var J=j;j=y;for(var me=0;me<o.length;me++)if(J.context===o[me]){j.lanes|=l,J=j.alternate,J!==null&&(J.lanes|=l),kh(j.return,l,s),d||(I=null);break e}j=J.next}}else if(y.tag===18){if(I=y.return,I===null)throw Error(a(341));I.lanes|=l,j=I.alternate,j!==null&&(j.lanes|=l),kh(I,l,s),I=null}else y.tag===13&&y.memoizedState!==null&&y.memoizedState.dehydrated===null?(y.lanes|=l,I=y.alternate,I!==null&&(I.lanes|=l),kh(y.return,l,s),I=y.child,I=I!==null?I.sibling:null):I=y.child;if(I!==null)I.return=y;else for(I=y;I!==null;){if(I===s){I=null;break}if(y=I.sibling,y!==null){y.return=I.return,I=y;break}I=I.return}y=I}}function jl(s,o,l,d){s=null;for(var y=o,j=!1;y!==null;){if(!j){if((y.flags&524288)!==0)j=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var I=y.alternate;if(I===null)throw Error(a(387));if(I=I.memoizedProps,I!==null){var J=y.type;Rr(y.pendingProps.value,I.value)||(s!==null?s.push(J):s=[J])}}else if(y===Te.current){if(I=y.alternate,I===null)throw Error(a(387));I.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(s!==null?s.push(nu):s=[nu])}y=y.return}return s!==null&&cb(o,s,l,d),o.flags|=262144,s!==null}function Th(s){for(s=s.firstContext;s!==null;){if(!Rr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Sl(s){wl=s,Ra=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Is(s){return Bj(wl,s)}function Eh(s,o){return wl===null&&Sl(s),Bj(s,o)}function Bj(s,o){var l=o._currentValue;if(o={context:o,memoizedValue:l,next:null},Ra===null){if(s===null)throw Error(a(308));Ra=o,s.dependencies={lanes:0,firstContext:o},s.flags|=524288}else Ra=Ra.next=o;return l}var Gz=typeof AbortController<"u"?AbortController:function(){var s=[],o=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){o.aborted=!0,s.forEach(function(l){return l()})}},qz=e.unstable_scheduleCallback,Yz=e.unstable_NormalPriority,os={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ub(){return{controller:new Gz,data:new Map,refCount:0}}function ad(s){s.refCount--,s.refCount===0&&qz(Yz,function(){s.controller.abort()})}function Vj(s,o){if((s.pendingLanes&4194048)!==0){var l=s.transitionTypes;for(l===null&&(l=s.transitionTypes=[]),s=0;s<o.length;s++){var d=o[s];l.indexOf(d)===-1&&l.push(d)}}}var id=null;function Kz(s){var o=s.transitionTypes;return s.transitionTypes=null,o}var ld=null,db=0,Nl=0,Oc=null;function Xz(s,o){if(ld===null){var l=ld=[];db=0,Nl=T0(),Oc={status:"pending",value:void 0,then:function(d){l.push(d)}}}return db++,o.then(Uj,Uj),o}function Uj(){if(--db===0&&(id=null,ld!==null)){Oc!==null&&(Oc.status="fulfilled");var s=ld;ld=null,Nl=0,Oc=null;for(var o=0;o<s.length;o++)(0,s[o])()}}function Wz(s,o){var l=[],d={status:"pending",value:null,reason:null,then:function(y){l.push(y)}};return s.then(function(){d.status="fulfilled",d.value=o;for(var y=0;y<l.length;y++)(0,l[y])(o)},function(y){for(d.status="rejected",d.reason=y,y=0;y<l.length;y++)(0,l[y])(void 0)}),d}var Hj=ae.S;ae.S=function(s,o){if(IN=ve(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&Xz(s,o),id!==null)for(var l=Wc;l!==null;)Vj(l,id),l=l.next;if(l=s.types,l!==null){for(var d=Wc;d!==null;)Vj(d,l),d=d.next;if(Nl!==0){d=id,d===null&&(d=id=[]);for(var y=0;y<l.length;y++){var j=l[y];d.indexOf(j)===-1&&d.push(j)}}}Hj!==null&&Hj(s,o)};var Cl=oe(null);function fb(){var s=Cl.current;return s!==null?s:An.pooledCache}function Rh(s,o){o===null?xe(Cl,Cl.current):xe(Cl,o.pool)}function Fj(){var s=fb();return s===null?null:{parent:os._currentValue,pool:s}}var Dc=Error(a(460)),hb=Error(a(474)),Ah=Error(a(542)),Mh={then:function(){}};function Gj(s){return s=s.status,s==="fulfilled"||s==="rejected"}function qj(s,o,l){switch(l=s[l],l===void 0?s.push(o):l!==o&&(o.then(er,er),o=l),o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,Kj(s),s===void 0&&!("reason"in o)?Error(a(600)):s;default:if(typeof o.status=="string")o.then(er,er);else{if(s=An,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=o,s.status="pending",s.then(function(d){if(o.status==="pending"){var y=o;y.status="fulfilled",y.value=d}},function(d){if(o.status==="pending"){var y=o;y.status="rejected",y.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,Kj(s),s}throw Tl=o,Dc}}function kl(s){try{var o=s._init;return o(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Tl=l,Dc):l}}var Tl=null;function Yj(){if(Tl===null)throw Error(a(459));var s=Tl;return Tl=null,s}function Kj(s){if(s===Dc||s===Ah)throw Error(a(483))}var zc=null,cd=0;function Oh(s){var o=cd;return cd+=1,zc===null&&(zc=[]),qj(zc,s,o)}function pi(s,o){o=o.props.ref,s.ref=o!==void 0?o:null}function Dh(s,o){throw o.$$typeof===O?Error(a(525)):(s=Object.prototype.toString.call(o),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s)))}function Xj(s){function o(Ne,be){if(s){var Ee=Ne.deletions;Ee===null?(Ne.deletions=[be],Ne.flags|=16):Ee.push(be)}}function l(Ne,be){if(!s)return null;for(;be!==null;)o(Ne,be),be=be.sibling;return null}function d(Ne){for(var be=new Map;Ne!==null;)Ne.key===null?be.set(Ne.index,Ne):be.set(Ne.key,Ne),Ne=Ne.sibling;return be}function y(Ne,be){return Ne=Ta(Ne,be),Ne.index=0,Ne.sibling=null,Ne}function j(Ne,be,Ee){return Ne.index=Ee,s?(Ee=Ne.alternate,Ee!==null?(Ee=Ee.index,Ee<be?(Ne.flags|=2,be):Ee):(Ne.flags|=134217730,be)):(Ne.flags|=1048576,be)}function I(Ne){return s&&Ne.alternate===null&&(Ne.flags|=134217730),Ne}function J(Ne,be,Ee,Le){return be===null||be.tag!==6?(be=sb(Ee,Ne.mode,Le),be.return=Ne,be):(be=y(be,Ee),be.return=Ne,be)}function me(Ne,be,Ee,Le){var ut=Ee.type;return ut===F?(Ne=ze(Ne,be,Ee.props.children,Le,Ee.key),pi(Ne,Ee),Ne):be!==null&&(be.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===be.type)?(be=y(be,Ee.props),pi(be,Ee),be.return=Ne,be):(be=jh(Ee.type,Ee.key,Ee.props,null,Ne.mode,Le),pi(be,Ee),be.return=Ne,be)}function Ce(Ne,be,Ee,Le){return be===null||be.tag!==4||be.stateNode.containerInfo!==Ee.containerInfo||be.stateNode.implementation!==Ee.implementation?(be=rb(Ee,Ne.mode,Le),be.return=Ne,be):(be=y(be,Ee.children||[]),be.return=Ne,be)}function ze(Ne,be,Ee,Le,ut){return be===null||be.tag!==7?(be=vl(Ee,Ne.mode,Le,ut),be.return=Ne,be):(be=y(be,Ee),be.return=Ne,be)}function $e(Ne,be,Ee){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return be=sb(""+be,Ne.mode,Ee),be.return=Ne,be;if(typeof be=="object"&&be!==null){switch(be.$$typeof){case D:return Ee=jh(be.type,be.key,be.props,null,Ne.mode,Ee),pi(Ee,be),Ee.return=Ne,Ee;case B:return be=rb(be,Ne.mode,Ee),be.return=Ne,be;case z:return be=kl(be),$e(Ne,be,Ee)}if(ye(be)||Y(be))return be=vl(be,Ne.mode,Ee,null),be.return=Ne,be;if(typeof be.then=="function")return $e(Ne,Oh(be),Ee);if(be.$$typeof===U)return $e(Ne,Eh(Ne,be),Ee);Dh(Ne,be)}return null}function we(Ne,be,Ee,Le){var ut=be!==null?be.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return ut!==null?null:J(Ne,be,""+Ee,Le);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:return Ee.key===ut?me(Ne,be,Ee,Le):null;case B:return Ee.key===ut?Ce(Ne,be,Ee,Le):null;case z:return Ee=kl(Ee),we(Ne,be,Ee,Le)}if(ye(Ee)||Y(Ee))return ut!==null?null:ze(Ne,be,Ee,Le,null);if(typeof Ee.then=="function")return we(Ne,be,Oh(Ee),Le);if(Ee.$$typeof===U)return we(Ne,be,Eh(Ne,Ee),Le);Dh(Ne,Ee)}return null}function Me(Ne,be,Ee,Le,ut){if(typeof Le=="string"&&Le!==""||typeof Le=="number"||typeof Le=="bigint")return Ne=Ne.get(Ee)||null,J(be,Ne,""+Le,ut);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case D:return Ne=Ne.get(Le.key===null?Ee:Le.key)||null,me(be,Ne,Le,ut);case B:return Ne=Ne.get(Le.key===null?Ee:Le.key)||null,Ce(be,Ne,Le,ut);case z:return Le=kl(Le),Me(Ne,be,Ee,Le,ut)}if(ye(Le)||Y(Le))return Ne=Ne.get(Ee)||null,ze(be,Ne,Le,ut,null);if(typeof Le.then=="function")return Me(Ne,be,Ee,Oh(Le),ut);if(Le.$$typeof===U)return Me(Ne,be,Ee,Eh(be,Le),ut);Dh(be,Le)}return null}function ot(Ne,be,Ee,Le){for(var ut=null,Xt=null,vt=be,Rt=be=0,ls=null;vt!==null&&Rt<Ee.length;Rt++){vt.index>Rt?(ls=vt,vt=null):ls=vt.sibling;var Jt=we(Ne,vt,Ee[Rt],Le);if(Jt===null){vt===null&&(vt=ls);break}s&&vt&&Jt.alternate===null&&o(Ne,vt),be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt,vt=ls}if(Rt===Ee.length)return l(Ne,vt),Vt&&Ea(Ne,Rt),ut;if(vt===null){for(;Rt<Ee.length;Rt++)vt=$e(Ne,Ee[Rt],Le),vt!==null&&(be=j(vt,be,Rt),Xt===null?ut=vt:Xt.sibling=vt,Xt=vt);return Vt&&Ea(Ne,Rt),ut}for(vt=d(vt);Rt<Ee.length;Rt++)ls=Me(vt,Ne,Rt,Ee[Rt],Le),ls!==null&&(s&&(Jt=ls.alternate,Jt!==null&&vt.delete(Jt.key===null?Rt:Jt.key)),be=j(ls,be,Rt),Xt===null?ut=ls:Xt.sibling=ls,Xt=ls);return s&&vt.forEach(function(zi){return o(Ne,zi)}),Vt&&Ea(Ne,Rt),ut}function mt(Ne,be,Ee,Le){if(Ee==null)throw Error(a(151));for(var ut=null,Xt=null,vt=be,Rt=be=0,ls=null,Jt=Ee.next();vt!==null&&!Jt.done;Rt++,Jt=Ee.next()){vt.index>Rt?(ls=vt,vt=null):ls=vt.sibling;var zi=we(Ne,vt,Jt.value,Le);if(zi===null){vt===null&&(vt=ls);break}s&&vt&&zi.alternate===null&&o(Ne,vt),be=j(zi,be,Rt),Xt===null?ut=zi:Xt.sibling=zi,Xt=zi,vt=ls}if(Jt.done)return l(Ne,vt),Vt&&Ea(Ne,Rt),ut;if(vt===null){for(;!Jt.done;Rt++,Jt=Ee.next())Jt=$e(Ne,Jt.value,Le),Jt!==null&&(be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return Vt&&Ea(Ne,Rt),ut}for(vt=d(vt);!Jt.done;Rt++,Jt=Ee.next())Jt=Me(vt,Ne,Rt,Jt.value,Le),Jt!==null&&(s&&(ls=Jt.alternate,ls!==null&&vt.delete(ls.key===null?Rt:ls.key)),be=j(Jt,be,Rt),Xt===null?ut=Jt:Xt.sibling=Jt,Xt=Jt);return s&&vt.forEach(function(AP){return o(Ne,AP)}),Vt&&Ea(Ne,Rt),ut}function Lt(Ne,be,Ee,Le){if(typeof Ee=="object"&&Ee!==null&&Ee.type===F&&Ee.key===null&&Ee.props.ref===void 0&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:e:{for(var ut=Ee.key;be!==null;){if(be.key===ut){if(ut=Ee.type,ut===F){if(be.tag===7){l(Ne,be.sibling),Le=y(be,Ee.props.children),pi(Le,Ee),Le.return=Ne,Ne=Le;break e}}else if(be.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===z&&kl(ut)===be.type){l(Ne,be.sibling),Le=y(be,Ee.props),pi(Le,Ee),Le.return=Ne,Ne=Le;break e}l(Ne,be);break}else o(Ne,be);be=be.sibling}Ee.type===F?(Le=vl(Ee.props.children,Ne.mode,Le,Ee.key),pi(Le,Ee),Le.return=Ne,Ne=Le):(Le=jh(Ee.type,Ee.key,Ee.props,null,Ne.mode,Le),pi(Le,Ee),Le.return=Ne,Ne=Le)}return I(Ne);case B:e:{for(ut=Ee.key;be!==null;){if(be.key===ut)if(be.tag===4&&be.stateNode.containerInfo===Ee.containerInfo&&be.stateNode.implementation===Ee.implementation){l(Ne,be.sibling),Le=y(be,Ee.children||[]),Le.return=Ne,Ne=Le;break e}else{l(Ne,be);break}else o(Ne,be);be=be.sibling}Le=rb(Ee,Ne.mode,Le),Le.return=Ne,Ne=Le}return I(Ne);case z:return Ee=kl(Ee),Lt(Ne,be,Ee,Le)}if(ye(Ee))return ot(Ne,be,Ee,Le);if(Y(Ee)){if(ut=Y(Ee),typeof ut!="function")throw Error(a(150));return Ee=ut.call(Ee),mt(Ne,be,Ee,Le)}if(typeof Ee.then=="function")return Lt(Ne,be,Oh(Ee),Le);if(Ee.$$typeof===U)return Lt(Ne,be,Eh(Ne,Ee),Le);Dh(Ne,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint"?(Ee=""+Ee,be!==null&&be.tag===6?(l(Ne,be.sibling),Le=y(be,Ee),Le.return=Ne,Ne=Le):(l(Ne,be),Le=sb(Ee,Ne.mode,Le),Le.return=Ne,Ne=Le),I(Ne)):l(Ne,be)}return function(Ne,be,Ee,Le){try{cd=0;var ut=Lt(Ne,be,Ee,Le);return zc=null,ut}catch(vt){if(vt===Dc||vt===Ah)throw vt;var Xt=dr(29,vt,null,Ne.mode);return Xt.lanes=Le,Xt.return=Ne,Xt}finally{}}}var El=Xj(!0),Wj=Xj(!1),gi=!1;function mb(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pb(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function xi(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function bi(s,o,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(dn&2)!==0){var y=d.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),d.pending=o,o=wh(s),Dj(s,null,l),o}return yh(s,d,o,l),wh(s)}function ud(s,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194048)!==0)){var d=o.lanes;d&=s.pendingLanes,l|=d,o.lanes=l,wo(s,l)}}function gb(s,o){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var y=null,j=null;if(l=l.firstBaseUpdate,l!==null){do{var I={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};j===null?y=j=I:j=j.next=I,l=l.next}while(l!==null);j===null?y=j=o:j=j.next=o}else y=j=o;l={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:j,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=o:s.next=o,l.lastBaseUpdate=o}var xb=!1;function dd(){if(xb){var s=Oc;if(s!==null)throw s}}function fd(s,o,l,d){xb=!1;var y=s.updateQueue;gi=!1;var j=y.firstBaseUpdate,I=y.lastBaseUpdate,J=y.shared.pending;if(J!==null){y.shared.pending=null;var me=J,Ce=me.next;me.next=null,I===null?j=Ce:I.next=Ce,I=me;var ze=s.alternate;ze!==null&&(ze=ze.updateQueue,J=ze.lastBaseUpdate,J!==I&&(J===null?ze.firstBaseUpdate=Ce:J.next=Ce,ze.lastBaseUpdate=me))}if(j!==null){var $e=y.baseState;I=0,ze=Ce=me=null,J=j;do{var we=J.lane&-536870913,Me=we!==J.lane;if(Me?(Kt&we)===we:(d&we)===we){we!==0&&we===Nl&&(xb=!0),ze!==null&&(ze=ze.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var ot=s,mt=J;we=o;var Lt=l;switch(mt.tag){case 1:if(ot=mt.payload,typeof ot=="function"){$e=ot.call(Lt,$e,we);break e}$e=ot;break e;case 3:ot.flags=ot.flags&-65537|128;case 0:if(ot=mt.payload,we=typeof ot=="function"?ot.call(Lt,$e,we):ot,we==null)break e;$e=T({},$e,we);break e;case 2:gi=!0}}we=J.callback,we!==null&&(s.flags|=64,Me&&(s.flags|=8192),Me=y.callbacks,Me===null?y.callbacks=[we]:Me.push(we))}else Me={lane:we,tag:J.tag,payload:J.payload,callback:J.callback,next:null},ze===null?(Ce=ze=Me,me=$e):ze=ze.next=Me,I|=we;if(J=J.next,J===null){if(J=y.shared.pending,J===null)break;Me=J,J=Me.next,Me.next=null,y.lastBaseUpdate=Me,y.shared.pending=null}}while(!0);ze===null&&(me=$e),y.baseState=me,y.firstBaseUpdate=Ce,y.lastBaseUpdate=ze,j===null&&(y.shared.lanes=0),Ci|=I,s.lanes=I,s.memoizedState=$e}}function Qj(s,o){if(typeof s!="function")throw Error(a(191,s));s.call(o)}function Zj(s,o){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)Qj(l[s],o)}var vi=oe(null),zh=oe(0);function Jj(s,o){s=Ia,xe(zh,s),xe(vi,o),Ia=s|o.baseLanes}function bb(){xe(zh,Ia),xe(vi,vi.current)}function vb(){Ia=zh.current,pe(vi),pe(zh)}var Ps=oe(null),qs=null;function yi(s){var o=s.alternate;xe(_s,_s.current&1),xe(Ps,s),qs===null&&(o===null||vi.current!==null||o.memoizedState!==null)&&(qs=s)}function yb(s){xe(_s,_s.current),xe(Ps,s),qs===null&&(qs=s)}function eS(s){s.tag===22?(xe(_s,_s.current),xe(Ps,s),qs===null&&(qs=s)):wi()}function wi(){xe(_s,_s.current),xe(Ps,Ps.current)}function Ar(s){pe(Ps),qs===s&&(qs=null),pe(_s)}var _s=oe(0);function hd(s,o){xe(Ps,Ps.current),xe(_s,o)}function wb(s){pe(_s),pe(Ps),qs===s&&(qs=null)}function Ih(s){for(var o=s;o!==null;){if(o.tag===13){var l=o.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||H0(l)||F0(l)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!=="independent"){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Ma=0,_t=null,Cn=null,as=null,Ph=!1,Ic=!1,Rl=!1,_h=0,md=0,Pc=null,Qz=0;function Xn(){throw Error(a(321))}function jb(s,o){if(o===null)return!1;for(var l=0;l<o.length&&l<s.length;l++)if(!Rr(s[l],o[l]))return!1;return!0}function Sb(s,o,l,d,y,j){return Ma=j,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ae.H=s===null||s.memoizedState===null?_S:LS,Rl=!1,j=l(d,y),Rl=!1,Ic&&(j=nS(o,l,d,y)),tS(s),j}function tS(s){ae.H=Fh;var o=Cn!==null&&Cn.next!==null;if(Ma=0,as=Cn=_t=null,Ph=!1,md=0,Pc=null,o)throw Error(a(300));s===null||is||(s=s.dependencies,s!==null&&Th(s)&&(is=!0))}function nS(s,o,l,d){_t=s;var y=0;do{if(Ic&&(Pc=null),md=0,Ic=!1,25<=y)throw Error(a(301));if(y+=1,as=Cn=null,s.updateQueue!=null){var j=s.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}ae.H=oI,j=o(l,d)}while(Ic);return j}function Zz(){var s=ae.H,o=s.useState()[0];return o=typeof o.then=="function"?pd(o):o,s=s.useState()[0],(Cn!==null?Cn.memoizedState:null)!==s&&(_t.flags|=1024),o}function Nb(){var s=_h!==0;return _h=0,s}function Cb(s,o,l){o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~l}function kb(s){if(Ph){for(s=s.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}Ph=!1}Ma=0,as=Cn=_t=null,Ic=!1,md=_h=0,Pc=null}function nr(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return as===null?_t.memoizedState=as=s:as=as.next=s,as}function es(){if(Cn===null){var s=_t.alternate;s=s!==null?s.memoizedState:null}else s=Cn.next;var o=as===null?_t.memoizedState:as.next;if(o!==null)as=o,Cn=s;else{if(s===null)throw _t.alternate===null?Error(a(467)):Error(a(310));Cn=s,s={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},as===null?_t.memoizedState=as=s:as=as.next=s}return as}function Lh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pd(s){var o=md;return md+=1,Pc===null&&(Pc=[]),s=qj(Pc,s,o),o=_t,(as===null?o.memoizedState:as.next)===null&&(o=o.alternate,ae.H=o===null||o.memoizedState===null?_S:LS),s}function $h(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return pd(s);if(s.$$typeof===V)return;if(s.$$typeof===U)return Is(s)}throw Error(a(438,String(s)))}function Tb(s){var o=null,l=_t.updateQueue;if(l!==null&&(o=l.memoCache),o==null){var d=_t.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(y){return y.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),l===null&&(l=Lh(),_t.updateQueue=l),l.memoCache=o,l=o.data[o.index],l===void 0)for(l=o.data[o.index]=Array(s),d=0;d<s;d++)l[d]=ee;return o.index++,l}function Oa(s,o){return typeof o=="function"?o(s):o}function Bh(s){var o=es();return Eb(o,Cn,s)}function Eb(s,o,l){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var y=s.baseQueue,j=d.pending;if(j!==null){if(y!==null){var I=y.next;y.next=j.next,j.next=I}o.baseQueue=y=j,d.pending=null}if(j=s.baseState,y===null)s.memoizedState=j;else{o=y.next;var J=I=null,me=null,Ce=o,ze=!1;do{var $e=Ce.lane&-536870913;if($e!==Ce.lane?(Kt&$e)===$e:(Ma&$e)===$e){var we=Ce.revertLane;if(we===0)me!==null&&(me=me.next={lane:0,revertLane:0,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null}),$e===Nl&&(ze=!0);else if((Ma&we)===we){Ce=Ce.next,we===Nl&&(ze=!0);continue}else $e={lane:0,revertLane:Ce.revertLane,gesture:null,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(J=me=$e,I=j):me=me.next=$e,_t.lanes|=we,Ci|=we;$e=Ce.action,Rl&&l(j,$e),j=Ce.hasEagerState?Ce.eagerState:l(j,$e)}else we={lane:$e,revertLane:Ce.revertLane,gesture:Ce.gesture,action:Ce.action,hasEagerState:Ce.hasEagerState,eagerState:Ce.eagerState,next:null},me===null?(J=me=we,I=j):me=me.next=we,_t.lanes|=$e,Ci|=$e;Ce=Ce.next}while(Ce!==null&&Ce!==o);if(me===null?I=j:me.next=J,!Rr(j,s.memoizedState)&&(is=!0,ze&&(l=Oc,l!==null)))throw l;s.memoizedState=j,s.baseState=I,s.baseQueue=me,d.lastRenderedState=j}return y===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Rb(s){var o=es(),l=o.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=s;var d=l.dispatch,y=l.pending,j=o.memoizedState;if(y!==null){l.pending=null;var I=y=y.next;do j=s(j,I.action),I=I.next;while(I!==y);Rr(j,o.memoizedState)||(is=!0),o.memoizedState=j,o.baseQueue===null&&(o.baseState=j),l.lastRenderedState=j}return[j,d]}function sS(s,o,l){var d=_t,y=es(),j=Vt;if(j){if(l===void 0)throw Error(a(407));l=l()}else l=o();var I=!Rr((Cn||y).memoizedState,l);if(I&&(y.memoizedState=l,is=!0),y=y.queue,Ob(aS.bind(null,d,y,s),[s]),s=y.getSnapshot!==o||I||as!==null&&(as.memoizedState.tag&1)!==0,_c(s?9:8,{destroy:void 0},oS.bind(null,d,y,l,o),null),s){if(d.flags|=2048,An===null)throw Error(a(349));j||(Ma&127)!==0||rS(d,o,l)}return l}function rS(s,o,l){s.flags|=16384,s={getSnapshot:o,value:l},o=_t.updateQueue,o===null?(o=Lh(),_t.updateQueue=o,o.stores=[s]):(l=o.stores,l===null?o.stores=[s]:l.push(s))}function oS(s,o,l,d){o.value=l,o.getSnapshot=d,iS(o)&&lS(s)}function aS(s,o,l){return l(function(){iS(o)&&lS(s)})}function iS(s){var o=s.getSnapshot;s=s.value;try{var l=o();return!Rr(s,l)}catch{return!0}}function lS(s){var o=bl(s,2);o!==null&&pr(o,s,2)}function Ab(s){var o=nr();if(typeof s=="function"){var l=s;if(s=l(),Rl){et(!0);try{l()}finally{et(!1)}}}return o.memoizedState=o.baseState=s,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oa,lastRenderedState:s},o}function cS(s,o,l,d){return s.baseState=l,Eb(s,Cn,typeof d=="function"?d:Oa)}function Jz(s,o,l,d,y){if(Hh(s))throw Error(a(485));if(s=o.action,s!==null){var j={payload:y,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){j.listeners.push(I)}};ae.T!==null?l(!0):j.isTransition=!1,d(j),l=o.pending,l===null?(j.next=o.pending=j,uS(o,j)):(j.next=l.next,o.pending=l.next=j)}}function uS(s,o){var l=o.action,d=o.payload,y=s.state;if(o.isTransition){var j=ae.T,I={};I.types=j!==null?j.types:null,ae.T=I;try{var J=l(y,d),me=ae.S;me!==null&&me(I,J),dS(s,o,J)}catch(Ce){Mb(s,o,Ce)}finally{j!==null&&I.types!==null&&(j.types=I.types),ae.T=j}}else try{j=l(y,d),dS(s,o,j)}catch(Ce){Mb(s,o,Ce)}}function dS(s,o,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){fS(s,o,d)},function(d){return Mb(s,o,d)}):fS(s,o,l)}function fS(s,o,l){o.status="fulfilled",o.value=l,hS(o),s.state=l,o=s.pending,o!==null&&(l=o.next,l===o?s.pending=null:(l=l.next,o.next=l,uS(s,l)))}function Mb(s,o,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=l,hS(o),o=o.next;while(o!==d)}s.action=null}function hS(s){s=s.listeners;for(var o=0;o<s.length;o++)(0,s[o])()}function mS(s,o){return o}function pS(s,o){if(Vt){var l=An.formState;if(l!==null){e:{var d=_t;if(Vt){if(Mn){t:{for(var y=Mn,j=so;y.nodeType!==8;){if(!j){y=null;break t}if(y=oo(y.nextSibling),y===null){y=null;break t}}j=y.data,y=j==="F!"||j==="F"?y:null}if(y){Mn=oo(y.nextSibling),d=y.data==="F!";break e}}hi(d)}d=!1}d&&(o=l[0])}}return l=nr(),l.memoizedState=l.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mS,lastRenderedState:o},l.queue=d,l=zS.bind(null,_t,d),d.dispatch=l,d=Ab(!1),j=_b.bind(null,_t,!1,d.queue),d=nr(),y={state:o,dispatch:null,action:s,pending:null},d.queue=y,l=Jz.bind(null,_t,y,j,l),y.dispatch=l,d.memoizedState=s,[o,l,!1]}function gS(s){var o=es();return xS(o,Cn,s)}function xS(s,o,l){if(o=Eb(s,o,mS)[0],s=Bh(Oa)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=pd(o)}catch(I){throw I===Dc?Ah:I}else d=o;o=es();var y=o.queue,j=y.dispatch;return l!==o.memoizedState&&(_t.flags|=2048,_c(9,{destroy:void 0},eI.bind(null,y,l),null)),[d,j,s]}function eI(s,o){s.action=o}function bS(s){var o=es(),l=Cn;if(l!==null)return xS(o,l,s);es(),o=o.memoizedState,l=es();var d=l.queue.dispatch;return l.memoizedState=s,[o,d,!1]}function _c(s,o,l,d){return s={tag:s,create:l,deps:d,inst:o,next:null},o=_t.updateQueue,o===null&&(o=Lh(),_t.updateQueue=o),l=o.lastEffect,l===null?o.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,o.lastEffect=s),s}function vS(){return es().memoizedState}function Vh(s,o,l,d){var y=nr();_t.flags|=s,y.memoizedState=_c(1|o,{destroy:void 0},l,d===void 0?null:d)}function Uh(s,o,l,d){var y=es();d=d===void 0?null:d;var j=y.memoizedState.inst;Cn!==null&&d!==null&&jb(d,Cn.memoizedState.deps)?y.memoizedState=_c(o,j,l,d):(_t.flags|=s,y.memoizedState=_c(1|o,j,l,d))}function yS(s,o){Vh(8390656,8,s,o)}function Ob(s,o){Uh(2048,8,s,o)}function tI(s){_t.flags|=4;var o=_t.updateQueue;if(o===null)o=Lh(),_t.updateQueue=o,o.events=[s];else{var l=o.events;l===null?o.events=[s]:l.push(s)}}function wS(s){var o=es().memoizedState;return tI({ref:o,nextImpl:s}),function(){if((dn&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function jS(s,o){return Uh(4,2,s,o)}function SS(s,o){return Uh(4,4,s,o)}function NS(s,o){if(typeof o=="function"){s=s();var l=o(s);return function(){typeof l=="function"?l():o(null)}}if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function CS(s,o,l){l=l!=null?l.concat([s]):null,Uh(4,4,NS.bind(null,o,s),l)}function Db(){}function kS(s,o){var l=es();o=o===void 0?null:o;var d=l.memoizedState;return o!==null&&jb(o,d[1])?d[0]:(l.memoizedState=[s,o],s)}function TS(s,o){var l=es();o=o===void 0?null:o;var d=l.memoizedState;if(o!==null&&jb(o,d[1]))return d[0];if(d=s(),Rl){et(!0);try{s()}finally{et(!1)}}return l.memoizedState=[d,o],d}function zb(s,o,l){return l===void 0||(Ma&1073741824)!==0&&(Kt&261930)===0?s.memoizedState=o:(s.memoizedState=l,s=_N(),_t.lanes|=s,Ci|=s,l)}function ES(s,o,l,d){return Rr(l,o)?l:vi.current!==null?(s=zb(s,l,d),Rr(s,o)||(is=!0),s):(Ma&106)===0||(Ma&1073741824)!==0&&(Kt&261930)===0?(is=!0,s.memoizedState=l):(s=_N(),_t.lanes|=s,Ci|=s,o)}function RS(s,o,l,d,y){var j=ue.p;ue.p=j!==0&&8>j?j:8;var I=ae.T,J={};J.types=I!==null?I.types:null,ae.T=J,_b(s,!1,o,l);try{var me=y(),Ce=ae.S;if(Ce!==null&&Ce(J,me),me!==null&&typeof me=="object"&&typeof me.then=="function"){var ze=Wz(me,d);gd(s,o,ze,zr(s))}else gd(s,o,d,zr(s))}catch($e){gd(s,o,{then:function(){},status:"rejected",reason:$e},zr())}finally{ue.p=j,I!==null&&J.types!==null&&(I.types=J.types),ae.T=I}}function nI(){}function Ib(s,o,l,d){if(s.tag!==5)throw Error(a(476));var y=AS(s).queue;RS(s,y,o,se,l===null?nI:function(){return MS(s),l(d)})}function AS(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oa,lastRenderedState:se},next:null};var l={};return o.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oa,lastRenderedState:l},next:null},s.memoizedState=o,s=s.alternate,s!==null&&(s.memoizedState=o),o}function MS(s){var o=AS(s);o.next===null&&(o=s.alternate.memoizedState),gd(s,o.next.queue,{},zr())}function Pb(){return Is(nu)}function OS(){return es().memoizedState}function DS(){return es().memoizedState}function sI(s){for(var o=s.return;o!==null;){switch(o.tag){case 24:case 3:var l=zr();s=xi(l);var d=bi(o,s,l);d!==null&&(pr(d,o,l),ud(d,o,l)),o={cache:ub()},s.payload=o;return}o=o.return}}function rI(s,o,l){var d=zr();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hh(s)?IS(o,l):(l=tb(s,o,l,d),l!==null&&(pr(l,s,d),PS(l,o,d)))}function zS(s,o,l){var d=zr();gd(s,o,l,d)}function gd(s,o,l,d){var y={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Hh(s))IS(o,y);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=o.lastRenderedReducer,j!==null))try{var I=o.lastRenderedState,J=j(I,l);if(y.hasEagerState=!0,y.eagerState=J,Rr(J,I))return yh(s,o,y,0),An===null&&vh(),!1}catch{}finally{}if(l=tb(s,o,y,d),l!==null)return pr(l,s,d),PS(l,o,d),!0}return!1}function _b(s,o,l,d){if(d={lane:2,revertLane:T0(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Hh(s)){if(o)throw Error(a(479))}else o=tb(s,l,d,2),o!==null&&pr(o,s,2)}function Hh(s){var o=s.alternate;return s===_t||o!==null&&o===_t}function IS(s,o){Ic=Ph=!0;var l=s.pending;l===null?o.next=o:(o.next=l.next,l.next=o),s.pending=o}function PS(s,o,l){if((l&4194048)!==0){var d=o.lanes;d&=s.pendingLanes,l|=d,o.lanes=l,wo(s,l)}}var Fh={readContext:Is,use:$h,useCallback:Xn,useContext:Xn,useEffect:Xn,useImperativeHandle:Xn,useLayoutEffect:Xn,useInsertionEffect:Xn,useMemo:Xn,useReducer:Xn,useRef:Xn,useState:Xn,useDebugValue:Xn,useDeferredValue:Xn,useTransition:Xn,useSyncExternalStore:Xn,useId:Xn,useHostTransitionStatus:Xn,useFormState:Xn,useActionState:Xn,useOptimistic:Xn,useMemoCache:Xn,useCacheRefresh:Xn,useEffectEvent:Xn},_S={readContext:Is,use:$h,useCallback:function(s,o){return nr().memoizedState=[s,o===void 0?null:o],s},useContext:Is,useEffect:yS,useImperativeHandle:function(s,o,l){l=l!=null?l.concat([s]):null,Vh(4194308,4,NS.bind(null,o,s),l)},useLayoutEffect:function(s,o){return Vh(4194308,4,s,o)},useInsertionEffect:function(s,o){Vh(4,2,s,o)},useMemo:function(s,o){var l=nr();o=o===void 0?null:o;var d=s();if(Rl){et(!0);try{s()}finally{et(!1)}}return l.memoizedState=[d,o],d},useReducer:function(s,o,l){var d=nr();if(l!==void 0){var y=l(o);if(Rl){et(!0);try{l(o)}finally{et(!1)}}}else y=o;return d.memoizedState=d.baseState=y,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:y},d.queue=s,s=s.dispatch=rI.bind(null,_t,s),[d.memoizedState,s]},useRef:function(s){var o=nr();return s={current:s},o.memoizedState=s},useState:function(s){s=Ab(s);var o=s.queue,l=zS.bind(null,_t,o);return o.dispatch=l,[s.memoizedState,l]},useDebugValue:Db,useDeferredValue:function(s,o){var l=nr();return zb(l,s,o)},useTransition:function(){var s=Ab(!1);return s=RS.bind(null,_t,s.queue,!0,!1),nr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,o,l){var d=_t,y=nr();if(Vt){if(l===void 0)throw Error(a(407));l=l()}else{if(l=o(),An===null)throw Error(a(349));(Kt&127)!==0||rS(d,o,l)}y.memoizedState=l;var j={value:l,getSnapshot:o};return y.queue=j,yS(aS.bind(null,d,j,s),[s]),d.flags|=2048,_c(9,{destroy:void 0},oS.bind(null,d,j,l,o),null),l},useId:function(){var s=nr(),o=An.identifierPrefix;if(Vt){var l=Uo,d=Vo;l=(d&~(1<<32-it(d)-1)).toString(32)+l,o="_"+o+"R_"+l,l=_h++,0<l&&(o+="H"+l.toString(32)),o+="_"}else l=Qz++,o="_"+o+"r_"+l.toString(32)+"_";return s.memoizedState=o},useHostTransitionStatus:Pb,useFormState:pS,useActionState:pS,useOptimistic:function(s){var o=nr();o.memoizedState=o.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=l,o=_b.bind(null,_t,!0,l),l.dispatch=o,[s,o]},useMemoCache:Tb,useCacheRefresh:function(){return nr().memoizedState=sI.bind(null,_t)},useEffectEvent:function(s){var o=nr(),l={impl:s};return o.memoizedState=l,function(){if((dn&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},LS={readContext:Is,use:$h,useCallback:kS,useContext:Is,useEffect:Ob,useImperativeHandle:CS,useInsertionEffect:jS,useLayoutEffect:SS,useMemo:TS,useReducer:Bh,useRef:vS,useState:function(){return Bh(Oa)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return ES(l,Cn.memoizedState,s,o)},useTransition:function(){var s=Bh(Oa)[0],o=es().memoizedState;return[typeof s=="boolean"?s:pd(s),o]},useSyncExternalStore:sS,useId:OS,useHostTransitionStatus:Pb,useFormState:gS,useActionState:gS,useOptimistic:function(s,o){var l=es();return cS(l,Cn,s,o)},useMemoCache:Tb,useCacheRefresh:DS,useEffectEvent:wS},oI={readContext:Is,use:$h,useCallback:kS,useContext:Is,useEffect:Ob,useImperativeHandle:CS,useInsertionEffect:jS,useLayoutEffect:SS,useMemo:TS,useReducer:Rb,useRef:vS,useState:function(){return Rb(Oa)},useDebugValue:Db,useDeferredValue:function(s,o){var l=es();return Cn===null?zb(l,s,o):ES(l,Cn.memoizedState,s,o)},useTransition:function(){var s=Rb(Oa)[0],o=es().memoizedState;return[typeof s=="boolean"?s:pd(s),o]},useSyncExternalStore:sS,useId:OS,useHostTransitionStatus:Pb,useFormState:bS,useActionState:bS,useOptimistic:function(s,o){var l=es();return Cn!==null?cS(l,Cn,s,o):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Tb,useCacheRefresh:DS,useEffectEvent:wS};function Lb(s,o,l,d){o=s.memoizedState,l=l(d,o),l=l==null?o:T({},o,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var $b={enqueueSetState:function(s,o,l){s=s._reactInternals;var d=zr(),y=xi(d);y.payload=o,l!=null&&(y.callback=l),o=bi(s,y,d),o!==null&&(pr(o,s,d),ud(o,s,d))},enqueueReplaceState:function(s,o,l){s=s._reactInternals;var d=zr(),y=xi(d);y.tag=1,y.payload=o,l!=null&&(y.callback=l),o=bi(s,y,d),o!==null&&(pr(o,s,d),ud(o,s,d))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var l=zr(),d=xi(l);d.tag=2,o!=null&&(d.callback=o),o=bi(s,d,l),o!==null&&(pr(o,s,l),ud(o,s,l))}};function $S(s,o,l,d,y,j,I){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,j,I):o.prototype&&o.prototype.isPureReactComponent?!nd(l,d)||!nd(y,j):!0}function BS(s,o,l,d){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(l,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(l,d),o.state!==s&&$b.enqueueReplaceState(o,o.state,null)}function Al(s,o){var l=o;if("ref"in o){l={};for(var d in o)d!=="ref"&&(l[d]=o[d])}if(s=s.defaultProps){l===o&&(l=T({},l));for(var y in s)l[y]===void 0&&(l[y]=s[y])}return l}function VS(s){bh(s)}function US(s){console.error(s)}function HS(s){bh(s)}function Gh(s,o){try{var l=s.onUncaughtError;l(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function FS(s,o,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Bb(s,o,l){return l=xi(l),l.tag=3,l.payload={element:null},l.callback=function(){Gh(s,o)},l}function GS(s){return s=xi(s),s.tag=3,s}function qS(s,o,l,d){var y=l.type.getDerivedStateFromError;if(typeof y=="function"){var j=d.value;s.payload=function(){return y(j)},s.callback=function(){FS(o,l,d)}}var I=l.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(s.callback=function(){FS(o,l,d),typeof y!="function"&&(ki===null?ki=new Set([this]):ki.add(this));var J=d.stack;this.componentDidCatch(d.value,{componentStack:J!==null?J:""})})}function aI(s,o,l,d,y){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=l.alternate,o!==null&&jl(o,l,y,!0),l=Ps.current,l!==null){switch(l.tag){case 31:case 13:case 19:return qs===null?fm():l.alternate===null&&Wn===0&&(Wn=3),l.flags&=-257,l.flags|=65536,l.lanes=y,d===Mh?l.flags|=16384:(o=l.updateQueue,o===null?l.updateQueue=new Set([d]):o.add(d),N0(s,d,y)),!1;case 22:return l.flags|=65536,d===Mh?l.flags|=16384:(o=l.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=o):(l=o.retryQueue,l===null?o.retryQueue=new Set([d]):l.add(d)),N0(s,d,y)),!1}throw Error(a(435,l.tag))}return N0(s,d,y),fm(),!1}if(Vt)return o=Ps.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=y,d!==ab&&(s=Error(a(422),{cause:d}),od(eo(s,l)))):(d!==ab&&(o=Error(a(423),{cause:d}),od(eo(o,l))),s=s.current.alternate,s.flags|=65536,y&=-y,s.lanes|=y,d=eo(d,l),y=Bb(s.stateNode,d,y),gb(s,y),Wn!==4&&(Wn=2)),!1;var j=Error(a(520),{cause:d});if(j=eo(j,l),Nd===null?Nd=[j]:Nd.push(j),Wn!==4&&(Wn=2),o===null)return!0;d=eo(d,l),l=o;do{switch(l.tag){case 3:return l.flags|=65536,s=y&-y,l.lanes|=s,s=Bb(l.stateNode,d,s),gb(l,s),!1;case 1:if(o=l.type,j=l.stateNode,(l.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(ki===null||!ki.has(j))))return l.flags|=65536,y&=-y,l.lanes|=y,y=GS(y),qS(y,s,l,d),gb(l,y),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var Vb=Error(a(461)),is=!1;function ms(s,o,l,d){o.child=s===null?Wj(o,null,l,d):El(o,s.child,l,d)}function YS(s,o,l,d,y){l=l.render;var j=o.ref;if("ref"in d){var I={};for(var J in d)J!=="ref"&&(I[J]=d[J])}else I=d;return Sl(o),d=Sb(s,o,l,I,j,y),J=Nb(),s!==null&&!is?(Cb(s,o,y),Da(s,o,y)):(Vt&&J&&Nh(o),o.flags|=1,ms(s,o,d,y),o.child)}function KS(s,o,l,d,y){if(s===null){var j=l.type;return typeof j=="function"&&!nb(j)&&j.defaultProps===void 0&&l.compare===null?(o.tag=15,o.type=j,XS(s,o,j,d,y)):(s=jh(l.type,null,d,o,o.mode,y),s.ref=o.ref,s.return=o,o.child=s)}if(j=s.child,!Xb(s,y)){var I=j.memoizedProps;if(l=l.compare,l=l!==null?l:nd,l(I,d)&&s.ref===o.ref)return Da(s,o,y)}return o.flags|=1,s=Ta(j,d),s.ref=o.ref,s.return=o,o.child=s}function XS(s,o,l,d,y){if(s!==null){var j=s.memoizedProps;if(nd(j,d)&&s.ref===o.ref)if(is=!1,o.pendingProps=d=j,Xb(s,y))(s.flags&131072)!==0&&(is=!0);else return o.lanes=s.lanes,Da(s,o,y)}return Ub(s,o,l,d,y)}function WS(s,o,l,d){var y=d.children,j=s!==null?s.memoizedState:null;if(s===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((o.flags&128)!==0){if(j=j!==null?j.baseLanes|l:l,s!==null){for(d=o.child=s.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~j}else d=0,o.child=null;return QS(s,o,j,l,d)}if((l&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},s!==null&&Rh(o,j!==null?j.cachePool:null),j!==null?Jj(o,j):bb(),eS(o);else return d=o.lanes=536870912,QS(s,o,j!==null?j.baseLanes|l:l,l,d)}else j!==null?(Rh(o,j.cachePool),Jj(o,j),wi(),o.memoizedState=null):(s!==null&&Rh(o,null),bb(),wi());return ms(s,o,y,l),o.child}function xd(s,o){return s!==null&&s.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function QS(s,o,l,d,y){var j=fb();return j=j===null?null:{parent:os._currentValue,pool:j},o.memoizedState={baseLanes:l,cachePool:j},s!==null&&Rh(o,null),bb(),eS(o),s!==null&&jl(s,o,d,!0),o.childLanes=y,null}function qh(s,o){return o=Yh({mode:o.mode,children:o.children},s.mode),o.ref=s.ref,s.child=o,o.return=s,o}function ZS(s,o,l){return El(o,s.child,null,l),s=qh(o,o.pendingProps),s.flags|=2,Ar(o),o.memoizedState=null,s}function iI(s,o,l){var d=o.pendingProps,y=(o.flags&128)!==0;if(o.flags&=-129,s===null){if(Vt){if(d.mode==="hidden")return s=qh(o,d),o.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},xd(null,s);if(yb(o),(s=Mn)?(s=NC(s,so),s=s!==null&&s.data==="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:di!==null?{id:Vo,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},l=Ij(s),l.return=o,o.child=l,Ns=o,Mn=null)):s=null,s===null)throw hi(o);return o.lanes=536870912,null}return qh(o,d)}var j=s.memoizedState;if(j!==null){var I=j.dehydrated;if(yb(o),y)if(o.flags&256)o.flags&=-257,o=ZS(s,o,l);else if(o.memoizedState!==null)o.child=s.child,o.flags|=128,o=null;else throw Error(a(558));else if(is||jl(s,o,l,!1),y=(l&s.childLanes)!==0,is||y){if(vi.current===null){if(d=An,d!==null&&(I=jo(d,l),I!==0&&I!==j.retryLane))throw j.retryLane=I,bl(s,I),pr(d,s,I),Vb;fm()}o=ZS(s,o,l)}else s=j.treeContext,Mn=oo(I.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&Lj(o,s),o=qh(o,d),o.flags|=134221824;return o}return s=Ta(s.child,{mode:d.mode,children:d.children}),s.ref=o.ref,o.child=s,s.return=o,s}function Lc(s,o){var l=o.ref;if(l===null)s!==null&&s.ref!==null&&(o.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(s===null||s.ref!==l)&&(o.flags|=4194816)}}function Ub(s,o,l,d,y){return Sl(o),l=Sb(s,o,l,d,void 0,y),d=Nb(),s!==null&&!is?(Cb(s,o,y),Da(s,o,y)):(Vt&&d&&Nh(o),o.flags|=1,ms(s,o,l,y),o.child)}function JS(s,o,l,d,y,j){return Sl(o),o.updateQueue=null,l=nS(o,d,l,y),tS(s),d=Nb(),s!==null&&!is?(Cb(s,o,j),Da(s,o,j)):(Vt&&d&&Nh(o),o.flags|=1,ms(s,o,l,j),o.child)}function eN(s,o,l,d,y){if(Sl(o),o.stateNode===null){var j=Ec,I=l.contextType;typeof I=="object"&&I!==null&&(j=Is(I)),j=new l(d,j),o.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=$b,o.stateNode=j,j._reactInternals=o,j=o.stateNode,j.props=d,j.state=o.memoizedState,j.refs={},mb(o),I=l.contextType,j.context=typeof I=="object"&&I!==null?Is(I):Ec,j.state=o.memoizedState,I=l.getDerivedStateFromProps,typeof I=="function"&&(Lb(o,l,I,d),j.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(I=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),I!==j.state&&$b.enqueueReplaceState(j,j.state,null),fd(o,d,j,y),dd(),j.state=o.memoizedState),typeof j.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(s===null){j=o.stateNode;var J=o.memoizedProps,me=Al(l,J);j.props=me;var Ce=j.context,ze=l.contextType;I=Ec,typeof ze=="object"&&ze!==null&&(I=Is(ze));var $e=l.getDerivedStateFromProps;ze=typeof $e=="function"||typeof j.getSnapshotBeforeUpdate=="function",J=o.pendingProps!==J,ze||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(J||Ce!==I)&&BS(o,j,d,I),gi=!1;var we=o.memoizedState;j.state=we,fd(o,d,j,y),dd(),Ce=o.memoizedState,J||we!==Ce||gi?(typeof $e=="function"&&(Lb(o,l,$e,d),Ce=o.memoizedState),(me=gi||$S(o,l,me,d,we,Ce,I))?(ze||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(o.flags|=4194308)):(typeof j.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=Ce),j.props=d,j.state=Ce,j.context=I,d=me):(typeof j.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{j=o.stateNode,pb(s,o),I=o.memoizedProps,ze=Al(l,I),j.props=ze,$e=o.pendingProps,we=j.context,Ce=l.contextType,me=Ec,typeof Ce=="object"&&Ce!==null&&(me=Is(Ce)),J=l.getDerivedStateFromProps,(Ce=typeof J=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(I!==$e||we!==me)&&BS(o,j,d,me),gi=!1,we=o.memoizedState,j.state=we,fd(o,d,j,y),dd();var Me=o.memoizedState;I!==$e||we!==Me||gi||s!==null&&s.dependencies!==null&&Th(s.dependencies)?(typeof J=="function"&&(Lb(o,l,J,d),Me=o.memoizedState),(ze=gi||$S(o,l,ze,d,we,Me,me)||s!==null&&s.dependencies!==null&&Th(s.dependencies))?(Ce||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,Me,me),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,Me,me)),typeof j.componentDidUpdate=="function"&&(o.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof j.componentDidUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=Me),j.props=d,j.state=Me,j.context=me,d=ze):(typeof j.componentDidUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),d=!1)}return j=d,Lc(s,o),d=(o.flags&128)!==0,j||d?(j=o.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:j.render(),o.flags|=1,s!==null&&d?(o.child=El(o,s.child,null,y),o.child=El(o,null,l,y)):ms(s,o,l,y),o.memoizedState=j.state,s=o.child):s=Da(s,o,y),s}function tN(s,o,l,d){return yl(),o.flags|=256,ms(s,o,l,d),o.child}var Hb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fb(s){return{baseLanes:s,cachePool:Fj()}}function Gb(s,o,l){return s=s!==null?s.childLanes&~l:0,o&&(s|=Dr),s}function nN(s,o,l){var d=o.pendingProps,y=!1,j=(o.flags&128)!==0,I;if((I=j)||(I=s!==null&&s.memoizedState===null?!1:(_s.current&2)!==0),I&&(y=!0,o.flags&=-129),I=(o.flags&32)!==0,o.flags&=-33,s===null){if(Vt){if(y?yi(o):wi(),(s=Mn)?(s=NC(s,so),s=s!==null&&s.data!=="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:di!==null?{id:Vo,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},l=Ij(s),l.return=o,o.child=l,Ns=o,Mn=null)):s=null,s===null)throw hi(o);return F0(s)?o.lanes=32:o.lanes=536870912,null}return j=d.children,d=d.fallback,y?(wi(),y=o.mode,j=Yh({mode:"hidden",children:j},y),d=vl(d,y,l,null),j.return=o,d.return=o,j.sibling=d,o.child=j,d=o.child,d.memoizedState=Fb(l),d.childLanes=Gb(s,I,l),o.memoizedState=Hb,xd(null,d)):(yi(o),qb(o,j))}var J=s.memoizedState;if(J!==null){var me=J.dehydrated;if(me!==null)return lI(s,o,j,I,d,me,J,l)}return y?(wi(),y=d.fallback,j=o.mode,J=s.child,me=J.sibling,d=Ta(J,{mode:"hidden",children:d.children}),d.subtreeFlags=J.subtreeFlags&1206910976,me!==null?y=Ta(me,y):(y=vl(y,j,l,null),y.flags|=2),y.return=o,d.return=o,d.sibling=y,o.child=d,xd(null,d),d=o.child,y=s.child.memoizedState,y===null?y=Fb(l):(j=y.cachePool,j!==null?(J=os._currentValue,j=j.parent!==J?{parent:J,pool:J}:j):j=Fj(),y={baseLanes:y.baseLanes|l,cachePool:j}),d.memoizedState=y,d.childLanes=Gb(s,I,l),o.memoizedState=Hb,xd(s.child,d)):(yi(o),l=s.child,s=l.sibling,l=Ta(l,{mode:"visible",children:d.children}),l.return=o,l.sibling=null,s!==null&&(I=o.deletions,I===null?(o.deletions=[s],o.flags|=16):I.push(s)),o.child=l,o.memoizedState=null,l)}function qb(s,o){return o=Yh({mode:"visible",children:o},s.mode),o.return=s,s.child=o}function Yh(s,o){return s=dr(22,s,null,o),s.lanes=0,s}function Kh(s,o,l){return El(o,s.child,null,l),s=qb(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function lI(s,o,l,d,y,j,I,J){if(l)return o.flags&256?(yi(o),o.flags&=-257,Kh(s,o,J)):o.memoizedState!==null?(wi(),o.child=s.child,o.flags|=128,null):(wi(),j=y.fallback,I=o.mode,y=Yh({mode:"visible",children:y.children},I),j=vl(j,I,J,null),j.flags|=2,y.return=o,j.return=o,y.sibling=j,o.child=y,El(o,s.child,null,J),y=o.child,y.memoizedState=Fb(J),y.childLanes=Gb(s,d,J),o.memoizedState=Hb,xd(null,y));if(yi(o),F0(j)){if(d=j.nextSibling&&j.nextSibling.dataset,d)var me=d.dgst;return d=me,d!==""&&(y=Error(a(419)),y.stack="",y.digest=d,od({value:y,source:null,stack:null})),Kh(s,o,J)}if(is||jl(s,o,J,!1),d=(J&s.childLanes)!==0,is||d){if(vi.current!==null)return Kh(s,o,J);if(d=An,d!==null&&(y=jo(d,J),y!==0&&y!==I.retryLane))throw I.retryLane=y,bl(s,y),pr(d,s,y),Vb;return H0(j)||fm(),Kh(s,o,J)}return H0(j)?(o.flags|=192,o.child=s.child,null):(s=I.treeContext,Mn=oo(j.nextSibling),Ns=o,Vt=!0,fi=null,so=!1,s!==null&&Lj(o,s),o=qb(o,y.children),o.flags|=134221824,o)}function sN(s,o,l){s.lanes|=o;var d=s.alternate;d!==null&&(d.lanes|=o),kh(s.return,o,l)}function rN(s){for(var o=null;s!==null;){var l=s.alternate;l!==null&&Ih(l)===null&&(o=s),s=s.sibling}return o}function Xh(s,o,l,d,y,j){var I=s.memoizedState;I===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:y,treeForkCount:j}:(I.isBackwards=o,I.rendering=null,I.renderingStartTime=0,I.last=d,I.tail=l,I.tailMode=y,I.treeForkCount=j)}function Yb(s){var o=s.child;for(s.child=null;o!==null;){var l=o.sibling;o.sibling=s.child,s.child=o,o=l}}function Kb(s,o,l){var d=o.pendingProps,y=d.revealOrder,j=d.tail;d=d.children;var I=_s.current;if(o.flags&128)return hd(o,I),null;var J=(I&2)!==0;if(J?(I=I&1|2,o.flags|=128):I&=1,hd(o,I),y==="backwards"&&s!==null?(Yb(s),ms(s,o,d,l),Yb(s)):ms(s,o,d,l),d=Vt?rd:0,!J&&s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&sN(s,l,o);else if(s.tag===19)sN(s,l,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(y){case"backwards":l=rN(o.child),l===null?(y=o.child,o.child=null):(y=l.sibling,l.sibling=null,Yb(o)),Xh(o,!0,y,null,j,d);break;case"unstable_legacy-backwards":for(l=null,y=o.child,o.child=null;y!==null;){if(s=y.alternate,s!==null&&Ih(s)===null){o.child=y;break}s=y.sibling,y.sibling=l,l=y,y=s}Xh(o,!0,l,null,j,d);break;case"together":Xh(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:l=rN(o.child),l===null?(y=o.child,o.child=null):(y=l.sibling,l.sibling=null),Xh(o,!1,y,l,j,d)}return o.child}function oN(s,o,l){var d=o.pendingProps;return mi(o,o.type,d.value),ms(s,o,d.children,l),o.child}function Da(s,o,l){if(s!==null&&(o.dependencies=s.dependencies),Ci|=o.lanes,(l&o.childLanes)===0)if(s!==null){if(jl(s,o,l,!1),(l&o.childLanes)===0)return null}else return null;if(s!==null&&o.child!==s.child)throw Error(a(153));if(o.child!==null){for(s=o.child,l=Ta(s,s.pendingProps),o.child=l,l.return=o;s.sibling!==null;)s=s.sibling,l=l.sibling=Ta(s,s.pendingProps),l.return=o;l.sibling=null}return o.child}function Xb(s,o){return(s.lanes&o)!==0?!0:(s=s.dependencies,!!(s!==null&&Th(s)))}function cI(s,o,l){switch(o.tag){case 3:re(o,o.stateNode.containerInfo),mi(o,os,s.memoizedState.cache),yl();break;case 27:case 5:Re(o);break;case 4:re(o,o.stateNode.containerInfo);break;case 10:mi(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,yb(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return yi(o),o.flags|=128,null;d=jl(s,o,l,!1);var y=o.child.childLanes;return d||(l&y)!==0?nN(s,o,l):(yi(o),s=Da(s,o,l),s!==null?s.sibling:null)}yi(o);break;case 19:if(o.flags&128)return Kb(s,o,l);if(y=(s.flags&128)!==0,d=(l&o.childLanes)!==0,d||(jl(s,o,l,!1),d=(l&o.childLanes)!==0),y){if(d)return Kb(s,o,l);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),hd(o,_s.current),d)break;return null;case 22:return o.lanes=0,WS(s,o,l,o.pendingProps);case 24:mi(o,os,s.memoizedState.cache)}return Da(s,o,l)}function aN(s,o,l){if(s!==null)if(s.memoizedProps!==o.pendingProps)is=!0;else{if(!Xb(s,l)&&(o.flags&128)===0)return is=!1,cI(s,o,l);is=(s.flags&131072)!==0}else is=!1,Vt&&(o.flags&1048576)!==0&&_j(o,rd,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(s=kl(o.elementType),o.type=s,typeof s=="function")nb(s)?(d=Al(s,d),o.tag=1,o=eN(null,o,s,d,l)):(o.tag=0,o=Ub(null,o,s,d,l));else{if(s!=null){var y=s.$$typeof;if(y===H){o.tag=11,o=YS(null,o,s,d,l);break e}else if(y===Z){o.tag=14,o=KS(null,o,s,d,l);break e}else if(y===U){o.tag=10,o.type=s,o=oN(null,o,l);break e}}throw o=te(s)||s,Error(a(306,o,""))}}return o;case 0:return Ub(s,o,o.type,o.pendingProps,l);case 1:return d=o.type,y=Al(d,o.pendingProps),eN(s,o,d,y,l);case 3:e:{if(re(o,o.stateNode.containerInfo),s===null)throw Error(a(387));d=o.pendingProps;var j=o.memoizedState;y=j.element,pb(s,o),fd(o,d,null,l);var I=o.memoizedState;if(d=I.cache,mi(o,os,d),d!==j.cache&&cb(o,[os],l,!0),dd(),d=I.element,j.isDehydrated)if(j={element:d,isDehydrated:!1,cache:I.cache},o.updateQueue.baseState=j,o.memoizedState=j,o.flags&256){o=tN(s,o,d,l);break e}else if(d!==y){y=eo(Error(a(424)),o),od(y),o=tN(s,o,d,l);break e}else{switch(s=o.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Mn=oo(s.firstChild),Ns=o,Vt=!0,fi=null,so=!0,l=Wj(o,null,d,l),o.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling}else{if(yl(),d===y){o=Da(s,o,l);break e}ms(s,o,d,l)}o=o.child}return o;case 26:return Lc(s,o),s===null?(l=MC(o.type,null,o.pendingProps,null))?o.memoizedState=l:Vt||(o.stateNode=uC(o.type,o.pendingProps,ce.current,o)):o.memoizedState=MC(o.type,s.memoizedProps,o.pendingProps,s.memoizedState),null;case 27:return Re(o),s===null&&Vt&&(d=o.stateNode=TC(o.type,o.pendingProps,ce.current),Ns=o,so=!0,y=Mn,Ri(o.type)?(G0=y,Mn=oo(d.firstChild)):Mn=y),ms(s,o,o.pendingProps.children,l),Lc(s,o),s===null&&(o.flags|=4194304),o.child;case 5:return s===null&&Vt&&((y=d=Mn)&&(d=sP(d,o.type,o.pendingProps,so),d!==null?(o.stateNode=d,Ns=o,Mn=oo(d.firstChild),so=!1,y=!0):y=!1),y||hi(o)),Re(o),y=o.type,j=o.pendingProps,I=s!==null?s.memoizedProps:null,d=j.children,P0(y,j)?d=null:I!==null&&P0(y,I)&&(o.flags|=32),o.memoizedState!==null&&(y=Sb(s,o,Zz,null,null,l),nu._currentValue=y),Lc(s,o),ms(s,o,d,l),o.child;case 6:return s===null&&Vt&&((s=l=Mn)&&(l=rP(l,o.pendingProps,so),l!==null?(o.stateNode=l,Ns=o,Mn=null,s=!0):s=!1),s||hi(o)),null;case 13:return nN(s,o,l);case 4:return re(o,o.stateNode.containerInfo),d=o.pendingProps,s===null?o.child=El(o,null,d,l):ms(s,o,d,l),o.child;case 11:return YS(s,o,o.type,o.pendingProps,l);case 7:return d=o.pendingProps,Lc(s,o),ms(s,o,d,l),o.child;case 8:return ms(s,o,o.pendingProps.children,l),o.child;case 12:return ms(s,o,o.pendingProps.children,l),o.child;case 10:return oN(s,o,l);case 9:return y=o.type._context,d=o.pendingProps.children,Sl(o),y=Is(y),d=d(y),o.flags|=1,ms(s,o,d,l),o.child;case 14:return KS(s,o,o.type,o.pendingProps,l);case 15:return XS(s,o,o.type,o.pendingProps,l);case 19:return Kb(s,o,l);case 31:return iI(s,o,l);case 22:return WS(s,o,l,o.pendingProps);case 24:return Sl(o),d=Is(os),s===null?(y=fb(),y===null&&(y=An,j=ub(),y.pooledCache=j,j.refCount++,j!==null&&(y.pooledCacheLanes|=l),y=j),o.memoizedState={parent:d,cache:y},mb(o),mi(o,os,y)):((s.lanes&l)!==0&&(pb(s,o),fd(o,null,null,l),dd()),y=s.memoizedState,j=o.memoizedState,y.parent!==d?(y={parent:d,cache:d},o.memoizedState=y,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=y),mi(o,os,d)):(d=j.cache,mi(o,os,d),d!==y.cache&&cb(o,[os],l,!0))),ms(s,o,o.pendingProps.children,l),o.child;case 30:return o.stateNode===null&&(o.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=o.pendingProps,d.name!=null&&d.name!=="auto"?o.flags|=s===null?18882560:18874368:Vt&&Nh(o),s!==null&&s.memoizedProps.name!==d.name?o.flags|=4194816:Lc(s,o),ms(s,o,d.children,l),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function za(s){s.flags|=4}function Wb(s,o,l,d,y){var j;if((j=(s.mode&32)!==0)&&(j=l===null?IC(o,d):IC(o,d)&&(d.src!==l.src||d.srcSet!==l.srcSet)),j){if(s.flags|=16777216,(y&335544128)===y)if(s.stateNode.complete)s.flags|=8192;else if(VN())s.flags|=8192;else throw Tl=Mh,hb}else s.flags&=-16777217}function iN(s,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!PC(o))if(VN())s.flags|=8192;else throw Tl=Mh,hb}function Wh(s,o){o!==null&&(s.flags|=4),s.flags&16384&&(o=s.tag!==22?xn():536870912,s.lanes|=o,Hc|=o)}function bd(s,o){if(!Vt)switch(s.tailMode){case"visible":break;case"collapsed":for(var l=s.tail,d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(o=s.tail,l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?s.tail=null:l.sibling=null}}function On(s){var o=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(o)for(var y=s.child;y!==null;)l|=y.lanes|y.childLanes,d|=y.subtreeFlags&1206910976,d|=y.flags&1206910976,y.return=s,y=y.sibling;else for(y=s.child;y!==null;)l|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=s,y=y.sibling;return s.subtreeFlags|=d,s.childLanes=l,o}function uI(s,o,l){var d=o.pendingProps;switch(ob(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return On(o),null;case 1:return On(o),null;case 3:return l=o.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),Aa(os),fe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(Mc(o)?za(o):s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ib())),On(o),null;case 26:var y=o.type,j=o.memoizedState;return s===null?(za(o),j!==null?(On(o),iN(o,j)):(On(o),Wb(o,y,null,d,l))):j?j!==s.memoizedState?(za(o),On(o),iN(o,j)):(On(o),o.flags&=-16777217):(s=s.memoizedProps,s!==d&&za(o),On(o),Wb(o,y,s,d,l)),null;case 27:if(Oe(o),l=ce.current,y=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&za(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return On(o),o.subtreeFlags&=-33554433,null}s=je.current,Mc(o)?$j(o):(s=TC(y,d,l),o.stateNode=s,za(o))}return On(o),o.subtreeFlags&=-33554433,null;case 5:if(Oe(o),y=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==d&&za(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return On(o),o.subtreeFlags&=-33554433,null}if(j=je.current,Mc(o))$j(o);else{var I=Rd(ce.current);switch(j){case 1:j=I.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:j=I.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":j=I.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":j=I.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":j=I.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof d.is=="string"?I.createElement("select",{is:d.is}):I.createElement("select"),d.multiple?j.multiple=!0:d.size&&(j.size=d.size);break;default:j=typeof d.is=="string"?I.createElement(y,{is:d.is}):I.createElement(y)}}j[Un]=o,j[Os]=d;e:for(I=o.child;I!==null;){if(I.tag===5||I.tag===6)j.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===o)break e;for(;I.sibling===null;){if(I.return===null||I.return===o)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}o.stateNode=j;e:switch($s(j,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&za(o)}}return On(o),o.subtreeFlags&=-33554433,Wb(o,o.type,s===null?null:s.memoizedProps,o.pendingProps,l),null;case 6:if(s&&o.stateNode!=null)s.memoizedProps!==d&&za(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(a(166));if(s=ce.current,Mc(o)){if(s=o.stateNode,l=o.memoizedProps,d=null,y=Ns,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}s[Un]=o,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||aC(s.nodeValue,l)),s||hi(o,!0)}else s=Rd(s).createTextNode(d),s[Un]=o,o.stateNode=s}return On(o),null;case 31:if(l=o.memoizedState,s===null||s.memoizedState!==null){if(d=Mc(o),l!==null){if(s===null){if(!d)throw Error(a(318));if(s=o.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[Un]=o}else yl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;On(o),s=!1}else l=ib(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return o.flags&256?(Ar(o),o):(Ar(o),null);if((o.flags&128)!==0)throw Error(a(558))}return On(o),null;case 13:if(d=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(y=Mc(o),d!==null&&d.dehydrated!==null){if(s===null){if(!y)throw Error(a(318));if(y=o.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[Un]=o}else yl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;On(o),y=!1}else y=ib(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=y),y=!0;if(!y)return o.flags&256?(Ar(o),o):(Ar(o),null)}return Ar(o),(o.flags&128)!==0?(o.lanes=l,o):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=o.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),j=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(j=d.memoizedState.cachePool.pool),j!==y&&(d.flags|=2048)),l!==s&&l&&(o.child.flags|=8192),Wh(o,o.updateQueue),On(o),null);case 4:return fe(),s===null&&M0(o.stateNode.containerInfo),o.flags|=67108864,On(o),null;case 10:return Aa(o.type),On(o),null;case 19:if(wb(o),d=o.memoizedState,d===null)return On(o),null;if(y=(o.flags&128)!==0,j=d.rendering,j===null)if(y)bd(d,!1);else{if(Wn!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(j=Ih(s),j!==null){for(o.flags|=128,bd(d,!1),s=j.updateQueue,o.updateQueue=s,Wh(o,s),o.subtreeFlags=0,s=l,l=o.child;l!==null;)zj(l,s),l=l.sibling;return hd(o,_s.current&1|2),Vt&&Ea(o,d.treeForkCount),o.child}s=s.sibling}d.tail!==null&&ve()>lm&&(o.flags|=128,y=!0,bd(d,!1),o.lanes=4194304)}else{if(!y)if(s=Ih(j),s!==null){if(o.flags|=128,y=!0,s=s.updateQueue,o.updateQueue=s,Wh(o,s),bd(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!j.alternate&&!Vt)return On(o),null}else 2*ve()-d.renderingStartTime>lm&&l!==536870912&&(o.flags|=128,y=!0,bd(d,!1),o.lanes=4194304);d.isBackwards?(j.sibling=o.child,o.child=j):(s=d.last,s!==null?s.sibling=j:o.child=j,d.last=j)}if(d.tail!==null){s=d.tail;e:{for(l=s;l!==null;){if(l.alternate!==null){l=!1;break e}l=l.sibling}l=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=ve(),s.sibling=null,j=_s.current,j=y?j&1|2:j&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!l||Vt?hd(o,j):(l=j,xe(Ps,o),xe(_s,l),qs===null&&(qs=o)),Vt&&Ea(o,d.treeForkCount),s}return On(o),null;case 22:case 23:return Ar(o),vb(),d=o.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(l&536870912)!==0&&(o.flags&128)===0&&(On(o),o.subtreeFlags&6&&(o.flags|=8192)):On(o),l=o.updateQueue,l!==null&&Wh(o,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==l&&(o.flags|=2048),s!==null&&pe(Cl),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),o.memoizedState.cache!==l&&(o.flags|=2048),Aa(os),On(o),null;case 25:return null;case 30:return o.flags|=33554432,On(o),null}throw Error(a(156,o.tag))}function dI(s,o){switch(ob(o),o.tag){case 1:return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return Aa(os),fe(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 26:case 27:case 5:return Oe(o),null;case 31:if(o.memoizedState!==null){if(Ar(o),o.alternate===null)throw Error(a(340));yl()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 13:if(Ar(o),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(a(340));yl()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return wb(o),s=o.flags,s&65536?(o.flags=s&-65537|128,s=o.memoizedState,s!==null&&(s.rendering=null,s.tail=null),o.flags|=4,o):null;case 4:return fe(),null;case 10:return Aa(o.type),null;case 22:case 23:return Ar(o),vb(),s!==null&&pe(Cl),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 24:return Aa(os),null;case 25:return null;default:return null}}function lN(s,o){switch(ob(o),o.tag){case 3:Aa(os),fe();break;case 26:case 27:case 5:Oe(o);break;case 4:fe();break;case 31:o.memoizedState!==null&&Ar(o);break;case 13:Ar(o);break;case 19:wb(o);break;case 10:Aa(o.type);break;case 22:case 23:Ar(o),vb(),s!==null&&pe(Cl);break;case 24:Aa(os)}}function vd(s,o){try{var l=o.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var y=d.next;l=y;do{if((l.tag&s)===s){d=void 0;var j=l.create,I=l.inst;d=j(),I.destroy=d}l=l.next}while(l!==y)}}catch(J){vn(o,o.return,J)}}function ji(s,o,l){try{var d=o.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var j=y.next;d=j;do{if((d.tag&s)===s){var I=d.inst,J=I.destroy;if(J!==void 0){I.destroy=void 0,y=o;var me=l,Ce=J;try{Ce()}catch(ze){vn(y,me,ze)}}}d=d.next}while(d!==j)}}catch(ze){vn(o,o.return,ze)}}function cN(s){var o=s.updateQueue;if(o!==null){var l=s.stateNode;try{Zj(o,l)}catch(d){vn(s,s.return,d)}}}function uN(s,o,l){l.props=Al(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){vn(s,o,d)}}function Ho(s,o){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var y=s.stateNode,j=Ca(s.memoizedProps,y);(y.ref===null||y.ref.name!==j)&&(y.ref=xC(j)),d=y.ref;break;case 7:if(s.stateNode===null){var I=new Ir(s);g(s.child,!1,tP,I,void 0,void 0),s.stateNode=I}d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(J){vn(s,o,J)}}function Ls(s,o){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(y){vn(s,o,y)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(y){vn(s,o,y)}else l.current=null}function Qh(s,o){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&o!==null)for(var l=0;l<o.length;l++)SC(s.stateNode,o[l])}function dN(s){for(var o=s.return;o!==null&&(Zb(o)&&SC(s.stateNode,o.stateNode),!Qb(o));)o=o.return}function yd(s){for(var o=s.return;o!==null&&(Zb(o)&&nP(s.stateNode,o.stateNode),!Qb(o));)o=o.return}function Qb(s){return s.tag===5||s.tag===3||s.tag===27}function Zb(s){return s&&s.tag===7&&s.stateNode!==null}function Jb(s){var o=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(y){vn(s,s.return,y)}}function e0(s,o,l){try{var d=s.stateNode;_I(d,s.type,l,o),d[Os]=o}catch(y){vn(s,s.return,y)}}function fN(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ri(s.type)||s.tag===4}function t0(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||fN(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ri(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function n0(s,o,l,d){var y=s.tag;if(y===5||y===6)y=s.stateNode,o?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(y,o):(o=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,o.appendChild(y),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=er)),Qh(s,d),St=!0;else if(y!==4&&(y===27&&(Qh(s,d),d=null,Ri(s.type)&&(l=s.stateNode,o=null)),s=s.child,s!==null))for(n0(s,o,l,d),s=s.sibling;s!==null;)n0(s,o,l,d),s=s.sibling}function Zh(s,o,l,d){var y=s.tag;if(y===5||y===6)y=s.stateNode,o?l.insertBefore(y,o):l.appendChild(y),Qh(s,d),St=!0;else if(y!==4&&(y===27&&(Qh(s,d),d=null,Ri(s.type)&&(l=s.stateNode)),s=s.child,s!==null))for(Zh(s,o,l,d),s=s.sibling;s!==null;)Zh(s,o,l,d),s=s.sibling}function hN(s){var o=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,y=o.attributes;y.length;)o.removeAttributeNode(y[0]);$s(o,d,l),o[Un]=s,o[Os]=l}catch(j){vn(s,s.return,j)}}var Jh=!1,Mr=null;function mN(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Jh=!0)}var Fo=null;function pN(){var s=Fo;return Fo=null,s}var fr=0;function $c(s,o,l,d,y){return fr=0,gN(s.child,o,l,d,y)}function gN(s,o,l,d,y){for(var j=!1;s!==null;){if(s.tag===5){var I=s.stateNode;if(d!==null){var J=$0(I);d.push(J),J.view&&(j=!0)}else j||$0(I).view&&(j=!0);Jh=!0,pC(I,fr===0?o:o+"_"+fr,l),fr++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&y||gN(s.child,o,l,d,y)&&(j=!0));s=s.sibling}return j}function Go(s,o){for(;s!==null;)s.tag===5?gC(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&o||Go(s.child,o)),s=s.sibling}function em(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(em(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var o=s.memoizedProps;if(o.name==null||o.name==="auto")throw Error(a(544));var l=o.name;o=ka(o.default,o.share),o!=="none"&&($c(s,l,o,null,!1)||Go(s.child,!1))}s=s.sibling}}function s0(s,o){if(s.tag===30){var l=s.stateNode,d=s.memoizedProps,y=Ca(d,l),j=ka(d.default,l.paired?d.share:d.enter);j!=="none"?$c(s,y,j,null,!1)?(em(s),l.paired||o||Yc(s,d.onEnter)):Go(s.child,!1):em(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)s0(s,o),s=s.sibling;else em(s)}function r0(s){if(Mr!==null&&Mr.size!==0){var o=Mr;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var l=s.memoizedProps,d=l.name;if(d!=null&&d!=="auto"){var y=o.get(d);if(y!==void 0){var j=ka(l.default,l.share);if(j!=="none"&&($c(s,d,j,null,!1)?(j=s.stateNode,y.paired=j,j.paired=y,Yc(s,l.onShare)):Go(s.child,!1)),o.delete(d),o.size===0)break}}}r0(s)}s=s.sibling}}}function o0(s){if(s.tag===30){var o=s.memoizedProps,l=Ca(o,s.stateNode),d=Mr!==null?Mr.get(l):void 0,y=ka(o.default,d!==void 0?o.share:o.exit);y!=="none"&&($c(s,l,y,null,!1)?d!==void 0?(y=s.stateNode,d.paired=y,y.paired=d,Mr.delete(l),Yc(s,o.onShare)):Yc(s,o.onExit):Go(s.child,!1)),Mr!==null&&r0(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)o0(s),s=s.sibling;else Mr!==null&&r0(s)}function xN(s){for(s=s.child;s!==null;){if(s.tag===30){var o=s.memoizedProps,l=Ca(o,s.stateNode);o=ka(o.default,o.update),s.flags&=-5,o!=="none"&&$c(s,l,o,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&xN(s);s=s.sibling}}function a0(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var o=s.stateNode;o.paired!==null&&(o.paired=null,Go(s.child,!1))}a0(s)}s=s.sibling}}function tm(s){if(s.tag===30)s.stateNode.paired=null,Go(s.child,!1),a0(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)tm(s),s=s.sibling;else a0(s)}function bN(s){for(s=s.child;s!==null;)s.tag===30?Go(s.child,!1):(s.subtreeFlags&33554432)!==0&&bN(s),s=s.sibling}function i0(s,o,l,d,y,j,I){for(var J=!1;o!==null;){if(o.tag===5){var me=o.stateNode;if(j!==null&&fr<j.length){var Ce=j[fr],ze=$0(me);(Ce.view||ze.view)&&(J=!0);var $e;if($e=(s.flags&4)===0)if(ze.clip)$e=!0;else{$e=Ce.rect;var we=ze.rect;$e=$e.y!==we.y||$e.x!==we.x||$e.height!==we.height||$e.width!==we.width}$e&&(s.flags|=4),ze.abs?ze=!Ce.abs:(Ce=Ce.rect,ze=ze.rect,ze=Ce.height!==ze.height||Ce.width!==ze.width),ze&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&pC(me,fr===0?l:l+"_"+fr,y),J&&(s.flags&4)!==0||(Fo===null&&(Fo=[]),Fo.push(me,fr===0?d:d+"_"+fr,o.memoizedProps)),fr++}else(o.tag!==22||o.memoizedState===null)&&(o.tag===30&&I?s.flags|=o.flags&32:i0(s,o.child,l,d,y,j,I)&&(J=!0));o=o.sibling}return J}function vN(s,o){for(s=s.child;s!==null;){if(s.tag===30){var l=s.memoizedProps,d=s.stateNode,y=Ca(l,d),j=ka(l.default,l.update),I;I=s.memoizedState,s.memoizedState=null,d=s;var J=s.child;fr=0,y=i0(d,J,y,y,j,I,!1),(s.flags&4)!==0&&y&&Yc(s,l.onUpdate)}else(s.subtreeFlags&33554432)!==0&&vN(s);s=s.sibling}}var Cs=!1,mn=!1,qo=!1,l0=!1,yN=typeof WeakSet=="function"?WeakSet:Set,ks=null,Yo=!1,wd=!1,nm=!1,c0=!1;function fI(s,o,l){if(s=s.containerInfo,z0=su,s=Nj(s),Xx(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var y=d.getSelection&&d.getSelection();if(y&&y.rangeCount!==0){d=y.anchorNode;var j=y.anchorOffset,I=y.focusNode;y=y.focusOffset;try{d.nodeType,I.nodeType}catch{d=null;break e}var J=0,me=-1,Ce=-1,ze=0,$e=0,we=s,Me=null;t:for(;;){for(var ot;we!==d||j!==0&&we.nodeType!==3||(me=J+j),we!==I||y!==0&&we.nodeType!==3||(Ce=J+y),we.nodeType===3&&(J+=we.nodeValue.length),(ot=we.firstChild)!==null;)Me=we,we=ot;for(;;){if(we===s)break t;if(Me===d&&++ze===j&&(me=J),Me===I&&++$e===y&&(Ce=J),(ot=we.nextSibling)!==null)break;we=Me,Me=we.parentNode}we=ot}d=me===-1||Ce===-1?null:{start:me,end:Ce}}else d=null}d=d||{start:0,end:0}}else d=null;for(I0={focusedElem:s,selectionRange:d},su=!1,l=(l&335544064)===l,ks=o,o=l?9270:1024;ks!==null;){if(s=ks,l&&(d=s.deletions,d!==null))for(j=0;j<d.length;j++)l&&o0(d[j]);if(s.alternate===null&&(s.flags&2)!==0)l&&mN(s),sm(l);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&l&&o0(d),sm(l);continue}else if(d!==null&&d.memoizedState!==null){l&&mN(s),sm(l);continue}}d=s.child,(s.subtreeFlags&o)!==0&&d!==null?(d.return=s,ks=d):(l&&xN(s),sm(l))}}Mr=null}function sm(s){for(;ks!==null;){var o=ks,l=s,d=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 15:break;case 1:if((y&1024)!==0&&d!==null){l=void 0,y=d.memoizedProps,d=d.memoizedState;var j=o.stateNode;try{var I=Al(o.type,y);l=j.getSnapshotBeforeUpdate(I,d),j.__reactInternalSnapshotBeforeUpdate=l}catch(J){vn(o,o.return,J)}}break;case 3:if((y&1024)!==0){if(d=o.stateNode.containerInfo,l=d.nodeType,l===9)U0(d);else if(l===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":U0(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&d!==null&&(l=Ca(d.memoizedProps,d.stateNode),y=o.memoizedProps,y=ka(y.default,y.update),y!=="none"&&$c(d,l,y,d.memoizedState=[],!0));break;default:if((y&1024)!==0)throw Error(a(163))}if(d=o.sibling,d!==null){d.return=o.return,ks=d;break}ks=o.return}}function wN(s,o,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Ko(s,l),d&4&&vd(5,l);break;case 1:if(Ko(s,l),d&4)if(s=l.stateNode,o===null)try{s.componentDidMount()}catch(I){vn(l,l.return,I)}else{var y=Al(l.type,o.memoizedProps);o=o.memoizedState;try{s.componentDidUpdate(y,o,s.__reactInternalSnapshotBeforeUpdate)}catch(I){vn(l,l.return,I)}}d&64&&cN(l),d&512&&Ho(l,l.return);break;case 3:if(Ko(s,l),d&64&&(s=l.updateQueue,s!==null)){if(o=null,l.child!==null)switch(l.child.tag){case 27:case 5:o=l.child.stateNode;break;case 1:o=l.child.stateNode}try{Zj(s,o)}catch(I){vn(l,l.return,I)}}break;case 27:o===null&&d&4&&hN(l);case 26:case 5:Ko(s,l),o===null&&d&4&&Jb(l),d&512&&Ho(l,l.return);break;case 12:Ko(s,l);break;case 31:Ko(s,l),d&4&&CN(s,l);break;case 13:Ko(s,l),d&4&&kN(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=NI.bind(null,l),oP(s,l))));break;case 22:if(d=l.memoizedState!==null||Cs,!d){var j=o!==null&&o.memoizedState!==null||mn;o=Cs,y=mn,Cs=d,(mn=j)&&!y?(d=2,(l.subtreeFlags&8772)!==0&&(d|=1),To(s,l,d)):Ko(s,l),Cs=o,mn=y}break;case 30:Ko(s,l),d&512&&Ho(l,l.return);break;case 7:d&512&&Ho(l,l.return);default:Ko(s,l)}}function u0(s,o){for(s=s.child;s!==null;)jN(s,o),s=s.sibling}function jN(s,o){switch(s.tag){case 5:case 26:try{var l=s.stateNode;if(o){var d=l.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var y=s.stateNode,j=s.memoizedProps.style,I=j!=null&&j.hasOwnProperty("display")?j.display:null;y.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(me){vn(s,s.return,me)}d0(s,o);break;case 6:try{s.stateNode.nodeValue=o?"":s.memoizedProps,St=!0}catch(me){vn(s,s.return,me)}break;case 18:try{var J=s.stateNode;o?mC(J,!0):mC(s.stateNode,!1)}catch(me){vn(s,s.return,me)}break;case 22:case 23:s.memoizedState===null&&u0(s,o);break;default:u0(s,o)}}function d0(s,o){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var l=s,d=o;switch(l.tag){case 4:jN(l,d);break e;case 22:l.memoizedState===null&&d0(l,d);break e;default:d0(l,d)}}s=s.sibling}}function SN(s){var o=s.alternate;o!==null&&(s.alternate=null,SN(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&vc(o)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Vn=null,hr=!1;function Co(s,o,l){for(l=l.child;l!==null;)NN(s,o,l),l=l.sibling}function NN(s,o,l){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(Se,l)}catch{}switch(l.tag){case 26:mn||Ls(l,o),Co(s,o,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!mn&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:mn||Ls(l,o),yd(l);var d=Vn,y=hr;Ri(l.type)&&(Vn=l.stateNode,hr=!1),Co(s,o,l),EC(l.stateNode,l.type,l.memoizedProps),Vn=d,hr=y;break;case 5:mn||Ls(l,o),yd(l);case 6:if(l.tag===6&&yd(l),d=Vn,y=hr,Vn=null,Co(s,o,l),Vn=d,hr=y,Vn!==null)if(hr)try{(Vn.nodeType===9?Vn.body:Vn.nodeName==="HTML"?Vn.ownerDocument.body:Vn).removeChild(l.stateNode),St=!0}catch(j){vn(l,o,j)}else try{Vn.removeChild(l.stateNode),St=!0}catch(j){vn(l,o,j)}break;case 18:Vn!==null&&(hr?(s=Vn,hC(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),ru(s)):hC(Vn,l.stateNode));break;case 4:d=Vn,y=hr,Vn=l.stateNode.containerInfo,hr=!0,Co(s,o,l),Vn=d,hr=y;break;case 0:case 11:case 14:case 15:ji(2,l,o),mn||ji(4,l,o),Co(s,o,l);break;case 1:mn||(Ls(l,o),d=l.stateNode,typeof d.componentWillUnmount=="function"&&uN(l,o,d)),Co(s,o,l);break;case 21:Co(s,o,l);break;case 22:mn=(d=mn)||l.memoizedState!==null,Co(s,o,l),mn=d;break;case 30:Ls(l,o),Co(s,o,l);break;case 7:mn||Ls(l,o),Co(s,o,l);break;default:Co(s,o,l)}}function CN(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ru(s)}catch(l){vn(o,o.return,l)}}}function kN(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ru(s)}catch(l){vn(o,o.return,l)}}function hI(s){switch(s.tag){case 31:case 13:case 19:var o=s.stateNode;return o===null&&(o=s.stateNode=new yN),o;case 22:return s=s.stateNode,o=s._retryCache,o===null&&(o=s._retryCache=new yN),o;default:throw Error(a(435,s.tag))}}function rm(s,o){var l=hI(s);o.forEach(function(d){if(!l.has(d)){l.add(d);var y=CI.bind(null,s,d);d.then(y,y)}})}function sr(s,o,l){var d=o.deletions;if(d!==null)for(var y=0;y<d.length;y++){var j=d[y],I=s,J=o,me=J;e:for(;me!==null;){switch(me.tag){case 27:if(Ri(me.type)){Vn=me.stateNode,hr=!1;break e}break;case 5:Vn=me.stateNode,hr=!1;break e;case 3:case 4:Vn=me.stateNode.containerInfo,hr=!0;break e}me=me.return}if(Vn===null)throw Error(a(160));NN(I,J,j),Vn=null,hr=!1,I=j.alternate,I!==null&&(I.return=null),j.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)TN(o,s,l),o=o.sibling}var ko=null;function TN(s,o,l){var d=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(y&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var j=0;j<d.length;j++){var I=d[j];I.ref.impl=I.nextImpl}sr(o,s,l),rr(s),y&4&&(ji(3,s,s.return),vd(3,s),ji(5,s,s.return));break;case 1:sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),y&64&&Cs&&(s=s.updateQueue,s!==null&&(o=s.callbacks,o!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:if(j=ko,sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),y&4)if(y=d!==null?d.memoizedState:null,l=s.memoizedState,d===null)if(l===null)if(s.stateNode===null)if(Cs)s.stateNode=uC(s.type,s.memoizedProps,o.containerInfo,s);else{e:{o=s.type,l=s.memoizedProps,y=j.ownerDocument||j;t:switch(o){case"title":d=y.getElementsByTagName("title")[0],(!d||d[cl]||d[Un]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=y.createElement(o),y.head.insertBefore(d,y.querySelector("head > title"))),$s(d,o,l),d[Un]=s,qe(d),o=d;break e;case"link":if(j=zC("link","href",y).get(o+(l.href||""))){for(I=0;I<j.length;I++)if(d=j[I],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(I,1);break t}}d=y.createElement(o),$s(d,o,l),y.head.appendChild(d);break;case"meta":if(j=zC("meta","content",y).get(o+(l.content||""))){for(I=0;I<j.length;I++)if(d=j[I],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(I,1);break t}}d=y.createElement(o),$s(d,o,l),y.head.appendChild(d);break;default:throw Error(a(468,o))}d[Un]=s,qe(d),o=d}s.stateNode=o}else Cs||X0(j,s.type,s.stateNode);else s.stateNode=DC(j,l,s.memoizedProps);else y!==l?(y===null?(o=d.stateNode,o===null||mn||o.parentNode.removeChild(o)):y.count--,l===null?Cs||X0(j,s.type,s.stateNode):DC(j,l,s.memoizedProps)):l===null&&s.stateNode!==null&&e0(s,s.memoizedProps,d.memoizedProps);break;case 27:sr(o,s,l),rr(s),y&512&&(mn||d===null||Ls(d,d.return)),d!==null&&y&4&&e0(s,s.memoizedProps,d.memoizedProps);break;case 5:if(j=qo,qo=!1,sr(o,s,l),qo=j,rr(s),y&512&&(mn||d===null||Ls(d,d.return)),s.flags&32){o=s.stateNode;try{Js(o,""),St=!0}catch(ze){vn(s,s.return,ze)}}y&4&&s.stateNode!=null&&(o=s.memoizedProps,e0(s,o,d!==null?d.memoizedProps:o)),y&1024&&(l0=!0);break;case 6:if(sr(o,s,l),rr(s),y&4){if(s.stateNode===null)throw Error(a(162));o=s.memoizedProps,l=s.stateNode;try{l.nodeValue=o,St=!0}catch(ze){vn(s,s.return,ze)}}break;case 3:if(St=!1,vm=null,j=ko,ko=Ad(o.containerInfo),sr(o,s,l),ko=j,rr(s),y&4&&d!==null&&d.memoizedState.isDehydrated)try{ru(o.containerInfo)}catch(ze){vn(s,s.return,ze)}l0&&(l0=!1,EN(s)),St=!1;break;case 4:y=qo,qo=Cs,d=hs(),j=ko,ko=Ad(s.stateNode.containerInfo),sr(o,s,l),rr(s),ko=j,St&&wd&&(nm=!0),St=d,qo=y;break;case 12:sr(o,s,l),rr(s);break;case 31:sr(o,s,l),rr(s),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 13:sr(o,s,l),rr(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(im=ve()),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 22:j=s.memoizedState!==null,I=d!==null&&d.memoizedState!==null;var J=Cs,me=mn,Ce=qo;Cs=J||j,qo=Ce||j,mn=me||I,sr(o,s,l),mn=me,qo=Ce,Cs=J,rr(s),y&8192&&(o=s.stateNode,o._visibility=j?o._visibility&-2:o._visibility|1,!j||d===null||I||Cs||mn||(o=I||mn,l=Cs,d=mn,Cs=j||Cs,mn=o,Si(s,2),Cs=l,mn=d),!j&&qo||u0(s,j)),y&4&&(o=s.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,rm(s,l))));break;case 19:sr(o,s,l),rr(s),y&4&&(o=s.updateQueue,o!==null&&(s.updateQueue=null,rm(s,o)));break;case 30:y&512&&(mn||d===null||Ls(d,d.return)),y=hs(),j=wd,I=(l&335544064)===l,J=s.memoizedProps,wd=I&&ka(J.default,J.update)!=="none",sr(o,s,l),rr(s),I&&d!==null&&St&&(s.flags|=4),wd=j,St=y;break;case 21:break;case 7:y&512&&(mn||d===null||Ls(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:sr(o,s,l),rr(s)}}function rr(s){var o=s.flags;if(o&2){try{for(var l,d=s.return;d!==null;){if(fN(d)){l=d;break}d=d.return}d=null;for(var y=s.return;y!==null;){if(Zb(y)){var j=y.stateNode;d===null?d=[j]:d.push(j)}if(Qb(y))break;y=y.return}var I=d;if(l==null)throw Error(a(160));switch(l.tag){case 27:var J=l.stateNode,me=t0(s);Zh(s,me,J,I);break;case 5:var Ce=l.stateNode;l.flags&32&&(Js(Ce,""),l.flags&=-33);var ze=t0(s);Zh(s,ze,Ce,I);break;case 3:case 4:var $e=l.stateNode.containerInfo,we=t0(s);n0(s,we,$e,I);break;default:throw Error(a(161))}}catch(Me){vn(s,s.return,Me)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function EN(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var o=s;EN(o),o.tag===5&&o.flags&1024&&(o=o.stateNode,su=!0,o.reset(),su=!1),s=s.sibling}}function Bc(s,o){if(o.subtreeFlags&9270)for(o=o.child;o!==null;)RN(o,s),o=o.sibling;else vN(o)}function RN(s,o){var l=s.alternate;if(l===null)s0(s,!1);else switch(s.tag){case 3:if(c0=Yo=!1,pN(),Bc(o,s),!Yo&&!nm){if(s=Fo,s!==null)for(var d=0;d<s.length;d+=3){l=s[d];var y=s[d+1];gC(l,s[d+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+y+")"})}s=o.containerInfo,s=s.nodeType===9?s.documentElement:s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName===""&&(s.style.viewTransitionName="none",s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),s.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),c0=!0}Fo=null;break;case 5:Bc(o,s);break;case 4:d=Yo,Yo=!1,Bc(o,s),Yo&&(nm=!0),Yo=d;break;case 22:s.memoizedState===null&&(l.memoizedState!==null?s0(s,!1):Bc(o,s));break;case 30:d=Yo,y=pN(),Yo=!1,Bc(o,s),Yo&&(s.flags|=4);var j=s.memoizedProps,I=s.stateNode;o=Ca(j,I),I=Ca(l.memoizedProps,I);var J=ka(j.default,j.update);J==="none"?o=!1:(j=l.memoizedState,l.memoizedState=null,l=s.child,fr=0,o=i0(s,l,o,I,J,j,!0),fr!==(j===null?0:j.length)&&(s.flags|=32)),(s.flags&4)!==0&&o?(Yc(s,s.memoizedProps.onUpdate),Fo=y):y!==null&&(y.push.apply(y,Fo),Fo=y),Yo=(s.flags&32)!==0?!0:d;break;default:Bc(o,s)}}function Ko(s,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)wN(s,o.alternate,o),o=o.sibling}function Si(s,o){for(s=s.child;s!==null;){var l=s,d=o;switch(l.tag){case 0:case 11:case 14:case 15:ji(4,l,l.return),Si(l,d);break;case 1:Ls(l,l.return);var y=l.stateNode;typeof y.componentWillUnmount=="function"&&uN(l,l.return,y),Si(l,d);break;case 27:(d&2)!==0&&EC(l.stateNode,l.type,l.memoizedProps);case 5:Ls(l,l.return),l.tag!==5&&l.tag!==27||yd(l),Si(l,d);break;case 6:yd(l);break;case 26:Ls(l,l.return),y=l.stateNode,l.memoizedState!==null||y===null||mn||y.parentNode.removeChild(y),Si(l,d);break;case 22:l.memoizedState===null&&Si(l,d);break;case 30:Ls(l,l.return),Si(l,d);break;case 7:Ls(l,l.return);default:Si(l,d)}s=s.sibling}}function To(s,o,l){for(l=(o.subtreeFlags&8772)!==0?l:l&-2,o=o.child;o!==null;){var d=o.alternate,y=s,j=o,I=j.flags,J=(l&1)!==0;switch(j.tag){case 0:case 11:case 15:To(y,j,l),vd(4,j);break;case 1:if(To(y,j,l),d=j,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ze){vn(d,d.return,ze)}if(d=j,y=d.updateQueue,y!==null){var me=d.stateNode;try{var Ce=y.shared.hiddenCallbacks;if(Ce!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Ce.length;y++)Qj(Ce[y],me)}catch(ze){vn(d,d.return,ze)}}J&&I&64&&cN(j),Ho(j,j.return);break;case 27:(l&2)!==0&&hN(j);case 5:j.tag!==5&&j.tag!==27||dN(j),To(y,j,l),J&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 6:dN(j);break;case 26:me=j.stateNode,j.memoizedState!==null||me===null||Cs||X0(Ad(me.ownerDocument),j.type,me),To(y,j,l),J&&d===null&&I&4&&Jb(j),Ho(j,j.return);break;case 12:To(y,j,l);break;case 31:To(y,j,l),J&&I&4&&CN(y,j);break;case 13:To(y,j,l),J&&I&4&&kN(y,j);break;case 22:j.memoizedState===null&&To(y,j,l),Ho(j,j.return);break;case 30:To(y,j,l),Ho(j,j.return);break;case 7:Ho(j,j.return);default:To(y,j,l)}o=o.sibling}}function f0(s,o){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(s=o.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&ad(l))}function h0(s,o){s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&ad(s))}function ro(s,o,l,d){var y=(l&335544064)===l;if(o.subtreeFlags&(y?10262:10256))for(o=o.child;o!==null;)AN(s,o,l,d),o=o.sibling;else y&&bN(o)}function AN(s,o,l,d){var y=(l&335544064)===l;y&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&tm(o);var j=o.flags;switch(o.tag){case 0:case 11:case 15:ro(s,o,l,d),j&2048&&vd(9,o);break;case 1:ro(s,o,l,d);break;case 3:ro(s,o,l,d),y&&c0&&(s=s.containerInfo,s=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,s.style.viewTransitionName==="root"&&(s.style.viewTransitionName=""),s=s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName==="none"&&(s.style.viewTransitionName="")),j&2048&&(j=null,o.alternate!==null&&(j=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==j&&(o.refCount++,j!=null&&ad(j)));break;case 12:if(j&2048){ro(s,o,l,d),j=o.stateNode;try{var I=o.memoizedProps,J=I.id,me=I.onPostCommit;typeof me=="function"&&me(J,o.alternate===null?"mount":"update",j.passiveEffectDuration,-0)}catch(Ce){vn(o,o.return,Ce)}}else ro(s,o,l,d);break;case 31:ro(s,o,l,d);break;case 13:ro(s,o,l,d);break;case 23:break;case 22:I=o.stateNode,J=o.alternate,o.memoizedState!==null?(y&&J!==null&&J.memoizedState===null&&tm(J),I._visibility&2?ro(s,o,l,d):jd(s,o)):(y&&J!==null&&J.memoizedState!==null&&tm(o),I._visibility&2?ro(s,o,l,d):(I._visibility|=2,Vc(s,o,l,d,(o.subtreeFlags&10256)!==0||!1))),j&2048&&f0(J,o);break;case 24:ro(s,o,l,d),j&2048&&h0(o.alternate,o);break;case 30:y&&(j=o.alternate,j!==null&&(Go(j.child,!0),Go(o.child,!0))),ro(s,o,l,d);break;default:ro(s,o,l,d)}}function Vc(s,o,l,d,y){for(y=y&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var j=s,I=o,J=l,me=d,Ce=I.flags;switch(I.tag){case 0:case 11:case 15:Vc(j,I,J,me,y),vd(8,I);break;case 23:break;case 22:var ze=I.stateNode;I.memoizedState!==null?ze._visibility&2?Vc(j,I,J,me,y):jd(j,I):(ze._visibility|=2,Vc(j,I,J,me,y)),y&&Ce&2048&&f0(I.alternate,I);break;case 24:Vc(j,I,J,me,y),y&&Ce&2048&&h0(I.alternate,I);break;default:Vc(j,I,J,me,y)}o=o.sibling}}function jd(s,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var l=s,d=o,y=d.flags;switch(d.tag){case 22:jd(l,d),y&2048&&f0(d.alternate,d);break;case 24:jd(l,d),y&2048&&h0(d.alternate,d);break;default:jd(l,d)}o=o.sibling}}var Ml=8192;function Ol(s,o,l){if(s.subtreeFlags&Ml)for(s=s.child;s!==null;)MN(s,o,l),s=s.sibling}function MN(s,o,l){switch(s.tag){case 26:Ol(s,o,l),s.flags&Ml&&(s.memoizedState!==null?vP(l,ko,s.memoizedState,s.memoizedProps):(s=s.stateNode,(o&335544128)===o&&LC(l,s)));break;case 5:Ol(s,o,l),s.flags&Ml&&(s=s.stateNode,(o&335544128)===o&&LC(l,s));break;case 3:case 4:var d=ko;ko=Ad(s.stateNode.containerInfo),Ol(s,o,l),ko=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Ml,Ml=16777216,Ol(s,o,l),Ml=d):Ol(s,o,l));break;case 30:if((s.flags&Ml)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var y=s.stateNode;y.paired=null,Mr===null&&(Mr=new Map),Mr.set(d,y)}Ol(s,o,l);break;default:Ol(s,o,l)}}function ON(s){var o=s.alternate;if(o!==null&&(s=o.child,s!==null)){o.child=null;do o=s.sibling,s.sibling=null,s=o;while(s!==null)}}function Sd(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var l=0;l<o.length;l++){var d=o[l];ks=d,zN(d,s)}ON(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)DN(s),s=s.sibling}function DN(s){switch(s.tag){case 0:case 11:case 15:Sd(s),s.flags&2048&&ji(9,s,s.return);break;case 3:Sd(s);break;case 12:Sd(s);break;case 22:var o=s.stateNode;s.memoizedState!==null&&o._visibility&2&&(s.return===null||s.return.tag!==13)?(o._visibility&=-3,om(s)):Sd(s);break;default:Sd(s)}}function om(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var l=0;l<o.length;l++){var d=o[l];ks=d,zN(d,s)}ON(s)}for(s=s.child;s!==null;){switch(o=s,o.tag){case 0:case 11:case 15:ji(8,o,o.return),om(o);break;case 22:l=o.stateNode,l._visibility&2&&(l._visibility&=-3,om(o));break;default:om(o)}s=s.sibling}}function zN(s,o){for(;ks!==null;){var l=ks;switch(l.tag){case 0:case 11:case 15:ji(8,l,o);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ad(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,ks=d;else e:for(l=s;ks!==null;){d=ks;var y=d.sibling,j=d.return;if(SN(d),d===l){ks=null;break e}if(y!==null){y.return=j,ks=y;break e}ks=j}}}var mI={getCacheForType:function(s){var o=Is(os),l=o.data.get(s);return l===void 0&&(l=s(),o.data.set(s,l)),l},cacheSignal:function(){return Is(os).controller.signal}},pI=typeof WeakMap=="function"?WeakMap:Map,dn=0,An=null,qt=null,Kt=0,bn=0,Or=null,Ni=!1,Uc=!1,m0=!1,Ia=0,Wn=0,Ci=0,Dl=0,am=0,Dr=0,Hc=0,Nd=null,mr=null,p0=!1,im=0,IN=0,lm=1/0,cm=null,ki=null,Fn=0,Eo=null,zl=null,Xo=0,g0=0,x0=null,PN=null,Fc=null,Gc=null,qc=null,Cd=0,um=null;function zr(){return(dn&2)!==0&&Kt!==0?Kt&-Kt:ae.T!==null?T0():fs()}function _N(){if(Dr===0)if((Kt&536870912)===0||Vt){var s=fn;fn<<=1,(fn&3932160)===0&&(fn=262144),Dr=s}else Dr=536870912;return s=Ps.current,s!==null&&(s.flags|=32),Dr}function Yc(s,o){if(o!=null){var l=s.stateNode,d=l.ref;d===null&&(d=l.ref=xC(Ca(s.memoizedProps,l))),Gc===null&&(Gc=[]),Gc.push(o.bind(null,d))}}function pr(s,o,l){(s===An&&(bn===2||bn===9)||s.cancelPendingCommit!==null)&&(Kc(s,0),Ti(s,Kt,Dr,!1)),un(s,l),((dn&2)===0||s!==An)&&(s===An&&((dn&2)===0&&(Dl|=l),Wn===4&&Ti(s,Kt,Dr,!1)),Wo(s))}function LN(s,o,l){if((dn&6)!==0)throw Error(a(327));var d=!l&&(o&127)===0&&(o&s.expiredLanes)===0||tt(s,o),y=d?bI(s,o):v0(s,o,!0),j=d;do{if(y===0){Uc&&!d&&Ti(s,o,0,!1);break}else{if(l=s.current.alternate,j&&!gI(l)){y=v0(s,o,!1),j=!1;continue}if(y===2){if(j=o,s.errorRecoveryDisabledLanes&j)var I=0;else I=s.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){o=I;e:{var J=s;y=Nd;var me=J.current.memoizedState.isDehydrated;if(me&&(Kc(J,I).flags|=256),I=v0(J,I,!1),I!==2&&I!==6){if(m0&&!me){J.errorRecoveryDisabledLanes|=j,Dl|=j,y=4;break e}j=mr,mr=y,j!==null&&(mr===null?mr=j:mr.push.apply(mr,j))}y=I}if(j=!1,y!==2)continue}}if(y===1){Kc(s,0),Ti(s,o,0,!0);break}e:{switch(d=s,j=y,j){case 0:case 1:throw Error(a(345));case 4:if((o&4194048)!==o&&(o&62914560)!==o)break;case 6:Ti(d,o,Dr,!Ni);break e;case 2:mr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(y=im+300-ve(),10<y)){if(Ti(d,o,Dr,!Ni),de(d,0,!0)!==0)break e;Xo=o,d.timeoutHandle=L0($N.bind(null,d,l,mr,cm,p0,o,Dr,Dl,Hc,Ni,j,"Throttled",-0,0),y);break e}$N(d,l,mr,cm,p0,o,Dr,Dl,Hc,Ni,j,null,-0,0)}}break}while(!0);Wo(s)}function $N(s,o,l,d,y,j,I,J,me,Ce,ze,$e,we,Me){s.timeoutHandle=-1;var ot=o.subtreeFlags,mt=(j&335544064)===j;if($e=null,(mt||ot&8192||(ot&16785408)===16785408)&&($e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:er},Mr=null,MN(o,j,$e),mt&&(ot=$e,mt=s.containerInfo,mt=(mt.nodeType===9?mt:mt.ownerDocument).__reactViewTransition,mt!=null&&(ot.count++,ot.waitingForViewTransition=!0,ot=Dd.bind(ot),mt.finished.then(ot,ot))),ot=(j&62914560)===j?im-ve():(j&4194048)===j?IN-ve():0,ot=yP($e,ot),ot!==null)){Xo=j,s.cancelPendingCommit=ot(YN.bind(null,s,o,j,l,d,y,I,J,me,Ce,ze,$e,null,we,Me)),Ti(s,j,I,!Ce);return}YN(s,o,j,l,d,y,I,J,me,Ce,ze,$e)}function gI(s){for(var o=s;;){var l=o.tag;if((l===0||l===11||l===15)&&o.flags&16384&&(l=o.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var y=l[d],j=y.getSnapshot;y=y.value;try{if(!Rr(j(),y))return!1}catch{return!1}}if(l=o.child,o.subtreeFlags&16384&&l!==null)l.return=o,o=l;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ti(s,o,l,d){o=Et(s,o),o&=~am,o&=~Dl,s.suspendedLanes|=o,s.pingedLanes&=~o,d&&(s.warmLanes|=o),d=s.expirationTimes;for(var y=o;0<y;){var j=31-it(y),I=1<<j;d[j]=-1,y&=~I}l!==0&&Jn(s,l,o)}function dm(){return(dn&6)===0?(kd(0),!1):!0}function b0(){if(qt!==null){if(bn===0)var s=qt.return;else s=qt,Ra=wl=null,kb(s),zc=null,cd=0,s=qt;for(;s!==null;)lN(s.alternate,s),s=s.return;qt=null}}function Kc(s,o){var l=s.timeoutHandle;return l!==-1&&(s.timeoutHandle=-1,BI(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Xo=0,b0(),An=s,qt=l=Ta(s.current,null),Kt=o,bn=0,Or=null,Ni=!1,Uc=tt(s,o),m0=!1,Hc=Dr=am=Dl=Ci=Wn=0,mr=Nd=null,p0=!1,Ia=Et(s,o),vh(),l}function BN(s,o){_t=null,ae.H=Fh,o===Dc||o===Ah?(o=Yj(),bn=3):o===hb?(o=Yj(),bn=4):bn=o===Vb?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Or=o,qt===null&&(Wn=1,Gh(s,eo(o,s.current)))}function VN(){var s=Ps.current;return s===null?!0:(Kt&4194048)===Kt?qs===null:(Kt&62914560)===Kt||(Kt&536870912)!==0?s===qs:!1}function UN(){var s=ae.H;return ae.H=Fh,s===null?Fh:s}function HN(){var s=ae.A;return ae.A=mI,s}function fm(){Wn=4,Ni||(Kt&4194048)!==Kt&&Ps.current!==null||(Uc=!0),(Ci&134217727)===0&&(Dl&134217727)===0||An===null||Ti(An,Kt,Dr,!1)}function v0(s,o,l){var d=dn;dn|=2;var y=UN(),j=HN();(An!==s||Kt!==o)&&(cm=null,Kc(s,o)),o=!1;var I=Wn;e:do try{if(bn!==0&&qt!==null){var J=qt,me=Or;switch(bn){case 8:b0(),I=6;break e;case 3:case 2:case 9:case 6:Ps.current===null&&(o=!0);var Ce=bn;if(bn=0,Or=null,Xc(s,J,me,Ce),l&&Uc){I=0;break e}break;default:Ce=bn,bn=0,Or=null,Xc(s,J,me,Ce)}}xI(),I=Wn;break}catch(ze){BN(s,ze)}while(!0);return o&&s.shellSuspendCounter++,Ra=wl=null,dn=d,ae.H=y,ae.A=j,qt===null&&(An=null,Kt=0,vh()),I}function xI(){for(;qt!==null;)FN(qt)}function bI(s,o){var l=dn;dn|=2;var d=UN(),y=HN();An!==s||Kt!==o?(cm=null,lm=ve()+500,Kc(s,o)):Uc=tt(s,o);e:do try{if(bn!==0&&qt!==null){o=qt;var j=Or;t:switch(bn){case 1:bn=0,Or=null,Xc(s,o,j,1);break;case 2:case 9:if(Gj(j)){bn=0,Or=null,GN(o);break}o=function(){bn!==2&&bn!==9||An!==s||(bn=7),Wo(s)},j.then(o,o);break e;case 3:bn=7;break e;case 4:bn=5;break e;case 7:Gj(j)?(bn=0,Or=null,GN(o)):(bn=0,Or=null,Xc(s,o,j,7));break;case 5:var I=null;switch(qt.tag){case 26:I=qt.memoizedState;case 5:case 27:var J=qt;if(I?PC(I):J.stateNode.complete){bn=0,Or=null;var me=J.sibling;if(me!==null)qt=me;else{var Ce=J.return;Ce!==null?(qt=Ce,hm(Ce)):qt=null}break t}}bn=0,Or=null,Xc(s,o,j,5);break;case 6:bn=0,Or=null,Xc(s,o,j,6);break;case 8:b0(),Wn=6;break e;default:throw Error(a(462))}}vI();break}catch(ze){BN(s,ze)}while(!0);return Ra=wl=null,ae.H=d,ae.A=y,dn=l,qt!==null?0:(An=null,Kt=0,vh(),Wn)}function vI(){for(;qt!==null&&!At();)FN(qt)}function FN(s){var o=aN(s.alternate,s,Ia);s.memoizedProps=s.pendingProps,o===null?hm(s):qt=o}function GN(s){var o=s,l=o.alternate;switch(o.tag){case 15:case 0:o=JS(l,o,o.pendingProps,o.type,void 0,Kt);break;case 11:o=JS(l,o,o.pendingProps,o.type.render,o.ref,Kt);break;case 5:kb(o);var d=o;d===Ns&&(Vt?(Ch(d),d.tag===5&&d.stateNode!=null&&(Mn=d.stateNode)):(Ch(d),Vt=!0));default:lN(l,o),o=qt=zj(o,Ia),o=aN(l,o,Ia)}s.memoizedProps=s.pendingProps,o===null?hm(s):qt=o}function Xc(s,o,l,d){Ra=wl=null,kb(o),zc=null,cd=0;var y=o.return;try{if(aI(s,y,o,l,Kt)){Wn=1,Gh(s,eo(l,s.current)),qt=null;return}}catch(j){if(y!==null)throw qt=y,j;Wn=1,Gh(s,eo(l,s.current)),qt=null;return}o.flags&32768?(Vt||d===1?s=!0:Uc||(Kt&536870912)!==0?s=!1:(Ni=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ps.current,d!==null&&d.tag===13&&(d.flags|=16384))),qN(o,s)):hm(o)}function hm(s){var o=s;do{if((o.flags&32768)!==0){qN(o,Ni);return}s=o.return;var l=uI(o.alternate,o,Ia);if(l!==null){qt=l;return}if(o=o.sibling,o!==null){qt=o;return}qt=o=s}while(o!==null);Wn===0&&(Wn=5)}function qN(s,o){do{var l=dI(s.alternate,s);if(l!==null){l.flags&=32767,qt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!o&&(s=s.sibling,s!==null)){qt=s;return}qt=s=l}while(s!==null);Wn=6,qt=null}function YN(s,o,l,d,y,j,I,J,me,Ce,ze,$e){s.cancelPendingCommit=null;do mm();while(Fn!==0);if((dn&6)!==0)throw Error(a(327));if(o!==null){if(o===s.current)throw Error(a(177));s===An&&(qt=An=null,Kt=0),zl=o,Eo=s,Xo=l,x0=y,PN=d,yI(s,o,l,I,J,me,$e)}}function yI(s,o,l,d,y,j,I){var J=o.lanes|o.childLanes;if(g0=J,J|=eb,ns(s,l,J,d,y,j),Gc=null,(l&335544064)===l?(qc=Kz(s),d=10262):(qc=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,kI(Ke,function(){return S0(),null})):(s.callbackNode=null,s.callbackPriority=0),Jh=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=ae.T,ae.T=null,y=ue.p,ue.p=2,j=dn,dn|=4;try{fI(s,o,l)}finally{dn=j,ue.p=y,ae.T=d}}Fn=1,Jh?Fc=qI(I,s.containerInfo,qc,y0,w0,jI,j0,S0,wI):(y0(),w0(),j0())}function wI(s){if(Fn!==0){var o=Eo.onRecoverableError;o(s,{componentStack:null})}}function jI(){Fn===3&&(Fn=0,RN(zl,Eo),Fn=4)}function y0(){if(Fn===1){Fn=0;var s=Eo,o=zl,l=Xo,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=ae.T,ae.T=null;var y=ue.p;ue.p=2;var j=dn;dn|=4;try{wd=nm=!1,TN(o,s,l),l=I0;var I=Nj(s.containerInfo),J=l.focusedElem,me=l.selectionRange;if(I!==J&&J&&J.ownerDocument&&Sj(J.ownerDocument.documentElement,J)){if(me!==null&&Xx(J)){var Ce=me.start,ze=me.end;if(ze===void 0&&(ze=Ce),"selectionStart"in J)J.selectionStart=Ce,J.selectionEnd=Math.min(ze,J.value.length);else{var $e=J.ownerDocument||document,we=$e&&$e.defaultView||window;if(we.getSelection){var Me=we.getSelection(),ot=J.textContent.length,mt=Math.min(me.start,ot),Lt=me.end===void 0?mt:Math.min(me.end,ot);!Me.extend&&mt>Lt&&(I=Lt,Lt=mt,mt=I);var Ne=jj(J,mt),be=jj(J,Lt);if(Ne&&be&&(Me.rangeCount!==1||Me.anchorNode!==Ne.node||Me.anchorOffset!==Ne.offset||Me.focusNode!==be.node||Me.focusOffset!==be.offset)){var Ee=$e.createRange();Ee.setStart(Ne.node,Ne.offset),Me.removeAllRanges(),mt>Lt?(Me.addRange(Ee),Me.extend(be.node,be.offset)):(Ee.setEnd(be.node,be.offset),Me.addRange(Ee))}}}}for($e=[],Me=J;Me=Me.parentNode;)Me.nodeType===1&&$e.push({element:Me,left:Me.scrollLeft,top:Me.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;J<$e.length;J++){var Le=$e[J];Le.element.scrollLeft=Le.left,Le.element.scrollTop=Le.top}}su=!!z0,I0=z0=null}finally{dn=j,ue.p=y,ae.T=d}}s.current=o,Fn=2}}function w0(){if(Fn===2){Fn=0;var s=Eo,o=zl,l=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||l){l=ae.T,ae.T=null;var d=ue.p;ue.p=2;var y=dn;dn|=4;try{wN(s,o.alternate,o)}finally{dn=y,ue.p=d,ae.T=l}}Fn=3}}function j0(){if(Fn===4||Fn===3){Fn=0;var s=Fc;Fc=null,rt();var o=Eo,l=zl,d=Xo,y=PN,j=(d&335544064)===d?10262:10256;if((l.subtreeFlags&j)!==0||(l.flags&j)!==0?Fn=5:(Fn=0,zl=Eo=null,KN(o,o.pendingLanes)),j=o.pendingLanes,j===0&&(ki=null),Fs(d),l=l.stateNode,Ye&&typeof Ye.onCommitFiberRoot=="function")try{Ye.onCommitFiberRoot(Se,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=ae.T,j=ue.p,ue.p=2,ae.T=null;try{for(var I=o.onRecoverableError,J=0;J<y.length;J++){var me=y[J];I(me.value,{componentStack:me.stack})}}finally{ae.T=l,ue.p=j}}if(y=Gc,I=qc,qc=null,y!==null&&(Gc=null,I===null&&(I=[]),s!==null))for(me=0;me<y.length;me++)l=(0,y[me])(I),l!==void 0&&s.finished.finally(l);(Xo&3)!==0&&mm(),Wo(o),j=o.pendingLanes,(d&261930)!==0&&(j&42)!==0?o===um?Cd++:(Cd=0,um=o):(Cd=0,um=null),kd(0)}}function KN(s,o){(s.pooledCacheLanes&=o)===0&&(o=s.pooledCache,o!=null&&(s.pooledCache=null,ad(o)))}function mm(){return Fc!==null&&(Fc.skipTransition(),Fc=null),y0(),w0(),j0(),S0()}function S0(){if(Fn!==5)return!1;var s=Eo,o=g0;g0=0;var l=Fs(Xo),d=ae.T,y=ue.p;try{ue.p=32>l?32:l,ae.T=null,l=x0,x0=null;var j=Eo,I=Xo;if(Fn=0,zl=Eo=null,Xo=0,(dn&6)!==0)throw Error(a(331));var J=dn;if(dn|=4,DN(j.current),AN(j,j.current,I,l),dn=J,kd(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(Se,j)}catch{}return!0}finally{ue.p=y,ae.T=d,KN(s,o)}}function XN(s,o,l){o=eo(l,o),o=Bb(s.stateNode,o,2),s=bi(s,o,2),s!==null&&(un(s,2),Wo(s))}function vn(s,o,l){if(s.tag===3)XN(s,s,l);else for(;o!==null;){if(o.tag===3){XN(o,s,l);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ki===null||!ki.has(d))){s=eo(l,s),l=GS(2),d=bi(o,l,2),d!==null&&(qS(l,d,o,s),un(d,2),Wo(d));break}}o=o.return}}function N0(s,o,l){var d=s.pingCache;if(d===null){d=s.pingCache=new pI;var y=new Set;d.set(o,y)}else y=d.get(o),y===void 0&&(y=new Set,d.set(o,y));y.has(l)||(m0=!0,y.add(l),s=SI.bind(null,s,o,l),o.then(s,s))}function SI(s,o,l){var d=s.pingCache;d!==null&&d.delete(o),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,An===s&&(Kt&l)===l&&((Wn===4||Wn===3&&(Kt&62914560)===Kt&&300>ve()-im)&&(dn&2)===0?Kc(s,0):am|=l,Hc===Kt&&(Hc=0)),Wo(s)}function WN(s,o){o===0&&(o=xn()),s=bl(s,o),s!==null&&(un(s,o),Wo(s))}function NI(s){var o=s.memoizedState,l=0;o!==null&&(l=o.retryLane),WN(s,l)}function CI(s,o){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,y=s.memoizedState;y!==null&&(l=y.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(o),WN(s,l)}function kI(s,o){return Je(s,o)}var Wc=null,Qc=null,C0=!1,pm=!1,k0=!1,Ei=0;function Wo(s){s!==Qc&&s.next===null&&(Qc===null?Wc=Qc=s:Qc=Qc.next=s),pm=!0,C0||(C0=!0,EI())}function kd(s,o){if(!k0&&pm){k0=!0;do for(var l=!1,d=Wc;d!==null;){if(s!==0){var y=d.pendingLanes;if(y===0)var j=0;else{var I=d.suspendedLanes,J=d.pingedLanes;j=(1<<31-it(42|s)+1)-1,j&=y&~(I&~J),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(l=!0,eC(d,j))}else j=Kt,j=de(d,d===An?j:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(j&3)===0||tt(d,j)||(l=!0,eC(d,j));d=d.next}while(l);k0=!1}}function TI(){QN()}function QN(){pm=C0=!1;var s=0;Ei!==0&&$I()&&(s=Ei);for(var o=ve(),l=null,d=Wc;d!==null;){var y=d.next,j=ZN(d,o);j===0?(d.next=null,l===null?Wc=y:l.next=y,y===null&&(Qc=l)):(l=d,(s!==0||(j&3)!==0)&&(pm=!0)),d=y}Fn!==0&&Fn!==5||kd(s),Ei!==0&&(Ei=0)}function ZN(s,o){for(var l=s.suspendedLanes,d=s.pingedLanes,y=s.expirationTimes,j=s.pendingLanes&-62914561;0<j;){var I=31-it(j),J=1<<I,me=y[I];me===-1?((J&l)===0||(J&d)!==0)&&(y[I]=on(J,o)):me<=o&&(s.expiredLanes|=J),j&=~J}if(o=An,l=Kt,l=de(s,s===o?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===o&&(bn===2||bn===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&ct(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||tt(s,l)){if(o=l&-l,o===s.callbackPriority)return o;switch(d!==null&&ct(d),Fs(l)){case 2:case 8:l=xt;break;case 32:l=Ke;break;case 268435456:l=jt;break;default:l=Ke}return d=JN.bind(null,s),l=Je(l,d),s.callbackPriority=o,s.callbackNode=l,o}return d!==null&&d!==null&&ct(d),s.callbackPriority=2,s.callbackNode=null,2}function JN(s,o){if(Fn!==0&&Fn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(mm()&&s.callbackNode!==l)return null;var d=Kt;return d=de(s,s===An?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(LN(s,d,o),ZN(s,ve()),s.callbackNode!=null&&s.callbackNode===l?JN.bind(null,s):null)}function eC(s,o){if(mm())return null;LN(s,o,!0)}function EI(){VI(function(){(dn&6)!==0?Je(Qe,TI):QN()})}function T0(){if(Ei===0){var s=Nl;s===0&&(s=Gt,Gt<<=1,(Gt&261888)===0&&(Gt=256)),Ei=s}return Ei}function tC(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ds(s)}function RI(s,o,l,d,y){if(o==="submit"&&l&&l.stateNode===y){var j=tC((y[Os]||null).action),I=d.submitter;I&&(o=(o=I[Os]||null)?tC(o.formAction):I.getAttribute("formAction"),o!==null&&(j=o,I=null));var J=new ph("action","action",null,d,y);s.push({event:J,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ei!==0){var me=new FormData(y,I);Ib(l,{pending:!0,data:me,method:y.method,action:j},null,me)}}else typeof j=="function"&&(J.preventDefault(),me=new FormData(y,I),Ib(l,{pending:!0,data:me,method:y.method,action:j},j,me))},currentTarget:y}]})}}for(var E0=0;E0<Jx.length;E0++){var R0=Jx[E0],AI=R0.toLowerCase(),MI=R0[0].toUpperCase()+R0.slice(1);No(AI,"on"+MI)}No(Tj,"onAnimationEnd"),No(Ej,"onAnimationIteration"),No(Rj,"onAnimationStart"),No("dblclick","onDoubleClick"),No("focusin","onFocus"),No("focusout","onBlur"),No(Bz,"onTransitionRun"),No(Vz,"onTransitionStart"),No(Uz,"onTransitionCancel"),No(Aj,"onTransitionEnd"),Nn("onMouseEnter",["mouseout","mouseover"]),Nn("onMouseLeave",["mouseout","mouseover"]),Nn("onPointerEnter",["pointerout","pointerover"]),Nn("onPointerLeave",["pointerout","pointerover"]),Bt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Td="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),OI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Td));function nC(s,o){o=(o&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],y=d.event;d=d.listeners;e:{var j=void 0;if(o)for(var I=d.length-1;0<=I;I--){var J=d[I],me=J.instance,Ce=J.currentTarget;if(J=J.listener,me!==j&&y.isPropagationStopped())break e;j=J,y.currentTarget=Ce;try{j(y)}catch(ze){bh(ze)}y.currentTarget=null,j=me}else for(I=0;I<d.length;I++){if(J=d[I],me=J.instance,Ce=J.currentTarget,J=J.listener,me!==j&&y.isPropagationStopped())break e;j=J,y.currentTarget=Ce;try{j(y)}catch(ze){bh(ze)}y.currentTarget=null,j=me}}}}function Yt(s,o){var l=o[Gu];l===void 0&&(l=o[Gu]=new Set);var d=s+"__bubble";l.has(d)||(sC(o,s,2,!1),l.add(d))}function A0(s,o,l){var d=0;o&&(d|=4),sC(l,s,d,o)}var gm="_reactListening"+Math.random().toString(36).slice(2);function M0(s){if(!s[gm]){s[gm]=!0,zt.forEach(function(l){l!=="selectionchange"&&(OI.has(l)||A0(l,!1,s),A0(l,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[gm]||(o[gm]=!0,A0("selectionchange",!1,o))}}function sC(s,o,l,d){switch(qC(o)){case 2:var y=NP;break;case 8:y=CP;break;default:y=Q0}l=y.bind(null,o,l,s),y=void 0,!pl||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),d?y!==void 0?s.addEventListener(o,l,{capture:!0,passive:y}):s.addEventListener(o,l,!0):y!==void 0?s.addEventListener(o,l,{passive:y}):s.addEventListener(o,l,!1)}function O0(s,o,l,d,y){var j=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var I=d.tag;if(I===3||I===4){var J=d.stateNode.containerInfo;if(J===y)break;if(I===4)for(I=d.return;I!==null;){var me=I.tag;if((me===3||me===4)&&I.stateNode.containerInfo===y)return;I=I.return}for(;J!==null;){if(I=So(J),I===null)return;if(me=I.tag,me===5||me===6||me===26||me===27){d=j=I;continue e}J=J.parentNode}}d=d.return}ml(function(){var Ce=j,ze=hl(l),$e=[];e:{var we=Mj.get(s);if(we!==void 0){var Me=ph,ot=s;switch(s){case"keypress":if(hh(l)===0)break e;case"keydown":case"keyup":Me=gz;break;case"focusin":ot="focus",Me=Hx;break;case"focusout":ot="blur",Me=Hx;break;case"beforeblur":case"afterblur":Me=Hx;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Me=aj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Me=rz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Me=wz;break;case Tj:case Ej:case Rj:Me=iz;break;case Aj:Me=Sz;break;case"scroll":case"scrollend":Me=nz;break;case"wheel":Me=Cz;break;case"copy":case"cut":case"paste":Me=cz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Me=lj;break;case"submit":Me=vz;break;case"toggle":case"beforetoggle":Me=Tz}var mt=(o&4)!==0,Lt=!mt&&(s==="scroll"||s==="scrollend"),Ne=mt?we!==null?we+"Capture":null:we;mt=[];for(var be=Ce,Ee;be!==null;){var Le=be;if(Ee=Le.stateNode,Le=Le.tag,Le!==5&&Le!==26&&Le!==27||Ee===null||Ne===null||(Le=Na(be,Ne),Le!=null&&mt.push(Ed(be,Le,Ee))),Lt)break;be=be.return}0<mt.length&&(we=new Me(we,ot,null,l,ze),$e.push({event:we,listeners:mt}))}}if((o&7)===0){e:{if(Me=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",Me&&l!==fl&&(ot=l.relatedTarget||l.fromElement)&&(So(ot)||ot[Nr]))break e;(we||Me)&&(ot=ze.window===ze?ze:(Me=ze.ownerDocument)?Me.defaultView||Me.parentWindow:window,we?(Me=l.relatedTarget||l.toElement,we=Ce,Me=Me?So(Me):null,Me!==null&&(Lt=c(Me),mt=Me.tag,Me!==Lt||mt!==5&&mt!==27&&mt!==6)&&(Me=null)):(we=null,Me=Ce),we!==Me&&(mt=aj,Le="onMouseLeave",Ne="onMouseEnter",be="mouse",(s==="pointerout"||s==="pointerover")&&(mt=lj,Le="onPointerLeave",Ne="onPointerEnter",be="pointer"),Lt=we==null?ot:De(we),Ee=Me==null?ot:De(Me),ot=new mt(Le,be+"leave",we,l,ze),ot.target=Lt,ot.relatedTarget=Ee,Le=null,So(ze)===Ce&&(mt=new mt(Ne,be+"enter",Me,l,ze),mt.target=Ee,mt.relatedTarget=Lt,Le=mt),Lt=Le,mt=we&&Me?R(we,Me,DI):null,we!==null&&rC($e,ot,we,mt,!1),Me!==null&&Lt!==null&&rC($e,Lt,Me,mt,!0)))}e:{if(we=Ce?De(Ce):window,Me=we.nodeName&&we.nodeName.toLowerCase(),Me==="select"||Me==="input"&&we.type==="file")var ut=gj;else if(mj(we))if(xj)ut=_z;else{ut=Iz;var Xt=zz}else Me=we.nodeName,!Me||Me.toLowerCase()!=="input"||we.type!=="checkbox"&&we.type!=="radio"?Ce&&dl(Ce.elementType)&&(ut=gj):ut=Pz;if(ut&&(ut=ut(s,Ce))){pj($e,ut,l,ze);break e}Xt&&Xt(s,we,Ce)}switch(Xt=Ce?De(Ce):window,s){case"focusin":(mj(Xt)||Xt.contentEditable==="true")&&(Cc=Xt,Wx=Ce,sd=null);break;case"focusout":sd=Wx=Cc=null;break;case"mousedown":Qx=!0;break;case"contextmenu":case"mouseup":case"dragend":Qx=!1,Cj($e,l,ze);break;case"selectionchange":if($z)break;case"keydown":case"keyup":Cj($e,l,ze)}var vt;if(Gx)e:{switch(s){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else Nc?fj(s,l)&&(Rt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Rt="onCompositionStart");Rt&&(cj&&l.locale!=="ko"&&(Nc||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&Nc&&(vt=rj()):(ci=ze,Bx="value"in ci?ci.value:ci.textContent,Nc=!0)),Xt=xm(Ce,Rt),0<Xt.length&&(Rt=new ij(Rt,s,null,l,ze),$e.push({event:Rt,listeners:Xt}),vt?Rt.data=vt:(vt=hj(l),vt!==null&&(Rt.data=vt)))),(vt=Rz?Az(s,l):Mz(s,l))&&(Rt=xm(Ce,"onBeforeInput"),0<Rt.length&&(Xt=new ij("onBeforeInput","beforeinput",null,l,ze),$e.push({event:Xt,listeners:Rt}),Xt.data=vt)),RI($e,s,Ce,l,ze)}nC($e,o)})}function Ed(s,o,l){return{instance:s,listener:o,currentTarget:l}}function xm(s,o){for(var l=o+"Capture",d=[];s!==null;){var y=s,j=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||j===null||(y=Na(s,l),y!=null&&d.unshift(Ed(s,y,j)),y=Na(s,o),y!=null&&d.push(Ed(s,y,j))),s.tag===3)return d;s=s.return}return[]}function DI(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function rC(s,o,l,d,y){for(var j=o._reactName,I=[];l!==null&&l!==d;){var J=l,me=J.alternate,Ce=J.stateNode;if(J=J.tag,me!==null&&me===d)break;J!==5&&J!==26&&J!==27||Ce===null||(me=Ce,y?(Ce=Na(l,j),Ce!=null&&I.unshift(Ed(l,Ce,me))):y||(Ce=Na(l,j),Ce!=null&&I.push(Ed(l,Ce,me)))),l=l.return}I.length!==0&&s.push({event:o,listeners:I})}var zI=/\r\n?/g,II=/\u0000|\uFFFD/g;function oC(s){return(typeof s=="string"?s:""+s).replace(zI,`
|
|
50
|
+
`).replace(II,"")}function aC(s,o){return o=oC(o),oC(s)===o}function yn(s,o,l,d,y,j){switch(l){case"children":if(typeof d=="string")o==="body"||o==="textarea"&&d===""||Js(s,d);else if(typeof d=="number"||typeof d=="bigint")o!=="body"&&Js(s,""+d);else return;break;case"className":Cr(s,"class",d);break;case"tabIndex":Cr(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(s,l,d);break;case"style":Tr(s,d,j);return;case"data":if(o!=="object"){Cr(s,"data",d);break}case"src":case"href":if(d===""&&(o!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ds(d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(l==="formAction"?(o!=="input"&&yn(s,o,"name",y.name,y,null),yn(s,o,"formEncType",y.formEncType,y,null),yn(s,o,"formMethod",y.formMethod,y,null),yn(s,o,"formTarget",y.formTarget,y,null)):(yn(s,o,"encType",y.encType,y,null),yn(s,o,"method",y.method,y,null),yn(s,o,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ds(d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=er);return;case"onScroll":d!=null&&Yt("scroll",s);return;case"onScrollEnd":d!=null&&Yt("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));(j!=null?j.__html:void 0)!==l&&(s.innerHTML=l)}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}l=Ds(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":Yt("beforetoggle",s),Yt("toggle",s),Hn(s,"popover",d);break;case"xlinkActuate":ss(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ss(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ss(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ss(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ss(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ss(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ss(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ss(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ss(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Hn(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=Ku.get(l)||l,Hn(s,l,d);else return}St=!0}function D0(s,o,l,d,y,j){switch(l){case"style":Tr(s,d,j);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));(j!=null?j.__html:void 0)!==l&&(s.innerHTML=l)}}break;case"children":if(typeof d=="string")Js(s,d);else if(typeof d=="number"||typeof d=="bigint")Js(s,""+d);else return;break;case"onScroll":d!=null&&Yt("scroll",s);return;case"onScrollEnd":d!=null&&Yt("scrollend",s);return;case"onClick":d!=null&&(s.onclick=er);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Mt.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(y=l.endsWith("Capture"),j=l.slice(2,y?l.length-7:void 0),o=s[Os]||null,o=o!=null?o[l]:null,typeof o=="function"&&s.removeEventListener(j,o,y),typeof d=="function")){typeof o!="function"&&o!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(j,d,y);break e}St=!0,l in s?s[l]=d:d===!0?s.setAttribute(l,""):Hn(s,l,d)}return}St=!0}function $s(s,o,l){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Yt("error",s),Yt("load",s);var d=!1,y=!1,j;for(j in l)if(l.hasOwnProperty(j)){var I=l[j];if(I!=null)switch(j){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:yn(s,o,j,I,l,null)}}y&&yn(s,o,"srcSet",l.srcSet,l,null),d&&yn(s,o,"src",l.src,l,null);return;case"input":Yt("invalid",s);var J=j=I=y=null,me=null,Ce=null;for(d in l)if(l.hasOwnProperty(d)){var ze=l[d];if(ze!=null)switch(d){case"name":y=ze;break;case"type":I=ze;break;case"checked":me=ze;break;case"defaultChecked":Ce=ze;break;case"value":j=ze;break;case"defaultValue":J=ze;break;case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(a(137,o));break;default:yn(s,o,d,ze,l,null)}}ii(s,j,J,me,Ce,I,y,!1);return;case"select":Yt("invalid",s),d=I=j=null;for(y in l)if(l.hasOwnProperty(y)&&(J=l[y],J!=null))switch(y){case"value":j=J;break;case"defaultValue":I=J;break;case"multiple":d=J;default:yn(s,o,y,J,l,null)}o=j,l=I,s.multiple=!!d,o!=null?ur(s,!!d,o,!1):l!=null&&ur(s,!!d,l,!0);return;case"textarea":Yt("invalid",s),j=y=d=null;for(I in l)if(l.hasOwnProperty(I)&&(J=l[I],J!=null))switch(I){case"value":d=J;break;case"defaultValue":y=J;break;case"children":j=J;break;case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(91));break;default:yn(s,o,I,J,l,null)}kr(s,d,y,j);return;case"option":for(me in l)if(l.hasOwnProperty(me)&&(d=l[me],d!=null))switch(me){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:yn(s,o,me,d,l,null)}return;case"dialog":Yt("beforetoggle",s),Yt("toggle",s),Yt("cancel",s),Yt("close",s);break;case"iframe":case"object":Yt("load",s);break;case"video":case"audio":for(d=0;d<Td.length;d++)Yt(Td[d],s);break;case"image":Yt("error",s),Yt("load",s);break;case"details":Yt("toggle",s);break;case"embed":case"source":case"link":Yt("error",s),Yt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ce in l)if(l.hasOwnProperty(Ce)&&(d=l[Ce],d!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:yn(s,o,Ce,d,l,null)}return;default:if(dl(o)){for(ze in l)l.hasOwnProperty(ze)&&(d=l[ze],d!==void 0&&D0(s,o,ze,d,l,void 0));return}}for(J in l)l.hasOwnProperty(J)&&(d=l[J],d!=null&&yn(s,o,J,d,l,null))}var PI={};function _I(s,o,l,d){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,j=null,I=null,J=null,me=null,Ce=null,ze=null;for(Me in l){var $e=l[Me];if(l.hasOwnProperty(Me)&&$e!=null)switch(Me){case"checked":break;case"value":break;case"defaultValue":me=$e;default:d.hasOwnProperty(Me)||yn(s,o,Me,null,d,$e)}}for(var we in d){var Me=d[we];if($e=l[we],d.hasOwnProperty(we)&&(Me!=null||$e!=null))switch(we){case"type":Me!==$e&&(St=!0),j=Me;break;case"name":Me!==$e&&(St=!0),y=Me;break;case"checked":Me!==$e&&(St=!0),Ce=Me;break;case"defaultChecked":Me!==$e&&(St=!0),ze=Me;break;case"value":Me!==$e&&(St=!0),I=Me;break;case"defaultValue":Me!==$e&&(St=!0),J=Me;break;case"children":case"dangerouslySetInnerHTML":if(Me!=null)throw Error(a(137,o));break;default:Me!==$e&&yn(s,o,we,Me,d,$e)}}Gs(s,I,J,me,Ce,ze,j,y);return;case"select":Me=I=J=we=null;for(j in l)if(me=l[j],l.hasOwnProperty(j)&&me!=null)switch(j){case"value":break;case"multiple":Me=me;default:d.hasOwnProperty(j)||yn(s,o,j,null,d,me)}for(y in d)if(j=d[y],me=l[y],d.hasOwnProperty(y)&&(j!=null||me!=null))switch(y){case"value":j!==me&&(St=!0),we=j;break;case"defaultValue":j!==me&&(St=!0),J=j;break;case"multiple":j!==me&&(St=!0),I=j;default:j!==me&&yn(s,o,y,j,d,me)}o=J,l=I,d=Me,we!=null?ur(s,!!l,we,!1):!!d!=!!l&&(o!=null?ur(s,!!l,o,!0):ur(s,!!l,l?[]:"",!1));return;case"textarea":Me=we=null;for(J in l)if(y=l[J],l.hasOwnProperty(J)&&y!=null&&!d.hasOwnProperty(J))switch(J){case"value":break;case"children":break;default:yn(s,o,J,null,d,y)}for(I in d)if(y=d[I],j=l[I],d.hasOwnProperty(I)&&(y!=null||j!=null))switch(I){case"value":y!==j&&(St=!0),we=y;break;case"defaultValue":y!==j&&(St=!0),Me=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==j&&yn(s,o,I,y,d,j)}Sc(s,we,Me);return;case"option":for(var ot in l)if(we=l[ot],l.hasOwnProperty(ot)&&we!=null&&!d.hasOwnProperty(ot))switch(ot){case"selected":s.selected=!1;break;default:yn(s,o,ot,null,d,we)}for(me in d)if(we=d[me],Me=l[me],d.hasOwnProperty(me)&&we!==Me&&(we!=null||Me!=null))switch(me){case"selected":we!==Me&&(St=!0),s.selected=we&&typeof we!="function"&&typeof we!="symbol";break;default:yn(s,o,me,we,d,Me)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var mt in l)we=l[mt],l.hasOwnProperty(mt)&&we!=null&&!d.hasOwnProperty(mt)&&yn(s,o,mt,null,d,we);for(Ce in d)if(we=d[Ce],Me=l[Ce],d.hasOwnProperty(Ce)&&we!==Me&&(we!=null||Me!=null))switch(Ce){case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(a(137,o));break;default:yn(s,o,Ce,we,d,Me)}return;default:if(dl(o)){for(var Lt in l)we=l[Lt],l.hasOwnProperty(Lt)&&we!==void 0&&!d.hasOwnProperty(Lt)&&D0(s,o,Lt,void 0,d,we);for(ze in d)we=d[ze],Me=l[ze],!d.hasOwnProperty(ze)||we===Me||we===void 0&&Me===void 0||D0(s,o,ze,we,d,Me);return}}for(var Ne in l)we=l[Ne],l.hasOwnProperty(Ne)&&we!=null&&!d.hasOwnProperty(Ne)&&yn(s,o,Ne,null,d,we);for($e in d)we=d[$e],Me=l[$e],!d.hasOwnProperty($e)||we===Me||we==null&&Me==null||yn(s,o,$e,we,d,Me)}function iC(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function LI(){if(typeof performance.getEntriesByType=="function"){for(var s=0,o=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var y=l[d],j=y.transferSize,I=y.initiatorType,J=y.duration;if(j&&J&&iC(I)){for(I=0,J=y.responseEnd,d+=1;d<l.length;d++){var me=l[d],Ce=me.startTime;if(Ce>J)break;var ze=me.transferSize,$e=me.initiatorType;ze&&iC($e)&&(me=me.responseEnd,I+=ze*(me<J?1:(J-Ce)/(me-Ce)))}if(--d,o+=8*(j+I)/(y.duration/1e3),s++,10<s)break}}if(0<s)return o/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var z0=null,I0=null;function Rd(s){return s.nodeType===9?s:s.ownerDocument}function lC(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function cC(s,o){if(s===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&o==="foreignObject"?0:s}function uC(s,o,l,d){return l=Rd(l).createElement(s),l[Un]=d,l[Os]=o,$s(l,s,o),qe(l),l}function P0(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var _0=null;function $I(){var s=window.event;return s&&s.type==="popstate"?s===_0?!1:(_0=s,!0):(_0=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,BI=typeof clearTimeout=="function"?clearTimeout:void 0,dC=typeof Promise=="function"?Promise:void 0,fC=typeof requestAnimationFrame=="function"?requestAnimationFrame:L0,VI=typeof queueMicrotask=="function"?queueMicrotask:typeof dC<"u"?function(s){return dC.resolve(null).then(s).catch(UI)}:L0;function UI(s){setTimeout(function(){throw s})}function Ri(s){return s==="head"}function hC(s,o){var l=o,d=0;do{var y=l.nextSibling;if(s.removeChild(l),y&&y.nodeType===8)if(l=y.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(y),ru(o);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")q0(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,q0(l);for(var j=l.firstChild;j;){var I=j.nextSibling,J=j.nodeName;j[cl]||J==="SCRIPT"||J==="STYLE"||J==="LINK"&&j.rel.toLowerCase()==="stylesheet"||l.removeChild(j),j=I}}else l==="body"&&q0(s.ownerDocument.body);l=y}while(l);ru(o)}function mC(s,o){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?o?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(o?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function pC(s,o,l){if(o=CSS.escape(o)!==o?"r-"+btoa(o).replace(/=/g,""):o,s.style.viewTransitionName=o,l!=null&&(s.style.viewTransitionClass=l),l=getComputedStyle(s),l.display==="inline"){if(o=s.getClientRects(),o.length===1)var d=1;else for(var y=d=0;y<o.length;y++){var j=o[y];0<j.width&&0<j.height&&d++}d===1&&(s=s.style,s.display=o.length===1?"inline-block":"block",s.marginTop="-"+l.paddingTop,s.marginBottom="-"+l.paddingBottom)}}function gC(s,o){s=s.style,o=o.style;var l=o!=null?o.hasOwnProperty("viewTransitionName")?o.viewTransitionName:o.hasOwnProperty("view-transition-name")?o["view-transition-name"]:null:null;s.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=o!=null?o.hasOwnProperty("viewTransitionClass")?o.viewTransitionClass:o.hasOwnProperty("view-transition-class")?o["view-transition-class"]:null:null,s.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),s.display==="inline-block"&&(o==null?s.display=s.margin="":(l=o.display,s.display=l==null||typeof l=="boolean"?"":l,l=o.margin,l!=null?s.margin=l:(l=o.hasOwnProperty("marginTop")?o.marginTop:o["margin-top"],s.marginTop=l==null||typeof l=="boolean"?"":l,o=o.hasOwnProperty("marginBottom")?o.marginBottom:o["margin-bottom"],s.marginBottom=o==null||typeof o=="boolean"?"":o)))}function HI(s,o,l){return l=l.ownerDocument.defaultView,{rect:s,abs:o.position==="absolute"||o.position==="fixed",clip:o.clipPath!=="none"||o.overflow!=="visible"||o.filter!=="none"||o.mask!=="none"||o.mask!=="none"||o.borderRadius!=="0px",view:0<=s.bottom&&0<=s.right&&s.top<=l.innerHeight&&s.left<=l.innerWidth}}function $0(s){var o=s.getBoundingClientRect(),l=getComputedStyle(s);return HI(o,l,s)}function FI(s){return s.documentElement.clientHeight}function GI(s){this.addEventListener("load",s),this.addEventListener("error",s)}function qI(s,o,l,d,y,j,I,J,me){var Ce=o.nodeType===9?o:o.ownerDocument;try{var ze=Ce.startViewTransition({update:function(){var we=Ce.defaultView,Me=we.navigation&&we.navigation.transition,ot=Ce.fonts.status;d();var mt=[];if(ot==="loaded"&&(FI(Ce),Ce.fonts.status==="loading"&&mt.push(Ce.fonts.ready)),ot=mt.length,s!==null)for(var Lt=s.suspenseyImages,Ne=0,be=0;be<Lt.length;be++){var Ee=Lt[be];if(!Ee.complete){var Le=Ee.getBoundingClientRect();if(0<Le.bottom&&0<Le.right&&Le.top<we.innerHeight&&Le.left<we.innerWidth){if(Ne+=_C(Ee),Ne>ym){mt.length=ot;break}Ee=new Promise(GI.bind(Ee)),mt.push(Ee)}}}if(0<mt.length)return we=Promise.race([Promise.all(mt),new Promise(function(ut){return setTimeout(ut,500)})]).then(y,y),(Me?Promise.allSettled([Me.finished,we]):we).then(j,j);if(y(),Me)return Me.finished.then(j,j);j()},types:l});Ce.__reactViewTransition=ze;var $e=[];return ze.ready.then(function(){for(var we=Ce.documentElement.getAnimations({subtree:!0}),Me=0;Me<we.length;Me++){var ot=we[Me],mt=ot.effect,Lt=mt.pseudoElement;if(Lt!=null&&Lt.startsWith("::view-transition")){$e.push(ot),ot=mt.getKeyframes();for(var Ne=Lt=void 0,be=!0,Ee=0;Ee<ot.length;Ee++){var Le=ot[Ee],ut=Le.width;if(Lt===void 0)Lt=ut;else if(Lt!==ut){be=!1;break}if(ut=Le.height,Ne===void 0)Ne=ut;else if(Ne!==ut){be=!1;break}delete Le.width,delete Le.height,Le.transform==="none"&&delete Le.transform}be&&Lt!==void 0&&Ne!==void 0&&(mt.setKeyframes(ot),be=getComputedStyle(mt.target,mt.pseudoElement),be.width!==Lt||be.height!==Ne)&&(be=ot[0],be.width=Lt,be.height=Ne,be=ot[ot.length-1],be.width=Lt,be.height=Ne,mt.setKeyframes(ot))}}I()},function(we){Ce.__reactViewTransition===ze&&(Ce.__reactViewTransition=null);try{if(typeof we=="object"&&we!==null)switch(we.name){case"InvalidStateError":(we.message==="View transition was skipped because document visibility state is hidden."||we.message==="Skipping view transition because document visibility state has become hidden."||we.message==="Skipping view transition because viewport size changed."||we.message==="Transition was aborted because of invalid state")&&(we=null)}we!==null&&me(we)}finally{d(),y(),I()}}),ze.finished.finally(function(){for(var we=0;we<$e.length;we++)$e[we].cancel();Ce.__reactViewTransition===ze&&(Ce.__reactViewTransition=null),J()}),ze}catch{return d(),y(),I(),null}}function Il(s,o){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+o+")"}Il.prototype.animate=function(s,o){return o=typeof o=="number"?{duration:o}:T({},o),o.pseudoElement=this._selector,this._scope.animate(s,o)},Il.prototype.getAnimations=function(){for(var s=this._scope,o=this._selector,l=s.getAnimations({subtree:!0}),d=[],y=0;y<l.length;y++){var j=l[y].effect;j!==null&&j.target===s&&j.pseudoElement===o&&d.push(l[y])}return d},Il.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function xC(s){return{name:s,group:new Il("group",s),imagePair:new Il("image-pair",s),old:new Il("old",s),new:new Il("new",s)}}function Ir(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}Ir.prototype.addEventListener=function(s,o,l){var d=null,y=null;if(!(l!=null&&typeof l!="boolean"&&(d=l.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var j=this._eventListeners;if(vC(j,s,o,l)===-1){var I=this,J=o;l!=null&&typeof l!="boolean"&&l.once===!0&&(J=function(me){I.removeEventListener(s,o,l),typeof o=="function"?o.call(this,me):o.handleEvent(me)}),d!==null&&(y=I.removeEventListener.bind(I,s,o,l),d.addEventListener("abort",y,{once:!0}),y=d.removeEventListener.bind(d,"abort",y)),d=Zc(l),j.push({type:s,listener:o,optionsOrUseCapture:l,attachedListener:J,cleanup:y}),g(this._fragmentFiber.child,!1,YI,s,J,d)}this._eventListeners=j}};function YI(s,o,l,d){return S(s).addEventListener(o,l,d),!1}Ir.prototype.removeEventListener=function(s,o,l){var d=this._eventListeners;if(d!==null&&(o=vC(d,s,o,l),o!==-1)){var y=d[o];l=y.attachedListener;var j=y.cleanup;y=Zc(y.optionsOrUseCapture),g(this._fragmentFiber.child,!1,KI,s,l,y),d.splice(o,1),j!==null&&j()}};function KI(s,o,l,d){return S(s).removeEventListener(o,l,d),!1}function Zc(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function bC(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function vC(s,o,l,d){if(s.length===0)return-1;d=bC(d);for(var y=0;y<s.length;y++){var j=s[y];if(j.type===o&&j.listener===l&&bC(j.optionsOrUseCapture)===d)return y}return-1}Ir.prototype.dispatchEvent=function(s){var o=b(this._fragmentFiber);if(o===null)return!0;o=S(o);var l=this._eventListeners;if(l!==null&&0<l.length||!s.bubbles){var d=o.nodeType===9?o.createComment(""):document.createTextNode("");if(l)for(var y=0;y<l.length;y++){var j=l[y];d.addEventListener(j.type,j.attachedListener,Zc(j.optionsOrUseCapture))}if(o.appendChild(d),s=d.dispatchEvent(s),l)for(y=0;y<l.length;y++)j=l[y],d.removeEventListener(j.type,j.attachedListener,Zc(j.optionsOrUseCapture));return o.removeChild(d),s}return o.dispatchEvent(s)},Ir.prototype.focus=function(s){g(this._fragmentFiber.child,!0,yC,s,void 0,void 0)};function yC(s,o){return s.tag===6?!1:(s=S(s),aP(s,o))}Ir.prototype.focusLast=function(s){var o=[];g(this._fragmentFiber.child,!0,B0,o,void 0,void 0);for(var l=o.length-1;0<=l&&!yC(o[l],s);l--);};function B0(s,o){return o.push(s),!1}Ir.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=S(s),s=Rd(s).activeElement,s!==null&&g(this._fragmentFiber.child,!1,XI,s,void 0,void 0))};function XI(s,o){return s.tag===6?!1:(s=S(s),s===o||s.contains(o)?(o.blur(),!0):!1)}Ir.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),g(this._fragmentFiber.child,!1,WI,s,void 0,void 0)};function WI(s,o){return s.tag===6||(s=S(s),o.observe(s)),!1}Ir.prototype.unobserveUsing=function(s){var o=this._observers;if(o!==null&&o.has(s)){o.delete(s),g(this._fragmentFiber.child,!1,QI,s,void 0,void 0);for(var l=o=0;l<Ro.length;l++){var d=Ro[l];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):Ro[o++]=d}Ro.length=o}};function QI(s,o){return s.tag===6||(s=S(s),o.unobserve(s)),!1}var Ro=[],V0=!1;function ZI(s,o,l){Ro.push({fragmentInstance:s,observer:o,instance:l}),V0||(V0=!0,iP(function(){V0=!1;var d=Ro;Ro=[];for(var y=0;y<d.length;y++){var j=d[y];j.observer.unobserve(j.instance)}}))}Ir.prototype.getClientRects=function(){var s=[];return g(this._fragmentFiber.child,!1,JI,s,void 0,void 0),s};function JI(s,o){if(s.tag===6){s=s.stateNode;var l=s.ownerDocument.createRange();l.selectNodeContents(s),o.push.apply(o,l.getClientRects())}else s=S(s),o.push.apply(o,s.getClientRects());return!1}Ir.prototype.getRootNode=function(s){var o=b(this._fragmentFiber);return o===null?this:S(o).getRootNode(s)},Ir.prototype.compareDocumentPosition=function(s){var o=b(this._fragmentFiber);if(o===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];g(this._fragmentFiber.child,!1,B0,l,void 0,void 0);var d=S(o);if(l.length===0){if(l=d,v(this._fragmentFiber)){e:{for(o=this._fragmentFiber.return;o!==null;){if(o.tag===4){o=o.stateNode.containerInfo;break e}if(o.tag===3||o.tag===5||o.tag===27)break;o=o.return}o=null}o!=null&&(l=o)}o=this._fragmentFiber;var y=d=l.compareDocumentPosition(s);return l===s?y=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=w(o)[1],l===null?y=Node.DOCUMENT_POSITION_PRECEDING:(s=S(l).compareDocumentPosition(s),y=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),y|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}o=S(l[0]),y=S(l[l.length-1]);var j=v(this._fragmentFiber)?o.parentElement:d;if(j==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=j.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY,j=j.compareDocumentPosition(y)&Node.DOCUMENT_POSITION_CONTAINED_BY;var I=o.compareDocumentPosition(s),J=y.compareDocumentPosition(s),me=I&Node.DOCUMENT_POSITION_CONTAINED_BY||J&Node.DOCUMENT_POSITION_CONTAINED_BY;return J=d&&j&&I&Node.DOCUMENT_POSITION_FOLLOWING&&J&Node.DOCUMENT_POSITION_PRECEDING,o=d&&o===s||j&&y===s||me||J?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&o===s||!j&&y===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:I,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||eP(o,this._fragmentFiber,l[0],l[l.length-1],s)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function eP(s,o,l,d,y){var j=So(y);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!j)e:{for(;j!==null;){if(j.tag===7&&(j===o||j.alternate===o)){l=!0;break e}j=j.return}l=!1}return l}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(j===null)return j=y.ownerDocument,y===j||y===j.documentElement||y===j.body;e:{for(j=o,o=b(o);j!==null;){if(!(j.tag!==5&&j.tag!==3&&j.tag!==27||j!==o&&j.alternate!==o)){j=!0;break e}j=j.return}j=!1}return j}return s&Node.DOCUMENT_POSITION_PRECEDING?((o=!!j)&&!(o=j===l)&&(o=R(l,j,M),o===null?o=!1:(g(o,!0,k,j,l),j=N,N=null,o=j!==null)),o):s&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!j)&&!(o=j===d)&&(o=R(d,j,M),o===null?o=!1:(g(o,!0,A,j,d),j=N,E=N=null,o=j!==null)),o):!1}function wC(s,o){var l=s.ownerDocument.createRange();l.selectNodeContents(s),s=l.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,o?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}Ir.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(a(566));var o=[];g(this._fragmentFiber.child,!1,B0,o,void 0,void 0);var l=s!==!1;if(o.length===0){var d=w(this._fragmentFiber);if(d=l?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=S(d),wC(s,l);return}if(d=S(d),d.nodeType!==9){if(d.nodeType===11){l="host"in d?d.host:null,l!==null&&l.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=l?o.length-1:0;d!==(l?-1:o.length);){var y=o[d];y.tag===6?(y=S(y),wC(y,l)):S(y).scrollIntoView(s),d+=l?-1:1}};function tP(s,o){return s=S(s),jC(s,o),!1}function jC(s,o){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(o)}function SC(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var y=l[d];s.addEventListener(y.type,y.attachedListener,Zc(y.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){for(var I=0,J=0;J<Ro.length;J++){var me=Ro[J];(me.fragmentInstance!==o||me.observer!==j||me.instance!==s)&&(Ro[I++]=me)}Ro.length=I,j.observe(s)}),jC(s,o))}function nP(s,o){var l=o._eventListeners;if(l!==null)for(var d=0;d<l.length;d++){var y=l[d];s.removeEventListener(y.type,y.attachedListener,Zc(y.optionsOrUseCapture))}s.nodeType!==3&&(l=o._observers,l!==null&&l.forEach(function(j){typeof j.rootMargin=="string"?ZI(o,j,s):j.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(o))}function U0(s){var o=s.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var l=o;switch(o=o.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":U0(l),vc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function sP(s,o,l,d){for(;s.nodeType===1;){var y=l;if(s.nodeName.toLowerCase()!==o.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[cl])switch(o){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(j=s.getAttribute("rel"),j==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(j!==y.rel||s.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||s.getAttribute("title")!==(y.title==null?null:y.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(j=s.getAttribute("src"),(j!==(y.src==null?null:y.src)||s.getAttribute("type")!==(y.type==null?null:y.type)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&j&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(o==="input"&&s.type==="hidden"){var j=y.name==null?null:""+y.name;if(y.type==="hidden"&&s.getAttribute("name")===j)return s}else return s;if(s=oo(s.nextSibling),s===null)break}return null}function rP(s,o,l){if(o==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=oo(s.nextSibling),s===null))return null;return s}function NC(s,o){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=oo(s.nextSibling),s===null))return null;return s}function H0(s){return s.data==="$?"||s.data==="$~"}function F0(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function oP(s,o){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=o;else if(s.data!=="$?"||l.readyState!=="loading")o();else{var d=function(){o(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function oo(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return s}var G0=null;function CC(s){s=s.nextSibling;for(var o=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(o===0)return oo(s.nextSibling);o--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||o++}s=s.nextSibling}return null}function kC(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(o===0)return s;o--}else l!=="/$"&&l!=="/&"||o++}s=s.previousSibling}return null}function aP(s,o){function l(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",l,!0),(s.focus||HTMLElement.prototype.focus).call(s,o)}finally{s.ownerDocument.removeEventListener("focus",l,!0)}return d}function iP(s){fC(function(){fC(function(o){return s(o)})})}function TC(s,o,l){switch(o=Rd(l),s){case"html":if(s=o.documentElement,!s)throw Error(a(452));return s;case"head":if(s=o.head,!s)throw Error(a(453));return s;case"body":if(s=o.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function EC(s,o,l){for(var d in l){var y=l[d];l.hasOwnProperty(d)&&y!=null&&yn(s,o,d,null,PI,y)}l.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===er&&(s.onclick=null),vc(s)}function q0(s){for(var o=s.attributes;o.length;)s.removeAttributeNode(o[0]);vc(s)}var ao=new Map,RC=new Set;function Ad(s){if(typeof s.getRootNode=="function"){var o=s.getRootNode();if(o.nodeType===9||o.nodeType===11)return o}return s.nodeType===9?s:s.ownerDocument}var Pa=ue.d;ue.d={f:lP,r:cP,D:uP,C:dP,L:fP,m:hP,X:pP,S:mP,M:gP};function lP(){var s=Pa.f(),o=dm();return s||o}function cP(s){var o=ul(s);o!==null&&o.tag===5&&o.type==="form"?MS(o):Pa.r(s)}var Jc=typeof document>"u"?null:document;function AC(s,o,l){var d=Jc;if(d&&typeof o=="string"&&o){var y=Ln(o);y='link[rel="'+s+'"][href="'+y+'"]',typeof l=="string"&&(y+='[crossorigin="'+l+'"]'),RC.has(y)||(RC.add(y),s={rel:s,crossOrigin:l,href:o},d.querySelector(y)===null&&(o=d.createElement("link"),$s(o,"link",s),qe(o),d.head.appendChild(o)))}}function uP(s){Pa.D(s),AC("dns-prefetch",s,null)}function dP(s,o){Pa.C(s,o),AC("preconnect",s,o)}function fP(s,o,l){Pa.L(s,o,l);var d=Jc;if(d&&s&&o){var y='link[rel="preload"][as="'+Ln(o)+'"]';o==="image"&&l&&l.imageSrcSet?(y+='[imagesrcset="'+Ln(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(y+='[imagesizes="'+Ln(l.imageSizes)+'"]')):y+='[href="'+Ln(s)+'"]';var j=y;switch(o){case"style":j=eu(s);break;case"script":j=tu(s)}if(!(ao.has(j)||(s=T({rel:"preload",href:o==="image"&&l&&l.imageSrcSet?void 0:s,as:o},l),ao.set(j,s),d.querySelector(y)!==null||o==="style"&&d.querySelector(Md(j))||o==="script"&&d.querySelector(Od(j))))){var I=d.createElement("link");$s(I,"link",s),o==="style"&&(I[bc]=!0,I.onload=I.onerror=function(){bt(I)}),qe(I),d.head.appendChild(I)}}}function hP(s,o){Pa.m(s,o);var l=Jc;if(l&&s){var d=o&&typeof o.as=="string"?o.as:"script",y='link[rel="modulepreload"][as="'+Ln(d)+'"][href="'+Ln(s)+'"]',j=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=tu(s)}if(!ao.has(j)&&(s=T({rel:"modulepreload",href:s},o),ao.set(j,s),l.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Od(j)))return}d=l.createElement("link"),$s(d,"link",s),qe(d),l.head.appendChild(d)}}}function mP(s,o,l){Pa.S(s,o,l);var d=Jc;if(d&&s){var y=Ge(d).hoistableStyles,j=eu(s);o=o||"default";var I=y.get(j);if(!I){var J={loading:0,preload:null};if(I=d.querySelector(Md(j)))J.loading=5;else{s=T({rel:"stylesheet",href:s,"data-precedence":o},l),(l=ao.get(j))&&Y0(s,l);var me=I=d.createElement("link");qe(me),$s(me,"link",s),me._p=new Promise(function(Ce,ze){me.onload=Ce,me.onerror=ze}),me.addEventListener("load",function(){J.loading|=1}),me.addEventListener("error",function(){J.loading|=2}),J.loading|=4,bm(I,o,d)}I={type:"stylesheet",instance:I,count:1,state:J},y.set(j,I)}}}function pP(s,o){Pa.X(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,y=tu(s),j=d.get(y);j||(j=l.querySelector(Od(y)),j||(s=T({src:s,async:!0},o),(o=ao.get(y))&&K0(s,o),j=l.createElement("script"),qe(j),$s(j,"link",s),l.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(y,j))}}function gP(s,o){Pa.M(s,o);var l=Jc;if(l&&s){var d=Ge(l).hoistableScripts,y=tu(s),j=d.get(y);j||(j=l.querySelector(Od(y)),j||(s=T({src:s,async:!0,type:"module"},o),(o=ao.get(y))&&K0(s,o),j=l.createElement("script"),qe(j),$s(j,"link",s),l.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(y,j))}}function MC(s,o,l,d){var y=(y=ce.current)?Ad(y):null;if(!y)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=eu(l.href),o=Ge(y).hoistableStyles,d=o.get(l),d||(d={type:"style",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=eu(l.href);var j=Ge(y).hoistableStyles,I=j.get(s);if(I||(y=y.ownerDocument||y,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(s,I),(j=y.querySelector(Md(s)))?j._p||(I.instance=j,I.state.loading=5):(j=ao.get(s),j||(j={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},ao.set(s,j)),xP(y,s,j,I.state))),o&&d===null)throw Error(a(528,""));return I}if(o&&d!==null)throw Error(a(529,""));return null;case"script":return o=l.async,l=l.src,typeof l=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(l=tu(l),o=Ge(y).hoistableScripts,d=o.get(l),d||(d={type:"script",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function eu(s){return'href="'+Ln(s)+'"'}function Md(s){return'link[rel="stylesheet"]['+s+"]"}function OC(s){return T({},s,{"data-precedence":s.precedence,precedence:null})}function xP(s,o,l,d){if(o=s.querySelector('link[rel="preload"][as="style"]['+o+"]")){if(o[bc]!==!0){d.loading=1;return}}else o=s.createElement("link"),o[bc]=!0,o.onload=o.onerror=bt.bind(null,o),$s(o,"link",l),qe(o),s.head.appendChild(o);d.preload=o,o.addEventListener("load",function(){return d.loading|=1}),o.addEventListener("error",function(){return d.loading|=2})}function tu(s){return'[src="'+Ln(s)+'"]'}function Od(s){return"script[async]"+s}function DC(s,o,l){if(o.count++,o.instance===null)switch(o.type){case"style":var d=s.querySelector('style[data-href~="'+Ln(l.href)+'"]');if(d)return o.instance=d,qe(d),d;var y=T({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),qe(d),$s(d,"style",y),bm(d,l.precedence,s),o.instance=d;case"stylesheet":y=eu(l.href);var j=s.querySelector(Md(y));if(j)return o.state.loading|=4,o.instance=j,qe(j),j;d=OC(l),(y=ao.get(y))&&Y0(d,y),j=(s.ownerDocument||s).createElement("link"),qe(j);var I=j;return I._p=new Promise(function(J,me){I.onload=J,I.onerror=me}),$s(j,"link",d),o.state.loading|=4,bm(j,l.precedence,s),o.instance=j;case"script":return j=tu(l.src),(y=s.querySelector(Od(j)))?(o.instance=y,qe(y),y):(d=l,(y=ao.get(j))&&(d=T({},l),K0(d,y)),s=s.ownerDocument||s,y=s.createElement("script"),qe(y),$s(y,"link",d),s.head.appendChild(y),o.instance=y);case"void":return null;default:throw Error(a(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(d=o.instance,o.state.loading|=4,bm(d,l.precedence,s));return o.instance}function bm(s,o,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,j=y,I=0;I<d.length;I++){var J=d[I];if(J.dataset.precedence===o)j=J;else if(j!==y)break}j?j.parentNode.insertBefore(s,j.nextSibling):(o=l.nodeType===9?l.head:l,o.insertBefore(s,o.firstChild))}function Y0(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.title==null&&(s.title=o.title)}function K0(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.integrity==null&&(s.integrity=o.integrity)}var vm=null;function zC(s,o,l){if(vm===null){var d=new Map,y=vm=new Map;y.set(l,d)}else y=vm,d=y.get(l),d||(d=new Map,y.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),y=0;y<l.length;y++){var j=l[y];if(!(j[cl]||j[Un]||s==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var I=j.getAttribute(o)||"";I=s+I;var J=d.get(I);J?J.push(j):d.set(I,[j])}}return d}function X0(s,o,l){s=s.ownerDocument||s,s.head.insertBefore(l,o==="title"?s.querySelector("head > title"):null)}function bP(s,o,l){if(l===1||o.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return s=o.disabled,typeof o.precedence=="string"&&s==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function IC(s,o){return s==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function PC(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function _C(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function LC(s,o){typeof o.decode=="function"&&(s.imgCount++,o.complete||(s.imgBytes+=_C(o),s.suspenseyImages.push(o)),s=wP.bind(s),o.decode().then(s,s))}function vP(s,o,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var y=eu(d.href),j=o.querySelector(Md(y));if(j){o=j._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(s.count++,s=Dd.bind(s),o.then(s,s)),l.state.loading|=4,l.instance=j,qe(j);return}j=o.ownerDocument||o,d=OC(d),(y=ao.get(y))&&Y0(d,y),j=j.createElement("link"),qe(j);var I=j;I._p=new Promise(function(J,me){I.onload=J,I.onerror=me}),$s(j,"link",d),l.instance=j}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,o),(o=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Dd.bind(s),o.addEventListener("load",l),o.addEventListener("error",l))}}var ym=0;function yP(s,o){return s.stylesheets&&s.count===0&&jm(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&jm(s,s.stylesheets),s.unsuspend){var j=s.unsuspend;s.unsuspend=null,j()}},6e4+o);0<s.imgBytes&&ym===0&&(ym=62500*LI());var y=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&jm(s,s.stylesheets),s.unsuspend)){var j=s.unsuspend;s.unsuspend=null,j()}},(s.imgBytes>ym?50:800)+o);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function $C(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)jm(s,s.stylesheets);else if(s.unsuspend){var o=s.unsuspend;s.unsuspend=null,o()}}}function Dd(){this.count--,$C(this)}function wP(){this.imgCount--,$C(this)}var wm=null;function jm(s,o){s.stylesheets=null,s.unsuspend!==null&&(s.count++,wm=new Map,o.forEach(jP,s),wm=null,Dd.call(s))}function jP(s,o){if(!(o.state.loading&4)){var l=wm.get(s);if(l)var d=l.get(null);else{l=new Map,wm.set(s,l);for(var y=s.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<y.length;j++){var I=y[j];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(l.set(I.dataset.precedence,I),d=I)}d&&l.set(null,d)}y=o.instance,I=y.getAttribute("data-precedence"),j=l.get(I)||d,j===d&&l.set(null,y),l.set(I,y),this.count++,d=Dd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),j?j.parentNode.insertBefore(y,j.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(y,s.firstChild)),o.state.loading|=4}}var nu={$$typeof:U,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function SP(s,o,l,d,y,j,I,J,me){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Wt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wt(0),this.hiddenUpdates=Wt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=j,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=me,this.transitionTypes=null,this.incompleteTransitions=new Map}function BC(s,o,l,d,y,j,I,J,me,Ce,ze,$e){return s=new SP(s,o,l,I,me,Ce,ze,$e,J),o=1,j===!0&&(o|=24),j=dr(3,null,null,o),s.current=j,j.stateNode=s,o=ub(),o.refCount++,s.pooledCache=o,o.refCount++,j.memoizedState={element:d,isDehydrated:l,cache:o},mb(j),s}function VC(s){return s?(s=Ec,s):Ec}function UC(s,o,l,d,y,j){y=VC(y),d.context===null?d.context=y:d.pendingContext=y,d=xi(o),d.payload={element:l},j=j===void 0?null:j,j!==null&&(d.callback=j),l=bi(s,d,o),l!==null&&(pr(l,s,o),ud(l,s,o))}function HC(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<o?l:o}}function W0(s,o){HC(s,o),(s=s.alternate)&&HC(s,o)}function FC(s){if(s.tag===13||s.tag===31){var o=bl(s,67108864);o!==null&&pr(o,s,67108864),W0(s,67108864)}}function GC(s){if(s.tag===13||s.tag===31){var o=zr();o=cr(o);var l=bl(s,o);l!==null&&pr(l,s,o),W0(s,o)}}var su=!0;function NP(s,o,l,d){var y=ae.T;ae.T=null;var j=ue.p;try{ue.p=2,Q0(s,o,l,d)}finally{ue.p=j,ae.T=y}}function CP(s,o,l,d){var y=ae.T;ae.T=null;var j=ue.p;try{ue.p=8,Q0(s,o,l,d)}finally{ue.p=j,ae.T=y}}function Q0(s,o,l,d){if(su){var y=Z0(d);if(y===null)O0(s,o,d,Sm,l),YC(s,d);else if(TP(y,s,o,l,d))d.stopPropagation();else if(YC(s,d),o&4&&-1<kP.indexOf(s)){for(;y!==null;){var j=ul(y);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var I=Kn(j.pendingLanes);if(I!==0){var J=j;for(J.pendingLanes|=2,J.entangledLanes|=2;I;){var me=1<<31-it(I);J.entanglements[1]|=me,I&=~me}Wo(j),(dn&6)===0&&(lm=ve()+500,kd(0))}}break;case 31:case 13:J=bl(j,2),J!==null&&pr(J,j,2),dm(),W0(j,2)}if(j=Z0(d),j===null&&O0(s,o,d,Sm,l),j===y)break;y=j}y!==null&&d.stopPropagation()}else O0(s,o,d,null,l)}}function Z0(s){return s=hl(s),J0(s)}var Sm=null;function J0(s){if(Sm=null,s=So(s),s!==null){var o=c(s);if(o===null)s=null;else{var l=o.tag;if(l===13){if(s=u(o),s!==null)return s;s=null}else if(l===31){if(s=f(o),s!==null)return s;s=null}else if(l===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null)}}return Sm=s,null}function qC(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ue()){case Qe:return 2;case xt:return 8;case Ke:case Be:return 32;case jt:return 268435456;default:return 32}default:return 32}}var ev=!1,Ai=null,Mi=null,Oi=null,zd=new Map,Id=new Map,Di=[],kP="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function YC(s,o){switch(s){case"focusin":case"focusout":Ai=null;break;case"dragenter":case"dragleave":Mi=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":zd.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Id.delete(o.pointerId)}}function Pd(s,o,l,d,y,j){return s===null||s.nativeEvent!==j?(s={blockedOn:o,domEventName:l,eventSystemFlags:d,nativeEvent:j,targetContainers:[y]},o!==null&&(o=ul(o),o!==null&&FC(o)),s):(s.eventSystemFlags|=d,o=s.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),s)}function TP(s,o,l,d,y){switch(o){case"focusin":return Ai=Pd(Ai,s,o,l,d,y),!0;case"dragenter":return Mi=Pd(Mi,s,o,l,d,y),!0;case"mouseover":return Oi=Pd(Oi,s,o,l,d,y),!0;case"pointerover":var j=y.pointerId;return zd.set(j,Pd(zd.get(j)||null,s,o,l,d,y)),!0;case"gotpointercapture":return j=y.pointerId,Id.set(j,Pd(Id.get(j)||null,s,o,l,d,y)),!0}return!1}function KC(s){var o=So(s.target);if(o!==null){var l=c(o);if(l!==null){if(o=l.tag,o===13){if(o=u(l),o!==null){s.blockedOn=o,Ms(s.priority,function(){GC(l)});return}}else if(o===31){if(o=f(l),o!==null){s.blockedOn=o,Ms(s.priority,function(){GC(l)});return}}else if(o===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Nm(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var l=Z0(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);fl=d,l.target.dispatchEvent(d),fl=null}else return o=ul(l),o!==null&&FC(o),s.blockedOn=l,!1;o.shift()}return!0}function XC(s,o,l){Nm(s)&&l.delete(o)}function EP(){ev=!1,Ai!==null&&Nm(Ai)&&(Ai=null),Mi!==null&&Nm(Mi)&&(Mi=null),Oi!==null&&Nm(Oi)&&(Oi=null),zd.forEach(XC),Id.forEach(XC)}function Cm(s,o){s.blockedOn===o&&(s.blockedOn=null,ev||(ev=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,EP)))}var km=null;function WC(s){km!==s&&(km=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){km===s&&(km=null);for(var o=0;o<s.length;o+=3){var l=s[o],d=s[o+1],y=s[o+2];if(typeof d!="function"){if(J0(d||l)===null)continue;break}var j=ul(l);j!==null&&(s.splice(o,3),o-=3,Ib(j,{pending:!0,data:y,method:l.method,action:d},d,y))}}))}function ru(s){function o(me){return Cm(me,s)}Ai!==null&&Cm(Ai,s),Mi!==null&&Cm(Mi,s),Oi!==null&&Cm(Oi,s),zd.forEach(o),Id.forEach(o);for(var l=0;l<Di.length;l++){var d=Di[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Di.length&&(l=Di[0],l.blockedOn===null);)KC(l),l.blockedOn===null&&Di.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var y=l[d],j=l[d+1],I=y[Os]||null;if(typeof j=="function")I||WC(l);else if(I){var J=null;if(j&&j.hasAttribute("formAction")){if(y=j,I=j[Os]||null)J=I.formAction;else if(J0(y)!==null)continue}else J=I.action;typeof J=="function"?l[d+1]=J:(l.splice(d,3),d-=3),WC(l)}}}function QC(){function s(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(I){return y=I})},focusReset:"manual",scroll:"manual"})}function o(){y!==null&&(y(),y=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),y!==null&&(y(),y=null)}}}function tv(s){this._internalRoot=s}Tm.prototype.render=tv.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(a(409));var l=o.current,d=zr();UC(l,d,s,o,null,null)},Tm.prototype.unmount=tv.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;UC(s.current,2,null,s,null,null),dm(),o[Nr]=null}};function Tm(s){this._internalRoot=s}Tm.prototype.unstable_scheduleHydration=function(s){if(s){var o=fs();s={blockedOn:null,target:s,priority:o};for(var l=0;l<Di.length&&o!==0&&o<Di[l].priority;l++);Di.splice(l,0,s),l===0&&KC(s)}};var ZC=t.version;if(ZC!=="19.3.0")throw Error(a(527,ZC,"19.3.0"));ue.findDOMNode=function(s){var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=m(o),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var RP={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ae,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Em=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Em.isDisabled&&Em.supportsFiber)try{Se=Em.inject(RP),Ye=Em}catch{}}return Ld.createRoot=function(s,o){if(!i(s))throw Error(a(299));var l=!1,d="",y=VS,j=US,I=HS;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(j=o.onCaughtError),o.onRecoverableError!==void 0&&(I=o.onRecoverableError)),o=BC(s,1,!1,null,null,l,d,null,y,j,I,QC),s[Nr]=o.current,M0(s),new tv(o)},Ld.hydrateRoot=function(s,o,l){if(!i(s))throw Error(a(299));var d=!1,y="",j=VS,I=US,J=HS,me=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onUncaughtError!==void 0&&(j=l.onUncaughtError),l.onCaughtError!==void 0&&(I=l.onCaughtError),l.onRecoverableError!==void 0&&(J=l.onRecoverableError),l.formState!==void 0&&(me=l.formState)),o=BC(s,1,!0,o,l??null,d,y,me,j,I,J,QC),o.context=VC(null),l=o.current,d=zr(),d=cr(d),y=xi(d),y.callback=null,bi(l,y,d),l=d,o.current.lanes=l,un(o,l),Wo(o),s[Nr]=o.current,M0(s),new Tm(o)},Ld.version="19.3.0",Ld}var ck;function QP(){if(ck)return ov.exports;ck=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ov.exports=WP(),ov.exports}var ZP=QP();const JP="modulepreload",e6=function(e){return"/"+e},uk={},by=function(t,r,a){let i=Promise.resolve();if(r&&r.length>0){let u=function(m){return Promise.all(m.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=u(r.map(m=>{if(m=e6(m),m in uk)return;uk[m]=!0;const p=m.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=p?"stylesheet":JP,p||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),p)return new Promise((v,w)=>{b.addEventListener("load",v),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return i.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},t6="openrod.compute-target";function n6(e,t){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");return`${e==="cloud"?"/api/remote/os":"/api/os"}${t}`}let XR="local";const WR=()=>XR;function QR(e){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");XR=e}function s6(e,t){const r=t??null;return{uid:r,revision:e.revision+(e.uid&&e.uid!==r?1:0)}}let ZR=null;const JR=()=>ZR;function dk(e){ZR=typeof e=="string"&&/^[a-f0-9]{16}$/.test(e)?e:null}var fk={projectToken:"phc_t8z9eNB6eJABMR9iLkDbqAZH5wFh7wmjjDqEpAxnPPAU",host:"https://us.i.posthog.com",version:"0.2.1-rc.1",environment:"production",enabled:!0};const r6=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i,hk="openrod.usage.v1",$d="openrod.usage-id.v1",cv="openrod.usage-session.v1",Rm="openrod.terminal-flows.v1",Ks=(...e)=>t=>e.includes(t)?t:void 0,cu=e=>typeof e=="string"&&r6.test(e)?e:void 0,Ui=e=>Number.isFinite(e)&&e>=0?Math.min(Math.round(e),864e5):void 0,uv=e=>typeof e=="boolean"?e:void 0,B1=Ks("sandboxes","activity","groups","egress","ingress","secrets","templates","setups","connections","terminal"),vy=Ks("gateway_connection","sandbox_creation","session_launch"),yy=Ks("local","ssh","cloud","unknown"),mk=Ks("docker_missing","docker_unavailable","openshell_missing","gateway_unavailable","ssh_auth","host_key","runtime_missing","image_build","credentials_missing","setup_import","policy","file_seed","timeout","connection_lost","unknown"),dv={flow:vy,flow_id:cu,attempt:Ui,location_type:yy,launch_target:Ks("browser","terminal","vscode","cursor")},o6=e=>typeof e=="string"?e.trim().slice(0,2e3):void 0,a6=e=>Array.isArray(e)?[...new Set(e.filter(t=>["claude","codex","cursor","pi","antigravity","opencode","aider","copilot","kiro","droid"].includes(t)))].slice(0,12):void 0,pk={creation_mode:Ks("quick","template"),file_source:Ks("empty","folder","repo"),agent_ids:a6,setup_count:Ui,provider_count:Ui,group_count:Ui},gk={telemetry_declined:{},console_opened:{gateway_state:Ks("available","setup_required","unavailable"),first_observed_visit:uv,connection_method:Ks("automatic","manual","existing","unknown")},view_opened:{previous_view:B1},flow_started:{...dv,...pk},flow_step_changed:{...dv,step:Ks("location","configuration","validation","host_selection","connecting","needs_docker","needs_runtime","preparing_tools","building_image","creating","requesting"),state:Ks("entered","blocked"),error_category:mk},flow_finished:{...dv,...pk,outcome:Ks("connected","created","live","handoff_requested","failed","cancelled"),duration_ms:Ui,start_observed:uv,error_category:mk},sandbox_ready:{flow_id:cu,duration_ms:Ui,location_type:yy},feature_used:{feature:Ks("template","setup","network","group","activity","files","sandbox"),action:Ks("built","imported","activated","rule_saved","membership_saved","filter_applied","exported","uploaded","started","stopped","deleted"),count:Ui,location_type:yy},feedback_submitted:{prompt:Ks("general"),category:Ks("general"),text:o6,feedback_only:uv}};function Am(e,t={}){if(!Object.hasOwn(gk,e))return null;if(e==="telemetry_declined")return{};const r={};for(const[a,i]of Object.entries({view:B1,...gk[e]})){const c=i(t[a]);c!==void 0&&(r[a]=c)}return r}const i6=[[/host key/i,"host_key"],[/permission denied|publickey|authentication failed/i,"ssh_auth"],[/docker (engine )?is missing|docker isn.t installed|install docker/i,"docker_missing"],[/docker isn.t running|docker daemon|reach docker|docker.*not available/i,"docker_unavailable"],[/openshell (cli )?is not installed|openshell isn.t installed/i,"openshell_missing"],[/runtime (image|package)|sandbox runtime/i,"runtime_missing"],[/timed out/i,"timeout"],[/gateway/i,"gateway_unavailable"]];function Cu(e){if((e==null?void 0:e.name)==="TimeoutError"||(e==null?void 0:e.status)===504)return"timeout";if((e==null?void 0:e.code)==="GATEWAY_DOCKER_MISMATCH")return"docker_unavailable";const t=typeof(e==null?void 0:e.message)=="string"?e.message:"";for(const[r,a]of i6)if(r.test(t))return a;return(e==null?void 0:e.name)==="TypeError"?"connection_lost":(e==null?void 0:e.status)===502||(e==null?void 0:e.status)===503?"gateway_unavailable":"unknown"}function l6({getStorage:e=()=>window.localStorage,getLocation:t=()=>window.location.href,randomUUID:r=()=>crypto.randomUUID(),now:a=()=>Date.now(),fetch:i=(...m)=>fetch(...m),setTimer:c=setTimeout,clearTimer:u=clearTimeout,replaceLocation:f=m=>window.history.replaceState(window.history.state,"",m),config:h=typeof fk>"u"?{}:fk}={}){let m=!1,p=!1,g=!1,b,v,w=!1,C;const S=h.host==="https://eu.i.posthog.com"?"EU":"US";let N=Object.freeze({available:!1,sharing:null,destination:S});const E=new Set,k=new Map,A=new Set,M=new Map,R=new Map;let T=[],O=0;const D=()=>e(),B=(oe,pe)=>{try{return oe()}catch{return pe}};function F(){O++;for(const[oe,pe]of k)oe.abort(),u(pe);k.clear(),A.clear(),M.clear(),R.clear(),T=[],w=!1,v=void 0,C=void 0}function K(){const oe=new URL(t());return!oe.searchParams.has("token")&&!oe.searchParams.has("handoff")&&!/^#local-(connect|return)=/.test(oe.hash)&&!(h.environment==="development"&&oe.searchParams.has("fleet"))}function $(){return B(()=>m&&p&&!g&&h.enabled===!0&&/^phc_[a-zA-Z0-9]+$/.test(h.projectToken??"")&&["https://us.i.posthog.com","https://eu.i.posthog.com"].includes(h.host)&&K(),!1)}function P(){B(()=>{let oe=null;try{const xe=D().getItem(hk);oe=xe==="yes"?!0:xe==="no"?!1:null}catch{g=!0,F()}oe!==!0&&N.sharing===!0&&F();const pe={available:$(),sharing:oe,destination:S};if(Object.keys(pe).some(xe=>pe[xe]!==N[xe])){N=Object.freeze(pe);for(const xe of E)B(xe)}})}function U({enabled:oe=!1,mode:pe="local"}={}){B(()=>{m=pe==="local",p=oe,(!m||!oe)&&F(),P()})}function H(oe){B(()=>{try{if(D().setItem(hk,oe?"yes":"no"),!oe){for(const pe of[$d,cv,Rm])D().removeItem(pe);F()}}catch{g=!0,F()}P()})}function W(){return B(()=>{if(P(),N.sharing===!1)return!1;const oe=N.available;return H(!1),oe&&N.sharing===!1&&Z("telemetry_declined",{},{explicitDecline:!0})},!1)}function q(){const oe=D();let pe=cu(oe.getItem($d)),xe;C??(C=!pe),pe||(pe=r(),oe.setItem($d,pe));try{xe=JSON.parse(oe.getItem(cv))}catch{}return(!cu(xe==null?void 0:xe.id)||!Number.isFinite(xe==null?void 0:xe.at)||a()-xe.at>18e5)&&(xe={id:r()}),oe.setItem(cv,JSON.stringify({id:xe.id,at:a()})),{id:pe,session:xe.id,first:C}}function Z(oe,pe={},{explicitFeedback:xe=!1,explicitDecline:je=!1}={}){return B(()=>{P();const Ie=je&&oe==="telemetry_declined"&&N.sharing===!1;if(oe==="telemetry_declined"&&!Ie||!N.available||N.sharing!==!0&&!Ie&&!(xe&&oe==="feedback_submitted"))return!1;const ce=Am(oe,pe);if(!ce)return!1;const Te=N.sharing===!0;let re;try{re=Te?q():{id:r()}}catch{return g=!0,F(),P(),!1}if(T=T.filter(he=>a()-he<6e4),k.size>=6||T.length>=120)return!1;const fe=new AbortController,Re=c(()=>{fe.abort(),k.delete(fe)},3e3);k.set(fe,Re),T.push(a());const Oe={api_key:h.projectToken,event:oe,distinct_id:re.id,timestamp:new Date(a()).toISOString(),properties:{schema_version:1,app_version:h.version,environment:h.environment,...Te&&re.session?{$session_id:re.session}:{},...Te&&b?{view:b}:{},...ce,$process_person_profile:!1,...Te?{}:{$geoip_disable:!0},...oe==="console_opened"?{first_observed_visit:re.first}:{},...xe?{feedback_only:!Te}:{}}},ke=()=>{u(Re),k.delete(fe)};oe==="console_opened"&&(C=!1);try{Promise.resolve(i(`${h.host}/i/v0/e/`,{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(Oe),signal:fe.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-store",redirect:"error",keepalive:!0})).then(ke,ke)}catch{ke()}return!0},!1)}function z(oe){B(()=>{w||!["live","setup-required","gateway-down"].includes(oe)||Z("console_opened",{gateway_state:oe==="live"?"available":oe==="setup-required"?"setup_required":"unavailable",connection_method:"existing"})&&(w=!0)})}function L(oe){B(()=>{b=B1(oe),b&&b!==v&&Z("view_opened",{previous_view:v})&&(v=b)})}function X(oe,pe={},xe=null){return B(()=>{if(P(),!N.available||N.sharing!==!0||!vy(oe))return null;const je=q().id;((xe==null?void 0:xe.generation)!==O||(xe==null?void 0:xe.installationId)!==je||(xe==null?void 0:xe.flow)!==oe)&&(xe=null),xe&&xe.outcome!=="failed"&&xe.started!==null&&(xe.outcome||Y(xe,"cancelled"),xe=null);const Ie={generation:O,installationId:je,id:(xe==null?void 0:xe.id)??r(),flow:oe,attempt:((xe==null?void 0:xe.attempt)??0)+1,started:a(),properties:Am("flow_started",pe)};return Z("flow_started",{...Ie.properties,flow:oe,flow_id:Ie.id,attempt:Ie.attempt}),G(Ie,oe==="session_launch"?"requesting":oe==="gateway_connection"?"connecting":"preparing_tools"),Ie},null)}function ee(oe,pe={}){return B(()=>(P(),!N.available||N.sharing!==!0||!vy(oe)?null:{generation:O,installationId:q().id,id:r(),flow:oe,attempt:0,started:null,properties:Am("flow_started",pe)}),null)}const _=oe=>oe&&oe.generation===O&&N.available&&N.sharing===!0&&cu(oe.installationId)&&oe.installationId===D().getItem($d),V=oe=>({...oe.properties,flow:oe.flow,flow_id:oe.id,attempt:oe.attempt});function G(oe,pe,xe="entered",je){B(()=>{if(P(),!_(oe))return;const Ie=`${oe.id}:${oe.attempt}`,ce=`${pe}:${xe}:${je}`;M.get(Ie)!==ce&&(M.size>=100&&M.delete(M.keys().next().value),M.set(Ie,ce),Z("flow_step_changed",{...V(oe),step:pe,state:xe,error_category:je}))})}function Y(oe,pe,xe){B(()=>{if(P(),!_(oe))return;const je=`${oe.id}:${oe.attempt}`;A.has(je)||(A.size>=200&&A.delete(A.values().next().value),A.add(je),M.delete(je),oe.outcome=pe,Z("flow_finished",{...V(oe),outcome:pe,start_observed:oe.started!==null,duration_ms:oe.started===null?void 0:a()-oe.started,error_category:xe}))})}function ne(oe){B(()=>{if(P(),!_(oe))return;const pe=`${oe.id}:ready`;A.has(pe)||(A.size>=200&&A.delete(A.values().next().value),A.add(pe),Z("sandbox_ready",{flow_id:oe.id,duration_ms:a()-oe.started,location_type:oe.properties.location_type}))})}function te(oe){return Z("feedback_submitted",oe,{explicitFeedback:!0})}function ye(oe,pe={}){B(()=>{const xe=X("session_launch",{...pe,launch_target:"browser"});if(P(),!_(xe))return;const je=new URL(oe.currentTarget.href),[Ie,ce=""]=je.hash.split("?"),Te=new URLSearchParams(ce);Te.set("analyticsFlow",xe.id),je.hash=`${Ie}?${Te}`;try{const re=ue();re.push(xe),D().setItem(Rm,JSON.stringify(re.slice(-20))),oe.currentTarget.href=je.href}catch{}})}function ae(oe,pe){try{D().setItem(Rm,JSON.stringify(oe.filter(xe=>xe.id!==pe)))}catch{}B(()=>{const xe=new URL(t()),[je,Ie=""]=xe.hash.split("?"),ce=new URLSearchParams(Ie);ce.delete("analyticsFlow"),xe.hash=ce.toString()?`${je}?${ce}`:je,f(xe.href)})}function ue(){let oe=[];try{oe=JSON.parse(D().getItem(Rm)||"[]")}catch{}return Array.isArray(oe)?oe.filter(pe=>cu(pe.id)&&pe.flow==="session_launch"&&Number.isFinite(pe.started)&&a()-pe.started<18e5).slice(-20):[]}function se(oe,pe){return B(()=>{if(P(),!N.available||N.sharing!==!0)return null;if(pe)return X("session_launch",oe,pe);const xe=new URLSearchParams(new URL(t()).hash.split("?")[1]).get("analyticsFlow"),je=q().id,Ie=ue(),ce=Ie.find(Te=>Te.id===xe&&Te.installationId===je);return xe&&ae(Ie,xe),ce?{generation:O,installationId:je,id:ce.id,flow:"session_launch",attempt:Ui(ce.attempt)??1,started:ce.started,properties:Am("flow_started",ce.properties)}:X("session_launch",{...oe,launch_target:"browser"})},null)}function Q(oe,pe){B(()=>{if(P(),!(!N.available||N.sharing!==!0)){if(oe.status==="ready"){Z("feature_used",{feature:"template",action:"built",location_type:mf(pe)});return}oe.status==="building"&&(R.size>=100&&R.delete(R.keys().next().value),R.set(JSON.stringify([pe==null?void 0:pe.context,oe.name]),{installationId:q().id,startedAt:oe.startedAt,at:a(),location_type:mf(pe)}))}})}function ie(oe){B(()=>{var pe,xe;for(const je of oe){const Ie=JSON.stringify([(pe=je.location)==null?void 0:pe.context,je.name]),ce=R.get(Ie);if(ce){if(ce.installationId!==D().getItem($d)||a()-ce.at>18e5){R.delete(Ie);continue}je.startedAt&&je.startedAt!==ce.startedAt||((xe=je.location)==null?void 0:xe.connected)===!1||(je.status==="ready"?(R.delete(Ie),Z("feature_used",{feature:"template",action:"built",location_type:ce.location_type})):je.status==="failed"&&R.delete(Ie))}}})}return{configure:U,setSharing:H,declineSharing:W,refresh:P,capture:Z,observeConsole:z,observeView:L,startFlow:X,exploreFlow:ee,step:G,finishFlow:Y,ready:ne,templateStarted:Q,observeTemplates:ie,submitFeedback:te,terminalClick:ye,terminalFlow:se,subscribe:oe=>(E.add(oe),()=>E.delete(oe)),getSnapshot:()=>N,stop:()=>{m=!1,F(),P()}}}const en=l6(),mf=e=>(e==null?void 0:e.target)==="cloud"?"cloud":e!=null&&e.remote?"ssh":"local";function c6(e,t){if(t==="GET"||t===void 0)return;const a=[[/^\/setups\/save$/,"setup","imported"],[/^\/setups\/[^/]+\/enable$/,"setup","activated"],[/^\/egress\/policies$/,"network","rule_saved"],[/^\/org\/members$/,"group","membership_saved"],[/^\/files\/[^/]+\/uploads\/[^/]+\/commit$/,"files","uploaded"],[/^\/sandboxes\/[^/]+\/start$/,"sandbox","started"],[/^\/sandboxes\/[^/]+\/stop$/,"sandbox","stopped"],[/^\/sandboxes\/[^/]+\/delete$/,"sandbox","deleted"]].find(([i])=>i.test(e));a&&en.capture("feature_used",{feature:a[1],action:a[2]})}const $i="CONSOLE_TOKEN_REQUIRED";function lr(e,t,r=null,a=JR()){const i=()=>e??WR(),c=a;let u,f;const h=v=>n6(i(),v),m=v=>t&&v?AbortSignal.any([t,v]):t??v;async function p(){t==null||t.throwIfAborted();const v=await fetch(h("/context"),{signal:t,headers:{...i()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...r?{"x-openshell-context":r,"x-openshell-location":"1"}:{}}}),w=await v.json();if(t==null||t.throwIfAborted(),w.code===$i?window.dispatchEvent(new Event($i)):(v.status===401||w.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!v.ok)throw new Error(w.error??"Could not read gateway registrations.");return u??(u=JSON.stringify([w.gateway,w.workspace])),w}async function g(){return t==null||t.throwIfAborted(),r??(u||(f??(f=p().finally(()=>{f=null})),await f),u)}async function b(v,{method:w="GET",body:C,signal:S,scoped:N=!0,raw:E=!1}={}){const k=m(S);k==null||k.throwIfAborted();const A=N?await g():null;k==null||k.throwIfAborted();const M=await fetch(h(v),{method:w,signal:k,headers:{...i()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...A?{"x-openshell-context":A}:{},...A&&r?{"x-openshell-location":"1"}:{},...w==="GET"?{}:{"content-type":E?"application/octet-stream":"application/json","x-openshell-console":"1"}},body:C===void 0?void 0:E?C:JSON.stringify(C)}),R=await M.json().catch(()=>({}));if(k==null||k.throwIfAborted(),R.code===$i?window.dispatchEvent(new Event($i)):(M.status===401||R.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!M.ok)throw Object.assign(new Error(R.error??`Request failed (${M.status})`),{status:M.status,code:R.code,sandboxes:R.sandboxes,fix:R.fix});return c6(v,w),R}return{target:e,signal:t,path:h,owner:c,url:(v,w={})=>{const C=new URLSearchParams({...w,...i()==="cloud"&&c?{owner:c}:{}});return h(v)+(C.size?"?"+C:"")},forContext:v=>lr(e,t,v,c),inventory:v=>b("/inventory",{signal:v,scoped:!1}),context:p,contextKey:g,capabilities:()=>b("/capabilities",{scoped:!1}),importCapabilities:()=>b("/resource-imports/capabilities"),exportResources:v=>b("/resource-imports/export",{method:"POST",body:v}),planImport:v=>b("/resource-imports/plan",{method:"POST",body:v}),importJobs:()=>b("/resource-imports"),importJob:v=>b(`/resource-imports/${encodeURIComponent(v)}`),executeImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/execute`,{method:"POST",body:{acknowledged:!0}}),retryImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/retry`,{method:"POST",body:{acknowledged:!0}}),cancelImport:v=>b(`/resource-imports/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),connections:v=>b("/connections",{signal:v,scoped:!1}),connectionJob:(v,w)=>b(`/connections/jobs/${encodeURIComponent(v)}`,{signal:w,scoped:!1}),connect:v=>b("/connections/connect",{method:"POST",body:v,scoped:!1}),installConnectionDocker:v=>b(`/connections/jobs/${encodeURIComponent(v)}/docker`,{method:"POST",body:{approve:!0},scoped:!1}),installConnectionRuntime:v=>b(`/connections/jobs/${encodeURIComponent(v)}/install`,{method:"POST",body:{method:"download"},scoped:!1}),uploadConnectionPackage:(v,w)=>b(`/connections/jobs/${encodeURIComponent(v)}/package`,{method:"POST",body:w,raw:!0,scoped:!1}),scanSshHost:v=>b("/connections/hosts/scan",{method:"POST",body:v,scoped:!1}),addSshHost:v=>b("/connections/hosts",{method:"POST",body:{token:v},scoped:!1}),removeSshHost:v=>b("/connections/hosts/remove",{method:"POST",body:{alias:v},scoped:!1}),restoreSshHost:v=>b("/connections/hosts/restore",{method:"POST",body:{host:v},scoped:!1}),forgetRemote:()=>b("/connections/forget",{method:"POST",body:{},scoped:!1}),disconnectRemote:()=>b("/connections/disconnect",{method:"POST",body:{},scoped:!1}),syncLocalCatalog:()=>b("/local-catalog",{method:"POST",body:{}}),gatewayDocker:(v=!1)=>b(`/gateway-docker${v?"?fresh=1":""}`,{scoped:!1}),connectGatewayDocker:(v=[],w=!0)=>b("/gateway-docker/connect",{method:"POST",body:{confirm:w,seen:v},scoped:!1}),undoGatewayDocker:(v=[])=>b("/gateway-docker/undo",{method:"POST",body:{confirm:!0,seen:v},scoped:!1}),setups:()=>b("/setups"),discoverSetups:v=>b("/setups/scan",{method:"POST",body:{sources:v}}),reviewSetup:(v,w)=>b("/setups/review",{method:"POST",body:{token:v,ids:w}}),removeSetupReviewItem:(v,w)=>b("/setups/remove-review-item",{method:"POST",body:{token:v,item:w}}),prepareSetup:(v,w)=>b("/setups/prepare",{method:"POST",body:{token:v,items:w,approved:!0}}),prepareLaunchSetup:(v,w)=>b(`/setups/${v}/prepare-launch`,{method:"POST",body:{revision:w}}),prepareSavedSetup:v=>b(`/setups/${v}/prepare`,{method:"POST",body:{}}),setupPreparation:v=>b(`/setups/preparations/${v}`),cancelSetupPreparation:v=>b(`/setups/preparations/${v}/cancel`,{method:"POST",body:{}}),setupFile:(v,w,C)=>b("/setups/file",{method:"POST",body:{token:v,item:w,path:C}}),saveSetup:(v,w,C)=>b("/setups/save",{method:"POST",body:{token:v,name:w,acknowledged:C}}),deleteSetup:(v,w)=>b(`/setups/${v}/delete`,{method:"POST",body:{revision:w}}),deleteSetupItem:(v,w,C)=>b(`/setups/${v}/delete-item`,{method:"POST",body:{item:w,revision:C}}),previewSetup:(v,w,C)=>b(`/setups/${v}/preview`,{method:"POST",body:{sandbox:w,targets:C}}),enableSetup:(v,w,C,S=!1)=>b(`/setups/${v}/enable`,{method:"POST",body:{sandbox:w,token:C,approveAccess:S}}),removeSetup:(v,w,C)=>b(`/setups/${v}/remove`,{method:"POST",body:{sandbox:w,token:C}}),setupJobs:v=>b(`/setups/${v}/jobs`),cloudExport:v=>b(`/cloud-export?name=${encodeURIComponent(v)}`),importCloud:v=>b("/cloud-import",{method:"POST",body:v}),cloudTransfer:(v,w)=>b("/cloud-transfer",{method:"POST",body:{name:v,ticket:w}}),selectContext:v=>b("/context",{method:"POST",body:v}),previewActivityDeletion:v=>b("/activity/delete-preview",{method:"POST",body:v}),deleteActivity:v=>b("/activity/delete",{method:"POST",body:{token:v}}),activityDestinations:()=>b("/activity-destinations"),createActivityDestination:v=>b("/activity-destinations",{method:"POST",body:v}),activityDestinationAction:(v,w)=>b(`/activity-destinations/${encodeURIComponent(v)}/${w}`,{method:"POST",body:{}}),overview:()=>b("/overview"),sandbox:v=>b(`/sandboxes/${encodeURIComponent(v)}`),activity:(v={})=>b(`/activity?query=${encodeURIComponent(JSON.stringify(v))}`),create:v=>b("/sandboxes",{method:"POST",body:v}),sshConnection:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh`),openSshTerminal:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-open`,{method:"POST",body:{mode:w}}),sshConfig:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-config`,{method:"POST",body:{}}),terminalSession:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/terminal-session`,{method:"POST",body:w}),lifecycle:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/${w}`,{method:"POST",body:{}}),editors:()=>b("/editors"),openEditor:(v,w)=>b(`/sandboxes/${encodeURIComponent(v)}/editor`,{method:"POST",body:{editor:w}}),fleetPolicy:()=>b("/policy/fleet"),policy:v=>b(`/policy/${encodeURIComponent(v)}`),revision:(v,w)=>b(`/policy/${encodeURIComponent(v)}/revisions/${w}`),applyOps:(v,w)=>b(`/policy/${encodeURIComponent(v)}/ops`,{method:"POST",body:{ops:w}}),restore:(v,w)=>b(`/policy/${encodeURIComponent(v)}/restore`,{method:"POST",body:{version:w}}),globalPolicy:()=>b("/policy/global"),removeGlobal:()=>b("/policy/global/remove",{method:"POST",body:{}}),settings:v=>b(`/settings${v?`/${encodeURIComponent(v)}`:""}`),setSetting:v=>b("/settings",{method:"POST",body:v}),secrets:()=>b("/secrets"),createSecret:v=>b("/secrets",{method:"POST",body:v}),rotateSecret:(v,w)=>b(`/secrets/${encodeURIComponent(v)}/rotate`,{method:"POST",body:{credentials:w}}),secretExpiry:(v,w,C)=>b(`/secrets/${encodeURIComponent(v)}/expiry`,{method:"POST",body:{key:w,expiresAt:C}}),deleteSecret:v=>b(`/secrets/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),attachSecret:(v,w,C)=>b(`/secrets/${encodeURIComponent(v)}/${C?"attach":"detach"}`,{method:"POST",body:{sandbox:w}}),importProfile:v=>b("/profiles/import",{method:"POST",body:{id:v}}),deleteTemplates:v=>b("/templates/delete",{method:"POST",body:{ids:v}}),templates:()=>b("/templates"),imageTemplates:()=>b("/image-templates"),localImages:()=>b("/image-templates/local-images"),buildImageTemplate:(v,w=!1)=>b("/image-templates",{method:"POST",body:{recipe:v,replace:w}}),cancelImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),dismissImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/dismiss`,{method:"POST",body:{}}),imageTemplateUsage:v=>b(`/image-templates/${encodeURIComponent(v)}/usage`),deleteImageTemplate:v=>b(`/image-templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),org:()=>b("/org"),saveOrg:v=>b("/org",{method:"POST",body:v}),saveGroup:v=>b("/org/groups",{method:"POST",body:v}),deleteGroup:v=>b(`/org/groups/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),setGroupMembers:(v,w,C="replace")=>b("/org/members",{method:"POST",body:{sandboxes:v,groups:w,mode:C}}),savePolicy:v=>b("/egress/policies",{method:"POST",body:v}),deletePolicy:v=>b(`/egress/policies/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),saveTemplate:v=>b("/templates",{method:"POST",body:v}),deleteTemplate:v=>b(`/templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),localFolder:v=>b("/local-folder",{method:"POST",body:{path:v}}),files:(v,w)=>b(`/files/${encodeURIComponent(v)}?path=${encodeURIComponent(w)}`),seed:v=>b(`/files/${encodeURIComponent(v)}/seed`),retrySeed:v=>b(`/files/${encodeURIComponent(v)}/seed/retry`,{method:"POST",body:{}}),prepareDownload:(v,w)=>b(`/files/${encodeURIComponent(v)}/download`,{method:"POST",body:{path:w}}),startUpload:v=>b(`/files/${encodeURIComponent(v)}/uploads`,{method:"POST",body:{}}),uploadFile:(v,w,C,S,N)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}?path=${encodeURIComponent(C)}`,{method:"POST",body:S,raw:!0,signal:N}),commitUpload:(v,w,C)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}/commit`,{method:"POST",body:{dir:C}}),cancelUpload:(v,w)=>b(`/files/${encodeURIComponent(v)}/uploads/${w}/cancel`,{method:"POST",body:{}}),ingress:()=>b("/ingress"),exposeService:v=>b("/ingress/expose",{method:"POST",body:v}),closeService:v=>b("/ingress/close",{method:"POST",body:{sandbox:v.sandbox,name:v.name}}),extendService:(v,w)=>b("/ingress/extend",{method:"POST",body:{sandbox:v.sandbox,name:v.name,closeAfterMinutes:w}})}}const cs=lr(),xk="https://console.openrod.io".trim(),ku=/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(xk)?xk:"",bk="Cloud is coming soon. We're still working on it.";function Ag(){return typeof window<"u"}function Us(e){return V1(e)?(e.nodeName||"").toLowerCase():"#document"}function Rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ei(e){var t;return(t=(V1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function V1(e){return Ag()?e instanceof Node||e instanceof Rn(e).Node:!1}function Ft(e){return Ag()?e instanceof Element||e instanceof Rn(e).Element:!1}function wn(e){return Ag()?e instanceof HTMLElement||e instanceof Rn(e).HTMLElement:!1}function Tu(e){return!Ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rn(e).ShadowRoot}function zf(e){const{overflow:t,overflowX:r,overflowY:a,display:i}=Br(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&i!=="inline"&&i!=="contents"}function u6(e){return/^(table|td|th)$/.test(Us(e))}function Mg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const d6=/transform|translate|scale|rotate|perspective|filter/,f6=/paint|layout|strict|content/,Pl=e=>!!e&&e!=="none";let fv;function U1(e){const t=Ft(e)?Br(e):e;return Pl(t.transform)||Pl(t.translate)||Pl(t.scale)||Pl(t.rotate)||Pl(t.perspective)||!H1()&&(Pl(t.backdropFilter)||Pl(t.filter))||d6.test(t.willChange||"")||f6.test(t.contain||"")}function h6(e){let t=Ka(e);for(;wn(t)&&!Ha(t);){if(U1(t))return t;if(Mg(t))return null;t=Ka(t)}return null}function H1(){return fv==null&&(fv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fv}function Ha(e){return/^(html|body|#document)$/.test(Us(e))}function Br(e){return Rn(e).getComputedStyle(e)}function Og(e){return Ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ka(e){if(Us(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tu(e)&&e.host||ei(e);return Tu(t)?t.host:t}function eA(e){const t=Ka(e);return Ha(t)?(e.ownerDocument||e).body:wn(t)&&zf(t)?t:eA(t)}function pf(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=eA(e),c=i===((a=e.ownerDocument)==null?void 0:a.body),u=Rn(i);if(c){const f=wy(u);return t.concat(u,u.visualViewport||[],zf(i)?i:[],f&&r?pf(f):[])}else return t.concat(i,pf(i,[],r))}function wy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const F1={..._P},vk={};function vs(e,t){const r=x.useRef(vk);return r.current===vk&&(r.current=e(t)),r}const hv=F1.useInsertionEffect,m6=hv&&hv!==F1.useLayoutEffect?hv:e=>e();function st(e){const t=vs(p6).current;return t.next=e,m6(t.effect),t.trampoline}function p6(){const e={next:void 0,callback:g6,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function g6(){}const x6=()=>{},We=typeof document<"u"?x.useLayoutEffect:x6;function jy(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const G1={};function Qs(e,t,r,a,i){if(!r&&!a&&!i&&!e)return Fp(t);let c=Fp(e);return t&&(c=Kd(c,t)),r&&(c=Kd(c,r)),a&&(c=Kd(c,a)),i&&(c=Kd(c,i)),c}function b6(e){if(e.length===0)return G1;if(e.length===1)return Fp(e[0]);let t=Fp(e[0]);for(let r=1;r<e.length;r+=1)t=Kd(t,e[r]);return t}function Fp(e){return q1(e)?{...nA(e,G1)}:v6(e)}function Kd(e,t){return q1(t)?nA(t,e):y6(e,t)}function v6(e){const t={...e};for(const r in t){const a=t[r];tA(r,a)&&(t[r]=sA(a))}return t}function y6(e,t){if(!t)return e;for(const r in t){const a=t[r];switch(r){case"style":{e[r]=jy(e.style,a);break}case"className":{e[r]=rA(e.className,a);break}default:tA(r,a)?e[r]=w6(e[r],a):e[r]=a}}return e}function tA(e,t){const r=e.charCodeAt(0),a=e.charCodeAt(1),i=e.charCodeAt(2);return r===111&&a===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function q1(e){return typeof e=="function"}function nA(e,t){return q1(e)?e(t):e??G1}function w6(e,t){return t?e?(...r)=>{const a=r[0];if(oA(a)){const c=a;Gp(c);const u=t(...r);return c.baseUIHandlerPrevented||e==null||e(...r),u}const i=t(...r);return e==null||e(...r),i}:sA(t):e}function sA(e){return e&&((...t)=>{const r=t[0];return oA(r)&&Gp(r),e(...t)})}function Gp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function rA(e,t){return t?e?t+" "+e:t:e}function oA(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function j6(e,t){return function(a,...i){const c=new URL(e);return c.searchParams.set("code",a.toString()),i.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${a}; visit ${c} for the full message.`}}const rn=j6("https://base-ui.com/production-error","Base UI"),aA=x.createContext(void 0);function Dg(e=!1){const t=x.useContext(aA);if(t===void 0&&!e)throw new Error(rn(16));return t}function S6(e){const{focusableWhenDisabled:t,disabled:r,composite:a=!1,tabIndex:i=0,isNativeButton:c}=e,u=a&&t!==!1,f=a&&t===!1;return{props:x.useMemo(()=>{const m={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return a||(m.tabIndex=i,!c&&r&&(m.tabIndex=t?i:-1)),(c&&(t||u)||!c&&r)&&(m["aria-disabled"]=r),c&&(!t||f)&&(m.disabled=r),m},[a,r,t,u,f,c,i])}}function Ht(e){return(e==null?void 0:e.ownerDocument)||document}function hu(e,t,{detail:r=0}={}){e.dispatchEvent(new(Rn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function bo(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:a=0,native:i=!0,composite:c}=e,u=x.useRef(null),f=Dg(!0),h=c??f!==void 0,{props:m}=S6({focusableWhenDisabled:r,disabled:t,composite:h,tabIndex:a,isNativeButton:i}),p=x.useCallback(()=>{const v=u.current;mv(v)&&h&&t&&m.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,m.disabled,h]);We(p,[p]);const g=x.useCallback((v={})=>{const{onClick:w,onMouseDown:C,onKeyUp:S,onKeyDown:N,onPointerDown:E,...k}=v;return Qs({onClick(A){if(t){A.preventDefault();return}w==null||w(A)},onMouseDown(A){t||C==null||C(A)},onKeyDown(A){if(t||(Gp(A),N==null||N(A),A.baseUIHandlerPrevented))return;const M=A.target===A.currentTarget,R=A.currentTarget,T=mv(R),O=!i&&N6(R),D=M&&(i?T:!O),B=A.key==="Enter",F=A.key===" ",K=R.getAttribute("role"),$=(K==null?void 0:K.startsWith("menuitem"))||K==="option"||K==="gridcell";if(M&&h&&F){if(A.defaultPrevented&&$)return;A.preventDefault(),(!i||T)&&(A.preventBaseUIHandler(),hu(R,A));return}if(!D||i||!F&&!B){M&&O&&F&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),B&&(A.preventBaseUIHandler(),hu(R,A)))},onKeyUp(A){if(!t){if(Gp(A),S==null||S(A),A.target===A.currentTarget&&i&&h&&mv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!i&&!h&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),hu(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}E==null||E(A)}},i?{type:"button"}:{role:"button"},m,k)},[t,m,h,i]),b=st(v=>{u.current=v,p()});return{getButtonProps:g,buttonRef:b}}function mv(e){return wn(e)&&e.tagName==="BUTTON"}function N6(e){return wn(e)&&e.tagName==="A"&&!!e.href}function mo(e,t,r,a){const i=vs(iA).current;return k6(i,e,t,r,a)&&lA(i,[e,t,r,a]),i.callback}function C6(e){const t=vs(iA).current;return T6(t,e)&&lA(t,e),t.callback}function iA(){return{callback:null,cleanup:null,refs:[]}}function k6(e,t,r,a,i){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==a||e.refs[3]!==i}function T6(e,t){return e.refs.length!==t.length||e.refs.some((r,a)=>r!==t[a])}function lA(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const a=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const u=c(r);typeof u=="function"&&(a[i]=u);break}case"object":{c.current=r;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const u=a[i];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}const E6=parseInt(x.version,10);function Y1(e){return E6>=e}function yk(e){if(!x.isValidElement(e))return null;const t=e,r=t.props;return(Y1(19)?r==null?void 0:r.ref:t.ref)??null}function $n(){}const Vr=Object.freeze([]),En=Object.freeze({});function R6(e,t){const r={};for(const a in e){const i=e[a];if(t!=null&&t.hasOwnProperty(a)){const c=t[a](i);c!=null&&Object.assign(r,c);continue}i===!0?r[`data-${a.toLowerCase()}`]="":i&&(r[`data-${a.toLowerCase()}`]=i.toString())}return r}function A6(e,t){return typeof e=="function"?e(t):e}function cA(e,t){return typeof e=="function"?e(t):e}function Ct(e,t,r={}){let a=t.render;r.enabled!==!1&&(a=z6(a));const i=M6(t,r,a);if(r.enabled===!1)return null;const c=r.state??En;return I6(e,a,i,c)}function M6(e,t,r){const{className:a,style:i}=e,{state:c=En,ref:u,props:f,stateAttributesMapping:h,enabled:m=!0}=t,p=m?A6(a,c):void 0,g=m?cA(i,c):void 0,b=m?R6(c,h):En,v=m&&f?O6(f):void 0,w=m?jy(b,v)??{}:En;return typeof document<"u"&&(m?Array.isArray(u)?w.ref=C6([w.ref,yk(r),...u]):w.ref=mo(w.ref,yk(r),u):mo(null,null)),m?(p!==void 0&&(w.className=rA(w.className,p)),g!==void 0&&(w.style=jy(w.style,g)),w):En}function O6(e){return Array.isArray(e)?b6(e):Qs(void 0,e)}const D6=Symbol.for("react.lazy");function z6(e){if((e==null?void 0:e.$$typeof)!==D6)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function I6(e,t,r,a){if(t){if(typeof t=="function")return t(r,a);const i=Qs(r,t.props);return i.ref=r.ref,x.cloneElement(t,i)}if(e&&typeof e=="string")return P6(e,r);throw new Error(rn(8))}function P6(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const _6=x.forwardRef(function(t,r){const{render:a,className:i,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:f=!0,style:h,...m}=t,{getButtonProps:p,buttonRef:g}=bo({disabled:c,focusableWhenDisabled:u,native:f});return Ct("button",t,{state:{disabled:c},ref:[r,g],props:[m,p]})});function uA(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=uA(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function dA(){for(var e,t,r=0,a="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=uA(e))&&(a&&(a+=" "),a+=t);return a}const wk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,jk=dA,If=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return jk(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:c}=t,u=Object.keys(i).map(m=>{const p=r==null?void 0:r[m],g=c==null?void 0:c[m];if(p===null)return null;const b=wk(p)||wk(g);return i[m][b]}),f=r&&Object.entries(r).reduce((m,p)=>{let[g,b]=p;return b===void 0||(m[g]=b),m},{}),h=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((m,p)=>{let{class:g,className:b,...v}=p;return Object.entries(v).every(w=>{let[C,S]=w;return Array.isArray(S)?S.includes({...c,...f}[C]):{...c,...f}[C]===S})?[...m,g,b]:m},[]);return jk(e,u,h,r==null?void 0:r.class,r==null?void 0:r.className)},L6=(e,t)=>{const r=new Array(e.length+t.length);for(let a=0;a<e.length;a++)r[a]=e[a];for(let a=0;a<t.length;a++)r[e.length+a]=t[a];return r},$6=(e,t)=>({classGroupId:e,validator:t}),fA=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),qp="-",Sk=[],B6="arbitrary..",V6=e=>{const t=H6(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return U6(u);const f=u.split(qp),h=f[0]===""&&f.length>1?1:0;return hA(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=a[u],m=r[u];return h?m?L6(m,h):h:m||Sk}return r[u]||Sk}}},hA=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],c=r.nextPart.get(i);if(c){const m=hA(e,t+1,c);if(m)return m}const u=r.validators;if(u===null)return;const f=t===0?e.join(qp):e.slice(t).join(qp),h=u.length;for(let m=0;m<h;m++){const p=u[m];if(p.validator(f))return p.classGroupId}},U6=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),a=t.slice(0,r);return a?B6+a:void 0})(),H6=e=>{const{theme:t,classGroups:r}=e;return F6(r,t)},F6=(e,t)=>{const r=fA();for(const a in e){const i=e[a];K1(i,r,a,t)}return r},K1=(e,t,r,a)=>{const i=e.length;for(let c=0;c<i;c++){const u=e[c];G6(u,t,r,a)}},G6=(e,t,r,a)=>{if(typeof e=="string"){q6(e,t,r);return}if(typeof e=="function"){Y6(e,t,r,a);return}K6(e,t,r,a)},q6=(e,t,r)=>{const a=e===""?t:mA(t,e);a.classGroupId=r},Y6=(e,t,r,a)=>{if(X6(e)){K1(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push($6(r,e))},K6=(e,t,r,a)=>{const i=Object.entries(e),c=i.length;for(let u=0;u<c;u++){const[f,h]=i[u];K1(h,mA(t,f),r,a)}},mA=(e,t)=>{let r=e;const a=t.split(qp),i=a.length;for(let c=0;c<i;c++){const u=a[c];let f=r.nextPart.get(u);f||(f=fA(),r.nextPart.set(u,f)),r=f}return r},X6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,W6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const i=(c,u)=>{r[c]=u,t++,t>e&&(t=0,a=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=a[c])!==void 0)return i(c,u),u},set(c,u){c in r?r[c]=u:i(c,u)}}},Sy="!",Nk=":",Q6=[],Ck=(e,t,r,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:i}),Z6=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=i=>{const c=[];let u=0,f=0,h=0,m;const p=i.length;for(let C=0;C<p;C++){const S=i[C];if(u===0&&f===0){if(S===Nk){c.push(i.slice(h,C)),h=C+1;continue}if(S==="/"){m=C;continue}}S==="["?u++:S==="]"?u--:S==="("?f++:S===")"&&f--}const g=c.length===0?i:i.slice(h);let b=g,v=!1;g.endsWith(Sy)?(b=g.slice(0,-1),v=!0):g.startsWith(Sy)&&(b=g.slice(1),v=!0);const w=m&&m>h?m-h:void 0;return Ck(c,v,b,w)};if(t){const i=t+Nk,c=a;a=u=>u.startsWith(i)?c(u.slice(i.length)):Ck(Q6,!1,u,void 0,!0)}if(r){const i=a;a=c=>r({className:c,parseClassName:i})}return a},J6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let i=[];for(let c=0;c<r.length;c++){const u=r[c],f=u[0]==="[",h=t.has(u);f||h?(i.length>0&&(i.sort(),a.push(...i),i=[]),a.push(u)):i.push(u)}return i.length>0&&(i.sort(),a.push(...i)),a}},e_=e=>({cache:W6(e.cacheSize),parseClassName:Z6(e),sortModifiers:J6(e),postfixLookupClassGroupIds:t_(e),...V6(e)}),t_=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let a=0;a<r.length;a++)t[r[a]]=!0;return t},n_=/\s+/,s_=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:c,postfixLookupClassGroupIds:u}=t,f=[],h=e.trim().split(n_);let m="";for(let p=h.length-1;p>=0;p-=1){const g=h[p],{isExternal:b,modifiers:v,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:S}=r(g);if(b){m=g+(m.length>0?" "+m:m);continue}let N=!!S,E;if(N){const T=C.substring(0,S);E=a(T);const O=E&&u[E]?a(C):void 0;O&&O!==E&&(E=O,N=!1)}else E=a(C);if(!E){if(!N){m=g+(m.length>0?" "+m:m);continue}if(E=a(C),!E){m=g+(m.length>0?" "+m:m);continue}N=!1}const k=v.length===0?"":v.length===1?v[0]:c(v).join(":"),A=w?k+Sy:k,M=A+E;if(f.indexOf(M)>-1)continue;f.push(M);const R=i(E,N);for(let T=0;T<R.length;++T){const O=R[T];f.push(A+O)}m=g+(m.length>0?" "+m:m)}return m},r_=(...e)=>{let t=0,r,a,i="";for(;t<e.length;)(r=e[t++])&&(a=pA(r))&&(i&&(i+=" "),i+=a);return i},pA=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=pA(e[a]))&&(r&&(r+=" "),r+=t);return r},o_=(e,...t)=>{let r,a,i,c;const u=h=>{const m=t.reduce((p,g)=>g(p),e());return r=e_(m),a=r.cache.get,i=r.cache.set,c=f,f(h)},f=h=>{const m=a(h);if(m)return m;const p=s_(h,r);return i(h,p),p};return c=u,(...h)=>c(r_(...h))},a_=[],ps=e=>{const t=r=>r[e]||a_;return t.isThemeGetter=!0,t.themeKey=e,t},gA=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,i_=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,l_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,c_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,u_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,d_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,f_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ii=e=>i_.test(e),Ut=e=>!!e&&!Number.isNaN(Number(e)),Qo=e=>!!e&&Number.isInteger(Number(e)),pv=e=>e.endsWith("%")&&Ut(e.slice(0,-1)),_a=e=>l_.test(e),bA=()=>!0,h_=e=>c_.test(e)&&!u_.test(e),X1=()=>!1,m_=e=>d_.test(e),p_=e=>f_.test(e),g_=e=>!dt(e)&&!ft(e),x_=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),b_=e=>sl(e,wA,X1),dt=e=>gA.test(e),_l=e=>sl(e,jA,h_),kk=e=>sl(e,k_,Ut),v_=e=>sl(e,NA,bA),y_=e=>sl(e,SA,X1),Tk=e=>sl(e,vA,X1),w_=e=>sl(e,yA,p_),Mm=e=>sl(e,CA,m_),ft=e=>xA.test(e),Bd=e=>fc(e,jA),j_=e=>fc(e,SA),Ek=e=>fc(e,vA),S_=e=>fc(e,wA),N_=e=>fc(e,yA),Om=e=>fc(e,CA,!0),C_=e=>fc(e,NA,!0),sl=(e,t,r)=>{const a=gA.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},fc=(e,t,r=!1)=>{const a=xA.exec(e);return a?a[1]?t(a[1]):r:!1},vA=e=>e==="position"||e==="percentage",yA=e=>e==="image"||e==="url",wA=e=>e==="length"||e==="size"||e==="bg-size",jA=e=>e==="length",k_=e=>e==="number",SA=e=>e==="family-name",NA=e=>e==="number"||e==="weight",CA=e=>e==="shadow",T_=()=>{const e=ps("color"),t=ps("font"),r=ps("text"),a=ps("font-weight"),i=ps("tracking"),c=ps("leading"),u=ps("breakpoint"),f=ps("container"),h=ps("spacing"),m=ps("radius"),p=ps("shadow"),g=ps("inset-shadow"),b=ps("text-shadow"),v=ps("drop-shadow"),w=ps("blur"),C=ps("perspective"),S=ps("aspect"),N=ps("ease"),E=ps("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...A(),ft,dt],R=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],O=()=>[ft,dt,h],D=()=>[Ii,"full","auto",...O()],B=()=>[Qo,"none","subgrid",ft,dt],F=()=>["auto",{span:["full",Qo,ft,dt]},Qo,ft,dt],K=()=>[Qo,"auto",ft,dt],$=()=>["auto","min","max","fr",ft,dt],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...O()],W=()=>[Ii,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],q=()=>[f,Ii,"screen","full","dvw","lvw","svw","min","max","fit",...O()],Z=()=>[Ii,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],z=()=>[e,ft,dt],L=()=>[...A(),Ek,Tk,{position:[ft,dt]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",S_,b_,{size:[ft,dt]}],_=()=>[pv,Bd,_l],V=()=>["","none","full",m,ft,dt],G=()=>["",Ut,Bd,_l],Y=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ut,pv,Ek,Tk],ye=()=>["","none",w,ft,dt],ae=()=>["none",Ut,ft,dt],ue=()=>["none",Ut,ft,dt],se=()=>[Ut,ft,dt],Q=()=>[Ii,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_a],breakpoint:[_a],color:[bA],container:[_a],"drop-shadow":[_a],ease:["in","out","in-out"],font:[g_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_a],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_a],shadow:[_a],spacing:["px",Ut],text:[_a],"text-shadow":[_a],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ii,dt,ft,S]}],container:["container"],"container-type":[{"@container":["","normal","size",ft,dt]}],"container-named":[x_],columns:[{columns:[Ut,"auto",dt,ft,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Qo,"auto",ft,dt]}],basis:[{basis:[Ii,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ut,Ii,"auto","initial","none",dt]}],grow:[{grow:["",Ut,ft,dt]}],shrink:[{shrink:["",Ut,ft,dt]}],order:[{order:[Qo,"first","last","none",ft,dt]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...q()]}],"min-inline-size":[{"min-inline":["auto",...q()]}],"max-inline-size":[{"max-inline":["none",...q()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[f,"screen",...W()]}],"min-w":[{"min-w":[f,"screen","none",...W()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh","none",...W()]}],"font-size":[{text:["base",r,Bd,_l]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,C_,v_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pv,dt]}],"font-family":[{font:[j_,y_,t]}],"font-features":[{"font-features":[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,ft,dt]}],"line-clamp":[{"line-clamp":[Ut,"none",ft,kk]}],leading:[{leading:["none",c,...O()]}],"list-image":[{"list-image":["none",ft,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ft,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ut,"from-font","auto",ft,_l]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[Ut,"auto",ft,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[Qo,ft,dt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ft,dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ft,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qo,ft,dt],radial:["",ft,dt],conic:["",Qo,ft,dt]},N_,w_]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:_()}],"gradient-via-pos":[{via:_()}],"gradient-to-pos":[{to:_()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ut,ft,dt]}],"outline-w":[{outline:["",Ut,Bd,_l]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","inner","none",p,Om,Mm]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",g,Om,Mm]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[Ut,_l]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",b,Om,Mm]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Ut,ft,dt]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ft,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ft,dt]}],filter:[{filter:["","none",ft,dt]}],blur:[{blur:ye()}],brightness:[{brightness:[Ut,ft,dt]}],contrast:[{contrast:[Ut,ft,dt]}],"drop-shadow":[{"drop-shadow":["","none",v,Om,Mm]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",Ut,ft,dt]}],"hue-rotate":[{"hue-rotate":[Ut,ft,dt]}],invert:[{invert:["",Ut,ft,dt]}],saturate:[{saturate:[Ut,ft,dt]}],sepia:[{sepia:["",Ut,ft,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",ft,dt]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[Ut,ft,dt]}],"backdrop-contrast":[{"backdrop-contrast":[Ut,ft,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ut,ft,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ut,ft,dt]}],"backdrop-invert":[{"backdrop-invert":["",Ut,ft,dt]}],"backdrop-opacity":[{"backdrop-opacity":[Ut,ft,dt]}],"backdrop-saturate":[{"backdrop-saturate":[Ut,ft,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",Ut,ft,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ft,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ut,"initial",ft,dt]}],ease:[{ease:["linear","initial",N,ft,dt]}],delay:[{delay:[Ut,ft,dt]}],animate:[{animate:["none",E,ft,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,ft,dt]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[ft,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],zoom:[{zoom:[Qo,ft,dt]}],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ft,dt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":z()}],"scrollbar-track-color":[{"scrollbar-track":z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ft,dt]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[Ut,Bd,_l,kk]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},E_=o_(T_);function Ve(...e){return E_(dA(e))}const R_=If("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function le({className:e,variant:t="default",size:r="default",...a}){return n.jsx(_6,{"data-slot":"button",className:Ve(R_({variant:t,size:r,className:e})),...a})}const kA=48,wa=(e,t=0)=>{const r=new Int32Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a)-kA-t;return r},zg=e=>{const t=new Int32Array(e.length+1);for(let r=0;r<e.length;r++)t[r+1]=t[r]+e[r];return t},Qi=e=>{const t=new Int32Array(e.length);let r=0;for(let a=0;a<e.length;a++){const i=e.charCodeAt(a)-kA;r+=i>>>1^-(i&1),t[a]=r}return t},A_=384,M_=[],Hl=zg(wa("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),O_=zg(wa(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),D_="@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom",z_=(()=>{const e=Hl.length-1,t=new Int32Array(e);for(let i=e-1;i>=0;i--){let c=1,u=i+1;for(let f=Hl[i];f<Hl[i+1];f++)c+=t[u],u+=t[u];t[i]=c}const r=new Int32Array(Hl[e]);let a=0;for(let i=0;i<e;i++){let c=i+1;for(let u=Hl[i];u<Hl[i+1];u++)r[a++]=c,c+=t[c]}return r})(),I_=wa("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),P_=zg(wa("1233333593464636351265367151576")),__=wa("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0324325853;D>E?3257D>03258432585:0325B:;0328B:032"),L_=wa("012123445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EJK4444::EJ4444441691;644444114244444:;L6666555555555555555999666664444444444444444444444226?6:66644M9N?D:111::::6DJ199"),$_=Qi("0202002020020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),B_=(()=>{const e=new Int32Array(319).fill(-1),t=Qi("02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222"),r=Qi("02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222");for(let a=0;a<t.length;a++)e[t[a]]=r[a];return e})(),V_="container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top|none | auto square video| auto fr max min px| auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform".split("|").map(e=>{const t=e.split(" "),r=t.shift();for(let a=0;a<t.length;a++)t[a]=r+t[a];return t}),Rk=Qi("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422"),U_=Qi("ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622"),H_=Qi("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000560|{~22>22|22222222222G000qOVI00000}2>40000B00000I¨000°00000000000000021Q²±00´000000000000000000000222HGHa5¾222Ã6À2222ÍÐ000°2±"),TA=new Int32Array(991),EA=new Int32Array(991),RA=new Int32Array(991);let Ny="";const Cy=new Int32Array(1030);{const e=new Map;let t=0,r=0;for(let a=0;a<Rk.length;a++)for(const i of V_[H_[a]]){let c=e.get(i);c===void 0&&(c=t++,e.set(i,c),Cy[c*2]=Ny.length,Cy[c*2+1]=i.length,Ny+=i),TA[r]=Rk[a],EA[r]=U_[a],RA[r]=c,r++}}const F_=Qi("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),G_=zg(wa("1::22222432:222:22:22>222222:22:2221322511111311111114")),q_=Qi("24A;33N=C@H4A;33N=C@<2;363@QTQʰ222ˉºŴŽ2R2=18cƴÅŇÜÛŲǝȈ:ħ25=11D3A@216Er25;11B3?<438Cn9@7=<8192>2E121@9@EHE@9>2T25511<398216=V25511<398216=ƧNž2Đå242L222290000f22500ɛ000ǘ222"),Y_=wa("ij"),K_=wa(""),X_=wa("1"),W_="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var Q_={GROUP_COUNT:A_,customValidatorNames:M_,edgeStart:Hl,labelStart:O_,labelText:D_,edgeTarget:z_,nodeGroup:I_,nodeVlist:B_,vlistPat:P_,vlistOps:__,vlistRef:L_,vlistGroup:$_,litAnchor:TA,litGroup:EA,litPool:RA,poolOffsets:Cy,poolText:Ny,adjGid:F_,adjStart:G_,adjTgt:q_,patGid:Y_,patTgt:K_,postfixLookupGroups:X_,orderSensitiveModifiers:W_};const Z_="line"in new Error,Zo=-1,Ll=-1,gv=(e,t,r)=>{let a=2166136261;for(let i=t;i<r;i++)a=Math.imul(a^e.charCodeAt(i),16777619);return a},xv=(e,t,r)=>{const a=r-t;let i=Math.imul(a,2654435761)^e.charCodeAt(t);if(a>3){const c=a>>2,u=a>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+c),2246822507),i=Math.imul(i^e.charCodeAt(t+u)<<8^e.charCodeAt(t+u+c)<<16^e.charCodeAt(r-3),3266489909),i^=e.charCodeAt(r-2)<<8^e.charCodeAt(r-1)<<16;for(let f=t+3,h=r-4;f<t+8&&f<h;f++,h--)i=Math.imul(i^e.charCodeAt(f)^e.charCodeAt(h)<<8,16777619)}return i^i>>>15|0},J_=(e,t,r={})=>{const{GROUP_COUNT:a,edgeStart:i,labelStart:c,labelText:u,edgeTarget:f,nodeGroup:h,nodeVlist:m,vlistPat:p,vlistOps:g,vlistRef:b,vlistGroup:v,litAnchor:w,litGroup:C,litPool:S,poolOffsets:N,poolText:E,adjGid:k,adjStart:A,adjTgt:M,patGid:R,patTgt:T,postfixLookupGroups:O,customValidatorNames:D,orderSensitiveModifiers:B}=e,F=new Int32Array(a).fill(-1);for(let De=0;De<k.length;De++)F[k[De]]=De;let K=0;for(let De=0;De+1<A.length;De++){const Ge=A[De+1]-A[De];Ge>K&&(K=Ge)}let $=32;for(;$<2*(1+K+R.length);)$<<=1;const P=new Int32Array(b.length+1);for(let De=0;De<b.length;De++)P[De+1]=P[De]+p[b[De]+1]-p[b[De]];const U=new Uint8Array(a);for(let De=0;De<O.length;De++)U[O[De]]=1;const H=i.length-1,W=new Uint8Array(H);let q=0,Z=!0;for(let De=0;De<w.length;De++){W[w[De]]=1;const Ge=N[S[De]*2+1];Ge>q&&(q=Ge);const qe=E.charCodeAt(N[S[De]*2]);(qe===91||qe===40)&&(Z=!1)}let z=1;for(;z<w.length*2;)z<<=1;const L=new Int32Array(z).fill(-1);for(let De=0;De<w.length;De++){const Ge=N[S[De]*2];let qe=(gv(E,Ge,Ge+N[S[De]*2+1])^Math.imul(w[De],2654435761)|0)&z-1;for(;L[qe]!==-1;)qe=qe+1&z-1;L[qe]=De}const X=(De,Ge,qe,bt)=>{let zt=(gv(Ge,qe,bt)^Math.imul(De,2654435761)|0)&z-1;const Mt=bt-qe;for(;;){const Bt=L[zt];if(Bt===-1)return-1;if(w[Bt]===De&&N[S[Bt]*2+1]===Mt){const Nn=N[S[Bt]*2];let hn=!0;for(let kt=0;kt<Mt;kt++)if(E.charCodeAt(Nn+kt)!==Ge.charCodeAt(qe+kt)){hn=!1;break}if(hn)return C[Bt]}zt=zt+1&z-1}},ee=r.cacheSize??8192,_=r.prefix??e.prefix??"",V=_===""?"":_+":",G=V.length,Y=(D??[]).map(De=>{throw new Error("cn: missing validator "+De)}),ne=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ye=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ae=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;let ue=0,se=-1,Q=-1,ie=-1,oe=-1;const pe=De=>De>=97&&De<=122||De>=65&&De<=90||De>=48&&De<=57||De===95,xe=De=>/\s/.test(String.fromCharCode(De)),je=(De,Ge,qe)=>{if(ue=0,se=-1,qe-Ge<3)return;const bt=De.charCodeAt(Ge),zt=De.charCodeAt(qe-1);if(bt===91&&zt===93)ue=1;else if(bt===40&&zt===41)ue=2;else return;ie=Ge+1,oe=qe-1;let Mt=Ge+1;if(pe(De.charCodeAt(Mt))){for(Mt++;Mt<qe-1;){const Bt=De.charCodeAt(Mt);if(!pe(Bt)&&Bt!==45)break;Mt++}Mt<qe-2&&De.charCodeAt(Mt)===58&&(se=Ge+1,Q=Mt,ie=Mt+1)}},Ie=(De,Ge,qe,bt)=>{if(qe-Ge!==bt.length)return!1;for(let zt=0;zt<bt.length;zt++)if(De.charCodeAt(Ge+zt)!==bt.charCodeAt(zt))return!1;return!0},ce=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Te=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,re=De=>!!De&&!Number.isNaN(Number(De)),fe=(De,Ge,qe)=>{if(qe-Ge<11||!Ie(De,Ge,Ge+10,"@container"))return!1;if(De.charCodeAt(Ge+10)===47)return qe-Ge>=12;const bt=De.charCodeAt(Ge+11);return bt===115&&qe-Ge>=17&&Ie(De,Ge+10,Ge+16,"-size/")||bt===110&&qe-Ge>=19&&Ie(De,Ge+10,Ge+18,"-normal/")},Re=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Oe="length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight".split("|").map(De=>De.split(" ")),ke=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],he=(De,Ge,qe,bt)=>{if(De>=10){if(De>=25)return Y[De-25](Ge.slice(qe,bt));const zt=De-10;if(ue!==Re[zt])return!1;if(se>=0){for(const Mt of Oe[zt])if(Ie(Ge,se,Q,Mt))return!0;return!1}switch(ke[zt]){case 0:return!1;case 1:return!0;case 2:{const Mt=Ge.slice(ie,oe);return ne.test(Mt)&&!te.test(Mt)}case 3:return re(Ge.slice(ie,oe));case 4:return ae.test(Ge.slice(ie,oe));default:return ye.test(Ge.slice(ie,oe))}}switch(De){case 0:return!0;case 1:return ue===0;case 2:return ue===1;case 3:return ue===2;case 4:return ce.test(Ge.slice(qe,bt));case 5:return re(Ge.slice(qe,bt));case 6:{const zt=Ge.slice(qe,bt);return!!zt&&Number.isInteger(Number(zt))}case 7:return bt>qe&&Ge.charCodeAt(bt-1)===37&&re(Ge.slice(qe,bt-1));case 8:return Te.test(Ge.slice(qe,bt));default:return fe(Ge,qe,bt)}},Ae=new Set(typeof B=="string"?B.split(" "):B),ge=(De,Ge,qe,bt,zt,Mt)=>{const Bt=gv(Ge,qe,bt)^(zt?2654435769:0)|0;let Nn=De.get(Bt);if(Nn!==void 0)e:for(let It=0;It<Nn.length;It++){const an=Nn[It];if(!(an.imp!==zt||an.k.length!==bt-qe)){for(let St=0;St<an.k.length;St++)if(an.k.charCodeAt(St)!==Ge.charCodeAt(qe+St))continue e;return an.id}}else De.set(Bt,Nn=[]);const hn=Ge.slice(qe,bt),kt=Mt(hn);return Nn.push({k:hn,imp:zt,id:kt}),kt};let Pe=new Map,Fe=new Map,_e=2;const Xe=4096,Je=(De,Ge)=>{const qe=[];let bt=0,zt=0,Mt=0;for(let kt=0;kt<De.length;kt++){const It=De.charCodeAt(kt);bt===0&&zt===0&&It===58?(qe.push(De.slice(Mt,kt)),Mt=kt+1):It===91?bt++:It===93?bt--:It===40?zt++:It===41&&zt--}qe.push(De.slice(Mt));let Bt=qe[0];if(qe.length>1){const kt=[];let It=[];for(const an of qe)an.charCodeAt(0)===91||Ae.has(an)?(It.length&&(kt.push(...It.sort()),It=[]),kt.push(an)):It.push(an);It.length&&kt.push(...It.sort()),Bt=kt.join(":")}const Nn=Ge?Bt+" !":Bt;let hn=Fe.get(Nn);return hn===void 0&&Fe.set(Nn,hn=_e++),hn};let ct=new Map,At=a;const rt=a+4096,ve=()=>At++,Ue=2097152,Qe=8192,xt=new Int32Array(Qe),Ke=new Array(Qe).fill(null),Be=new Int32Array(Qe),jt=new Int32Array(Qe),Ze=new Uint8Array(Qe);let Tt=0;const Se=(De,Ge,qe,bt,zt,Mt,Bt,Nn)=>{let hn=De;if(Ke[De]!==null)if(Ke[De|1]===null)hn=De|1;else if((Tt++&3)===0)hn=De|Tt>>2&1;else return;Ke[hn]=Ge.slice(qe,bt),xt[hn]=zt,Be[hn]=Mt,jt[hn]=Bt,Ze[hn]=Nn},Ye=()=>Ke.fill(null);let et=256,it=[new Int32Array(et),new Int32Array(et),new Int32Array(et),new Int32Array(et)],[lt,wt,cn,Gt]=it,fn=new Uint8Array(et),Bn=new Uint8Array(et);const Kn=()=>{et*=2,it=it.map(Ge=>{const qe=new Int32Array(et);return qe.set(Ge),qe}),[lt,wt,cn,Gt]=it;const De=new Uint8Array(et);De.set(fn),fn=De,Bn=new Uint8Array(et)};let de=64,tt=new Int32Array(de),Et=new Int32Array(de);const on=new Int32Array(a);let xn=2048,Wt=21,un=new Float64Array(xn),ns=new Int32Array(xn),Jn=0;const wo=(De,Ge)=>{if(De===0&&Ge<a)return on[Ge]===Jn?1:(on[Ge]=Jn,0);const qe=De*2097152+Ge+1;let bt=Math.imul(qe,2654435761)>>>Wt;for(;ns[bt]===Jn;){if(un[bt]===qe)return 1;bt=bt+1&xn-1}return un[bt]=qe,ns[bt]=Jn,0},jo=(De,Ge,qe,bt,zt)=>{if(qe-Ge>=2&&De.charCodeAt(Ge)===91&&De.charCodeAt(qe-1)===93){let Mt=-1;for(let Bt=Ge+1;Bt<qe-1;Bt++)if(De.charCodeAt(Bt)===58){Mt=Bt;break}return Mt===-1||Mt===Ge+1?Zo:ge(ct,De,Ge+1,Mt,0,ve)}if(bt>=0&&h[bt]>=0)return h[bt];for(let Mt=zt-1;Mt>=0;Mt--){const Bt=Et[Mt];if(Bt>qe)continue;const Nn=tt[Mt],hn=qe-Bt;if(W[Nn]===1&&hn>0&&hn<=q){const Hn=De.charCodeAt(Bt);if(Z===!1||Hn!==91&&Hn!==40){const Cr=X(Nn,De,Bt,qe);if(Cr>=0)return Cr}}const kt=m[Nn];if(kt<0)continue;const It=b[kt],an=p[It],St=p[It+1];if(an===St)continue;je(De,Bt,qe);const hs=P[kt]-an;for(let Hn=an;Hn<St;Hn++)if(he(g[Hn],De,Bt,qe))return v[hs+Hn]}return Zo},cr=De=>{const Ge=De.length;let qe=0,bt=0,zt=!1;(_e>Xe||Pe.size>Xe)&&(Pe=new Map,Fe=new Map,_e=2,Ye()),At>rt&&(ct=new Map,At=a,Ye());let Mt=0;for(;Mt<Ge;){let kt=De.charCodeAt(Mt);if(kt===32||kt>=9&&kt<=13||kt>=160&&xe(kt)){kt!==32&&(zt=!0),Mt++;continue}const It=Mt;let an=0;for(;Mt<Ge;){if(kt=De.charCodeAt(Mt),kt<=32){if(kt===32)break;if(kt>=9&&kt<=13){zt=!0;break}}else if(kt>=160&&xe(kt)){zt=!0;break}an=Math.imul(an^kt,16777619),Mt++}const St=Mt,hs=St-It;qe===et&&Kn();const Hn=qe++;lt[Hn]=It,wt[Hn]=St,bt+=hs,an^=Math.imul(hs,2654435761);const Cr=an^an>>>15|0,ss=Cr&8190;{let Zt=-1;if(xt[ss]===Cr&&Ke[ss]!==null&&Ke[ss].length===hs?Zt=ss:xt[ss|1]===Cr&&Ke[ss|1]!==null&&Ke[ss|1].length===hs&&(Zt=ss|1),Zt>=0){const Ss=Ke[Zt];let Zr=!0;for(let Er=0;Er<hs;Er++)if(Ss.charCodeAt(Er)!==De.charCodeAt(It+Er)){Zr=!1;break}if(Zr){cn[Hn]=Be[Zt],Gt[Hn]=jt[Zt],fn[Hn]=Ze[Zt];continue}}}let rs=It;if(G!==0){if(St-It<=G||!De.startsWith(V,It)){cn[Hn]=Zo,Se(ss,De,It,St,Cr,Zo,0,0);continue}rs=It+G}let yc=0,qu=0,Sa=-1,wc=-1;for(let Zt=rs;Zt<St;Zt++){const Ss=De.charCodeAt(Zt);if(yc===0&&qu===0){if(Ss===58){Sa=Zt;continue}if(Ss===47){wc=Zt;continue}}Ss===91?yc++:Ss===93?yc--:Ss===40?qu++:Ss===41&&qu--}const dh=Sa>=rs?Sa+1:rs;let Ln=dh,Gs=St,ii=!1,jc=0;Gs>Ln&&De.charCodeAt(Gs-1)===33?(ii=!0,Gs--):Gs>Ln&&De.charCodeAt(Ln)===33&&(ii=!0,Ln++,jc=1);let ur=-1;wc>dh&&(ur=wc+jc,ur>=Gs&&(ur=-1));let Sc=Ln;Gs-Ln>1&&De.charCodeAt(Ln)===45&&(Sc=Ln+1);let kr=0,Js=0,li=0,Yu=-1,Tr=0;(m[0]>=0||W[0]===1)&&(tt[0]=0,Et[0]=Sc,Tr=1);let dl=Ll,Ku=0;for(let Zt=Sc;Zt<Gs;Zt++)if(Zt===ur&&(dl=Js<li?Ll:kr,Ku=Tr),kr!==Ll){const Ss=De.charCodeAt(Zt);let Zr=-1;if(Js<li)u.charCodeAt(Js)===Ss?(Js++,Js===li&&(Zr=kr=Yu)):kr=Ll;else{const Er=i[kr],ml=i[kr+1];let Na=Ll;for(let zs=Er;zs<ml;zs++){const pl=c[zs];if(u.charCodeAt(pl)===Ss){c[zs+1]-pl===1?Zr=Na=f[zs]:(Js=pl+1,li=c[zs+1],Yu=f[zs],Na=kr);break}}kr=Na}if(Zr>=0&&(m[Zr]>=0||W[Zr]===1)&&Zt+1<Gs&&De.charCodeAt(Zt+1)===45){if(Tr===de){de*=2;const Er=new Int32Array(de);Er.set(tt),tt=Er;const ml=new Int32Array(de);ml.set(Et),Et=ml}tt[Tr]=Zr,Et[Tr]=Zt+2,Tr++}}ur===Gs&&(dl=Js<li?Ll:kr,Ku=Tr);const Xu=Js<li?Ll:kr;let Ds,er=!1;if(ur>=0)if(er=!0,Ds=jo(De,Ln,ur,dl,Ku),Ds!==Zo&&Ds<a&&U[Ds]){const Zt=jo(De,Ln,Gs,Xu,Tr);Zt!==Zo&&Zt!==Ds&&(Ds=Zt,er=!1)}else Ds===Zo&&(Ds=jo(De,Ln,Gs,Xu,Tr),er=!1);else Ds=jo(De,Ln,Gs,Xu,Tr);let fl=0,hl=0;Ds===Zo?cn[Hn]=Zo:(hl=er?1:0,fl=rs>=Sa?ii?1:0:ge(Pe,De,rs,Sa,ii?1:0,Zt=>Je(Zt,ii)),cn[Hn]=Ds,fn[Hn]=hl,Gt[Hn]=fl),Se(ss,De,It,St,Cr,Ds,fl,hl)}if(qe===0)return"";if(qe===1)return lt[0]===0&&wt[0]===Ge?De:De.slice(lt[0],wt[0]);if(qe*$>xn){for(;qe*$>xn;)xn<<=1,Wt--;un=new Float64Array(xn),ns=new Int32Array(xn)}if(_e>=Ue||At>=Ue)throw new Error("cn: too many distinct classes in one merge");Jn=Jn+1|0,Jn===0&&(on.fill(0),ns.fill(0),Jn=1);let Bt=!1;for(let kt=qe-1;kt>=0;kt--){const It=cn[kt];if(It===Zo){Bn[kt]=1;continue}const an=Gt[kt];if(wo(an,It)===1){Bn[kt]=0,Bt=!0;continue}if(Bn[kt]=1,It<a){const St=F[It];if(St>=0)for(let hs=A[St];hs<A[St+1];hs++)wo(an,M[hs]);if(fn[kt]&1)for(let hs=0;hs<R.length;hs++)R[hs]===It&&wo(an,T[hs])}}if(!Bt&&!zt&&Ge===bt+qe-1)return De;let Nn="",hn=0;for(;hn<qe;){if(!Bn[hn]){hn++;continue}const kt=lt[hn];let It=wt[hn],an=hn+1;for(;an<qe&&Bn[an]&<[an]===It+1&&De.charCodeAt(It)===32;)It=wt[an],an++;Nn.length>0&&(Nn+=" "),Nn+=De.slice(kt,It),hn=an}return Nn},Fs=16384,fs=new Int32Array(Fs*2);let Ms=0,_n=1,Un=Object.create(null),Os=Object.create(null),Nr=new Map,Gu=new Map,gc=0,xc=0;const ai=()=>{Ms^=Fs,_n=_n+1|0,xc=0},cl=De=>{let Ge=Un[De];if(Ge!==void 0)return Ge;const qe=xv(De,0,De.length),bt=(qe&16383)+Ms,zt=fs[bt]===(qe^_n)||fs[bt^Fs]===(qe^_n-1);return zt&&(Ge=Os[De],Ge!==void 0)?(Un[De]=Ge,Ge):(Ge=cr(De),zt?(Un[De]=Ge,++gc>ee&&(gc=0,Os=Un,Un=Object.create(null),ai())):(fs[bt]=qe^_n,++xc>Fs&&ai()),Ge)},bc=De=>{let Ge=Nr.get(De);if(Ge!==void 0)return Ge;const qe=xv(De,0,De.length),bt=(qe&16383)+Ms,zt=fs[bt]===(qe^_n)||fs[bt^Fs]===(qe^_n-1);return zt&&(Ge=Gu.get(De),Ge!==void 0)?(Nr.set(De,Ge),Ge):(Ge=cr(De),zt?(Nr.set(De,Ge),++gc>ee&&(gc=0,Gu=Nr,Nr=new Map,ai())):(fs[bt]=qe^_n,++xc>Fs&&ai()),Ge)},vc=De=>{const Ge=xv(De,0,De.length),qe=(Ge&16383)+Ms;return fs[qe]===(Ge^_n)||fs[qe^Fs]===(Ge^_n-1)?!0:(fs[qe]=Ge^_n,++xc>Fs&&ai(),!1)},So=ee===0?cr:Z_?De=>{const Ge=Nr.get(De);return Ge!==void 0?Ge:bc(De)}:cl;return{merge:function(){return arguments.length===1&&typeof arguments[0]=="string"?So(arguments[0]):So(tL.apply(null,arguments))},mergeString:So,seenBefore:ee===0?()=>!1:vc,mergeUncached:cr}},Yp=(e,t)=>{if(!e)return"";if(typeof e=="string")return e;let r="";if(typeof e.length=="number"&&(!t||Array.isArray(e))){const a=e;for(let i=0;i<a.length;i++){const c=a[i];if(!c)continue;const u=typeof c=="string"?c:Yp(c,t);u&&(r&&(r+=" "),r+=u)}return r}if(t){if(typeof e=="number")return""+e;if(typeof e=="object")for(const a in e)e[a]&&(r&&(r+=" "),r+=a)}return r},eL=(e,t)=>{let r="";for(let a=0;a<e.length;a++){const i=e[a];if(!i)continue;const c=typeof i=="string"?i:Yp(i,t);c&&(r&&(r+=" "),r+=c)}return r},tL=function(){return eL(arguments,!1)},nL=(e,t)=>{const r=t===void 0?()=>!0:t.seenBefore,a=t===void 0?e:t.mergeUncached;let i=new Map,c=new Map,u=0,f=null;const h=(b,v,w,C)=>{let S=0;if(v){if(v!==b.a0)return!1;S=1}if(w){if(w!==(S===0?b.a0:b.a1))return!1;S++}if(C){if(C!==(S===0?b.a0:S===1?b.a1:b.a2))return!1;S++}return S===b.t},m=(b,v)=>{const w=b.a;let C=0;for(let S=0;S<v.length;S++){const N=v[S];if(N){if(N!==w[C])return!1;C++}}return C===b.t},p=(b,v)=>{const w=b.length,C=f===null?null:f.n;if(!v){if(C!==null&&m(C,b))return f=C,C.r;if(f!==null&&f!==C&&m(f,b))return f.r}let S="",N=-1,E=0,k=!1;for(let R=0;R<w;R++){let T=b[R];if(T){if(typeof T!="string"){if(T=b[R]=Yp(T,!0),!T)continue;k=!0}N<0&&(S=T,N=R),E++}}if(E===0)return"";if(E===1)return e(S);if(k){if(C!==null&&m(C,b))return f=C,C.r;if(f!==null&&f!==C&&m(f,b))return f.r}let A=i.get(S);A===void 0&&(A=c.get(S),A!==void 0&&i.set(S,A));let M=null;if(A!==void 0)e:for(let R=0;R<A.length;R++){const T=A[R];if(T.t!==E)continue;const O=T.a;let D=1;for(let B=N+1;B<w;B++){const F=b[B];if(F&&F!==O[D++])continue e}M=T;break}if(M===null){let R=S;const T=[S];for(let O=N+1;O<w;O++){const D=b[O];D&&(R+=" "+D,T.push(D))}if(!r(R))return a(R);M={r:e(R),t:T.length,a0:T[0],a1:T[1],a2:T[2]??"",a:T,n:null},A===void 0&&i.set(S,A=[]),A.length>=256&&A.shift(),A.push(M),++u>1e3&&(u=0,c=i,i=new Map)}return f!==null&&f!==M&&(f.n=M),f=M,M.r},g=b=>Array.isArray(b)?p(b.slice(),!1):e(Yp(b,!0));return function(b,v,w){const C=arguments.length;if((C|1)===3){const E=f;if(E!==null){const k=E.n;if(k!==null&&h(k,b,v,w))return f=k,k.r;if(E!==k&&h(E,b,v,w))return E.r}return p([b,v,w],!0)}if(C===1)return typeof b=="string"?e(b):g(b);const S=f;if(S!==null){const E=S.n;if(E!==null){const k=E.a;let A=0,M=!0;for(let R=0;R<C;R++){const T=arguments[R];if(T){if(T!==k[A]){M=!1;break}A++}}if(M&&A===E.t)return f=E,E.r}if(S!==E){const k=S.a;let A=0,M=!0;for(let R=0;R<C;R++){const T=arguments[R];if(T){if(T!==k[A]){M=!1;break}A++}}if(M&&A===S.t)return S.r}}const N=[];for(let E=0;E<C;E++)N.push(arguments[E]);return p(N,!0)}},Ak=J_(Q_),js=nL(Ak.mergeString,Ak);/**
|
|
51
|
+
* @license lucide-react v0.577.0 - ISC
|
|
52
|
+
*
|
|
53
|
+
* This source code is licensed under the ISC license.
|
|
54
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
+
*/const AA=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();/**
|
|
56
|
+
* @license lucide-react v0.577.0 - ISC
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the ISC license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/const sL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
61
|
+
* @license lucide-react v0.577.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/const rL=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());/**
|
|
66
|
+
* @license lucide-react v0.577.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/const Mk=e=>{const t=rL(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
71
|
+
* @license lucide-react v0.577.0 - ISC
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the ISC license.
|
|
74
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
+
*/var oL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
76
|
+
* @license lucide-react v0.577.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/const aL=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
81
|
+
* @license lucide-react v0.577.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/const iL=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:i="",children:c,iconNode:u,...f},h)=>x.createElement("svg",{ref:h,...oL,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:AA("lucide",i),...!c&&!aL(f)&&{"aria-hidden":"true"},...f},[...u.map(([m,p])=>x.createElement(m,p)),...Array.isArray(c)?c:[c]]));/**
|
|
86
|
+
* @license lucide-react v0.577.0 - ISC
|
|
87
|
+
*
|
|
88
|
+
* This source code is licensed under the ISC license.
|
|
89
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
+
*/const at=(e,t)=>{const r=x.forwardRef(({className:a,...i},c)=>x.createElement(iL,{ref:c,iconNode:t,className:AA(`lucide-${sL(Mk(e))}`,`lucide-${e}`,a),...i}));return r.displayName=Mk(e),r};/**
|
|
91
|
+
* @license lucide-react v0.577.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/const lL=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],cL=at("activity",lL);/**
|
|
96
|
+
* @license lucide-react v0.577.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const uL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pf=at("arrow-down",uL);/**
|
|
101
|
+
* @license lucide-react v0.577.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/const dL=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],W1=at("arrow-left",dL);/**
|
|
106
|
+
* @license lucide-react v0.577.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/const fL=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],mu=at("arrow-right",fL);/**
|
|
111
|
+
* @license lucide-react v0.577.0 - ISC
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the ISC license.
|
|
114
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/const hL=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Zi=at("arrow-up-right",hL);/**
|
|
116
|
+
* @license lucide-react v0.577.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/const mL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_f=at("arrow-up",mL);/**
|
|
121
|
+
* @license lucide-react v0.577.0 - ISC
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the ISC license.
|
|
124
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
+
*/const pL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],gL=at("ban",pL);/**
|
|
126
|
+
* @license lucide-react v0.577.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const xL=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],bL=at("book-open",xL);/**
|
|
131
|
+
* @license lucide-react v0.577.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/const vL=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],MA=at("bot",vL);/**
|
|
136
|
+
* @license lucide-react v0.577.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const yL=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],hc=at("box",yL);/**
|
|
141
|
+
* @license lucide-react v0.577.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const wL=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],jL=at("building-2",wL);/**
|
|
146
|
+
* @license lucide-react v0.577.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const SL=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],NL=at("cable",SL);/**
|
|
151
|
+
* @license lucide-react v0.577.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const CL=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],kL=at("calendar-clock",CL);/**
|
|
156
|
+
* @license lucide-react v0.577.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const TL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Yn=at("check",TL);/**
|
|
161
|
+
* @license lucide-react v0.577.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const EL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ha=at("chevron-down",EL);/**
|
|
166
|
+
* @license lucide-react v0.577.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const RL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lr=at("chevron-right",RL);/**
|
|
171
|
+
* @license lucide-react v0.577.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const AL=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],OA=at("chevron-up",AL);/**
|
|
176
|
+
* @license lucide-react v0.577.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const ML=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ok=at("circle-alert",ML);/**
|
|
181
|
+
* @license lucide-react v0.577.0 - ISC
|
|
182
|
+
*
|
|
183
|
+
* This source code is licensed under the ISC license.
|
|
184
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
+
*/const OL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],DL=at("circle-check",OL);/**
|
|
186
|
+
* @license lucide-react v0.577.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/const zL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],IL=at("circle-x",zL);/**
|
|
191
|
+
* @license lucide-react v0.577.0 - ISC
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the ISC license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/const PL=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Kp=at("cloud",PL);/**
|
|
196
|
+
* @license lucide-react v0.577.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/const _L=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Lf=at("copy",_L);/**
|
|
201
|
+
* @license lucide-react v0.577.0 - ISC
|
|
202
|
+
*
|
|
203
|
+
* This source code is licensed under the ISC license.
|
|
204
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
+
*/const LL=[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]],Q1=at("door-open",LL);/**
|
|
206
|
+
* @license lucide-react v0.577.0 - ISC
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the ISC license.
|
|
209
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
+
*/const $L=[["path",{d:"M10 12h.01",key:"1kxr2c"}],["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}]],DA=at("door-closed",$L);/**
|
|
211
|
+
* @license lucide-react v0.577.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/const BL=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],pu=at("download",BL);/**
|
|
216
|
+
* @license lucide-react v0.577.0 - ISC
|
|
217
|
+
*
|
|
218
|
+
* This source code is licensed under the ISC license.
|
|
219
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
+
*/const VL=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zA=at("earth",VL);/**
|
|
221
|
+
* @license lucide-react v0.577.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/const UL=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Dk=at("ellipsis",UL);/**
|
|
226
|
+
* @license lucide-react v0.577.0 - ISC
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the ISC license.
|
|
229
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
+
*/const HL=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],FL=at("external-link",HL);/**
|
|
231
|
+
* @license lucide-react v0.577.0 - ISC
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the ISC license.
|
|
234
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/const GL=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],IA=at("file-code-corner",GL);/**
|
|
236
|
+
* @license lucide-react v0.577.0 - ISC
|
|
237
|
+
*
|
|
238
|
+
* This source code is licensed under the ISC license.
|
|
239
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
+
*/const qL=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Z1=at("file-text",qL);/**
|
|
241
|
+
* @license lucide-react v0.577.0 - ISC
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the ISC license.
|
|
244
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/const YL=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],KL=at("file",YL);/**
|
|
246
|
+
* @license lucide-react v0.577.0 - ISC
|
|
247
|
+
*
|
|
248
|
+
* This source code is licensed under the ISC license.
|
|
249
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
+
*/const XL=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],WL=at("folder-git-2",XL);/**
|
|
251
|
+
* @license lucide-react v0.577.0 - ISC
|
|
252
|
+
*
|
|
253
|
+
* This source code is licensed under the ISC license.
|
|
254
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
+
*/const QL=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],gf=at("folder-input",QL);/**
|
|
256
|
+
* @license lucide-react v0.577.0 - ISC
|
|
257
|
+
*
|
|
258
|
+
* This source code is licensed under the ISC license.
|
|
259
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
+
*/const ZL=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],zk=at("folder",ZL);/**
|
|
261
|
+
* @license lucide-react v0.577.0 - ISC
|
|
262
|
+
*
|
|
263
|
+
* This source code is licensed under the ISC license.
|
|
264
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
+
*/const JL=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ik=at("funnel",JL);/**
|
|
266
|
+
* @license lucide-react v0.577.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/const e8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],J1=at("globe",e8);/**
|
|
271
|
+
* @license lucide-react v0.577.0 - ISC
|
|
272
|
+
*
|
|
273
|
+
* This source code is licensed under the ISC license.
|
|
274
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
+
*/const t8=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],PA=at("hard-drive",t8);/**
|
|
276
|
+
* @license lucide-react v0.577.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const n8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Du=at("info",n8);/**
|
|
281
|
+
* @license lucide-react v0.577.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const s8=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],zu=at("key-round",s8);/**
|
|
286
|
+
* @license lucide-react v0.577.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const r8=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],e2=at("laptop",r8);/**
|
|
291
|
+
* @license lucide-react v0.577.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const o8=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],a8=at("layers",o8);/**
|
|
296
|
+
* @license lucide-react v0.577.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const i8=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],_A=at("link-2",i8);/**
|
|
301
|
+
* @license lucide-react v0.577.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/const l8=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],c8=at("list-filter",l8);/**
|
|
306
|
+
* @license lucide-react v0.577.0 - ISC
|
|
307
|
+
*
|
|
308
|
+
* This source code is licensed under the ISC license.
|
|
309
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
+
*/const u8=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ql=at("loader-circle",u8);/**
|
|
311
|
+
* @license lucide-react v0.577.0 - ISC
|
|
312
|
+
*
|
|
313
|
+
* This source code is licensed under the ISC license.
|
|
314
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
+
*/const d8=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Pk=at("lock",d8);/**
|
|
316
|
+
* @license lucide-react v0.577.0 - ISC
|
|
317
|
+
*
|
|
318
|
+
* This source code is licensed under the ISC license.
|
|
319
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
+
*/const f8=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],h8=at("message-square",f8);/**
|
|
321
|
+
* @license lucide-react v0.577.0 - ISC
|
|
322
|
+
*
|
|
323
|
+
* This source code is licensed under the ISC license.
|
|
324
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
+
*/const m8=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],p8=at("monitor",m8);/**
|
|
326
|
+
* @license lucide-react v0.577.0 - ISC
|
|
327
|
+
*
|
|
328
|
+
* This source code is licensed under the ISC license.
|
|
329
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
+
*/const g8=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],x8=at("moon",g8);/**
|
|
331
|
+
* @license lucide-react v0.577.0 - ISC
|
|
332
|
+
*
|
|
333
|
+
* This source code is licensed under the ISC license.
|
|
334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
+
*/const b8=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Ig=at("network",b8);/**
|
|
336
|
+
* @license lucide-react v0.577.0 - ISC
|
|
337
|
+
*
|
|
338
|
+
* This source code is licensed under the ISC license.
|
|
339
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
+
*/const v8=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],LA=at("octagon-x",v8);/**
|
|
341
|
+
* @license lucide-react v0.577.0 - ISC
|
|
342
|
+
*
|
|
343
|
+
* This source code is licensed under the ISC license.
|
|
344
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
+
*/const y8=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],t2=at("package",y8);/**
|
|
346
|
+
* @license lucide-react v0.577.0 - ISC
|
|
347
|
+
*
|
|
348
|
+
* This source code is licensed under the ISC license.
|
|
349
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
+
*/const w8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],j8=at("panel-left",w8);/**
|
|
351
|
+
* @license lucide-react v0.577.0 - ISC
|
|
352
|
+
*
|
|
353
|
+
* This source code is licensed under the ISC license.
|
|
354
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
+
*/const S8=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],N8=at("pause",S8);/**
|
|
356
|
+
* @license lucide-react v0.577.0 - ISC
|
|
357
|
+
*
|
|
358
|
+
* This source code is licensed under the ISC license.
|
|
359
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
+
*/const C8=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],_k=at("pencil",C8);/**
|
|
361
|
+
* @license lucide-react v0.577.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/const k8=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],$A=at("play",k8);/**
|
|
366
|
+
* @license lucide-react v0.577.0 - ISC
|
|
367
|
+
*
|
|
368
|
+
* This source code is licensed under the ISC license.
|
|
369
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
+
*/const T8=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],n2=at("plug",T8);/**
|
|
371
|
+
* @license lucide-react v0.577.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/const E8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ys=at("plus",E8);/**
|
|
376
|
+
* @license lucide-react v0.577.0 - ISC
|
|
377
|
+
*
|
|
378
|
+
* This source code is licensed under the ISC license.
|
|
379
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
+
*/const R8=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],rl=at("refresh-cw",R8);/**
|
|
381
|
+
* @license lucide-react v0.577.0 - ISC
|
|
382
|
+
*
|
|
383
|
+
* This source code is licensed under the ISC license.
|
|
384
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
+
*/const A8=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],M8=at("rotate-ccw",A8);/**
|
|
386
|
+
* @license lucide-react v0.577.0 - ISC
|
|
387
|
+
*
|
|
388
|
+
* This source code is licensed under the ISC license.
|
|
389
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
+
*/const O8=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],BA=at("rotate-cw",O8);/**
|
|
391
|
+
* @license lucide-react v0.577.0 - ISC
|
|
392
|
+
*
|
|
393
|
+
* This source code is licensed under the ISC license.
|
|
394
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
+
*/const D8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],z8=at("search",D8);/**
|
|
396
|
+
* @license lucide-react v0.577.0 - ISC
|
|
397
|
+
*
|
|
398
|
+
* This source code is licensed under the ISC license.
|
|
399
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
+
*/const I8=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],$f=at("server",I8);/**
|
|
401
|
+
* @license lucide-react v0.577.0 - ISC
|
|
402
|
+
*
|
|
403
|
+
* This source code is licensed under the ISC license.
|
|
404
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
+
*/const P8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Iu=at("shield-check",P8);/**
|
|
406
|
+
* @license lucide-react v0.577.0 - ISC
|
|
407
|
+
*
|
|
408
|
+
* This source code is licensed under the ISC license.
|
|
409
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
+
*/const _8=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],s2=at("shield-off",_8);/**
|
|
411
|
+
* @license lucide-react v0.577.0 - ISC
|
|
412
|
+
*
|
|
413
|
+
* This source code is licensed under the ISC license.
|
|
414
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
+
*/const L8=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],$8=at("sliders-horizontal",L8);/**
|
|
416
|
+
* @license lucide-react v0.577.0 - ISC
|
|
417
|
+
*
|
|
418
|
+
* This source code is licensed under the ISC license.
|
|
419
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
+
*/const B8=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],V8=at("square-code",B8);/**
|
|
421
|
+
* @license lucide-react v0.577.0 - ISC
|
|
422
|
+
*
|
|
423
|
+
* This source code is licensed under the ISC license.
|
|
424
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
+
*/const U8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],H8=at("square-plus",U8);/**
|
|
426
|
+
* @license lucide-react v0.577.0 - ISC
|
|
427
|
+
*
|
|
428
|
+
* This source code is licensed under the ISC license.
|
|
429
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
+
*/const F8=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],VA=at("square-terminal",F8);/**
|
|
431
|
+
* @license lucide-react v0.577.0 - ISC
|
|
432
|
+
*
|
|
433
|
+
* This source code is licensed under the ISC license.
|
|
434
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
+
*/const G8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],q8=at("square",G8);/**
|
|
436
|
+
* @license lucide-react v0.577.0 - ISC
|
|
437
|
+
*
|
|
438
|
+
* This source code is licensed under the ISC license.
|
|
439
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
+
*/const Y8=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],K8=at("sun",Y8);/**
|
|
441
|
+
* @license lucide-react v0.577.0 - ISC
|
|
442
|
+
*
|
|
443
|
+
* This source code is licensed under the ISC license.
|
|
444
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
445
|
+
*/const X8=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],r2=at("terminal",X8);/**
|
|
446
|
+
* @license lucide-react v0.577.0 - ISC
|
|
447
|
+
*
|
|
448
|
+
* This source code is licensed under the ISC license.
|
|
449
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
+
*/const W8=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Lk=at("timer",W8);/**
|
|
451
|
+
* @license lucide-react v0.577.0 - ISC
|
|
452
|
+
*
|
|
453
|
+
* This source code is licensed under the ISC license.
|
|
454
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
455
|
+
*/const Q8=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ts=at("trash-2",Q8);/**
|
|
456
|
+
* @license lucide-react v0.577.0 - ISC
|
|
457
|
+
*
|
|
458
|
+
* This source code is licensed under the ISC license.
|
|
459
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
460
|
+
*/const Z8=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ti=at("triangle-alert",Z8);/**
|
|
461
|
+
* @license lucide-react v0.577.0 - ISC
|
|
462
|
+
*
|
|
463
|
+
* This source code is licensed under the ISC license.
|
|
464
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
465
|
+
*/const J8=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],e7=at("upload",J8);/**
|
|
466
|
+
* @license lucide-react v0.577.0 - ISC
|
|
467
|
+
*
|
|
468
|
+
* This source code is licensed under the ISC license.
|
|
469
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
470
|
+
*/const t7=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],n7=at("user-round",t7);/**
|
|
471
|
+
* @license lucide-react v0.577.0 - ISC
|
|
472
|
+
*
|
|
473
|
+
* This source code is licensed under the ISC license.
|
|
474
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
475
|
+
*/const s7=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Xa=at("users",s7);/**
|
|
476
|
+
* @license lucide-react v0.577.0 - ISC
|
|
477
|
+
*
|
|
478
|
+
* This source code is licensed under the ISC license.
|
|
479
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
480
|
+
*/const r7=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],$k=at("webhook",r7);/**
|
|
481
|
+
* @license lucide-react v0.577.0 - ISC
|
|
482
|
+
*
|
|
483
|
+
* This source code is licensed under the ISC license.
|
|
484
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
485
|
+
*/const o7=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pn=at("x",o7);function Nt({className:e,...t}){return n.jsx(Ql,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:js("size-4 animate-spin motion-reduce:animate-none",e),...t})}function a7(e){try{const t=new URL(e);return t.origin===e&&t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)&&!!t.port&&Number(t.port)>0&&!t.username&&!t.password}catch{return!1}}function i7(e){var t;try{const r=(t=/^#local-connect=([A-Za-z0-9_-]+)$/.exec(e))==null?void 0:t[1];if(!r||r.length>2048)return null;const a=JSON.parse(atob(r.replaceAll("-","+").replaceAll("_","/")));return!a7(a.origin)||!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(a.nonce??"")||!/^[a-f0-9]{64}$/.test(a.challenge??"")?null:{origin:a.origin,nonce:a.nonce,challenge:a.challenge}}catch{return null}}function l7(e,t,r,a=ku){var i;return!!(a&&t&&e.source===t&&e.origin===a&&((i=e.data)==null?void 0:i.type)==="openrod-local-connected"&&e.data.nonce===r&&typeof e.data.code=="string"&&/^[a-f0-9]{64}\.[a-f0-9]{64}$/.test(e.data.code))}async function Fa(e,t,{signal:r,owner:a=JR()}={}){const i=await fetch(`/api/local-cloud/${e}`,{signal:r,method:t===void 0?"GET":"POST",headers:{...a?{"x-openrod-local-owner":a}:{},...t===void 0?{}:{"content-type":"application/json","x-openshell-console":"1"}},body:t===void 0?void 0:JSON.stringify(t)}),c=await i.json().catch(()=>({}));if((c.code==="CLOUD_OWNER_CHANGED"||i.status===401&&["machine","inventory"].includes(e))&&window.dispatchEvent(new Event("openrod-session-expired")),!i.ok)throw Object.assign(new Error(c.error??"Cloud connection unavailable"),{status:i.status});return c}const c7=(e,t)=>new Promise((r,a)=>{const i=()=>{clearTimeout(c),a(new DOMException("Cloud preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);t==null||t.addEventListener("abort",i,{once:!0}),t!=null&&t.aborted&&i()});async function UA(e,{signal:t,onProgress:r=()=>{},wait:a=c7,attempts:i=120}={}){var c,u,f;for(let h=0;h<i;h++){t==null||t.throwIfAborted();const m=await e();if(t==null||t.throwIfAborted(),!m.connected)throw new Error("Your cloud connection expired. Connect again to continue.");if(m.error)throw new Error(m.error);if(r(m),((c=m.machine)==null?void 0:c.status)==="ready")return m;if(((u=m.machine)==null?void 0:u.status)==="error"||(f=m.machine)!=null&&f.error)throw new Error(m.machine.error??"Your cloud machine could not start.");h<i-1&&await a(5e3,t)}throw new Error("Your private machine is still preparing. Check its status before trying again.")}async function u7({owner:e,signal:t,onProgress:r,request:a=Fa,wait:i,attempts:c}={}){t==null||t.throwIfAborted();const u=await a("machine",{},{signal:t,owner:e});let f=!0;return UA(async()=>{const h=f?u:await a("machine",void 0,{signal:t,owner:e});if(f=!1,h.owner!==e)throw new Error("Your cloud account changed. Choose the destination again.");return h},{signal:t,onProgress:r,wait:i,attempts:c})}async function HA(e,t,r,a){const i=await e.cloudExport(r),c=await t.importCloud(a?{...i.bundle,destinationGroups:a}:i.bundle);return{...c,warning:c.warning||i.warning}}async function d7(e,t,r,a){if(t.target!=="local")throw Error("Choose a local destination for this workspace.");return HA(e,t,r,a)}async function f7(e,t=fetch){const r=await t("/api/cloud/local-connect/authorize",{method:"POST",headers:{"content-type":"application/json","x-openshell-console":"1"},body:JSON.stringify(e)}),a=await r.json().catch(()=>({}));if(!r.ok)throw new Error(a.error??"Could not finish sign-in.");if(typeof a.code!="string"||!/^[a-f0-9]{64}\.[a-f0-9]{64}$/.test(a.code))throw new Error("Invalid sign-in response.");return a}const o2="account",h7=e=>new URLSearchParams(e).get(o2)==="choose";function m7(e){const t=new URL(e);return t.searchParams.set(o2,"choose"),t.href}function p7({popup:e,origin:t,cloud:r=ku,chooseAccount:a=!1,request:i=Fa,events:c=window,focus:u=()=>window.focus(),setTimer:f=setInterval,clearTimer:h=clearInterval,now:m=Date.now}){let p,g=!1,b=!1,v,w;const C=new Promise((R,T)=>{v=R,w=T}),S=async()=>{p&&await i("cancel",{nonce:p}).catch(()=>{})},N=()=>{h(M),c.removeEventListener("message",k)};function E(R="Cloud sign-in was cancelled."){return b?Promise.resolve():(b=!0,N(),e.close(),w(new Error(R)),S())}const k=async R=>{if(!(b||g||!p||!l7(R,e,p,r))){g=!0;try{const T=await i("finish",{nonce:p,code:R.data.code});if(b){await S();return}if(!T.connected||!T.user)throw new Error("Sign-in did not finish. Try again.");b=!0,N(),e.close(),u(),v(T)}catch(T){if(b){await S();return}await E(T.message)}}},A=m()+15*6e4,M=f(()=>{(e.closed||m()>A)&&E(e.closed?"Cloud sign-in was cancelled.":"Cloud sign-in timed out. Try again.")},500);return c.addEventListener("message",k),Promise.resolve().then(async()=>{if(b)return;const R=await i("start",{origin:t});if(p=R.nonce,b){await S();return}e.location.href=a?m7(R.url):R.url}).catch(R=>{b||E(R.message)}),{promise:C,cancel:E}}const Pg=x.createContext(null),bv="openrod-cloud-choose-account",vv={get:()=>{try{return localStorage.getItem(bv)==="1"}catch{return!1}},set:e=>{try{e?localStorage.setItem(bv,"1"):localStorage.removeItem(bv)}catch{}}},FA=x.createContext(null),ds=()=>x.useContext(Pg);function Bf(){const e=x.useContext(FA);if(!e)throw new Error("useApi outside ComputeSession");return e}function g7({target:e,children:t}){const r=ds(),a=x.useMemo(()=>e&&(r!=null&&r.localViewer)?{...r,target:e,nativeActions:e==="local"||!!r.connected}:r,[r,e]);return n.jsx(Pg.Provider,{value:a,children:t})}function ky({target:e,ownerScope:t,children:r}){const a=x.useMemo(()=>{const i=new AbortController;return{controller:i,generation:0,api:lr(e,i.signal)}},[e,t]);return x.useEffect(()=>{const i=++a.generation;return()=>queueMicrotask(()=>{i===a.generation&&a.controller.abort()})},[a]),n.jsx(FA.Provider,{value:a.api,children:r})}function x7({children:e,user:t,logout:r}){QR("cloud");const a={target:"cloud",localViewer:!1,nativeActions:!1,user:t,logout:r,connected:!0,available:!0};return n.jsx(Pg.Provider,{value:a,children:n.jsx(ky,{target:"local",children:e})})}function b7({children:e,status:t,onStatus:r,onCancel:a}){var w;const[i,c]=x.useState(((w=t.machine)==null?void 0:w.status)==="ready"),[u,f]=x.useState(t.machine),[h,m]=x.useState(""),[p,g]=x.useState(0),[b,v]=x.useState(!1);return x.useEffect(()=>{if(i)return;const C=new AbortController;return m(""),Fa("machine",b?{}:void 0,{signal:C.signal}).then(S=>{var N;return((N=S.machine)==null?void 0:N.status)==="none"?(f(S.machine),null):UA(()=>Fa("machine",void 0,{signal:C.signal}),{signal:C.signal,onProgress:E=>{f(E.machine),r(E)}})}).then(S=>{S&&c(!0)}).catch(S=>{S.name!=="AbortError"&&m(S.message)}),()=>C.abort()},[p,i,r,b]),i?e:n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:(u==null?void 0:u.status)==="none"?"Start OpenRod Cloud":"Starting your cloud machine…"}),n.jsx("p",{role:"status",className:"mt-3 text-sm text-muted-foreground",children:(u==null?void 0:u.message)||"Your account has one dedicated machine. Its first start can take several minutes."}),(u==null?void 0:u.status)==="none"&&!h&&n.jsx(le,{className:"mt-5",onClick:()=>v(!0),children:"Start cloud machine"}),h&&n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:h}),n.jsx("button",{className:"mt-4 text-sm underline",onClick:()=>{v(!0),g(C=>C+1)},children:"Try again"})]}),n.jsx("button",{className:"mt-6 block w-full text-xs underline",onClick:a,children:"Use local compute"}),ku&&n.jsx("a",{href:ku,target:"_blank",rel:"noopener noreferrer",className:"mt-4 block text-xs underline",children:"Open cloud console"})]})})}function v7({children:e}){var U;const[t,r]=x.useState("local"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,h]=x.useState(!1),[m,p]=x.useState(!1),g=x.useRef(null),[b,v]=x.useState(null),[w,C]=x.useState(0),S=x.useRef(null),N=x.useCallback(async H=>{const W=await Fa("status",void 0,{signal:H});return i(q=>({...q,...W})),u(W.error??""),W},[]),E=x.useRef({uid:null,revision:0});QR(t),dk(a!=null&&a.connected?a.owner:null),x.useEffect(()=>{let H=!0;Fa("status").then(q=>{H&&(i(q),u(q.error??""))}).catch(q=>{H&&(u(q.message),i({connected:!1,available:!1}))});const W=()=>{i(q=>({...q,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")};return window.addEventListener("openrod-session-expired",W),()=>{var q,Z;H=!1,window.removeEventListener("openrod-session-expired",W),(q=g.current)==null||q.cancel("Cloud connection cancelled."),(Z=S.current)==null||Z.controller.abort()}},[]),x.useEffect(()=>{if(!(a!=null&&a.connected)||!a.expires)return;const H=typeof a.expires=="number"?a.expires:Date.parse(a.expires);if(!Number.isFinite(H))return;const W=setTimeout(()=>{i(q=>({...q,connected:!1,machine:null})),u("Your cloud connection expired. Connect again to continue.")},Math.max(0,H-Date.now()));return()=>clearTimeout(W)},[a]);function k(H){if(!["local","cloud"].includes(H))return;try{sessionStorage.setItem(t6,H)}catch{}const W=new URL(window.location.href);W.searchParams.delete("target"),W.hash="",window.history.replaceState(null,"",W),window.dispatchEvent(new HashChangeEvent("hashchange")),r(H)}async function A(){if(a!=null&&a.connected)return a;if(!(a!=null&&a.available))throw new Error((a==null?void 0:a.reason)||"OpenRod Cloud is not configured on this computer.");if(g.current)throw new Error("A cloud sign-in is already open.");const H=window.open("about:blank","_blank","popup,width=760,height=720");if(!H)throw new Error("Allow popups to connect your local OpenRod to cloud.");const W=p7({popup:H,origin:window.location.origin,cloud:a.origin||ku,chooseAccount:vv.get()});g.current=W,h(!0),u("");try{const q=await W.promise;if(g.current!==W)throw new Error("Cloud sign-in was cancelled.");return dk(q.owner),vv.set(!1),i(Z=>({...Z,...q})),q}catch(q){throw g.current===W&&u(q.message),q}finally{g.current===W&&(g.current=null,h(!1))}}function M(H="Cloud connection cancelled."){const W=g.current;if(W)return g.current=null,h(!1),u(H),W.cancel(H)}async function R(){vv.set(!0);try{const H=await Fa("disconnect",{});i(H),k("local")}catch(H){throw[401,403].includes(H.status)&&(i(W=>({...W,connected:!1,machine:null})),k("local")),u(H.message),H}}async function T({signal:H,onProgress:W}={}){H==null||H.throwIfAborted();const q=A(),Z=g.current,z=()=>{Z&&g.current===Z&&M()};H==null||H.addEventListener("abort",z,{once:!0});let L;try{L=await q}finally{H==null||H.removeEventListener("abort",z)}H==null||H.throwIfAborted();const X=L.owner;return u7({owner:X,signal:H,onProgress:_=>{if(_.owner!==X)throw new Error("Your cloud account changed. Choose the destination again.");i(V=>({...V,..._})),W==null||W(_)}})}function O(){if(S.current)return;const H={controller:new AbortController};S.current=H;const W=q=>{S.current===H&&v(Z=>({...Z,...q}))};v({stage:a!=null&&a.connected?"preparing":"signing-in",error:null}),T({signal:H.controller.signal,onProgress:q=>W({stage:"preparing",machine:q.machine})}).then(()=>{W({stage:"ready"}),N().catch(()=>{})}).catch(q=>{q.name==="AbortError"||H.controller.signal.aborted?S.current===H&&v(null):W({stage:"failed",error:q.message})}).finally(()=>{S.current===H&&(S.current=null)})}function D(){const H=S.current;S.current=null,H==null||H.controller.abort(),v(null)}function B(){S.current||v(null)}const F=x.useCallback(()=>(C(H=>H+1),()=>C(H=>H-1)),[]);E.current=s6(E.current,a!=null&&a.connected?(U=a.user)==null?void 0:U.uid:null);const K=E.current.revision,$=`${t}:${K}`,P={target:t,status:a,available:!!(a!=null&&a.available),checking:a===null,refresh:N,prepare:T,localViewer:!0,nativeActions:t==="local"||!!(a!=null&&a.connected),user:a==null?void 0:a.user,connected:!!(a!=null&&a.connected),connecting:f,error:c,connect:A,disconnect:R,selectTarget:k,createRequested:m,requestCreate:p,cancelConnect:()=>M(),cloudSetup:b,cloudSetupWatched:w>0,startCloudSetup:O,cancelCloudSetup:D,dismissCloudSetup:B,watchCloudSetup:F};return n.jsx(Pg.Provider,{value:P,children:t==="cloud"&&!(a!=null&&a.connected)?n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:"Connect your cloud workspace"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Sign in with Google to control your private cloud machine from local OpenRod."}),c&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:c}),n.jsxs(le,{disabled:!(a!=null&&a.available)||f,className:"mt-6",onClick:()=>A().catch(()=>{}),children:[f&&n.jsx(Nt,{}),a===null?"Checking connection…":f?"Connecting…":"Continue with Google"]}),a&&!a.available&&n.jsx("p",{role:"status",className:"mt-3 text-xs text-muted-foreground",children:a.reason||"OpenRod Cloud is not configured on this computer."}),n.jsx("button",{className:"mt-4 block w-full text-xs underline",onClick:()=>{M(),k("local")},children:"Use local compute"})]})}):t==="cloud"?n.jsx(b7,{status:a,onStatus:i,onCancel:()=>k("local"),children:n.jsx(ky,{target:t,ownerScope:K,children:e},$)},`cloud:${K}`):n.jsx(ky,{target:t,ownerScope:K,children:e},$)})}function ra(e){return Array.isArray(e)?e.map(ra):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>[t,ra(e[t])])):e}const yv=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r])=>!t.includes(r))),Ty=["location","copies","sourceOrg","sourceSetups","id","createdAt","updatedAt","revision","importedAt","importSource","localSource","configurationCount"];function Ey(e,t){if(e==="network"&&t.sourceOrg){const r=u=>{var h;const f=t.sourceOrg.groups.find(m=>m.id===u);return f?yv(Ey("groups",f),["template"]):{missing:u,source:(h=t.location)==null?void 0:h.id}},a=u=>{var h,m;const f=(h=t.sourceSetups)==null?void 0:h.find(p=>p.id===u);return f?Ey("setups",f):{missing:u,source:(m=t.location)==null?void 0:m.id}},i=u=>u.map(f=>ra(f)).sort((f,h)=>JSON.stringify(f).localeCompare(JSON.stringify(h))),c=yv(t,Ty);return{...c,destinations:i(c.destinations),appliesTo:{...c.appliesTo,groups:i(c.appliesTo.groups.map(r)),setups:i((c.appliesTo.setups??[]).map(a)),sandboxes:i(c.appliesTo.sandboxes)},...c.setup?{setup:{...c.setup,id:a(c.setup.id)}}:{}}}return e==="setups"?{name:t.name,items:t.items.map(r=>({name:r.name,kind:r.kind,contentDigest:r.contentDigest??t.revision})).sort((r,a)=>JSON.stringify(r).localeCompare(JSON.stringify(a)))}:e==="templates"?{name:t.name,recipe:t.recipe,managed:t.managed,status:t.status,exists:t.exists}:yv(t,Ty)}const Bi=(e,t)=>JSON.stringify(ra(Ey(e,t)));function xf(e,t){const r=[];for(const a of t){const i=e!=="network"&&a.name?JSON.stringify([e,a.name]):Bi(e,a),c=r.find(u=>u.key===i&&!u.copies.some(f=>{var h,m;return((h=f.location)==null?void 0:h.id)===((m=a.location)==null?void 0:m.id)}));c?c.copies.push(a):r.push({key:i,copies:[a]})}return r.map(({copies:a})=>({...a.find(i=>{var c;return((c=i.location)==null?void 0:c.connected)!==!1})??a[0],copies:a,configurationCount:new Set(a.map(i=>Bi(e,i))).size}))}const a2=e=>(e==null?void 0:e.copies)??(e?[e]:[]);function y7(e,t){const r=a2(e);return t.filter(a=>{var i,c;return((i=a.location)==null?void 0:i.id)!==((c=e.location)==null?void 0:c.id)&&r.some(u=>{var f,h;return((f=u.location)==null?void 0:f.id)===((h=a.location)==null?void 0:h.id)&&(u.id??u.name)===(a.id??a.name)})&&t.filter(u=>{var f,h;return((f=u.location)==null?void 0:f.id)===((h=a.location)==null?void 0:h.id)&&(u.id??u.name)===(a.id??a.name)}).length===1})}function GA(e,t,r){if(t&&typeof t=="object"&&!Array.isArray(t)){const a={...r};for(const[i,c]of Object.entries(t))JSON.stringify(ra(e==null?void 0:e[i]))!==JSON.stringify(ra(c))&&(a[i]=GA(e==null?void 0:e[i],c,r==null?void 0:r[i]));return a}return t}async function w7({type:e,before:t,args:r,method:a},i,c){var p,g;if(!((p=i.location)!=null&&p.connected))throw new Error("Reconnect this source before applying changes.");const u=e==="setups"?await c.setups():e==="templates"?await c.imageTemplates():(await c.org())[e==="network"?"policies":"groups"],f=(Array.isArray(u)?u:u.templates??[]).find(b=>(b.id??b.name)===(i.id??i.name));if(!f||Bi(e,{...f,sourceOrg:void 0,sourceSetups:void 0})!==Bi(e,{...i,sourceOrg:void 0,sourceSetups:void 0}))throw new Error("This source changed. Reopen it before applying the edit.");if(a==="deleteSetupItem"){const b=t.items.find(w=>w.id===r[1]),v=f.items.filter(w=>w.name===(b==null?void 0:b.name)&&w.kind===(b==null?void 0:b.kind)&&(b.contentDigest?w.contentDigest===b.contentDigest:f.revision===t.revision));if(v.length!==1)throw new Error("The matching item differs on this source. Edit it separately.");return c.deleteSetupItem(f.id,v[0].id,f.revision)}const h={},m=e==="templates"?t.recipe:t;for(const[b,v]of Object.entries(r[0]))Ty.includes(b)||b==="isNew"||e==="templates"&&b==="environment"||JSON.stringify(ra(m[b]))!==JSON.stringify(ra(v))&&(h[b]=GA(m[b],v,(e==="templates"?f.recipe:f)[b]));if(a==="savePolicy"){const b=await c.org(),v={...f,...h,id:f.id,isNew:!1};if(h.appliesTo){v.appliesTo={...f.appliesTo};for(const[w,C]of Object.entries(h.appliesTo))JSON.stringify(ra(C))!==JSON.stringify(ra(t.appliesTo[w]))&&(w==="groups"?v.appliesTo.groups=C.map(S=>{var k;const N=(k=t.sourceOrg)==null?void 0:k.groups.find(A=>A.id===S),E=N?b.groups.filter(A=>Bi("groups",A)===Bi("groups",N)):b.groups.filter(A=>A.id===S);if(E.length!==1)throw new Error("A changed group is missing or ambiguous here. Import or select it separately.");return E[0].id}):v.appliesTo[w]=C)}if(v.appliesTo.groups.some(w=>!b.groups.some(C=>C.id===w)))throw new Error("A required group is missing here. Import it first.");if((g=v.appliesTo.setups)!=null&&g.length){const w=await c.setups();if(v.appliesTo.setups.some(C=>!w.some(S=>S.id===C)))throw new Error("A required setup is missing here. Import it first.")}return c.savePolicy(v)}if(a==="saveGroup")return c.saveGroup({...f,...h,id:f.id,isNew:!1});if(a==="buildImageTemplate"){if(!Object.keys(h).length)throw new Error("Only environment values changed. Enter them on this source separately.");return c.buildImageTemplate({...f.recipe,...h,name:f.name},!0)}throw new Error("This change must be made separately on each source.")}const nc={local:{id:"local",label:"Local",hint:"Runs on this computer"},remote:{id:"remote",label:"Remote",hint:"Runs on an SSH host"},cloud:{id:"cloud",label:"Cloud",hint:"Runs on a cloud machine"}},xp=e=>{var t;return e!=null&&e.cloud||(e==null?void 0:e.target)==="cloud"?"cloud":((t=nc[e==null?void 0:e.placement])==null?void 0:t.id)??(e!=null&&e.remote?"remote":"local")},Dn=e=>(e==null?void 0:e.label)??((e==null?void 0:e.target)==="cloud"?"Cloud":e!=null&&e.remote?`SSH · ${e.host??e.gateway}`:"Local"),ht=e=>{var t,r;return JSON.stringify([[((t=e.location)==null?void 0:t.target)??"local",((r=e.location)==null?void 0:r.context)??""],e.id??e.name])},Bk=new WeakMap;async function j7(e,t,r=1e3){const a=Bk.get(e),i=en.startFlow("gateway_connection",{location_type:"local"},(a==null?void 0:a.outcome)==="failed"?a:null);Bk.set(e,i);try{let c=await e.connect({localGateway:t});for(;c.status==="working";)await new Promise(u=>setTimeout(u,r)),c=await e.connectionJob(c.id);if(c.status!=="ready")throw new Error(c.error||`Couldn’t connect to ${t}.`);return en.finishFlow(i,"connected"),c}catch(c){throw en.finishFlow(i,"failed",Cu(c)),c}}const wv=({x:e,y:t})=>n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:e-1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:e+1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:`M${e-1.1} ${t+1.5}q1.1 1 2.2 0`})]}),S7={local:()=>n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"2.5",y:"2.5",width:"11",height:"8",rx:"1.8"}),n.jsx("path",{d:"M1 13.5h14"}),n.jsx(wv,{x:8,y:6})]}),remote:()=>n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"3",y:"5",width:"10",height:"9",rx:"2"}),n.jsx("path",{d:"M5.8 3a3.2 3.2 0 0 1 4.4 0"}),n.jsx("circle",{cx:"8",cy:"1.6",r:".55",fill:"currentColor",stroke:"none",className:"motion-safe:animate-pulse"}),n.jsx(wv,{x:8,y:8.8})]}),cloud:()=>n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4.5 13.5a3 3 0 0 1-.4-6 4 4 0 0 1 7.7-.7 3.4 3.4 0 0 1-.1 6.7z"}),n.jsx("path",{d:"M13.6 1.2v2M12.6 2.2h2",className:"motion-safe:animate-pulse"}),n.jsx(wv,{x:7.6,y:9.6})]})},N7={local:"bg-indigo-50 text-indigo-700 ring-indigo-200 dark:bg-indigo-500/15 dark:text-indigo-300 dark:ring-indigo-400/30",remote:"bg-fuchsia-50 text-fuchsia-700 ring-fuchsia-200 dark:bg-fuchsia-500/15 dark:text-fuchsia-300 dark:ring-fuchsia-400/30",cloud:"bg-sky-50 text-sky-700 ring-sky-200 dark:bg-sky-500/15 dark:text-sky-300 dark:ring-sky-400/30"};function C7({type:e,className:t="size-3.5"}){const r=S7[e];return n.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:`shrink-0 overflow-visible transition-transform duration-200 motion-safe:group-hover:-translate-y-px motion-safe:group-hover:-rotate-6 ${t}`,children:n.jsx(r,{})})}function qA({type:e,title:t}){return n.jsxs("span",{title:t,className:`inline-flex h-5 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-full pr-2 pl-1.5 font-sans text-[11px] leading-none font-medium ring-1 ring-inset ${N7[e]}`,children:[n.jsx(C7,{type:e}),nc[e].label]})}function Hs({location:e}){const t=xp(e);return n.jsx(qA,{type:t,title:`${nc[t].hint} · ${Dn(e)}`})}function po({controlled:e,default:t,name:r,state:a="value"}){const{current:i}=x.useRef(e!==void 0),[c,u]=x.useState(t),f=i&&e!==void 0?e:c,h=x.useCallback(m=>{i||u(m)},[]);return[f,h]}const YA={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},_g={...YA,position:"fixed",top:0,left:0},i2={...YA,position:"absolute"};function k7(e){if(!e)return null;for(const t of e.elements){const r=t.tagName;if(r==="BUTTON"||r==="INPUT"){const a=t;if(a.type==="submit")return a}}return null}const T7="data-valid",E7="data-invalid",R7={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},A7={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},M7={disabled:!1,...A7},Lg={valid(e){return e===null?null:e?{[T7]:""}:{[E7]:""}}},O7="data-checked",D7="data-unchecked";function KA(e){return{checked(t){return e.indeterminate?{}:t?{[O7]:""}:{[D7]:""}},...Lg}}let Vk=0;function z7(e,t="mui"){const[r,a]=x.useState(e),i=e||r;return x.useEffect(()=>{r==null&&(Vk+=1,a(`${t}-${Vk}`))},[r,t]),i}const Uk=F1.useId;function sc(e,t){if(Uk!==void 0){const r=Uk();return e??(t?`${t}-${r}`:r)}return z7(e,t)}function ws(e){return sc(e,"base-ui")}const I7={invalid:void 0,name:void 0,validityData:{state:R7,errors:[],error:"",value:"",initialValue:null},setValidityData:$n,disabled:void 0,setTouched:$n,setDirty:$n,setFilled:$n,setFocused:$n,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:M7,registerFieldControl:$n,validation:{getValidationProps:(e,t=En)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:$n,getInputControl:()=>null,commit:async()=>{},change:$n}},P7=x.createContext(I7);function Pu(e=!0){const t=x.useContext(P7);if(t.setValidityData===$n&&!e)throw new Error(rn(28));return t}function $g(e,t,r,a,i=!0,c){const{registerFieldControl:u}=Pu(),f=vs(()=>Symbol());We(()=>{const h=f.current;if(!i){u(h,void 0);return}u(h,{controlRef:e,getValue:a,id:t,name:c,value:r})},[e,i,a,t,c,u,f,r]),We(()=>{const h=f.current;return()=>{u(h,void 0)}},[u,f])}const _7=x.createContext({disabled:!1});function L7(){return x.useContext(_7)}const $7=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:$n,validationMode:"onSubmit",submitCountRef:{current:0}});function Bg(){return x.useContext($7)}const B7=x.createContext({controlId:void 0,registerControlId:$n,resetControlId:$n,labelId:void 0,setLabelId:$n,messageIds:[],setMessageIds:$n,getDescriptionProps:e=>e});function Vf(){return x.useContext(B7)}function XA(e,t,r,a=!0,i){const[c,u]=x.useState(),f=ws(i?`${i}-label`:void 0),h=e??t??c;return We(()=>{const m=e||t||!a?void 0:V7(r.current,f);c!==m&&u(m)}),h}function V7(e,t){const r=U7(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}function U7(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const r=e.id;if(r){const i=e.nextElementSibling;if(i&&i.htmlFor===r)return i}const a=e.labels;return a&&a[0]}function Uf(e={}){const{id:t,enabled:r=!0}=e,{controlId:a,registerControlId:i,resetControlId:c}=Vf(),u=ws(),f=vs(()=>Symbol()),h=x.useRef(!1),m=x.useRef(!1),p=st(()=>{!h.current||i===$n||(h.current=!1,i(f.current,void 0))});return We(()=>{if(!r||i===$n){p();return}let g;if(t!==void 0)m.current=!0,g=t;else if(m.current)g=u;else{c();return}if(g===void 0){p();return}h.current=!0,i(f.current,g)},[t,r,i,c,u,f,p]),We(()=>p,[p]),(r?a:void 0)??t??u}const H7=x.createContext(void 0);function F7(){return x.useContext(H7)}const WA=x.createContext(void 0);function G7(){const e=x.useContext(WA);if(e===void 0)throw new Error(rn(14));return e}const Ur="none",ma="trigger-press",Qn="trigger-hover",gu="trigger-focus",Vg="outside-press",Zl="item-press",QA="close-press",Ji="focus-out",Hf="escape-key",Ry="list-navigation",ZA="cancel-open",Xd="sibling-open",JA="disabled",Hk="missing",Fk="initial",Ug="imperative-action",q7="window-resize";function yt(e,t,r,a){let i=!1,c=!1;const u=a??En;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:r,...u}}function Ff(e,t){const r=x.useRef(e),a=st(t);We(()=>{r.current!==e&&a(r.current),r.current=e},[e,a])}const Y7="data-parent",K7=x.forwardRef(function(t,r){const{checked:a,className:i,defaultChecked:c=!1,"aria-labelledby":u,disabled:f=!1,form:h,id:m,indeterminate:p=!1,inputRef:g,name:b,onCheckedChange:v,parent:w=!1,readOnly:C=!1,render:S,required:N=!1,uncheckedValue:E,value:k,nativeButton:A=!1,style:M,...R}=t,{clearErrors:T}=Bg(),{disabled:O,name:D,setDirty:B,setFilled:F,setFocused:K,setTouched:$,state:P,validationMode:U,validityData:H,validation:W}=Pu(),q=L7(),{labelId:Z,registerControlId:z,getDescriptionProps:L}=Vf(),X=F7(),ee=(X==null?void 0:X.allValues)===void 0?void 0:X.parent,_=ee!==void 0,V=O||q.disabled||(X==null?void 0:X.disabled)||f,G=D??b,Y=k??G,ne=ws(),te=(X==null?void 0:X.registerControlId)!==z,ye=Uf({id:m||void 0,enabled:te}),ae=A?ye:ne;let ue={};_&&(w?ue=ee.getParentProps():Y!==void 0&&(ue=ee.getChildProps(Y)));const{checked:se=a,indeterminate:Q=p,onCheckedChange:ie,...oe}=ue,pe=X==null?void 0:X.value,xe=x.useRef(null),{getButtonProps:je,buttonRef:Ie}=bo({disabled:V,native:A}),ce=(X==null?void 0:X.validation)??W,[Te,re]=po({controlled:Y!==void 0&&pe!==void 0&&!w?pe.includes(Y):se,default:c,name:"Checkbox",state:"checked"}),fe=_?!!se:Te,Re=_&&Q||p;$g(xe,ne,Te,void 0,!X&&!V,b);const Oe=ee==null?void 0:ee.registerChildId,ke=x.useRef(null),he=ce.registerInput,Ae=X?Y:void 0,ge=x.useCallback(rt=>he(rt,{controlRef:xe,value:Ae}),[he,Ae]),Pe=mo(g,ke,w?void 0:ge),Fe=XA(u,Z,ke,!A,ye);We(()=>{ke.current&&(ke.current.indeterminate=Re),X||F(Te)},[Te,Re,X,F]),Ff(Te,()=>{X||(T(G),B(Te!==H.initialValue),ce.change(Te))});const _e=Qs({checked:Te,disabled:V,form:h,name:w?void 0:G,id:A?void 0:ye,required:N,ref:Pe,style:G?i2:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(rt){if(rt.nativeEvent.defaultPrevented)return;if(C){rt.preventDefault();return}const ve=rt.currentTarget.checked,Ue=yt(Ur,rt.nativeEvent);if(v==null||v(ve,Ue),!Ue.isCanceled&&(ie==null||ie(ve,Ue),!Ue.isCanceled&&(re(ve),Y!==void 0&&X!==void 0&&!w&&!_))){const Qe=ve?[...X.value,Y]:X.value.filter(xt=>xt!==Y);X.setValue(Qe,Ue)}},onClick(rt){rt.stopPropagation()},onFocus(){var rt;(rt=xe.current)==null||rt.focus()}},k!==void 0?{value:(X?Te&&k:k)||""}:En,L,rt=>ce.getValidationProps(V,rt));x.useEffect(()=>{if(!ee||Y===void 0)return;const rt=ee.disabledStatesRef.current;return rt.set(Y,V),()=>{rt.delete(Y)}},[ee,V,Y]);const Xe=x.useMemo(()=>({...P,checked:fe,disabled:V,readOnly:C,required:N,indeterminate:Re}),[P,fe,V,C,N,Re]),Je=KA(Xe),ct=Ct("span",t,{state:Xe,ref:[Ie,xe,r],props:[{id:ae,role:"checkbox","aria-checked":Re?"mixed":fe,"aria-readonly":C||void 0,"aria-required":N||void 0,"aria-labelledby":Fe,[Y7]:w?"":void 0,onFocus(){V||K(!0)},onBlur(){const rt=ke.current;rt&&($(!0),K(!1),U==="onBlur"&&ce.commit(X?pe:rt.checked))},onKeyDown(rt){var jt;if(rt.key!=="Enter"||(rt.preventBaseUIHandler(),rt.defaultPrevented))return;const ve=((jt=ke.current)==null?void 0:jt.form)??null,Ue=rt.currentTarget,Qe=rt.nativeEvent,xt=rt.preventDefault,Ke=Qe.preventDefault;let Be=!1;rt.preventDefault=()=>{Be=!0,xt.call(rt)},Qe.preventDefault=()=>{Be=!0,Ke.call(Qe)},Ke.call(Qe),Rn(Ue).queueMicrotask(()=>{var Ze;rt.preventDefault=xt,Qe.preventDefault=Ke,Be||(Ze=k7(ve))==null||Ze.click()})},onClick(rt){if(C||V)return;rt.preventDefault();const ve=ke.current;ve&&hu(ve,rt)}},R,oe,je,L,rt=>ce.getValidationProps(V,rt)],stateAttributesMapping:Je}),At=ct.props.id;return We(()=>{if(!(!Oe||w||Y===void 0||At===void 0))return Oe(Y,At)},[Oe,w,Y,At]),n.jsxs(WA.Provider,{value:Xe,children:[ct,!Te&&!X&&G&&!w&&E!==void 0&&n.jsx("input",{type:"hidden",form:h,name:G,value:E,disabled:V}),n.jsx("input",{..._e,suppressHydrationWarning:!0})]})});var go=KR();const X7=GR(go);function l2(e){x.useEffect(e,Vr)}const Dm=null;class W7{constructor(){ln(this,"callbacks",[]);ln(this,"callbacksCount",0);ln(this,"nextId",1);ln(this,"startId",1);ln(this,"isScheduled",!1);ln(this,"tick",t=>{var i;this.isScheduled=!1;const r=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let c=0;c<r.length;c+=1)(i=r[c])==null||i.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||this.callbacks[r]!==null&&(this.callbacks[r]=null,this.callbacksCount-=1)}}let zm=new W7;class wr{constructor(){ln(this,"currentId",Dm);ln(this,"cancel",()=>{this.currentId!==Dm&&(zm.cancel(this.currentId),this.currentId=Dm)});ln(this,"disposeEffect",()=>this.cancel)}static create(){return new wr}static request(t){return zm.request(t)}static cancel(t){return zm.cancel(t)}request(t){this.cancel(),this.currentId=zm.request(()=>{this.currentId=Dm,t()})}}function Eu(){const e=vs(wr.create).current;return l2(e.disposeEffect),e}function La(e){return e==null?e:"current"in e?e.current:e}const c2="data-starting-style",Q7="data-ending-style";let Im=null;function Z7(e){if(!Im){const t=[];Im=t,queueMicrotask(()=>{Im=null,go.flushSync(()=>{for(const r of t)r()})})}Im.push(e)}function Gf(e,t=!1,r=!1){const a=Eu();return st((i,c=null)=>{a.cancel();const u=La(e);if(u==null)return;const f=u,h=()=>{if(!r){go.flushSync(i);return}Z7(()=>{c!=null&&c.aborted||i()})};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function m(){Promise.all(f.getAnimations().map(p=>p.finished)).then(()=>{c!=null&&c.aborted||h()},()=>{if(c!=null&&c.aborted)return;if(f.getAnimations().some(g=>g.pending||g.playState!=="finished")){m();return}h()})}if(t){const p=c2;if(!f.hasAttribute(p)){a.request(m);return}const g=new MutationObserver(()=>{f.hasAttribute(p)||(g.disconnect(),m())});g.observe(f,{attributes:!0,attributeFilter:[p]}),c==null||c.addEventListener("abort",()=>g.disconnect(),{once:!0});return}a.request(m)})}function Sr(e){const{enabled:t=!0,open:r,ref:a,batch:i=!1,onComplete:c}=e,u=st(c),f=Gf(a,r,i);x.useEffect(()=>{if(!t)return;const h=new AbortController;return f(u,h.signal),()=>{h.abort()}},[t,r,u,f])}function ni(e,t=!1,r=!1,a=!1){const[i,c]=x.useState(e&&t?"idle":void 0),[u,f]=x.useState(e&&!a);return e&&!u&&(f(!0),c("starting")),!e&&u&&i!=="ending"&&!r&&c("ending"),!e&&!u&&i==="ending"&&c(void 0),We(()=>{if(!e&&u&&i!=="ending"&&r){const h=wr.request(()=>{c("ending")});return()=>{wr.cancel(h)}}},[e,u,i,r]),We(()=>{if(!e||t)return;const h=wr.request(()=>{c(void 0)});return()=>{wr.cancel(h)}},[t,e]),We(()=>{if(!e||!t)return;e&&u&&i!=="idle"&&c("starting");const h=wr.request(()=>{c("idle")});return()=>{wr.cancel(h)}},[t,e,u,i]),{mounted:u,setMounted:f,transitionStatus:i}}const J7={[c2]:""},e$={[Q7]:""},si={transitionStatus(e){return e==="starting"?J7:e==="ending"?e$:null}},t$=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,h=G7(),m=h.checked||h.indeterminate,{mounted:p,transitionStatus:g,setMounted:b}=ni(m),v=x.useRef(null),w={...h,transitionStatus:g};Sr({batch:!0,enabled:!m,open:m,ref:v,onComplete(){m||b(!1)}});const S={...KA(h),...si},N=u||p,E=Ct("span",t,{ref:[r,v],state:w,stateAttributesMapping:S,props:f});return N?E:null});function $o({className:e,...t}){return n.jsx(K7,{"data-slot":"checkbox",className:js("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",e),...t,children:n.jsx(t$,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:n.jsx(Yn,{})})})}const eM=x.createContext(void 0);function mc(e){const t=x.useContext(eM);if(!e&&t===void 0)throw new Error(rn(27));return t}const n$="data-open",s$="data-closed",r$="data-anchor-hidden",tM="data-popup-open",o$="data-pressed",a$={[tM]:""},i$={[tM]:"",[o$]:""},l$={[n$]:""},c$={[s$]:""},u$={[r$]:""},u2={open(e){return e?a$:null}},Xp={open(e){return e?i$:null}},qf={open(e){return e?l$:c$},anchorHidden(e){return e?u$:null}},Hg={...qf,...si},d2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,forceRender:u=!1,...f}=t,h=mc(),m=h.useState("open"),p=h.useState("nested"),g=h.useState("mounted"),b=h.useState("transitionStatus");return Ct("div",t,{state:{open:m,transitionStatus:b},ref:[h.context.backdropRef,r],stateAttributesMapping:Hg,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:u||!p})}),Fg=x.forwardRef(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,...h}=t,m=mc(),p=m.useState("open"),{getButtonProps:g,buttonRef:b}=bo({disabled:u,native:f}),v={disabled:u};function w(C){p&&m.setOpen(!1,yt(QA,C.nativeEvent))}return Ct("button",t,{state:v,ref:[r,b],props:[{onClick:w},h,g]})}),f2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,h=mc(),m=ws(u);return h.useSyncedValueWithCleanup("descriptionElementId",m),Ct("p",t,{ref:r,props:[{id:m},f]})}),Vd=0;class xo{constructor(){ln(this,"currentId",Vd);ln(this,"clear",()=>{this.currentId!==Vd&&(clearTimeout(this.currentId),this.currentId=Vd)});ln(this,"disposeEffect",()=>this.clear)}static create(){return new xo}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Vd,r()},t)}isStarted(){return this.currentId!==Vd}}function us(){const e=vs(xo.create).current;return l2(e.disposeEffect),e}function d$(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:f$,platform:h$,maxTouchPoints:m$}=d$(),Gg=f$.toLowerCase(),bf=h$.toLowerCase(),qg=/^i(os$|p)/.test(bf)||bf==="macintel"&&m$>1,Gk="android",Ay=bf===Gk||Gg.includes(Gk),h2=!qg&&bf.startsWith("mac");bf.startsWith("win");const p$=h2||qg;var FR;const ri=typeof CSS<"u"&&!!((FR=CSS.supports)!=null&&FR.call(CSS,"-webkit-backdrop-filter:none"));!ri&&Gg.includes("firefox");!ri&&Gg.includes("chrom");const g$=p$,m2=/jsdom|happydom/.test(Gg);function ta(e){e.preventDefault(),e.stopPropagation()}function x$(e){return"nativeEvent"in e}function Yg(e){return e.pointerType===""&&e.isTrusted?!0:Ay&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function p2(e){return m2?!1:!Ay&&e.width===0&&e.height===0||Ay&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Hi(e,t){const r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}function b$(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Xs(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function gt(e,t){var a;if(!e||!t)return!1;const r=(a=t.getRootNode)==null?void 0:a.call(t);if(e.contains(t))return!0;if(r&&Tu(r)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Vs(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const My="data-base-ui-focusable",nM="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Kg="ArrowLeft",Xg="ArrowRight",sM="ArrowUp",g2="ArrowDown",Oy="data-trigger-disabled";function Wp(e,t){if(!Ft(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute(Oy);for(const[,a]of t.entries())if(gt(a,r))return!a.hasAttribute(Oy);return!1}function jv(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}function v$(e){return e.matches("html,body")}function Wg(e){return wn(e)&&e.matches(nM)}function y$(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${nM}`))!=null}function Dy(e){return e?e.getAttribute("role")==="combobox"&&Wg(e):!1}function w$(e){if(!e||m2)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qp(e){return e?e.hasAttribute(My)?e:e.querySelector(`[${My}]`)||e:null}function j$(e,t){return t!=null&&!Hi(t)?0:typeof e=="function"?e():e}function rc(e,t,r){const a=j$(e,r);return typeof a=="number"?a:a==null?void 0:a[t]}function qk(e){return typeof e=="function"?e():e}function rM(e,t){return t||e==="click"||e==="mousedown"}function S$(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const oM=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new xo,currentIdRef:{current:null},currentContextRef:{current:null}});function N$(e,t){e.current=t.current}function C$(e){const{children:t,delay:r,timeoutMs:a=0}=e,i=x.useRef(r),c=x.useRef(r),u=x.useRef(null),f=x.useRef(null),h=us();return We(()=>{if(c.current=r,!u.current){i.current=r;return}i.current={open:rc(i.current,"open"),close:rc(r,"close")}},[r,u,i,c]),n.jsx(oM.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:u,timeoutMs:a,currentContextRef:f,timeout:h}),[a,h]),children:t})}function k$(e,t={open:!1}){const{open:r}=t,a="rootStore"in e?e.rootStore:e,i=a.useState("floatingId"),c=x.useContext(oM),{currentIdRef:u,delayRef:f,timeoutMs:h,initialDelayRef:m,currentContextRef:p,hasProvider:g,timeout:b}=c,[v,w]=x.useState(!1),C=x.useRef(r);return We(()=>{C.current=r},[r]),We(()=>{function S(){var N;(N=p.current)==null||N.setIsInstantPhase(!1),u.current=null,p.current=null,f.current=m.current,b.clear()}if(u.current&&!r&&u.current===i){if(w(!1),h){const N=i;return b.start(h,()=>{a.select("open")||u.current&&u.current!==N||S()}),()=>{(C.current||u.current!==N)&&b.clear()}}S()}},[r,i,u,f,h,m,p,b,a]),We(()=>{if(!r)return;const S=p.current,N=u.current;b.clear(),p.current={onOpenChange:a.setOpen,setIsInstantPhase:w},u.current=i,f.current={open:0,close:rc(m.current,"close")},N!==null&&N!==i?(w(!0),S==null||S.setIsInstantPhase(!0),S==null||S.onOpenChange(!1,yt(Ur))):(w(!1),S==null||S.setIsInstantPhase(!1))},[r,i,a,u,f,m,p,b]),We(()=>()=>{if(u.current===i){if(p.current=null,!C.current)return;u.current=null,N$(f,m),b.clear()}},[p,u,f,i,m,b]),x.useMemo(()=>({activeIdRef:u,hasProvider:g,delayRef:f,isInstantPhase:v}),[u,g,f,v])}function $t(e,t,r,a){return e.addEventListener(t,r,a),()=>{e.removeEventListener(t,r,a)}}function oa(...e){return()=>{for(let t=0;t<e.length;t+=1){const r=e[t];r&&r()}}}function qn(e){const t=vs(T$,e).current;return t.next=e,We(t.effect),t}function T$(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const el=x.forwardRef(function(t,r){const[a,i]=x.useState();We(()=>{g$&&ri&&i("button")},[]);const c={tabIndex:0,role:a};return n.jsx("span",{...t,ref:r,style:_g,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})}),Ru=Math.min,Ga=Math.max,Zp=Math.round,Pm=Math.floor,qa=e=>({x:e,y:e}),E$={left:"right",right:"left",bottom:"top",top:"bottom"};function aM(e,t,r){return Ga(e,Ru(t,r))}function tl(e,t){return typeof e=="function"?e(t):e}function uo(e){return e.split("-")[0]}function Wa(e){return e.split("-")[1]}function x2(e){return e==="x"?"y":"x"}function b2(e){return e==="y"?"height":"width"}function co(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function v2(e){return x2(co(e))}function R$(e,t,r){r===void 0&&(r=!1);const a=Wa(e),i=v2(e),c=b2(i);let u=i==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Jp(u)),[u,Jp(u)]}function A$(e){const t=Jp(e);return[zy(e),t,zy(t)]}function zy(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Yk=["left","right"],Kk=["right","left"],M$=["top","bottom"],O$=["bottom","top"];function D$(e,t,r){switch(e){case"top":case"bottom":return r?t?Kk:Yk:t?Yk:Kk;case"left":case"right":return t?M$:O$;default:return[]}}function z$(e,t,r,a){const i=Wa(e);let c=D$(uo(e),r==="start",a);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(zy)))),c}function Jp(e){const t=uo(e);return E$[t]+e.slice(t.length)}function I$(e){var t,r,a,i;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(a=e.bottom)!=null?a:0,left:(i=e.left)!=null?i:0}}function iM(e){return typeof e!="number"?I$(e):{top:e,right:e,bottom:e,left:e}}function vf(e){const{x:t,y:r,width:a,height:i}=e;return{width:a,height:i,top:r,left:t,right:t+a,bottom:r+i,x:t,y:r}}function sf(e,t){return t<0||t>=e.length}function bp(e,t){return Va(e.current,{disabledIndices:t})}function Iy(e,t){return Va(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Va(e,{startingIndex:t=-1,decrement:r=!1,disabledIndices:a,amount:i=1}={}){let c=t;do c+=r?-i:i;while(c>=0&&c<=e.length-1&&xu(e,c,a));return c}function xu(e,t,r){if(typeof r=="function"?r(t):(r==null?void 0:r.includes(t))??!1)return!0;const i=e[t];return i?!Qg(i)||i.matches(":disabled")?!0:!r&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!1}function P$(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Qg(e,t=e?Br(e):null){return!e||!e.isConnected||!t||P$(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const _$='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function L$(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const r=e.getRootNode();return Tu(r)?r.host:null}function Py(e){for(const t of Array.from(e.children))if(Us(t)==="summary")return t;return null}function $$(e,t){const r=Py(t);return!!r&&(e===r||gt(r,e))}function lM(e){const t=e?Us(e):"";return e!=null&&e.matches(_$)&&(t!=="summary"||e.parentElement!=null&&Us(e.parentElement)==="details"&&Py(e.parentElement)===e)&&(t!=="details"||Py(e)==null)&&(t!=="input"||e.type!=="hidden")}function cM(e){if(!lM(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=L$(t)){const r=t!==e,a=Us(t)==="slot";if(t.hasAttribute("inert")||r&&Us(t)==="details"&&!t.open&&!$$(e,t)||t.hasAttribute("hidden")||!a&&!B$(t,r))return!1}return!0}function B$(e,t){const r=Br(e);return t?r.display!=="none":Qg(e,r)}function uM(e){const t=e.tabIndex;if(t<0){const r=Us(e);if(r==="details"||r==="audio"||r==="video"||wn(e)&&e.isContentEditable)return 0}return t}function Sv(e){if(Us(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function V$(e,t){const r=Sv(e);if(!r)return!0;const a=t.find(i=>{const c=Sv(i);return(c==null?void 0:c.name)===r.name&&c.form===r.form&&c.checked});return a?a===r:t.find(i=>{const c=Sv(i);return(c==null?void 0:c.name)===r.name&&c.form===r.form})===r}function dM(e){if(wn(e)&&Us(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return wn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function fM(e,t){dM(e).forEach(r=>{lM(r)&&t.push(r),fM(r,t)})}function hM(e,t,r){dM(e).forEach(a=>{wn(a)&&a.matches(t)&&r.push(a),hM(a,t,r)})}function y2(e){return cM(e)&&uM(e)>=0}function mM(e){const t=[];return fM(e,t),t.filter(cM)}function Yf(e){const t=mM(e);return t.filter(r=>uM(r)>=0&&V$(r,t))}function pM(e,t){const r=Yf(e),a=r.length;if(a===0)return;const i=Xs(Ht(e)),c=r.indexOf(i),u=c===-1?t===1?0:a-1:c+t;return r[u]}function w2(e){return pM(Ht(e).body,1)||e}function gM(e){return pM(Ht(e).body,-1)||e}function xM(e,t){if(!e)return null;const r=Yf(Ht(e).body),a=r.length;if(a===0)return null;const i=r.indexOf(e);if(i===-1)return null;const c=(i+t+a)%a;return r[c]}function U$(e){return xM(e,1)}function H$(e){return xM(e,-1)}function bu(e,t){const r=t||e.currentTarget,a=e.relatedTarget;return!a||!gt(r,a)}function F$(e){Yf(e).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function Xk(e){const t=[];hM(e,"[data-tabindex]",t),t.forEach(r=>{const a=r.dataset.tabindex;delete r.dataset.tabindex,a?r.setAttribute("tabindex",a):r.removeAttribute("tabindex")})}function nl(e,t,r=!0){return e.filter(i=>i.parentId===t).flatMap(i=>{var c;return[...!r||(c=i.context)!=null&&c.open?[i]:[],...nl(e,i.id,r)]})}function Wk(e,t){var i;let r=[],a=(i=e.find(c=>c.id===t))==null?void 0:i.parentId;for(;a;){const c=e.find(u=>u.id===a);a=c==null?void 0:c.parentId,c&&(r=r.concat(c))}return r}function yf(e){return`data-base-ui-${e}`}let _m=0;function vp(e,t={}){const{preventScroll:r=!1,sync:a=!1,shouldFocus:i}=t;cancelAnimationFrame(_m);function c(){i&&!i()||e==null||e.focus({preventScroll:r})}if(a)return c(),$n;const u=requestAnimationFrame(c);return _m=u,()=>{_m===u&&(cancelAnimationFrame(u),_m=0)}}const Nv={inert:new WeakMap,"aria-hidden":new WeakMap},Qk="data-base-ui-inert",_y={inert:new WeakSet,"aria-hidden":new WeakSet};let Ud=new WeakMap,Cv=0;function G$(e){return _y[e]}function bM(e){return e?Tu(e)?e.host:bM(e.parentNode):null}const Zk=(e,t)=>t.map(r=>{if(e.contains(r))return r;const a=bM(r);return e.contains(a)?a:null}).filter(r=>r!=null),Jk=e=>{const t=new Set;return e.forEach(r=>{let a=r;for(;a&&!t.has(a);)t.add(a),a=a.parentNode}),t},e5=(e,t,r)=>{const a=[],i=c=>{!c||r.has(c)||Array.from(c.children).forEach(u=>{Us(u)!=="script"&&(t.has(u)?i(u):a.push(u))})};return i(e),a};function q$(e,t,r,a,{mark:i=!0}){let c=null;a?c="inert":r&&(c="aria-hidden");let u=null,f=null;const h=Zk(t,e),m=i?e5(t,Jk(h),new Set(h)):[],p=[],g=[];if(c){const b=Nv[c],v=G$(c);f=v,u=b;const w=Zk(t,Array.from(t.querySelectorAll("[aria-live]"))),C=h.concat(w);e5(t,Jk(C),new Set(C)).forEach(N=>{const E=N.getAttribute(c),k=E!==null&&E!=="false",A=(b.get(N)||0)+1;b.set(N,A),p.push(N),A===1&&k&&v.add(N),k||N.setAttribute(c,c==="inert"?"":"true")})}return i&&m.forEach(b=>{const v=(Ud.get(b)||0)+1;Ud.set(b,v),g.push(b),v===1&&b.setAttribute(Qk,"")}),Cv+=1,()=>{u&&p.forEach(b=>{const w=(u.get(b)||0)-1;u.set(b,w),w||(!(f!=null&&f.has(b))&&c&&b.removeAttribute(c),f==null||f.delete(b))}),i&&g.forEach(b=>{const v=(Ud.get(b)||0)-1;Ud.set(b,v),v||b.removeAttribute(Qk)}),Cv-=1,Cv||(Nv.inert=new WeakMap,Nv["aria-hidden"]=new WeakMap,_y.inert=new WeakSet,_y["aria-hidden"]=new WeakSet,Ud=new WeakMap)}}function t5(e,t={}){const{ariaHidden:r=!1,inert:a=!1,mark:i=!0}=t,c=Ht(e[0]).body;return q$(e,c,r,a,{mark:i})}const Y$=500,vM=500,K$={style:{transition:"none"}},yM="data-base-ui-click-trigger",wM={fallbackAxisSide:"none"},j2={fallbackAxisSide:"end"},X$={clipPath:"inset(50%)",position:"fixed",top:0,left:0},jM=x.createContext(null),SM=()=>x.useContext(jM),W$=yf("portal");function NM(e={}){const{ref:t,container:r,componentProps:a=En,elementProps:i}=e,c=sc(),u=SM(),f=u==null?void 0:u.portalNode,[h,m]=x.useState(null),[p,g]=x.useState(null),b=st(S=>{S!==null&&g(S)}),v=x.useRef(null);We(()=>{if(r===null){v.current&&(v.current=null,g(null),m(null));return}const S=(r&&(V1(r)?r:r.current))??f??document.body;if(S==null){v.current&&(v.current=null,g(null),m(null));return}v.current!==S&&(v.current=S,g(null),m(S))},[r,f]);const w=Ct("div",a,{ref:[t,b],props:[{id:c,[W$]:""},i]}),C=h&&w?go.createPortal(w,h):null;return{node:p,nodeId:x.isValidElement(w)?w.props.id:void 0,subtree:C}}const Zg=x.forwardRef(function(t,r){const{render:a,className:i,style:c,children:u,container:f,portalOwnerRole:h,...m}=t,{node:p,nodeId:g,subtree:b}=NM({container:f,ref:r,componentProps:t,elementProps:m}),v=x.useRef(null),w=x.useRef(null),C=x.useRef(null),S=x.useRef(null),[N,E]=x.useState(null),k=x.useRef(!1),A=N==null?void 0:N.modal,M=N==null?void 0:N.open,R=!!N&&!N.modal&&N.open&&!!p;x.useEffect(()=>{if(!p||A)return;function O(D){p&&D.relatedTarget&&bu(D)&&(D.type==="focusin"?k.current&&(Xk(p),k.current=!1):(F$(p),k.current=!0))}return oa($t(p,"focusin",O,!0),$t(p,"focusout",O,!0))},[p,A]),We(()=>{!p||M!==!0||!k.current||(Xk(p),k.current=!1)},[M,p]);const T=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:w,beforeInsideRef:C,afterInsideRef:S,portalNode:p,setFocusManagerState:E}),[p]);return n.jsxs(x.Fragment,{children:[b,n.jsxs(jM.Provider,{value:T,children:[R&&p&&n.jsx(el,{"data-type":"outside",ref:v,onFocus:O=>{var D;if(bu(O,p))(D=C.current)==null||D.focus();else{const B=N?N.domReference:null,F=gM(B);F==null||F.focus()}}}),R&&p&&n.jsx("span",{role:h,"aria-owns":g,style:X$}),p&&go.createPortal(u,p),R&&p&&n.jsx(el,{"data-type":"outside",ref:w,onFocus:O=>{var D;if(bu(O,p))(D=S.current)==null||D.focus();else{const B=N?N.domReference:null,F=w2(B);F==null||F.focus(),N!=null&&N.closeOnFocusOut&&(N==null||N.onOpenChange(!1,yt(Ji,O.nativeEvent)))}}})]})]})});function CM(){const e=new Map;return{emit(t,r){var a;(a=e.get(t))==null||a.forEach(i=>i(r))},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r)},off(t,r){var a;(a=e.get(t))==null||a.delete(r)}}}class S2{constructor(){ln(this,"nodesRef",{current:[]});ln(this,"events",CM())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const r=this.nodesRef.current.findIndex(a=>a===t);r!==-1&&this.nodesRef.current.splice(r,1)}}const kM=x.createContext(null),TM=x.createContext(null),ol=()=>{var e;return((e=x.useContext(kM))==null?void 0:e.id)||null},al=e=>{const t=x.useContext(TM);return e??t};function N2(e){const t=sc(),r=al(e),a=ol();return We(()=>{if(!t)return;const i={id:t,parentId:a};return r==null||r.addNode(i),()=>{r==null||r.removeNode(i)}},[r,t,a]),t}function EM(e){const{children:t,id:r}=e,a=ol();return n.jsx(kM.Provider,{value:x.useMemo(()=>({id:r,parentId:a}),[r,a]),children:t})}function RM(e){const{children:t,externalTree:r}=e,a=vs(()=>r??new S2).current;return n.jsx(TM.Provider,{value:a,children:t})}function Q$(e,t){const r=Rn(Vs(e));return e instanceof r.KeyboardEvent?"keyboard":e instanceof r.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof r.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const n5=20;let Vi=[];function C2(){Vi=Vi.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function s5(e){C2(),e&&Us(e)!=="body"&&(Vi.push(new WeakRef(e)),Vi.length>n5&&(Vi=Vi.slice(-n5)))}function r5(){var e;return C2(),(e=Vi[Vi.length-1])==null?void 0:e.deref()}function Z$(e){return e?y2(e)?e:Yf(e)[0]||e:null}function o5(e){var i;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((i=e.getAttribute("role"))!=null&&i.includes("dialog")))return;const r=mM(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return y2(c)||c.hasAttribute("data-tabindex")&&!u.startsWith("-")}),a=e.getAttribute("tabindex");r.length===0?a!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(a!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Jg(e){const{context:t,children:r,disabled:a=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:h=!0,openInteractionType:m="",nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:b,externalTree:v,getInsideElements:w}=e,C="rootStore"in t?t.rootStore:t,S=C.useState("open"),N=C.useState("domReferenceElement"),E=C.useState("floatingElement"),{events:k,dataRef:A}=C.context,M=st(()=>{var ue;return(ue=A.current.floatingContext)==null?void 0:ue.nodeId}),R=i===!1,T=Dy(N)&&R,O=qn(i),D=qn(c),B=qn(m),F=qn(S),K=al(v),$=SM(),P=x.useRef(!1),U=x.useRef(!1),H=x.useRef(!1),W=x.useRef(null),q=x.useRef(""),Z=x.useRef(""),z=x.useRef(null),L=x.useRef(null),X=mo(z,b,$==null?void 0:$.beforeInsideRef),ee=mo(L,$==null?void 0:$.afterInsideRef),_=us(),V=us(),G=Eu(),Y=$!=null,ne=Qp(E),te=st((ue=ne)=>ue?Yf(ue):[]),ye=st(()=>(w==null?void 0:w().filter(ue=>ue!=null))??[]);x.useEffect(()=>{if(a||!f)return;function ue(Q){Q.key==="Tab"&>(ne,Xs(Ht(ne)))&&te().length===0&&!T&&ta(Q)}const se=Ht(ne);return $t(se,"keydown",ue)},[a,ne,f,T,te]),x.useEffect(()=>{if(a||!S)return;const ue=Ht(ne);function se(){H.current=!1}function Q(oe){const pe=Vs(oe),xe=ye(),je=gt(E,pe)||gt(N,pe)||gt($==null?void 0:$.portalNode,pe)||xe.some(Ie=>Ie===pe||gt(Ie,pe));H.current=!je,Z.current=oe.pointerType||"keyboard",pe!=null&&pe.closest(`[${yM}]`)&&(U.current=!0,V.start(0,()=>{U.current=!1}))}function ie(){Z.current="keyboard"}return oa($t(ue,"pointerdown",Q,!0),$t(ue,"pointerup",se,!0),$t(ue,"pointercancel",se,!0),$t(ue,"keydown",ie,!0),se)},[a,E,N,ne,S,$,V,ye]),x.useEffect(()=>{if(a||!h)return;const ue=Ht(ne);function se(){U.current=!0,V.start(0,()=>{U.current=!1})}function Q(xe){const je=Vs(xe);y2(je)&&(W.current=je)}function ie(xe){const je=xe.relatedTarget,Ie=xe.currentTarget,ce=Vs(xe);f&&je==null&&ce!=null&>(E,ce)&&s5(ce),queueMicrotask(()=>{const Te=M(),re=C.context.triggerElements,fe=ye(),Re=(je==null?void 0:je.hasAttribute(yf("focus-guard")))&&[z.current,L.current,$==null?void 0:$.beforeInsideRef.current,$==null?void 0:$.afterInsideRef.current,$==null?void 0:$.beforeOutsideRef.current,$==null?void 0:$.afterOutsideRef.current,La(g),La(p)].includes(je),Oe=!(gt(N,je)||gt(E,je)||gt(je,E)||gt($==null?void 0:$.portalNode,je)||fe.some(ke=>ke===je||gt(ke,je))||re.hasMatchingElement(ke=>gt(ke,je))||Re||K&&(nl(K.nodesRef.current,Te).find(ke=>{var he,Ae;return gt((he=ke.context)==null?void 0:he.elements.floating,je)||gt((Ae=ke.context)==null?void 0:Ae.elements.domReference,je)})||Wk(K.nodesRef.current,Te).find(ke=>{var he,Ae,ge;return[(he=ke.context)==null?void 0:he.elements.floating,Qp((Ae=ke.context)==null?void 0:Ae.elements.floating)].includes(je)||((ge=ke.context)==null?void 0:ge.elements.domReference)===je})));if(Ie===N&&ne&&o5(ne),u&&Ie!==N&&!Qg(ce)&&Xs(ue)===ue.body){if(wn(ne)&&(ne.focus(),u==="popup")){G.request(()=>{ne.focus()});return}const ke=te(),he=W.current,Ae=(he&&ke.includes(he)?he:null)||ke[ke.length-1]||ne;wn(Ae)&&Ae.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(T||!f)&&je&&Oe&&!U.current&&(T||je!==r5())&&(P.current=!0,C.setOpen(!1,yt(Ji,xe)))})}function oe(){H.current||(A.current.insideReactTree=!0,_.start(0,()=>{A.current.insideReactTree=!1}))}const pe=wn(N)?N:null;if(!(!E&&!pe))return oa(pe&&$t(pe,"focusout",ie),pe&&$t(pe,"pointerdown",se),E&&$t(E,"focusin",Q),E&&$t(E,"focusout",ie),E&&$&&$t(E,"focusout",oe,!0))},[a,N,E,ne,f,K,$,C,h,u,te,T,M,A,_,V,G,p,g,ye]),x.useEffect(()=>{var Ie,ce,Te;if(a||!E||!S)return;const ue=Array.from(((Ie=$==null?void 0:$.portalNode)==null?void 0:Ie.querySelectorAll(`[${yf("portal")}]`))||[]),Q=(Te=(ce=(K?Wk(K.nodesRef.current,M()):[]).find(re=>{var fe;return Dy(((fe=re.context)==null?void 0:fe.elements.domReference)||null)}))==null?void 0:ce.context)==null?void 0:Te.elements.domReference,oe=[...[E,...ue,z.current,L.current,$==null?void 0:$.beforeOutsideRef.current,$==null?void 0:$.afterOutsideRef.current,...ye()],Q,La(g),La(p),T?N:null].filter(re=>re!=null),pe=t5(oe,{ariaHidden:f||T,mark:!1}),xe=[E,...ue].filter(re=>re!=null),je=t5(xe);return()=>{je(),pe()}},[S,a,N,E,f,$,T,K,M,p,g,ye]),We(()=>{if(!S||a||!wn(ne))return;q.current="",Z.current="";const ue=Ht(ne),se=Xs(ue);queueMicrotask(()=>{const Q=O.current,ie=typeof Q=="function"?Q(B.current||""):Q;if(ie===void 0||ie===!1||gt(ne,se))return;let pe=null;const xe=()=>(pe==null&&(pe=te(ne)),pe[0]||ne);let je;ie===!0||ie===null?je=xe():je=La(ie),je=je||xe();const Ie=gt(ne,Xs(ue));vp(je,{preventScroll:je===ne,shouldFocus(){if(!F.current)return!1;if(Ie)return!0;const ce=Xs(ue);return!(ce!==je&>(ne,ce))}})})},[a,S,ne,te,O,B,F]),We(()=>{if(a||!ne)return;const ue=Ht(ne),se=Xs(ue),Q=B.current==null;s5(se);function ie(pe){if(pe.open||(q.current=Q$(pe.nativeEvent,Z.current)),pe.reason===Qn&&pe.nativeEvent.type==="mouseleave"&&(P.current=!0),pe.reason===Vg)if(pe.nested)P.current=!1;else if(Yg(pe.nativeEvent)||p2(pe.nativeEvent))P.current=!1;else{let xe=!1;Ht(ne).createElement("div").focus({get preventScroll(){return xe=!0,!1}}),xe?P.current=!1:P.current=!0}}k.on("openchange",ie);function oe(pe){const xe=D.current;let je=typeof xe=="function"?xe(pe):xe;if(je===void 0||je===!1)return null;je===null&&(je=!0);const Ie=N!=null&&N.isConnected?N:null,ce=se!=null&&se.isConnected&&Us(se)!=="body"?se:null;let Te=Q?ce||Ie:Ie||ce;return Te||(Te=r5()||null),typeof je=="boolean"?Te:La(je)||Te||null}return()=>{k.off("openchange",ie);const pe=Xs(ue),xe=ye(),je=gt(E,pe)||xe.some(re=>re===pe||gt(re,pe))||K&&nl(K.nodesRef.current,M(),!1).some(re=>{var fe;return gt((fe=re.context)==null?void 0:fe.elements.floating,pe)}),Ie=D.current,ce=q.current,Te=oe(ce);queueMicrotask(()=>{const re=Z$(Te),fe=typeof Ie!="boolean";if(Ie&&!P.current&&wn(re)&&(!(!fe&&re!==pe&&pe!==ue.body)||je)){const Re={preventScroll:!0};ce==="keyboard"&&(Re.focusVisible=!0),re.focus(Re)}P.current=!1})}},[a,E,ne,D,B,k,K,N,M,ye]),We(()=>{if(!ri||S||!E)return;const ue=Xs(Ht(E));!wn(ue)||!Wg(ue)||gt(E,ue)&&ue.blur()},[S,E]),We(()=>{if(!(a||!$))return $.setFocusManagerState({modal:f,closeOnFocusOut:h,open:S,onOpenChange:C.setOpen,domReference:N}),()=>{$.setFocusManagerState(null)}},[a,$,f,S,C,h,N]),We(()=>{if(!(a||!ne))return o5(ne),()=>{queueMicrotask(C2)}},[a,ne]);const ae=!a&&(f?!T:!0)&&(Y||f);return n.jsxs(x.Fragment,{children:[ae&&n.jsx(el,{"data-type":"inside",ref:X,onFocus:ue=>{var se;if(f){const Q=te();vp(Q[Q.length-1])}else if($!=null&&$.portalNode)if(P.current=!1,bu(ue,$.portalNode)){const Q=w2(N);Q==null||Q.focus()}else(se=La(g??$.beforeOutsideRef))==null||se.focus()}}),r,ae&&n.jsx(el,{"data-type":"inside",ref:ee,onFocus:ue=>{var se;if(f)vp(te()[0]);else if($!=null&&$.portalNode)if(h&&(P.current=!0),bu(ue,$.portalNode)){const Q=gM(N);Q==null||Q.focus()}else(se=La(p??$.afterOutsideRef))==null||se.focus()}})]})}function k2(e,t={}){const{enabled:r=!0,event:a="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:f=0,reason:h=ma}=t,m="rootStore"in e?e.rootStore:e,p=m.context.dataRef,g=x.useRef(void 0),b=Eu(),v=us(),w=x.useMemo(()=>{function C(N,E,k,A){const M=yt(h,E,k);N&&A==="touch"&&f>0?v.start(f,()=>{m.setOpen(!0,M)}):m.setOpen(N,M)}function S(N,E,k){const A=p.current.openEvent,M=m.select("domReferenceElement")!==E;return N&&M||!N||!i?!0:A&&u?!k(A.type):!1}return{onPointerDown(N){g.current=Hi(N.pointerType,!0)&&p2(N.nativeEvent)?"virtual":N.pointerType},onMouseDown(N){const E=g.current,k=N.nativeEvent,A=m.select("open");if(N.button!==0||a==="click"||Hi(E,!0)&&c)return;const M=S(A,N.currentTarget,O=>O==="click"||O==="mousedown"),R=Vs(k);if(Wg(R)){C(M,k,R,E);return}const T=N.currentTarget;b.request(()=>{C(M,k,T,E)})},onClick(N){if(a==="mousedown-only")return;const E=g.current;if(a==="mousedown"&&E){g.current=void 0;return}if(Hi(E,!0)&&c)return;const k=m.select("open"),A=S(k,N.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");C(A,N.nativeEvent,N.currentTarget,E)},onKeyDown(){g.current=void 0}}},[p,a,c,h,m,u,i,b,v,f]);return x.useMemo(()=>r?{reference:w}:En,[r,w])}function J$(e,t){let r=null,a=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){var v;const c=(e==null?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",f=t.axis==="y"||t.axis==="both",h=["mouseenter","mousemove"].includes(((v=t.dataRef.current.openEvent)==null?void 0:v.type)||"")&&t.pointerType!=="touch";let m=c.width,p=c.height,g=c.x,b=c.y;return r==null&&t.x&&u&&(r=c.x-t.x),a==null&&t.y&&f&&(a=c.y-t.y),g-=r||0,b-=a||0,m=0,p=0,!i||h?(m=t.axis==="y"?c.width:0,p=t.axis==="x"?c.height:0,g=u&&t.x!=null?t.x:g,b=f&&t.y!=null?t.y:b):i&&!h&&(p=t.axis==="x"?c.height:p,m=t.axis==="y"?c.width:m),i=!0,{width:m,height:p,x:g,y:b,top:b,right:g+m,bottom:b+p,left:g}}}}function a5(e){return e!=null&&e.clientX!=null}function eB(e,t={}){const{enabled:r=!0,axis:a="both"}=t,i="rootStore"in e?e.rootStore:e,c=i.useState("open"),u=i.useState("floatingElement"),f=i.useState("domReferenceElement"),h=i.context.dataRef,m=x.useRef(!1),p=x.useRef(null),[g,b]=x.useState(),[v,w]=x.useState([]),C=st(A=>{i.set("positionReference",A)}),S=st((A,M,R)=>{m.current||h.current.openEvent&&!a5(h.current.openEvent)||i.set("positionReference",J$(R??f,{x:A,y:M,axis:a,dataRef:h,pointerType:g}))}),N=st(A=>{c?p.current||(S(A.clientX,A.clientY,A.currentTarget),w([])):S(A.clientX,A.clientY,A.currentTarget)}),E=Hi(g)?u:c;x.useEffect(()=>{if(!r){C(f);return}if(!E)return;function A(){var T;(T=p.current)==null||T.call(p),p.current=null}const M=Rn(u);function R(T){const O=Vs(T);gt(u,O)?A():S(T.clientX,T.clientY)}return!h.current.openEvent||a5(h.current.openEvent)?p.current=$t(M,"mousemove",R):C(f),A},[E,r,u,h,f,i,S,C,v]),x.useEffect(()=>()=>{i.set("positionReference",null)},[i]),x.useEffect(()=>{r&&!u&&(m.current=!1)},[r,u]),x.useEffect(()=>{!r&&c&&(m.current=!0)},[r,c]);const k=x.useMemo(()=>{function A(M){b(M.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:N,onMouseEnter:N}},[N]);return x.useMemo(()=>r?{reference:k,trigger:k}:{},[r,k])}function tB(){return!1}function nB(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function Kf(e,t={}){const{enabled:r=!0,escapeKey:a=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:u=tB,bubbles:f,externalTree:h}=t,m="rootStore"in e?e.rootStore:e,p=m.useState("open"),g=m.useState("floatingElement"),{dataRef:b,events:v}=m.context,w=al(h),C=st(typeof i=="function"?i:()=>!1),S=typeof i=="function"?C:i,N=S!==!1,E=st(()=>c),{escapeKey:k,outsidePress:A}=nB(f),M=x.useRef(!1),R=x.useRef(!1),T=x.useRef(!1),O=x.useRef(!1),D=x.useRef(!1),B=x.useRef(""),F=x.useRef(null),K=us(),$=us(),P=st(()=>{$.clear(),b.current.insideReactTree=!1}),U=st(_=>{var Y;const V=(Y=b.current.floatingContext)==null?void 0:Y.nodeId;return(w?nl(w.nodesRef.current,V):[]).some(ne=>{var te;return((te=ne.context)==null?void 0:te.open)&&!ne.context.dataRef.current[_]})}),H=st(_=>jv(_,m.select("floatingElement"))||jv(_,m.select("domReferenceElement"))),W=st(_=>{u()&&m.setOpen(!1,yt(ma,_.nativeEvent))}),q=st(_=>{if(!p||!r||!a||_.key!=="Escape"||D.current||!k&&U("__escapeKeyBubbles"))return;const V=x$(_)?_.nativeEvent:_,G=yt(Hf,V);m.setOpen(!1,G),G.isCanceled||_.preventDefault(),!k&&!G.isPropagationAllowed&&_.stopPropagation()}),Z=st(()=>{b.current.insideReactTree=!0,$.start(0,P)}),z=st(_=>{if(!p||!r||_.button!==0)return;const V=Vs(_.nativeEvent);gt(m.select("floatingElement"),V)&&(M.current||(M.current=!0,R.current=!1))}),L=st(_=>{!p||!r||(_.defaultPrevented||_.nativeEvent.defaultPrevented)&&M.current&&(R.current=!0)});x.useEffect(()=>{function _(V){V.open||(O.current=!1)}return v.on("openchange",_),()=>{v.off("openchange",_)}},[v]),x.useEffect(()=>{if(!p||!r)return p||(O.current=!1),P;b.current.__escapeKeyBubbles=k,b.current.__outsidePressBubbles=A;const _=new xo,V=new xo,G=Ht(g);function Y(){_.clear(),D.current=!0}function ne(){_.start(ri?5:0,()=>{D.current=!1})}function te(){T.current=!0,V.start(0,()=>{T.current=!1})}function ye(){M.current=!1,R.current=!1}function ae(){const Oe=B.current,ke=Oe==="pen"||!Oe?"mouse":Oe,he=E(),Ae=typeof he=="function"?he():he;return typeof Ae=="string"?Ae:Ae[ke]}function ue(Oe){const ke=ae();return ke==="intentional"&&Oe.type!=="click"||ke==="sloppy"&&Oe.type==="click"}function se(Oe){var Ae;const ke=(Ae=b.current.floatingContext)==null?void 0:Ae.nodeId,he=w&&nl(w.nodesRef.current,ke).some(ge=>{var Pe;return jv(Oe,(Pe=ge.context)==null?void 0:Pe.elements.floating)});return H(Oe)||he}function Q(Oe){if(ue(Oe)){Oe.type!=="click"&&!H(Oe)&&(V.clear(),T.current=!1),P();return}if(b.current.insideReactTree){P();return}const ke=Vs(Oe),he=`[${yf("inert")}]`,Ae=Ft(ke)?ke.getRootNode():null,ge=Array.from((Tu(Ae)?Ae:Ht(m.select("floatingElement"))).querySelectorAll(he)),Pe=m.context.triggerElements;if(ke&&(Pe.hasElement(ke)||Pe.hasMatchingElement(_e=>gt(_e,ke))))return;let Fe=Ft(ke)?ke:null;for(;Fe&&!Ha(Fe);){const _e=Ka(Fe);if(Ha(_e)||!Ft(_e))break;Fe=_e}if(!(ge.length&&Ft(ke)&&!v$(ke)&&!gt(ke,m.select("floatingElement"))&&ge.every(_e=>!gt(Fe,_e)))){if(wn(ke)&&!("touches"in Oe)){const _e=Ha(ke),Xe=Br(ke),Je=/auto|scroll/,ct=_e||Je.test(Xe.overflowX),At=_e||Je.test(Xe.overflowY),rt=ct&&ke.clientWidth>0&&ke.scrollWidth>ke.clientWidth,ve=At&&ke.clientHeight>0&&ke.scrollHeight>ke.clientHeight,Ue=Xe.direction==="rtl",Qe=ve&&(Ue?Oe.offsetX<=ke.offsetWidth-ke.clientWidth:Oe.offsetX>ke.clientWidth),xt=rt&&Oe.offsetY>ke.clientHeight;if(Qe||xt)return}if(!se(Oe)){if(ae()==="intentional"){if(Oe.detail!==0&&!Yg(Oe)&&!O.current)return;if(T.current){V.clear(),T.current=!1;return}}typeof S=="function"&&!S(Oe)||U("__outsidePressBubbles")||(m.setOpen(!1,yt(Vg,Oe)),P())}}}function ie(Oe){ae()!=="sloppy"||Oe.pointerType==="touch"||!m.select("open")||!r||H(Oe)||Q(Oe)}function oe(Oe){if(ae()!=="sloppy"||!m.select("open")||!r||H(Oe))return;const ke=Oe.touches[0];ke&&(F.current={startTime:Date.now(),startX:ke.clientX,startY:ke.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},K.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function pe(Oe,ke){const he=Vs(Oe);if(!he)return;const Ae=$t(he,Oe.type,()=>{ke(Oe),Ae()})}function xe(Oe){B.current="touch",pe(Oe,oe)}function je(Oe){K.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(O.current=!0),B.current=Oe.pointerType),!(Oe.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&pe(Oe,ke=>{ke.type==="pointerdown"?ie(ke):Q(ke)})}function Ie(Oe){if(Oe.type==="pointercancel"&&(O.current=!1),!M.current)return;const ke=R.current;if(ye(),ae()==="intentional"){if(Oe.type==="pointercancel"){ke&&te();return}if(!se(Oe)){if(ke){te();return}typeof S=="function"&&!S(Oe)||(V.clear(),T.current=!0,P())}}}function ce(Oe){if(ae()!=="sloppy"||!F.current||H(Oe))return;const ke=Oe.touches[0];if(!ke)return;const he=Math.abs(ke.clientX-F.current.startX),Ae=Math.abs(ke.clientY-F.current.startY),ge=Math.sqrt(he*he+Ae*Ae);ge>5&&(F.current.dismissOnTouchEnd=!0),ge>10&&(Q(Oe),K.clear(),F.current=null)}function Te(Oe){pe(Oe,ce)}function re(Oe){ae()!=="sloppy"||!F.current||H(Oe)||(F.current.dismissOnTouchEnd&&Q(Oe),K.clear(),F.current=null)}function fe(Oe){pe(Oe,re)}const Re=oa(a&&oa($t(G,"keydown",q),$t(G,"compositionstart",Y),$t(G,"compositionend",ne)),N&&oa($t(G,"click",je,!0),$t(G,"pointerdown",je,!0),$t(G,"pointerup",Ie,!0),$t(G,"pointercancel",Ie,!0),$t(G,"mousedown",je,!0),$t(G,"mouseup",Ie,!0),$t(G,"touchstart",xe,{capture:!0,passive:!0}),$t(G,"touchmove",Te,{capture:!0,passive:!0}),$t(G,"touchend",fe,{capture:!0,passive:!0})));return()=>{Re(),_.clear(),V.clear(),ye(),T.current=!1,P()}},[b,g,a,N,S,p,r,k,A,q,P,E,U,H,w,m,K]);const X=x.useMemo(()=>({onKeyDown:q,onPointerDown:W,onClick:W}),[q,W]),ee=x.useMemo(()=>({onKeyDown:q,onPointerDown:L,onMouseDown:L,onClickCapture:Z,onMouseDownCapture(_){Z(),z(_)},onPointerDownCapture(_){Z(),z(_)},onMouseUpCapture:Z,onTouchEndCapture:Z,onTouchMoveCapture:Z}),[q,Z,z,L]);return x.useMemo(()=>r?{reference:X,floating:ee,trigger:X}:{},[r,X,ee])}function i5(e,t,r){let{reference:a,floating:i}=e;const c=co(t),u=v2(t),f=b2(u),h=uo(t),m=c==="y",p=a.x+a.width/2-i.width/2,g=a.y+a.height/2-i.height/2,b=a[f]/2-i[f]/2;let v;switch(h){case"top":v={x:p,y:a.y-i.height};break;case"bottom":v={x:p,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:g};break;case"left":v={x:a.x-i.width,y:g};break;default:v={x:a.x,y:a.y}}const w=Wa(t);return w&&(v[u]+=b*(w==="end"?1:-1)*(r&&m?-1:1)),v}async function sB(e,t){var r;t===void 0&&(t={});const{x:a,y:i,platform:c,rects:u,elements:f,strategy:h}=e,{boundary:m="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:b=!1,padding:v=0}=tl(t,e),w=iM(v),S=f[b?g==="floating"?"reference":"floating":g],N=vf(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(S)))==null||r?S:S.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:m,rootBoundary:p,strategy:h})),E=g==="floating"?{x:a,y:i,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),A=await(c.isElement==null?void 0:c.isElement(k))&&await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1},M=vf(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:k,strategy:h}):E);return{top:(N.top-M.top+w.top)/A.y,bottom:(M.bottom-N.bottom+w.bottom)/A.y,left:(N.left-M.left+w.left)/A.x,right:(M.right-N.right+w.right)/A.x}}const rB=50,oB=async(e,t,r)=>{const{placement:a="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:sB},h=await(u.isRTL==null?void 0:u.isRTL(t));let m=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:g}=i5(m,a,h),b=a,v=0;const w={};for(let C=0;C<c.length;C++){const S=c[C];if(!S)continue;const{name:N,fn:E}=S,{x:k,y:A,data:M,reset:R}=await E({x:p,y:g,initialPlacement:a,placement:b,strategy:i,middlewareData:w,rects:m,platform:f,elements:{reference:e,floating:t}});p=k??p,g=A??g,w[N]={...w[N],...M},R&&v<rB&&(v++,typeof R=="object"&&(R.placement&&(b=R.placement),R.rects&&(m=R.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):R.rects),{x:p,y:g}=i5(m,b,h)),C=-1)}return{x:p,y:g,placement:b,strategy:i,middlewareData:w}},aB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:i,middlewareData:c,rects:u,initialPlacement:f,platform:h,elements:m}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...S}=tl(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const N=uo(i),E=co(f),k=uo(f)===f,A=await(h.isRTL==null?void 0:h.isRTL(m.floating)),M=b||(k||!C?[Jp(f)]:A$(f)),R=w!=="none";!b&&R&&M.push(...z$(f,C,w,A));const T=[f,...M],O=await h.detectOverflow(t,S),D=[];let B=((a=c.flip)==null?void 0:a.overflows)||[];if(p&&D.push(O[N]),g){const P=R$(i,u,A);D.push(O[P[0]],O[P[1]])}if(B=[...B,{placement:i,overflows:D}],!D.every(P=>P<=0)){var F,K;const P=(((F=c.flip)==null?void 0:F.index)||0)+1,U=T[P];if(U&&(!(g==="alignment"?E!==co(U):!1)||B.every(q=>co(q.placement)===E?q.overflows[0]>0:!0)))return{data:{index:P,overflows:B},reset:{placement:U}};let H=(K=B.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:K.placement;if(!H)switch(v){case"bestFit":{var $;const W=($=B.filter(q=>{if(R){const Z=co(q.placement);return Z===E||Z==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(Z=>Z>0).reduce((Z,z)=>Z+z,0)]).sort((q,Z)=>q[1]-Z[1])[0])==null?void 0:$[0];W&&(H=W);break}case"initialPlacement":H=f;break}if(i!==H)return{reset:{placement:H}}}return{}}}},AM=new Set(["left","top"]);async function iB(e,t){const{placement:r,platform:a,elements:i}=e,c=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=uo(r),f=Wa(r),h=co(r)==="y",m=AM.has(u)?-1:1,p=c&&h?-1:1,g=tl(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof w=="number"&&(v=f==="end"?w*-1:w),h?{x:v*p,y:b*m}:{x:b*m,y:v*p}}const lB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:i,y:c,placement:u,middlewareData:f}=t,h=await iB(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:i+h.x,y:c+h.y,data:{...h,placement:u}}}}},cB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:i,platform:c}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:h={fn:E=>{let{x:k,y:A}=E;return{x:k,y:A}}},...m}=tl(e,t),p={x:r,y:a},g=await c.detectOverflow(t,m),b=co(i),v=x2(b);let w=p[v],C=p[b];const S=(E,k)=>aM(k+g[E==="y"?"top":"left"],k,k-g[E==="y"?"bottom":"right"]);u&&(w=S(v,w)),f&&(C=S(b,C));const N=h.fn({...t,[v]:w,[b]:C});return{...N,data:{x:N.x-r,y:N.y-a,enabled:{[v]:u,[b]:f}}}}}},uB=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,a;const{x:i,y:c,placement:u,rects:f,middlewareData:h}=t,{offset:m=0,mainAxis:p=!0,crossAxis:g=!0}=tl(e,t),b={x:i,y:c},v=co(u),w=x2(v);let C=b[w],S=b[v];const N=tl(m,t),E=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:(r=N.mainAxis)!=null?r:0,crossAxis:(a=N.crossAxis)!=null?a:0};if(p){const M=w==="y"?"height":"width",R=f.reference[w]-f.floating[M]+E.mainAxis,T=f.reference[w]+f.reference[M]-E.mainAxis;C<R?C=R:C>T&&(C=T)}if(g){var k,A;const M=w==="y"?"width":"height",R=AM.has(uo(u)),T=f.reference[v]-f.floating[M]+(R&&((k=h.offset)==null?void 0:k[v])||0)+(R?0:E.crossAxis),O=f.reference[v]+f.reference[M]+(R?0:((A=h.offset)==null?void 0:A[v])||0)-(R?E.crossAxis:0);S<T?S=T:S>O&&(S=O)}return{[w]:C,[v]:S}}}},dB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:a,platform:i,elements:c}=t,{apply:u=()=>{},...f}=tl(e,t),h=await i.detectOverflow(t,f),m=uo(r),p=Wa(r),g=co(r)==="y",{width:b,height:v}=a.floating;let w,C;m==="top"||m==="bottom"?(w=m,C=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(C=m,w=p==="end"?"top":"bottom");const S=v-h.top-h.bottom,N=b-h.left-h.right,E=Ru(v-h[w],S),k=Ru(b-h[C],N),A=t.middlewareData.shift,M=!A;let R=E,T=k;A!=null&&A.enabled.x&&(T=N),A!=null&&A.enabled.y&&(R=S),M&&!p&&(g?T=b-2*Ga(h.left,h.right):R=v-2*Ga(h.top,h.bottom)),await u({...t,availableWidth:T,availableHeight:R});const O=await i.getDimensions(c.floating);return b!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function MM(e){const t=Br(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=wn(e),c=i?e.offsetWidth:r,u=i?e.offsetHeight:a,f=Zp(r)!==c||Zp(a)!==u;return f&&(r=c,a=u),{width:r,height:a,$:f}}function T2(e){return Ft(e)?e:e.contextElement}function vu(e){const t=T2(e);if(!wn(t))return qa(1);const r=t.getBoundingClientRect(),{width:a,height:i,$:c}=MM(t);let u=(c?Zp(r.width):r.width)/a,f=(c?Zp(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const fB=qa(0);function OM(e){const t=Rn(e);return!H1()||!t.visualViewport?fB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hB(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===Rn(e)}function oc(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=T2(e);let u=qa(1);t&&(a?Ft(a)&&(u=vu(a)):u=vu(e));const f=hB(c,r,a)?OM(c):qa(0);let h=(i.left+f.x)/u.x,m=(i.top+f.y)/u.y,p=i.width/u.x,g=i.height/u.y;if(c&&a){const b=Rn(c),v=Ft(a)?Rn(a):a;let w=b,C=wy(w);for(;C&&v!==w;){const S=vu(C),N=C.getBoundingClientRect(),E=Br(C),k=N.left+(C.clientLeft+parseFloat(E.paddingLeft))*S.x,A=N.top+(C.clientTop+parseFloat(E.paddingTop))*S.y;h*=S.x,m*=S.y,p*=S.x,g*=S.y,h+=k,m+=A,w=Rn(C),C=wy(w)}}return vf({width:p,height:g,x:h,y:m})}function ex(e,t){const r=Og(e).scrollLeft;return t?t.left+r:oc(ei(e)).left+r}function DM(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-ex(e,r),i=r.top+t.scrollTop;return{x:a,y:i}}function mB(e){let{elements:t,rect:r,offsetParent:a,strategy:i}=e;const c=i==="fixed",u=ei(a),f=t?Mg(t.floating):!1;if(a===u||f&&c)return r;let h={scrollLeft:0,scrollTop:0},m=qa(1);const p=qa(0),g=wn(a);if((g||!c)&&((Us(a)!=="body"||zf(u))&&(h=Og(a)),g)){const v=oc(a);m=vu(a),p.x=v.x+a.clientLeft,p.y=v.y+a.clientTop}const b=u&&!g&&!c?DM(u,h):qa(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-h.scrollLeft*m.x+p.x+b.x,y:r.y*m.y-h.scrollTop*m.y+p.y+b.y}}function pB(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function gB(e){const t=Og(e),r=e.ownerDocument.body,a=Ga(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Ga(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-t.scrollLeft+ex(e);const u=-t.scrollTop;return Br(r).direction==="rtl"&&(c+=Ga(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:c,y:u}}const xB=25;function bB(e,t,r){r===void 0&&(r="viewport");const a=r==="layoutViewport",i=Rn(e),c=ei(e),u=i.visualViewport;let f=c.clientWidth,h=c.clientHeight,m=0,p=0;if(u){const b=!H1()||t==="fixed";a?b||(m=-u.offsetLeft,p=-u.offsetTop):(f=u.width,h=u.height,b&&(m=u.offsetLeft,p=u.offsetTop))}if(ex(c)<=0){const b=c.ownerDocument,v=b.body,w=getComputedStyle(v),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,S=Math.abs(c.clientWidth-v.clientWidth-C),N=getComputedStyle(c).scrollbarGutter==="stable both-edges"?S/2:S;N<=xB&&(f-=N)}return{width:f,height:h,x:m,y:p}}function vB(e,t){const r=oc(e,!0,t==="fixed"),a=r.top+e.clientTop,i=r.left+e.clientLeft,c=vu(e),u=e.clientWidth*c.x,f=e.clientHeight*c.y,h=i*c.x,m=a*c.y;return{width:u,height:f,x:h,y:m}}function l5(e,t,r){let a;if(t==="viewport"||t==="layoutViewport")a=bB(e,r,t);else if(t==="document")a=gB(ei(e));else if(Ft(t))a=vB(t,r);else{const i=OM(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return vf(a)}function yB(e,t){const r=t.get(e);if(r)return r;let a=pf(e,[],!1).filter(f=>Ft(f)&&Us(f)!=="body"),i=null;const c=Br(e).position==="fixed";let u=c?Ka(e):e;for(;Ft(u)&&!Ha(u);){const f=Br(u),h=U1(u),m=i?i.position:c?"fixed":"";!h&&(m==="fixed"||m==="absolute"&&f.position==="static")?a=a.filter(g=>g!==u):i=f,u=Ka(u)}return t.set(e,a),a}function wB(e){let{element:t,boundary:r,rootBoundary:a,strategy:i}=e;const u=[...r==="clippingAncestors"?Mg(t)?[]:yB(t,this._c):[].concat(r),a],f=l5(t,u[0],i);let h=f.top,m=f.right,p=f.bottom,g=f.left;for(let b=1;b<u.length;b++){const v=l5(t,u[b],i);h=Ga(v.top,h),m=Ru(v.right,m),p=Ru(v.bottom,p),g=Ga(v.left,g)}return{width:m-g,height:p-h,x:g,y:h}}function jB(e){const{width:t,height:r}=MM(e);return{width:t,height:r}}function SB(e,t,r){const a=wn(t),i=ei(t),c=r==="fixed",u=oc(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const h=qa(0);if((a||!c)&&((Us(t)!=="body"||zf(i))&&(f=Og(t)),a)){const b=oc(t,!0,c,t);h.x=b.x+t.clientLeft,h.y=b.y+t.clientTop}!a&&i&&(h.x=ex(i));const m=i&&!a&&!c?DM(i,f):qa(0),p=u.left+f.scrollLeft-h.x-m.x,g=u.top+f.scrollTop-h.y-m.y;return{x:p,y:g,width:u.width,height:u.height}}function kv(e){return Br(e).position==="static"}function c5(e,t){if(!wn(e)||Br(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ei(e)===r&&(r=r.ownerDocument.body),r}function zM(e,t){const r=Rn(e);if(Mg(e))return r;if(!wn(e)){let i=Ka(e);for(;i&&!Ha(i);){if(Ft(i)&&!kv(i))return i;i=Ka(i)}return r}let a=c5(e,t);for(;a&&u6(a)&&kv(a);)a=c5(a,t);return a&&Ha(a)&&kv(a)&&!U1(a)?r:a||h6(e)||r}const NB=async function(e){const t=this.getOffsetParent||zM,r=this.getDimensions,a=await r(e.floating);return{reference:SB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function CB(e){return Br(e).direction==="rtl"}const IM={convertOffsetParentRelativeRectToViewportRelativeRect:mB,getDocumentElement:ei,getClippingRect:wB,getOffsetParent:zM,getElementRects:NB,getClientRects:pB,getDimensions:jB,getScale:vu,isElement:Ft,isRTL:CB};function PM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kB(e,t,r){let a=null,i;const c=ei(e);function u(){var p;clearTimeout(i),(p=a)==null||p.disconnect(),a=null}function f(p,g){p===void 0&&(p=!1),g===void 0&&(g=1),u();const b=e.getBoundingClientRect(),{left:v,top:w,width:C,height:S}=b;if(p||t(),!C||!S)return;const N=Pm(w),E=Pm(c.clientWidth-(v+C)),k=Pm(c.clientHeight-(w+S)),A=Pm(v),R={rootMargin:-N+"px "+-E+"px "+-k+"px "+-A+"px",threshold:Ga(0,Ru(1,g))||1};let T=!0;function O(D){const B=D[0].intersectionRatio;if(!PM(b,e.getBoundingClientRect()))return f();if(B!==g){if(!T)return f();B?f(!1,B):i=setTimeout(()=>{f(!1,1e-7)},1e3)}T=!1}try{a=new IntersectionObserver(O,{...R,root:c.ownerDocument})}catch{a=new IntersectionObserver(O,R)}a.observe(e)}const h=Rn(e),m=()=>f(r);return h.addEventListener("resize",m),f(!0),()=>{h.removeEventListener("resize",m),u()}}function u5(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=a,m=T2(e),p=i||c?[...m?pf(m):[],...t?pf(t):[]]:[];p.forEach(N=>{i&&N.addEventListener("scroll",r),c&&N.addEventListener("resize",r)});const g=m&&f?kB(m,r,c):null;let b=-1,v=null;u&&(v=new ResizeObserver(N=>{let[E]=N;E&&E.target===m&&v&&t&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var k;(k=v)==null||k.observe(t)})),r()}),m&&!h&&v.observe(m),t&&v.observe(t));let w,C=h?oc(e):null;h&&S();function S(){const N=oc(e);C&&!PM(C,N)&&r(),C=N,w=requestAnimationFrame(S)}return r(),()=>{var N;p.forEach(E=>{i&&E.removeEventListener("scroll",r),c&&E.removeEventListener("resize",r)}),g==null||g(),(N=v)==null||N.disconnect(),v=null,h&&cancelAnimationFrame(w)}}const TB=lB,EB=cB,RB=aB,AB=dB,MB=uB,OB=(e,t,r)=>{const a=new Map,i=r??{},c={...IM,...i.platform,_c:a};return oB(e,t,{...i,platform:c})};var DB=typeof document<"u",zB=function(){},yp=DB?x.useLayoutEffect:zB;function eg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,a,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(a=r;a--!==0;)if(!eg(e[a],t[a]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,i[a]))return!1;for(a=r;a--!==0;){const c=i[a];if(!(c==="_owner"&&e.$$typeof)&&!eg(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function _M(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function d5(e,t){const r=_M(e);return Math.round(t*r)/r}function Tv(e){const t=x.useRef(e);return yp(()=>{t.current=e}),t}function IB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:i,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:h,open:m}=e,[p,g]=x.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=x.useState(a);eg(b,a)||v(a);const[w,C]=x.useState(null),[S,N]=x.useState(null),E=x.useCallback(q=>{q!==R.current&&(R.current=q,C(q))},[]),k=x.useCallback(q=>{q!==T.current&&(T.current=q,N(q))},[]),A=c||w,M=u||S,R=x.useRef(null),T=x.useRef(null),O=x.useRef(p),D=h!=null,B=Tv(h),F=Tv(i),K=Tv(m),$=x.useCallback(()=>{if(!R.current||!T.current)return;const q={placement:t,strategy:r,middleware:b};F.current&&(q.platform=F.current),OB(R.current,T.current,q).then(Z=>{const z={...Z,isPositioned:K.current!==!1};P.current&&!eg(O.current,z)&&(O.current=z,go.flushSync(()=>{g(z)}))})},[b,t,r,F,K]);yp(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,g(q=>({...q,isPositioned:!1})))},[m]);const P=x.useRef(!1);yp(()=>(P.current=!0,()=>{P.current=!1}),[]),yp(()=>{if(A&&(R.current=A),M&&(T.current=M),A&&M){if(B.current)return B.current(A,M,$);$()}},[A,M,$,B,D]);const U=x.useMemo(()=>({reference:R,floating:T,setReference:E,setFloating:k}),[E,k]),H=x.useMemo(()=>({reference:A,floating:M}),[A,M]),W=x.useMemo(()=>{const q={position:r,left:0,top:0};if(!H.floating)return q;const Z=d5(H.floating,p.x),z=d5(H.floating,p.y);return f?{...q,transform:"translate("+Z+"px, "+z+"px)",..._M(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Z,top:z}},[r,f,H.floating,p.x,p.y]);return x.useMemo(()=>({...p,update:$,refs:U,elements:H,floatingStyles:W}),[p,$,U,H,W])}const PB=(e,t)=>{const r=TB(e);return{name:r.name,fn:r.fn,options:[e,t]}},_B=(e,t)=>{const r=EB(e);return{name:r.name,fn:r.fn,options:[e,t]}},LB=(e,t)=>({fn:MB(e).fn,options:[e,t]}),$B=(e,t)=>{const r=RB(e);return{name:r.name,fn:r.fn,options:[e,t]}},BB=(e,t)=>{const r=AB(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Ev={exports:{}},Rv={};/**
|
|
486
|
+
* @license React
|
|
487
|
+
* use-sync-external-store-shim.production.js
|
|
488
|
+
*
|
|
489
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
490
|
+
*
|
|
491
|
+
* This source code is licensed under the MIT license found in the
|
|
492
|
+
* LICENSE file in the root directory of this source tree.
|
|
493
|
+
*/var f5;function VB(){if(f5)return Rv;f5=1;var e=Df();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,i=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(g,b){var v=b(),w=a({inst:{value:v,getSnapshot:b}}),C=w[0].inst,S=w[1];return c(function(){C.value=v,C.getSnapshot=b,h(C)&&S({inst:C})},[g,v,b]),i(function(){return h(C)&&S({inst:C}),g(function(){h(C)&&S({inst:C})})},[g]),u(v),v}function h(g){var b=g.getSnapshot;g=g.value;try{var v=b();return!r(g,v)}catch{return!0}}function m(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return Rv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Rv}var h5;function LM(){return h5||(h5=1,Ev.exports=VB()),Ev.exports}var E2=LM(),Av={exports:{}},Mv={};/**
|
|
494
|
+
* @license React
|
|
495
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
496
|
+
*
|
|
497
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
498
|
+
*
|
|
499
|
+
* This source code is licensed under the MIT license found in the
|
|
500
|
+
* LICENSE file in the root directory of this source tree.
|
|
501
|
+
*/var m5;function UB(){if(m5)return Mv;m5=1;var e=Df(),t=LM();function r(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var a=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,h=e.useDebugValue;return Mv.useSyncExternalStoreWithSelector=function(m,p,g,b,v){var w=c(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=f(function(){function N(R){if(!E){if(E=!0,k=R,R=b(R),v!==void 0&&C.hasValue){var T=C.value;if(v(T,R))return A=T}return A=R}if(T=A,a(k,R))return T;var O=b(R);return v!==void 0&&v(T,O)?(k=R,T):(k=R,A=O)}var E=!1,k,A,M=g===void 0?null:g;return[function(){return N(p())},M===null?void 0:function(){return N(M())}]},[p,g,b,v]);var S=i(m,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=S},[S]),h(S),S},Mv}var p5;function HB(){return p5||(p5=1,Av.exports=UB()),Av.exports}var FB=HB();const Ly=[];let $y;function GB(){return $y}function qB(e){Ly.push(e)}function Xf(e){const t=(r,a)=>{const i=vs(YB).current;let c;try{$y=i;for(const u of Ly)u.before(i);c=e(r,a);for(const u of Ly)u.after(i);i.didInitialize=!0}finally{$y=void 0}return c};return t.displayName=e.displayName||e.name,t}function R2(e){return x.forwardRef(Xf(e))}function YB(){return{didInitialize:!1}}const KB=Y1(19),XB=KB?QB:ZB;function $M(e,t,r,a,i){return XB(e,t,r,a,i)}function WB(e,t,r,a,i){const c=x.useCallback(()=>t(e.getSnapshot(),r,a,i),[e,t,r,a,i]);return E2.useSyncExternalStore(e.subscribe,c,c)}qB({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let r=0;r<e.syncHooks.length;r+=1){const a=e.syncHooks[r],i=a.selector(a.store.state,a.a1,a.a2,a.a3);Object.is(a.value,i)||(t=!0,a.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const r=new Set;for(const i of e.syncHooks)r.add(i.store);const a=[];for(const i of r)a.push(i.subscribe(t));return()=>{for(const i of a)i()}}),E2.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function QB(e,t,r,a,i){const c=GB();if(!c)return WB(e,t,r,a,i);const u=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[u],(f.store!==e||f.selector!==t||!Object.is(f.a1,r)||!Object.is(f.a2,a)||!Object.is(f.a3,i))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=t,f.a1=r,f.a2=a,f.a3=i,f.value=t(e.getSnapshot(),r,a,i))):(f={store:e,selector:t,a1:r,a2:a,a3:i,value:t(e.getSnapshot(),r,a,i)},c.syncHooks.push(f)),f.value}function ZB(e,t,r,a,i){return FB.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,r,a,i))}class JB{constructor(t){ln(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ln(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const r=this.updateTick;for(const a of this.listeners){if(r!==this.updateTick)return;a(t)}}update(t){for(const r in t)if(!Object.is(this.state[r],t[r])){this.setState({...this.state,...t});return}}set(t,r){Object.is(this.state[t],r)||this.setState({...this.state,[t]:r})}notifyAll(){const t={...this.state};this.setState(t)}use(t,r,a,i){return $M(this,t,r,a,i)}}class _u extends JB{constructor(t,r={},a){super(t),this.context=r,this.selectors=a}useSyncedValue(t,r){x.useDebugValue(t);const a=this;We(()=>{a.state[t]!==r&&a.set(t,r)},[a,t,r])}useSyncedValueWithCleanup(t,r){const a=this;We(()=>(a.state[t]!==r&&a.set(t,r),()=>{a.set(t,void 0)}),[a,t,r])}useSyncedValues(t){const r=this,a=Object.values(t);We(()=>{r.update(t)},[r,...a])}useControlledProp(t,r){x.useDebugValue(t);const a=this,i=r!==void 0;We(()=>{i&&!Object.is(a.state[t],r)&&a.setState({...a.state,[t]:r})},[a,t,r,i])}select(t,r,a,i){const c=this.selectors[t];return c(this.state,r,a,i)}useState(t,r,a,i){return x.useDebugValue(t),$M(this,this.selectors[t],r,a,i)}useContextCallback(t,r){x.useDebugValue(t);const a=st(r??$n);this.context[t]=a}useStateSetter(t){const r=x.useRef(void 0);return r.current===void 0&&(r.current=a=>{this.set(t,a)}),r.current}observe(t,r){let a;typeof t=="function"?a=t:a=this.selectors[t];let i=a(this.state);return r(i,i,this),this.subscribe(c=>{const u=a(c);if(!Object.is(i,u)){const f=i;i=u,r(u,f,this)}})}}const eV={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class A2 extends _u{constructor(r){const{syncOnly:a,nested:i,onOpenChange:c,triggerElements:u,...f}=r;super({...f,positionReference:f.referenceElement,domReferenceElement:f.referenceElement},{onOpenChange:c,dataRef:{current:{}},events:CM(),nested:i,triggerElements:u},eV);ln(this,"syncOpenEvent",(r,a)=>{(!r||!this.state.open||a!=null&&b$(a))&&(this.context.dataRef.current.openEvent=r?a:void 0)});ln(this,"dispatchOpenChange",(r,a)=>{this.syncOpenEvent(r,a.event);const i={open:r,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",i)});ln(this,"setOpen",(r,a)=>{var i,c,u,f;if(this.syncOnly){(c=(i=this.context).onOpenChange)==null||c.call(i,r,a);return}this.dispatchOpenChange(r,a),(f=(u=this.context).onOpenChange)==null||f.call(u,r,a)});this.syncOnly=a}}function BM(e){const{popupStore:t,treatPopupAsFloatingElement:r=!1,floatingRootContext:a,floatingId:i,nested:c,onOpenChange:u}=e,f=t.useState("open"),h=t.useState("activeTriggerElement"),m=t.useState(r?"popupElement":"positionerElement"),p=t.context.triggerElements,g=u,b=x.useRef(null);a===void 0&&b.current===null&&(b.current=new A2({open:f,transitionStatus:void 0,referenceElement:h,floatingElement:m,triggerElements:p,onOpenChange:g,floatingId:i,syncOnly:!0,nested:c}));const v=a??b.current;return t.useSyncedValue("floatingId",i),We(()=>{const w={open:f,floatingId:i,referenceElement:h,floatingElement:m};Ft(h)&&(w.domReferenceElement=h),v.state.positionReference===v.state.referenceElement&&(w.positionReference=h),v.update(w)},[f,i,h,m,v]),v.context.onOpenChange=g,v.context.nested=c,v}const Wf={tabIndex:-1,[My]:""};function VM(e){return t=>t==="touch"?e.current:!0}function M2(e,t=!1){const r=sc(),a=ol()!=null,i=vs(()=>e(r,a)).current;return BM({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:a,onOpenChange:i.setOpen}),i}function tx({handle:e,store:t}){return We(()=>e.attachStore(t),[e,t]),null}function g5(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function tV(e,t){const r=x.useRef(null);return st(a=>{const i=r.current;if(i!==null){if(i.element===a&&i.store===t&&i.id===e)return;r.current=null;const c=i.store;c.context.triggerElements.getById(i.id)===i.element&&(c.context.triggerElements.delete(i.id),g5(c))}a!==null&&e!==void 0&&(r.current={store:t,id:e,element:a},t.context.triggerElements.add(e,a),g5(t))})}function nx(e,t,r,a=!1){let i=e.preventUnmountingOnClose;t?i=!1:a&&(i=!0);const c=(r==null?void 0:r.id)??null;let u=e.activeTriggerId,f=e.activeTriggerElement;return(c||t)&&(u=c,f=r??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:u,activeTriggerElement:f}}function O2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function nV(e,t,r,a={}){var p,g,b;const i=r.reason,c=i===Qn,u=t&&i===gu,f=!t&&(i===ma||i===Hf),h=O2(r);if((g=(p=e.context).onOpenChange)==null||g.call(p,t,r),r.isCanceled)return;(b=a.onBeforeDispatch)==null||b.call(a),e.state.floatingRootContext.dispatchOpenChange(t,r);const m=()=>{const v=nx(e.state,t,r.trigger,h()),w={...a.extraState,...v};u?w.instantType="focus":f?w.instantType="dismiss":c&&(w.instantType=void 0),e.update(w)};c?go.flushSync(m):m()}function D2(e,t,r,a){const i=r.useState("isMountedByTrigger",e),c=tV(e,r),u=st(h=>{const m=r.select("open"),p=r.select("activeTriggerId");if(p===e){const g={activeTriggerElement:h,...m?a:null};r.update(g);return}if(p==null&&m){const g={activeTriggerId:e??null,activeTriggerElement:h,...a};r.update(g)}}),f=st(h=>{c(h),h&&u(h)});return We(()=>(f(t.current),()=>f(null)),[f,t,r,e]),We(()=>{if(i){const h={activeTriggerElement:t.current,...a};r.update(h)}},[i,r,t,...Object.values(a)]),{registerTrigger:f,isMountedByThisTrigger:i}}function sx(e,t={}){const{closeOnActiveTriggerUnmount:r=!1}=t,a=x.useRef(null),i=e.useState("open"),c=e.useState("triggerCount"),u=e.useState("activeTriggerId"),f=e.useState("activeTriggerElement");We(()=>{if(!i){a.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const h=e.context.triggerElements.size,m={};e.state.triggerCount!==h&&(m.triggerCount=h);const p=e.select("activeTriggerId");let g=null;if(p){const b=e.context.triggerElements.getById(p);if(b)a.current=p,b!==e.state.activeTriggerElement&&(m.activeTriggerElement=b);else{for(const[v,w]of e.context.triggerElements.entries())if(w===e.state.activeTriggerElement){m.activeTriggerId=v,m.activeTriggerElement=w,a.current=v;break}m.activeTriggerId===void 0&&(a.current===p?g=p:a.current=null)}}else a.current=null;if(!g&&!p&&h===1){const b=e.context.triggerElements.entries().next();if(!b.done){const[v,w]=b.value;m.activeTriggerId=v,m.activeTriggerElement=w,a.current=v}}(m.triggerCount!==void 0||m.activeTriggerId!==void 0||m.activeTriggerElement!==void 0)&&e.update(m),g&&r&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===g&&!e.context.triggerElements.getById(g)){const b=yt(Ur);e.setOpen(!1,b),b.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,c,u,f,r])}function rx(e,t,r,a){const{mounted:i,setMounted:c,transitionStatus:u}=ni(e,!1,!1,a),f=t.useState("preventUnmountingOnClose"),h=e?!1:f;t.useSyncedValues({mounted:i,transitionStatus:u,preventUnmountingOnClose:h});const m=st(()=>{var p,g;c(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),r==null||r(),(g=(p=t.context).onOpenChangeComplete)==null||g.call(p,!1)});return Sr({enabled:i&&!e&&!h,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:u}}function ox(e,t){e.useSyncedValues(t),We(()=>()=>{e.update({activeTriggerProps:En,inactiveTriggerProps:En,popupProps:En})},[e])}function UM(e,t){We(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),We(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Qf{constructor(){this.idMap=new Map}add(t,r){this.idMap.set(t,r)}delete(t){this.idMap.delete(t)}hasElement(t){for(const r of this.idMap.values())if(r===t)return!0;return!1}hasMatchingElement(t){for(const r of this.idMap.values())if(t(r))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function ax(e,t,r=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new A2({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:r,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:En,inactiveTriggerProps:En,popupProps:En}}const rf=e=>e.triggerIdProp??e.activeTriggerId,z2=e=>e.openProp??e.open,x5=e=>{var r;return(((r=e.popupElement)==null?void 0:r.id)??e.floatingId)||void 0};function HM(e,t){return t!==void 0&&z2(e)&&rf(e)===t}function sV(e,t){return HM(e,t)?!0:t!==void 0&&z2(e)&&rf(e)==null&&e.triggerCount===1}const ix={open:z2,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:rf,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:x5,isTriggerActive:(e,t)=>t!==void 0&&rf(e)===t,isOpenedByTrigger:(e,t)=>HM(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&rf(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>sV(e,t)?x5(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function I2(e){const t=x.useCallback(a=>e===void 0?$n:e.subscribeStore(a),[e]),r=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return E2.useSyncExternalStore(t,r,()=>e==null?void 0:e.serverStore)}function rV(e){const{open:t=!1,onOpenChange:r,elements:a={}}=e,i=sc(),c=ol()!=null,u=vs(()=>new A2({open:t,transitionStatus:void 0,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new Qf,floatingId:i,syncOnly:!1,nested:c})).current;return We(()=>{const f={open:t,floatingId:i};a.reference!==void 0&&(f.referenceElement=a.reference,f.domReferenceElement=Ft(a.reference)?a.reference:null),a.floating!==void 0&&(f.floatingElement=a.floating),u.update(f)},[t,i,a.reference,a.floating,u]),u.context.onOpenChange=r,u.context.nested=c,u}function oV(e){return aV(e,e.rootContext)}function aV(e,t){const{nodeId:r,externalTree:a}=e,i=t.useState("referenceElement"),c=t.useState("floatingElement"),u=t.useState("domReferenceElement"),f=t.useState("open"),h=t.useState("floatingId"),[m,p]=x.useState(null),[g,b]=x.useState(void 0),[v,w]=x.useState(void 0),C=x.useRef(null),S=al(a),N=x.useMemo(()=>({reference:i,floating:c,domReference:u}),[i,c,u]),E=IB({...e,elements:{...N,...m&&{reference:m}}}),k=Ft(g)?g:null,A=v===void 0?t.state.floatingElement:v;t.useSyncedValue("referenceElement",g??null),t.useSyncedValue("domReferenceElement",g===void 0?u:k),t.useSyncedValue("floatingElement",A);const M=x.useCallback(F=>{const K=Ft(F)?{getBoundingClientRect:()=>F.getBoundingClientRect(),getClientRects:()=>F.getClientRects(),contextElement:F}:F;p(K),E.refs.setReference(K)},[E.refs]),R=x.useCallback(F=>{(Ft(F)||F===null)&&(C.current=F,b(F)),(Ft(E.refs.reference.current)||E.refs.reference.current===null||F!==null&&!Ft(F))&&E.refs.setReference(F)},[E.refs,b]),T=x.useCallback(F=>{w(F),E.refs.setFloating(F)},[E.refs]),O=x.useMemo(()=>({...E.refs,setReference:R,setFloating:T,setPositionReference:M,domReference:C}),[E.refs,R,T,M]),D=x.useMemo(()=>({...E.elements,domReference:u}),[E.elements,u]),B=x.useMemo(()=>({...E,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:h,refs:O,elements:D,nodeId:r,rootStore:t}),[E,O,D,r,t,f,h]);return We(()=>{u&&(C.current=u)},[u]),We(()=>{t.context.dataRef.current.floatingContext=B;const F=S==null?void 0:S.nodesRef.current.find(K=>K.id===r);F&&(F.context=B)}),x.useMemo(()=>({...E,context:B,refs:O,elements:D,rootStore:t}),[E,O,D,B,t])}const Ov=h2&&ri;function FM(e,t={}){const{enabled:r=!0,delay:a}=t,i="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=i.context,f=x.useRef(!1),h=x.useRef(null),m=x.useRef(!0),p=us();x.useEffect(()=>{const b=i.select("domReferenceElement");if(!r)return;const v=Rn(b);function w(){const N=i.select("domReferenceElement");!i.select("open")&&wn(N)&&N===Xs(Ht(N))&&(f.current=!0,h.current=N)}function C(){m.current=!0}function S(){m.current=!1}return oa($t(v,"blur",w),Ov&&$t(v,"keydown",C,!0),Ov&&$t(v,"pointerdown",S,!0))},[i,r]),x.useEffect(()=>{if(!r)return;function b(v){if(v.reason===ma||v.reason===Hf){const w=i.select("domReferenceElement");Ft(w)&&(h.current=w,f.current=!0)}}return c.on("openchange",b),()=>{c.off("openchange",b)}},[c,r,i]);const g=x.useMemo(()=>{function b(){f.current=!1,h.current=null}return{onMouseLeave(){b()},onFocus(v){const w=v.currentTarget;if(f.current){if(h.current===w)return;b()}const C=Vs(v.nativeEvent);if(Ft(C)){if(Ov&&!v.relatedTarget){if(!m.current&&!Wg(C))return}else if(!w$(C))return}const S=Wp(v.relatedTarget,i.context.triggerElements),{nativeEvent:N,currentTarget:E}=v,k=typeof a=="function"?a():a;if(i.select("open")&&S||k===0||k===void 0){i.setOpen(!0,yt(gu,N,E));return}p.start(k,()=>{f.current||i.setOpen(!0,yt(gu,N,E))})},onBlur(v){b();const w=v.relatedTarget,C=v.nativeEvent,S=Ft(w)&&w.hasAttribute(yf("focus-guard"))&&w.getAttribute("data-type")==="outside";p.start(0,()=>{var A;const N=i.select("domReferenceElement"),E=Xs(Ht(N));!w&&E===N||gt((A=u.current.floatingContext)==null?void 0:A.refs.floating.current,E)||gt(N,E)||S||Wp(w??E,i.context.triggerElements)||i.setOpen(!1,yt(gu,C))})}}},[u,a,i,p]);return x.useMemo(()=>r?{reference:g,trigger:g}:{},[r,g])}class P2{constructor(){ln(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ln(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new xo,this.restTimeout=new xo,this.handleCloseOptions=void 0}static create(){return new P2}}const tg=new WeakMap;function ng(e){var r,a,i;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&tg.get(t)===e&&((r=e.pointerEventsScopeElement)==null||r.style.removeProperty("pointer-events"),(a=e.pointerEventsReferenceElement)==null||a.style.removeProperty("pointer-events"),(i=e.pointerEventsFloatingElement)==null||i.style.removeProperty("pointer-events"),tg.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function GM(e,t){const{scopeElement:r,referenceElement:a,floatingElement:i}=t,c=tg.get(r);c&&c!==e&&ng(c),ng(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=a,e.pointerEventsFloatingElement=i,tg.set(r,e),r.style.pointerEvents="none",a.style.pointerEvents="auto",i.style.pointerEvents="auto"}function _2(e){const t=e.context.dataRef.current,r=vs(()=>t.hoverInteractionState??P2.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=r),l2(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function L2(e,t={}){const{enabled:r=!0,closeDelay:a=0,nodeId:i}=t,c="rootStore"in e?e.rootStore:e,u=c.useState("open"),f=c.useState("floatingElement"),h=c.useState("domReferenceElement"),{dataRef:m}=c.context,p=al(),g=ol(),b=_2(c),v=us(),w=st(()=>{var N;return rM((N=m.current.openEvent)==null?void 0:N.type,b.interactedInside)}),C=st(()=>{var N;return S$((N=m.current.openEvent)==null?void 0:N.type)}),S=st(()=>{ng(b)});We(()=>{u||(b.pointerType=void 0,b.restTimeoutPending=!1,b.interactedInside=!1,S())},[u,b,S]),x.useEffect(()=>S,[S]),We(()=>{var N,E,k,A,M;if(r&&u&&(N=b.handleCloseOptions)!=null&&N.blockPointerEvents&&C()&&Ft(h)&&f){const R=h,T=f,O=Ht(f),D=(k=(E=p==null?void 0:p.nodesRef.current.find($=>$.id===g))==null?void 0:E.context)==null?void 0:k.elements.floating;D&&(D.style.pointerEvents="");const B=b.pointerEventsScopeElement!==T?b.pointerEventsScopeElement:null,F=D!==T?D:null,K=((M=(A=b.handleCloseOptions)==null?void 0:A.getScope)==null?void 0:M.call(A))??B??F??R.closest("[data-rootownerid]")??O.body;return GM(b,{scopeElement:K,referenceElement:R,floatingElement:T}),()=>{S()}}},[r,u,h,f,b,C,p,g,S]),x.useEffect(()=>{if(!r)return;function N(){return!!(p&&g&&nl(p.nodesRef.current,g).length>0)}function E(O){const D=rc(a,"close",b.pointerType),B=()=>{c.setOpen(!1,yt(Qn,O)),p==null||p.events.emit("floating.closed",O)};D?b.openChangeTimeout.start(D,B):(b.openChangeTimeout.clear(),B())}function k(O){const D=Vs(O);if(!y$(D)){b.interactedInside=!1;return}b.interactedInside=(D==null?void 0:D.closest("[aria-haspopup]"))!=null}function A(){b.openChangeTimeout.clear(),v.clear(),p==null||p.events.off("floating.closed",R),S()}function M(O){var K;if(N()&&p){p.events.on("floating.closed",R);return}if(Wp(O.relatedTarget,c.context.triggerElements))return;const D=((K=m.current.floatingContext)==null?void 0:K.nodeId)??i,B=O.relatedTarget;if(!(p&&D&&Ft(B)&&nl(p.nodesRef.current,D,!1).some($=>{var P;return gt((P=$.context)==null?void 0:P.elements.floating,B)}))){if(b.handler){b.handler(O);return}S(),C()&&!w()&&E(O)}}function R(O){!p||!g||N()||v.start(0,()=>{p.events.off("floating.closed",R),c.setOpen(!1,yt(Qn,O)),p.events.emit("floating.closed",O)})}const T=f;return oa(T&&$t(T,"mouseenter",A),T&&$t(T,"mouseleave",M),T&&$t(T,"pointerdown",k,!0),()=>{p==null||p.events.off("floating.closed",R)})},[r,f,c,m,a,i,C,w,S,b,p,g,v])}const iV={current:null};function $2(e,t={}){const{enabled:r=!0,delay:a=0,handleClose:i=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:h=iV,externalTree:m,isActiveTrigger:p=!0,getHandleCloseContext:g,isClosing:b,shouldOpen:v,guardStaleOpen:w=!1}=t,C="rootStore"in e?e.rootStore:e,{dataRef:S,events:N}=C.context,E=al(m),k=_2(C),A=x.useRef(!1),M=qn(i),R=qn(a),T=qn(u),O=qn(r),D=qn(v),B=qn(b),F=st(()=>{var H;return rM((H=S.current.openEvent)==null?void 0:H.type,k.interactedInside)}),K=st(()=>{var H;return((H=D.current)==null?void 0:H.call(D))!==!1}),$=st((H,W,q)=>{const Z=C.context.triggerElements;if(Z.hasElement(W))return!H||!gt(H,W);if(!Ft(q))return!1;const z=q;return Z.hasMatchingElement(L=>gt(L,z))&&(!H||!gt(H,z))}),P=st(()=>{if(!k.handler)return;Ht(C.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0}),U=st(()=>{ng(k)});return p&&(k.handleCloseOptions=i==null?void 0:i.__options),x.useEffect(()=>P,[P]),x.useEffect(()=>{if(!r)return;function H(W){W.open?A.current=!1:(A.current=W.reason===Qn,P(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return N.on("openchange",H),()=>{N.off("openchange",H)}},[r,N,k,P]),x.useEffect(()=>{if(!r)return;function H(X,ee=!0){const _=rc(R.current,"close",k.pointerType);_?k.openChangeTimeout.start(_,()=>{C.setOpen(!1,yt(Qn,X)),E==null||E.events.emit("floating.closed",X)}):ee&&(k.openChangeTimeout.clear(),C.setOpen(!1,yt(Qn,X)),E==null||E.events.emit("floating.closed",X))}const W=h.current??(p?C.select("domReferenceElement"):null);if(!Ft(W))return;function q(X){var pe;if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,c&&!Hi(k.pointerType))return;const ee=qk(T.current),_=rc(R.current,"open",k.pointerType),V=Vs(X),G=X.currentTarget??null,Y=C.select("domReferenceElement");let ne=G;if(Ft(V)&&!C.context.triggerElements.hasElement(V)){for(const xe of C.context.triggerElements.elements())if(gt(xe,V)){ne=xe;break}}Ft(G)&&Ft(Y)&&!C.context.triggerElements.hasElement(G)&>(G,Y)&&(ne=Y);const te=ne==null?!1:$(Y,ne,V),ye=C.select("open"),ae=((pe=B.current)==null?void 0:pe.call(B))??C.select("transitionStatus")==="ending",ue=!ye&&ae&&A.current,se=!te&&Ft(ne)&&Ft(Y)&>(Y,ne)&&ue,Q=ee>0&&!_,ie=te&&(ye||ue)||se,oe=!ye||te;if(ie){K()&&C.setOpen(!0,yt(Qn,X,ne));return}Q||(_?k.openChangeTimeout.start(_,()=>{oe&&K()&&C.setOpen(!0,yt(Qn,X,ne))}):oe&&K()&&C.setOpen(!0,yt(Qn,X,ne)))}function Z(X){if(F()){U();return}P();const ee=C.select("domReferenceElement"),_=Ht(ee);k.restTimeout.clear(),k.restTimeoutPending=!1;const V=S.current.floatingContext??(g==null?void 0:g());if(Wp(X.relatedTarget,C.context.triggerElements))return;if(M.current&&V){C.select("open")||k.openChangeTimeout.clear();const Y=h.current;k.handler=M.current({...V,tree:E,x:X.clientX,y:X.clientY,onClose(){U(),P(),O.current&&!F()&&Y===C.select("domReferenceElement")&&H(X,!0)}}),_.addEventListener("mousemove",k.handler),k.handler(X);return}(k.pointerType==="touch"?!gt(C.select("floatingElement"),X.relatedTarget):!0)&&H(X)}function z(X){gt(W,X.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}const L=w?$t(W,"mouseout",z):void 0;return f?oa($t(W,"mousemove",q,{once:!0}),$t(W,"mouseenter",q),$t(W,"mouseleave",Z),L):oa($t(W,"mouseenter",q),$t(W,"mouseleave",Z),L)},[P,U,S,R,C,r,M,k,p,$,F,c,f,T,h,E,O,g,B,K,w]),x.useMemo(()=>{if(!r)return;function H(W){k.pointerType=W.pointerType}return{onPointerDown:H,onPointerEnter:H,onMouseMove(W){var V,G,Y;const{nativeEvent:q}=W,Z=W.currentTarget,z=C.select("domReferenceElement"),L=C.select("open"),X=$(z,Z,W.target);if(c&&!Hi(k.pointerType))return;if(L&&X&&((V=k.handleCloseOptions)!=null&&V.blockPointerEvents)){const ne=C.select("floatingElement");if(ne){const te=((Y=(G=k.handleCloseOptions)==null?void 0:G.getScope)==null?void 0:Y.call(G))??Z.ownerDocument.body;GM(k,{scopeElement:te,referenceElement:Z,floatingElement:ne})}}const ee=qk(T.current);if(L&&!X||ee===0||!X&&k.restTimeoutPending&&W.movementX**2+W.movementY**2<2)return;k.restTimeout.clear();function _(){if(k.restTimeoutPending=!1,F())return;const ne=C.select("open");!k.blockMouseMove&&(!ne||X)&&K()&&C.setOpen(!0,yt(Qn,q,Z))}k.pointerType==="touch"?go.flushSync(()=>{_()}):X&&L?_():(k.restTimeoutPending=!0,k.restTimeout.start(ee,_))}}},[r,k,F,$,c,C,T,K])}const lV="Escape";function b5(e){return ri&&e.movementX===0&&e.movementY===0}function lx(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function Lm(e,t){return lx(t,e===sM||e===g2,e===Kg||e===Xg)}function Dv(e,t,r){return lx(t,e===g2,r?e===Kg:e===Xg)||e==="Enter"||e===" "||e===""}function cV(e,t,r){return lx(t,r?e===Kg:e===Xg,e===g2)}function uV(e,t,r,a){const i=r?e===Xg:e===Kg,c=e===sM;return t==="both"||t==="horizontal"&&a?e===lV:lx(t,i,c)}function qM(e,t){const{listRef:r,activeIndex:a,onNavigate:i=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:f=!1,loopFocus:h=!1,nested:m=!1,rtl:p=!1,virtual:g=!1,focusItemOnOpen:b="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:w=!0,disabledIndices:C=void 0,orientation:S="vertical",parentOrientation:N,id:E,resetOnPointerLeave:k=!0,externalTree:A,grid:M}=t,R=M!=null,T="rootStore"in e?e.rootStore:e,O=T.useState("open"),D=T.useState("floatingElement"),B=T.useState("domReferenceElement"),F=T.context.dataRef,K=Qp(D),$=Dy(B),P=qn(K),U=ol(),H=al(A),W=x.useRef(b),q=x.useRef(u??-1),Z=x.useRef(null),z=x.useRef(!0),L=st(fe=>{i(q.current===-1?null:q.current,fe)}),X=x.useRef(!!D),ee=x.useRef(O),_=x.useRef(!1),V=x.useRef(!1),G=x.useRef(null),Y=qn(C),ne=qn(O),te=qn(u),ye=qn(k),ae=Eu(),ue=Eu(),se=st(()=>{function fe(he){g?H==null||H.events.emit("virtualfocus",he):G.current=vp(he,{sync:_.current,preventScroll:!0})}const Re=r.current[q.current],Oe=V.current;Re&&fe(Re),(_.current?he=>he():he=>ae.request(he))(()=>{var ge;const he=r.current[q.current]||Re;if(!he)return;Re||fe(he),je&&(Oe||!z.current)&&((ge=he.scrollIntoView)==null||ge.call(he,{block:"nearest",inline:"nearest"}))})});We(()=>{F.current.orientation=S},[F,S]),We(()=>{c&&(O&&D?(q.current=u??-1,W.current&&u!=null&&(V.current=!0,L())):X.current&&(q.current=-1,L()))},[c,O,D,u,L]),We(()=>{if(c){if(!O){_.current=!1;return}if(D)if(a==null){if(_.current=!1,te.current!=null)return;if(X.current&&(q.current=-1,se()),(!ee.current||!X.current)&&W.current&&(Z.current!=null||W.current===!0&&Z.current==null)){let fe=0;const Re=()=>{r.current[0]==null?(fe<2&&(fe?ke=>ue.request(ke):queueMicrotask)(Re),fe+=1):(q.current=Z.current==null||Dv(Z.current,S,p)||m?bp(r):Iy(r),Z.current=null,L())};Re()}}else sf(r.current,a)||(q.current=a,se(),V.current=!1)}},[c,O,D,a,te,m,r,S,p,L,se,ue]),We(()=>{var he,Ae;if(!c||D||!H||g||!X.current)return;const fe=H.nodesRef.current,Re=(Ae=(he=fe.find(ge=>ge.id===U))==null?void 0:he.context)==null?void 0:Ae.elements.floating,Oe=Xs(Ht(B??Re??null)),ke=fe.some(ge=>ge.context&>(ge.context.elements.floating,Oe));Re&&!ke&&z.current&&Re.focus({preventScroll:!0})},[c,D,B,H,U,g]),We(()=>{ee.current=O,X.current=!!D}),We(()=>{O||(Z.current=null,W.current=b)},[O,b]);const Q=a!=null,ie=st(fe=>{if(!ne.current)return;const Re=r.current.indexOf(fe.currentTarget);Re!==-1&&(q.current!==Re||a!==Re)&&(q.current=Re,L(fe))}),oe=st(()=>{var fe,Re,Oe;return N??((Oe=(Re=(fe=H==null?void 0:H.nodesRef.current.find(ke=>ke.id===U))==null?void 0:fe.context)==null?void 0:Re.dataRef)==null?void 0:Oe.current.orientation)}),pe=st(()=>bp(r,Y.current)),xe=st(fe=>{if(z.current=!1,_.current=!0,fe.which===229||!ne.current&&fe.currentTarget===P.current)return;if(m&&uV(fe.key,S,p,R)){Lm(fe.key,oe())||ta(fe),T.setOpen(!1,yt(Ry,fe.nativeEvent)),wn(B)&&(g?H==null||H.events.emit("virtualfocus",B):B.focus());return}const Re=q.current,Oe=bp(r,C),ke=Iy(r,C);if($||(fe.key==="Home"&&(ta(fe),q.current=Oe,L(fe)),fe.key==="End"&&(ta(fe),q.current=ke,L(fe))),M!=null){const he=M(fe,q.current,r,S,h,p,C,Oe,ke);if(he!=null&&(q.current=he,L(fe)),S==="both")return}if(Lm(fe.key,S)){if(ta(fe),O&&!g&&Xs(fe.currentTarget.ownerDocument)===fe.currentTarget){q.current=Dv(fe.key,S,p)?Oe:ke,L(fe);return}Dv(fe.key,S,p)?h?Re>=ke?f&&Re!==r.current.length?q.current=-1:(_.current=!1,q.current=Oe):q.current=Va(r.current,{startingIndex:Re,disabledIndices:C}):q.current=Math.min(ke,Va(r.current,{startingIndex:Re,disabledIndices:C})):h?Re<=Oe?f&&Re!==-1?q.current=r.current.length:(_.current=!1,q.current=ke):q.current=Va(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C}):q.current=Math.max(Oe,Va(r.current,{startingIndex:Re,decrement:!0,disabledIndices:C})),sf(r.current,q.current)&&(q.current=-1),L(fe)}}),je=x.useMemo(()=>({onFocus(Re){_.current=!0,ie(Re)},onClick:({currentTarget:Re})=>Re.focus({preventScroll:!0}),onMouseMove(Re){b5(Re)||(_.current=!0,V.current=!1,v&&ie(Re))},onPointerLeave(Re){var ke;if(!ne.current||!z.current||Re.pointerType==="touch")return;_.current=!0;const Oe=Re.relatedTarget;if(!(!v||r.current.includes(Oe))&&ye.current&&((ke=G.current)==null||ke.call(G),G.current=null,q.current=-1,L(Re),!g)){const he=P.current,Ae=Xs(Ht(he));he&>(he,Ae)&&he.focus({preventScroll:!0})}}}),[ie,ne,P,v,r,L,ye,g]),Ie=x.useMemo(()=>g&&O&&Q&&{"aria-activedescendant":`${E}-${a}`},[g,O,Q,E,a]),ce=x.useMemo(()=>({...$?{}:Ie,onKeyDown(fe){if(fe.key==="Tab"&&fe.shiftKey&&O&&!g){const Re=Vs(fe.nativeEvent);if(Re&&!gt(P.current,Re))return;ta(fe),T.setOpen(!1,yt(Ji,fe.nativeEvent)),wn(B)&&B.focus();return}xe(fe)},onPointerMove(fe){b5(fe)||(z.current=!0)}}),[Ie,xe,P,$,T,O,g,B]),Te=x.useMemo(()=>{function fe(ke){T.setOpen(!0,yt(Ry,ke.nativeEvent,ke.currentTarget))}function Re(ke){b==="auto"&&Yg(ke.nativeEvent)&&(W.current=!g)}function Oe(ke){W.current=b,b==="auto"&&p2(ke.nativeEvent)&&(W.current=!0)}return{onKeyDown(ke){const he=T.select("open");z.current=!1;const Ae=ke.key.startsWith("Arrow"),ge=cV(ke.key,oe(),p),Pe=Lm(ke.key,S),Fe=(m?ge:Pe)||ke.key==="Enter"||ke.key.trim()==="";if(g&&he)return xe(ke);if(!(!he&&!w&&Ae)){if(Fe){const _e=Lm(ke.key,oe());Z.current=m&&_e?null:ke.key}if(m){ge&&(ta(ke),he?(q.current=pe(),L(ke)):fe(ke));return}Pe&&(te.current!=null&&(q.current=te.current),ta(ke),!he&&w?fe(ke):xe(ke),he&&L(ke))}},onFocus(ke){T.select("open")&&!g&&(q.current=-1,L(ke))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:Re,onClick:Re}},[xe,b,pe,m,L,T,w,S,oe,p,te,g]),re=x.useMemo(()=>({...Ie,...Te}),[Ie,Te]);return x.useMemo(()=>c?{reference:re,floating:ce,item:je,trigger:Te}:{},[c,re,ce,Te,je])}function YM(e,t){const{listRef:r,elementsRef:a,activeIndex:i,onMatch:c,disabledIndices:u,onTyping:f,enabled:h=!0,resetMs:m=750,selectedIndex:p=null}=t,g="rootStore"in e?e.rootStore:e,b=g.useState("open"),v=us(),w=x.useRef(""),C=x.useRef(p??i??-1),S=x.useRef(null),N=st(A=>{function M(P){return a==null?void 0:a.current[P]}function R(P){const U=M(P);return U&&!Qg(U)||U!=null&&U.matches(":disabled")?!1:u==null||!xu(Vr,P,u)}function T(P,U,H=0){if(P.length===0)return-1;const W=(H%P.length+P.length)%P.length,q=U.toLowerCase();for(let Z=0;Z<P.length;Z+=1){const z=(W+Z)%P.length,L=P[z];if(!(!(L!=null&&L.toLowerCase().startsWith(q))||!R(z)))return z}return-1}const O=r.current;if(w.current.length>0&&A.key===" "&&(ta(A),f==null||f(!0)),w.current.length>0&&w.current[0]!==" "&&T(O,w.current)===-1&&A.key!==" "&&(f==null||f(!1)),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;b&&A.key!==" "&&(ta(A),f==null||f(!0));const D=w.current==="";D&&(C.current=p??i??-1),O.every((P,U)=>{var H,W;return P&&R(U)?((H=P[0])==null?void 0:H.toLowerCase())!==((W=P[1])==null?void 0:W.toLowerCase()):!0})&&w.current===A.key&&(w.current="",C.current=S.current),w.current+=A.key,v.start(m,()=>{w.current="",C.current=S.current,f==null||f(!1)});const K=((D?p??i??-1:C.current)??0)+1,$=T(O,w.current,K);$!==-1?(c==null||c($),S.current=$):A.key!==" "&&(w.current="",f==null||f(!1))}),E=st(A=>{const M=A.relatedTarget,R=g.select("domReferenceElement"),T=g.select("floatingElement");gt(R,M)||gt(T,M)||(v.clear(),w.current="",C.current=S.current,f==null||f(!1))});We(()=>{!b&&p!==null||(v.clear(),S.current=null,w.current!==""&&(w.current=""))},[b,p,v]);const k=x.useMemo(()=>({onKeyDown:N,onBlur:E}),[N,E]);return x.useMemo(()=>h?{reference:k,floating:k}:{},[h,k])}const v5=.1,dV=v5*v5,kn=.5;function $m(e,t,r,a,i,c){return a>=t!=c>=t&&e<=(i-r)*(t-a)/(c-a)+r}function Bm(e,t,r,a,i,c,u,f,h,m){let p=!1;return $m(e,t,r,a,i,c)&&(p=!p),$m(e,t,i,c,u,f)&&(p=!p),$m(e,t,u,f,h,m)&&(p=!p),$m(e,t,h,m,r,a)&&(p=!p),p}function fV(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}function Vm(e,t,r,a,i,c){const u=Math.min(r,i),f=Math.max(r,i),h=Math.min(a,c),m=Math.max(a,c);return e>=u&&e<=f&&t>=h&&t<=m}function B2(e={}){const{blockPointerEvents:t=!1}=e,r=new xo,a=({x:i,y:c,placement:u,elements:f,onClose:h,nodeId:m,tree:p})=>{const g=u==null?void 0:u.split("-")[0];let b=!1,v=null,w=null,C=typeof performance<"u"?performance.now():0;function S(E,k){const A=performance.now(),M=A-C;if(v===null||w===null||M===0)return v=E,w=k,C=A,!1;const R=E-v,T=k-w,O=R*R+T*T,D=M*M*dV;return v=E,w=k,C=A,O<D}function N(){r.clear(),h()}return function(k){r.clear();const A=f.domReference,M=f.floating;if(!A||!M||g==null||i==null||c==null)return;const{clientX:R,clientY:T}=k,O=Vs(k),D=k.type==="mouseleave",B=gt(M,O),F=gt(A,O);if(B&&(b=!0,!D))return;if(F&&(b=!1,!D)){b=!0;return}if(D&&Ft(k.relatedTarget)&>(M,k.relatedTarget))return;function K(){return!!(p&&nl(p.nodesRef.current,m).length>0)}function $(){K()||N()}if(K())return;const P=A.getBoundingClientRect(),U=M.getBoundingClientRect(),H=i>U.right-U.width/2,W=c>U.bottom-U.height/2,q=U.width>P.width,Z=U.height>P.height,z=(q?P:U).left,L=(q?P:U).right,X=(Z?P:U).top,ee=(Z?P:U).bottom;if(g==="top"&&c>=P.bottom-1||g==="bottom"&&c<=P.top+1||g==="left"&&i>=P.right-1||g==="right"&&i<=P.left+1){$();return}let _=!1;switch(g){case"top":_=Vm(R,T,z,P.top+1,L,U.bottom-1);break;case"bottom":_=Vm(R,T,z,U.top+1,L,P.bottom-1);break;case"left":_=Vm(R,T,U.right-1,ee,P.left+1,X);break;case"right":_=Vm(R,T,P.right-1,ee,U.left+1,X);break}if(_)return;if(b&&!fV(R,T,P)){$();return}if(!D&&S(R,T)){$();return}let V=!1;switch(g){case"top":{const G=q?kn/2:kn*4,Y=q||H?i+G:i-G,ne=q?i-G:H?i+G:i-G,te=c+kn+1,ye=H||q?U.bottom-kn:U.top,ae=H?q?U.bottom-kn:U.top:U.bottom-kn;V=Bm(R,T,Y,te,ne,te,U.left,ye,U.right,ae);break}case"bottom":{const G=q?kn/2:kn*4,Y=q||H?i+G:i-G,ne=q?i-G:H?i+G:i-G,te=c-kn,ye=H||q?U.top+kn:U.bottom,ae=H?q?U.top+kn:U.bottom:U.top+kn;V=Bm(R,T,Y,te,ne,te,U.left,ye,U.right,ae);break}case"left":{const G=Z?kn/2:kn*4,Y=Z||W?c+G:c-G,ne=Z?c-G:W?c+G:c-G,te=i+kn+1,ye=W||Z?U.right-kn:U.left,ae=W?Z?U.right-kn:U.left:U.right-kn;V=Bm(R,T,ye,U.top,ae,U.bottom,te,Y,te,ne);break}case"right":{const G=Z?kn/2:kn*4,Y=Z||W?c+G:c-G,ne=Z?c-G:W?c+G:c-G,te=i-kn,ye=W||Z?U.left+kn:U.right,ae=W?Z?U.left+kn:U.right:U.left+kn;V=Bm(R,T,te,Y,te,ne,ye,U.top,ae,U.bottom);break}}V?b||r.start(40,$):$()}};return a.__options={...e,blockPointerEvents:t},a}const KM=x.createContext(void 0);function hV(){const e=x.useContext(KM);if(e===void 0)throw new Error(rn(26));return e}const By="ArrowUp",Vy="ArrowDown",Uy="ArrowLeft",Hy="ArrowRight",Fy="Home",Gy="End",Zf=new Set([By,Vy,Uy,Hy,Fy,Gy]),mV="Shift",pV=[mV,"Control","Alt","Meta"];function gV(e){return wn(e)&&e.tagName==="INPUT"}function y5(e){return!!(gV(e)&&e.selectionStart!=null||wn(e)&&e.tagName==="TEXTAREA")}function w5(e,t,r,a){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(u&&a!=="vertical"){const h=j5(e,t,"left"),m=Um(e),p=Um(t);r==="ltr"&&(h+t.offsetWidth+p.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?i=h+t.offsetWidth+p.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:h-p.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(i=h-p.scrollMarginLeft-m.scrollPaddingLeft)),r==="rtl"&&(h-p.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft?i=h-p.scrollMarginLeft-m.scrollPaddingLeft:h+t.offsetWidth+p.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(i=h+t.offsetWidth+p.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(f&&a!=="horizontal"){const h=j5(e,t,"top"),m=Um(e),p=Um(t);h-p.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=h-p.scrollMarginTop-m.scrollPaddingTop:h+t.offsetHeight+p.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=h+t.offsetHeight+p.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:i,top:c,behavior:"auto"})}function j5(e,t,r){const a=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[a],t.offsetParent!==e);)t=t.offsetParent;return i}function Um(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const xV="--nested-dialogs",bV="data-nested-dialog-open",vV={...qf,...si,nestedDialogOpen(e){return e?{[bV]:""}:null}},V2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,initialFocus:f,...h}=t,m=mc(),p=m.useState("descriptionElementId"),g=m.useState("disablePointerDismissal"),b=m.useState("floatingRootContext"),v=m.useState("popupProps"),w=m.useState("modal"),C=m.useState("mounted"),S=m.useState("nested"),N=m.useState("nestedOpenDialogCount"),E=m.useState("open"),k=m.useState("openMethod"),A=m.useState("titleElementId"),M=m.useState("transitionStatus"),R=m.useState("role"),T=b.useState("floatingId");hV(),Sr({open:E,ref:m.context.popupRef,onComplete(){var $,P;E&&((P=($=m.context).onOpenChangeComplete)==null||P.call($,!0))}});const O=f===void 0?VM(m.context.popupRef):f,D=N>0,B=m.useStateSetter("popupElement"),K=Ct("div",t,{state:{open:E,nested:S,transitionStatus:M,nestedDialogOpen:D},props:[v,{id:T,"aria-labelledby":A,"aria-describedby":p,role:R,...Wf,hidden:!C,onKeyDown($){Zf.has($.key)&&$.stopPropagation()},style:{[xV]:N}},h],ref:[r,m.context.popupRef,B],stateAttributesMapping:vV});return n.jsx(Jg,{context:b,openInteractionType:k,disabled:!C,closeOnFocusOut:!g,initialFocus:O,returnFocus:u,modal:w!==!1,restoreFocus:"popup",children:K})});function Jf(e){return Y1(19)?e:e?"true":void 0}const cx=x.forwardRef(function(t,r){const{cutout:a,...i}=t;let c;if(a){const u=a.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${u.left}px ${u.top}px,${u.left}px ${u.bottom}px,${u.right}px ${u.bottom}px,${u.right}px ${u.top}px,${u.left}px ${u.top}px)`}return n.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),U2=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t,c=mc(),u=c.useState("mounted"),f=c.useState("modal"),h=c.useState("open");return u||a?n.jsx(KM.Provider,{value:a,children:n.jsxs(Zg,{ref:r,...i,children:[u&&f===!0&&n.jsx(cx,{ref:c.context.internalBackdropRef,inert:Jf(!h)}),t.children]})}):null});let S5={},N5={},C5="";function ux(e,t){return zf(e)?e:t}function k5(e,t,r){return/hidden|clip/.test(e.getComputedStyle(ux(t,r)).overflowY)}function yV(e){if(typeof document>"u")return!1;const t=Ht(e);return Rn(t).innerWidth-t.documentElement.clientWidth>0}function wV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=Ht(e),a=r.documentElement,i=r.body,c=ux(a,i),u=c.style.overflowY,f=a.style.scrollbarGutter;a.style.scrollbarGutter="stable",c.style.overflowY="scroll";const h=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=u,a.style.scrollbarGutter=f,h===m}function jV(e){const t=Ht(e),r=t.documentElement,a=t.body,i=ux(r,a),c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function SV(e){var v;const t=Ht(e),r=t.documentElement,a=t.body,i=Rn(r);let c=0,u=0,f=!1;const h=wr.create();if(ri&&(((v=i.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function m(){const w=i.getComputedStyle(r),C=i.getComputedStyle(a),E=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,u=r.scrollLeft,S5={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},C5=r.style.scrollBehavior,N5={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const k=r.scrollHeight>r.clientHeight,A=r.scrollWidth>r.clientWidth,M=w.overflowY==="scroll"||C.overflowY==="scroll",R=w.overflowX==="scroll"||C.overflowX==="scroll",T=Math.max(0,i.innerWidth-a.clientWidth),O=Math.max(0,i.innerHeight-a.clientHeight),D=parseFloat(C.marginTop)+parseFloat(C.marginBottom),B=parseFloat(C.marginLeft)+parseFloat(C.marginRight),F=ux(r,a);if(f=wV(e),f){r.style.scrollbarGutter=E,F.style.overflowY="hidden",F.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(k||M)&&(r.style.overflowY="scroll"),(A||R)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:D||O?`calc(100dvh - ${D+O}px)`:"100dvh",width:B||T?`calc(100vw - ${B+T}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),a.scrollTop=c,a.scrollLeft=u,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function p(){Object.assign(r.style,S5),Object.assign(a.style,N5),f||(r.scrollTop=c,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=C5)}function g(){p(),h.request(m)}m();const b=$t(i,"resize",g);return()=>{h.cancel(),p(),typeof i.removeEventListener=="function"&&b()}}class NV{constructor(){ln(this,"lockCount",0);ln(this,"restore",null);ln(this,"timeoutLock",xo.create());ln(this,"timeoutUnlock",xo.create());ln(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ln(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ht(t),a=r.documentElement,i=r.body,c=Rn(a);if(k5(c,a,i)){const f=new c.MutationObserver(()=>{k5(c,a,i)||(f.disconnect(),this.restore=null,this.lock(t))}),h={attributes:!0};f.observe(a,h),f.observe(i,h),this.restore=()=>f.disconnect();return}const u=qg||!yV(t);this.restore=u?jV(t):SV(t)}}const CV=new NV;function XM(e=!0,t=null){We(()=>{if(e)return CV.acquire(t)},[e,t])}function kV({store:e,parentContext:t,isDrawer:r}){const a=e.useState("open"),i=e.useState("disablePointerDismissal"),c=e.useState("modal"),u=e.useState("popupElement"),f=e.useState("floatingRootContext"),[h,m]=x.useState(0),[p,g]=x.useState(0),b=h===0,v=Kf(f,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(w){if(!e.context.outsidePressEnabledRef.current||"button"in w&&w.button!==0)return!1;if("touches"in w){if(w.type==="touchend"){if(w.changedTouches.length!==1||w.touches.length!==0)return!1}else if(w.touches.length!==1)return!1}const C=Vs(w);if(b&&!i){if(c){const S=e.context.internalBackdropRef.current,N=e.context.backdropRef.current;return S||N?S===C||N===C||gt(C,u)&&!(C!=null&&C.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:b});return XM(a&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(w,C)=>{m(w),g(C)}),We(()=>(t!=null&&t.onNestedDialogOpen&&(a?t.onNestedDialogOpen(h+1,p+(r?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&a&&t.onNestedDialogOpen(0,0)}),[r,a,h,p,t]),ox(e,{activeTriggerProps:v.reference,inactiveTriggerProps:v.trigger,popupProps:v.floating,nestedOpenDialogCount:h,nestedOpenDrawerCount:p}),null}const TV={...ix,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class EV extends _u{constructor(r,a,i){const c=new Qf,u=RV(r,c,a,i);super(u,AV(c),TV);ln(this,"setOpen",(r,a)=>{var i,c;a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!r&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),(c=(i=this.context).onOpenChange)==null||c.call(i,r,a),!a.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(r,a),this.update(nx(this.state,r,a.trigger)))})}}function RV(e,t,r,a=!1){return{...ax(t,r,a),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function AV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function WM(e,t){const{children:r,open:a,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:f=!1,modal:h=!0,actionsRef:m,handle:p,triggerId:g,defaultTriggerId:b=null}=t,v=e==="drawer",w=e==="alert-dialog",C=w?!0:h,S=w||f,N=w?"alertdialog":"dialog",E=mc(!0),k=E!=null,A={modal:C,disablePointerDismissal:S,nested:k,role:N},M=M2((F,K)=>new EV({open:i,openProp:a,activeTriggerId:b,triggerIdProp:g,...A},F,K),!0);M.useControlledProp("openProp",a),M.useControlledProp("triggerIdProp",g),M.useSyncedValues(A),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",u);const R=M.useState("open"),T=M.useState("mounted"),O=M.useState("payload");UM(M,R),sx(M);const{forceUnmount:D}=rx(R,M);x.useImperativeHandle(m,()=>({unmount:D,close:()=>M.setOpen(!1,yt(Ug))}),[D,M]);const B=R||T;return n.jsxs(eM.Provider,{value:M,children:[p&&n.jsx(tx,{handle:p,store:M}),B&&n.jsx(kV,{store:M,parentContext:E==null?void 0:E.context,isDrawer:v}),typeof r=="function"?r({payload:O}):r]})}const QM=Xf(function(t){return WM("dialog",t)}),H2=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,h=mc(),m=ws(u);return h.useSyncedValueWithCleanup("titleElementId",m),Ct("h2",t,{ref:r,props:[{id:m},f]})});function MV(e){const t=x.useRef(""),r=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:r}}function ZM(e,t){const r=st((c,u)=>{(typeof e=="function"?e():e)||t(u||(qg?"touch":""))}),{onClick:a,onPointerDown:i}=MV(r);return x.useMemo(()=>({onClick:a,onPointerDown:i}),[a,i])}function JM(e){const[t,r]=x.useState(null),a=ZM(e,r);return Ff(e,i=>{i&&!e&&r(null)}),x.useMemo(()=>({openMethod:t,triggerProps:a}),[t,a])}function tn({...e}){return n.jsx(QM,{"data-slot":"dialog",...e})}function OV({...e}){return n.jsx(U2,{"data-slot":"dialog-portal",...e})}function DV({className:e,...t}){return n.jsx(d2,{"data-slot":"dialog-overlay",className:Ve("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function nn({className:e,children:t,showCloseButton:r=!0,...a}){return n.jsxs(OV,{children:[n.jsx(DV,{}),n.jsxs(V2,{"data-slot":"dialog-content",className:Ve("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[t,r&&n.jsxs(Fg,{"data-slot":"dialog-close",render:n.jsx(le,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[n.jsx(Pn,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function sn({className:e,...t}){return n.jsx("div",{"data-slot":"dialog-header",className:Ve("flex flex-col gap-2",e),...t})}function Hr({className:e,showCloseButton:t=!1,children:r,...a}){return n.jsxs("div",{"data-slot":"dialog-footer",className:Ve("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...a,children:[r,t&&n.jsx(Fg,{render:n.jsx(le,{variant:"outline"}),children:"Close"})]})}function Qt({className:e,...t}){return n.jsx(H2,{"data-slot":"dialog-title",className:Ve("font-heading text-base leading-none font-medium",e),...t})}function Sn({className:e,...t}){return n.jsx(f2,{"data-slot":"dialog-description",className:Ve("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const dx=x.createContext(null);function Zn({location:e,children:t}){var h;const r=Bf(),a=ds(),i=a!=null&&a.localViewer&&(e!=null&&e.target)?e.target:r.target,c=i==="cloud"?((h=a==null?void 0:a.status)==null?void 0:h.owner)??r.owner:r.owner,u=x.useMemo(()=>lr(i,r.signal,e==null?void 0:e.context,c),[i,r.signal,e==null?void 0:e.context,c]),f=x.useMemo(()=>({location:e,api:u}),[e,u]);return n.jsx(g7,{target:e==null?void 0:e.target,children:n.jsx(dx.Provider,{value:f,children:t})})}function Pt(){var t;const e=Bf();return((t=x.useContext(dx))==null?void 0:t.api)??e}function gn(){var e;return((e=x.useContext(dx))==null?void 0:e.location)??null}function e3({api:e,location:t=null,children:r}){return n.jsx(dx.Provider,{value:{location:t,api:e},children:r})}function fx({record:e}){return n.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a2(e).map(t=>n.jsx(Hs,{location:t.location},ht(t))),e.configurationCount>1&&n.jsx("span",{className:"text-[10px] leading-tight text-muted-foreground",title:"Configurations differ. Open the row and select a source to inspect or edit its copy.",children:"Varies by source"})]})}function wf({record:e,onChange:t,disabled:r}){const a=a2(e);return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Source"}),a.map(i=>{var c;return n.jsx("button",{type:"button",disabled:r||((c=i.location)==null?void 0:c.connected)===!1,"aria-pressed":ht(i)===ht(e),"aria-label":`Edit in ${Dn(i.location)}`,onClick:()=>t({...i,copies:a}),className:"rounded-full p-0.5 outline-none aria-pressed:ring-2 aria-pressed:ring-ring focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:n.jsx(Hs,{location:i.location})},ht(i))})]})}function hx({record:e,type:t,offer:r,children:a}){const i=Pt(),c=gn(),u=x.useMemo(()=>{const f={groups:["saveGroup"],network:["savePolicy"],setups:["deleteSetupItem"],templates:["buildImageTemplate"]}[t]??[];return{...i,...Object.fromEntries(f.map(h=>[h,async(...m)=>{var g;const p=await i[h](...m);return(g=m[0])!=null&&g.isNew||r({type:t,before:e,method:h,args:m}),p}]))}},[i,e,t,r]);return n.jsx(e3,{api:u,location:c,children:a})}function mx(e,t,r){const[a,i]=x.useState(null),[c,u]=x.useState([]),[f,h]=x.useState({}),[m,p]=x.useState(!1),g=v=>{var C,S;if(!((C=v.before)!=null&&C.name)||!((S=v.before)!=null&&S.location))return;const w=y7(v.before,e);w.length&&(i({...v,targets:w}),u([]),h({}))},b=a&&n.jsx(tn,{open:!0,onOpenChange:v=>{!v&&!m&&i(null)},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Apply to other sources?"}),n.jsxs(Sn,{children:["Saved in ",Dn(a.before.location),". Choose where to apply the same change to “",a.before.name,"”."]})]}),n.jsx("div",{className:"divide-y rounded-lg border",children:a.targets.map(v=>{const w=ht(v),C=Bi(a.type,v)!==Bi(a.type,a.before);return n.jsxs("label",{className:"flex items-start gap-3 p-3 text-xs",children:[n.jsx($o,{checked:c.includes(w),disabled:m||!v.location.connected||f[w]==="Applied",onCheckedChange:S=>u(N=>S?[...N,w]:N.filter(E=>E!==w))}),n.jsxs("span",{className:"space-y-1",children:[n.jsx(Hs,{location:v.location}),C&&n.jsx("span",{className:"block text-muted-foreground",children:"Different configuration · only changed fields will be applied."}),!v.location.connected&&n.jsx("span",{className:"block text-muted-foreground",children:"Disconnected"}),f[w]&&n.jsx("span",{role:"status",className:"block",children:f[w]})]})]},w)})}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:m,onClick:()=>i(null),children:Object.values(f).includes("Applied")?"Done":"Only this source"}),n.jsx(le,{disabled:m||!c.some(v=>f[v]!=="Applied"),onClick:async()=>{var v,w,C;p(!0);for(const S of a.targets.filter(N=>c.includes(ht(N))&&f[ht(N)]!=="Applied")){let N;try{const E=await w7(a,S,t(S.location));N=(v=E==null?void 0:E.sync)!=null&&v.error||(C=(w=E==null?void 0:E.sync)==null?void 0:w.failed)!=null&&C.length?"Saved; sandbox synchronization needs attention.":"Applied"}catch(E){N=E.message}h(E=>({...E,[ht(S)]:N}))}try{await r()}finally{p(!1)}},children:m?"Applying…":"Apply selected"})]})]})});return{offer:g,dialog:b}}const t3=[{id:"claude",name:"Claude Code",command:"claude",config:".claude.json",key:"mcpServers",format:"claude",skills:".claude/skills"},{id:"codex",name:"Codex",command:"codex",config:".codex/config.toml",key:"mcp_servers",format:"codex",skills:".agents/skills",extraSkillRoots:[".codex/skills"]},{id:"opencode",name:"OpenCode",command:"opencode",config:".config/opencode/opencode.json",alternateConfig:".config/opencode/opencode.jsonc",key:"mcp",format:"opencode",skills:".config/opencode/skills",extraSkillRoots:[".claude/skills",".agents/skills"]},{id:"pi",name:"Pi",command:"pi",config:".pi/agent/mcp.json",key:"mcpServers",format:"json",skills:".pi/agent/skills",extraSkillRoots:[".agents/skills"],note:"Requires a Pi version with built-in MCP support; MCP extensions can override it."},{id:"cursor",name:"Cursor",command:"cursor-agent",config:".cursor/mcp.json",key:"mcpServers",format:"json",skills:".cursor/skills"},{id:"antigravity",name:"Antigravity CLI",command:"agy",config:".gemini/config/mcp_config.json",key:"mcpServers",format:"antigravity",skills:".gemini/config/skills"},{id:"copilot",name:"GitHub Copilot",command:"copilot",config:".copilot/mcp-config.json",key:"mcpServers",format:"copilot",skills:".copilot/skills"},{id:"kiro",name:"Kiro CLI",command:"kiro-cli",config:".kiro/settings/mcp.json",key:"mcpServers",format:"json",skills:".kiro/skills"},{id:"droid",name:"Factory Droid",command:"droid",config:".factory/mcp.json",key:"mcpServers",format:"droid",skills:".factory/skills"},{id:"aider",name:"Aider",command:"aider",reason:"Aider has no supported native MCP or SKILL.md setup integration. Choose another agent to use this Setup."}],zV=t3,IV=t3.filter(e=>e.config&&e.skills),qy=e=>IV.find(t=>t.id===e),PV=e=>e.filter(t=>!!qy(t)),_V=x.forwardRef(function(t,r){const{render:a,className:i,id:c,name:u,value:f,disabled:h=!1,onValueChange:m,defaultValue:p,autoFocus:g=!1,style:b,...v}=t,{state:w,name:C,disabled:S,setTouched:N,setDirty:E,validityData:k,setFocused:A,setFilled:M,validationMode:R,validation:T}=Pu(),{clearErrors:O,elementRef:D,submitCountRef:B}=Bg(),F=S||h,K=C??u,$={...w,disabled:F},{labelId:P}=Vf(),U=Uf({id:c}),[H]=po({controlled:f,default:p,name:"FieldControl",state:"value"}),W=f!==void 0,q=W?H:void 0,Z=q==null?void 0:String(q),z=st(()=>{var _;return(_=T.inputRef.current)==null?void 0:_.value});$g(T.inputRef,U,Z,z,!F,u),We(()=>{var V;const _=Z??((V=T.inputRef.current)==null?void 0:V.value);_!==void 0&&M(_!=="")},[Z,T.inputRef,M]),Ff(Z,()=>{Z!==void 0&&(O(K),E(Z!==(k.initialValue??"")),T.change(Z))});const L=x.useRef(null),X=us();return We(()=>{g&&L.current===Xs(Ht(L.current))&&A(!0)},[g,A]),Ct("input",t,{ref:[r,L],state:$,props:[{id:U,disabled:F,name:K,ref:T.inputRef,"aria-labelledby":P,autoFocus:g,...W?{value:q}:{defaultValue:p},onChange(_){const V=_.currentTarget.value,G=yt(Ur,_.nativeEvent);m==null||m(V,G),!W&&(E(V!==(k.initialValue??"")),M(V!==""),!_.nativeEvent.defaultPrevented&&!G.isCanceled&&(O(K),T.change(V)))},onFocus(){A(!0)},onBlur(_){if(N(!0),A(!1),R==="onBlur"){const V=_.currentTarget.value;T.commit(V),W&&queueMicrotask(()=>{var Y;const G=(Y=T.inputRef.current)==null?void 0:Y.value;G!==void 0&&G!==V&&G!==(k.initialValue??"")&&T.commit(G)})}},onKeyDown(_){if(_.currentTarget.tagName==="INPUT"&&_.key==="Enter"){N(!0);const V=_.currentTarget.value,G=_.currentTarget.form;if(G&&G===D.current&&!_.defaultPrevented){const Y=_.currentTarget,ne=B.current;X.start(0,()=>{B.current===ne&&T.commit(Y.value)})}else T.commit(V)}}},v,_=>T.getValidationProps(F,_)],stateAttributesMapping:Lg})}),LV=x.forwardRef(function(t,r){return n.jsx(_V,{ref:r,...t})});function Ot({className:e,type:t,...r}){return n.jsx(LV,{type:t,"data-slot":"input",className:Ve("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}function $V({className:e,...t}){return n.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:n.jsx("table",{"data-slot":"table",className:js("w-full caption-bottom text-sm",e),...t})})}function BV({className:e,...t}){return n.jsx("thead",{"data-slot":"table-header",className:js("[&_tr]:border-b",e),...t})}function VV({className:e,...t}){return n.jsx("tbody",{"data-slot":"table-body",className:js("[&_tr:last-child]:border-0",e),...t})}function T5({className:e,...t}){return n.jsx("tr",{"data-slot":"table-row",className:js("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function zv({className:e,...t}){return n.jsx("th",{"data-slot":"table-head",className:js("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function $l({className:e,...t}){return n.jsx("td",{"data-slot":"table-cell",className:js("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Lu(e){const t=Math.round((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const r=Math.round(t/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function jf(e){return!e||!Number.isFinite(Date.parse(e))?"Not reported":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function UV(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}function HV(e){const[t,r]=x.useState({current:e,previous:null});return Object.is(e,t.current)||r({current:e,previous:t.current}),t.previous}function n3(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const s3=x.createContext(void 0),r3=x.createContext(void 0),o3=x.createContext(void 0);function ja(){const e=x.useContext(s3);if(e===void 0)throw new Error(rn(60));return e}function px(){const e=x.useContext(r3);if(e===void 0)throw new Error(rn(101));return e}function a3(){const e=x.useContext(o3);if(e===void 0)throw new Error(rn(61));return e}function FV(e,t,r=Object.is){const{length:a}=e;if(a!==t.length)return!1;for(let i=0;i<a;i+=1)if(!r(e[i],t[i]))return!1;return!0}const i3=(e,t)=>Object.is(e,t);function ac(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function GV(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!FV(e,t,(a,i)=>ac(a,i,r)):e!==t}function Yy(e,t,r){return e?e.some(a=>a===void 0?!1:ac(t,a,r)):!1}function wp(e,t,r){return e?e.findIndex(a=>a===void 0?!1:ac(a,t,r)):-1}function qV(e,t){if(t!==i3)return a=>Yy(e,a,t);const r=new Set(e);return r.delete(void 0),a=>r.has(a)&&(a!==0||e.some(i=>Object.is(a,i)))}function l3(e,t,r,a){const i=a&&Array.isArray(t)?e.findIndex(qV(t,r)):wp(e,t,r);return i===-1?null:i}function YV(e,t,r,a,i,c){return Yy(a,t,i)?c!=null&&e>c&&Yy(a,r[c],i)?c:e:e===c?l3(r,a,i,!0):c}function KV(e,t,r){return e.filter(a=>!ac(t,a,r))}function Ky(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function XV(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function c3(e){return XV(e==null?void 0:e[0])}function WV(e){return c3(e)?e.flatMap(t=>t.items):e}function QV(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(c3(t)){for(const r of t)for(const a of r.items)if(a&&a.value==null&&a.label!=null)return!0;return!1}for(const r of t)if(r&&r.value==null&&r.label!=null)return!0;return!1}function u3(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ky(e)}function iu(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ky(e.value):Ky(e)}function d3(e,t,r){function a(){return u3(e,r)}if(r&&e!=null)return r(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??a();if(Array.isArray(t)){const c=WV(t);if(e==null||typeof e!="object"){const u=c.find(f=>f.value===e);return u&&u.label!=null?u.label:a()}if("value"in e){const u=c.find(f=>f&&f.value===e.value);if(u&&u.label!=null)return u.label}}return a()}function ZV(e,t,r){return e.reduce((a,i,c)=>(c>0&&a.push(", "),a.push(n.jsx(x.Fragment,{children:d3(i,t,r)},c)),a),[])}const JV={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:r,itemToStringValue:a}=e;return t==null?!1:r&&Array.isArray(t)?t.length>0:iu(t,a)!==""},hasNullItemLabel:(e,t)=>t?QV(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const r=e.isItemEqualToValue,a=e.value;return e.multiple?Array.isArray(a)&&a.some(i=>ac(t,i,r)):ac(t,a,r)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Wd(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const zo=1;function F2(e,t){return Math.max(0,e-t)}function sg(e,t){if(t<=0)return 0;const r=Wd(e,0,t),a=r,i=t-r,c=a<=zo,u=i<=zo;return c&&u?a<=i?0:t:c?0:u?t:r}function e9(e){const{id:t,value:r,defaultValue:a=null,onValueChange:i,open:c,defaultOpen:u=!1,onOpenChange:f,name:h,form:m,autoComplete:p,disabled:g=!1,readOnly:b=!1,required:v=!1,modal:w=!0,actionsRef:C,inputRef:S,onOpenChangeComplete:N,items:E,multiple:k=!1,itemToStringLabel:A,itemToStringValue:M,isItemEqualToValue:R=i3,highlightItemOnHover:T=!0,children:O}=e,{clearErrors:D}=Bg(),{setDirty:B,setTouched:F,setFocused:K,validityData:$,setFilled:P,name:U,disabled:H,validation:W,validationMode:q}=Pu(),Z=Uf({id:t}),z=H||g,L=U??h,[X,ee]=po({controlled:r,default:k?a??Vr:a,name:"Select",state:"value"}),[_,V]=po({controlled:c,default:u,name:"Select",state:"open"}),G=x.useRef([]),Y=x.useRef([]),ne=x.useRef(null),te=x.useRef(null),ye=x.useRef(0),ae=x.useRef(null),ue=x.useRef([]),se=x.useRef(!1),Q=x.useRef(null),ie=x.useRef(null),oe=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=x.useRef(!1),xe=x.useRef(X),{mounted:je,setMounted:Ie,transitionStatus:ce}=ni(_),{openMethod:Te,triggerProps:re}=JM(_),fe=vs(()=>new _u({id:Z,labelId:void 0,modal:w,multiple:k,itemToStringLabel:A,itemToStringValue:M,isItemEqualToValue:R,value:X,open:_,mounted:je,transitionStatus:ce,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:En,triggerProps:En,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:$n,setOpen:$n,handleScrollArrowVisibility:$n,onOpenChangeComplete:$n,listRef:G,popupRef:ne,scrollHandlerRef:te,scrollArrowsMountedCountRef:ye,valueRef:ae,valuesRef:ue,labelsRef:Y,typingRef:se,selectionRef:oe,firstItemTextRef:Q,selectedItemTextRef:ie,alignItemWithTriggerActiveRef:pe,initialValueRef:xe},JV)).current,Re=fe.useState("activeIndex"),Oe=fe.useState("selectedIndex"),ke=fe.useState("triggerElement"),he=fe.useState("positionerElement"),Ae=HV(Te),ge=Te??Ae,Pe=x.useMemo(()=>k?"":iu(X,M),[k,X,M]),Fe=x.useMemo(()=>k&&Array.isArray(X)?X.map(lt=>iu(lt,M)):iu(X,M),[k,X,M]),_e=qn(ke),Xe=st(()=>Fe);$g(_e,Z,X,Xe,!z,h);const Je=k?Array.isArray(X)&&X.length>0:X!=null&&Pe!=="";We(()=>{P(Je)},[Je,P]),We(function(){const wt=l3(ue.current,X,R,k);wt===null&&(ie.current=null),!_&&fe.set("selectedIndex",wt)},[k,_,X,R,fe]),Ff(X,()=>{D(L),B(GV(X,$.initialValue,R)),W.change(X)});const ct=st((lt,wt)=>{f==null||f(lt,wt),!wt.isCanceled&&(V(lt),!lt&&(wt.reason===Ji||wt.reason===Vg)&&(F(!0),K(!1),q==="onBlur"&&W.commit(X)))}),At=st(()=>{Ie(!1),fe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),N==null||N(!1)});Sr({enabled:!C,open:_,ref:ne,onComplete(){_||At()}}),x.useImperativeHandle(C,()=>({unmount:At}),[At]);const rt=st((lt,wt)=>{i==null||i(lt,wt),!wt.isCanceled&&ee(lt)}),ve=st(lt=>{const wt=F2(lt.scrollHeight,lt.clientHeight),cn=sg(lt.scrollTop,wt),Gt=cn>0,fn=cn<wt;fe.set("scrollUpArrowVisible",Gt),fe.set("scrollDownArrowVisible",fn)}),Ue=rV({open:_,onOpenChange:ct,elements:{reference:ke,floating:he}}),Qe=k2(Ue,{enabled:!z,event:"mousedown"}),xt=Kf(Ue),Ke=qM(Ue,{enabled:!z,listRef:G,activeIndex:Re,selectedIndex:Oe,disabledIndices:Vr,onNavigate(lt){lt===null&&!_||fe.set("activeIndex",lt)},focusItemOnHover:T}),Be=YM(Ue,{enabled:!z&&(_||!b&&!k),listRef:Y,activeIndex:Re,selectedIndex:Oe,disabledIndices:lt=>n3(G.current[lt]),onMatch(lt){_?fe.set("activeIndex",lt):rt(ue.current[lt],yt(Ur))},onTyping(lt){se.current=lt}}),jt=x.useMemo(()=>Qs(Be.reference,Ke.reference,xt.reference,Qe.reference,re),[Qe.reference,Be.reference,Ke.reference,xt.reference,re]),Ze=x.useMemo(()=>Qs(Wf,Be.floating,Ke.floating,xt.floating),[Be.floating,Ke.floating,xt.floating]),Tt=Ke.item??En;fe.useContextCallback("setValue",rt),fe.useContextCallback("setOpen",ct),fe.useContextCallback("handleScrollArrowVisibility",ve),fe.useContextCallback("onOpenChangeComplete",N),UV(()=>{fe.update({popupProps:Ze,triggerProps:jt})}),fe.useSyncedValues({id:Z,modal:w,multiple:k,value:X,open:_,mounted:je,transitionStatus:ce,popupProps:Ze,triggerProps:jt,items:E,itemToStringLabel:A,itemToStringValue:M,isItemEqualToValue:R,openMethod:ge});const Se=x.useMemo(()=>({disabled:z,readOnly:b,required:v,multiple:k,highlightItemOnHover:T,itemProps:Tt}),[z,b,v,k,T,Tt]),Ye=mo(S,W.inputRef),et=k?void 0:L,it=x.useMemo(()=>!k||!Array.isArray(X)||!L?null:X.map(lt=>{const wt=iu(lt,M);return n.jsx("input",{type:"hidden",form:m,name:L,value:wt,disabled:z},wt)}),[k,X,m,L,M,z]);return n.jsxs(s3.Provider,{value:fe,children:[n.jsx(r3.Provider,{value:Se,children:n.jsx(o3.Provider,{value:Ue,children:O})}),n.jsx("input",{...W.getValidationProps(z,{onFocus(){var lt;(lt=fe.state.triggerElement)==null||lt.focus({focusVisible:!0})},onChange(lt){if(lt.nativeEvent.defaultPrevented||z||b)return;const wt=lt.currentTarget.value,cn=yt(Ur,lt.nativeEvent);function Gt(){if(k)return;const fn=wt.toLowerCase();let Bn=ue.current.findIndex(de=>iu(de,M).toLowerCase()===fn||u3(de,A).toLowerCase()===fn);Bn===-1&&(Bn=ue.current.findIndex((de,tt)=>{const Et=Y.current[tt];return Et!=null&&Et.toLowerCase()===fn}));const Kn=ue.current[Bn];Kn!=null&&rt(Kn,cn)}fe.set("forceMount",!0),queueMicrotask(Gt)}}),id:Z&&et==null?`${Z}-hidden-input`:void 0,form:m,name:et,autoComplete:p,value:Pe,disabled:z,required:v&&!(k&&Je),readOnly:b,ref:Ye,style:L?i2:_g,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),it]})}function t9(e,t){return e??t}const Hm=5;function f3(e,t){const r=n9(t);return e.clientX>=r.left-Hm&&e.clientX<=r.right+Hm&&e.clientY>=r.top-Hm&&e.clientY<=r.bottom+Hm}function n9(e){const t=e.getBoundingClientRect(),r=Rn(e);if(m2)return t;const a=r.getComputedStyle(e,"::before"),i=r.getComputedStyle(e,"::after");if(!(a.content!=="none"||i.content!=="none"))return t;const u=parseFloat(a.width)||0,f=parseFloat(a.height)||0,h=parseFloat(i.width)||0,m=parseFloat(i.height)||0,p=Math.max(t.width,u,h),g=Math.max(t.height,f,m),b=p-t.width,v=g-t.height;return{left:t.left-b/2,right:t.right+b/2,top:t.top-v/2,bottom:t.bottom+v/2}}const s9="data-popup-side",r9=400,o9={...Xp,...Lg,popupSide:e=>e?{[s9]:e}:null,value:()=>null},a9=x.forwardRef(function(t,r){var ye;const{render:a,className:i,id:c,disabled:u=!1,nativeButton:f=!0,style:h,...m}=t,{setTouched:p,setFocused:g,validationMode:b,validation:v,state:w,disabled:C}=Pu(),{labelId:S}=Vf(),N=ja(),{readOnly:E,required:k,disabled:A}=px(),M=C||A||u,R=N.useState("open"),T=N.useState("mounted"),O=N.useState("value"),D=N.useState("triggerProps"),B=N.useState("positionerElement"),F=N.useState("listElement"),K=N.useState("popupSide"),$=N.useState("id"),P=N.useState("labelId"),U=N.useState("hasSelectedValue"),H=T&&B?K:null,W=c??$,q=t9(S,P);Uf({id:c});const Z=qn(B),z=x.useRef(null),{getButtonProps:L,buttonRef:X}=bo({disabled:M,native:f}),ee=N.useStateSetter("triggerElement"),_=us(),V=us(),G=us();x.useEffect(()=>{if(R)return G.start(r9,()=>{N.context.selectionRef.current.allowUnselectedMouseUp=!0,N.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{G.clear()};N.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},V.clear()},[R,N,V,G]);const Y=Qs(D,{id:W,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?(F==null?void 0:F.id)??((ye=Qp(B))==null?void 0:ye.id):void 0,"aria-labelledby":q,"aria-readonly":E||void 0,"aria-required":k||void 0,tabIndex:M?-1:0,onFocus(ae){g(!0),R&&N.context.alignItemWithTriggerActiveRef.current&&N.context.setOpen(!1,yt(Ur,ae.nativeEvent)),_.start(0,()=>{N.set("forceMount",!0)})},onBlur(ae){gt(B,ae.relatedTarget)||(p(!0),g(!1),b==="onBlur"&&v.commit(O))},onMouseDown(ae){if(R)return;const ue=Ht(ae.currentTarget);function se(Q){if(!z.current)return;const ie=Q.target;gt(z.current,ie)||gt(Z.current,ie)||f3(Q,z.current)||N.context.setOpen(!1,yt(ZA,Q))}V.start(0,()=>{ue.addEventListener("mouseup",se,{once:!0})})}},m,L),ne=v.getValidationProps(M,Y);ne.role="combobox";const te={...w,open:R,disabled:M,value:O,readOnly:E,popupSide:H,placeholder:!U};return Ct("button",t,{ref:[r,z,X,ee],state:te,stateAttributesMapping:o9,props:ne})}),i9={value:()=>null},l9=x.forwardRef(function(t,r){const{className:a,render:i,children:c,placeholder:u,style:f,...h}=t,m=ja(),p=m.useState("value"),g=m.useState("items"),b=m.useState("itemToStringLabel"),v=m.useState("hasSelectedValue"),w=!v&&u!=null&&c==null,C=m.useState("hasNullItemLabel",w),S={value:p,placeholder:!v};let N=null;return typeof c=="function"?N=c(p):c!=null?N=c:w&&!C?N=u:Array.isArray(p)?N=ZV(p,g,b):N=d3(p,g,b),Ct("span",t,{state:S,ref:[r,m.context.valueRef],props:[{children:N},h],stateAttributesMapping:i9})}),c9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,m={open:ja().useState("open")};return Ct("span",t,{state:m,ref:r,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:u2})}),u9=x.forwardRef(function(t,r){const a=ja(),i=a.useState("mounted"),c=a.useState("forceMount");return i||c?n.jsx(Zg,{ref:r,...t}):null}),h3=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function d9(){return x.useContext(h3)}function eh(e){const{children:t,elementsRef:r,labelsRef:a,onMapChange:i}=e,c=st(i),[,u]=x.useState(!1),f=vs(h9).current,h=vs(f9).current,m=x.useRef(0),p=x.useRef(!0),g=x.useRef(null),b=x.useRef(null),v=st(()=>{p.current||(p.current=!0,u(M=>!M))}),w=st((M,R)=>{h.set(M,R),v()}),C=st(M=>{h.delete(M),v()}),S=st(M=>{const R=new Map;return r.current.length=0,a&&(a.current.length=0),M.forEach(T=>{var O,D;R.set(T.element,{...T.registration.metadata??{},index:T.index}),r.current[T.index]=T.element,a&&(a.current[T.index]=T.registration.label!==void 0?T.registration.label:((D=(O=T.registration.textRef)==null?void 0:O.current)==null?void 0:D.textContent)??T.element.textContent)}),m.current=r.current.length,R});function N(M){var O;if((O=b.current)==null||O.disconnect(),b.current=null,typeof MutationObserver!="function"||M.length<2)return;const R=new MutationObserver(D=>{if(!g9(D))return;let B=null;for(const F of M)if(F.isConnected){if(B&&m3(B,F)>0){R.disconnect(),v();return}B=F}});b.current=R;const T=new Set;for(let D=1;D<M.length;D+=1){const B=p9(M[D-1],M[D]);B&&T.add(B)}T.forEach(D=>R.observe(D,{childList:!0}))}const E=st(()=>{const[M,R]=m9(h),T=S(M),O=g.current,D=!O||O.length!==M.length||M.some((B,F)=>{const K=O[F];return B.index!==K.index||B.element!==K.element||B.registration.index!==K.registration.index||B.registration.metadata!==K.registration.metadata});N(R),g.current=M,p.current=!1,D&&(f.forEach(B=>B(T)),c(T))});We(()=>(!p.current&&g.current&&S(g.current),()=>{r.current=[],a&&(a.current=[])}),[r,a,S]),We(()=>{p.current&&E()}),We(()=>()=>{var M;(M=b.current)==null||M.disconnect(),p.current=!0},[]);const k=st(M=>(f.add(M),()=>{f.delete(M)})),A=x.useMemo(()=>({register:w,unregister:C,subscribeMapChange:k,nextIndexRef:m}),[w,C,k,m]);return n.jsx(h3.Provider,{value:A,children:t})}function f9(){return new Map}function h9(){return new Set}function m9(e){const t=new Set,r=[],a=[];e.forEach((c,u)=>{if(!u.isConnected)return;const f=c.index,h={index:f??-1,element:u,registration:c};f===null?a.push(h):f>=0&&(t.add(f),r.push(h))});let i=0;return a.sort((c,u)=>m3(c.element,u.element)),a.forEach(c=>{for(;t.has(i);)i+=1;c.index=i,r.push(c),i+=1}),t.size>0&&r.sort((c,u)=>c.index-u.index),[r,a.map(c=>c.element)]}function p9(e,t){let r=e.parentElement;for(;r&&!r.contains(t);)r=r.parentElement;return r}function g9(e){for(const t of e)for(let r=0;r<t.removedNodes.length;r+=1)if(t.removedNodes[r].isConnected)return!0;return!1}function m3(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const x9=x.createContext(void 0);function gx(){const e=x.useContext(x9);return(e==null?void 0:e.direction)??"ltr"}const b9=e=>({name:"arrow",options:e,async fn(t){var Z,z;const{x:r,y:a,placement:i,rects:c,platform:u,elements:f,middlewareData:h}=t,{element:m,padding:p=0,offsetParent:g="real"}=tl(e,t)||{};if(m==null)return{};const b=iM(p),v={x:r,y:a},w=v2(i),C=b2(w),S=await u.getDimensions(m),N=w==="y",E=N?"top":"left",k=N?"bottom":"right",A=N?"clientHeight":"clientWidth",M=c.reference[C]+c.reference[w]-v[w]-c.floating[C],R=v[w]-c.reference[w],T=g==="real"?await((Z=u.getOffsetParent)==null?void 0:Z.call(u,m)):f.floating;let O=f.floating[A]||c.floating[C];(!O||!await((z=u.isElement)==null?void 0:z.call(u,T)))&&(O=f.floating[A]||c.floating[C]);const D=M/2-R/2,B=O/2-S[C]/2-1,F=Math.min(b[E],B),K=Math.min(b[k],B),$=F,P=O-S[C]-K,U=O/2-S[C]/2+D,H=aM($,U,P),W=!h.arrow&&Wa(i)!=null&&U!==H&&c.reference[C]/2-(U<$?F:K)-S[C]/2<0,q=W?U<$?U-$:U-P:0;return{[w]:v[w]+q,data:{[w]:H,centerOffset:U-H-q,...W&&{alignmentOffset:q}},reset:W}}}),v9=(e,t)=>{const{name:r,fn:a}=b9(e);return{name:r,fn:a,options:[e,t]}},y9={name:"hide",async fn(e){const{width:t,height:r,x:a,y:i}=e.rects.reference,c=t===0&&r===0&&a===0&&i===0,u=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:u.top-r>=0||u.right-t>=0||u.bottom-r>=0||u.left-t>=0||c}}}},w9={sideX:"left",sideY:"top"},j9="--available-width",S9="--available-height",N9="--anchor-width",C9="--anchor-height",k9="--transform-origin",E5=j9,R5=S9;function p3(e,t,r){const a=e==="inline-start"||e==="inline-end";return{top:"top",right:a?r?"inline-start":"inline-end":"right",bottom:"bottom",left:a?r?"inline-end":"inline-start":"left"}[t]}function A5(e,t,r){const{rects:a,placement:i}=e;return{side:p3(t,uo(i),r),align:Wa(i)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function xx(e){return T9(e,oV)}function T9(e,t){var xt,Ke;const{anchor:r,positionMethod:a="absolute",side:i="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,collisionBoundary:h,collisionPadding:m=5,sticky:p=!1,arrowPadding:g=5,disableAnchorTracking:b=!1,inline:v,keepMounted:w=!1,floatingRootContext:C,mounted:S,collisionAvoidance:N,shift:E,nodeId:k,adaptiveOrigin:A,lazyFlip:M=!1,externalTree:R}=e,[T,O]=x.useState(null);!S&&T!==null&&O(null);const D=N.side||"flip",B=N.align||"flip",F=N.fallbackAxisSide||"end",K=(E==null?void 0:E.crossAxis)??!1,$=E==null?void 0:E.rootBoundary,P=typeof r=="function"?r:void 0,U=st(P),H=P?U:r,W=qn(r),q=qn(S),z=gx()==="rtl",L=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":z?"left":"right","inline-start":z?"right":"left"}[i],X=u==="center"?L:`${L}-${u}`;let ee=m;typeof ee=="number"?ee={top:ee,right:ee,bottom:ee,left:ee}:ee&&(ee={top:ee.top||0,right:ee.right||0,bottom:ee.bottom||0,left:ee.left||0});const _=1,V=i==="bottom"?_:0,G=i==="top"?_:0,Y=i==="right"?_:0,ne=i==="left"?_:0,te={boundary:h==="clipping-ancestors"?"clippingAncestors":h,padding:ee},ye=x.useRef(null),ae=qn(c),ue=qn(f),se=typeof c!="function"?c:0,Q=typeof f!="function"?f:0,ie=[];v&&ie.push(v),ie.push(PB(Be=>{const jt=A5(Be,i,z),Ze=typeof ae.current=="function"?ae.current(jt):ae.current,Tt=typeof ue.current=="function"?ue.current(jt):ue.current;return{mainAxis:Ze,crossAxis:Tt,alignmentAxis:Tt}},[se,Q,z,i]));const oe=B==="none"&&D!=="shift",pe=!oe&&(p||K||D==="shift"),xe=D==="none"?null:$B({...te,padding:{top:ee.top+_+V,right:ee.right+_+ne,bottom:ee.bottom+_+G,left:ee.left+_+Y},mainAxis:!K&&D==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),je=oe?null:_B({...te,rootBoundary:$,mainAxis:B!=="none",crossAxis:pe,limiter:p||K?void 0:LB(Be=>{if(!ye.current)return{};const{width:jt,height:Ze}=ye.current.getBoundingClientRect(),Tt=co(uo(Be.placement)),Se=Tt==="y"?jt:Ze,Ye=Tt==="y"?ee.left+ee.right:ee.top+ee.bottom;return{offset:Se/2+Ye/2}})},[te,p,K,$,ee,B]);D==="shift"||B==="shift"||u==="center"?ie.push(je,xe):ie.push(xe,je),ie.push(BB({...te,apply({elements:{floating:Be},availableWidth:jt,availableHeight:Ze,rects:Tt}){if(!q.current)return;const Se=Be.style;Se.setProperty(E5,`${jt}px`),Se.setProperty(R5,`${Ze}px`);const Ye=Rn(Be).devicePixelRatio||1,{x:et,y:it,width:lt,height:wt}=Tt.reference,cn=(Math.round((et+lt)*Ye)-Math.round(et*Ye))/Ye,Gt=(Math.round((it+wt)*Ye)-Math.round(it*Ye))/Ye;Se.setProperty(N9,`${cn}px`),Se.setProperty(C9,`${Gt}px`)}}),v9(Be=>({element:ye.current||Ht(Be.elements.floating).createElement("div"),padding:ye.current?g:0,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(Be){var Kn,de,tt,Et,on,xn;const{elements:{floating:jt},middlewareData:Ze,placement:Tt,platform:Se,rects:Ye,y:et}=Be,it=uo(Tt),lt=Wa(Tt),wt=co(it)==="y",cn=ye.current,Gt=typeof c=="function"?c(A5(Be,i,z)):c;let fn;if(!cn&<&&Math.abs(wt?((Kn=Ze.shift)==null?void 0:Kn.x)||0:((de=Ze.shift)==null?void 0:de.y)||0)<=1)fn=lt==="start"===(wt&&((tt=Se.isRTL)==null?void 0:tt.call(Se,jt))===!0)?"100%":"0%";else{const Wt=wt?((Et=Ze.arrow)==null?void 0:Et.x)||0:((on=Ze.arrow)==null?void 0:on.y)||0,un=wt?(cn==null?void 0:cn.clientWidth)||0:(cn==null?void 0:cn.clientHeight)||0;fn=`${Wt+un/2}px`}let Bn=it==="top"||it==="left"?`calc(100% + ${Gt}px)`:`${-Gt}px`;return pe&&wt&&Math.abs(((xn=Ze.shift)==null?void 0:xn.y)||0)>Gt&&(Bn=`${Ye.reference.y+Ye.reference.height/2-et}px`),jt.style.setProperty(k9,wt?`${fn} ${Bn}`:`${Bn} ${fn}`),{}}},y9,A),We(()=>{!S&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[S,C]);const Ie=x.useMemo(()=>({ancestorScroll:!b,elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:ce,elements:Te,x:re,y:fe,middlewareData:Re,update:Oe,placement:ke,context:he,isPositioned:Ae,floatingStyles:ge}=t({rootContext:C,open:w?S:void 0,placement:X,middleware:ie,strategy:a,whileElementsMounted:w?void 0:(...Be)=>u5(...Be,Ie),nodeId:k,externalTree:R}),{sideX:Pe,sideY:Fe}=Re.adaptiveOrigin||w9,_e=Ae?a:"fixed",Xe=x.useMemo(()=>{let Be;return Ae?A?Be={position:_e,[Pe]:re,[Fe]:fe}:Be={...ge,position:_e}:Be={position:_e,top:0,left:0},Be[E5]="100vw",Be[R5]="100vh",Ae||(Be.opacity=0),Be},[A,_e,Pe,re,Fe,fe,ge,Ae]),Je=x.useRef(null);We(()=>{if(!S)return;const Be=W.current,jt=typeof Be=="function"?Be():Be,Tt=(M5(jt)?jt.current:jt)||null||null;Tt!==Je.current&&(ce.setPositionReference(Tt),Je.current=Tt)},[S,ce,H,W]),x.useEffect(()=>{if(!S)return;const Be=W.current;typeof Be!="function"&&M5(Be)&&Be.current!==Je.current&&(ce.setPositionReference(Be.current),Je.current=Be.current)},[S,ce,H,W]),x.useEffect(()=>{if(w&&S&&Te.reference&&Te.floating)return u5(Te.reference,Te.floating,Oe,Ie)},[w,S,Te,Oe,Ie]);const ct=uo(ke),At=p3(i,ct,z),rt=Wa(ke)||"center",ve=!!((xt=Re.hide)!=null&&xt.referenceHidden);We(()=>{M&&S&&Ae&&ct!==L&&O(ct)},[M,S,Ae,ct,L]);const Ue=x.useMemo(()=>{var Be,jt;return{position:"absolute",top:(Be=Re.arrow)==null?void 0:Be.y,left:(jt=Re.arrow)==null?void 0:jt.x}},[Re.arrow]),Qe=((Ke=Re.arrow)==null?void 0:Ke.centerOffset)!==0;return x.useMemo(()=>({positionerStyles:Xe,arrowStyles:Ue,arrowRef:ye,arrowUncentered:Qe,side:At,align:rt,physicalSide:ct,anchorHidden:ve,refs:ce,context:he,isPositioned:Ae,update:Oe}),[Xe,Ue,ye,Qe,At,rt,ct,ve,ce,he,Ae,Oe])}function M5(e){return e!=null&&"current"in e}const g3=x.createContext(void 0);function G2(){const e=x.useContext(g3);if(!e)throw new Error(rn(59));return e}function rg(e,t){e&&Object.assign(e.style,t)}const x3={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function th(e){return e==="starting"?K$:En}function bx(e,t,{styles:r,transitionStatus:a,props:i,refs:c,hidden:u,inert:f=!1}){const h={...r};return f&&(h.pointerEvents="none"),Ct("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:h},th(a),i],stateAttributesMapping:qf})}const E9=20;function q2(e,t,r,a){const[i,c]=x.useState(!1);We(()=>{if(!e||!t||r==null){c(!1);return}const u=Ht(r).documentElement.clientWidth,f=r.offsetWidth;c(u>0&&f>0&&f>=u-E9)},[e,t,r]),XM(e&&(!t||i),a)}const R9={position:"fixed"},A9=x.forwardRef(function(t,r){const{anchor:a,className:i,render:c,positionMethod:u,side:f,align:h,sideOffset:m,alignOffset:p,collisionBoundary:g="clipping-ancestors",collisionPadding:b,arrowPadding:v,sticky:w,disableAnchorTracking:C,alignItemWithTrigger:S=!0,collisionAvoidance:N=wM,style:E,...k}=t,A=ja(),M=a3(),R=A.useState("open"),T=A.useState("mounted"),O=A.useState("modal"),D=A.useState("value"),B=A.useState("openMethod"),F=A.useState("positionerElement"),K=A.useState("triggerElement"),$=A.useState("isItemEqualToValue"),P=A.useState("transitionStatus"),U=x.useRef(null),H=x.useRef(null),[W,q]=x.useState(S),Z=T&&W&&B!=="touch";!T&&W!==S&&q(S),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>Z),q2((Z||O)&&R,B==="touch",F,K);const z=xx({anchor:a,floatingRootContext:M,positionMethod:u,mounted:T,side:f,sideOffset:m,align:h,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:b,sticky:w,disableAnchorTracking:C??Z,collisionAvoidance:N,keepMounted:!0}),L=Z?"none":z.side,X=Z?R9:z.positionerStyles,ee={open:R,side:L,align:z.align,anchorHidden:z.anchorHidden};We(()=>{A.set("popupSide",z.side)},[A,z.side]);const _=A.useStateSetter("positionerElement"),V=bx(t,ee,{styles:X,transitionStatus:P,props:k,refs:[r,_],hidden:!T,inert:!R}),G=x.useRef(0),Y=st(te=>{if(A.context.valuesRef.current.length===0)return;const ye=G.current;G.current=te.size;const ae=yt(Ur);if(ye!==0&&!A.state.multiple&&D!==null&&wp(A.context.valuesRef.current,D,$)===-1){const se=A.context.initialValueRef.current,ie=se!=null&&wp(A.context.valuesRef.current,se,$)!==-1?se:null;A.context.setValue(ie,ae),ie===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ye!==0&&A.state.multiple&&Array.isArray(D)){const ue=D.filter(se=>wp(A.context.valuesRef.current,se,$)!==-1);ue.length!==D.length&&(A.context.setValue(ue,ae),ue.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(R&&Z){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ue={height:""};rg(F,ue),rg(A.context.popupRef.current,ue)}}),ne=x.useMemo(()=>({...z,side:L,alignItemWithTriggerActive:Z,setControlledAlignItemWithTrigger:q,scrollUpArrowRef:U,scrollDownArrowRef:H}),[z,L,Z,q]);return n.jsx(eh,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:Y,children:n.jsxs(g3.Provider,{value:ne,children:[T&&O&&n.jsx(cx,{inert:Jf(!R),cutout:K}),V]})})}),Fm="base-ui-disable-scrollbar",Xy={className:Fm,getElement(e){return n.jsx("style",{nonce:e,href:Fm,precedence:"base-ui:low",children:`.${Fm}{scrollbar-width:none}.${Fm}::-webkit-scrollbar{display:none}`})}},M9=x.createContext(void 0);function vx(e){return x.useContext(M9)}const O9=x.createContext(void 0),D9={disableStyleElements:!1};function z9(){return x.useContext(O9)??D9}const O5="--transform-origin",I9={...qf,...si},P9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,...f}=t,h=ja(),{multiple:m,readOnly:p,highlightItemOnHover:g}=px(),b=a3(),{side:v,align:w,alignItemWithTriggerActive:C,isPositioned:S,setControlledAlignItemWithTrigger:N}=G2(),E=vx()!=null,k=gx(),{nonce:A,disableStyleElements:M}=z9(),R=h.useState("id"),T=h.useState("open"),O=h.useState("openMethod"),D=h.useState("mounted"),B=h.useState("popupProps"),F=h.useState("transitionStatus"),K=h.useState("triggerElement"),$=h.useState("positionerElement"),P=h.useState("listElement"),U=x.useRef(!1),H=x.useRef(!1),W=x.useRef({}),q=Eu(),Z=st(ee=>{if(!$||!h.context.popupRef.current||!H.current)return;const _=$.style.top==="0px",V=$.style.bottom==="0px";if(U.current||!C||!_&&!V){h.context.handleScrollArrowVisibility(ee);return}const G=z5($),Y=Qd($.getBoundingClientRect().height,"y",G),ne=Ht($),te=Rn($),ye=te.getComputedStyle($),ae=parseFloat(ye.marginTop),ue=parseFloat(ye.marginBottom),se=D5(te.getComputedStyle(h.context.popupRef.current)),Q=Math.min(ne.documentElement.clientHeight-ae-ue,se),ie=ee.scrollTop,oe=Gm(ee);let pe=null;const xe=Te=>{$.style.height=`${Te}px`},je=_?oe-ie:ie,Ie=Math.min(Y+je,Q);if(je<=zo){const Te=Wd(je,0,Q-Y);Te>0&&xe(Y+Te),ee.scrollTop=_?oe:0,Q-(Y+Te)<=zo&&(U.current=!0),h.context.handleScrollArrowVisibility(ee);return}if(Q-Ie>zo)pe=_?1/0:0;else if(V&&ie<oe){const Te=Y+je-Q;pe=ie-(je-Te)}const ce=Math.ceil(Ie);if(ce!==0&&xe(ce),pe!=null){const Te=Wd(pe,0,Gm(ee));Math.abs(ee.scrollTop-Te)>zo&&(ee.scrollTop=Te)}ce>=Q-zo&&(U.current=!0),h.context.handleScrollArrowVisibility(ee)});x.useImperativeHandle(h.context.scrollHandlerRef,()=>Z,[Z]),Sr({open:T,ref:h.context.popupRef,onComplete(){T&&h.context.onOpenChangeComplete(!0)}});const z={open:T,transitionStatus:F,side:v,align:w};We(()=>{!$||!h.context.popupRef.current||Object.keys(W.current).length||(W.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[h,$]),We(()=>{T||C||(H.current=!1,U.current=!1,rg($,W.current))},[T,C,$]),We(()=>{var V,G;const ee=h.context.popupRef.current;if(!T||!K||!$||!ee||C&&!S||h.state.transitionStatus==="ending")return;if(H.current=!0,ee.style.removeProperty(O5),!C){q.request(()=>h.context.handleScrollArrowVisibility(P||ee));return}const _=_9(ee);try{let Y=h.context.selectedItemTextRef.current;Y!=null&&Y.isConnected||(Y=!h.select("hasSelectedValue")&&((V=h.context.firstItemTextRef.current)!=null&&V.isConnected)?h.context.firstItemTextRef.current:null);const ne=h.context.valueRef.current,te=Rn($),ye=te.getComputedStyle($),ae=te.getComputedStyle(ee),ue=Ht(K),se=z5(K),Q=qm(K.getBoundingClientRect(),se),ie=qm($.getBoundingClientRect(),se),oe=Q.height,pe=P||ee,xe=pe.scrollHeight,je=parseFloat(ae.borderBottomWidth),Ie=parseFloat(ye.marginTop)||10,ce=parseFloat(ye.marginBottom)||10,Te=parseFloat(ye.minHeight)||100,re=D5(ae),fe=5,Re=5,Oe=20,ke=ue.documentElement.clientHeight-Ie-ce,he=ue.documentElement.clientWidth,Ae=ke-Q.bottom+oe;let ge,Pe=k==="rtl"?Q.right-ie.width:Q.left,Fe=0;if(Y&&ne){const Ke=qm(ne.getBoundingClientRect(),se);ge=qm(Y.getBoundingClientRect(),se),Pe=ie.left+(k==="rtl"?Ke.right-ge.right:Ke.left-ge.left);const Be=Ke.top-Q.top+Ke.height/2;Fe=ge.top-ie.top+ge.height/2-Be}const _e=Ae+Fe+ce+je;let Xe=Math.min(ke,_e);const Je=ke-Ie-ce,ct=_e-Xe,At=he-Re;$.style.left=`${Wd(Pe,fe,At-ie.width)}px`,$.style.height=`${Xe}px`,$.style.maxHeight="none",$.style.marginTop=`${Ie}px`,$.style.marginBottom=`${ce}px`,ee.style.height="100%";const rt=Gm(pe),ve=ct>=rt-zo;ve&&(Xe=Math.min(ke,ie.height)-(ct-rt));const Ue=Q.top<Oe||Q.bottom>ke-Oe||Math.ceil(Xe)+zo<Math.min(xe,Te),Qe=(((G=te.visualViewport)==null?void 0:G.scale)??1)!==1&&ri;if(Ue||Qe){rg($,W.current),N(!1);return}const xt=Math.max(Te,Xe);if(ve){const Ke=Math.max(0,ke-_e);$.style.top=ie.height>=Je?"0":`${Ke}px`,$.style.height=`${Xe}px`,pe.scrollTop=Gm(pe)}else $.style.bottom="0",pe.scrollTop=ct;if(ge){const Ke=ie.top,Be=ie.height,jt=ge.top+ge.height/2,Ze=Wd(Be>0?(jt-Ke)/Be*100:50,0,100);ee.style.setProperty(O5,`50% ${Ze}%`)}(xt===ke||Xe>=re)&&(U.current=!0),h.context.handleScrollArrowVisibility(pe),g&&h.state.selectedIndex===null&&h.state.activeIndex===null&&h.context.listRef.current[0]!=null&&h.set("activeIndex",0)}finally{_()}},[h,T,$,K,C,N,q,P,g,k,S]),x.useEffect(()=>{if(!C||!$||!T)return;const ee=Rn($);function _(V){h.context.setOpen(!1,yt(q7,V))}return $t(ee,"resize",_)},[h,C,$,T]);const L={...P?{role:"presentation"}:{role:"listbox","aria-multiselectable":m||void 0,"aria-readonly":p||void 0,id:`${R}-list`},onKeyDown(ee){E&&Zf.has(ee.key)&&ee.stopPropagation()},onScroll(ee){P||Z(ee.currentTarget)},...C&&{style:P?{height:"100%"}:x3},className:!P&&C?Xy.className:void 0},X=Ct("div",t,{ref:[r,h.context.popupRef],state:z,stateAttributesMapping:I9,props:[B,L,th(F),f]});return n.jsxs(x.Fragment,{children:[!M&&Xy.getElement(A),n.jsx(Jg,{context:b,modal:!1,disabled:!D,openInteractionType:O,returnFocus:u,restoreFocus:!0,children:X})]})});function D5(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Gm(e){return F2(e.scrollHeight,e.clientHeight)}function z5(e){return IM.getScale(e)}function Qd(e,t,r){return e/r[t]}function qm(e,t){return vf({x:Qd(e.x,"x",t),y:Qd(e.y,"y",t),width:Qd(e.width,"x",t),height:Qd(e.height,"y",t)})}const I5=[["transform","none"],["scale","1"],["translate","0 0"]];function _9(e){const{style:t}=e,r={};for(const[a,i]of I5)r[a]=t.getPropertyValue(a),t.setProperty(a,i,"important");return()=>{for(const[a]of I5){const i=r[a];i?t.setProperty(a,i):t.removeProperty(a)}}}const L9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=ja(),{multiple:h,readOnly:m}=px(),{alignItemWithTriggerActive:p}=G2(),g=f.useState("hasScrollArrows"),b=f.useState("openMethod"),w={id:`${f.useState("id")}-list`,role:"listbox","aria-multiselectable":h||void 0,"aria-readonly":m||void 0,onScroll(S){var N,E;(E=(N=f.context.scrollHandlerRef).current)==null||E.call(N,S.currentTarget)},...p&&{style:x3},className:g&&b!=="touch"?Xy.className:void 0},C=f.useStateSetter("listElement");return Ct("div",t,{ref:[r,C],props:[w,u]})});function pc(e={}){const{guess:t,label:r,metadata:a,textRef:i,index:c}=e,{register:u,unregister:f,subscribeMapChange:h,nextIndexRef:m}=d9(),p=x.useRef(-1),[g,b]=x.useState(c==null&&t?()=>{if(p.current===-1){const S=m.current;m.current+=1,p.current=S}return p.current}:-1),v=c??g,w=x.useRef(null),C=x.useCallback(S=>{const N=w.current;N&&f(N),w.current=S,S&&u(S,{metadata:a??null,index:c??null,label:r,textRef:i})},[c,u,f,a,r,i]);return We(()=>{if(c==null)return h(S=>{var E;const N=w.current?(E=S.get(w.current))==null?void 0:E.index:null;N!=null&&b(N)})},[c,h]),{ref:C,index:v}}const b3=x.createContext(void 0);function Y2(){const e=x.useContext(b3);if(!e)throw new Error(rn(57));return e}const $9=x.memo(x.forwardRef(function(t,r){const{render:a,className:i,style:c,value:u=null,label:f,disabled:h=!1,nativeButton:m=!1,...p}=t,g=x.useRef(null),b=pc({guess:!0,label:f,textRef:g}),v=ja(),{itemProps:w,multiple:C,disabled:S,readOnly:N}=px(),E=S||h,k=v.useState("isActive",b.index),A=v.useState("open"),M=v.useState("isSelected",u),R=v.useState("isSelectedByFocus",b.index),T=v.useState("isItemEqualToValue"),O=b.index,D=x.useRef(null);We(()=>{const z=v.context.valuesRef.current;return z[O]=u,()=>{delete z[O]}},[O,u,v]),We(()=>{const z=v.state.value,L=v.state.selectedIndex;let X=L,ee;C&&Array.isArray(z)?(X=YV(O,u,v.context.valuesRef.current,z,T,L),ee=X===O,O===L&&!ee&&(v.context.selectedItemTextRef.current=null)):(ee=z!==void 0&&ac(u,z,T),ee&&(X=O)),v.set("selectedIndex",X),ee&&g.current&&(v.context.selectedItemTextRef.current=g.current)},[O,C,T,v,u]);const B=x.useRef("mouse"),F=x.useRef(!1),{getButtonProps:K,buttonRef:$}=bo({disabled:E,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:E,selected:M,highlighted:k};function U(z){if(S||N)return;const L=v.state.value;if(C){const X=Array.isArray(L)?L:[],ee=M?KV(X,u,T):[...X,u];v.context.setValue(ee,yt(Zl,z))}else v.context.setValue(u,yt(Zl,z)),v.context.setOpen(!1,yt(Zl,z))}function H(){v.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":M,tabIndex:A&&k?0:-1,onKeyDown(z){v.set("activeIndex",O),z.key===" "&&v.context.typingRef.current&&z.preventDefault()},onClick(z){const L=B.current!=="touch",X=z.nativeEvent.pointerType,ee=L&&Yg(z.nativeEvent)&&(X!==void 0||k),_=L&&!ee&&!F.current;F.current=!1,!(E||_)&&U(z.nativeEvent)},onPointerEnter(z){B.current=z.pointerType},onPointerMove(z){if(z.pointerType==="mouse"&&z.buttons===1){const L=v.context.selectionRef.current;L.dragY+=z.movementY,L.dragY**2>=64&&(L.allowUnselectedMouseUp=!0)}},onPointerDown(z){B.current=z.pointerType,F.current=!0,H()},onMouseUp(){var X;if(H(),E||B.current==="touch"||F.current)return;const z=!v.context.selectionRef.current.allowSelectedMouseUp&&M,L=!v.context.selectionRef.current.allowUnselectedMouseUp&&!M;z||L||(F.current=!0,(X=D.current)==null||X.click(),F.current=!1)}},q=Ct("div",t,{ref:[$,r,b.ref,D],state:P,props:[w,W,p,K]}),Z=x.useMemo(()=>({selected:M,index:O,textRef:g,selectedByFocus:R}),[M,O,g,R]);return n.jsx(b3.Provider,{value:Z,children:q})})),B9=x.forwardRef(function(t,r){const{selected:a}=Y2();return t.keepMounted||a?n.jsx(V9,{...t,ref:r}):null}),V9=x.memo(x.forwardRef((e,t)=>{const{render:r,className:a,style:i,keepMounted:c,...u}=e,{selected:f}=Y2(),h=x.useRef(null),{transitionStatus:m,setMounted:p}=ni(f),b=Ct("span",e,{ref:[t,h],state:{selected:f,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:si});return Sr({batch:!0,enabled:!f,open:f,ref:h,onComplete(){f||p(!1)}}),b})),U9=x.memo(x.forwardRef(function(t,r){const{index:a,textRef:i,selectedByFocus:c}=Y2(),u=ja(),{render:f,className:h,style:m,...p}=t,g=x.useCallback(v=>{v&&(a===0&&(u.context.firstItemTextRef.current=v),c&&(u.context.selectedItemTextRef.current=v))},[u,a,c]);return Ct("div",t,{ref:[g,r,i],props:p})})),v3=x.forwardRef(function(t,r){const{render:a,className:i,style:c,direction:u,keepMounted:f,...h}=t,m=u==="up",p=ja(),{side:g,scrollDownArrowRef:b,scrollUpArrowRef:v}=G2(),w=m?"scrollUpArrowVisible":"scrollDownArrowVisible",C=p.useState(w),S=p.useState("openMethod"),N=C&&S!=="touch",E=us(),k=m?v:b,{mounted:A,transitionStatus:M,setMounted:R}=ni(N);We(()=>(p.context.scrollArrowsMountedCountRef.current+=1,p.set("hasScrollArrows",!0),()=>{p.context.scrollArrowsMountedCountRef.current=Math.max(0,p.context.scrollArrowsMountedCountRef.current-1),p.context.scrollArrowsMountedCountRef.current===0&&p.set("hasScrollArrows",!1)}),[p]),Sr({open:N,ref:k,onComplete(){N||R(!1)}});const D=Ct("div",t,{ref:[r,k],state:{direction:u,visible:N,side:g,transitionStatus:M},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(F){if(F.movementX===0&&F.movementY===0||E.isStarted())return;p.set("activeIndex",null);function K(){var q;const $=p.state.listElement??p.context.popupRef.current;if(!$)return;p.set("activeIndex",null),p.context.handleScrollArrowVisibility($);const P=F2($.scrollHeight,$.clientHeight),U=sg($.scrollTop,P),H=U===(m?0:P),W=p.context.listRef.current;if(U!==$.scrollTop&&($.scrollTop=U),H){E.clear();return}if(W.length>0){const Z=((q=k.current)==null?void 0:q.offsetHeight)||0;$.scrollTop=H9(W,m,U,$.clientHeight,Z,P)}E.start(40,K)}E.start(40,K)},onMouseLeave(){E.clear()}},h],stateAttributesMapping:si});return A||f?D:null});function H9(e,t,r,a,i,c){if(t){let p=0;const g=r+i-zo;for(let w=0;w<e.length;w+=1){const C=e[w];if(C&&C.offsetTop>=g){p=w;break}}const b=Math.max(0,p-1),v=e[b];return b<p&&v?sg(v.offsetTop-i,c):0}let u=e.length-1;const f=r+a-i+zo;for(let p=0;p<e.length;p+=1){const g=e[p];if(g&&g.offsetTop+g.offsetHeight>f){u=Math.max(0,p-1);break}}const h=Math.min(e.length-1,u+1),m=e[h];return h>u&&m?sg(m.offsetTop+m.offsetHeight-a+i,c):c}const F9=x.forwardRef(function(t,r){return n.jsx(v3,{...t,ref:r,direction:"down"})}),G9=x.forwardRef(function(t,r){return n.jsx(v3,{...t,ref:r,direction:"up"})}),q9=x.createContext(void 0),Y9=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,[f,h]=x.useState(),m=x.useMemo(()=>({labelId:f,setLabelId:h}),[f,h]),p=Ct("div",t,{ref:r,props:[{role:"group","aria-labelledby":f},u]});return n.jsx(q9.Provider,{value:m,children:p})}),jp=e9;function P5({className:e,...t}){return n.jsx(Y9,{"data-slot":"select-group",className:Ve("scroll-my-1 p-1",e),...t})}function Sp({className:e,...t}){return n.jsx(l9,{"data-slot":"select-value",className:Ve("flex flex-1 text-left",e),...t})}function Np({className:e,size:t="default",children:r,...a}){return n.jsxs(a9,{"data-slot":"select-trigger","data-size":t,className:Ve("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[r,n.jsx(c9,{render:n.jsx(ha,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Cp({className:e,children:t,side:r="bottom",sideOffset:a=4,align:i="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...f}){return n.jsx(u9,{children:n.jsx(A9,{side:r,sideOffset:a,align:i,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:n.jsxs(P9,{"data-slot":"select-content","data-align-trigger":u,className:Ve("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[n.jsx(K9,{}),n.jsx(L9,{children:t}),n.jsx(X9,{})]})})})}function Zd({className:e,children:t,...r}){return n.jsxs($9,{"data-slot":"select-item",className:Ve("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[n.jsx(U9,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(B9,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Yn,{className:"pointer-events-none"})})]})}function K9({className:e,...t}){return n.jsx(G9,{"data-slot":"select-scroll-up-button",className:Ve("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(OA,{})})}function X9({className:e,...t}){return n.jsx(F9,{"data-slot":"select-scroll-down-button",className:Ve("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(ha,{})})}function pn({children:e,value:t,onChange:r,className:a,disabled:i,...c}){const u=h=>x.Children.toArray(h).join(""),f=x.Children.toArray(e).map(h=>({value:h.props.value??u(h.props.children),label:u(h.props.children),disabled:h.props.disabled}));return n.jsxs(jp,{items:f,value:t,disabled:i,onValueChange:h=>r==null?void 0:r({target:{value:h}}),children:[n.jsx(Np,{className:a,...c,children:n.jsx(Sp,{})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:f.map(h=>n.jsx(Zd,{className:"text-xs",value:h.value,disabled:h.disabled,children:h.label},h.value))})]})}const y3=x.createContext(void 0);function K2(){const e=x.useContext(y3);if(e===void 0)throw new Error(rn(64));return e}const W9="data-activation-direction",yx={tabActivationDirection:e=>({[W9]:e})},Q9=x.forwardRef(function(t,r){const{className:a,defaultValue:i=0,onValueChange:c,orientation:u="horizontal",render:f,value:h,style:m,...p}=t,g=t.defaultValue!==void 0,b=x.useRef([]),[v,w]=x.useState(()=>new Map),[C,S]=po({controlled:h,default:i,name:"Tabs",state:"value"}),N=h!==void 0,[E,k]=x.useState(()=>new Map),A=x.useRef(void 0),M=x.useCallback(ne=>Wy(E,ne),[E]),[R,T]=x.useState(()=>({previousValue:C,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:D}=R;let B=D,F=!1;O!==C&&(B=_5(O,C,u,E),F=O!=null&&C!=null&&M(C)==null);const K=F?O:C,$=O!==K||D!==B;We(()=>{$&&T({previousValue:K,tabActivationDirection:B})},[K,$,B]);const P=st((ne,te)=>{const ye=_5(C,ne,u,E);te.activationDirection=ye,c==null||c(ne,te),!te.isCanceled&&S(ne)}),U=st((ne,te)=>{c==null||c(ne,yt(te,void 0,void 0,{activationDirection:"none"}))}),H=st((ne,te)=>(w(ye=>{const ae=new Map(ye);return ae.set(ne,te),ae}),()=>{w(ye=>{if(ye.get(ne)!==te)return ye;const ae=new Map(ye);return ae.delete(ne),ae})})),W=x.useCallback(ne=>v.get(ne),[v]),q=x.useCallback(ne=>{for(const te of E.values())if(ne===te.value)return te.id},[E]),Z=x.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:q,getTabPanelIdByValue:W,onValueChange:P,orientation:u,registerMountedTabPanel:H,setTabMap:k,tabActivationDirection:B,value:C}),[M,q,W,P,u,H,k,B,C]),z=x.useMemo(()=>{for(const ne of E.values())if(ne.value===C)return ne},[E,C]),L=x.useMemo(()=>{for(const ne of E.values())if(!ne.disabled)return ne.value},[E]),X=x.useRef(!g),ee=x.useRef(i),_=x.useRef(g),V=x.useRef(!1);We(()=>{var ue;if(N)return;function ne(se,Q){S(se),T({previousValue:se,tabActivationDirection:"none"}),U(se,Q),X.current=!1}if(E.size===0){V.current&&C!==null&&!((ue=A.current)!=null&&ue.isConnected)&&ne(null,Hk);return}V.current=!0,A.current=E.keys().next().value;const te=z==null?void 0:z.disabled,ye=z==null&&C!==null;if(!te&&C===ee.current&&(_.current=!1),_.current&&te&&C===ee.current)return;const ae=X.current;if(te||ye){const se=L??null;if(C===se){X.current=!1;return}let Q=Hk;ae?Q=Fk:te&&(Q=JA),ne(se,Q);return}ae&&z!=null&&(U(C,Fk),X.current=!1)},[L,N,U,z,S,E,C]);const Y=Ct("div",t,{state:{orientation:u,tabActivationDirection:B},ref:r,props:p,stateAttributesMapping:yx});return n.jsx(y3.Provider,{value:Z,children:n.jsx(eh,{elementsRef:b,children:Y})})});function Wy(e,t){for(const[r,a]of e.entries())if(t===a.value)return r;return null}function _5(e,t,r,a){if(e==null||t==null)return"none";const[i,c,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],f=Wy(a,e),h=Wy(a,t);if(f==null||h==null)return f!==h&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?u:c:"none";const m=f.getBoundingClientRect()[i],p=h.getBoundingClientRect()[i];return p<m?c:p>m?u:"none"}const X2="data-composite-item-active";function w3(e={}){const{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:a}=Dg(),{ref:i,index:c}=pc(e),u=r===c,f=x.useRef(null),h=mo(i,f);return{compositeProps:{tabIndex:u?0:-1,onFocus(){a(c)},onMouseMove(){const p=f.current;if(!t||!p)return;const g=p.hasAttribute("disabled")||p.ariaDisabled==="true";!u&&!g&&p.focus()}},compositeRef:h,index:c}}const j3=x.createContext(void 0);function Z9(){const e=x.useContext(j3);if(e===void 0)throw new Error(rn(65));return e}const J9=x.forwardRef(function(t,r){const{className:a,disabled:i=!1,render:c,value:u,id:f,nativeButton:h=!0,style:m,...p}=t,{value:g,getTabPanelIdByValue:b,onValueChange:v,orientation:w,tabActivationDirection:C}=K2(),{activateOnFocus:S,registerTabResizeObserverElement:N,tabsListElement:E}=Z9(),{highlightedIndex:k,onHighlightedIndexChange:A}=Dg(),M=ws(f),R=x.useMemo(()=>({disabled:i,id:M,value:u}),[i,M,u]),{compositeProps:T,compositeRef:O,index:D}=w3({metadata:R}),B=u===g,F=x.useRef(!1),K=x.useRef(null),$=st(V=>{var G;(G=K.current)==null||G.call(K),K.current=V?N(V):null});We(()=>{if(F.current){F.current=!1;return}if(!(B&&D>-1&&k!==D))return;const V=E;if(V!=null){const G=Xs(Ht(V));if(G&>(V,G))return}i||A(D)},[B,D,k,A,i,E]);const{getButtonProps:P,buttonRef:U}=bo({disabled:i,native:h,focusableWhenDisabled:!0}),H=b(u),W=x.useRef(!1),q=x.useRef(!1);function Z(V){v(u,yt(Ur,V.nativeEvent,void 0,{activationDirection:"none"}))}function z(V){B||i||Z(V)}function L(V){B||i||S&&(!W.current||q.current)&&Z(V)}function X(V){if(B||i)return;W.current=!0,q.current=V.button===0;const G=Ht(V.currentTarget);function Y(){W.current=!1,q.current=!1,G.removeEventListener("pointerup",Y),G.removeEventListener("pointercancel",Y)}G.addEventListener("pointerup",Y),G.addEventListener("pointercancel",Y)}return Ct("button",t,{state:{disabled:i,active:B,orientation:w,tabActivationDirection:C},ref:[r,U,O,$],props:[T,{role:"tab","aria-controls":H,"aria-selected":B,id:M,onClick:z,onFocus:L,onPointerDown:X,[X2]:B?"":void 0,onKeyDownCapture(){F.current=!0}},p,P],stateAttributesMapping:yx})}),eU="data-index",tU={...yx,...si},nU=x.forwardRef(function(t,r){const{className:a,value:i,render:c,keepMounted:u=!1,style:f,...h}=t,{value:m,getTabIdByPanelValue:p,orientation:g,tabActivationDirection:b,registerMountedTabPanel:v}=K2(),w=ws(),{ref:C,index:S}=pc(),N=i===m,{mounted:E,transitionStatus:k,setMounted:A}=ni(N),M=!E,R=p(i),T={hidden:M,orientation:g,tabActivationDirection:b,transitionStatus:k},O=x.useRef(null),D=Ct("div",t,{state:T,ref:[r,C,O],props:[{"aria-labelledby":R,hidden:M,id:w,role:"tabpanel",tabIndex:N?0:-1,inert:Jf(!N),[eU]:S},h],stateAttributesMapping:tU});return Sr({open:N,ref:O,onComplete(){N||A(!1)}}),We(()=>{if(!(w==null||M&&!u))return v(i,w)},[M,u,i,w,v]),u||E?D:null});function sU(e){const{loopFocus:t=!0,orientation:r="both",grid:a,onLoop:i,direction:c,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:h,enableHomeAndEndKeys:m=!1,stopEventPropagation:p,disabledIndices:g,modifierKeys:b=Vr}=e,[v,w]=x.useState(0),C=a!=null,S=x.useRef(null),N=mo(S,h),E=x.useRef([]),k=x.useRef(!1),A=x.useRef(null),M=u??v,R=st((F,K=!1)=>{if(A.current=E.current[F]??null,(f??w)(F),K){const $=E.current[F];w5(S.current,$,c,r)}}),T=st(F=>{var U;if(F.size===0)return;if(k.current){const H=E.current,W=H.indexOf(A.current);if(W===-1){const q=H[M];!q||xu(H,M,g)?R(rU(H,g)):A.current=q}else W!==M&&R(W);return}k.current=!0;const K=Array.from(F.keys()),$=K.find(H=>H==null?void 0:H.hasAttribute(X2))??null,P=$?((U=F.get($))==null?void 0:U.index)??-1:-1;if(P!==-1)R(P);else if(xu(K,M,g)){const H=Va(K,{disabledIndices:g});sf(K,H)||R(H)}w5(S.current,$,c,r)});We(()=>{if(g==null||u!=null||!k.current)return;const F=E.current;if(xu(F,M,g)){const K=Va(F,{disabledIndices:g});sf(F,K)||R(K)}},[g,u,M,E,R]);const O=st((F,K,$)=>i?i(F,K,$,E):$),D=st(F=>{const K=F.key===Fy||F.key===Gy;if(!Zf.has(F.key)||!m&&K||oU(F,b)||!S.current)return;const P=c==="rtl",U=P?Uy:Hy,H=P?Hy:Uy,W=r==="vertical"?Vy:U,q=r==="vertical"?By:H,Z=Vs(F.nativeEvent);if(Z!=null&&y5(Z)&&!n3(Z)){const V=Z.selectionStart,G=Z.selectionEnd,Y=Z.value;if(V==null||F.shiftKey||V!==G||F.key!==q&&V<Y.length||F.key!==W&&V>0)return}let z=M;const L=bp(E,g),X=Iy(E,g);a!=null&&(z=a({disabledIndices:g,elementsRef:E,event:F,highlightedIndex:M,loopFocus:t,maxIndex:X,minIndex:L,onLoop:O,orientation:r,rtl:P}));const ee=r!=="vertical"&&F.key===U||r!=="horizontal"&&F.key===Vy,_=r!=="vertical"&&F.key===H||r!=="horizontal"&&F.key===By;m&&(F.key===Fy?z=L:F.key===Gy&&(z=X)),z===M&&(ee||_)&&(t&&z===X&&ee?(z=L,i&&(z=i(F,M,z,E))):t&&z===L&&_?(z=X,i&&(z=i(F,M,z,E))):z=Va(E.current,{startingIndex:z,decrement:_,disabledIndices:g})),z!==M&&!sf(E.current,z)&&(p&&F.stopPropagation(),(C||K||ee||_)&&F.preventDefault(),R(z,!0),queueMicrotask(()=>{var V;(V=E.current[z])==null||V.focus()}))});return{props:{ref:N,onFocus(F){const K=S.current,$=Vs(F.nativeEvent);!K||$==null||!y5($)||$.setSelectionRange(0,$.value.length)},onKeyDown:D},highlightedIndex:M,onHighlightedIndexChange:R,elementsRef:E,onMapChange:T,relayKeyboardEvent:D}}function rU(e,t){let r=-1;for(let a=0;a<e.length;a+=1){const i=e[a];if(!(!i||xu(e,a,t))){if(i.hasAttribute(X2))return a;r===-1&&(r=a)}}return Math.max(r,0)}function oU(e,t){for(const r of pV)if(!t.includes(r)&&e.getModifierState(r))return!0;return!1}function S3(e){const{render:t,className:r,style:a,refs:i=Vr,props:c=Vr,state:u=En,stateAttributesMapping:f,highlightedIndex:h,onHighlightedIndexChange:m,orientation:p,grid:g,loopFocus:b,onLoop:v,enableHomeAndEndKeys:w,onMapChange:C,stopEventPropagation:S=!0,rootRef:N,disabledIndices:E,modifierKeys:k,highlightItemOnHover:A=!1,tag:M="div",...R}=e,T=gx(),{props:O,highlightedIndex:D,onHighlightedIndexChange:B,elementsRef:F,onMapChange:K,relayKeyboardEvent:$}=sU({grid:g,loopFocus:b,onLoop:v,orientation:p,highlightedIndex:h,onHighlightedIndexChange:m,rootRef:N,stopEventPropagation:S,enableHomeAndEndKeys:w,direction:T,disabledIndices:E,modifierKeys:k}),P=Ct(M,e,{state:u,ref:i,props:[O,...c,R],stateAttributesMapping:f}),U=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:B,highlightItemOnHover:A,relayKeyboardEvent:$}),[D,B,A,$]);return n.jsx(aA.Provider,{value:U,children:n.jsx(eh,{elementsRef:F,onMapChange:H=>{C==null||C(H),K(H)},children:P})})}const aU=x.forwardRef(function(t,r){const{activateOnFocus:a=!1,className:i,loopFocus:c=!0,render:u,style:f,...h}=t,{orientation:m,setTabMap:p,tabActivationDirection:g}=K2(),[b,v]=x.useState(0),[w,C]=x.useState(null),S=x.useRef(new Set),N=x.useRef(new Set),E=x.useRef(null);We(()=>{if(typeof ResizeObserver>"u")return;const O=new ResizeObserver(()=>{S.current.forEach(D=>{D()})});return E.current=O,w&&O.observe(w),N.current.forEach(D=>{O.observe(D)}),()=>{O.disconnect(),E.current=null}},[w]);const k=st(O=>(S.current.add(O),()=>{S.current.delete(O)})),A=st(O=>{var D;return N.current.add(O),(D=E.current)==null||D.observe(O),()=>{var B;N.current.delete(O),(B=E.current)==null||B.unobserve(O)}}),M={orientation:m,tabActivationDirection:g},R={"aria-orientation":m==="vertical"?"vertical":void 0,role:"tablist"},T=x.useMemo(()=>({activateOnFocus:a,registerIndicatorUpdateListener:k,registerTabResizeObserverElement:A,tabsListElement:w}),[a,k,A,w]);return n.jsx(j3.Provider,{value:T,children:n.jsx(S3,{render:u,className:i,style:f,state:M,refs:[r,C],props:[R,h],stateAttributesMapping:yx,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:c,orientation:m,onHighlightedIndexChange:v,onMapChange:p,disabledIndices:Vr})})});function nh({className:e,orientation:t="horizontal",...r}){return n.jsx(Q9,{"data-slot":"tabs","data-orientation":t,className:Ve("group/tabs flex gap-2 data-horizontal:flex-col",e),...r})}const iU=If("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function sh({className:e,variant:t="default",...r}){return n.jsx(aU,{"data-slot":"tabs-list","data-variant":t,className:Ve(iU({variant:t}),e),...r})}function Pr({className:e,...t}){return n.jsx(J9,{"data-slot":"tabs-trigger",className:Ve("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Io({className:e,...t}){return n.jsx(nU,{"data-slot":"tabs-content",className:Ve("flex-1 text-sm outline-none",e),...t})}const N3=x.createContext(void 0);function C3(){const e=x.useContext(N3);if(e===void 0)throw new Error(rn(10));return e}const lU={value:()=>null},cU=x.forwardRef(function(t,r){const{render:a,className:i,disabled:c=!1,hiddenUntilFound:u,keepMounted:f,loopFocus:h,onValueChange:m,multiple:p=!1,orientation:g="vertical",value:b,defaultValue:v,style:w,...C}=t,S=v??Vr,N=x.useRef([]),[E,k]=po({controlled:b,default:S,name:"Accordion",state:"value"}),A=st((O,D,B)=>{if(p)if(D){const F=E.slice();if(F.push(O),m==null||m(F,B),B.isCanceled)return;k(F)}else{const F=E.filter(K=>K!==O);if(m==null||m(F,B),B.isCanceled)return;k(F)}else{const F=E[0]===O?[]:[O];if(m==null||m(F,B),B.isCanceled)return;k(F)}}),M=x.useMemo(()=>({value:E,disabled:c,orientation:g}),[E,c,g]),R=x.useMemo(()=>({disabled:c,handleValueChange:A,hiddenUntilFound:u??!1,keepMounted:f??!1,state:M,value:E}),[c,A,u,f,M,E]),T=Ct("div",t,{state:M,ref:r,props:C,stateAttributesMapping:lU});return n.jsx(N3.Provider,{value:R,children:n.jsx(eh,{elementsRef:N,children:T})})});function uU(e){const{open:t,defaultOpen:r=!1,onOpenChange:a,disabled:i}=e,[c,u]=po({controlled:t,default:r,name:"Collapsible",state:"open"}),{mounted:f,setMounted:h,transitionStatus:m}=ni(c,!0,!0),p=ws(),[g,b]=x.useState(),v=g===null?void 0:g??p,w=st(C=>{const S=!c,N=yt(ma,C.nativeEvent);a(S,N),!N.isCanceled&&u(S)});return x.useMemo(()=>({defaultPanelId:p,disabled:i,handleTrigger:w,mounted:f,open:c,panelId:v,setMounted:h,setOpen:u,setPanelIdState:b,transitionStatus:m}),[p,i,w,f,c,v,h,u,b,m])}const k3=x.createContext(void 0);function T3(){const e=x.useContext(k3);if(e===void 0)throw new Error(rn(15));return e}const E3=x.createContext(void 0);function W2(){const e=x.useContext(E3);if(e===void 0)throw new Error(rn(9));return e}const dU="data-open",fU="data-closed",hU=c2,mU="data-panel-open",pU={[dU]:""},gU={[fU]:""},xU={open(e){return e?{[mU]:""}:null}},bU={open(e){return e?pU:gU}},vU="data-index",Q2={...bU,index:e=>({[vU]:String(e)}),...si,value:()=>null},yU=x.forwardRef(function(t,r){const{className:a,disabled:i=!1,onOpenChange:c,render:u,value:f,style:h,...m}=t,{ref:p,index:g}=pc(),b=mo(r,p),{disabled:v,handleValueChange:w,state:C,value:S}=C3(),N=ws(),E=f??N,k=i||v,A=S.indexOf(E)!==-1,M=st((H,W)=>{c==null||c(H,W),!W.isCanceled&&w(E,H,W)}),R=uU({open:A,onOpenChange:M,disabled:k}),T=x.useMemo(()=>({open:R.open,disabled:R.disabled,transitionStatus:R.transitionStatus}),[R.open,R.disabled,R.transitionStatus]),O=x.useMemo(()=>({...R,onOpenChange:M,state:T}),[R,T,M]),D=x.useMemo(()=>({...C,hidden:!A&&!R.mounted,index:g,disabled:k,open:A}),[R.mounted,k,g,A,C]),B=ws(),[F,K]=x.useState(),$=F===null?void 0:F??B,P=x.useMemo(()=>({defaultTriggerId:B,open:A,state:D,setTriggerId:K,triggerId:$}),[B,A,D,K,$]),U=Ct("div",t,{state:D,ref:b,props:m,stateAttributesMapping:Q2});return n.jsx(k3.Provider,{value:O,children:n.jsx(E3.Provider,{value:P,children:U})})}),wU=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,{state:f}=W2();return Ct("h3",t,{state:f,ref:r,props:u,stateAttributesMapping:Q2})}),jU=x.forwardRef(function(t,r){const{disabled:a,className:i,id:c,render:u,nativeButton:f=!0,style:h,...m}=t,{panelId:p,open:g,handleTrigger:b,disabled:v}=T3(),w=a||v,{getButtonProps:C,buttonRef:S}=bo({disabled:w,focusableWhenDisabled:!0,native:f}),{defaultTriggerId:N,state:E,setTriggerId:k}=W2(),A=c||void 0,M=A??N;return We(()=>(k(O=>A??(O===null?void 0:O)),()=>{k(O=>O===A?null:O)}),[A,k]),Ct("button",t,{state:E,ref:[r,S],props:[{"aria-controls":g?p:void 0,"aria-expanded":g,id:M,onClick:b},m,C],stateAttributesMapping:xU})}),Hd={height:void 0,width:void 0};function SU(e){const{externalRef:t,hiddenUntilFound:r,id:a,keepMounted:i,mounted:c,onOpenChange:u,open:f,setMounted:h,setOpen:m,transitionStatus:p}=e,g=x.useRef(null),b=x.useRef(null),[v,w]=x.useState(Hd),C=x.useRef(Hd),S=x.useRef(!1),N=x.useRef(f),E=x.useRef(!1),[k,A]=x.useState(!1),M=x.useRef(null),R=mo(t,g),T=qn(f),O=Gf(g),D=!f&&!c,B=k?"idle":p,F=f&&(N.current||E.current),K=!f&&c&&b.current==="css-animation"&&v.height===void 0&&v.width===void 0?C.current:v,$=r&&D&&b.current!=="css-animation",P=st((Z,z=!0)=>{z&&(C.current=Z),w(Z)}),U=st(()=>{var Z;(Z=M.current)==null||Z.call(M),M.current=null}),H=st(Z=>{U(),M.current=()=>{M.current=null,Z()}}),W=st(()=>{f&&c&&b.current==="css-animation"&&(E.current=!0)});We(()=>{!k||p==="starting"||A(!1)},[k,p]),x.useEffect(()=>()=>{W(),U()},[W,U]),We(()=>{const Z=g.current;if(!Z)return;!f&&M.current&&U();const z=NU(Z,F);if(b.current=z,f&&p==="idle"&&N.current&&z==="css-animation"){C.current=ou(Z);return}if(f&&p==="starting"){const ee=S.current;if(S.current=!1,z==="none"){P(ou(Z)),A(!0);return}if(z==="css-transition"){const G=CU(Z);if(P(ou(Z)),!ee)return G;const Y=Ym(Z,"transition-duration","0s");return H(Y),A(!0),G}P(ou(Z));const _=Ym(Z,"animation-name","none");if(!ee){_();return}const V=Ym(Z,"animation-duration","0s");_(),H(V),A(!0);return}if(!f&&c&&(p==="idle"||p==="starting")){if(N.current=!1,E.current=!1,z==="none"){P(Hd,!1),h(!1);return}P(ou(Z));return}if(p!=="ending")return;if(z==="none"){h(!1);return}const L=ou(Z);if(!(L.height>0||L.width>0)){h(!1);return}P(L),z==="css-animation"&&Ym(Z,"animation-name","none")()},[c,f,U,P,h,H,F,p]),Sr({enabled:f&&c&&B==="idle",open:!0,ref:g,onComplete(){f&&P(Hd,!1)}}),x.useEffect(()=>{if(f||!c||B!=="ending"||!g.current)return;const z=new AbortController;let L=-1;function X(){T.current||(h(!1),P(Hd,!1))}return L=wr.request(()=>{O(X,z.signal)}),()=>{wr.cancel(L),z.abort()}},[T,c,f,B,O,P,h]),We(()=>{const Z=g.current;!Z||!r||!D||Z.setAttribute("hidden","until-found")},[D,r]),x.useEffect(function(){const z=g.current;if(!z)return;function L(X){const ee=yt(Ur,X);u(!0,ee),!ee.isCanceled&&(S.current=!0,m(!0))}return $t(z,"beforematch",L)},[u,m]);const q=i||r||c||f;return{height:K.height,props:{...$?{[hU]:""}:void 0,hidden:D,id:a},ref:R,shouldPreventOpenAnimation:F,shouldRender:q,transitionStatus:B,width:K.width}}function ou(e){return{height:e.scrollHeight,width:e.scrollWidth}}function NU(e,t){const r=Rn(e).getComputedStyle(e),a=(r.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||t)&&L5(r.animationDuration),i=L5(r.transitionDuration);return a&&i||i?"css-transition":a?"css-animation":"none"}function L5(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function Ym(e,t,r){const a=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,r),()=>{if(a===""){e.style.removeProperty(t);return}e.style.setProperty(t,a,i)}}function CU(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(i=>{e.style.setProperty(i,"initial","important")});function r(){Object.entries(t).forEach(([i,c])=>{if(c===""){e.style.removeProperty(i);return}e.style.setProperty(i,c)})}const a=wr.request(r);return()=>{wr.cancel(a),r()}}const kU="--accordion-panel-height",TU="--accordion-panel-width",EU=x.forwardRef(function(t,r){const{className:a,hiddenUntilFound:i,keepMounted:c,id:u,render:f,style:h,...m}=t,{hiddenUntilFound:p,keepMounted:g}=C3(),{defaultPanelId:b,mounted:v,onOpenChange:w,open:C,setMounted:S,setOpen:N,setPanelIdState:E,transitionStatus:k}=T3(),A=i??p,M=c??g,R=u||void 0,T=u??b;We(()=>(E(z=>R??(z===null?void 0:z)),()=>{E(z=>z===R?null:z)}),[R,E]);const{height:O,props:D,ref:B,shouldPreventOpenAnimation:F,shouldRender:K,transitionStatus:$,width:P}=SU({externalRef:r,hiddenUntilFound:A,id:T,keepMounted:M,mounted:v,onOpenChange:w,open:C,setMounted:S,setOpen:N,transitionStatus:k}),{state:U,triggerId:H}=W2(),W={...U,transitionStatus:$},q=cA(h,W),Z=Ct("div",{...t,style:void 0},{state:W,ref:B,props:[D,{"aria-labelledby":H,role:"region",style:{[kU]:O===void 0?"auto":`${O}px`,[TU]:P===void 0?"auto":`${P}px`}},m,q?{style:q}:void 0,F?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Q2});return K?Z:null});function RU({className:e,...t}){return n.jsx(cU,{"data-slot":"accordion",className:Ve("flex w-full flex-col",e),...t})}function AU({className:e,...t}){return n.jsx(yU,{"data-slot":"accordion-item",className:Ve("not-last:border-b",e),...t})}function MU({className:e,children:t,...r}){return n.jsx(wU,{className:"flex",children:n.jsxs(jU,{"data-slot":"accordion-trigger",className:Ve("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...r,children:[t,n.jsx(ha,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),n.jsx(OA,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function OU({className:e,children:t,...r}){return n.jsx(EU,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...r,children:n.jsx("div",{className:Ve("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}const Z2=x.createContext({});function rh(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const DU=typeof window<"u",Au=DU?x.useLayoutEffect:x.useEffect,wx=x.createContext(null);function J2(e,t){e.indexOf(t)===-1&&e.push(t)}function og(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const Bo=(e,t,r)=>r>t?t:r<e?e:r;let jx=()=>{};const Qa={},ew=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),R3=e=>typeof e=="object"&&e!==null,tw=e=>/^0[^.\s]+$/u.test(e);function A3(e){let t;return()=>(t===void 0&&(t=e()),t)}const _o=e=>e,oh=(...e)=>e.reduce((t,r)=>a=>r(t(a))),Sf=(e,t,r)=>{const a=t-e;return a?(r-e)/a:1};class ag{constructor(){this.subscriptions=[]}add(t){return J2(this.subscriptions,t),()=>this.remove(t)}remove(t){og(this.subscriptions,t)}notify(t,r,a){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,r,a);else for(let c=0;c<i;c++){const u=this.subscriptions[c];u&&u(t,r,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const fo=e=>e*1e3,_r=e=>e/1e3,M3=(e,t)=>t?e*(1e3/t):0,O3=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,zU=1e-7,IU=12;function PU(e,t,r,a,i){let c,u,f=0;do u=t+(r-t)/2,c=O3(u,a,i)-e,c>0?r=u:t=u;while(Math.abs(c)>zU&&++f<IU);return u}function ah(e,t,r,a){if(e===t&&r===a)return _o;const i=c=>PU(c,0,1,e,r);return c=>c===0||c===1?c:O3(i(c),t,a)}const D3=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,z3=e=>t=>1-e(1-t),I3=ah(.33,1.53,.69,.99),nw=z3(I3),P3=D3(nw),_3=e=>e>=1?1:(e*=2)<1?.5*nw(e):.5*(2-Math.pow(2,-10*(e-1))),sw=e=>1-Math.sin(Math.acos(e)),L3=z3(sw),$3=D3(sw),_U=ah(.42,0,1,1),LU=ah(0,0,.58,1),rw=ah(.42,0,.58,1),$U=e=>Array.isArray(e)&&typeof e[0]!="number",B3=e=>Array.isArray(e)&&typeof e[0]=="number",BU={linear:_o,easeIn:_U,easeInOut:rw,easeOut:LU,circIn:sw,circInOut:$3,circOut:L3,backIn:nw,backInOut:P3,backOut:I3,anticipate:_3},VU=e=>typeof e=="string",$5=e=>{if(B3(e)){jx(e.length===4);const[t,r,a,i]=e;return ah(t,r,a,i)}else if(VU(e))return BU[e];return e},Km=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function UU(e){let t=new Set,r=new Set,a=!1,i=!1;const c=new Set;let u={delta:0,timestamp:0,isProcessing:!1};function f(m){c.has(m)&&(r.add(m),e()),m(u)}const h={schedule:(m,p=!1,g=!1)=>{const v=g&&a?t:r;return p&&c.add(m),v.add(m),m},cancel:m=>{r.delete(m),c.delete(m)},process:m=>{if(u=m,a){i=!0;return}a=!0;const p=t;t=r,r=p,t.forEach(f),t.clear(),a=!1,i&&(i=!1,h.process(m))}};return h}const HU=40;function V3(e,t){let r=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,u=Km.reduce((k,A)=>(k[A]=UU(c),k),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:p,update:g,preRender:b,render:v,postRender:w}=u,C=()=>{const k=Qa.useManualTiming,A=k?i.timestamp:performance.now();r=!1,k||(i.delta=a?1e3/60:Math.max(Math.min(A-i.timestamp,HU),1)),i.timestamp=A,i.isProcessing=!0,f.process(i),h.process(i),m.process(i),p.process(i),g.process(i),b.process(i),v.process(i),w.process(i),i.isProcessing=!1,r&&t&&(a=!1,e(C))},S=()=>{r=!0,a=!0,i.isProcessing||e(C)};return{schedule:Km.reduce((k,A)=>{const M=u[A];return k[A]=(R,T=!1,O=!1)=>(r||S(),M.schedule(R,T,O)),k},{}),cancel:k=>{for(let A=0;A<Km.length;A++)u[Km[A]].cancel(k)},state:i,steps:u}}const{schedule:jn,cancel:pa,state:Es,steps:Iv}=V3(typeof requestAnimationFrame<"u"?requestAnimationFrame:_o,!0);let kp;function FU(){kp=void 0}const As={now:()=>(kp===void 0&&As.set(Es.isProcessing||Qa.useManualTiming?Es.timestamp:performance.now()),kp),set:e=>{kp=e,queueMicrotask(FU)}},yu=e=>Math.round(e*1e5)/1e5,U3=e=>t=>typeof t=="string"&&t.startsWith(e),H3=U3("--"),GU=U3("var(--"),ow=e=>GU(e)?qU.test(e.split("/*")[0].trim()):!1,qU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function B5(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const $u={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Nf={...$u,transform:e=>Bo(0,1,e)},Xm={...$u,default:1},aw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function YU(e){return e==null}const KU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,iw=(e,t)=>r=>!!(typeof r=="string"&&KU.test(r)&&r.startsWith(e)||t&&!YU(r)&&Object.prototype.hasOwnProperty.call(r,t)),F3=(e,t,r)=>a=>{if(typeof a!="string")return a;const[i,c,u,f]=a.match(aw);return{[e]:parseFloat(i),[t]:parseFloat(c),[r]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},XU=e=>Bo(0,255,e),Pv={...$u,transform:e=>Math.round(XU(e))},Xl={test:iw("rgb","red"),parse:F3("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:a=1})=>"rgba("+Pv.transform(e)+", "+Pv.transform(t)+", "+Pv.transform(r)+", "+yu(Nf.transform(a))+")"};function WU(e){let t="",r="",a="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}}const Qy={test:iw("#"),parse:WU,transform:Xl.transform},ih=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),$a=ih("deg"),aa=ih("%"),pt=ih("px"),QU=ih("vh"),ZU=ih("vw"),V5={...aa,parse:e=>aa.parse(e)/100,transform:e=>aa.transform(e*100)},uu={test:iw("hsl","hue"),parse:F3("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:a=1})=>"hsla("+Math.round(e)+", "+aa.transform(yu(t))+", "+aa.transform(yu(r))+", "+yu(Nf.transform(a))+")"},xs={test:e=>Xl.test(e)||Qy.test(e)||uu.test(e),parse:e=>Xl.test(e)?Xl.parse(e):uu.test(e)?uu.parse(e):Qy.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Xl.transform(e):uu.transform(e),getAnimatableNone:e=>{const t=xs.parse(e);return t.alpha=0,xs.transform(t)}},JU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,G3=new RegExp(aw.source),q3=new RegExp(JU.source,"i");function eH(e){return isNaN(e)&&typeof e=="string"&&(G3.test(e)||q3.test(e))}const Y3="number",K3="color",tH="var",nH="var(",U5="${}",sH=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function rH(e){const t=e.toString();return G3.test(t)||q3.test(t)}function Cf(e){const t=e.toString(),r=[],a={color:[],number:[],var:[]},i=[];let c=0;const f=t.replace(sH,h=>(xs.test(h)?(a.color.push(c),i.push(K3),r.push(xs.parse(h))):h.startsWith(nH)?(a.var.push(c),i.push(tH),r.push(h)):(a.number.push(c),i.push(Y3),r.push(parseFloat(h))),++c,U5)).split(U5);return{values:r,split:f,indexes:a,types:i}}function oH(e){return Cf(e).values}function X3({split:e,types:t}){const r=e.length;return a=>{let i="";for(let c=0;c<r;c++)if(i+=e[c],a[c]!==void 0){const u=t[c];u===Y3?i+=yu(a[c]):u===K3?i+=xs.transform(a[c]):i+=a[c]}return i}}function aH(e){return X3(Cf(e))}const iH=e=>typeof e=="number"?0:xs.test(e)?xs.getAnimatableNone(e):e,lH=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:iH(e);function cH(e){const t=Cf(e);return X3(t)(t.values.map((a,i)=>lH(a,t.split[i])))}const $r={test:eH,parse:oH,createTransformer:aH,getAnimatableNone:cH};function _v(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function uH({hue:e,saturation:t,lightness:r,alpha:a}){e/=360,t/=100,r/=100;let i=0,c=0,u=0;if(!t)i=c=u=r;else{const f=r<.5?r*(1+t):r+t-r*t,h=2*r-f;i=_v(h,f,e+1/3),c=_v(h,f,e),u=_v(h,f,e-1/3)}return{red:Math.round(i*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function ig(e,t){return r=>r>0?t:e}const Tn=(e,t,r)=>e+(t-e)*r,Lv=(e,t,r)=>{const a=e*e,i=r*(t*t-a)+a;return i<0?0:Math.sqrt(i)},dH=[Qy,Xl,uu],fH=e=>dH.find(t=>t.test(e));function H5(e){const t=fH(e);if(!t)return!1;let r=t.parse(e);return t===uu&&(r=uH(r)),r}const F5=(e,t)=>{const r=H5(e),a=H5(t);if(!r||!a)return ig(e,t);const i={...r};return c=>(i.red=Lv(r.red,a.red,c),i.green=Lv(r.green,a.green,c),i.blue=Lv(r.blue,a.blue,c),i.alpha=Tn(r.alpha,a.alpha,c),Xl.transform(i))},Zy=new Set(["none","hidden"]);function hH(e,t){return Zy.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function mH(e,t){return r=>Tn(e,t,r)}function lw(e){return typeof e=="number"?mH:typeof e=="string"?ow(e)?ig:xs.test(e)?F5:xH:Array.isArray(e)?W3:typeof e=="object"?xs.test(e)?F5:pH:ig}function W3(e,t){const r=[...e],a=r.length,i=e.map((c,u)=>lw(c)(c,t[u]));return c=>{for(let u=0;u<a;u++)r[u]=i[u](c);return r}}function pH(e,t){const r={...e,...t},a={};for(const i in r)e[i]!==void 0&&t[i]!==void 0&&(a[i]=lw(e[i])(e[i],t[i]));return i=>{for(const c in a)r[c]=a[c](i);return r}}function gH(e,t){const r=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const c=t.types[i],u=e.indexes[c][a[c]],f=e.values[u]??0;r[i]=f,a[c]++}return r}const xH=(e,t)=>{const r=$r.createTransformer(t),a=Cf(e),i=Cf(t);return a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length?Zy.has(e)&&!i.values.length||Zy.has(t)&&!a.values.length?hH(e,t):oh(W3(gH(a,i),i.values),r):ig(e,t)},G5=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function bH(e,t){const r=G5.exec(e);if(!r)return;const a=G5.exec(t);if(!a||r[2]!==a[2])return;const i=r[2],c=parseFloat(r[1]),u=parseFloat(a[1]);return f=>yu(Tn(c,u,f))+i}function cw(e,t,r){if(typeof e=="number"&&typeof t=="number"&&typeof r=="number")return Tn(e,t,r);if(typeof e=="string"&&typeof t=="string"){const i=bH(e,t);if(i)return i}return lw(e)(e,t)}const vH=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>jn.update(t,r),stop:()=>pa(t),now:()=>Es.isProcessing?Es.timestamp:As.now()}},Q3=(e,t,r=10)=>{let a="";const i=Math.max(Math.round(t/r),2);for(let c=0;c<i;c++)a+=Math.round(e(c/(i-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},uw=2e4;function dw(e,t=50,r=uw,a){let i=0,c=e.next(i);for(;!c.done&&i<r;)i+=t,c=e.next(i);return i>=r?1/0:i}function yH(e,t=100,r){const a=r({...e,keyframes:[0,t]}),i=Math.min(dw(a),uw);return{type:"keyframes",ease:c=>a.next(i*c).value/t,duration:_r(i)}}const Gn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Jy(e,t){return e*Math.sqrt(1-t*t)}const wH=12;function jH(e,t,r){let a=r;for(let i=1;i<wH;i++)a=a-e(a)/t(a);return a}const $v=.001;function SH({duration:e=Gn.duration,bounce:t=Gn.bounce,velocity:r=Gn.velocity,mass:a=Gn.mass}){let i,c,u=1-t;u=Bo(Gn.minDamping,Gn.maxDamping,u),e=Bo(Gn.minDuration,Gn.maxDuration,_r(e)),u<1?(i=m=>{const p=m*u,g=p*e,b=p-r,v=Jy(m,u),w=Math.exp(-g);return $v-b/v*w},c=m=>{const g=m*u*e,b=g*r+r,v=u*u*m*m*e,w=Math.exp(-g),C=Jy(m*m,u);return(-i(m)+$v>0?-1:1)*((b-v)*w)/C}):(i=m=>{const p=Math.exp(-m*e),g=(m-r)*e+1;return-$v+p*g},c=m=>{const p=Math.exp(-m*e),g=(r-m)*(e*e);return p*g});const f=5/e,h=jH(i,c,f);if(e=fo(e),isNaN(h))return{stiffness:Gn.stiffness,damping:Gn.damping,duration:e};{const m=h*h*a;return{stiffness:m,damping:u*2*Math.sqrt(a*m),duration:e}}}const NH=["duration","bounce"];function CH(e,t){return t.some(r=>e[r]!==void 0)}const e1=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Bv(e,t){if(e1(e,t))return e}function kH(e){const t=Bv(e.stiffness),r=Bv(e.damping,!0),a=Bv(e.mass);let i={...e,stiffness:t??Gn.stiffness,damping:r??Gn.damping,mass:a??Gn.mass,isResolvedFromDuration:!1,isTimeDefined:(t??r??a)===void 0&&CH(e,NH)};if(i.isTimeDefined){if(i.velocity=0,e.visualDuration){const c=e.visualDuration,u=2*Math.PI/(c*1.2),f=u*u,h=2*Bo(.05,1,1-(e.bounce||0))*Math.sqrt(f);i={...i,mass:Gn.mass,stiffness:f,damping:h}}else{const c=SH(i);i={...i,...c,mass:Gn.mass},i.isResolvedFromDuration=!0}(!e1(i.stiffness)||!e1(i.damping,!0))&&(i.stiffness=Gn.stiffness,i.damping=Gn.damping)}return i}function lg(e=Gn.visualDuration,t=Gn.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,a=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],c={done:!1,value:a},{stiffness:u,damping:f,mass:h,duration:m,velocity:p,isResolvedFromDuration:g,isTimeDefined:b}=kH({...r,velocity:-_r(r.velocity||0)}),v=f/(2*Math.sqrt(u*h)),w=_r(Math.sqrt(u/h)),C=v*w,S={target:i,delta:i-a,velocity:p||0,restSpeed:0,restDelta:0},N=()=>{const T=Math.abs(S.delta)<5;S.restSpeed=r.restSpeed||(T?Gn.restSpeed.granular:Gn.restSpeed.default),S.restDelta=r.restDelta||(T?Gn.restDelta.granular:Gn.restDelta.default)};N();let E,k,A;if(v<1){const T=Jy(w,v),O={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};A=()=>{O.A=(S.velocity+C*S.delta)/T,O.sinC=C*O.A+S.delta*T,O.cosC=C*S.delta-O.A*T};const D=B=>{B!==O.t&&(O.t=B,O.env=Math.exp(-C*B),O.sin=Math.sin(T*B),O.cos=Math.cos(T*B))};E=B=>(D(B),S.target-O.env*(O.A*O.sin+S.delta*O.cos)),k=B=>(D(B),O.env*(O.sinC*O.sin+O.cosC*O.cos))}else if(v===1){E=O=>S.target-Math.exp(-w*O)*(S.delta+(S.velocity+w*S.delta)*O);const T={C:0};A=()=>{T.C=S.velocity+w*S.delta},k=O=>Math.exp(-w*O)*(w*T.C*O-S.velocity)}else{const T=w*Math.sqrt(v*v-1);E=D=>{const B=Math.exp(-C*D),F=Math.min(T*D,300);return S.target-B*((S.velocity+C*S.delta)*Math.sinh(F)+T*S.delta*Math.cosh(F))/T};const O={P:0,sinh:0,cosh:0};A=()=>{O.P=(S.velocity+C*S.delta)/T,O.sinh=C*O.P-S.delta*T,O.cosh=C*S.delta-O.P*T},k=D=>{const B=Math.exp(-C*D),F=Math.min(T*D,300);return B*(O.sinh*Math.sinh(F)+O.cosh*Math.cosh(F))}}A();const M=g&&m||null,R={calculatedDuration:M,retarget:(T,O)=>{S.target=T[T.length-1],S.delta=S.target-T[0],S.velocity=b?0:-_r(O),r.restSpeed&&r.restDelta||N(),R.calculatedDuration=M,c.done=!1,A()},velocity:T=>fo(k(T)),next:T=>{const O=E(T);if(g)c.done=T>=m;else{const D=fo(k(T));c.done=Math.abs(D)<=S.restSpeed&&Math.abs(S.target-O)<=S.restDelta}return c.value=c.done?S.target:O,c},toString:()=>{const T=Math.min(dw(R),uw),O=Q3(D=>R.next(T*D).value,T,30);return T+"ms "+O},toTransition:()=>{}};return R}lg.applyToOptions=e=>{const t=yH(e,100,lg);return e.ease=t.ease,e.duration=fo(t.duration),e.type="keyframes",e};function t1({keyframes:e,velocity:t=0,power:r=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:c=500,modifyTarget:u,min:f,max:h,restDelta:m=.5,restSpeed:p}){const g=e[0],b={done:!1,value:g},v=T=>T<f||T>h,w=T=>f===void 0?h:h===void 0||Math.abs(f-T)<Math.abs(h-T)?f:h;let C=r*t;const S=g+C,N=u===void 0?S:u(S);N!==S&&(C=N-g);const E=T=>-C*Math.exp(-T/a),k=T=>{const O=E(T);b.done=Math.abs(O)<=m,b.value=b.done?N:N+O};let A,M;const R=T=>{v(b.value)&&(A=T,M=lg({keyframes:[b.value,w(b.value)],velocity:-E(T)/a*1e3,damping:i,stiffness:c,restDelta:m,restSpeed:p}))};return R(0),{calculatedDuration:null,next:T=>{let O=!1;return!M&&A===void 0&&(O=!0,k(T),R(T)),A!==void 0&&T>=A?M.next(T-A):(!O&&k(T),b)}}}function TH(e,t,r){const a=[],i=r||Qa.mix||cw,c=e.length-1;for(let u=0;u<c;u++){let f=i(e[u],e[u+1]);if(t){const h=Array.isArray(t)?t[u]||_o:t;f=oh(h,f)}a.push(f)}return a}function Z3(e,t,{clamp:r=!0,ease:a,mixer:i}={}){const c=e.length;if(jx(c===t.length),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=TH(t,a,i),h=f.length,m=p=>{if(u&&p<e[0])return t[0];let g=0;if(h>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const b=Sf(e[g],e[g+1],p);return f[g](b)};return r?p=>m(Bo(e[0],e[c-1],p)):m}function EH(e,t){const r=e[e.length-1];for(let a=1;a<=t;a++){const i=Sf(0,t,a);e.push(Tn(r,1,i))}}function RH(e){const t=[0];return EH(t,e.length-1),t}function AH(e,t){return e.map(r=>r*t)}function MH(e,t){return e.map(()=>t||rw).splice(0,e.length-1)}function wu({duration:e=300,keyframes:t,times:r,ease:a="easeInOut"}){const i=$U(a)?a.map($5):$5(a)||rw,c={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!r||r.length!==2||r[0]===0&&r[1]===1)){const[h,m]=t,p=h===m?void 0:(Qa.mix||cw)(h,m);return{calculatedDuration:e,next:g=>(c.value=p?p(i(e>0?Bo(0,1,g/e):1)):m,c.done=g>=e,c)}}const u=AH(r&&r.length===t.length?r:RH(t),e),f=Z3(u,t,{ease:Array.isArray(i)?i:MH(t,i)});return{calculatedDuration:e,next:h=>(c.value=f(h),c.done=h>=e,c)}}const OH=5;function DH(e,t,r){const a=Math.max(t-OH,0);return M3(r-e(a),t-a)}function J3(e,t,r=0){return t<=0?r:e.velocity?e.velocity(t):DH(a=>e.next(a).value,t,e.next(t).value)}const zH=e=>e!==null;function Sx(e,{repeat:t,repeatType:r="loop"},a,i=1){const c=e.filter(zH),f=i<0||t&&r!=="loop"&&t%2===1?0:c.length-1;return!f||a===void 0?c[f]:a}const IH={decay:t1,inertia:t1,tween:wu,keyframes:wu,spring:lg};function fw(e){typeof e.type=="string"&&(e.type=IH[e.type])}function eO(e,t){return{kind:e,animation:t,timestamp:As.now(),frameTimestamp:Es.timestamp,frameIsProcessing:Es.isProcessing}}function tO(e,t,r){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...eO("animation-start",e),options:r?{...t,...r}:t})}catch{}}function PH(e,t){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...eO("layout-animation-start",e),node:t})}catch{}}class Nx{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){var t;this.isResolved=!0,(t=this._resolve)==null||t.call(this)}then(t,r){return this.finished.then(t,r)}}const _H=e=>e/100;class cg extends Nx{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var a,i;const{motionValue:r}=this.options;r&&r.updatedAt!==As.now()&&this.tick(As.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(a=this.options).onStop)==null||i.call(a))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),tO(this,this.options)}initAnimation(){const{options:t}=this;fw(t);const{type:r=wu,repeat:a=0,repeatDelay:i=0,repeatType:c,velocity:u=0}=t;let{keyframes:f}=t;const h=r||wu;h!==wu&&typeof f[0]!="number"&&(this.mixKeyframes=oh(_H,cw(f[0],f[1])),f=[0,100]);const m=h(f===t.keyframes?t:{...t,keyframes:f});c==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...f].reverse(),velocity:-u})),m.calculatedDuration===null&&(m.calculatedDuration=dw(m));const{calculatedDuration:p}=m;this.calculatedDuration=p,this.resolvedDuration=p+i,this.totalDuration=this.resolvedDuration*(a+1)-i,this.generator=m}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:a,totalDuration:i,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return a.next(0);const{delay:m=0,keyframes:p,repeat:g,repeatType:b,repeatDelay:v,type:w,onUpdate:C,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const N=this.currentTime-m*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?N<0:N>i;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let k=this.currentTime,A=a;if(g){const O=Math.min(this.currentTime,i)/f;let D=Math.floor(O),B=O%1;!B&&O>=1&&(B=1),B===1&&D--,D=Math.min(D,g+1),!!(D%2)&&(b==="reverse"?(B=1-B,v&&(B-=v/f)):b==="mirror"&&(A=u)),k=Bo(0,1,B)*f}let M;E?(this.delayState.value=p[0],M=this.delayState):M=A.next(k),c&&!E&&(M.value=c(M.value));let{done:R}=M;!E&&h!==null&&(R=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return T&&w!==t1&&(M.value=Sx(p,this.options,S,this.speed)),C&&C(M.value),T&&this.finish(),M}then(t,r){return this.finished.then(t,r)}get duration(){return _r(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_r(t)}get time(){return _r(this.currentTime)}set time(t){t=fo(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return J3(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(As.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=_r(this.currentTime))}play(){var i,c;if(this.isStopped)return;const{driver:t=vH,startTime:r}=this.options;this.driver||(this.driver=t(u=>this.tick(u))),(c=(i=this.options).onPlay)==null||c.call(i);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=r??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(As.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(t=this.options).onComplete)==null||r.call(t)}cancel(){var t,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(t=this.options).onCancel)==null||r.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),t.observe(this)}}const LH=new Set(["brightness","contrast","saturate","opacity"]);function $H(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=r.match(aw)||[];if(!a)return e;const i=r.replace(a,"");let c=LH.has(t)?1:0;return a!==r&&(c*=100),t+"("+c+i+")"}const BH=/\b([a-z-]*)\(.*?\)/gu,n1={...$r,getAnimatableNone:e=>{const t=e.match(BH);return t?t.map($H).join(" "):e}},s1={...$r,getAnimatableNone:e=>{const t=$r.parse(e);return $r.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},q5={...$u,transform:Math.round},VH={rotate:$a,pathRotation:$a,rotateX:$a,rotateY:$a,rotateZ:$a,scale:Xm,scaleX:Xm,scaleY:Xm,scaleZ:Xm,skew:$a,skewX:$a,skewY:$a,distance:pt,translateX:pt,translateY:pt,translateZ:pt,x:pt,y:pt,z:pt,perspective:pt,transformPerspective:pt,opacity:Nf,originX:V5,originY:V5,originZ:pt},ug={borderWidth:pt,borderTopWidth:pt,borderRightWidth:pt,borderBottomWidth:pt,borderLeftWidth:pt,borderRadius:pt,borderTopLeftRadius:pt,borderTopRightRadius:pt,borderBottomRightRadius:pt,borderBottomLeftRadius:pt,width:pt,maxWidth:pt,height:pt,maxHeight:pt,top:pt,right:pt,bottom:pt,left:pt,inset:pt,insetBlock:pt,insetBlockStart:pt,insetBlockEnd:pt,insetInline:pt,insetInlineStart:pt,insetInlineEnd:pt,padding:pt,paddingTop:pt,paddingRight:pt,paddingBottom:pt,paddingLeft:pt,paddingBlock:pt,paddingBlockStart:pt,paddingBlockEnd:pt,paddingInline:pt,paddingInlineStart:pt,paddingInlineEnd:pt,margin:pt,marginTop:pt,marginRight:pt,marginBottom:pt,marginLeft:pt,marginBlock:pt,marginBlockStart:pt,marginBlockEnd:pt,marginInline:pt,marginInlineStart:pt,marginInlineEnd:pt,fontSize:pt,backgroundPositionX:pt,backgroundPositionY:pt,...VH,zIndex:q5,fillOpacity:Nf,strokeOpacity:Nf,numOctaves:q5},UH={...ug,color:xs,backgroundColor:xs,outlineColor:xs,fill:xs,stroke:xs,borderColor:xs,borderTopColor:xs,borderRightColor:xs,borderBottomColor:xs,borderLeftColor:xs,filter:n1,WebkitFilter:n1,mask:s1,WebkitMask:s1},nO=e=>UH[e],HH=new Set([n1,s1]);function hw(e,t){let r=nO(e);return HH.has(r)||(r=$r),r.getAnimatableNone?r.getAnimatableNone(t):void 0}function FH(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Wl=e=>e*180/Math.PI,r1=e=>{const t=Wl(Math.atan2(e[1],e[0]));return o1(t)},GH={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:r1,rotateZ:r1,skewX:e=>Wl(Math.atan(e[1])),skewY:e=>Wl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},o1=e=>(e=e%360,e<0&&(e+=360),e),Y5=r1,K5=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),X5=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),qH={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:K5,scaleY:X5,scale:e=>(K5(e)+X5(e))/2,rotateX:e=>o1(Wl(Math.atan2(e[6],e[5]))),rotateY:e=>o1(Wl(Math.atan2(-e[2],e[0]))),rotateZ:Y5,rotate:Y5,skewX:e=>Wl(Math.atan(e[4])),skewY:e=>Wl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function a1(e){return e.includes("scale")?1:0}function i1(e,t){if(!e||e==="none")return a1(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(r)a=qH,i=r;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=GH,i=f}if(!i)return a1(t);const c=a[t],u=i[1].split(",").map(KH);return typeof c=="function"?c(u):u[c]}const YH=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return i1(r,t)};function KH(e){return parseFloat(e.trim())}const Bu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vu=new Set([...Bu,"pathRotation"]),W5=e=>e===$u||e===pt,XH=new Set(["x","y","z"]),WH=Bu.filter(e=>!XH.has(e));function QH(e){const t=[];return WH.forEach(r=>{const a=e.getValue(r);if(a!==void 0){const i=a.get(),c=r.startsWith("scale")?1:0;if(i===c)return;t.push([r,i]),a.set(c)}}),t}const ZH=new Set(["bottom","right"]);function Q5(e,t,r,a,i,c){const u=parseFloat(e);if(!isNaN(u))return u;const{min:f,max:h}=t()[r],m=h-f;return c==="border-box"?m:m-parseFloat(a)-parseFloat(i)}const Jl={width:({width:e,paddingLeft:t="0",paddingRight:r="0",boxSizing:a},i)=>Q5(e,i,"x",t,r,a),height:({height:e,paddingTop:t="0",paddingBottom:r="0",boxSizing:a},i)=>Q5(e,i,"y",t,r,a),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:r}=t();return parseFloat(e)+(r.max-r.min)},right:({left:e},t)=>{const{x:r}=t();return parseFloat(e)+(r.max-r.min)},x:({transform:e})=>i1(e,"x"),y:({transform:e})=>i1(e,"y")};Jl.translateX=Jl.x;Jl.translateY=Jl.y;const ec=new Set;let l1=!1,c1=!1,u1=!1;function sO(){if(c1){const e=[],t=new Set,r=new Set;ec.forEach(i=>{i.needsMeasurement&&(e.push(i),t.add(i.element),ZH.has(i.name)&&r.add(i.element))});const a=new Map;r.forEach(i=>{const c=QH(i);c.length&&(a.set(i,c),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const c=a.get(i);c&&c.forEach(([u,f])=>{var h;(h=i.getValue(u))==null||h.set(f)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}c1=!1,l1=!1,ec.forEach(e=>e.complete(u1)),ec.clear()}function rO(){ec.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(c1=!0)})}function JH(){u1=!0,rO(),sO(),u1=!1}function eF(e,t,r){if(typeof e=="string"){if(ew(e)||tw(e))return parseFloat(e);if(!$r.test(e)&&$r.test(r))return hw(t,r)}return e??void 0}class mw{constructor(t,r,a,i,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=a,this.motionValue=i,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(ec.add(this),l1||(l1=!0,jn.read(rO),jn.resolveKeyframes(sO))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:a,motionValue:i}=this;if(t[0]===null){const c=i==null?void 0:i.get(),u=t[t.length-1];if(c!==void 0)t[0]=c;else if(a&&r){const f=eF(a.readValue(r,u),r,u);f!==void 0&&(t[0]=f)}t[0]===void 0&&(t[0]=u),i&&c===void 0&&i.set(t[0])}FH(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ec.delete(this)}cancel(){this.state==="scheduled"&&(ec.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const tF=e=>e.startsWith("--");function oO(e,t,r){tF(t)?e.style.setProperty(t,r):e.style[t]=r}const nF={};function aO(e,t){const r=A3(e);return()=>nF[t]??r()}const sF=aO(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),iO=aO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Jd=([e,t,r,a])=>`cubic-bezier(${e}, ${t}, ${r}, ${a})`,Z5={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Jd([0,.65,.55,1]),circOut:Jd([.55,0,1,.45]),backIn:Jd([.31,.01,.66,-.59]),backOut:Jd([.33,1.53,.69,.99])};function lO(e,t){if(e)return typeof e=="function"?iO()?Q3(e,t):"ease-out":B3(e)?Jd(e):Array.isArray(e)?e.map(r=>lO(r,t)||Z5.easeOut):Z5[e]}function rF(e,t,r,{delay:a=0,duration:i=300,repeat:c=0,repeatType:u="loop",ease:f="easeOut",times:h}={},m=void 0){const p={[t]:r};h&&(p.offset=h);const g=lO(f,i);Array.isArray(g)&&(p.easing=g);const b={delay:a,duration:i,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),e.animate(p,b)}function cO(e){return typeof e=="function"&&"applyToOptions"in e}function oF({type:e,...t}){return cO(e)&&iO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class uO extends Nx{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:a,keyframes:i,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:f,onComplete:h}=t;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=t,jx(typeof t.type!="string");const m=oF(t);this.animation=rF(r,a,i,m,c),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const p=Sx(i,this.options,f,this.speed);this.updateMotionValue&&this.updateMotionValue(p),oO(r,a,p),this.animation.cancel()}h==null||h(),this.notifyFinished()},tO(this,t,m)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,r;(r=(t=this.animation).finish)==null||r.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var r,a,i;const t=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(a=this.animation).commitStyles)==null||i.call(a))}get duration(){var r,a;const t=((a=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:a.call(r).duration)||0;return _r(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_r(t)}get time(){return _r(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=fo(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:a,observe:i}){var c;return this.allowFlatten&&((c=this.animation.effect)==null||c.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&sF()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),a&&(this.animation.rangeEnd=a),_o):i(this)}}const dO={anticipate:_3,backInOut:P3,circInOut:$3};function aF(e){return e in dO}function iF(e){typeof e.ease=="string"&&aF(e.ease)&&(e.ease=dO[e.ease])}const Vv=10;class lF extends uO{constructor(t){iF(t),fw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:a,onComplete:i,element:c,...u}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const f=new cg({...u,autoplay:!1}),h=Math.max(Vv,As.now()-this.startTime),m=Bo(0,Vv,h-Vv),p=f.sample(h).value,{name:g}=this.options;c&&g&&oO(c,g,p),r.setWithVelocity(f.sample(Math.max(0,h-m)).value,p,m),f.stop()}}const J5=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&($r.test(e)||e==="0")&&!e.startsWith("url("));function cF(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function uF(e,t,r,a){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],u=J5(i,t),f=J5(c,t);return!u||!f?!1:cF(e)||(r==="spring"||cO(r))&&a}function d1(e){e.duration=0,e.type="keyframes"}const f1=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),dF=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function fF(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&dF.test(e[t]))return!0;return!1}const eT=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),hF=A3(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function mF(e){var g;const{motionValue:t,name:r,repeatDelay:a,repeatType:i,damping:c,type:u,keyframes:f}=e;if(!r||!(f1.has(r)||eT.has(r)))return!1;const h=(g=t==null?void 0:t.owner)==null?void 0:g.current;if(!(h instanceof HTMLElement)&&!(h instanceof SVGElement))return!1;const{onUpdate:m,transformTemplate:p}=t.owner.getProps();return hF()&&(f1.has(r)||eT.has(r)&&fF(f))&&(r!=="transform"||!p)&&!m&&!a&&i!=="mirror"&&c!==0&&u!=="inertia"}const pF=40;class gF extends Nx{constructor(t){var h;super(),this.stop=()=>{var m,p;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(p=this.keyframeResolver)==null||p.cancel()},this.createdAt=As.now();const{keyframes:r,name:a,motionValue:i,element:c}=t,u=t;u.autoplay??(u.autoplay=!0),u.delay??(u.delay=0),u.type??(u.type="keyframes"),u.repeat??(u.repeat=0),u.repeatDelay??(u.repeatDelay=0),u.repeatType??(u.repeatType="loop");const f=(c==null?void 0:c.KeyframeResolver)||mw;this.keyframeResolver=new f(r,(m,p,g)=>this.onKeyframesResolved(m,p,u,!g),a,i,c),(h=this.keyframeResolver)==null||h.scheduleResolve()}onKeyframesResolved(t,r,a,i){var S,N;this.keyframeResolver=void 0;const{name:c,type:u,velocity:f,delay:h,isHandoff:m,onUpdate:p}=a;this.resolvedAt=As.now();let g=!0;uF(t,c,u,f)||(g=!1,(Qa.instantAnimations||!h)&&(p==null||p(Sx(t,a,r))),t[0]=t[t.length-1],d1(a),a.repeat=0);const b=i?this.resolvedAt?this.resolvedAt-this.createdAt>pF?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:v}=a;a.startTime??(a.startTime=b),a.finalKeyframe=r,a.keyframes=t,a.onComplete=()=>{v==null||v(),this.notifyFinished()};const w=g&&!m&&mF(a);let C;if(w){a.element=(N=(S=a.motionValue)==null?void 0:S.owner)==null?void 0:N.current;try{C=new lF(a)}catch{C=new cg(a)}}else C=new cg(a);this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}get finished(){return this._animation?this._animation.finished:super.finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),JH()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function fO(e,t,r,a=0,i=1){const c=Array.from(e).sort((m,p)=>m.sortNodePosition(p)).indexOf(t),u=e.size,f=(u-1)*a;return typeof r=="function"?r(c,u):i===1?c*a:f-c*a}const tT=30,xF=e=>!isNaN(parseFloat(e)),of={current:void 0};class bF{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=As.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=As.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xF(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){var a;return t==="change"?this.onChangeSubscribe(r):((a=this.events)[t]||(a[t]=new ag)).add(r)}onChangeSubscribe(t){const{events:r}=this;return!r.change&&!this.changeSubscriber?this.changeSubscriber=t:(r.change||(r.change=new ag,r.change.add(this.changeSubscriber),this.changeSubscriber=void 0),r.change.add(t)),()=>{var a;this.changeSubscriber===t?this.changeSubscriber=void 0:(a=r.change)==null||a.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){jn.read(()=>{var t;!this.changeSubscriber&&!((t=this.events.change)!=null&&t.getSize())&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,a){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){var a;const{current:t,changeSubscriber:r}=this;r?r(t):(a=this.events.change)==null||a.notify(t)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return of.current&&of.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=As.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>tT)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,tT);return M3(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{var c;this.hasAnimated=!0;let a=!1,i;i=t(()=>{var u;a=!0,(u=this.events.animationComplete)==null||u.notify(),this.animation===i&&this.clearAnimation(),r()}),a||(this.animation=i),(c=this.events.animationStart)==null||c.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){var t,r;(t=this.dependents)==null||t.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ic(e,t){return new bF(e,t)}function hO(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...a}=e;return{...t,...a}}return e}function pw(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?hO(r,e):r}const vF={type:"spring",stiffness:500,damping:25,restSpeed:10},yF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),wF={type:"keyframes",duration:.8},jF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},SF=(e,{keyframes:t})=>t.length>2?wF:Vu.has(e)?e.startsWith("scale")?yF(t[1]):vF:jF,NF=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function CF(e){for(const t in e)if(!NF.has(t))return!0;return!1}const gw=(e,t,r,a={},i,c)=>u=>{const f=pw(a,e)||{},h=f.delay||a.delay||0;let{elapsed:m=0}=a;m=m-fo(h);const p={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-m,onUpdate:b=>{t.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:c?void 0:i};CF(f)||Object.assign(p,SF(e,p)),p.duration&&(p.duration=fo(p.duration)),p.repeatDelay&&(p.repeatDelay=fo(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(d1(p),p.delay===0&&(g=!0)),(Qa.instantAnimations||Qa.skipAnimations||i!=null&&i.shouldSkipAnimations||f.skipAnimations)&&(g=!0,d1(p),p.delay=0),p.allowFlatten=!f.type&&!f.ease,g&&!c&&t.get()!==void 0){const b=Sx(p.keyframes,f);if(b!==void 0){jn.update(()=>{p.onUpdate(b),p.onComplete()});return}}return f.isSync?new cg(p):new gF(p)},kF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function TF(e){const t=kF.exec(e);if(!t)return[,];const[,r,a,i]=t;return[`--${r??a}`,i]}function mO(e,t,r=1){const[a,i]=TF(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return ew(u)?parseFloat(u):u}return ow(i)?mO(i,t,r+1):i}function nT(e){const t=[{},{}];return e==null||e.values.forEach((r,a)=>{t[0][a]=r.get(),t[1][a]=r.getVelocity()}),t}function xw(e,t,r,a){if(typeof t=="function"){const[i,c]=nT(a);t=t(r!==void 0?r:e.custom,i,c)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,c]=nT(a);t=t(r!==void 0?r:e.custom,i,c)}return t}function tc(e,t,r){const a=e.getProps();return xw(a,t,r!==void 0?r:a.custom,e)}const pO=new Set(["width","height","top","left","right","bottom",...Bu]),h1=e=>Array.isArray(e);function EF(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,ic(r))}function RF(e){return h1(e)?e[e.length-1]||0:e}function AF(e,t){const r=tc(e,t);let{transitionEnd:a={},transition:i={},...c}=r||{};c={...c,...a};for(const u in c){const f=RF(c[u]);EF(e,u,f)}}const bs=e=>!!(e&&e.getVelocity);function MF(e){return!!(bs(e)&&e.add)}function m1(e,t){const r=e.getValue("willChange");if(MF(r))return r.add(t);if(!r&&Qa.WillChange){const a=new Qa.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function bw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const OF="framerAppearId",gO="data-"+bw(OF);function xO(e){return e.props[gO]}const DF=typeof window<"u";function zF({protectedKeys:e,needsAnimating:t},r){const a=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,a}function bO(e,t,{delay:r=0,transitionOverride:a,type:i}={}){let{transition:c,transitionEnd:u,...f}=t;const h=e.getDefaultTransition();c=c?hO(c,h):h;const m=c==null?void 0:c.reduceMotion,p=c==null?void 0:c.skipAnimations;a&&(c=a);const g=[],b=i&&e.animationState&&e.animationState.getState()[i],v=c==null?void 0:c.path;v&&v.animateVisualElement(e,f,c,r,g);for(const w in f){const C=e.getValue(w,e.latestValues[w]??null),S=f[w];if(S===void 0||b&&zF(b,w))continue;const N={delay:r,...pw(c||{},w)};p&&(N.skipAnimations=!0);const E=C.get();if(E!==void 0&&!C.isAnimating()&&!Array.isArray(S)&&S===E&&!N.velocity){jn.update(()=>C.set(S));continue}let k=!1;if(DF&&window.MotionHandoffAnimation){const R=xO(e);if(R){const T=window.MotionHandoffAnimation(R,w,jn);T!==null&&(N.startTime=T,k=!0)}}m1(e,w);const A=m??e.shouldReduceMotion;C.start(gw(w,C,S,A&&pO.has(w)?{type:!1}:N,e,k));const M=C.animation;M&&g.push(M)}if(u){const w=()=>jn.update(()=>{u&&AF(e,u)});g.length?Promise.all(g).then(w):w()}return g}function p1(e,t,r={}){var h;const a=tc(e,t,r.type==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};r.transitionOverride&&(i=r.transitionOverride);const c=a?()=>Promise.all(bO(e,a,r)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:b}=i;return IF(e,t,m,p,g,b,r)}:()=>Promise.resolve(),{when:f}=i;if(f){const[m,p]=f==="beforeChildren"?[c,u]:[u,c];return m().then(()=>p())}else return Promise.all([c(),u(r.delay)])}function IF(e,t,r=0,a=0,i=0,c=1,u){const f=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),f.push(p1(h,t,{...u,delay:r+(typeof a=="function"?0:a)+fO(e.variantChildren,h,a,i,c)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(f)}function PF(e,t,r={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(c=>p1(e,c,r));a=Promise.all(i)}else if(typeof t=="string")a=p1(e,t,r);else{const i=typeof t=="function"?tc(e,t,r.custom):t;a=Promise.all(bO(e,i,r))}return a.then(()=>{e.notify("AnimationComplete",t)})}const _F={test:e=>e==="auto",parse:e=>e},LF=e=>t=>t.test(e),$F=[$u,pt,aa,$a,ZU,QU,_F],sT=e=>$F.find(LF(e));function BF(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||tw(e):!0}const VF=new Set(["auto","none","0"]);function UF(e,t,r){let a=0,i;for(;a<e.length&&!i;){const c=e[a];typeof c=="string"&&!VF.has(c)&&rH(c)&&(i=e[a]),a++}if(i&&r)for(const c of t)e[c]!==i&&(e[c]=hw(r,i))}class HF extends mw{constructor(t,r,a,i,c){super(t,r,a,i,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:a}=this;if(!r||!r.current)return;super.readKeyframes();for(let p=0;p<t.length;p++){let g=t[p];if(typeof g=="string"&&(g=g.trim(),ow(g))){const b=mO(g,r.current);b!==void 0&&(t[p]=b),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!pO.has(a)||t.length!==2)return;const[i,c]=t;if(typeof i=="number"&&typeof c=="number")return;const u=sT(i),f=sT(c),h=B5(i),m=B5(c);if(h!==m&&Jl[a]){this.needsMeasurement=!0;return}if(u!==f)if(W5(u)&&W5(f))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else Jl[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,a=[];for(let i=0;i<t.length;i++)(t[i]===null||BF(t[i]))&&a.push(i);a.length&&UF(t,a,r)}measure(){const{element:t,name:r}=this;return Jl[r](window.getComputedStyle(t.current),()=>t.measureViewportBox())}measureInitialState(){var c;const{element:t,unresolvedKeyframes:r,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),r[0]=this.measuredOrigin;const i=r[r.length-1];i!==void 0&&((c=this.motionValue)==null||c.jump(i,!1))}measureEndState(){var c,u;const{element:t,unresolvedKeyframes:r}=this;if(!t||!t.current)return;(c=this.motionValue)==null||c.jump(this.measuredOrigin,!1);const a=r.length-1,i=r[a];r[a]=this.measure(),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(u=this.removedTransforms)!=null&&u.length&&this.removedTransforms.forEach(([f,h])=>{t.getValue(f).set(h)}),this.resolveNoneKeyframes()}}const vw=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Tp(e){return R3(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function yw(e){return R3(e)&&"ownerSVGElement"in e}const g1=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function ww(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){const i=document.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(a=>a!=null)}const FF={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},GF=Bu.length;function qF(e,t,r){let a="",i=!0;for(let u=0;u<GF;u++){const f=Bu[u],h=e[f];if(h===void 0)continue;let m=!0;if(typeof h=="number")m=h===(f.startsWith("scale")?1:0);else{const p=parseFloat(h);m=f.startsWith("scale")?p===1:p===0}if(!m||r){const p=g1(h,ug[f]);if(!m){i=!1;const g=FF[f]||f;a+=`${g}(${p}) `}r&&(t[f]=p)}}const c=e.pathRotation;return c&&(i=!1,a+=`rotate(${g1(c,ug.pathRotation)}) `),a=a.trim(),r?a=r(t,i?"":a):i&&(a="none"),a}function jw(e,t,r){const{style:a,vars:i,transformOrigin:c}=e;let u=!1,f=!1;for(const h in t){const m=t[h];if(Vu.has(h)){u=!0;continue}else if(H3(h)){i[h]=m;continue}else{const p=g1(m,ug[h]);h.startsWith("origin")?(f=!0,c[h]=p):a[h]=p}}if(t.transform||(u||r?a.transform=qF(t,e.transform,r):a.transform&&(a.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:p=0}=c;a.transformOrigin=`${h} ${m} ${p}`}}const YF={offset:"stroke-dashoffset",array:"stroke-dasharray"},KF={offset:"strokeDashoffset",array:"strokeDasharray"};function XF(e,t,r=1,a=0,i=!0){e.pathLength=1;const c=i?YF:KF;e[c.offset]=`${-a}`,e[c.array]=`${t} ${r}`}const vO=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yO(e,{attrX:t,attrY:r,attrScale:a,pathLength:i,pathSpacing:c=1,pathOffset:u=0,...f},h,m,p){if(jw(e,f,m),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:b}=e;for(const v of vO)g[v]!==void 0&&(b[v]=g[v],delete g[v]);(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=(p==null?void 0:p.transformBox)??"fill-box",delete g.transformBox),t!==void 0&&(g.x=t),r!==void 0&&(g.y=r),a!==void 0&&(g.scale=a),i!==void 0&&XF(g,i,c,u,!1)}function wO({top:e,left:t,right:r,bottom:a}){return{x:{min:t,max:r},y:{min:e,max:a}}}function WF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function QF(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:a.y,right:a.x}}function Uv(e){return e===void 0||e===1}function x1({scale:e,scaleX:t,scaleY:r}){return!Uv(e)||!Uv(t)||!Uv(r)}function Fl(e){return x1(e)||jO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function jO(e){return rT(e.x)||rT(e.y)}function rT(e){return e&&e!=="0%"}function dg(e,t,r){const a=e-r,i=t*a;return r+i}function oT(e,t,r,a,i){return i!==void 0&&(e=dg(e,i,a)),dg(e,r,a)+t}function b1(e,t=0,r=1,a,i){e.min=oT(e.min,t,r,a,i),e.max=oT(e.max,t,r,a,i)}function SO(e,{x:t,y:r}){b1(e.x,t.translate,t.scale,t.originPoint),b1(e.y,r.translate,r.scale,r.originPoint)}const aT=.999999999999,iT=1.0000000000001;function ZF(e,t,r,a=!1){var f;const i=r.length;if(!i)return;t.x=t.y=1;let c,u;for(let h=0;h<i;h++){c=r[h],u=c.projectionDelta;const{visualElement:m}=c.options;m&&m.props.style&&m.props.style.display==="contents"||(a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&(sa(e.x,-c.scroll.offset.x),sa(e.y,-c.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,SO(e,u)),a&&Fl(c.latestValues)&&Ep(e,c.latestValues,(f=c.layout)==null?void 0:f.layoutBox))}t.x<iT&&t.x>aT&&(t.x=1),t.y<iT&&t.y>aT&&(t.y=1)}function sa(e,t){e.min+=t,e.max+=t}function lT(e,t,r,a,i=.5){const c=Tn(e.min,e.max,i);b1(e,t,r,c,a)}function cT(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ep(e,t,r){const a=r??e;lT(e.x,cT(t.x,a.x),t.scaleX,t.scale,t.originX),lT(e.y,cT(t.y,a.y),t.scaleY,t.scale,t.originY)}function NO(e,t){return wO(QF(e.getBoundingClientRect(),t))}function JF(e,t,r){const a=NO(e,r),{scroll:i}=t;return i&&(sa(a.x,i.offset.x),sa(a.y,i.offset.y)),a}const{schedule:Sw}=V3(queueMicrotask,!1),Mo={x:!1,y:!1};function CO(){return Mo.x||Mo.y}function eG(e){return e==="x"||e==="y"?Mo[e]?null:(Mo[e]=!0,()=>{Mo[e]=!1}):Mo.x||Mo.y?null:(Mo.x=Mo.y=!0,()=>{Mo.x=Mo.y=!1})}function kO(e,t){const r=ww(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[r,i,()=>a.abort()]}function tG(e){return!(e.pointerType==="touch"||CO())}function nG(e,t,r={}){const[a,i,c]=kO(e,r);return a.forEach(u=>{let f=!1,h=!1,m;const p=()=>{u.removeEventListener("pointerleave",w)},g=S=>{m&&(m(S),m=void 0),p()},b=S=>{f=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),h&&(h=!1,g(S))},v=()=>{f=!0,window.addEventListener("pointerup",b,i),window.addEventListener("pointercancel",b,i)},w=S=>{if(S.pointerType!=="touch"){if(f){h=!0;return}g(S)}},C=S=>{if(!tG(S))return;h=!1;const N=t(u,S);typeof N=="function"&&(m=N,u.addEventListener("pointerleave",w,i))};u.addEventListener("pointerenter",C,i),u.addEventListener("pointerdown",v,i)}),c}const TO=(e,t)=>t?e===t?!0:TO(e,t.parentElement):!1,Nw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,sG=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function rG(e){return sG.has(e.tagName)||e.isContentEditable===!0}const oG=new Set(["INPUT","SELECT","TEXTAREA"]);function aG(e){return oG.has(e.tagName)||e.isContentEditable===!0}const Rp=new WeakSet;function uT(e){return t=>{t.key==="Enter"&&e(t)}}function Hv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const iG=(e,t)=>{const r=e.currentTarget;if(!r)return;const a=uT(()=>{if(Rp.has(r))return;Hv(r,"down");const i=uT(()=>{Hv(r,"up")}),c=()=>Hv(r,"cancel");r.addEventListener("keyup",i,t),r.addEventListener("blur",c,t)});r.addEventListener("keydown",a,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",a),t)};function dT(e){return Nw(e)&&!CO()}const fT=new WeakSet;function lG(e,t,r={}){const[a,i,c]=kO(e,r),u=f=>{const h=f.currentTarget;if(!dT(f)||fT.has(f))return;Rp.add(h),r.stopPropagation&&fT.add(f);const m=t(h,f),p={...i,capture:!0},g=(w,C)=>{window.removeEventListener("pointerup",b,p),window.removeEventListener("pointercancel",v,p),Rp.has(h)&&Rp.delete(h),dT(w)&&typeof m=="function"&&m(w,{success:C})},b=w=>{g(w,h===window||h===document||r.useGlobalTarget||TO(h,w.target))},v=w=>{g(w,!1)};window.addEventListener("pointerup",b,p),window.addEventListener("pointercancel",v,p)};return a.forEach(f=>{(r.useGlobalTarget?window:f).addEventListener("pointerdown",u,i),Tp(f)&&(f.addEventListener("focus",m=>iG(m,i)),!rG(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}const Ap=new WeakMap;let _i;const EO=(e,t,r)=>(a,i)=>i&&i[0]?i[0][e+"Size"]:yw(a)&&"getBBox"in a?a.getBBox()[t]:a[r],cG=EO("inline","width","offsetWidth"),uG=EO("block","height","offsetHeight");function dG({target:e,borderBoxSize:t}){var r;(r=Ap.get(e))==null||r.forEach(a=>{a(e,{get width(){return cG(e,t)},get height(){return uG(e,t)}})})}function fG(e){e.forEach(dG)}function hG(){typeof ResizeObserver>"u"||(_i=new ResizeObserver(fG))}function mG(e,t){_i||hG();const r=ww(e);return r.forEach(a=>{let i=Ap.get(a);i||(i=new Set,Ap.set(a,i)),i.add(t),_i==null||_i.observe(a)}),()=>{r.forEach(a=>{const i=Ap.get(a);i==null||i.delete(t),i!=null&&i.size||_i==null||_i.unobserve(a)})}}const Mp=new Set;let du;function pG(){du=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Mp.forEach(t=>t(e))},window.addEventListener("resize",du)}function gG(e){return Mp.add(e),du||pG(),()=>{Mp.delete(e),!Mp.size&&typeof du=="function"&&(window.removeEventListener("resize",du),du=void 0)}}function hT(e,t){return typeof e=="function"?gG(e):mG(e,t)}function xG(e){return yw(e)&&e.tagName==="svg"}function bG(...e){const t=!Array.isArray(e[0]),r=t?0:-1,a=e[0+r],i=e[1+r],c=e[2+r],u=e[3+r],f=Z3(i,c,u);return t?f(a):f}const ef=new Set,mT=({timestamp:e})=>{ef.forEach(t=>t.tick(e))};class vG extends Nx{constructor(t){super(),this.state="idle",this.startTime=0,this.currentTime=0,this.started=!1,this.hasNextTarget=!1,this.nextTarget=0,this.stop=()=>{var a,i;this.state!=="idle"&&(this.teardown(),(i=(a=this.options).onStop)==null||i.call(a))},this.options=t,fw(t),this.factory=t.type||wu,this.generator=this.factory(t);const{driver:r}=t;r&&(this.driver=r(a=>this.tick(a))),this.startTime=this.now(),this.state="running",this.driver?this.driver.start():(ef.size||jn.update(mT,!0),ef.add(this))}setTarget(t,r){this.nextTarget=t,this.nextVelocity=r,this.hasNextTarget=!0}retarget(t,r){const{options:a,generator:i}=this;a.keyframes=t,a.velocity=r,this.startTime=this.now(),this.currentTime=0,i.retarget?i.retarget(t,r):this.generator=this.factory(a)}tick(t){var g;const{options:r,hasNextTarget:a}=this,{delay:i=0,onUpdate:c,onPlay:u}=r,f=Math.round(t-this.startTime)-i,h=this.currentTime=Math.max(0,f),m=this.generator.next(h),p=f<0?r.keyframes[0]:m.value;if(a){this.hasNextTarget=!1;const{keyframes:b}=r;b[0]=p,b[1]=this.nextTarget,this.retarget(b,this.nextVelocity??this.getGeneratorVelocity())}(a||!this.started)&&(this.started=!0,u==null||u()),this.state==="running"&&(c==null||c(p),m.done&&f>=0&&!a&&!this.hasNextTarget&&this.state==="running"&&(this.notifyFinished(),this.teardown(),this.state="finished",(g=r.onComplete)==null||g.call(r)))}getGeneratorVelocity(){return J3(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():As.now()}teardown(){this.state="idle",this.driver?this.driver.stop():(ef.delete(this),ef.size||pa(mT))}}function yG(e,t,r={}){const a=e.get();let i=null,c;const u=typeof a=="string"?a.replace(/[\d.-]/g,""):void 0,f=p=>c(u?p+u:p),h=()=>{var p;return(p=e.events.animationStart)==null?void 0:p.notify()},m=()=>{i&&(i.stop(),i=null),e.animation=void 0};if(e.attach((p,g)=>{c=g;const b=gT(p);if((i==null?void 0:i.state)==="running"){i.setTarget(b,r.velocity);return}const v=gT(e.get()),w=i?i.getGeneratorVelocity():e.getVelocity();if(m(),v===b)return;const C={keyframes:[v,b],velocity:w,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:f},S=i=new vG({...C,onPlay:h});e.animation=S,S.then(()=>{var N;i===S&&(i=null,e.animation=void 0,(N=e.events.animationComplete)==null||N.notify())})},m),bs(t)){let p=r.skipInitialAnimation===!0;const g=t.on("change",v=>{p?(p=!1,e.jump(pT(v,u),!1)):e.set(pT(v,u))}),b=e.on("destroy",g);return()=>{g(),b()}}return m}function pT(e,t){return t?e+t:e}function gT(e){return typeof e=="number"?e:parseFloat(e)}const xT=()=>({translate:0,scale:1,origin:0,originPoint:0}),fu=()=>({x:xT(),y:xT()}),bT=()=>({min:0,max:0}),gs=()=>({x:bT(),y:bT()}),wG=new WeakMap;function Cx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function kf(e){return typeof e=="string"||Array.isArray(e)}const Cw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fg=["initial",...Cw];function kx(e){if(Cx(e.animate))return!0;for(let t=0;t<fg.length;t++)if(kf(e[fg[t]]))return!0;return!1}function RO(e){return!!(kx(e)||e.variants)}function jG(e,t,r){for(const a in t){const i=t[a],c=r[a];if(bs(i))e.addValue(a,i);else if(bs(c))e.addValue(a,ic(i,{owner:e}));else if(c!==i)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(a);e.addValue(a,ic(u!==void 0?u:i,{owner:e}))}}for(const a in r)t[a]===void 0&&e.removeValue(a);return t}const hg={current:null},kw={current:!1},SG=typeof window<"u";function AO(){if(kw.current=!0,!!SG)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>hg.current=e.matches;e.addEventListener("change",t),t()}else hg.current=!1}const vT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let mg={};function MO(e){mg=e}function NG(){return mg}class CG{scrapeMotionValuesFromProps(t,r,a){return{}}constructor({parent:t,props:r,presenceContext:a,reducedMotionConfig:i,skipAnimations:c,blockInitialAnimation:u,visualState:f},h={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=mw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=As.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,jn.render(this.render,!1,!0))};const{latestValues:m,renderState:p}=f;this.latestValues=m,this.baseTarget={...m},this.initialValues=r.initial?{...m}:{},this.renderState=p,this.parent=t,this.props=r,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=c,this.options=h,this.blockInitialAnimation=!!u,this.isControllingVariants=kx(r),this.isVariantNode=RO(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...b}=this.scrapeMotionValuesFromProps(r,{},this);for(const v in b){const w=b[v];m[v]!==void 0&&bs(w)&&w.set(m[v])}}mount(t){var r,a;if(this.hasBeenMounted)for(const i in this.initialValues)(r=this.values.get(i))==null||r.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=t,wG.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,c)=>this.bindToMotionValue(c,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(kw.current||AO(),this.shouldReduceMotion=hg.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(a=this.parent)==null||a.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),pa(this.notifyUpdate),pa(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const a=this.features[r];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&f1.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:h,ease:m,duration:p}=r.accelerate,g=new uO({element:this.current,name:t,keyframes:f,times:h,ease:m,duration:fo(p)}),b=u(g);this.valueSubscriptions.set(t,()=>{b(),g.cancel()});return}const a=Vu.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=r.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&jn.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;typeof window<"u"&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{i(),c&&c()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in mg){const r=mg[t];if(!r)continue;const{isEnabled:a,Feature:i}=r;if(!this.features[t]&&i&&a(this.props)&&(this.features[t]=new i(this)),this.features[t]){const c=this.features[t];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):gs()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let a=0;a<vT.length;a++){const i=vT[a];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const c="on"+i,u=t[c];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=jG(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const a=this.values.get(t);r!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&r!==void 0&&(a=ic(r===null?void 0:r,{owner:this}),this.addValue(t,a)),a}readValue(t,r){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(ew(a)||tw(a))?a=parseFloat(a):typeof a!="number"&&!$r.test(a)&&$r.test(r)&&(a=hw(t,r)),this.setBaseTarget(t,bs(a)?a.get():a)),bs(a)?a.get():a}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var c;const{initial:r}=this.props;let a;if(typeof r=="string"||typeof r=="object"){const u=xw(this.props,r,(c=this.presenceContext)==null?void 0:c.custom);u&&(a=u[t])}if(r&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!bs(i)?i:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new ag),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){Sw.render(this.render)}}class OO extends CG{constructor(){super(...arguments),this.KeyframeResolver=HF}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const a=t.style;return a?a[r]:void 0}removeValueFromRenderState(t,{vars:r,style:a}){delete r[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;bs(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class il{constructor(t){this.isMounted=!1,this.node=t}update(){}}function DO(e,{style:t,vars:r},a,i){const c=e.style;let u;for(u in t)c[u]=t[u];i==null||i.applyProjectionStyles(c,a);for(u in r)c.setProperty(u,r[u])}function yT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Fd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(pt.test(e))e=parseFloat(e);else return e;const r=yT(e,t.target.x),a=yT(e,t.target.y);return`${r}% ${a}%`}},kG={correct:(e,{treeScale:t,projectionDelta:r})=>{const a=e,i=$r.parse(e);if(i.length>5)return a;const c=$r.createTransformer(e),u=typeof i[0]!="number"?1:0,f=r.x.scale*t.x,h=r.y.scale*t.y;i[0+u]/=f,i[1+u]/=h;const m=Tn(f,h,.5);return typeof i[2+u]=="number"&&(i[2+u]/=m),typeof i[3+u]=="number"&&(i[3+u]/=m),c(i)}},v1={borderRadius:{...Fd,applyTo:[...vw]},borderTopLeftRadius:Fd,borderTopRightRadius:Fd,borderBottomLeftRadius:Fd,borderBottomRightRadius:Fd,boxShadow:kG};function zO(e,{layout:t,layoutId:r}){return Vu.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!v1[e]||e==="opacity")}function Tw(e,t,r){var u;const a=e.style,i=t==null?void 0:t.style,c={};if(!a)return c;for(const f in a)(bs(a[f])||i&&bs(i[f])||zO(f,e)||((u=r==null?void 0:r.getValue(f))==null?void 0:u.liveStyle)!==void 0)&&(c[f]=a[f]);return c}function TG(e){return window.getComputedStyle(e)}class EG extends OO{constructor(){super(...arguments),this.type="html",this.renderInstance=DO}mount(t){jx(!!t.style),super.mount(t)}readValueFromInstance(t,r){var a;if(Vu.has(r))return(a=this.projection)!=null&&a.isProjecting?a1(r):YH(t,r);{const i=TG(t),c=(H3(r)?i.getPropertyValue(r):i[r])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(t,{transformPagePoint:r}){return NO(t,r)}build(t,r,a){jw(t,r,a.transformTemplate)}scrapeMotionValuesFromProps(t,r,a){return Tw(t,r,a)}}const IO=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),PO=e=>typeof e=="string"&&e.toLowerCase()==="svg";function RG(e,t,r,a){DO(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(IO.has(i)?i:bw(i),t.attrs[i])}function _O(e,t,r){const a=Tw(e,t,r);for(const i in e)if(bs(e[i])||bs(t[i])){const c=Bu.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[c]=e[i]}return a}class AG extends OO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=gs}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Vu.has(r)){const a=nO(r);return a&&a.default||0}if(vO.includes(r)){const i=getComputedStyle(t)[r];if(typeof i=="string"&&i)return i.trim()}return r=IO.has(r)?r:bw(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,a){return _O(t,r,a)}build(t,r,a){yO(t,r,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,r,a,i){RG(t,r,a,i)}mount(t){this.isSVGTag=PO(t.tagName),super.mount(t)}}const MG=fg.length;function LO(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?LO(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<MG;r++){const a=fg[r],i=e.props[a];(kf(i)||i===!1)&&(t[a]=i)}return t}function $O(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let a=0;a<r;a++)if(t[a]!==e[a])return!1;return!0}const OG=[...Cw].reverse(),DG=Cw.length;function zG(e){return t=>Promise.all(t.map(({animation:r,options:a})=>PF(e,r,a)))}function IG(e){let t=zG(e),r=wT(),a=!0,i=!1;const c=m=>(p,g)=>{var v;const b=tc(e,g,m==="exit"?(v=e.presenceContext)==null?void 0:v.custom:void 0);if(b){const{transition:w,transitionEnd:C,...S}=b;p={...p,...S,...C}}return p};function u(m){t=m(e)}function f(m){const{props:p}=e,g=LO(e.parent)||{},b=[],v=new Set;let w={},C=1/0;for(let N=0;N<DG;N++){const E=OG[N],k=r[E],A=p[E]!==void 0?p[E]:g[E],M=kf(A),R=E===m?k.isActive:null;R===!1&&(C=N);let T=A===g[E]&&A!==p[E]&&M;if(T&&(a||i)&&e.manuallyAnimateOnMount&&(T=!1),k.protectedKeys={...w},!k.isActive&&R===null||!A&&!k.prevProp||Cx(A)||typeof A=="boolean")continue;if(E==="exit"&&k.isActive&&R!==!0){k.prevResolvedValues&&(w={...w,...k.prevResolvedValues});continue}const O=PG(k.prevProp,A);let D=O||E===m&&k.isActive&&!T&&M||N>C&&M,B=!1;const F=Array.isArray(A)?A:[A];let K=F.reduce(c(E),{});R===!1&&(K={});const{prevResolvedValues:$={}}=k,P={...$,...K},U=q=>{D=!0,v.has(q)&&(B=!0,v.delete(q)),k.needsAnimating[q]=!0;const Z=e.getValue(q);Z&&(Z.liveStyle=!1)};for(const q in P){const Z=K[q],z=$[q];if(w.hasOwnProperty(q))continue;let L=!1;h1(Z)&&h1(z)?L=!$O(Z,z)||O:L=Z!==z,L?Z!=null?U(q):v.add(q):Z!==void 0&&v.has(q)?U(q):k.protectedKeys[q]=!0}k.prevProp=A,k.prevResolvedValues=K,k.isActive&&(w={...w,...K}),(a||i)&&e.blockInitialAnimation&&(D=!1);const H=T&&O;D&&(!H||B)&&b.push(...F.map(q=>{const Z={type:E};if(typeof q=="string"&&(a||i)&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:z}=e,L=tc(z,q);if(z.enteringChildren&&L){const{delayChildren:X}=L.transition||{};Z.delay=fO(z.enteringChildren,e,X)}}return{animation:q,options:Z}}))}if(v.size){const N={};if(typeof p.initial!="boolean"){const E=tc(e,Array.isArray(p.initial)?p.initial[0]:p.initial);E&&E.transition&&(N.transition=E.transition)}v.forEach(E=>{const k=e.getBaseTarget(E),A=e.getValue(E);A&&(A.liveStyle=!0),N[E]=k??null}),b.push({animation:N})}let S=!!b.length;return a&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(S=!1),a=!1,i=!1,S?t(b):Promise.resolve()}function h(m,p){var b;if(r[m].isActive===p)return Promise.resolve();(b=e.variantChildren)==null||b.forEach(v=>{var w;return(w=v.animationState)==null?void 0:w.setActive(m,p)}),r[m].isActive=p;const g=f(m);for(const v in r)r[v].protectedKeys={};return g}return{animateChanges:f,setActive:h,setAnimateFunction:u,getState:()=>r,reset:()=>{r=wT(),i=!0}}}function PG(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!$O(t,e):!1}function Bl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wT(){return{animate:Bl(!0),whileInView:Bl(),whileHover:Bl(),whileTap:Bl(),whileDrag:Bl(),whileFocus:Bl(),exit:Bl()}}function y1(e,t){e.min=t.min,e.max=t.max}function Ao(e,t){y1(e.x,t.x),y1(e.y,t.y)}function jT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const BO=1e-4,_G=1-BO,LG=1+BO,VO=.01,$G=0-VO,BG=0+VO;function ar(e){return e.max-e.min}function VG(e,t,r){return Math.abs(e-t)<=r}function ST(e,t,r,a=.5){e.origin=a,e.originPoint=Tn(t.min,t.max,e.origin),e.scale=ar(r)/ar(t),e.translate=Tn(r.min,r.max,e.origin)-e.originPoint,(e.scale>=_G&&e.scale<=LG||isNaN(e.scale))&&(e.scale=1),(e.translate>=$G&&e.translate<=BG||isNaN(e.translate))&&(e.translate=0)}function af(e,t,r,a){ST(e.x,t.x,r.x,a?a.originX:void 0),ST(e.y,t.y,r.y,a?a.originY:void 0)}function NT(e,t,r,a=0){const i=a?Tn(r.min,r.max,a):r.min;e.min=i+t.min,e.max=e.min+ar(t)}function UG(e,t,r,a){NT(e.x,t.x,r.x,a==null?void 0:a.x),NT(e.y,t.y,r.y,a==null?void 0:a.y)}function CT(e,t,r,a=0){const i=a?Tn(r.min,r.max,a):r.min;e.min=t.min-i,e.max=e.min+ar(t)}function pg(e,t,r,a){CT(e.x,t.x,r.x,a==null?void 0:a.x),CT(e.y,t.y,r.y,a==null?void 0:a.y)}function kT(e,t,r,a,i){return e-=t,e=dg(e,1/r,a),i!==void 0&&(e=dg(e,1/i,a)),e}function HG(e,t=0,r=1,a=.5,i,c=e,u=e){if(aa.test(t)&&(t=parseFloat(t),t=Tn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=Tn(c.min,c.max,a);e===c&&(f-=t),e.min=kT(e.min,t,r,f,i),e.max=kT(e.max,t,r,f,i)}function TT(e,t,[r,a,i],c,u){HG(e,t[r],t[a],t[i],t.scale,c,u)}const FG=["x","scaleX","originX"],GG=["y","scaleY","originY"];function ET(e,t,r,a){TT(e.x,t,FG,r?r.x:void 0,a?a.x:void 0),TT(e.y,t,GG,r?r.y:void 0,a?a.y:void 0)}function RT(e){return e.translate===0&&e.scale===1}function UO(e){return RT(e.x)&&RT(e.y)}function AT(e,t){return e.min===t.min&&e.max===t.max}function qG(e,t){return AT(e.x,t.x)&&AT(e.y,t.y)}function MT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function HO(e,t){return MT(e.x,t.x)&&MT(e.y,t.y)}function OT(e){return ar(e.x)/ar(e.y)}function DT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ea(e){return[e("x"),e("y")]}function YG(e,t,r){let a="";const i=e.x.translate/t.x,c=e.y.translate/t.y,u=(r==null?void 0:r.z)||0;if((i||c||u)&&(a=`translate3d(${i}px, ${c}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:m,rotate:p,pathRotation:g,rotateX:b,rotateY:v,skewX:w,skewY:C}=r;m&&(a=`perspective(${m}px) ${a}`),p&&(a+=`rotate(${p}deg) `),g&&(a+=`rotate(${g}deg) `),b&&(a+=`rotateX(${b}deg) `),v&&(a+=`rotateY(${v}deg) `),w&&(a+=`skewX(${w}deg) `),C&&(a+=`skewY(${C}deg) `)}const f=e.x.scale*t.x,h=e.y.scale*t.y;return(f!==1||h!==1)&&(a+=`scale(${f}, ${h})`),a||"none"}const KG=vw.length,zT=e=>typeof e=="string"?parseFloat(e):e,IT=e=>typeof e=="number"||pt.test(e);function XG(e,t,r,a,i,c){i?(e.opacity=Tn(0,r.opacity??1,WG(a)),e.opacityExit=Tn(t.opacity??1,0,QG(a))):c&&(e.opacity=Tn(t.opacity??1,r.opacity??1,a));for(let u=0;u<KG;u++){const f=vw[u];let h=PT(t,f),m=PT(r,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||IT(h)===IT(m)?(e[f]=Math.max(Tn(zT(h),zT(m),a),0),(aa.test(m)||aa.test(h))&&(e[f]+="%")):e[f]=m}(t.rotate||r.rotate)&&(e.rotate=Tn(t.rotate||0,r.rotate||0,a))}function PT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const WG=FO(0,.5,L3),QG=FO(.5,.95,_o);function FO(e,t,r){return a=>a<e?0:a>t?1:r(Sf(e,t,a))}function ZG(e,t,r){const a=bs(e)?e:ic(e);return a.start(gw("",a,t,r)),a.animation}function Tf(e,t,r,a={passive:!0}){return e.addEventListener(t,r,a),()=>e.removeEventListener(t,r,a)}const JG=(e,t)=>e.depth-t.depth;class eq{constructor(){this.children=[],this.isDirty=!1}add(t){J2(this.children,t),this.isDirty=!0}remove(t){og(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(JG),this.isDirty=!1,this.children.forEach(t)}}function tq(e,t){const r=As.now(),a=({timestamp:i})=>{const c=i-r;c>=t&&(pa(a),e(c-t))};return jn.setup(a,!0),()=>pa(a)}function Op(e){return bs(e)?e.get():e}class nq{constructor(){this.members=[]}add(t){J2(this.members,t);for(let r=this.members.length-1;r>=0;r--){const a=this.members[r];if(a===t||a===this.lead||a===this.prevLead)continue;const i=a.instance;(!i||i.isConnected===!1)&&!a.snapshot&&(og(this.members,a),a.unmount())}t.scheduleRender()}remove(t){if(og(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){var r;for(let a=this.members.indexOf(t)-1;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1&&((r=i.instance)==null?void 0:r.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,r){var i;const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.updateSnapshot(),t.scheduleRender();const{layoutDependency:c}=a.options,{layoutDependency:u}=t.options;(c===void 0||c!==u)&&(t.resumeFrom=a,r&&(a.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var r,a,i,c,u;(a=(r=t.options).onExitComplete)==null||a.call(r),(u=(i=t.resumingFrom)==null?void 0:(c=i.options).onExitComplete)==null||u.call(c)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Dp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Fv=["","X","Y","Z"],sq=1e3;let rq=0;function Gv(e,t,r,a){const{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function GO(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=xO(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:c}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",jn,!(i||c))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&GO(a)}function qO({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},f=t==null?void 0:t()){this.id=rq++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(iq),this.nodes.forEach(hq),this.nodes.forEach(mq),this.nodes.forEach(lq)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new eq)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new ag),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const h=this.eventHandlers.get(u);h&&h.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=yw(u)&&!xG(u),this.instance=u;const{layoutId:f,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||f)&&(this.isLayoutDirty=!0),e){let p,g=0;const b=()=>this.root.updateBlockedByResize=!1;jn.read(()=>{g=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=tq(b,250),Dp.hasAnimatedSinceResize&&(Dp.hasAnimatedSinceResize=!1,this.nodes.forEach($T)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||h)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||m.getDefaultTransition()||vq,{onLayoutAnimationStart:C,onLayoutAnimationComplete:S}=m.getProps(),N=!this.targetLayout||!HO(this.targetLayout,v),E=!g&&b;if(this.options.layoutRoot||this.resumeFrom||E||g&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...pw(w,"layout"),onPlay:C,onComplete:S};(m.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(p,E,k.path)}else g||$T(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),pa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pq),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&GO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const h=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),h&&this.nodes.forEach(uq),this.nodes.forEach(_T);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(LT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(dq),this.nodes.forEach(fq),this.nodes.forEach(oq),this.nodes.forEach(aq)):this.nodes.forEach(LT),this.clearAllSnapshots();const f=As.now();Es.delta=Bo(0,1e3/60,f-Es.timestamp),Es.timestamp=f,Es.isProcessing=!0,Iv.update.process(Es),Iv.preRender.process(Es),Iv.render.process(Es),Es.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Sw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cq),this.sharedNodes.forEach(gq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,jn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){jn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ar(this.snapshot.measuredBox.x)&&!ar(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=gs()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f&&this.instance){const h=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!UO(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,p=m!==this.prevTransformTemplateValue;u&&this.instance&&(f||Fl(this.latestValues)||p)&&(i(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return u&&(h=this.removeTransform(h)),yq(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var m;const{visualElement:u}=this.options;if(!u)return gs();const f=u.measureViewportBox();if(!(((m=this.scroll)==null?void 0:m.wasRoot)||this.path.some(wq))){const{scroll:p}=this.root;p&&(sa(f.x,p.offset.x),sa(f.y,p.offset.y))}return f}removeElementScroll(u){var h;const f=gs();if(Ao(f,u),(h=this.scroll)!=null&&h.wasRoot)return f;for(let m=0;m<this.path.length;m++){const p=this.path[m],{scroll:g,options:b}=p;p!==this.root&&g&&b.layoutScroll&&(g.wasRoot&&Ao(f,u),sa(f.x,g.offset.x),sa(f.y,g.offset.y))}return f}applyTransform(u,f=!1,h){var p,g;const m=h||gs();Ao(m,u);for(let b=0;b<this.path.length;b++){const v=this.path[b];!f&&v.options.layoutScroll&&v.scroll&&v!==v.root&&(sa(m.x,-v.scroll.offset.x),sa(m.y,-v.scroll.offset.y)),Fl(v.latestValues)&&Ep(m,v.latestValues,(p=v.layout)==null?void 0:p.layoutBox)}return Fl(this.latestValues)&&Ep(m,this.latestValues,(g=this.layout)==null?void 0:g.layoutBox),m}removeTransform(u){var h;const f=gs();Ao(f,u);for(let m=0;m<this.path.length;m++){const p=this.path[m];if(!Fl(p.latestValues))continue;let g;p.instance&&(x1(p.latestValues)&&p.updateSnapshot(),g=gs(),Ao(g,p.measurePageBox())),ET(f,p.latestValues,(h=p.snapshot)==null?void 0:h.layoutBox,g)}return Fl(this.latestValues)&&ET(f,this.latestValues),f}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Es.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var v;const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(u||h&&this.isSharedProjectionDirty||this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=Es.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=gs(),this.targetWithTransforms=gs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),UG(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ao(this.target,this.layout.layoutBox),SO(this.target,this.targetDelta)):Ao(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||x1(this.parent.latestValues)||jO(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,f,h){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=gs(),this.relativeTargetOrigin=gs(),pg(this.relativeTargetOrigin,f,h,this.options.layoutAnchor||void 0),Ao(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var w;const u=this.getLead(),f=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||(w=this.parent)!=null&&w.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Es.timestamp&&(h=!1),h)return;const{layout:m,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||p))return;Ao(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;ZF(this.layoutCorrected,this.treeScale,this.path,f),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=gs());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(jT(this.prevProjectionDelta.x,this.projectionDelta.x),jT(this.prevProjectionDelta.y,this.projectionDelta.y)),af(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!DT(this.projectionDelta.x,this.prevProjectionDelta.x)||!DT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var f;if((f=this.options.visualElement)==null||f.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=fu(),this.projectionDelta=fu(),this.projectionDeltaWithTransform=fu()}setAnimationOrigin(u,f=!1,h){const m=this.snapshot,p=m?m.latestValues:{},g={...this.latestValues},b=fu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=gs(),w=m?m.source:void 0,C=this.layout?this.layout.source:void 0,S=w!==C,N=this.getStack(),E=!N||N.members.length<=1,k=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(bq));this.animationProgress=0;let A;const M=h==null?void 0:h.interpolateProjection(u);this.mixTargetDelta=R=>{const T=R/1e3,O=M==null?void 0:M(T);O?(b.x.translate=O.x,b.x.scale=Tn(u.x.scale,1,T),b.x.origin=u.x.origin,b.x.originPoint=u.x.originPoint,b.y.translate=O.y,b.y.scale=Tn(u.y.scale,1,T),b.y.origin=u.y.origin,b.y.originPoint=u.y.originPoint):(BT(b.x,u.x,T),BT(b.y,u.y,T)),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pg(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),xq(this.relativeTarget,this.relativeTargetOrigin,v,T),A&&qG(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=gs()),Ao(A,this.relativeTarget)),S&&(this.animationValues=g,XG(g,p,this.latestValues,T,k,E)),O&&O.rotate!==void 0&&(this.animationValues||(this.animationValues=g),this.animationValues.pathRotation=O.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){var f,h,m;this.notifyListeners("animationStart"),(f=this.currentAnimation)==null||f.stop(),(m=(h=this.resumingFrom)==null?void 0:h.currentAnimation)==null||m.stop(),this.pendingAnimation&&(pa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=jn.update(()=>{Dp.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ic(0)),this.motionValue.jump(0,!1),this.currentAnimation=ZG(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),PH(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sq),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead(),{targetWithTransforms:f,layout:h,latestValues:m}=u;let{target:p}=u;if(!(!f||!p||!h)){if(this!==u&&this.layout&&h&&YO(this.options.animationType,this.layout.layoutBox,h.layoutBox)){p=this.target||gs();const g=ar(this.layout.layoutBox.x);p.x.min=u.target.x.min,p.x.max=p.x.min+g;const b=ar(this.layout.layoutBox.y);p.y.min=u.target.y.min,p.y.max=p.y.min+b}Ao(f,p),Ep(f,m),af(this.projectionDeltaWithTransform,this.layoutCorrected,f,m)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new nq),this.sharedNodes.get(u).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var f;const{layoutId:u}=this.options;return u?((f=this.getStack())==null?void 0:f.lead)||this:this}getPrevLead(){var f;const{layoutId:u}=this.options;return u?(f=this.getStack())==null?void 0:f.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const m={};h.z&&Gv("z",u,m,this.animationValues);for(let p=0;p<Fv.length;p++)Gv(`rotate${Fv[p]}`,u,m,this.animationValues),Gv(`skew${Fv[p]}`,u,m,this.animationValues);u.render();for(const p in m)u.setStaticValue(p,m[p]),this.animationValues&&(this.animationValues[p]=m[p]);u.scheduleRender()}applyProjectionStyles(u,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Op(f==null?void 0:f.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Op(f==null?void 0:f.pointerEvents)||""),this.hasProjected&&!Fl(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=YG(this.projectionDeltaWithTransform,this.treeScale,p);h&&(g=h(p,g)),u.transform=g;const{x:b,y:v}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${v.origin*100}% 0`,m.animationValues?u.opacity=m===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=m===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const w in v1){if(p[w]===void 0)continue;const{correct:C,applyTo:S,isCSSVariable:N}=v1[w],E=g==="none"?p[w]:C(p[w],m);if(S){const k=S.length;for(let A=0;A<k;A++)u[S[A]]=E}else N?this.options.visualElement.renderState.vars[w]=E:u[w]=E}this.options.layoutId&&(u.pointerEvents=m===this?Op(f==null?void 0:f.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var f;return(f=u.currentAnimation)==null?void 0:f.stop()}),this.root.nodes.forEach(_T),this.root.sharedNodes.clear()}}}function oq(e){e.updateLayout()}function aq(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:i}=e.layout,{animationType:c}=e.options,u=t.source!==e.layout.source;if(c==="size")ea(g=>{const b=u?t.measuredBox[g]:t.layoutBox[g],v=ar(b);b.min=a[g].min,b.max=b.min+v});else if(c==="x"||c==="y"){const g=c==="x"?"y":"x";y1(u?t.measuredBox[g]:t.layoutBox[g],a[g])}else YO(c,t.layoutBox,a)&&ea(g=>{const b=u?t.measuredBox[g]:t.layoutBox[g],v=ar(a[g]);b.max=b.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+v)});const f=fu();af(f,a,t.layoutBox);const h=fu();u?af(h,e.applyTransform(i,!0),t.measuredBox):af(h,a,t.layoutBox);const m=!UO(f);let p=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:b,layout:v}=g;if(b&&v){const w=e.options.layoutAnchor||void 0,C=gs();pg(C,t.layoutBox,b.layoutBox,w);const S=gs();pg(S,a,v.layoutBox,w),HO(C,S)||(p=!0),g.options.layoutRoot&&(e.relativeTarget=S,e.relativeTargetOrigin=C,e.relativeParent=g)}}}e.notifyListeners("didUpdate",{layout:a,snapshot:t,delta:h,layoutDelta:f,hasLayoutChanged:m,hasRelativeLayoutChanged:p})}else if(e.isLead()){const{onExitComplete:a}=e.options;a&&a()}e.options.transition=void 0}function iq(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function lq(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cq(e){e.clearSnapshot()}function _T(e){e.clearMeasurements()}function uq(e){e.isLayoutDirty=!0,e.updateLayout()}function LT(e){e.isLayoutDirty=!1}function dq(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function fq(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function $T(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hq(e){e.resolveTargetDelta()}function mq(e){e.calcProjection()}function pq(e){e.resetSkewAndRotation()}function gq(e){e.removeLeadSnapshot()}function BT(e,t,r){e.translate=Tn(t.translate,0,r),e.scale=Tn(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function VT(e,t,r,a){e.min=Tn(t.min,r.min,a),e.max=Tn(t.max,r.max,a)}function xq(e,t,r,a){VT(e.x,t.x,r.x,a),VT(e.y,t.y,r.y,a)}function bq(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const vq={duration:.45,ease:[.4,0,.1,1]},UT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),HT=UT("applewebkit/")&&!UT("chrome/")?Math.round:_o;function FT(e){e.min=HT(e.min),e.max=HT(e.max)}function yq(e){FT(e.x),FT(e.y)}function YO(e,t,r){return e==="position"||e==="preserve-aspect"&&!VG(OT(t),OT(r),.2)}function wq(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const jq=qO({attachResizeListener:(e,t)=>Tf(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),qv={current:void 0},KO=qO({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qv.current){const e=new jq({});e.mount(window),e.setOptions({layoutScroll:!0}),qv.current=e}return qv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),lh=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function GT(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sq(...e){return t=>{let r=!1;const a=e.map(i=>{const c=GT(i,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():GT(e[i],null)}}}}function Nq(...e){return x.useCallback(Sq(...e),e)}class Cq extends x.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(Tp(r)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=r.offsetParent,i=Tp(a)&&a.offsetWidth||0,c=Tp(a)&&a.offsetHeight||0,u=getComputedStyle(r),f=this.props.sizeRef.current;f.height=parseFloat(u.height),f.width=parseFloat(u.width),f.top=r.offsetTop,f.left=r.offsetLeft,f.right=i-f.width-f.left,f.bottom=c-f.height-f.top,f.direction=u.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function kq({children:e,isPresent:t,anchorX:r,anchorY:a,root:i,pop:c}){var b;const u=x.useId(),f=x.useRef(null),h=x.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:m}=x.useContext(lh),p=c!==!1?((b=e.props)==null?void 0:b.ref)??(e==null?void 0:e.ref):void 0,g=Nq(f,p);return x.useInsertionEffect(()=>{const{width:v,height:w,top:C,left:S,right:N,bottom:E,direction:k}=h.current;if(t||c===!1||!f.current||!v||!w)return;const A=k==="rtl",M=r==="left"?A?`right: ${N}`:`left: ${S}`:A?`left: ${S}`:`right: ${N}`,R=a==="bottom"?`bottom: ${E}`:`top: ${C}`;f.current.dataset.motionPopId=u;const T=document.createElement("style");m&&(T.nonce=m);const O=i??document.head;return O.appendChild(T),T.sheet&&T.sheet.insertRule(`
|
|
502
|
+
[data-motion-pop-id="${u}"] {
|
|
503
|
+
position: absolute !important;
|
|
504
|
+
width: ${v}px !important;
|
|
505
|
+
height: ${w}px !important;
|
|
506
|
+
${M}px !important;
|
|
507
|
+
${R}px !important;
|
|
508
|
+
}
|
|
509
|
+
`),()=>{var D;(D=f.current)==null||D.removeAttribute("data-motion-pop-id"),O.contains(T)&&O.removeChild(T)}},[t]),n.jsx(Cq,{isPresent:t,childRef:f,sizeRef:h,pop:c,children:c===!1?e:x.cloneElement(e,{ref:g})})}const Tq=({children:e,initial:t,isPresent:r,onExitComplete:a,custom:i,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:h,root:m})=>{const p=rh(Eq),g=x.useId(),b=x.useRef(r),v=x.useRef(a);Au(()=>{b.current=r,v.current=a});let w=!0,C=x.useMemo(()=>(w=!1,{id:g,initial:t,isPresent:r,custom:i,onExitComplete:S=>{p.set(S,!0);for(const N of p.values())if(!N)return;a&&a()},register:S=>(p.set(S,!1),()=>{var N;p.delete(S),!b.current&&!p.size&&((N=v.current)==null||N.call(v))})}),[r,p,a]);return c&&w&&(C={...C}),x.useMemo(()=>{p.forEach((S,N)=>p.set(N,!1))},[r]),x.useEffect(()=>{!r&&!p.size&&a&&a()},[r]),e=n.jsx(kq,{pop:u==="popLayout",isPresent:r,anchorX:f,anchorY:h,root:m,children:e}),n.jsx(wx.Provider,{value:C,children:e})};function Eq(){return new Map}function XO(e=!0){const t=x.useContext(wx);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:a,register:i}=t,c=x.useId();x.useEffect(()=>{if(e)return i(c)},[e]);const u=x.useCallback(()=>e&&a&&a(c),[c,a,e]);return!r&&a?[!1,u]:[!0]}const Wm=e=>e.key||"";function qT(e){const t=[];return x.Children.forEach(e,r=>{x.isValidElement(r)&&t.push(r)}),t}const lc=({children:e,custom:t,initial:r=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:c="sync",propagate:u=!1,anchorX:f="left",anchorY:h="top",root:m})=>{const[p,g]=XO(u),b=x.useMemo(()=>qT(e),[e]),v=u&&!p?[]:b.map(Wm),w=x.useRef(!0),C=x.useRef(b),S=rh(()=>new Map),N=x.useRef(new Set),[E,k]=x.useState(b),[A,M]=x.useState(b);Au(()=>{u&&!p&&!A.length&&(g==null||g())},[p,u,A.length,g]),Au(()=>{w.current=!1,C.current=b;for(let O=0;O<A.length;O++){const D=Wm(A[O]);v.includes(D)?(S.delete(D),N.current.delete(D)):S.get(D)!==!0&&S.set(D,!1)}},[A,v.length,v.join("-")]);const R=[];if(b!==E){let O=[...b],D=0;for(const B of A){const F=v.indexOf(Wm(B));F===-1?(O.splice(D++,0,B),R.push(B)):D=F+R.length+1}return c==="wait"&&R.length&&(O=R),M(qT(O)),k(b),null}const{forceRender:T}=x.useContext(Z2);return n.jsx(n.Fragment,{children:A.map(O=>{const D=Wm(O),B=u&&!p?!1:b===A||v.includes(D),F=()=>{if(N.current.has(D))return;if(S.has(D))N.current.add(D),S.set(D,!0);else return;let K=!0;S.forEach($=>{$||(K=!1)}),K&&(T==null||T(),M(C.current),u&&(g==null||g()),a&&a())};return n.jsx(Tq,{isPresent:B,initial:!w.current||r?void 0:!1,custom:t,presenceAffectsLayout:i,mode:c,root:m,onExitComplete:B?void 0:F,anchorX:f,anchorY:h,children:O},D)})})},WO=x.createContext({strict:!1}),YT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let KT=!1;function Rq(){if(KT)return;const e={};for(const t in YT)e[t]={isEnabled:r=>YT[t].some(a=>!!r[a])};MO(e),KT=!0}function QO(){return Rq(),NG()}function Aq(e){const t=QO();for(const r in e)t[r]={...t[r],...e[r]};MO(t)}const Tx=x.createContext({});function Mq(e,t){if(kx(e)){const{initial:r,animate:a}=e;return{initial:r===!1||kf(r)?r:void 0,animate:kf(a)?a:void 0}}return e.inherit!==!1?t:{}}function Oq(e){const{initial:t,animate:r}=Mq(e,x.useContext(Tx));return x.useMemo(()=>({initial:t,animate:r}),[XT(t),XT(r)])}function XT(e){return Array.isArray(e)?e.join(" "):e}const Ew=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ZO(e,t,r){for(const a in t)!bs(t[a])&&!zO(a,r)&&(e[a]=t[a])}function Dq({transformTemplate:e},t){return x.useMemo(()=>{const r=Ew();return jw(r,t,e),Object.assign({},r.vars,r.style)},[t])}function zq(e,t){const r=e.style||{},a={};return ZO(a,r,e),Object.assign(a,Dq(e,t)),a}function Iq(e,t){const r={},a=zq(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=a,r}const JO=()=>({...Ew(),attrs:{}});function Pq(e,t,r,a){const i=x.useMemo(()=>{const c=JO();return yO(c,t,PO(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};ZO(c,e.style,e),i.style={...c,...i.style}}return i}const _q=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function gg(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||_q.has(e)}function Lq(e,t){return e.startsWith("on")?!gg(e):(t==null?void 0:t(e))??!gg(e)}function $q(e,t,r,a){const i={};for(const c in e)c==="values"&&typeof e.values=="object"||bs(e[c])||(Lq(c,a)||r===!0&&gg(c)||!t&&!gg(c)||e.draggable&&c.startsWith("onDrag"))&&(i[c]=e[c]);return i}const Bq=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Rw(e){return typeof e!="string"||e.includes("-")?!1:!!(Bq.indexOf(e)>-1||/[A-Z]/u.test(e))}function Vq(e,t,r,{latestValues:a},i,c=!1,u,f){const m=(u??Rw(e)?Pq:Iq)(t,a,i,e),p=$q(t,typeof e=="string",c,f),g=e!==x.Fragment?{...p,...m,ref:r}:{},{children:b}=t,v=x.useMemo(()=>bs(b)?b.get():b,[b]);return x.createElement(e,{...g,children:v})}function Uq({scrapeMotionValuesFromProps:e,createRenderState:t},r,a,i){return{latestValues:Hq(r,a,i,e),renderState:t()}}function Hq(e,t,r,a){const i={},c=a(e,{});for(const b in c)i[b]=Op(c[b]);let{initial:u,animate:f}=e;const h=kx(e),m=RO(e);t&&m&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),f===void 0&&(f=t.animate));let p=r?r.initial===!1:!1;p=p||u===!1;const g=p?f:u;if(g&&typeof g!="boolean"&&!Cx(g)){const b=Array.isArray(g)?g:[g];for(let v=0;v<b.length;v++){const w=xw(e,b[v]);if(w){const{transitionEnd:C,transition:S,...N}=w;for(const E in N){let k=N[E];if(Array.isArray(k)){const A=p?k.length-1:0;k=k[A]}k!==null&&(i[E]=k)}for(const E in C)i[E]=C[E]}}}return i}const e4=e=>(t,r)=>{const a=x.useContext(Tx),i=x.useContext(wx),c=()=>Uq(e,t,a,i);return r?c():rh(c)},Fq=e4({scrapeMotionValuesFromProps:Tw,createRenderState:Ew}),Gq=e4({scrapeMotionValuesFromProps:_O,createRenderState:JO}),qq=Symbol.for("motionComponentSymbol");function Yq(e,t,r){const a=x.useRef(r);x.useInsertionEffect(()=>{a.current=r});const i=x.useRef(null);return x.useCallback(c=>{var f;c&&((f=e.onMount)==null||f.call(e,c)),t&&(c?t.mount(c):t.unmount());const u=a.current;if(typeof u=="function")if(c){const h=u(c);typeof h=="function"&&(i.current=h)}else i.current?(i.current(),i.current=null):u(c);else u&&(u.current=c)},[t])}const t4=x.createContext({});function lu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Kq(e,t,r,a,i,c){var k,A;const{visualElement:u}=x.useContext(Tx),f=x.useContext(WO),h=x.useContext(wx),m=x.useContext(lh),p=m.reducedMotion,g=m.skipAnimations,b=x.useRef(null),v=x.useRef(!1);a=a||f.renderer,!b.current&&a&&(b.current=a(e,{visualState:t,parent:u,props:r,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:c}),v.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const w=b.current,C=x.useContext(t4);w&&!w.projection&&i&&(w.type==="html"||w.type==="svg")&&Xq(b.current,r,i,C);const S=x.useRef(!1);x.useInsertionEffect(()=>{w&&S.current&&w.update(r,h)});const N=r[gO],E=x.useRef(!!N&&typeof window<"u"&&!((k=window.MotionHandoffIsComplete)!=null&&k.call(window,N))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,N)));return Au(()=>{var M;!v.current||!w||((M=w.animationState)==null||M.animateChanges(),w.enteringChildren=void 0)},[]),Au(()=>{v.current=!0,w&&(S.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),E.current&&w.animationState&&w.animationState.animateChanges())}),x.useEffect(()=>{w&&(!E.current&&w.animationState&&w.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{var M;(M=window.MotionHandoffMarkAsComplete)==null||M.call(window,N)}),E.current=!1),w.enteringChildren=void 0)}),w}function Xq(e,t,r,a){const{layoutId:i,layout:c,drag:u,dragConstraints:f,layoutScroll:h,layoutRoot:m,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:n4(e.parent)),e.projection.setOptions({layoutId:i,layout:c,alwaysMeasureLayout:!!u||f&&lu(f),visualElement:e,animationType:typeof c=="string"?c:"both",initialPromotionConfig:a,crossfade:g,layoutScroll:h,layoutRoot:m,layoutAnchor:p})}function n4(e){if(e)return e.options.allowProjection!==!1?e.projection:n4(e.parent)}function Yv(e,{forwardMotionProps:t=!1,type:r}={},a,i){a&&Aq(a);const c=r?r==="svg":Rw(e),u=c?Gq:Fq;function f(m,p){let g;const b={...x.useContext(lh),...m,layoutId:Wq(m)},{isStatic:v,isValidProp:w}=b,C=Oq(m),S=u(m,v);if(!v&&typeof window<"u"){Qq();const N=Zq(b);g=N.MeasureLayout,C.visualElement=Kq(e,S,b,i,N.ProjectionNode,c)}return n.jsxs(Tx.Provider,{value:C,children:[g&&C.visualElement?n.jsx(g,{visualElement:C.visualElement,...b}):null,Vq(e,m,Yq(S,C.visualElement,p),S,v,t,c,w)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=x.forwardRef(f);return h[qq]=e,h}function Wq({layoutId:e}){const t=x.useContext(Z2).id;return t&&e!==void 0?t+"-"+e:e}function Qq(e,t){x.useContext(WO).strict}function Zq(e){const t=QO(),{drag:r,layout:a}=t;if(!r&&!a)return{};const i={...r,...a};return{MeasureLayout:r!=null&&r.isEnabled(e)||a!=null&&a.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Jq(e,t){if(typeof Proxy>"u")return Yv;const r=new Map,a=(c,u)=>Yv(c,u,e,t),i=(c,u)=>a(c,u);return new Proxy(i,{get:(c,u)=>u==="create"?a:(r.has(u)||r.set(u,Yv(u,void 0,e,t)),r.get(u))})}const eY=(e,t)=>t.isSVG??Rw(e)?new AG(t):new EG(t,{allowProjection:e!==x.Fragment});class tY extends il{constructor(t){super(t),t.animationState||(t.animationState=IG(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Cx(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let nY=0;class sY extends il{constructor(){super(...arguments),this.id=nY++,this.isExitComplete=!1}update(){var c;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;if(t&&a===!1){if(this.isExitComplete){const{initial:u,custom:f}=this.node.getProps();if(typeof u=="string"||typeof u=="object"&&u!==null&&!Array.isArray(u)){const h=tc(this.node,u,f);if(h){const{transition:m,transitionEnd:p,...g}=h;for(const b in g)(c=this.node.getValue(b))==null||c.jump(g[b])}}this.node.blockInitialAnimation=!1,this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1,this.exitAnimation=void 0;return}const i=this.exitAnimation=this.node.animationState.setActive("exit",!t);r&&!t&&i.then(()=>{this.exitAnimation===i&&(this.isExitComplete=!0,r(this.id))})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const rY={animation:{Feature:tY},exit:{Feature:sY}};function Ex(e){return{point:{x:e.pageX,y:e.pageY}}}const oY=e=>t=>Nw(t)&&e(t,Ex(t));function lf(e,t,r,a){return Tf(e,t,oY(r),a)}const s4=({current:e})=>e?e.ownerDocument.defaultView:null,WT=(e,t)=>Math.abs(e-t);function aY(e,t){const r=WT(e.x,t.x),a=WT(e.y,t.y);return Math.sqrt(r**2+a**2)}const QT=new Set(["auto","scroll"]);class r4{constructor(t,r,{transformPagePoint:a,contextWindow:i=window,dragSnapToOrigin:c=!1,distanceThreshold:u=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Qm(this.lastRawMoveEventInfo,this.transformPagePoint));const w=Kv(this.lastMoveEventInfo,this.history),C=this.startEvent!==null,S=aY(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!C&&!S)return;const{point:N}=w;this.history.push({...N,timestamp:As.now()});const{onStart:E,onMove:k}=this.handlers;C||(E&&E(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,w)},this.handlePointerMove=(w,C)=>{this.lastMoveEvent=w,this.lastRawMoveEventInfo=C,this.lastMoveEventInfo=Qm(C,this.transformPagePoint),this.hasPendingMove=!0,jn.update(this.updatePoint,!0)},this.handlePointerUp=(w,C)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:S,onSessionEnd:N,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Kv(w.type==="pointercancel"?this.lastMoveEventInfo:Qm(C,this.transformPagePoint),this.history);this.startEvent&&S&&S(w,k),N&&N(w,k)},!Nw(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const h=Ex(t),m=Qm(h,this.transformPagePoint),{point:p}=m,{timestamp:g}=Es;this.history=[{...p,timestamp:g}];const{onSessionStart:b}=r;b&&b(t,Kv(m,this.history));const v={passive:!0,capture:!0};this.removeListeners=oh(lf(this.contextWindow,"pointermove",this.handlePointerMove,v),lf(this.contextWindow,"pointerup",this.handlePointerUp,v),lf(this.contextWindow,"pointercancel",this.handlePointerUp,v)),f&&this.startScrollTracking(f)}startScrollTracking(t){let r=t.parentElement;for(;r;){const a=getComputedStyle(r);(QT.has(a.overflowX)||QT.has(a.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const a=t===window,i=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},c={x:i.x-r.x,y:i.y-r.y};c.x===0&&c.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=c.x,this.lastMoveEventInfo.point.y+=c.y):this.history.length>0&&(this.history[0].x-=c.x,this.history[0].y-=c.y),this.scrollPositions.set(t,i),jn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),pa(this.updatePoint)}}function Qm(e,t){return t?{point:t(e.point)}:e}function ZT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Kv({point:e},t){return{point:e,delta:ZT(e,o4(t)),offset:ZT(e,iY(t)),velocity:lY(t,.1)}}function iY(e){return e[0]}function o4(e){return e[e.length-1]}function lY(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,a=null;const i=o4(e);for(;r>=0&&(a=e[r],!(i.timestamp-a.timestamp>fo(t)));)r--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&i.timestamp-a.timestamp>fo(t)*2&&(a=e[1]);const c=_r(i.timestamp-a.timestamp);if(c===0)return{x:0,y:0};const u={x:(i.x-a.x)/c,y:(i.y-a.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function cY(e,{min:t,max:r},a){return t!==void 0&&e<t?e=a?Tn(t,e,a.min):Math.max(e,t):r!==void 0&&e>r&&(e=a?Tn(r,e,a.max):Math.min(e,r)),e}function JT(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function uY(e,{top:t,left:r,bottom:a,right:i}){return{x:JT(e.x,r,i),y:JT(e.y,t,a)}}function eE(e,t){let r=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,a]=[a,r]),{min:r,max:a}}function dY(e,t){return{x:eE(e.x,t.x),y:eE(e.y,t.y)}}function fY(e,t){let r=.5;const a=ar(e),i=ar(t);return i>a?r=Sf(t.min,t.max-a,e.min):a>i&&(r=Sf(e.min,e.max-i,t.min)),Bo(0,1,r)}function hY(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const w1=.35;function mY(e=w1){return e===!1?e=0:e===!0&&(e=w1),{x:tE(e,"left","right"),y:tE(e,"top","bottom")}}function tE(e,t,r){return{min:nE(e,t),max:nE(e,r)}}function nE(e,t){return typeof e=="number"?e:e[t]||0}const pY=new WeakMap;class gY{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=gs(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:a}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const c=g=>{r&&this.snapToCursor(g),this.stopAnimation()},u=(g,b)=>{const{drag:v,dragPropagation:w,onDragStart:C}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eG(v),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ea(N=>{let E=this.getAxisMotionValue(N).get()||0;if(aa.test(E)){const{projection:k}=this.visualElement;if(k&&k.layout){const A=k.layout.layoutBox[N];A&&(E=ar(A)*(parseFloat(E)/100))}}this.originPoint[N]=E}),C&&jn.update(()=>C(g,b),!1,!0),m1(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:C,onDrag:S}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:N}=b;if(w&&this.currentDirection===null){this.currentDirection=bY(N),this.currentDirection!==null&&C&&C(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),S&&jn.update(()=>S(g,b),!1,!0)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new r4(t,{onSessionStart:c,onStart:u,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:a,contextWindow:s4(this.visualElement),element:this.visualElement.current})}stop(t,r){const a=t||this.latestPointerEvent,i=r||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!i||!a)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&jn.postRender(()=>f(a,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,r,a){const{drag:i}=this.getProps();if(!a||!Zm(t,i,this.currentDirection))return;const c=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=cY(u,this.constraints[t],this.elastic[t])),c.set(u)}resolveConstraints(){var c;const{dragConstraints:t,dragElastic:r}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(c=this.visualElement.projection)==null?void 0:c.layout,i=this.constraints;t&&lu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=uY(a.layoutBox,t):this.constraints=!1,this.elastic=mY(r),i!==this.constraints&&!lu(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&ea(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=hY(a.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!lu(t))return!1;const a=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const c=JF(a,i.root,this.visualElement.getTransformPagePoint());let u=dY(i.layout.layoutBox,c);if(r){const f=r(WF(u));this.hasMutatedConstraints=!!f,f&&(u=wO(f))}return u}startAnimation(t){const{drag:r,dragMomentum:a,dragElastic:i,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},m=ea(p=>{if(!Zm(p,r,this.currentDirection))return;let g=h&&h[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const b=i?200:1e6,v=i?40:1e7,w={type:"inertia",velocity:a?t[p]:0,bounceStiffness:b,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...c,...g};return this.startAxisValueAnimation(p,w)});return Promise.all(m).then(f)}startAxisValueAnimation(t,r){const a=this.getAxisMotionValue(t);return m1(this.visualElement,t),a.start(gw(t,a,0,r,this.visualElement,!1))}stopAnimation(){ea(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps()[r];return i||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:r}){var f;const{drag:a}=this.getProps(),i={x:t,y:r},c=((f=this.visualElement.getTransformPagePoint())==null?void 0:f(i))||i,u=this.visualElement.measureViewportBox();ea(h=>{if(!Zm(h,a,this.currentDirection))return;const m=this.getAxisMotionValue(h),{min:p,max:g}=u[h];m.set((m.get()||0)+c[h]-Tn(p,g,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:a}=this.visualElement;if(!lu(r)||!a||!this.constraints)return;this.stopAnimation();const i=this.constraints,c={x:0,y:0};ea(f=>{const h=this.getAxisMotionValue(f).get();c[f]=fY({min:h,max:h},i[f])});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),ea(f=>{const h=this.getAxisMotionValue(f);if(!Zm(f,t,null)||!h.get())return;const{min:m,max:p}=this.constraints[f];h.set(Tn(m,p,c[f]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;pY.set(this.visualElement,this);const t=this.visualElement.current,r=lf(t,"pointerdown",m=>{const{drag:p,dragListener:g=!0}=this.getProps(),b=m.target,v=b!==t&&aG(b);p&&g&&!v&&this.start(m)});let a;const i=()=>{const{dragConstraints:m}=this.getProps();lu(m)&&m.current&&(this.constraints=this.resolveRefConstraints(),a||(a=xY(t,m.current,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,u=c.addEventListener("measure",i);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),jn.read(i);const f=Tf(window,"resize",()=>this.scalePositionWithinConstraints()),h=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:p})=>{this.isDragging&&p&&(ea(g=>{const b=this.getAxisMotionValue(g);b&&(this.originPoint[g]+=m[g].translate,b.set(b.get()+m[g].translate))}),this.visualElement.render())}));return()=>{f(),r(),u(),h&&h(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:a=!1,dragPropagation:i=!1,dragConstraints:c=!1,dragElastic:u=w1,dragMomentum:f=!0}=t;return{...t,drag:r,dragDirectionLock:a,dragPropagation:i,dragConstraints:c,dragElastic:u,dragMomentum:f}}}function sE(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function xY(e,t,r){const a=hT(e,sE(r)),i=hT(t,sE(r));return()=>{a(),i()}}function Zm(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function bY(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class vY extends il{constructor(t){super(t),this.removeGroupControls=_o,this.removeListeners=_o,this.controls=new gY(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_o}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Xv=e=>(t,r)=>{e&&jn.update(()=>e(t,r),!1,!0)};class yY extends il{constructor(){super(...arguments),this.removePointerDownListener=_o}onPointerDown(t){this.session=new r4(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:s4(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:Xv(t),onStart:Xv(r),onMove:Xv(a),onEnd:(c,u)=>{delete this.session,i&&jn.postRender(()=>i(c,u))}}}mount(){this.removePointerDownListener=lf(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Wv=!1;class wY extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a,layoutId:i}=this.props,{projection:c}=t;c&&(r.group&&r.group.add(c),a&&a.register&&i&&a.register(c),Wv&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Dp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:a,drag:i,isPresent:c}=this.props,{projection:u}=a;return u&&(u.isPresent=c,t.layoutDependency!==r&&u.setOptions({...u.options,layoutDependency:r}),Wv=!0,i||t.layoutDependency!==r||r===void 0||t.isPresent!==c?u.willUpdate():this.safeToRemove(),t.isPresent!==c&&(c?u.promote():u.relegate()||jn.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:r}=this.props,{projection:a}=t;a&&(a.options.layoutAnchor=r,a.root.didUpdate(),Sw.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a}=this.props,{projection:i}=t;Wv=!0,i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),a&&a.deregister&&a.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function a4(e){const[t,r]=XO(),a=x.useContext(Z2);return n.jsx(wY,{...e,layoutGroup:a,switchLayoutGroup:x.useContext(t4),isPresent:t,safeToRemove:r})}const jY={pan:{Feature:yY},drag:{Feature:vY,ProjectionNode:KO,MeasureLayout:a4}};function rE(e,t,r){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",r==="Start");const i="onHover"+r,c=a[i];c&&jn.postRender(()=>c(t,Ex(t)))}class SY extends il{mount(){const{current:t}=this.node;t&&(this.unmount=nG(t,(r,a)=>(rE(this.node,a,"Start"),i=>rE(this.node,i,"End"))))}unmount(){}}class NY extends il{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=oh(Tf(this.node.current,"focus",()=>this.onFocus()),Tf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function oE(e,t,r){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",r==="Start");const i="onTap"+(r==="End"?"":r),c=a[i];c&&jn.postRender(()=>c(t,Ex(t)))}class CY extends il{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:a}=this.node.props;this.unmount=lG(t,(i,c)=>(oE(this.node,c,"Start"),(u,{success:f})=>oE(this.node,u,f?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const j1=new WeakMap,Qv=new WeakMap,kY=e=>{const t=j1.get(e.target);t&&t(e)},TY=e=>{e.forEach(kY)};function EY({root:e,...t}){const r=e||document;Qv.has(r)||Qv.set(r,{});const a=Qv.get(r),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(TY,{root:e,...t})),a[i]}function RY(e,t,r){const a=EY(t);return j1.set(e,r),a.observe(e),()=>{j1.delete(e),a.unobserve(e)}}const AY={some:0,all:1};class MY extends il{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var h;(h=this.stopObserver)==null||h.call(this);const{viewport:t={}}=this.node.getProps(),{root:r,margin:a,amount:i="some",once:c}=t,u={root:r?r.current:void 0,rootMargin:a,threshold:typeof i=="number"?i:AY[i]},f=m=>{const{isIntersecting:p}=m;if(this.isInView===p||(this.isInView=p,c&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:g,onViewportLeave:b}=this.node.getProps(),v=p?g:b;v&&v(m)};this.stopObserver=RY(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(OY(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function OY({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const DY={inView:{Feature:MY},tap:{Feature:CY},focus:{Feature:NY},hover:{Feature:SY}},zY={layout:{ProjectionNode:KO,MeasureLayout:a4}},IY={...rY,...DY,...jY,...zY},PY=Jq(IY,eY);function Aw(e){const t=rh(()=>ic(e)),{isStatic:r}=x.useContext(lh);if(r){const[,a]=x.useState(e);x.useEffect(()=>t.on("change",a),[])}return t}function i4(e,t){const r=Aw(t()),a=()=>r.set(t());return a(),Au(()=>{const i=()=>jn.preRender(a,!1,!0),c=e.map(u=>u.on("change",i));return()=>{c.forEach(u=>u()),pa(a)}}),r}function _Y(e){of.current=[],e();const t=i4(of.current,e);return of.current=void 0,t}function LY(e,t,r,a){if(typeof e=="function")return _Y(e);const c=bG(t,r,a),u=Array.isArray(e)?aE(e,c):aE([e],([h])=>c(h)),f=Array.isArray(e)?void 0:e.accelerate;return f&&!f.isTransformed&&typeof t!="function"&&Array.isArray(r)&&(a==null?void 0:a.clamp)!==!1&&(u.accelerate={...f,times:t,keyframes:r,isTransformed:!0}),u}function aE(e,t){const r=rh(()=>[]);return i4(e,()=>{r.length=0;const a=e.length;for(let i=0;i<a;i++)r[i]=e[i].get();return t(r)})}function $Y(e,t={}){const{isStatic:r}=x.useContext(lh),a=()=>bs(e)?e.get():e;if(r)return LY(a);const i=Aw(a());return x.useInsertionEffect(()=>yG(i,e,t),[i,JSON.stringify(t)]),i}function BY(e,t={}){return $Y(e,{type:"spring",...t})}function Zs(){!kw.current&&AO();const[e]=x.useState(hg.current);return e}const VY={some:0,all:1};function UY(e,t,{root:r,margin:a,amount:i="some"}={}){const c=ww(e),u=new WeakMap,f=m=>{m.forEach(p=>{const g=u.get(p.target);if(p.isIntersecting!==!!g)if(p.isIntersecting){const b=t(p.target,p);typeof b=="function"?u.set(p.target,b):h.unobserve(p.target)}else typeof g=="function"&&(g(p),u.delete(p.target))})},h=new IntersectionObserver(f,{root:r,rootMargin:a,threshold:typeof i=="number"?i:VY[i]});return c.forEach(m=>h.observe(m)),()=>h.disconnect()}function l4(e,{root:t,margin:r,amount:a,once:i=!1,initial:c=!1}={}){const[u,f]=x.useState(c);return x.useEffect(()=>{if(!e.current||i&&u)return;const h=()=>(f(!0),i?void 0:()=>f(!1)),m={root:t&&t.current||void 0,margin:r,amount:a};return UY(e.current,h,m)},[t,e,r,i,a]),u}const In=PY,iE=e=>typeof e=="function"?void 0:e.filter;function ho({children:e,className:t,variant:r,duration:a=.4,delay:i=0,offset:c=6,direction:u="down",inView:f=!1,inViewMargin:h="-50px",blur:m="6px",...p}){const g=x.useRef(null),b=l4(g,{once:!0,margin:h}),v=!f||b,w=Zs(),C={hidden:{[u==="left"||u==="right"?"x":"y"]:u==="right"||u==="down"?-c:c,opacity:0,filter:`blur(${m})`},visible:{[u==="left"||u==="right"?"x":"y"]:0,opacity:1,filter:"blur(0px)"}},S=r??C,N=iE(S.hidden),E=iE(S.visible),k=N!=null&&E!=null&&N!==E;return n.jsx(lc,{children:n.jsx(In.div,{ref:g,initial:w?!1:"hidden",animate:v?"visible":"hidden",exit:"hidden",variants:S,transition:{delay:.04+i,duration:w?0:a,ease:"easeOut",...k?{filter:{duration:a}}:{}},className:t,...p,children:e})})}const Rx=[{name:"Claude Code",logo:"claudecode",commands:["claude","claude-code"]},{name:"Codex",logo:"codex",commands:["codex"]},{name:"GitHub Copilot",logo:"copilot",commands:["copilot"]},{name:"Cursor",logo:"cursor",commands:["cursor-agent","agent"],aliases:["Cursor CLI"]},{name:"Gemini CLI",logo:"gemini",commands:["gemini"]},{name:"OpenCode",logo:"opencode",commands:["opencode"]},{name:"OpenClaw",logo:"openclaw-color",commands:["openclaw"]},{name:"Pi",logo:"pi",commands:["pi"]},{name:"Antigravity CLI",logo:"antigravity",commands:["agy"],aliases:["Antigravity"]},{name:"Kiro CLI",logo:"kiro",commands:["kiro-cli"],aliases:["Kiro"]},{name:"Factory Droid",logo:"factory",commands:["droid"],aliases:["Droid","Factory"]},{name:"Aider",logo:"aider",commands:["aider"]}];function c4(e){var m,p;const t=(e==null?void 0:e.labels)??{},r=t["openshell.console/agents"]||t["openshell.console/agent"],a=typeof r=="string"?r.split(/[,\n]/).map(g=>g.trim()).filter(Boolean):[],i=Array.isArray(e==null?void 0:e.command)?(m=e.command[0])==null?void 0:m.split("/").pop():null,c=(p=e==null?void 0:e.agentInventory)==null?void 0:p.agents,u=a.length>0,h=(Array.isArray(c)?c:u?a:i&&i!=="agent"?[i]:[]).flatMap(g=>{var v,w;const b=Rx.find(C=>{var S;return C.name.toLowerCase()===g.toLowerCase()||C.commands.includes(g.toLowerCase())||((S=C.aliases)==null?void 0:S.some(N=>N.toLowerCase()===g.toLowerCase()))});return b?[{resources:(w=(v=e==null?void 0:e.agentInventory)==null?void 0:v.resources)==null?void 0:w[b.name],name:b.name,logo:`/logos/agents/${b.logo}.svg`}]:u?[{name:g,logo:null}]:[]});return h.filter((g,b)=>h.findIndex(v=>v.name.toLowerCase()===g.name.toLowerCase())===b)}function Zv(e){const t=e==null?void 0:e.agentInventory;return(t==null?void 0:t.status)==="checked"?t.agents.length?"Installed agents":"No supported agents found":t!=null&&t.checkedAt?"Last detected agents · scan unavailable":(t==null?void 0:t.status)==="unavailable"?"Agent scan unavailable":"Agent inventory not checked"}const HY=`
|
|
510
|
+
## OpenShell website access
|
|
511
|
+
|
|
512
|
+
Network access is restricted per destination, not globally offline. A denied website or hosted search request does not mean another website is blocked.
|
|
513
|
+
For a user-requested website, call read_url_content for that website. Hosted URL fetch and search services are deliberately blocked because they bypass the sandbox destination policy. read_url_content can fall back to a direct request from this sandbox, where the website policy applies.
|
|
514
|
+
If a request is denied, report that specific destination or service as blocked. On a later request for a different website, try that website independently; do not reuse an earlier denial as evidence that all internet access is unavailable. Do not claim to have fetched current content without a successful tool result.
|
|
515
|
+
Do not use hosted search, external proxies, or other relay services to bypass a blocked destination. Never change network policy to complete a browsing request.
|
|
516
|
+
`,xg=[{id:"ubuntu:24.04",name:"Ubuntu 24.04"},{id:"debian:12-slim",name:"Debian 12 slim"}],FY=["git","curl","ripgrep"],Jm=(e,t="bash")=>`curl -fsSL ${e} -o /tmp/install-agent.sh && ${t} /tmp/install-agent.sh && rm /tmp/install-agent.sh`,GY=[{id:"claude",command:"claude",featured:!0},{id:"codex",command:"codex",featured:!0,npm:"@openai/codex"},{id:"opencode",command:"opencode",featured:!0,npm:"opencode-ai"},{id:"pi",command:"pi",npm:"@earendil-works/pi-coding-agent",ignoreScripts:!0,packages:["fd-find","ripgrep"]},{id:"cursor",command:"cursor-agent",featured:!0,install:Jm("https://cursor.com/install")},{id:"antigravity",command:"agy",install:Jm("https://antigravity.google/cli/install.sh")},{id:"copilot",command:"copilot",npm:"@github/copilot"},{id:"kiro",command:"kiro-cli",packages:["unzip"],install:Jm("https://cli.kiro.dev/install")},{id:"droid",command:"droid",install:Jm("https://app.factory.ai/cli","sh")},{id:"aider",command:"aider",python:!0}],Ws=GY.map(e=>{const t=Rx.find(r=>r.commands.includes(e.command));return{...e,name:t.name,logo:`/logos/agents/${t.logo}.svg`}}),S1=e=>Ws.filter(t=>e.agents.includes(t.id)),N1=[{id:"node",name:"Node.js 22",logo:"/logos/templates/nodejs.svg"},{id:"python",name:"Python 3",logo:"/logos/templates/python.svg"},{id:"vscode",name:"VS Code Server",logo:"/logos/vscode.svg",retired:!0}],qY="/run/openshell-supervisor-ca/material/ca-bundle.crt",bg=[...Ws.map(e=>({id:e.command,name:e.name})),{id:"",name:"Shell"}],YY=/^[a-z0-9]([a-z0-9-]{0,17}[a-z0-9])?$/,KY=8e3,Ax=e=>e.source==="build"&&Array.isArray(e.agents)&&new Set(e.agents).size+(Array.isArray(e.customAgents)?e.customAgents.length:0)>1;function na(e={}){const t={name:"",source:"build",agents:["claude"],customAgents:[],repository:"",runtimes:[],base:xg[0].id,packages:[...FY],setup:"",image:"",environment:[],command:"claude",setups:[],setupRevisions:{},...e};return Ax(t)&&(t.command=""),t}const lE=e=>e.split(/[\s,]+/).filter(Boolean),Jv=e=>`openshell-image-recipe-v3:${e}`;function cE(e){try{const t=JSON.parse(sessionStorage.getItem(e));return t!=null&&t.recipe&&typeof t.recipe.name=="string"?t:null}catch{return null}}function XY(e){var t,r,a;return e.source==="image"?{source:"image",image:e.image,command:e.command,...(t=e.setups)!=null&&t.length?{setups:e.setups,setupRevisions:e.setupRevisions||{}}:{}}:{source:"build",agents:e.agents,...(r=e.setups)!=null&&r.length?{setups:e.setups,setupRevisions:e.setupRevisions||{}}:{},...(a=e.customAgents)!=null&&a.length?{customAgents:e.customAgents}:{},repository:e.repository,runtimes:e.runtimes,base:e.base,packages:e.packages,setup:e.setup,command:e.command}}function WY(e){let t=2166136261;for(const r of C1(e))t=Math.imul(t^r.charCodeAt(0),16777619);return(t>>>0).toString(16).padStart(8,"0")}const ey=e=>"'"+e.replaceAll("'","'\\''")+"'",QY=/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]{0,255}$/;function ZY(e){const t={};if((!Array.isArray(e.setups)||e.setups.length>8||e.setups.some(r=>typeof r!="string"||!/^[a-f0-9]{24}$/.test(r))||new Set(e.setups).size!==e.setups.length)&&(t.setups="Choose up to eight unique saved Setups."),e.setupRevisions&&(typeof e.setupRevisions!="object"||Array.isArray(e.setupRevisions)||Object.entries(e.setupRevisions).some(([r,a])=>{var i;return!((i=e.setups)!=null&&i.includes(r))||!/^[a-f0-9]{64}$/.test(a)}))&&(t.setups="Invalid pinned Setup revision."),YY.test(e.name||"")||(t.name="Use lowercase letters, digits and dashes for the name, up to 19 characters."),e.source==="build"){if((!Array.isArray(e.agents)||e.agents.some(r=>!Ws.some(a=>a.id===r)))&&(t.agents="Choose a supported agent."),(!Array.isArray(e.runtimes)||e.runtimes.some(r=>!N1.some(a=>a.id===r)))&&(t.runtimes="Choose a supported runtime."),typeof e.repository!="string")t.repository="Invalid repository.";else if(e.repository)try{const r=new URL(e.repository);if(/[\r\n\0]/.test(e.repository)||r.protocol!=="https:"||r.username||r.password||r.search||r.hash)throw new Error}catch{t.repository="Use a public HTTPS repository URL without credentials or query parameters."}xg.some(r=>r.id===e.base)||(t.base="Choose a supported base image."),(!Array.isArray(e.packages)||e.packages.length>80||e.packages.some(r=>typeof r!="string"||!/^[a-z0-9][a-z0-9+.-]*(=[a-zA-Z0-9:.+~_-]+)?$/.test(r)))&&(t.packages="Add up to 80 valid apt package names, such as jq or build-essential."),(!Array.isArray(e.customAgents)||e.customAgents.length>10||e.customAgents.some(r=>!r||typeof r.name!="string"||!r.name.trim()||r.name.length>80||/[\x00-\x1f\x7f]/.test(r.name)||typeof r.install!="string"||!r.install.trim()||r.install.length>6e3||/[\x00\r]/.test(r.install)))&&(t.customAgents="Enter valid custom agent install commands, up to 6,000 characters."),(typeof e.setup!="string"||e.setup.length>6e3)&&(t.setup="Setup commands must be under 6 KB.")}else e.source==="image"?QY.test(e.image||"")||(t.image="Enter a valid image reference, such as team/workspace:latest."):t.source="Choose an image source.";return!Array.isArray(e.environment)||e.environment.length>40||e.environment.some(r=>!r||typeof r.name!="string"||typeof r.value!="string"||r.name.length>128||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r.name)||/[\x00-\x1f\x7f]/.test(r.value)||r.value.length>1e3)?t.environment="Use variable names of letters, digits and underscores (up to 128) and single-line values (up to 1,000 characters).":e.environment.some(r=>r.name.startsWith("OPENSHELL_"))?t.environment="Variable names starting with OPENSHELL_ are reserved by OpenShell.":e.environment.some(r=>/secret|token|password|api_?key|credential|auth/i.test(r.name))?t.environment="Keep credentials out of templates. Attach them through Secrets when you launch.":new Set(e.environment.map(r=>r.name)).size!==e.environment.length&&(t.environment="Environment variable names must be unique."),(typeof e.command!="string"||e.command.length>512||/[\r\n\0]/.test(e.command))&&(t.command="Use a single-line start command, up to 512 characters."),Ax(e)&&e.command!==""&&(t.command="Templates with multiple agents must start in Shell."),!Object.keys(t).length&&new TextEncoder().encode(JSON.stringify(XY(e))).length>KY&&(t.setup="This recipe is too large to store with the template. Shorten the setup commands or package list."),t}function C1(e){var u,f,h;const t=S1(e),r=!!((u=e.setups)!=null&&u.length)||e.runtimes.includes("node")||t.some(m=>m.npm),a=!!((f=e.setups)!=null&&f.length)||e.runtimes.includes("python")||t.some(m=>m.python),i=[...new Set(["ca-certificates","curl","iproute2","tmux",...e.packages,...t.flatMap(m=>m.packages??[]),...e.repository?["git"]:[],...a?["python3","python3-venv"]:[]])],c=[`FROM ${e.base}`,"","USER root","ENV DEBIAN_FRONTEND=noninteractive",`RUN apt-get update --error-on=any && apt-get install -y --no-install-recommends ${i.map(ey).join(" ")} && rm -rf /var/lib/apt/lists/*`,'RUN if getent passwd 1000 >/dev/null; then usermod --login sandbox --home /sandbox --move-home --shell /bin/bash "$(getent passwd 1000 | cut -d: -f1)"; else useradd --uid 1000 --create-home --home-dir /sandbox --shell /bin/bash sandbox; fi && chown -R 1000:1000 /sandbox'];r&&c.push("","COPY --from=node:22-bookworm-slim /usr/local/ /usr/local/"),a&&c.push("","RUN python3 -m venv /usr/local/venv",'ENV PATH="/usr/local/venv/bin:${PATH}"'),e.runtimes.includes("vscode")&&c.push(`RUN echo 'ca_certificate = ${qY}' >> /etc/wgetrc`);for(const m of t.filter(p=>p.npm))c.push(`RUN npm install --global ${m.ignoreScripts?"--ignore-scripts ":""}${m.npm}`);e.agents.includes("pi")&&c.push("RUN ln -sf /usr/bin/fdfind /usr/local/bin/fd"),e.agents.includes("aider")&&c.push("RUN python3 -m venv /opt/aider && /opt/aider/bin/pip install --no-cache-dir aider-chat && ln -s /opt/aider/bin/aider /usr/local/bin/aider"),e.agents.includes("claude")&&c.push("RUN curl -fsSL https://claude.ai/install.sh -o /tmp/install-claude.sh && bash /tmp/install-claude.sh && cp -L /root/.local/bin/claude /usr/local/bin/claude && chmod 0755 /usr/local/bin/claude && rm -rf /root/.local /root/.claude* /tmp/install-claude.sh"),c.push("","ENV HOME=/sandbox",'ENV PATH="/sandbox/.local/bin:/sandbox/.npm-global/bin:/sandbox/.opencode/bin:${PATH}"',"ENV NPM_CONFIG_PREFIX=/sandbox/.npm-global","USER sandbox","WORKDIR /sandbox");for(const m of t.filter(p=>p.install))c.push(`RUN ${m.install} && command -v ${m.command}`);for(const m of e.customAgents??[])c.push(`RUN ${JSON.stringify(["/bin/bash","-euo","pipefail","-c",m.install])}`);return e.repository&&c.push(`RUN git clone -- ${ey(e.repository)} /sandbox/project`,"WORKDIR /sandbox/project"),e.setup.trim()&&c.push("COPY --chown=1000:1000 setup.sh /tmp/template-setup.sh","RUN bash -eu /tmp/template-setup.sh"),e.agents.includes("antigravity")&&c.push(`RUN printf '%s\\n' ${HY.split(`
|
|
517
|
+
`).map(ey).join(" ")} >> ${e.repository?"/sandbox/project":"/sandbox"}/GEMINI.md`),(h=e.setups)!=null&&h.length&&c.push("COPY --chown=1000:1000 setup-bundles/ /sandbox/.openshell/bundles/"),c.push("",'CMD ["/bin/bash"]',""),c.join(`
|
|
518
|
+
`)}const uE="openshell.console/session",JY="openshell.console/project",zp=e=>!!(e!=null&&e.remote&&/^console-ssh-[a-f0-9]{24}$/.test(e.name??e.gateway??"")),eK=e=>{var r;const t=(r=e==null?void 0:e.labels)==null?void 0:r[JY];return typeof t=="string"&&/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(t)?t:null},tK={shell:"/bin/bash -l",...Object.fromEntries(Ws.map(e=>[e.command,e.command]))},nK=e=>Object.hasOwn(tK,e??""),sK=e=>{var t;return nK((t=e==null?void 0:e.labels)==null?void 0:t[uE])?e.labels[uE]:"shell"},u4=e=>{var t;return e==="shell"?"Shell":((t=Ws.find(r=>r.command===e))==null?void 0:t.name)??e};function hte(e){const t=sK(e),r=c4(e).flatMap(i=>Ws.filter(c=>c.name===i.name).map(c=>c.command)),a=[...new Set([...t==="shell"?[]:[t],...r])];return[{id:"shell",name:"Shell"},...a.map(i=>({id:i,name:u4(i)}))]}function vg(e,t,r,a=typeof r=="string"?r:(r==null?void 0:r.target)??WR()){var h,m;const i=new URLSearchParams;t&&i.set("session",t);const c=typeof(r==null?void 0:r.gateway)=="string"?r.gateway:((h=r==null?void 0:r.gateway)==null?void 0:h.name)??(r==null?void 0:r.name),u=(r==null?void 0:r.workspace)??((m=r==null?void 0:r.gateway)==null?void 0:m.workspace);c&&u&&(i.set("gateway",c),i.set("workspace",u),r!=null&&r.remote&&i.set("remote","1"));const f=i.toString();return`?target=${a}#terminal/${encodeURIComponent(e)}${f?`?${f}`:""}`}function Mw(e){if(e==null)return[];const t=Array.isArray(e)?e:[e];if(t.some(r=>typeof r!="string"||!r))throw new Error("Groups must be a list of group IDs.");return[...new Set(t)]}const Mx=(e,t)=>e.appliesTo.everyone||Mw(t.groups??t.group).some(r=>e.appliesTo.groups.includes(r))||e.appliesTo.sandboxes.includes(t.name)||(e.appliesTo.setups??[]).some(r=>(t.setups??[]).includes(r)),rK=e=>e.startsWith("*")||!e.includes(".")?[e]:[e,`**.${e}`],oK=e=>e.flatMap(rK);function d4(e,t){if(t=String(t??"").toLowerCase(),e.startsWith("**."))return t.endsWith(e.slice(2));if(e.startsWith("*.")){const r=e.slice(1);return t.endsWith(r)&&!t.slice(0,-r.length).includes(".")&&t.length>r.length}return t===e}const f4=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48).replace(/-$/,""),ir=(e,t)=>{var r;return Mw((r=e==null?void 0:e.assignments)==null?void 0:r[t])},h4=(e,t)=>(e??[]).filter(r=>Mx(r,t)),Ow=(e,t)=>(e??[]).filter(r=>!r.appliesTo.everyone&&r.appliesTo.groups.includes(t));function dE({pressed:e,onClick:t,children:r,count:a,muted:i}){return n.jsxs("button",{type:"button","aria-pressed":e,onClick:t,className:Ve("flex items-center gap-1.5 rounded-md border px-3 py-2 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e?"border-foreground/50 bg-accent font-medium text-foreground":"border-foreground/20 bg-background text-foreground hover:border-foreground/40 hover:bg-accent/50"),children:[e?n.jsx(Yn,{className:"size-3","aria-hidden":"true"}):!i&&n.jsx(Xa,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),r,a!=null&&n.jsx("span",{className:"font-mono text-[10px] tabular-nums text-faint",children:a})]})}function aK({onCreated:e,existing:t}){const r=Pt(),[a,i]=x.useState(!1),[c,u]=x.useState(""),[f,h]=x.useState(!1),[m,p]=x.useState(null),g=f4(c),b=t.some(w=>w.id===g);async function v(){if(!(!g||b)){h(!0),p(null);try{const{group:w}=await r.saveGroup({id:g,name:c.trim(),description:"",isNew:!0});i(!1),u(""),e(w)}catch(w){p(w.message)}finally{h(!1)}}}return a?n.jsxs("div",{className:"grid w-full gap-1",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{value:c,onChange:w=>u(w.target.value),autoFocus:!0,placeholder:"Frontend","aria-label":"New group name",className:"h-7 max-w-52 text-xs",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),v()),w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),i(!1))}}),n.jsxs(le,{type:"button",size:"xs",onClick:v,disabled:f||!g||b,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Nt,{"aria-hidden":"true"}),"Create"]}),n.jsx(le,{type:"button",size:"xs",variant:"ghost",onClick:()=>{i(!1),u("")},children:"Cancel"})]}),(m||b)&&n.jsx("p",{className:"text-[11px] text-red-700",children:m??`A group called "${c.trim()}" already exists.`})]}):n.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground outline-none transition-colors hover:border-foreground/30 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(ys,{className:"size-3","aria-hidden":"true"}),"New group"]})}function cc({groups:e,counts:t={},value:r,onChange:a,multiple:i=!1,required:c=!1,allowCreate:u=!0,onCreated:f}){const h=x.useId(),m=i?r:r?[r]:[],p=g=>{a(i?m.includes(g)?m.filter(b=>b!==g):[...m,g]:g)};return n.jsxs("div",{role:"group","aria-label":i?"Choose groups":"Choose a group",className:"flex flex-wrap items-center gap-1.5",children:[!i&&!c&&n.jsx(dE,{pressed:!r,onClick:()=>a(null),muted:!0,children:"No group"}),e.map(g=>c&&!i?n.jsxs("label",{className:"relative min-w-0 cursor-pointer",children:[n.jsx("input",{type:"radio",name:h,value:g.id,checked:r===g.id,onChange:()=>a(g.id),required:!0,className:"peer sr-only"}),n.jsxs("span",{className:"flex items-center gap-1.5 rounded-md border border-foreground/20 bg-background px-3 py-2 text-xs text-foreground transition-colors hover:border-foreground/40 hover:bg-accent/50 peer-checked:border-foreground/50 peer-checked:bg-accent peer-checked:font-medium peer-focus-visible:ring-2 peer-focus-visible:ring-ring",children:[r===g.id?n.jsx(Yn,{className:"size-3 shrink-0","aria-hidden":"true"}):n.jsx(Xa,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),n.jsx("span",{className:"break-words",children:g.name}),t[g.id]!=null&&n.jsx("span",{"aria-label":`${t[g.id]} sandboxes`,className:"font-mono text-[10px] text-faint",children:t[g.id]})]})]},g.id):n.jsx(dE,{pressed:m.includes(g.id),onClick:()=>p(g.id),count:t[g.id],children:g.name},g.id)),u&&n.jsx(aK,{existing:e,onCreated:g=>{f==null||f(g),p(g.id)}})]})}function ga({location:e}){return e?n.jsxs("span",{className:`inline-flex shrink-0 items-center rounded border px-1.5 py-0.5 text-[10px] font-normal ${e.connected?"border-border text-muted-foreground":"border-amber-500/40 text-amber-600"}`,title:e.error||`${e.gateway} · ${e.workspace}`,children:[Dn(e),!e.connected&&" · Disconnected"]}):null}function iK(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const lK=e=>{switch(e){case"success":return dK;case"info":return hK;case"warning":return fK;case"error":return mK;default:return null}},cK=Array(12).fill(0),uK=({visible:e,className:t})=>nt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},nt.createElement("div",{className:"sonner-spinner"},cK.map((r,a)=>nt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),dK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),fK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),hK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),mK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},nt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),pK=nt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},nt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),nt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),gK=()=>{const[e,t]=nt.useState(document.hidden);return nt.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[]),e};let xK=1;const bK=100,fE=e=>{var t;return typeof(e==null?void 0:e.id)=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:xK++};class vK{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(r=>t(r)),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-bK;t<=0||(this.toasts=this.toasts.filter(r=>t>0&&this.dismissedToasts.has(r.id)?(this.dismissedToasts.delete(r.id),t--,!1):!0))},this.create=t=>{const{message:r,...a}=t,i=fE(t),c=this.pendingDismissals.get(i);c!==void 0&&(cancelAnimationFrame(c),this.pendingDismissals.delete(i),this.dismissedToasts.delete(i));const u=this.dismissedToasts.has(i),f=t.dismissible===void 0?!0:t.dismissible;return u&&(this.dismissedToasts.delete(i),this.toasts=this.toasts.filter(m=>m.id!==i)),(u?void 0:this.toasts.find(m=>m.id===i))?this.toasts=this.toasts.map(m=>m.id===i?(this.publish({...m,...t,id:i,title:r}),{...m,...t,id:i,dismissible:f,title:r}):m):this.addToast({title:r,...a,dismissible:f,id:i}),i},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(a=>{this.dismissedToasts.add(a.id),this.subscribers.forEach(i=>i({id:a.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);const r=this.pendingDismissals.get(t);return r!==void 0&&cancelAnimationFrame(r),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(a=>a({id:t,dismiss:!0}))})),t},this.message=(t,r)=>this.create({...r,message:t,type:void 0}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let c=a!==void 0,u;const f=i.then(async m=>{if(u=["resolve",m],nt.isValidElement(m))c=!1,this.create({id:a,type:"default",message:m});else if(wK(m)&&!m.ok){c=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description,w=typeof g=="object"&&!nt.isValidElement(g)?g:{message:g};this.create({id:a,type:"error",description:b,...w})}else if(m instanceof Error){c=!1;const g=typeof r.error=="function"?await r.error(m):r.error,b=typeof r.description=="function"?await r.description(m):r.description,w=typeof g=="object"&&!nt.isValidElement(g)?g:{message:g};this.create({id:a,type:"error",description:b,...w})}else if(r.success!==void 0){c=!1;const g=typeof r.success=="function"?await r.success(m):r.success,b=typeof r.description=="function"?await r.description(m):r.description,w=typeof g=="object"&&!nt.isValidElement(g)?g:{message:g};this.create({id:a,type:"success",description:b,...w})}}).catch(async m=>{if(u=["reject",m],r.error!==void 0){c=!1;const p=typeof r.error=="function"?await r.error(m):r.error,g=typeof r.description=="function"?await r.description(m):r.description,v=typeof p=="object"&&!nt.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:g,...v})}}).finally(()=>{c&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),h=()=>new Promise((m,p)=>f.then(()=>u[0]==="reject"?p(u[1]):m(u[1])).catch(p));return typeof a!="string"&&typeof a!="number"?{unwrap:h}:Object.assign(a,{unwrap:h})},this.custom=(t,r)=>{const a=fE(r);return this.create({...r,jsx:t(a),id:a,type:void 0}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const vr=new vK,yK=(e,t)=>vr.message(e,t),wK=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",jK=yK,SK=()=>vr.toasts,NK=()=>vr.getActiveToasts(),He=Object.assign(jK,{success:vr.success,info:vr.info,warning:vr.warning,error:vr.error,custom:vr.custom,message:vr.message,promise:vr.promise,dismiss:vr.dismiss,loading:vr.loading},{getHistory:SK,getToasts:NK});iK("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ep(e){return e.label!==void 0}const CK=3,kK="24px",TK="16px",hE=4e3,EK=356,RK=14,AK=45,MK=200;function Jo(...e){return e.filter(Boolean).join(" ")}function OK(e){const[t,r]=e.split("-"),a=[];return t&&a.push(t),r&&a.push(r),a}const DK=e=>{var t,r,a,i,c,u,f,h,m;const{invert:p,toast:g,unstyled:b,interacting:v,setHeights:w,visibleToasts:C,heights:S,index:N,toasts:E,expanded:k,removeToast:A,defaultRichColors:M,closeButton:R,style:T,cancelButtonStyle:O,actionButtonStyle:D,className:B="",descriptionClassName:F="",duration:K,position:$,gap:P,expandByDefault:U,classNames:H,icons:W,closeButtonAriaLabel:q="Close toast"}=e,[Z,z]=nt.useState(null),[L,X]=nt.useState(null),[ee,_]=nt.useState(!1),[V,G]=nt.useState(!1),[Y,ne]=nt.useState(!1),[te,ye]=nt.useState(!1),[ae,ue]=nt.useState(!1),[se,Q]=nt.useState(0),[ie,oe]=nt.useState(0),pe=nt.useRef(g.duration||K||hE),xe=nt.useRef(null),je=nt.useRef(null),Ie=N===0,ce=N+1<=C,Te=g.type,re=Te??"default",fe=g.dismissible!==!1,Re=g.className||"",Oe=g.descriptionClassName||"",ke=nt.useMemo(()=>S.findIndex(Ze=>Ze.toastId===g.id)||0,[S,g.id]),he=nt.useMemo(()=>{var Ze;return(Ze=g.closeButton)!=null?Ze:R},[g.closeButton,R]),Ae=nt.useMemo(()=>g.duration||K||hE,[g.duration,K]),ge=nt.useRef(0),Pe=nt.useRef(0),Fe=nt.useRef(0),_e=nt.useRef(null),[Xe,Je]=$.split("-"),ct=nt.useMemo(()=>S.reduce((Ze,Tt,Se)=>Se>=ke?Ze:Ze+Tt.height,0),[S,ke]),At=gK(),rt=nt.useMemo(()=>{var Ze;return(Ze=e.swipeDirections)!=null?Ze:OK($)},[e.swipeDirections,$]),ve=g.invert||p,Ue=Te==="loading";Pe.current=nt.useMemo(()=>ke*P+ct,[ke,ct]),nt.useEffect(()=>{pe.current=Ae},[Ae]),nt.useEffect(()=>{_(!0)},[]),nt.useEffect(()=>{const Ze=je.current;if(Ze){const Tt=Ze.getBoundingClientRect().height;return oe(Tt),w(Se=>[{toastId:g.id,height:Tt,position:g.position},...Se]),()=>w(Se=>Se.filter(Ye=>Ye.toastId!==g.id))}},[w,g.id]),nt.useLayoutEffect(()=>{if(!ee)return;const Ze=je.current,Tt=Ze.style.height;Ze.style.height="auto";const Se=Ze.getBoundingClientRect().height;Ze.style.height=Tt,oe(Se),w(Ye=>Ye.find(it=>it.toastId===g.id)?Ye.map(it=>it.toastId===g.id?{...it,height:Se}:it):[{toastId:g.id,height:Se,position:g.position},...Ye])},[ee,g.title,g.description,w,g.id,g.jsx,g.action,g.cancel]);const Qe=nt.useCallback(()=>{G(!0),Q(Pe.current),w(Ze=>Ze.filter(Tt=>Tt.toastId!==g.id)),setTimeout(()=>{A(g)},MK)},[g,A,w,Pe]);nt.useEffect(()=>{if(g.promise&&Te==="loading"||g.duration===1/0||g.type==="loading")return;let Ze;return k||v||At?(()=>{if(Fe.current<ge.current){const Ye=new Date().getTime()-ge.current;pe.current=pe.current-Ye}Fe.current=new Date().getTime()})():(()=>{pe.current!==1/0&&(ge.current=new Date().getTime(),Ze=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),Qe()},pe.current))})(),()=>clearTimeout(Ze)},[k,v,g,Te,At,Qe]),nt.useEffect(()=>{g.delete&&(Qe(),g.onDismiss==null||g.onDismiss.call(g,g))},[Qe,g.delete]);function xt(){var Ze;if(W!=null&&W.loading){var Tt;return nt.createElement("div",{className:Jo(H==null?void 0:H.loader,g==null||(Tt=g.classNames)==null?void 0:Tt.loader,"sonner-loader"),"data-visible":Te==="loading"},W.loading)}return nt.createElement(uK,{className:Jo(H==null?void 0:H.loader,g==null||(Ze=g.classNames)==null?void 0:Ze.loader),visible:Te==="loading"})}const Ke=g.icon||(W==null?void 0:W[Te])||lK(Te);var Be,jt;return nt.createElement("li",{tabIndex:0,ref:je,className:Jo(B,Re,H==null?void 0:H.toast,g==null||(t=g.classNames)==null?void 0:t.toast,H==null?void 0:H[re],g==null||(r=g.classNames)==null?void 0:r[re]),"data-sonner-toast":"","data-rich-colors":(Be=g.richColors)!=null?Be:M,"data-styled":!(g.jsx||g.unstyled||b),"data-mounted":ee,"data-promise":!!g.promise,"data-swiped":ae,"data-removed":V,"data-visible":ce,"data-y-position":Xe,"data-x-position":Je,"data-index":N,"data-front":Ie,"data-swiping":Y,"data-dismissible":fe,"data-type":Te,"data-invert":ve,"data-swipe-out":te,"data-swipe-direction":L,"data-expanded":!!(k||U&&ee),"data-testid":g.testId,style:{"--index":N,"--toasts-before":N,"--z-index":E.length-N,"--offset":`${V?se:Pe.current}px`,"--initial-height":U?"auto":`${ie}px`,...T,...g.style},onDragEnd:()=>{ne(!1),z(null),_e.current=null},onPointerDown:Ze=>{Ze.button!==2&&(Ue||!fe||(xe.current=new Date,Q(Pe.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(ne(!0),_e.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,Tt,Se;if(te||!fe)return;_e.current=null;const Ye=Number(((Ze=je.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),et=Number(((Tt=je.current)==null?void 0:Tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),it=new Date().getTime()-((Se=xe.current)==null?void 0:Se.getTime()),lt=Z==="x"?Ye:et,wt=Math.abs(lt)/it;if((Z==="x"?rt.includes(Ye>0?"right":"left"):rt.includes(et>0?"bottom":"top"))&&(Math.abs(lt)>=AK||wt>.11)){Q(Pe.current),g.onDismiss==null||g.onDismiss.call(g,g),X(Z==="x"?Ye>0?"right":"left":et>0?"down":"up"),Qe(),ye(!0);return}else{var Gt,fn;(Gt=je.current)==null||Gt.style.setProperty("--swipe-amount-x","0px"),(fn=je.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}ue(!1),ne(!1),z(null)},onPointerMove:Ze=>{var Tt,Se,Ye;if(!_e.current||!fe||((Tt=window.getSelection())==null?void 0:Tt.toString().length)>0)return;const it=Ze.clientY-_e.current.y,lt=Ze.clientX-_e.current.x;!Z&&(Math.abs(lt)>1||Math.abs(it)>1)&&z(Math.abs(lt)>Math.abs(it)?"x":"y");let wt={x:0,y:0};const cn=Gt=>1/(1.5+Math.abs(Gt)/20);if(Z==="y"){if(rt.includes("top")||rt.includes("bottom"))if(rt.includes("top")&&it<0||rt.includes("bottom")&&it>0)wt.y=it;else{const Gt=it*cn(it);wt.y=Math.abs(Gt)<Math.abs(it)?Gt:it}}else if(Z==="x"&&(rt.includes("left")||rt.includes("right")))if(rt.includes("left")&<<0||rt.includes("right")&<>0)wt.x=lt;else{const Gt=lt*cn(lt);wt.x=Math.abs(Gt)<Math.abs(lt)?Gt:lt}(Math.abs(wt.x)>0||Math.abs(wt.y)>0)&&ue(!0),(Se=je.current)==null||Se.style.setProperty("--swipe-amount-x",`${wt.x}px`),(Ye=je.current)==null||Ye.style.setProperty("--swipe-amount-y",`${wt.y}px`)}},he&&!g.jsx&&Te!=="loading"?nt.createElement("button",{"aria-label":q,"data-disabled":Ue,"data-close-button":!0,onClick:Ue||!fe?()=>{}:()=>{Qe(),g.onDismiss==null||g.onDismiss.call(g,g)},className:Jo(H==null?void 0:H.closeButton,g==null||(a=g.classNames)==null?void 0:a.closeButton)},(jt=W==null?void 0:W.close)!=null?jt:pK):null,(Te||g.icon||g.promise)&&g.icon!==null&&((W==null?void 0:W[Te])!==null||g.icon)?nt.createElement("div",{"data-icon":"",className:Jo(H==null?void 0:H.icon,g==null||(i=g.classNames)==null?void 0:i.icon)},Te==="loading"?g.icon||xt():g.promise?xt():null,Te!=="loading"?Ke:null):null,nt.createElement("div",{"data-content":"",className:Jo(H==null?void 0:H.content,g==null||(c=g.classNames)==null?void 0:c.content)},nt.createElement("div",{"data-title":"",className:Jo(H==null?void 0:H.title,g==null||(u=g.classNames)==null?void 0:u.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?nt.createElement("div",{"data-description":"",className:Jo(F,Oe,H==null?void 0:H.description,g==null||(f=g.classNames)==null?void 0:f.description)},typeof g.description=="function"?g.description():g.description):null),nt.isValidElement(g.cancel)?g.cancel:g.cancel&&ep(g.cancel)?nt.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||O,onClick:Ze=>{ep(g.cancel)&&fe&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,Ze),Qe())},className:Jo(H==null?void 0:H.cancelButton,g==null||(h=g.classNames)==null?void 0:h.cancelButton)},g.cancel.label):null,nt.isValidElement(g.action)?g.action:g.action&&ep(g.action)?nt.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||D,onClick:Ze=>{ep(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,Ze),!Ze.defaultPrevented&&Qe())},className:Jo(H==null?void 0:H.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function mE(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function zK(e,t){const r={};return[e,t].forEach((a,i)=>{const c=i===1,u=c?"--mobile-offset":"--offset",f=c?TK:kK;function h(m){["top","right","bottom","left"].forEach(p=>{r[`${u}-${p}`]=typeof m=="number"?`${m}px`:m})}typeof a=="number"||typeof a=="string"?h(a):typeof a=="object"?["top","right","bottom","left"].forEach(m=>{a[m]===void 0?r[`${u}-${m}`]=f:r[`${u}-${m}`]=typeof a[m]=="number"?`${a[m]}px`:a[m]}):h(f)}),r}const IK=nt.forwardRef(function(t,r){const{id:a,invert:i,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:f,closeButton:h,className:m,offset:p,mobileOffset:g,theme:b="light",richColors:v,duration:w,style:C,visibleToasts:S=CK,toastOptions:N,dir:E=mE(),gap:k=RK,icons:A,customAriaLabel:M,containerAriaLabel:R="Notifications"}=t,[T,O]=nt.useState([]),D=nt.useMemo(()=>a?T.filter(_=>_.toasterId===a):T.filter(_=>!_.toasterId),[T,a]),B=nt.useMemo(()=>Array.from(new Set([c].concat(D.filter(_=>_.position).map(_=>_.position)))),[D,c]),[F,K]=nt.useState([]),[$,P]=nt.useState(!1),[U,H]=nt.useState(!1),[W,q]=nt.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=nt.useRef(null),z=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=nt.useRef(null),X=nt.useRef(!1),ee=nt.useCallback(_=>{O(V=>{var G;return(G=V.find(Y=>Y.id===_.id))!=null&&G.delete||vr.dismiss(_.id),V.filter(({id:Y})=>Y!==_.id)})},[]);return nt.useEffect(()=>vr.subscribe(_=>{if(_.dismiss){requestAnimationFrame(()=>{O(V=>V.map(G=>G.id===_.id?{...G,delete:!0}:G))});return}setTimeout(()=>{X7.flushSync(()=>{O(V=>{const G=V.findIndex(Y=>Y.id===_.id);return G!==-1?[...V.slice(0,G),{...V[G],..._},...V.slice(G+1)]:[_,...V]})})})}),[]),nt.useEffect(()=>{if(b!=="system"){q(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const _=window.matchMedia("(prefers-color-scheme: dark)");try{_.addEventListener("change",({matches:V})=>{q(V?"dark":"light")})}catch{_.addListener(({matches:G})=>{try{q(G?"dark":"light")}catch(Y){console.error(Y)}})}},[b]),nt.useEffect(()=>{T.length<=1&&P(!1)},[T]),nt.useEffect(()=>{const _=V=>{var G;if(u.length>0&&u.every(te=>V[te]||V.code===te)){var ne;P(!0),(ne=Z.current)==null||ne.focus()}V.code==="Escape"&&(document.activeElement===Z.current||(G=Z.current)!=null&&G.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]),nt.useEffect(()=>{if(Z.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,X.current=!1)}},[Z.current]),nt.createElement("section",{ref:r,"aria-label":M??`${R} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},B.map((_,V)=>{var G;const[Y,ne]=_.split("-");return D.length?nt.createElement("ol",{key:_,dir:E==="auto"?mE():E,tabIndex:-1,ref:Z,className:m,"data-sonner-toaster":!0,"data-sonner-theme":W,"data-y-position":Y,"data-x-position":ne,style:{"--front-toast-height":`${((G=F[0])==null?void 0:G.height)||0}px`,"--width":`${EK}px`,"--gap":`${k}px`,...C,...zK(p,g)},onBlur:te=>{X.current&&!te.currentTarget.contains(te.relatedTarget)&&(X.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||X.current||(X.current=!0,L.current=te.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{U||P(!1)},onDragEnd:()=>P(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},D.filter(te=>!te.position&&V===0||te.position===_).map((te,ye)=>{var ae,ue;return nt.createElement(DK,{key:te.id,icons:A,index:ye,toast:te,defaultRichColors:v,duration:(ae=N==null?void 0:N.duration)!=null?ae:w,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:i,visibleToasts:S,closeButton:(ue=N==null?void 0:N.closeButton)!=null?ue:h,interacting:U,position:_,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,closeButtonAriaLabel:N==null?void 0:N.closeButtonAriaLabel,removeToast:ee,toasts:D.filter(se=>se.position==te.position),heights:F.filter(se=>se.position==te.position),setHeights:K,expandByDefault:f,gap:k,expanded:$,swipeDirections:t.swipeDirections})})):null}))}),PK={info:{icon:n.jsx(Du,{className:"size-4 text-muted-foreground"}),role:"status"},progress:{icon:n.jsx(Nt,{className:"size-4 text-muted-foreground"}),role:"status"},success:{icon:n.jsx(Yn,{className:"size-4 text-emerald-600"}),role:"status"},warning:{icon:n.jsx(ti,{className:"size-4 text-amber-600"}),role:"alert"},error:{icon:n.jsx(LA,{className:"size-4 text-destructive"}),role:"alert"}};function _K({tone:e="info",title:t,children:r,actions:a,onDismiss:i,dismissLabel:c}){const{icon:u,role:f}=PK[e];return n.jsxs("div",{role:f,className:"flex w-[var(--width)] max-w-full gap-3 rounded-[var(--radius)] border border-border bg-popover p-4 text-xs text-popover-foreground shadow-lg",children:[n.jsx("span",{className:"mt-px shrink-0","aria-hidden":"true",children:u}),n.jsxs("div",{className:"min-w-0 flex-1",children:[t&&n.jsx("p",{className:"break-words font-medium",children:t}),r&&n.jsx("div",{className:"mt-0.5 break-words text-muted-foreground",children:r}),a&&n.jsx("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:a})]}),i&&n.jsx("button",{type:"button","aria-label":c??"Dismiss notification",onClick:i,className:"-mt-1 -mr-1 size-6 shrink-0 rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"mx-auto size-3.5"})})]})}function xa({id:e,...t}){return x.useEffect(()=>{const r=setTimeout(()=>He.custom(()=>n.jsx(_K,{...t}),{id:e,duration:1/0,dismissible:!1,unstyled:!0}));return()=>clearTimeout(r)}),x.useEffect(()=>()=>{He.dismiss(e)},[e]),null}const LK="Not downloaded yet. Import downloads this npm package and checks that it starts, in a temporary sandbox.",Dw=e=>e===LK||e.startsWith("Prepare package"),zw=e=>e.kind==="mcp"&&!e.disabled&&!e.config&&!e.configuration&&!e.package;function $K(e){const t=new Map([["shadcn","ui.shadcn.com"],["@magicuidesign/mcp","magicui.design"]]).get(e==null?void 0:e.name);return t?[{phase:"runtime",host:t,port:443,reason:"Default component registry this MCP reads from."}]:[]}function m4(e){var r;const t=new Set(e.preparationIssues||[]);return!!(!e.disabled&&e.package&&!e.artifact&&!((r=e.credentialFields)!=null&&r.length)&&e.issues.every(a=>Dw(a)||t.has(a)))}function BK(e){return!e.disabled&&(!e.issues.length||m4(e))}function VK(e){const t=e.requirements||[];return[...t,...$K(e.package).filter(r=>!t.some(a=>a.host===r.host&&a.phase===r.phase))]}const pE=e=>e.items.some(t=>!t.disabled&&t.issues.length>0),p4=e=>!!(e!=null&&e.useSourceSecrets||e!=null&&e.provider||Object.values((e==null?void 0:e.secrets)||{}).some(Boolean)),g4=(e,t)=>e.issues.filter(r=>{var a;return!Dw(r)&&!((a=e.preparationIssues)!=null&&a.includes(r))&&!(r.startsWith("Connect credentials")&&p4(t))}),UK=(e,t={})=>new Map(e.items.map(r=>[r.id,new Set(g4(r,t[r.id]))])),HK=(e,t={})=>e.items.filter(r=>!r.disabled&&g4(r,t[r.id]).length>0),FK=(e,t)=>t.items.some(r=>!r.disabled&&r.issues.some(a=>{var i;return!((i=e.get(r.id))!=null&&i.has(a))}));async function GK(e,t,r,a,{onProgress:i=()=>{},onReview:c=()=>{},isCancelled:u=()=>!1,resumeJob:f,wait:h=m=>new Promise(p=>setTimeout(p,m))}={}){const m=UK(t,a);let p=f||await e.prepareSetup(t.token,a);i(p);let g=0;for(;p.status==="running";){await h(1500*Math.min(g+1,4));try{p=await e.setupPreparation(p.id),g=0}catch(v){if(++g>=20)throw v;continue}i(p)}if(p.review&&c(p.review),p.status==="cancelled"||u())return{status:"cancelled",review:p.review};if(p.status!=="complete"||!p.review)throw new Error(p.message||"Import could not finish. Try again.");return FK(m,p.review)?{status:"needs-attention",review:p.review}:(i({...p,message:"Saving your setup…"}),{status:"saved",setup:await e.saveSetup(p.review.token,r,!0),inactive:p.review.items.filter(v=>!v.disabled&&v.issues.length).map(v=>v.name)})}const ia={own:{label:"Sandbox",swatch:"bg-stone-700",beam:["#a8a29e","#44403c"]},agent:{label:"Agent defaults",swatch:"bg-indigo-500",beam:["#a5b4fc","#6366f1"]},org:{label:"Shared",swatch:"bg-[#4a5568]",beam:["#94a3b8","#4a5568"]},group:{label:"Inherited",swatch:"bg-teal-600",beam:["#5eead4","#0f766e"]},policy:{label:"Network rule",swatch:"bg-indigo-600",beam:["#a5b4fc","#4338ca"]},secret:{label:"Secret",swatch:"bg-amber-600",beam:["#fcd34d","#b45309"]}},yg=["org","policy","group","agent","own","secret"],Ya=e=>e.startsWith("_provider_")?"secret":e.startsWith("egress_")?"policy":e.startsWith("org_")?"org":e.startsWith("group_")?"group":e.startsWith("agent-")?"agent":"own",cf=e=>e.replace(/^_provider_/,"").replace(/^(org|group|egress)_/,"").replace(/_/g,"-");function Iw(e){if(!e)return null;try{return new URL(e.includes("://")?e:`https://${e}`).hostname}catch{return e.split("/")[0].replace(/:\d+$/,"")}}function x4(e){try{const t=new URL(e.includes("://")?e:`https://${e}`);return Number(t.port)||(t.protocol==="http:"?80:443)}catch{return 443}}const wg=e=>e.split("/").pop(),b4=e=>/^\d+\.\d+\.\d+\.\d+$/.test(e);function qK(e){const t=String(e).replace(/^\*\*?\./,"").split(".");return(t.length>=3&&["co","com","org","net","ac","gov"].includes(t.at(-2))?t.at(-3):t.at(-2)??t[0])??e}function v4(e,t,r){var h,m;const a=new Map,i=new Map,c=new Map;for(const p of e){const g=new Set,b={};for(const v of p.rules){const w=Ya(v.key);b[w]=(b[w]??0)+1;for(const C of v.endpoints){if(C.blocked)continue;g.add(C.host);const S=a.get(C.host)??{host:C.host,sources:new Set,access:new Set,ports:new Set,sandboxes:new Set,grants:[],hits:0,hitsBySandbox:new Map};S.sources.add(w),S.access.add(C.access),C.ports.forEach(E=>S.ports.add(E)),S.sandboxes.add(p.name);let N=S.grants.find(E=>E.sandbox===p.name&&E.key===v.key);N||(N={sandbox:p.name,key:v.key,source:w,access:[],ports:[]},S.grants.push(N)),N.access.push(C.access),N.ports.push(...C.ports),a.set(C.host,S)}}i.set(p.name,g),c.set(p.name,{counts:b,blocked:0})}const u=new Map;for(const p of t){if(p.kind!=="audit"||!p.verdict)continue;const g=Iw(p.destination);if(!g||b4(g))continue;if(p.verdict==="allowed"){const w=a.get(g);w&&(w.hits+=1,w.hitsBySandbox.set(p.sandbox,(w.hitsBySandbox.get(p.sandbox)??0)+1));continue}if(p.verdict!=="denied"||(h=i.get(p.sandbox))!=null&&h.has(g))continue;const b=u.get(g)??{host:g,port:x4(p.destination),sandboxes:new Set,attempts:0,programs:new Set,lastAt:null};b.attempts+=1,b.sandboxes.add(p.sandbox),p.binary&&b.programs.add(p.binary),p.at&&(!b.lastAt||p.at>b.lastAt)&&(b.lastAt=p.at),u.set(g,b);const v=c.get(p.sandbox);v&&(v.blocked+=1)}const f=oK([...((m=r==null?void 0:r.org)==null?void 0:m.blocked)??[],...((r==null?void 0:r.policies)??[]).filter(p=>p.action==="block").flatMap(p=>p.destinations)]);return{destinations:[...a.values()].sort((p,g)=>g.sandboxes.size-p.sandboxes.size||g.hits-p.hits||p.host.localeCompare(g.host)),blocked:[...u.values()].filter(p=>!f.some(g=>d4(g,p.host))).sort((p,g)=>g.sandboxes.size-p.sandboxes.size||g.attempts-p.attempts),perSandbox:c}}function YK(e){const t=e.map(r=>{var a,i,c,u,f;return{location:r.location,...v4(((i=(a=r.data)==null?void 0:a.fleetPolicy)==null?void 0:i.sandboxes)??[],((u=(c=r.data)==null?void 0:c.activity)==null?void 0:u.events)??[],(f=r.data)==null?void 0:f.org)}});return{destinations:t.flatMap(r=>r.destinations.map(a=>({...a,location:r.location}))),blocked:t.flatMap(r=>r.blocked.map(a=>({...a,location:r.location}))),perSandbox:new Map(t.flatMap(r=>[...r.perSandbox].map(([a,i])=>[ht({name:a,location:r.location}),i])))}}function KK(e){var r;const t={locations:[],sandboxes:[],templates:[]};for(const{target:a,inventory:i,cloud:c=a==="cloud"}of e){const u=new Map((i.locations??[]).map(f=>{const h={...f,target:a,cloud:c,id:JSON.stringify([a,f.context]),...c?{label:"Cloud"}:{}};return t.locations.push(h),[f.context,h]}));for(const f of["sandboxes","templates"])for(const h of i[f]??[]){const m=u.get((r=h.location)==null?void 0:r.context);m&&t[f].push({...h,location:m})}}return t}function vo(){var m;const e=ds(),t=!!(e!=null&&e.localViewer),r=t&&e.connected,a=`${t}:${r?(m=e.user)==null?void 0:m.uid:""}`,[i,c]=x.useState(null),[u,f]=x.useReducer(p=>p+1,0);x.useEffect(()=>{let p=!0,g;const b=new AbortController,v=lr("local",b.signal);let w=null;const C=async()=>{var A,M;const S=await Promise.allSettled([v.inventory(),...r?[Fa("inventory",void 0,{signal:b.signal})]:[]]);if(!p)return;const N=[],E=[];for(let R=0;R<S.length;R++){const T=R===0?"local":"cloud",O=R!==0||!t,D=S[R];if(D.status==="fulfilled")N.push({target:T,cloud:O,inventory:D.value}),(A=D.value.machine)!=null&&A.error&&E.push(D.value.machine.error);else{E.push(`${O?"Cloud":"Local"} inventory unavailable: ${D.reason.message}`);const B=(M=w==null?void 0:w.filter(F=>F.target===T)[0])==null?void 0:M.inventory;if(B){const F=B.locations.map(K=>({...K,connected:!1,error:D.reason.message}));N.push({target:T,cloud:O,inventory:{...B,locations:F}})}}}w=N;const k=KK(N);en.observeTemplates(k.templates),c({scope:a,inventory:k,error:E.join("; ")||null}),g=setTimeout(C,k.templates.some(R=>R.status==="building")?1200:5e3)};return C(),()=>{p=!1,b.abort(),clearTimeout(g)}},[a,u,t,r]);const h=(i==null?void 0:i.scope)===a?i:null;return{...(h==null?void 0:h.inventory)??{sandboxes:[],templates:[],locations:[]},error:(h==null?void 0:h.error)??null,loading:!h,refresh:f}}async function XK(e,t,r,a=[]){const i=new Map(a.map(c=>[c.location.id??c.location.context,c.data]));return Promise.all(e.map(async c=>{const u=i.get(c.id??c.context);if(!c.connected)return{location:c,data:u??null,error:null};const f=await Promise.allSettled(t.map(p=>r(c)[p]())),h={},m=[];return f.forEach((p,g)=>{p.status==="fulfilled"?h[t[g]]=p.value:((u==null?void 0:u[t[g]])!==void 0&&(h[t[g]]=u[t[g]]),m.push(p.reason.message))}),{location:m.length&&m.length===t.length?{...c,connected:!1}:c,data:Object.keys(h).length?h:null,error:[...new Set(m)].join("; ")||null}}))}function WK(e,t){const r=c=>t.every(u=>{var f;return((f=c.data)==null?void 0:f[u])!==void 0}),a=e.filter(c=>c.error),i=e.filter(c=>!c.error&&!r(c)&&c.location.connected===!1);return{failed:a,offline:i,any:a.length+i.length>0,unavailable:e.length>0&&e.every(c=>!r(c)&&(c.error||c.location.connected===!1))}}const gE=new Map;function Uu(e){var N,E;const t=Bf(),r=ds(),a=vo(),i=e.join(","),c=`${t.owner??""}:${((N=r==null?void 0:r.user)==null?void 0:N.uid)??""}:${i}`,u=JSON.stringify(a.locations.map(({id:k,context:A,connected:M})=>[k,A,M])),f=x.useRef(a.locations);f.current=a.locations;const[h,m]=x.useState(null),[p,g]=x.useState(!0),b=x.useRef(0),v=x.useCallback(k=>{var M;const A=r!=null&&r.localViewer?k.target:t.target;return lr(A,t.signal,k.context,A==="cloud"?((M=r==null?void 0:r.status)==null?void 0:M.owner)??t.owner:t.owner)},[t,r==null?void 0:r.localViewer,(E=r==null?void 0:r.status)==null?void 0:E.owner]),w=x.useCallback(async()=>{var M;const k=++b.current;g(!0);const A=await XK(f.current,i.split(",").filter(Boolean),v,gE.get(c));if(!(k!==b.current||(M=t.signal)!=null&&M.aborted))return gE.set(c,A),m({scope:c,sources:A}),g(!1),A},[v,i,c,t.signal]);x.useEffect(()=>{if(a.loading)return;w();const k=setInterval(w,15e3),A=()=>w();return window.addEventListener("openrod-resources-changed",A),()=>{b.current++,clearInterval(k),window.removeEventListener("openrod-resources-changed",A)}},[w,u,a.loading]);const C=x.useMemo(()=>(h==null?void 0:h.scope)===c?h.sources.map(k=>({...k,location:{...k.location,connected:k.location.connected&&f.current.some(A=>A.id===k.location.id&&A.connected)}})):[],[h,c,u]),S=x.useMemo(()=>WK(C,i.split(",").filter(Boolean)),[C,i]);return{sources:C,status:S,loading:a.loading||p,refresh:w,apiFor:v,locations:a.locations,inventory:a,error:C.filter(k=>k.error).map(k=>`${k.location.label}: ${k.error}`).join("; ")}}function Mu({model:e,what:t,offline:r=!0}){const{failed:a,offline:i}=e.status,c=i.map(u=>Dn(u.location));return n.jsxs(n.Fragment,{children:[a.map(u=>n.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-border px-4 py-2 text-xs text-red-600 sm:px-6",children:[n.jsxs("span",{className:"min-w-0",children:[Dn(u.location),": ",u.error]}),n.jsx(le,{variant:"outline",size:"sm",className:"shrink-0",onClick:e.refresh,children:"Retry"})]},u.location.id??u.location.context)),r&&c.length>0&&n.jsxs("p",{role:"status",className:"border-b border-border px-4 py-1.5 text-[11px] text-muted-foreground sm:px-6",children:[c.join(", ")," ",c.length===1?"is":"are"," offline. Reconnect to see ",c.length===1?"its":"their"," ",t,"."]})]})}const Ef=e=>e.id||`${e.sandbox}|${e.at}|${e.source}|${e.target}|${e.message}`,jg={CRITICAL:6,FATAL:6,HIGH:5,MED:4,MEDIUM:4,LOW:3,INFO:2,INFORMATIONAL:2},QK={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},ZK={NET:"Network",HTTP:"HTTP",SSH:"Session",CONFIG:"Configuration",PROC:"Process",FILE:"File",AUTH:"Authentication",FINDING:"Finding",EVENT:"Event"};function Pw(e){var u,f,h,m,p;const t=((u=e.binary)==null?void 0:u.split("/").pop())||"",r=Rx.find(g=>g.commands.includes(t.toLowerCase())&&t.toLowerCase()!=="agent"),a=r?{name:r.name,logo:`/logos/agents/${r.logo}.svg`}:null,i=e.direction||(e.kind==="inbound"&&["NET","HTTP","SSH"].includes(e.category)?"in":e.kind==="audit"&&["NET","HTTP"].includes(e.category)?"out":"unknown"),c={source:((f=e.location)==null?void 0:f.label)??"",time:e.at??"",sandbox:e.sandbox??"",scope:e.scope??"",sandboxId:e.sandboxId??((h=e.original)==null?void 0:h.sandboxId)??"",agent:(a==null?void 0:a.name)??"Unknown",category:ZK[e.category]??(e.kind==="log"?"Log":"Unclassified"),severity:e.severity||"Not reported",logLevel:e.level&&e.level!=="OCSF"?e.level:"Not reported",direction:i,verdict:e.verdict||(["NET","HTTP","SSH","AUTH"].includes(e.category)?"not reported":"not applicable"),outcome:e.outcome??"unknown",process:e.binary??"",action:[r?"":t,e.method||e.action].filter(Boolean).join(" · ")||"Not reported",destination:e.destination??"",policy:e.policy??"",session:e.sessionId??"",correlation:e.correlationId??"",why:QK[e.reason]??e.reason??""};return{event:e,agent:a,key:Ef(e),values:c,timestamp:Date.parse(e.at),search:[...Object.values(c),e.message,e.detail,e.source,e.target,JSON.stringify(((m=e.original)==null?void 0:m.fields)??((p=e.original)==null?void 0:p.metadata)??{})].join(" ").toLowerCase()}}function k1(e,{query:t="",direction:r="all",sandboxes:a=[],verdicts:i=[],agents:c=[],filters:u={},range:f="all",from:h="",to:m="",now:p=Date.now(),sort:g={key:"time",direction:"desc"}}={}){const b=new Set(a),v=t.trim().toLowerCase(),w=f==="custom"?h?Date.parse(h):-1/0:f==="all"?-1/0:p-Number(f)*6e4,C=f==="custom"&&m?Date.parse(m):1/0;return e.filter(S=>r!=="all"&&S.values.direction!==r||b.size&&!b.has(S.values.sandbox)||c.length&&!c.includes(S.values.agent)||i.length&&!i.includes(S.values.verdict)||v&&!S.search.includes(v)||f!=="all"&&(!Number.isFinite(S.timestamp)||S.timestamp<w||S.timestamp>C)?!1:Object.entries(u).every(([N,E])=>{var k;return!((k=E==null?void 0:E.value)!=null&&k.trim())||(E.mode==="equals"?(S.values[N]??"").toLowerCase()===E.value.trim().toLowerCase():(S.values[N]??"").toLowerCase().includes(E.value.trim().toLowerCase()))!==(E.mode==="excludes")})).sort((S,N)=>{const E=g.key==="severity"?jg[S.values.severity.toUpperCase()]??-1:g.key==="time"?Number.isFinite(S.timestamp)?S.timestamp:0:S.values[g.key]??"",k=g.key==="severity"?jg[N.values.severity.toUpperCase()]??-1:g.key==="time"?Number.isFinite(N.timestamp)?N.timestamp:0:N.values[g.key]??"",A=typeof E=="number"?E-k:E.localeCompare(k,void 0,{numeric:!0});return(g.direction==="asc"?A:-A)||S.key.localeCompare(N.key)})}const y4=x.createContext(null),ty=2e3;function Rf({children:e}){const t=Pt(),r=gn(),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState([]),[m,p]=x.useState("connecting"),[g,b]=x.useState(null),[v,w]=x.useState(null),C=x.useRef(new Set),S=x.useRef(0),[N,E]=x.useState(0),k=x.useCallback(T=>{const O=T.filter(D=>{const B=Ef(D);return C.current.has(B)?!1:(C.current.add(B),!0)});O.length&&h(D=>{const B=[...O,...D].sort((F,K)=>(K.at??"").localeCompare(F.at??""));if(B.length<=ty)return B;for(const F of B.slice(ty))C.current.delete(Ef(F));return B.slice(0,ty)})},[]),A=x.useCallback(async()=>{try{u(await t.overview())}catch(T){u(O=>O??{error:T.message})}},[t]),M=x.useCallback(async()=>{const T=S.current;try{const O=await t.activity({limit:500});if(T!==S.current)return;k(O.events),b(O.coverage),w(null)}catch(O){w(O.message)}},[k,t]);x.useEffect(()=>{let T,O,D=!1;const B=()=>{S.current++,C.current.clear(),h([]),E(F=>F+1),M()};return i(null),u(null),h([]),C.current.clear(),S.current++,t.context().then(async F=>{if(D)return;if(!r&&!F.configured){p("setup-required"),i([]);return}A(),M(),O=setInterval(A,15e3);const K=await t.contextKey();D||(T=new EventSource(t.url("/stream",{context:K,...r?{location:"1"}:{}})),T.onopen=()=>{p("live"),B()},T.addEventListener("context-changed",()=>window.location.reload()),T.addEventListener("activity-deleted",$=>{b(JSON.parse($.data).coverage),B()}),T.onerror=()=>p("reconnecting"),T.addEventListener("sandboxes",$=>{p("live"),i(JSON.parse($.data))}),T.addEventListener("log",$=>k([JSON.parse($.data)])),T.addEventListener("collection",$=>b(JSON.parse($.data))),T.addEventListener("gateway-health",()=>p("live")),T.addEventListener("gateway-error",()=>p("gateway-down")))}).catch(()=>{D||p("gateway-down")}),()=>{D=!0,T==null||T.close(),clearInterval(O)}},[k,M,A,t,r==null?void 0:r.context]);const R=x.useMemo(()=>({sandboxes:a??(c==null?void 0:c.sandboxes)??null,overview:c,events:f,connection:m,collection:g,historyError:v,activityRevision:N,refresh:()=>{A(),M()}}),[a,c,f,m,g,v,N,A,M]);return n.jsx(y4.Provider,{value:R,children:e})}function oi(){const e=x.useContext(y4);if(!e)throw new Error("useLive outside LiveProvider");return e}const xE=["Claude Code","Codex","OpenCode","Pi","Cursor"];function _w(){const[e,t]=x.useState(xE.slice(0,3));return x.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)");let a,i=-1;function c(){clearTimeout(a),!(r.matches||document.hidden)&&(a=setTimeout(()=>{const u=[0,1,2].filter(m=>m!==i),f=u[Math.floor(Math.random()*u.length)];i=f;const h=Math.random();t(m=>{const p=xE.filter(g=>!m.includes(g));return m.map((g,b)=>b===f?p[Math.floor(h*p.length)]:g)}),c()},1100+Math.random()*900))}return c(),r.addEventListener("change",c),document.addEventListener("visibilitychange",c),()=>{clearTimeout(a),r.removeEventListener("change",c),document.removeEventListener("visibilitychange",c)}},[]),n.jsxs("svg",{className:"cloud-agents",viewBox:"50 10 540 340",role:"img","aria-labelledby":"cloud-agents-title cloud-agents-desc",children:[n.jsx("title",{id:"cloud-agents-title",children:"Your agents in OpenRod Cloud"}),n.jsx("desc",{id:"cloud-agents-desc",children:"Claude Code, Codex, OpenCode, Pi, and Cursor on OpenRod Cloud."}),n.jsxs("g",{className:"cloud-spark",children:[n.jsx("path",{d:"M93 105h4v-8h4v8h8v4h-8v8h-4v-8h-8v-4z"}),n.jsx("path",{d:"M544 72h4v-7h4v7h7v4h-7v7h-4v-7h-7v-4z"}),n.jsx("path",{d:"M563 268h4v-6h4v6h6v4h-6v6h-4v-6h-6v-4z"})]}),n.jsx("path",{d:"M98 292h-28v-76h28v-35h55v-48h55v-35h80V74h72v24h48v35h48v48h53v35h30v76h-29v31H98z",fill:"#cadbd7",transform:"translate(0 13)"}),n.jsx("path",{d:"M98 292h-28v-76h28v-35h55v-48h55v-35h80V74h72v24h48v35h48v48h53v35h30v76h-29v31H98z",fill:"#f4f1e8",stroke:"#b3c8c2",strokeWidth:"2"}),n.jsx("path",{d:"M106 291h397",stroke:"#d8ded2",strokeWidth:"2",strokeDasharray:"3 7"}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(165 165)",children:[n.jsxs("g",{className:`cloud-card-face ${e[0]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[0]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]})]}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(267 146)",children:[n.jsxs("g",{className:`cloud-card-face ${e[1]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]}),n.jsxs("g",{className:`cloud-card-face ${e[1]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]})]}),n.jsxs("g",{className:"cloud-card-slot",transform:"translate(369 165)",children:[n.jsxs("g",{className:`cloud-card-face ${e[2]==="OpenCode"?"is-active":""}`,"data-agent":"OpenCode",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e1e6d9"}),n.jsx("image",{href:"/logos/agents/opencode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"OpenCode"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Pi"?"is-active":""}`,"data-agent":"Pi",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e6dfd0"}),n.jsx("image",{href:"/logos/agents/pi.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Pi"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Cursor"?"is-active":""}`,"data-agent":"Cursor",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e2e5df"}),n.jsx("image",{href:"/logos/agents/cursor.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Cursor"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Claude Code"?"is-active":""}`,"data-agent":"Claude Code",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#f0dccb"}),n.jsx("image",{href:"/logos/agents/claudecode.svg",x:"18",y:"18",width:"46",height:"46"}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Claude Code"})]}),n.jsxs("g",{className:`cloud-card-face ${e[2]==="Codex"?"is-active":""}`,"data-agent":"Codex",children:[n.jsx("rect",{width:"82",height:"82",rx:"8",fill:"#e3e3ec"}),n.jsx("svg",{x:"7",y:"1",width:"68",height:"81",viewBox:"335 265 625 735",children:n.jsx("image",{href:"/cloud-agents/codex-character.png",width:"1312",height:"1199"})}),n.jsx("text",{x:"41",y:"102",textAnchor:"middle",fontSize:"10",fill:"#68746b",children:"Codex"})]})]}),n.jsx("g",{role:"img","aria-label":"OpenRod Cloud",children:n.jsx("path",{fill:"#536f67",d:"M226.25 30h2.5v2.5h-2.5zM228.75 30h2.5v2.5h-2.5zM231.25 30h2.5v2.5h-2.5zM223.75 32.5h2.5v2.5h-2.5zM233.75 32.5h2.5v2.5h-2.5zM223.75 35h2.5v2.5h-2.5zM233.75 35h2.5v2.5h-2.5zM223.75 37.5h2.5v2.5h-2.5zM233.75 37.5h2.5v2.5h-2.5zM223.75 40h2.5v2.5h-2.5zM233.75 40h2.5v2.5h-2.5zM223.75 42.5h2.5v2.5h-2.5zM233.75 42.5h2.5v2.5h-2.5zM226.25 45h2.5v2.5h-2.5zM228.75 45h2.5v2.5h-2.5zM231.25 45h2.5v2.5h-2.5zM238.75 30h2.5v2.5h-2.5zM241.25 30h2.5v2.5h-2.5zM243.75 30h2.5v2.5h-2.5zM246.25 30h2.5v2.5h-2.5zM238.75 32.5h2.5v2.5h-2.5zM248.75 32.5h2.5v2.5h-2.5zM238.75 35h2.5v2.5h-2.5zM248.75 35h2.5v2.5h-2.5zM238.75 37.5h2.5v2.5h-2.5zM241.25 37.5h2.5v2.5h-2.5zM243.75 37.5h2.5v2.5h-2.5zM246.25 37.5h2.5v2.5h-2.5zM238.75 40h2.5v2.5h-2.5zM238.75 42.5h2.5v2.5h-2.5zM238.75 45h2.5v2.5h-2.5zM253.75 30h2.5v2.5h-2.5zM256.25 30h2.5v2.5h-2.5zM258.75 30h2.5v2.5h-2.5zM261.25 30h2.5v2.5h-2.5zM263.75 30h2.5v2.5h-2.5zM253.75 32.5h2.5v2.5h-2.5zM253.75 35h2.5v2.5h-2.5zM253.75 37.5h2.5v2.5h-2.5zM256.25 37.5h2.5v2.5h-2.5zM258.75 37.5h2.5v2.5h-2.5zM261.25 37.5h2.5v2.5h-2.5zM253.75 40h2.5v2.5h-2.5zM253.75 42.5h2.5v2.5h-2.5zM253.75 45h2.5v2.5h-2.5zM256.25 45h2.5v2.5h-2.5zM258.75 45h2.5v2.5h-2.5zM261.25 45h2.5v2.5h-2.5zM263.75 45h2.5v2.5h-2.5zM268.75 30h2.5v2.5h-2.5zM278.75 30h2.5v2.5h-2.5zM268.75 32.5h2.5v2.5h-2.5zM271.25 32.5h2.5v2.5h-2.5zM278.75 32.5h2.5v2.5h-2.5zM268.75 35h2.5v2.5h-2.5zM271.25 35h2.5v2.5h-2.5zM278.75 35h2.5v2.5h-2.5zM268.75 37.5h2.5v2.5h-2.5zM273.75 37.5h2.5v2.5h-2.5zM278.75 37.5h2.5v2.5h-2.5zM268.75 40h2.5v2.5h-2.5zM276.25 40h2.5v2.5h-2.5zM278.75 40h2.5v2.5h-2.5zM268.75 42.5h2.5v2.5h-2.5zM276.25 42.5h2.5v2.5h-2.5zM278.75 42.5h2.5v2.5h-2.5zM268.75 45h2.5v2.5h-2.5zM278.75 45h2.5v2.5h-2.5zM283.75 30h2.5v2.5h-2.5zM286.25 30h2.5v2.5h-2.5zM288.75 30h2.5v2.5h-2.5zM291.25 30h2.5v2.5h-2.5zM283.75 32.5h2.5v2.5h-2.5zM293.75 32.5h2.5v2.5h-2.5zM283.75 35h2.5v2.5h-2.5zM293.75 35h2.5v2.5h-2.5zM283.75 37.5h2.5v2.5h-2.5zM286.25 37.5h2.5v2.5h-2.5zM288.75 37.5h2.5v2.5h-2.5zM291.25 37.5h2.5v2.5h-2.5zM283.75 40h2.5v2.5h-2.5zM288.75 40h2.5v2.5h-2.5zM283.75 42.5h2.5v2.5h-2.5zM291.25 42.5h2.5v2.5h-2.5zM283.75 45h2.5v2.5h-2.5zM293.75 45h2.5v2.5h-2.5zM301.25 30h2.5v2.5h-2.5zM303.75 30h2.5v2.5h-2.5zM306.25 30h2.5v2.5h-2.5zM298.75 32.5h2.5v2.5h-2.5zM308.75 32.5h2.5v2.5h-2.5zM298.75 35h2.5v2.5h-2.5zM308.75 35h2.5v2.5h-2.5zM298.75 37.5h2.5v2.5h-2.5zM308.75 37.5h2.5v2.5h-2.5zM298.75 40h2.5v2.5h-2.5zM308.75 40h2.5v2.5h-2.5zM298.75 42.5h2.5v2.5h-2.5zM308.75 42.5h2.5v2.5h-2.5zM301.25 45h2.5v2.5h-2.5zM303.75 45h2.5v2.5h-2.5zM306.25 45h2.5v2.5h-2.5zM313.75 30h2.5v2.5h-2.5zM316.25 30h2.5v2.5h-2.5zM318.75 30h2.5v2.5h-2.5zM321.25 30h2.5v2.5h-2.5zM313.75 32.5h2.5v2.5h-2.5zM323.75 32.5h2.5v2.5h-2.5zM313.75 35h2.5v2.5h-2.5zM323.75 35h2.5v2.5h-2.5zM313.75 37.5h2.5v2.5h-2.5zM323.75 37.5h2.5v2.5h-2.5zM313.75 40h2.5v2.5h-2.5zM323.75 40h2.5v2.5h-2.5zM313.75 42.5h2.5v2.5h-2.5zM323.75 42.5h2.5v2.5h-2.5zM313.75 45h2.5v2.5h-2.5zM316.25 45h2.5v2.5h-2.5zM318.75 45h2.5v2.5h-2.5zM321.25 45h2.5v2.5h-2.5zM346.25 30h2.5v2.5h-2.5zM348.75 30h2.5v2.5h-2.5zM351.25 30h2.5v2.5h-2.5zM353.75 30h2.5v2.5h-2.5zM343.75 32.5h2.5v2.5h-2.5zM343.75 35h2.5v2.5h-2.5zM343.75 37.5h2.5v2.5h-2.5zM343.75 40h2.5v2.5h-2.5zM343.75 42.5h2.5v2.5h-2.5zM346.25 45h2.5v2.5h-2.5zM348.75 45h2.5v2.5h-2.5zM351.25 45h2.5v2.5h-2.5zM353.75 45h2.5v2.5h-2.5zM358.75 30h2.5v2.5h-2.5zM358.75 32.5h2.5v2.5h-2.5zM358.75 35h2.5v2.5h-2.5zM358.75 37.5h2.5v2.5h-2.5zM358.75 40h2.5v2.5h-2.5zM358.75 42.5h2.5v2.5h-2.5zM358.75 45h2.5v2.5h-2.5zM361.25 45h2.5v2.5h-2.5zM363.75 45h2.5v2.5h-2.5zM366.25 45h2.5v2.5h-2.5zM368.75 45h2.5v2.5h-2.5zM376.25 30h2.5v2.5h-2.5zM378.75 30h2.5v2.5h-2.5zM381.25 30h2.5v2.5h-2.5zM373.75 32.5h2.5v2.5h-2.5zM383.75 32.5h2.5v2.5h-2.5zM373.75 35h2.5v2.5h-2.5zM383.75 35h2.5v2.5h-2.5zM373.75 37.5h2.5v2.5h-2.5zM383.75 37.5h2.5v2.5h-2.5zM373.75 40h2.5v2.5h-2.5zM383.75 40h2.5v2.5h-2.5zM373.75 42.5h2.5v2.5h-2.5zM383.75 42.5h2.5v2.5h-2.5zM376.25 45h2.5v2.5h-2.5zM378.75 45h2.5v2.5h-2.5zM381.25 45h2.5v2.5h-2.5zM388.75 30h2.5v2.5h-2.5zM398.75 30h2.5v2.5h-2.5zM388.75 32.5h2.5v2.5h-2.5zM398.75 32.5h2.5v2.5h-2.5zM388.75 35h2.5v2.5h-2.5zM398.75 35h2.5v2.5h-2.5zM388.75 37.5h2.5v2.5h-2.5zM398.75 37.5h2.5v2.5h-2.5zM388.75 40h2.5v2.5h-2.5zM398.75 40h2.5v2.5h-2.5zM388.75 42.5h2.5v2.5h-2.5zM398.75 42.5h2.5v2.5h-2.5zM391.25 45h2.5v2.5h-2.5zM393.75 45h2.5v2.5h-2.5zM396.25 45h2.5v2.5h-2.5zM403.75 30h2.5v2.5h-2.5zM406.25 30h2.5v2.5h-2.5zM408.75 30h2.5v2.5h-2.5zM411.25 30h2.5v2.5h-2.5zM403.75 32.5h2.5v2.5h-2.5zM413.75 32.5h2.5v2.5h-2.5zM403.75 35h2.5v2.5h-2.5zM413.75 35h2.5v2.5h-2.5zM403.75 37.5h2.5v2.5h-2.5zM413.75 37.5h2.5v2.5h-2.5zM403.75 40h2.5v2.5h-2.5zM413.75 40h2.5v2.5h-2.5zM403.75 42.5h2.5v2.5h-2.5zM413.75 42.5h2.5v2.5h-2.5zM403.75 45h2.5v2.5h-2.5zM406.25 45h2.5v2.5h-2.5zM408.75 45h2.5v2.5h-2.5zM411.25 45h2.5v2.5h-2.5z"})})]})}function JK(e,t,r){var c,u;const a=e.job&&["working","needs-install","needs-docker"].includes(e.job.status)?e.job:null,i=r??t??(a==null?void 0:a.host)??((c=e.active)==null?void 0:c.host)??((u=e.hosts[0])==null?void 0:u.name)??"";return{host:i,job:(a==null?void 0:a.host)===i?a:null}}const w4=({className:e,containerRef:t,fromRef:r,toRef:a,curvature:i=0,reverse:c=!1,duration:u=5,delay:f=0,pathColor:h="gray",pathWidth:m=2,pathOpacity:p=.2,gradientStartColor:g="#ffaa40",gradientStopColor:b="#9c40ff",repeat:v=1/0,repeatDelay:w=0,startXOffset:C=0,startYOffset:S=0,endXOffset:N=0,endYOffset:E=0})=>{const k=x.useId(),[A,M]=x.useState(""),[R,T]=x.useState({width:0,height:0}),O=c?{x1:["90%","-10%"],x2:["100%","0%"],y1:["0%","0%"],y2:["0%","0%"]}:{x1:["10%","110%"],x2:["0%","100%"],y1:["0%","0%"],y2:["0%","0%"]};return x.useEffect(()=>{const D=()=>{if(t.current&&r.current&&a.current){const F=t.current.getBoundingClientRect(),K=r.current.getBoundingClientRect(),$=a.current.getBoundingClientRect(),P=F.width,U=F.height;T({width:P,height:U});const H=K.left-F.left+K.width/2+C,W=K.top-F.top+K.height/2+S,q=$.left-F.left+$.width/2+N,Z=$.top-F.top+$.height/2+E,z=W-i,L=`M ${H},${W} Q ${(H+q)/2},${z} ${q},${Z}`;M(L)}},B=new ResizeObserver(()=>{D()});return t.current&&B.observe(t.current),D(),()=>{B.disconnect()}},[t,r,a,i,C,S,N,E]),n.jsxs("svg",{fill:"none",width:R.width,height:R.height,xmlns:"http://www.w3.org/2000/svg",className:Ve("pointer-events-none absolute top-0 left-0 transform-gpu stroke-2",e),viewBox:`0 0 ${R.width} ${R.height}`,children:[n.jsx("path",{d:A,stroke:h,strokeWidth:m,strokeOpacity:p,strokeLinecap:"round"}),n.jsx("path",{d:A,strokeWidth:m,stroke:`url(#${k})`,strokeOpacity:"1",strokeLinecap:"round"}),n.jsx("defs",{children:n.jsxs(In.linearGradient,{className:"transform-gpu",id:k,gradientUnits:"userSpaceOnUse",initial:{x1:"0%",x2:"0%",y1:"0%",y2:"0%"},animate:{x1:O.x1,x2:O.x2,y1:O.y1,y2:O.y2},transition:{delay:f,duration:u,ease:[.16,1,.3,1],repeat:v,repeatDelay:w},children:[n.jsx("stop",{stopColor:g,stopOpacity:"0"}),n.jsx("stop",{stopColor:g}),n.jsx("stop",{offset:"32.5%",stopColor:b}),n.jsx("stop",{offset:"100%",stopColor:b,stopOpacity:"0"})]})})]})};function zn({className:e,...t}){return n.jsx("label",{"data-slot":"label",className:js("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const bE={working:{icon:Ql,tone:"text-muted-foreground animate-spin motion-reduce:animate-none",title:e=>`Connecting to ${e.host}`},"needs-docker":{icon:Ok,tone:"text-amber-500",title:e=>`Docker isn’t installed on ${e.host}`},"needs-install":{icon:Ok,tone:"text-amber-500",title:e=>`${e.host} needs the runtime images`},failed:{icon:IL,tone:"text-destructive",title:e=>`Couldn’t connect to ${e.host}`}};function Lw({onConnected:e,onBack:t,initialHost:r,connectedHost:a=null,onUseConnected:i}){var _,V;const[c,u]=x.useState(null),[f,h]=x.useState("download"),[m,p]=x.useState(""),[g,b]=x.useState(null),[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),[M,R]=x.useState(null),[T,O]=x.useState(0),D=x.useRef(0),B=x.useRef(null),F=x.useRef(!1),K=x.useRef(null),$=x.useId(),P=x.useCallback(G=>{F.current||(F.current=!0,en.finishFlow(K.current,"connected"),e(G))},[e]);x.useEffect(()=>{!g||!K.current||(g.status==="needs-docker"?en.step(K.current,"needs_docker","blocked","docker_missing"):g.status==="needs-install"?en.step(K.current,"needs_runtime","blocked","runtime_missing"):g.status==="failed"&&en.finishFlow(K.current,"failed",Cu({message:g.error})))},[g==null?void 0:g.status,g==null?void 0:g.id]),x.useEffect(()=>{const G=new AbortController,Y=++D.current,ne=setTimeout(()=>G.abort(new Error("Reading hosts timed out. Try refreshing.")),1e4);return E(!0),A(null),R(null),cs.connections(G.signal).then(te=>{if(D.current!==Y)return;u(te);const{host:ye,job:ae}=JK(te,r,B.current);b(ae),ae&&h(ae.runtimeInstallation||"download"),p(ye)}).catch(te=>{D.current===Y&&te.name!=="AbortError"&&A(te.message)}).finally(()=>{clearTimeout(ne),D.current===Y&&E(!1)}),()=>{G.abort(),clearTimeout(ne),D.current+=1}},[T,r]),x.useEffect(()=>{if((g==null?void 0:g.status)!=="working"||M||C)return;const G=new AbortController;let Y;async function ne(){try{const te=await cs.connectionJob(g.id,G.signal);if(G.signal.aborted)return;b(te),te.status==="ready"?P(te):te.status==="working"&&(Y=setTimeout(ne,1e3))}catch(te){G.signal.aborted||R(te.message)}}return Y=setTimeout(ne,500),()=>{G.abort(),clearTimeout(Y)}},[g==null?void 0:g.id,g==null?void 0:g.status,M,C,P]);async function U(G,Y){var ne;(G==="connect"||((ne=K.current)==null?void 0:ne.outcome)==="failed")&&(K.current=en.startFlow("gateway_connection",{location_type:"ssh"},K.current)),S(G),A(null),R(null);try{const te=await Y();b(te),te.status==="ready"&&P(te)}catch(te){en.finishFlow(K.current,"failed",Cu(te)),A(te.message)}finally{S(null)}}const H=(c==null?void 0:c.hosts)??[],W=H.find(G=>G.name===m),q=!!C||(g==null?void 0:g.status)==="working",Z=(g==null?void 0:g.status)==="needs-install"||(g==null?void 0:g.status)==="needs-docker",z=c&&!c.tools.ssh,L=g&&g.host===m&&bE[g.status]?bE[g.status]:null,X=()=>O(G=>G+1),ee=!!(a&&i&&m===a&&!g);return n.jsxs("div",{className:"grid gap-6 text-xs",children:[n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 md:gap-8",children:[n.jsx("div",{className:"grid min-w-0 content-start gap-5",children:n.jsx(tX,{host:(W==null?void 0:W.label)??(m||"Your server"),live:(g==null?void 0:g.status)==="working"||ee})}),n.jsxs("div",{className:"grid min-w-0 content-start gap-5",children:[n.jsxs("div",{className:"grid gap-2",children:[n.jsx(zn,{htmlFor:`${$}-host`,className:"text-xs",children:"SSH host"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(pn,{id:`${$}-host`,className:"flex-1",value:m,disabled:q||!H.length,onChange:G=>{B.current=G.target.value,p(G.target.value),b(null),w(null),A(null),R(null)},children:[n.jsx("option",{value:"",disabled:!0,children:H.length?"Choose a host":"No hosts in ~/.ssh/config"}),!!m&&!W&&n.jsxs("option",{value:m,disabled:!0,children:[m," · Missing from SSH config"]}),H.map(G=>n.jsx("option",{value:G.name,children:G.label??G.name},G.name))]}),n.jsx(le,{type:"button",variant:"outline",size:"icon","aria-label":"Refresh hosts",disabled:!!C||N,onClick:X,children:n.jsx(rl,{className:`size-3.5 ${N?"animate-spin motion-reduce:animate-none":""}`})})]}),c&&m&&!W&&n.jsxs("p",{role:"status",className:"text-muted-foreground",children:[m," is no longer in your SSH config. Add it again in Connections, or restore its SSH config entry and refresh."]}),ee?n.jsx("p",{className:"text-muted-foreground",children:"Connected now. Choose another host to replace this connection."}):a&&W&&n.jsxs("p",{className:"text-muted-foreground",children:["Connecting ",m," replaces the connection to ",a,"."]}),W&&!W.managed&&!ee&&n.jsxs("p",{className:"text-muted-foreground",children:["First time? Run ",n.jsxs("code",{className:"rounded bg-muted px-1 font-mono text-foreground",children:["ssh ",m]})," once to trust the machine."]}),z&&n.jsx(tp,{children:"OpenSSH isn’t installed on this computer. Install it, then refresh."})]}),n.jsxs(eX,{children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"font-medium text-foreground",children:"If the host is missing the runtime images"}),n.jsx("div",{role:"radiogroup","aria-label":"Runtime images",className:"inline-flex w-fit rounded-lg bg-muted p-0.5",children:[["download","Download on host"],["upload","I’ll upload a package"]].map(([G,Y])=>n.jsx("button",{type:"button",role:"radio","aria-checked":f===G,disabled:q||Z,onClick:()=>h(G),className:`rounded-md px-2.5 py-1 transition-colors disabled:opacity-60 ${f===G?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Y},G))})]}),n.jsxs("ul",{className:"grid list-disc gap-1.5 pl-4",children:[n.jsx("li",{children:"Needs Linux with Docker. On Ubuntu or Debian, OpenRod can install Docker (it asks first; needs passwordless sudo)."}),n.jsx("li",{children:"Docker access is admin access. Connect only to machines you trust."}),n.jsx("li",{children:"The host gets credentials for its own gateway, never your main one."}),n.jsx("li",{children:"The link runs inside OpenRod on this computer. Stopping OpenRod disconnects it; disconnect any time from the gateway menu in the sidebar."})]})]})]})]}),L&&n.jsxs("div",{role:"status","aria-live":"polite",className:"grid gap-3 rounded-xl border border-border bg-muted/20 p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(L.icon,{className:`mt-0.5 size-4 shrink-0 ${L.tone}`}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"font-medium text-foreground",children:L.title(g)}),g.stage&&g.stage!=="Connection failed"&&n.jsx("p",{className:"mt-0.5 break-words whitespace-pre-wrap text-muted-foreground",children:g.stage})]})]}),g.probe&&n.jsx("div",{className:"flex flex-wrap gap-1.5",children:[`${g.probe.os||"Unknown OS"} · ${g.probe.arch||"?"}`,g.probe.dockerInstalled===!1?"No Docker":"Docker found",g.probe.runtimeReady?"Images ready":"Images missing"].map(G=>n.jsx("span",{className:"rounded-full border border-border bg-background px-2 py-0.5 text-[10px] text-muted-foreground",children:G},G))}),g.status==="needs-docker"&&((_=g.probe)!=null&&_.dockerInstallSupported?n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("p",{className:"text-muted-foreground",children:["OpenRod will install ",n.jsx("code",{className:"font-mono",children:"docker.io"}),", start it, and add your SSH user to the ",n.jsx("code",{className:"font-mono",children:"docker"})," group (root-equivalent). Nothing changes unless you approve."]}),n.jsx(le,{type:"button",size:"sm",className:"justify-self-start",disabled:q,onClick:()=>U("docker",()=>cs.installConnectionDocker(g.id)),children:C==="docker"?"Starting…":"Install Docker and continue"})]}):n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("p",{className:"text-muted-foreground",children:[((V=g.probe)==null?void 0:V.dockerInstallReason)||"Automatic install works on Ubuntu and Debian only."," Install Docker yourself, then check again."]}),n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:q,onClick:()=>U("connect",()=>cs.connect({host:g.host,runtimeInstallation:f})),children:"Check again"})]})),g.status==="needs-install"&&n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:q,onClick:()=>U("download",()=>cs.installConnectionRuntime(g.id)),children:C==="download"?"Starting download…":"Download on host"}),n.jsxs("p",{className:"text-muted-foreground",children:["Or upload a ",n.jsx("code",{className:"font-mono",children:"docker save"})," .tar with the sandbox, supervisor and gateway images for this host’s architecture."]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ot,{"aria-label":"Docker-save package (.tar)",type:"file",accept:".tar,application/x-tar",className:"h-8 flex-1 text-xs",disabled:q,onChange:G=>{var Y;w(((Y=G.target.files)==null?void 0:Y[0])??null),A(null)}}),n.jsx(le,{type:"button",variant:"outline",size:"sm",disabled:q||!(v!=null&&v.name.toLowerCase().endsWith(".tar")),onClick:()=>U("upload",()=>cs.uploadConnectionPackage(g.id,v)),children:C==="upload"?"Uploading…":"Upload"})]}),v&&!v.name.toLowerCase().endsWith(".tar")&&n.jsx(tp,{children:"Choose an uncompressed .tar archive."})]})]}),(k||L&&g.error)&&n.jsx(tp,{children:k||g.error}),M&&n.jsxs(tp,{children:["Lost track of progress: ",M," It may still be running. Refresh to check."]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[n.jsx(le,{type:"button",variant:"ghost",className:"mr-auto",disabled:!!C,onClick:t,children:"Back"}),ee?n.jsxs(le,{type:"button",onClick:i,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:["Continue with ",a]}):n.jsx(le,{type:"button",disabled:q||!W||z||Z,onClick:()=>U("connect",()=>cs.connect({host:m,runtimeInstallation:f})),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:C==="connect"||(g==null?void 0:g.status)==="working"?n.jsxs(n.Fragment,{children:[n.jsx(Ql,{className:"size-3.5 animate-spin"}),"Connecting…"]}):(g==null?void 0:g.status)==="failed"&&g.host===m?"Try again":"Connect"})]})]})}function tp({children:e}){return n.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:e})}function eX({children:e}){const[t,r]=x.useState(!1);return n.jsxs("div",{children:[n.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>r(a=>!a),className:"flex w-full items-center gap-2 rounded text-left text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(Du,{className:"size-3.5"}),"Requirements & safety",n.jsx(ha,{className:`ml-auto size-3.5 transition-transform ${t?"rotate-180":""}`})]}),t&&n.jsx("div",{className:"grid gap-4 pt-3 text-muted-foreground",children:e})]})}function tX({host:e,live:t}){const r=x.useRef(null),a=x.useRef(null),i=x.useRef(null),c=(u,f,h,m)=>n.jsxs("div",{className:"z-10 flex flex-col items-center gap-2 text-center",children:[n.jsx("span",{ref:u,className:"flex size-11 items-center justify-center rounded-2xl border border-border bg-background shadow-sm",children:n.jsx(f,{className:"size-5"})}),n.jsxs("span",{children:[n.jsx("span",{className:"block max-w-32 truncate font-medium text-foreground",children:h}),n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:m})]})]});return n.jsxs("div",{ref:r,className:"relative flex items-start justify-between overflow-hidden rounded-xl border border-border bg-muted/20 px-8 py-4",children:[c(a,e2,"This computer","Gateway"),n.jsx("span",{className:"absolute top-[38px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 rounded-full border border-border bg-background px-2 py-0.5 font-mono text-[10px] text-muted-foreground",children:"ssh"}),c(i,$f,e,"Docker · sandboxes"),n.jsx(w4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:5,pathOpacity:.25,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})}function nX({width:e=16,height:t=16,x:r=0,y:a=0,cx:i=1,cy:c=1,cr:u=1,className:f,glow:h=!1,...m}){const p=x.useId(),g=x.useRef(null),[b,v]=x.useState({width:0,height:0});x.useEffect(()=>{const C=()=>{if(g.current){const{width:S,height:N}=g.current.getBoundingClientRect();v({width:S,height:N})}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const w=Array.from({length:Math.ceil(b.width/e)*Math.ceil(b.height/t)},(C,S)=>{const N=S%Math.ceil(b.width/e),E=Math.floor(S/Math.ceil(b.width/e));return{x:N*e+i+r,y:E*t+c+a,delay:Math.random()*5,duration:Math.random()*3+2}});return n.jsxs("svg",{ref:g,"aria-hidden":"true",className:Ve("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",f),...m,children:[n.jsx("defs",{children:n.jsxs("radialGradient",{id:`${p}-gradient`,children:[n.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),n.jsx("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),w.map(C=>n.jsx(In.circle,{cx:C.x,cy:C.y,r:u,fill:h?`url(#${p}-gradient)`:"currentColor",initial:h?{opacity:.4,scale:1}:{},animate:h?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:h?{duration:C.duration,repeat:1/0,repeatType:"reverse",delay:C.delay,ease:"easeInOut"}:{}},`${C.x}-${C.y}`))]})}function $w({step:e,subject:t="sandbox"}){return n.jsx("ol",{"aria-label":"Steps",className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["Location",t==="setup"?"Setup":t==="template"?"Template":"Sandbox"].map((r,a)=>{const i=a+1===e,c=a+1<e;return n.jsxs(x.Fragment,{children:[a>0&&n.jsx("span",{"aria-hidden":"true",className:`h-px w-6 transition-colors ${c||i?"bg-foreground/40":"bg-border"}`}),n.jsxs("li",{"aria-current":i?"step":void 0,className:`flex items-center gap-1.5 transition-colors ${i?"text-foreground":""}`,children:[n.jsx("span",{className:`flex size-4 items-center justify-center rounded-full text-[9px] font-semibold transition-colors ${i?"bg-foreground text-background":c?"bg-foreground/15 text-foreground":"border border-border"}`,children:a+1}),r]})]},r)})})}function j4({location:e,onChange:t}){return n.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-muted/30 py-0.5 pr-1 pl-2.5 text-[11px] text-muted-foreground",children:[e!=null&&e.cloud||(e==null?void 0:e.target)==="cloud"?n.jsx(Kp,{"aria-hidden":"true",className:"size-3"}):e!=null&&e.remote?n.jsx($f,{"aria-hidden":"true",className:"size-3"}):n.jsx(e2,{"aria-hidden":"true",className:"size-3"}),n.jsx("span",{className:"max-w-40 truncate text-foreground",children:e!=null&&e.cloud||(e==null?void 0:e.target)==="cloud"?"OpenRod Cloud":e!=null&&e.remote?tf(e):"This computer"}),n.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-full px-2 text-[11px]",onClick:t,children:"Change"})]})}const tf=e=>{var t;return((t=e==null?void 0:e.label)==null?void 0:t.replace(/^SSH · /,""))??(e==null?void 0:e.gateway)};function vE({live:e}){const t=Zs(),r=x.useId();return n.jsxs("svg",{viewBox:"0 0 72 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:`${r}-screen`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0",stopColor:"currentColor",stopOpacity:"0.14"}),n.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0.03"})]})}),n.jsx("rect",{x:"10",y:"2",width:"52",height:"34",rx:"3.5",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),n.jsx("rect",{x:"13.5",y:"5.5",width:"45",height:"27",rx:"1.5",fill:`url(#${r}-screen)`}),n.jsx("rect",{x:"18",y:"11",width:"14",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.45"}),n.jsx("rect",{x:"18",y:"16",width:"22",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.3"}),n.jsx("rect",{x:"18",y:"21",width:"9",height:"1.6",rx:"0.8",fill:"#10b981",fillOpacity:"0.8"}),n.jsx(In.rect,{x:"29",y:"20.3",width:"3",height:"3",rx:"0.5",fill:"currentColor",fillOpacity:"0.7",animate:t||!e?void 0:{opacity:[1,0,1]},transition:{duration:1.1,repeat:1/0,times:[0,.5,1]}}),n.jsx("path",{d:"M2 38.5h68l-2.6 5.2a2.5 2.5 0 0 1-2.2 1.3H6.8a2.5 2.5 0 0 1-2.2-1.3Z",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55",strokeLinejoin:"round"}),n.jsx("rect",{x:"30",y:"38.5",width:"12",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.35"})]})}function S4({live:e}){const t=Zs();return n.jsx("svg",{viewBox:"0 0 52 50",className:"h-[60px] w-auto text-foreground","aria-hidden":"true",children:[0,1,2].map(r=>n.jsxs("g",{children:[n.jsx("rect",{x:"2",y:2+r*16,width:"48",height:"13",rx:"3",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),n.jsxs(n.Fragment,{children:[n.jsx(In.circle,{cx:"9",cy:8.5+r*16,r:"1.6",fill:"#10b981",initial:{opacity:.9},animate:t||!e?void 0:{opacity:[.9,.25,.9]},transition:{duration:1.6,repeat:1/0,delay:r*.35}}),n.jsx("circle",{cx:"14.5",cy:8.5+r*16,r:"1.6",fill:"currentColor",fillOpacity:"0.25"}),[0,1,2,3].map(a=>n.jsx("rect",{x:30+a*4.2,y:5.5+r*16,width:"1.6",height:"6",rx:"0.8",fill:"currentColor",fillOpacity:"0.22"},a))]})]},r))})}function N4(){return n.jsx("svg",{viewBox:"0 0 76 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:n.jsxs("g",{transform:"translate(0 3)",children:[n.jsx("path",{d:"M20 42a14 14 0 0 1-1.6-27.9A18 18 0 0 1 52.6 10 13 13 0 0 1 56 42Z",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55",strokeLinejoin:"round"}),[0,1,2].map(e=>n.jsx("rect",{x:24+e*10,y:"26",width:"7",height:"7",rx:"1.5",fill:"currentColor",fillOpacity:.3-e*.07},e))]})})}function sX({kind:e,live:t}){const r=x.useRef(null),a=x.useRef(null),i=x.useRef(null);return n.jsxs("div",{ref:r,className:"relative flex h-36 items-center justify-center gap-14",children:[n.jsx(nX,{width:14,height:14,className:"text-foreground/15 transition-colors duration-500 [mask-image:radial-gradient(160px_circle_at_center,white,transparent)] group-hover:text-foreground/30"}),e==="cloud"&&n.jsx("span",{className:"relative z-10",children:n.jsx(N4,{})}),e==="local"&&n.jsx("span",{className:"relative z-10 transition-transform duration-500 group-hover:scale-105",children:n.jsx(vE,{live:t})}),e==="remote"&&n.jsxs(n.Fragment,{children:[n.jsx("span",{ref:a,className:"relative z-10 transition-transform duration-500 group-hover:-translate-x-1",children:n.jsx(vE,{live:t})}),n.jsx("span",{ref:i,className:"relative z-10 transition-transform duration-500 group-hover:translate-x-1",children:n.jsx(S4,{live:t})}),n.jsx(w4,{containerRef:r,fromRef:a,toRef:i,duration:t?2.5:4,pathOpacity:.3,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})]})}function ny({index:e,scene:t,live:r,title:a,caption:i,tone:c="idle",disabled:u,onClick:f,trailing:h}){const m=Zs(),p=g=>{const b=g.currentTarget.getBoundingClientRect();g.currentTarget.style.setProperty("--x",`${g.clientX-b.left}px`),g.currentTarget.style.setProperty("--y",`${g.clientY-b.top}px`)};return n.jsxs(In.button,{type:"button",disabled:u,onClick:f,onPointerMove:p,initial:m?!1:{opacity:0,y:10},animate:{opacity:u?.5:1,y:0},transition:{duration:.35,delay:e*.07,ease:[.22,1,.36,1]},className:"group relative block w-full overflow-hidden rounded-2xl bg-muted/30 text-left outline-none transition-colors duration-300 hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:ring-1 focus-visible:ring-foreground/20 disabled:pointer-events-none",children:[n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"radial-gradient(260px circle at var(--x, 50%) var(--y, 50%), color-mix(in oklab, var(--foreground) 7%, transparent), transparent 70%)"}}),n.jsx(sX,{kind:t,live:r}),n.jsxs("span",{className:"relative flex items-center gap-3 px-4 pt-1 pb-4",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:a}),n.jsxs("span",{className:"flex items-center gap-1.5 truncate text-xs text-muted-foreground",children:[c!=="idle"&&n.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${c==="live"?"bg-emerald-500":"bg-amber-500"}`}),i]})]}),h||n.jsx(Zi,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-all duration-300 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 group-hover:text-foreground"})]})]})}function Ox({locations:e,allowRemote:t,onPick:r,onConnected:a,onCancel:i,connecting:c,subject:u="sandbox"}){const f=Zs(),h=ds(),[m,p]=x.useState("choose"),[g,b]=x.useState(!1),[v,w]=x.useState(null),[C,S]=x.useState(!1),[N,E]=x.useState(!1),[k,A]=x.useState(null),M=e.find(X=>X.cloud||X.target==="cloud"),R=e.find(X=>!X.remote&&!X.cloud&&X.target!=="cloud"),T=e.find(X=>X.remote&&!X.cloud&&X.target!=="cloud"),O=!(h!=null&&h.localViewer)&&!!M,D=h==null?void 0:h.cloudSetup,B=(D==null?void 0:D.stage)==="signing-in"||(D==null?void 0:D.stage)==="preparing",F=B||g,K=x.useRef(!1),$=h==null?void 0:h.watchCloudSetup;x.useEffect(()=>$==null?void 0:$(),[$]),x.useEffect(()=>{var ee;if(!D)return;if(B){K.current=!0;return}const X=K.current;K.current=!1,(ee=h.dismissCloudSetup)==null||ee.call(h),D.stage==="failed"?A(D.error):D.stage==="ready"&&X&&(b(!0),a==null||a({target:"cloud",gateway:null}))},[D,B,h,a]),x.useEffect(()=>{g&&(M!=null&&M.connected)&&(b(!1),r(M.id??M.context))},[g,M,r]),x.useEffect(()=>{if(!g)return;const X=setTimeout(()=>{b(!1),A("Cloud is ready but its locations could not load. Refresh the connection and try again.")},6e4);return()=>clearTimeout(X)},[g]);function P(){var X;if(M!=null&&M.connected){r(M.id??M.context);return}A(null),K.current=!0,(X=h==null?void 0:h.startCloudSetup)==null||X.call(h)}function U(){var X;K.current=!1,(X=h==null?void 0:h.cancelCloudSetup)==null||X.call(h),b(!1)}x.useEffect(()=>{if(R||!t)return;let X=!0;return cs.connections().then(ee=>{var _;X&&(w(ee.locals),S(((_=ee.tools)==null?void 0:_.openshell)===!1))}).catch(()=>{X&&w([])}),()=>{X=!1}},[R,t]);async function H(){E(!0),A(null);try{const X=await j7(cs,v[0].name);a(X)}catch(X){A(X.message),E(!1)}}const W=m==="remote"?"remote":F?"cloud":"choose",q=f?{}:{initial:{opacity:0,x:m==="remote"?24:-24},animate:{opacity:1,x:0},exit:{opacity:0,x:m==="remote"?-24:24},transition:{duration:.22,ease:[.22,1,.36,1]}},Z=R?R.connected?"Local gateway":"Disconnected":v!=null&&v.length?`Use ${v[0].name}`:v?C?"OpenShell isn’t installed":"No local gateway running":"Checking…",z=(D==null?void 0:D.stage)==="signing-in",L=M!=null&&M.connected?"Ready to use":h!=null&&h.checking?"Checking connection…":h!=null&&h.available?h!=null&&h.connected?"Start cloud machine":"Connect your account":"Coming soon";return n.jsxs("div",{className:"flex min-h-0 flex-col gap-6 rounded-xl bg-popover p-7 ring-1 ring-foreground/10",children:[n.jsxs(sn,{className:"gap-3",children:[!["workspace","resource"].includes(u)&&n.jsx($w,{step:1,subject:u}),n.jsxs("div",{className:"flex items-center gap-2",children:[m==="remote"&&n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Back to locations",onClick:()=>p("choose"),children:n.jsx(W1,{})}),n.jsx(Qt,{children:m==="remote"?"Connect a machine":u==="resource"?"Create in":u==="workspace"?"Work in":u==="setup"?"Import to":"Where should it run?"})]}),n.jsx(Sn,{className:m==="remote"||["setup","workspace","resource"].includes(u)?"sr-only":"text-xs",children:m==="remote"?`Connect an SSH host to ${u==="workspace"?"work on":u==="setup"?"import your setup to":u==="sandbox"?"run sandboxes on":"build templates on"}.`:u==="workspace"?"Choose a working location.":`Pick a location for this ${u}.`})]}),n.jsx("div",{className:"-m-2 min-h-0 flex-1 overflow-x-hidden overflow-y-auto p-2",children:n.jsx(lc,{mode:"wait",initial:!1,children:W==="cloud"?n.jsxs(In.div,{...q,className:"flex flex-col items-center py-4 text-center",children:[n.jsx(_w,{}),n.jsx("p",{className:"text-lg font-semibold",children:z?"Signing in to OpenRod Cloud…":g?"Opening OpenRod Cloud…":"Setting up your cloud machine…"}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:z?"Complete sign-in in the new window.":"High demand may slow this down."}),n.jsxs("div",{role:"status",className:"mt-5 flex items-center justify-center gap-2 rounded-lg bg-muted/50 px-4 py-3 text-xs",children:[n.jsx(Nt,{"aria-hidden":"true"}),n.jsx("span",{children:z?"Waiting for sign-in":g?"Loading your cloud locations":"Continues automatically when ready"})]}),!g&&n.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"You can close this. Setup keeps going in the background."}),n.jsxs("div",{className:"mt-6 flex justify-center gap-2",children:[!g&&n.jsx(le,{type:"button",variant:"ghost",onClick:U,children:"Cancel setup"}),n.jsx(le,{type:"button",variant:"outline",onClick:i,children:g?"Close":"Continue in background"})]})]},"cloud"):W==="choose"?n.jsxs(In.div,{...q,className:"grid gap-3",children:[n.jsxs("div",{className:`grid gap-4 ${t?"sm:grid-cols-3":M&&!O?"sm:grid-cols-2":""}`,children:[!O&&n.jsx(ny,{index:0,scene:"local",live:R==null?void 0:R.connected,title:"This computer",caption:Z,tone:R!=null&&R.connected?"live":"idle",disabled:R?!R.connected:!(v!=null&&v.length)||N,onClick:()=>R?r(R.id??R.context):H(),trailing:N&&n.jsx(Ql,{className:"size-4 animate-spin text-muted-foreground"})}),t&&n.jsx(ny,{index:1,scene:"remote",live:T==null?void 0:T.connected,title:"Remote machine",caption:T!=null&&T.connected?`Connected · ${tf(T)}`:T?`${tf(T)} · Disconnected`:"Your server, over SSH",tone:T!=null&&T.connected?"live":T?"warn":"idle",onClick:()=>p("remote")}),(t||M)&&n.jsx(ny,{index:2,scene:"cloud",title:"OpenRod Cloud",caption:L,live:M==null?void 0:M.connected,tone:M!=null&&M.connected?"live":F?"warn":"idle",disabled:F||!(M!=null&&M.connected)&&(!(h!=null&&h.available)||(h==null?void 0:h.checking)),onClick:P,trailing:F?n.jsx(Ql,{className:"size-4 animate-spin text-muted-foreground"}):void 0})]}),k&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:k}),n.jsx("div",{className:"mt-3 flex justify-end",children:n.jsx(le,{type:"button",variant:"ghost",onClick:i,children:"Cancel"})})]},"choose"):n.jsx(In.div,{...q,children:c?n.jsxs("div",{role:"status",className:"grid place-items-center gap-3 py-16 text-xs text-muted-foreground",children:[n.jsx(Ql,{className:"size-5 animate-spin"}),"Connected. Opening the ",u," form…"]}):n.jsx(Lw,{initialHost:T?tf(T):void 0,connectedHost:T!=null&&T.connected?tf(T):null,onUseConnected:()=>r(T.id??T.context),onConnected:a,onBack:()=>p("choose")})},"remote")})})]})}function rX(e,{offerCloud:t=!1}={}){const[r]=e;return e.length===1&&!r.remote&&r.connected&&!t?r:null}function Dx({children:e,onClose:t,subject:r="resource"}){const a=vo(),i=ds(),[c,u]=x.useState(null),[f,h]=x.useState(null);x.useEffect(()=>{if(!f)return;const b=a.locations.find(v=>v.target==="local"&&v.gateway===f&&v.connected);b&&(u(b),h(null))},[f,a.locations]);const m=a.loading||(i==null?void 0:i.localViewer)&&(i==null?void 0:i.checking),p=!c&&!m?rX(a.locations,{offerCloud:!!(i!=null&&i.localViewer&&(i!=null&&i.available))}):null;p&&u(p);const g=c??p;return g?n.jsx(Zn,{location:g,children:e(g,t)}):n.jsx(tn,{open:!0,onOpenChange:b=>{b||t()},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:a.locations,allowRemote:!!(i!=null&&i.localViewer),subject:r,connecting:!!f,onPick:b=>u(a.locations.find(v=>(v.id??v.context)===b&&v.connected)),onConnected:b=>{h(b.gateway),a.refresh()},onCancel:t})})})}function Af({value:e,startValue:t=0,direction:r="up",delay:a=0,className:i,decimalPlaces:c=0,...u}){const f=x.useRef(null),h=Zs(),m=Aw(r==="down"?e:t),p=BY(m,{damping:60,stiffness:100}),g=l4(f,{once:!0,margin:"0px"}),b=x.useCallback(v=>Intl.NumberFormat("en-US",{minimumFractionDigits:c,maximumFractionDigits:c}).format(Number(v.toFixed(c))),[c]);return x.useEffect(()=>{if(!g)return;const v=setTimeout(()=>m.set(r==="down"?t:e),a*1e3);return()=>clearTimeout(v)},[m,g,a,e,r,t]),x.useEffect(()=>p.on("change",v=>{f.current&&!h&&(f.current.textContent=b(v))}),[p,b,h]),x.useEffect(()=>{f.current&&h&&(f.current.textContent=b(e))},[h,e,b]),n.jsx("span",{ref:f,className:Ve("inline-block tabular-nums",i),...u,children:h?b(e):t})}function C4(e){if(e.length<2)return e.length?`M${e[0][0]} ${e[0][1]}`:"";const t=e.length,r=[],a=[];for(let u=0;u<t-1;u++)r[u]=e[u+1][0]-e[u][0],a[u]=(e[u+1][1]-e[u][1])/(r[u]||1);const i=[a[0]];for(let u=1;u<t-1;u++)i[u]=a[u-1]*a[u]<=0?0:(a[u-1]+a[u])/2;i[t-1]=a[t-2];for(let u=0;u<t-1;u++){if(a[u]===0){i[u]=0,i[u+1]=0;continue}const f=i[u]/a[u],h=i[u+1]/a[u],m=Math.hypot(f,h);m>3&&(i[u]=3*f/m*a[u],i[u+1]=3*h/m*a[u])}let c=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let u=0;u<t-1;u++){const f=r[u]/3;c+=` C${(e[u][0]+f).toFixed(2)} ${(e[u][1]+i[u]*f).toFixed(2)} ${(e[u+1][0]-f).toFixed(2)} ${(e[u+1][1]-i[u+1]*f).toFixed(2)} ${e[u+1][0].toFixed(2)} ${e[u+1][1].toFixed(2)}`}return c}function k4(e,t,r){const a=r-t*6e4,i=Array.from({length:t},(c,u)=>({at:a+(u+1)*6e4,allowed:0,denied:0}));for(const c of e){if(c.kind!=="audit"||!c.verdict||!c.at)continue;const u=Date.parse(c.at);if(u<=a||u>r)continue;const f=Math.min(t-1,Math.floor((u-a)/6e4));i[f][c.verdict]+=1}return i}const oX=e=>new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function T4({points:e,height:t=34,title:r,action:a}){const i=x.useRef(null),c=x.useId(),u=Zs(),[f,h]=x.useState(280),[m,p]=x.useState(null);x.useLayoutEffect(()=>{const M=i.current;if(!M)return;const R=()=>h(M.clientWidth);R();const T=new ResizeObserver(R);return T.observe(M),()=>T.disconnect()},[]);const g=Math.max(4,Math.round(t*.18)),b=e.map(M=>M.allowed+M.denied),v=Math.max(1,...b),w=M=>(e.length<2?f-12:M/(e.length-1)*(f-12))+6,C=M=>t-g-M/v*(t-g*2),S=b.map((M,R)=>[w(R),C(M)]),N=C4(S),E=`${N} L${w(e.length-1).toFixed(2)} ${t} L${w(0).toFixed(2)} ${t} Z`,k=m===null?null:e[m],A=M=>e.reduce((R,T)=>R+T[M],0);return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>p(null),onMouseMove:M=>{const R=M.currentTarget.getBoundingClientRect(),T=(M.clientX-R.left)/Math.max(1,R.width);p(Math.min(e.length-1,Math.max(0,Math.round(T*(e.length-1)))))},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:k?n.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[oX(k.at)," · ",k.allowed," allowed",k.denied?n.jsxs("span",{className:"text-red-600",children:[" · ",k.denied," denied"]}):null]}):r}),n.jsx("span",{className:"ml-auto shrink-0",children:a})]}),n.jsx("div",{ref:i,className:"w-full",children:n.jsxs("svg",{width:f,height:t,role:"img","aria-label":`${A("allowed")} allowed and ${A("denied")} denied connections over ${e.length} minutes`,children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:c,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),n.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),n.jsx("path",{d:E,fill:`url(#${c})`}),n.jsx(In.path,{d:N,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:u?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),e.map((M,R)=>M.denied?n.jsx("circle",{cx:w(R),cy:t-2,r:"1.75",fill:"var(--status-error)",opacity:m===R?1:.75},M.at):null),k&&n.jsxs("g",{children:[n.jsx("line",{x1:w(m),x2:w(m),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),n.jsx("circle",{cx:w(m),cy:C(b[m]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}function yo({value:e,onValueChange:t,className:r,ref:a,...i}){return n.jsxs("div",{className:Ve("relative",r),children:[n.jsx(z8,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),n.jsx(Ot,{ref:a,value:e,onChange:c=>t(c.target.value),className:"h-7 rounded-[3px] pr-7 pl-8 text-xs focus-visible:ring-1",...i}),e&&n.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute top-1/2 right-2 -translate-y-1/2",onClick:()=>t(""),children:n.jsx(Pn,{className:"size-3.5"})})]})}function Lo({...e}){return n.jsx(QM,{"data-slot":"sheet",...e})}function aX({...e}){return n.jsx(U2,{"data-slot":"sheet-portal",...e})}function iX({className:e,...t}){return n.jsx(d2,{"data-slot":"sheet-overlay",className:Ve("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function la({className:e,children:t,side:r="right",showCloseButton:a=!0,...i}){return n.jsxs(aX,{children:[n.jsx(iX,{}),n.jsxs(V2,{"data-slot":"sheet-content","data-side":r,className:Ve("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[t,a&&n.jsxs(Fg,{"data-slot":"sheet-close",render:n.jsx(le,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[n.jsx(Pn,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ca({className:e,...t}){return n.jsx("div",{"data-slot":"sheet-header",className:Ve("flex flex-col gap-0.5 p-4",e),...t})}function ua({className:e,...t}){return n.jsx(H2,{"data-slot":"sheet-title",className:Ve("font-heading text-base font-medium text-foreground",e),...t})}function da({className:e,...t}){return n.jsx(f2,{"data-slot":"sheet-description",className:Ve("text-sm text-muted-foreground",e),...t})}function lX(e){return WM("alert-dialog",e)}function Fr({...e}){return n.jsx(lX,{"data-slot":"alert-dialog",...e})}function cX({...e}){return n.jsx(U2,{"data-slot":"alert-dialog-portal",...e})}function uX({className:e,...t}){return n.jsx(d2,{"data-slot":"alert-dialog-overlay",className:js("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Gr({className:e,size:t="default",...r}){return n.jsxs(cX,{children:[n.jsx(uX,{}),n.jsx(V2,{"data-slot":"alert-dialog-content","data-size":t,className:js("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r})]})}function qr({className:e,...t}){return n.jsx("div",{"data-slot":"alert-dialog-header",className:js("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Yr({className:e,...t}){return n.jsx("div",{"data-slot":"alert-dialog-footer",className:js("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Kr({className:e,...t}){return n.jsx(H2,{"data-slot":"alert-dialog-title",className:js("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Xr({className:e,...t}){return n.jsx(f2,{"data-slot":"alert-dialog-description",className:js("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Wr({className:e,...t}){return n.jsx(le,{"data-slot":"alert-dialog-action",className:js(e),...t})}function Qr({className:e,variant:t="outline",size:r="default",...a}){return n.jsx(Fg,{"data-slot":"alert-dialog-cancel",className:js(e),render:n.jsx(le,{variant:t,size:r}),...a})}const E4=x.createContext(void 0);function zx(e){const t=x.useContext(E4);if(t===void 0&&!e)throw new Error(rn(33));return t}const R4=x.createContext(void 0);function ll(e){const t=x.useContext(R4);if(t===void 0&&!e)throw new Error(rn(36));return t}const dX=x.createContext(void 0);function Bw(e=!0){const t=x.useContext(dX);if(t===void 0&&!e)throw new Error(rn(25));return t}const A4=x.createContext(void 0);function fX(){const e=x.useContext(A4);if(e===void 0)throw new Error(rn(30));return e}function hX(e){const{closeOnClick:t,highlighted:r,id:a,nodeId:i,store:c,typingRef:u,itemRef:f,itemMetadata:h}=e,{events:m}=c.useState("floatingTreeRoot"),p=c.useState("open"),g=Bw(!0),b=g!==void 0;return x.useMemo(()=>({id:a,role:"menuitem",tabIndex:p&&r?0:-1,onKeyDown(v){v.key===" "&&(u!=null&&u.current)&&v.preventDefault()},onMouseMove(v){i&&m.emit("itemhover",{nodeId:i,target:v.currentTarget})},onClick(v){t&&m.emit("close",{domEvent:v,reason:Zl})},onMouseUp(v){if(g){const w=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,b&&w&&Math.abs(v.clientX-w.x)<=1&&Math.abs(v.clientY-w.y)<=1||b&&!h2&&v.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!b||v.button===2)&&h.type==="regular-item"&&hu(f.current,v,{detail:1})}}),[t,r,a,m,i,p,c,u,f,g,b,h])}const Vw={type:"regular-item"};function Uw(e){const{closeOnClick:t,disabled:r,highlighted:a,id:i,store:c,typingRef:u=c.context.typingRef,nativeButton:f,itemMetadata:h,nodeId:m}=e,p=x.useRef(null),{getButtonProps:g,buttonRef:b}=bo({disabled:r,focusableWhenDisabled:!0,native:f,composite:!0}),v=hX({closeOnClick:t,highlighted:a,id:i,nodeId:m,store:c,typingRef:u,itemRef:p,itemMetadata:h}),w=x.useCallback(S=>Qs(v,{onMouseEnter(){h.type==="submenu-trigger"&&h.setActive()}},S,g),[v,g,h]),C=mo(p,b);return x.useMemo(()=>({getItemProps:w,itemRef:C}),[w,C])}const mX="data-checked",pX="data-unchecked",Ix={checked(e){return e?{[mX]:""}:{[pX]:""}},...si},gX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:h=!1,closeOnClick:m=!1,checked:p,defaultChecked:g,onCheckedChange:b,style:v,...w}=t,C=pc({guess:!0,label:u}),S=zx(!0),N=ws(c),{store:E}=ll(),k=E.useState("disabled"),A=h||k,M=E.useState("isActive",C.index),R=E.useState("itemProps"),[T,O]=po({controlled:p,default:g??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:D,itemRef:B}=Uw({closeOnClick:m,disabled:A,highlighted:M,id:N,store:E,nativeButton:f,nodeId:S==null?void 0:S.context.nodeId,itemMetadata:Vw}),F=x.useMemo(()=>({disabled:A,highlighted:M,checked:T}),[A,M,T]);function K(P){const U=yt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:$n});b==null||b(!T,U),!U.isCanceled&&O(H=>!H)}const $=Ct("div",t,{state:F,stateAttributesMapping:Ix,props:[R,{role:"menuitemcheckbox","aria-checked":T,onClick:K},w,D],ref:[B,r,C.ref]});return n.jsx(A4.Provider,{value:F,children:$})}),xX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,h=fX(),m=x.useRef(null),{transitionStatus:p,mounted:g,setMounted:b}=ni(h.checked);Sr({batch:!0,enabled:!h.checked,open:h.checked,ref:m,onComplete(){h.checked||b(!1)}});const v={checked:h.checked,disabled:h.disabled,highlighted:h.highlighted,transitionStatus:p};return Ct("span",t,{state:v,ref:[r,m],stateAttributesMapping:Ix,props:{"aria-hidden":!0,...f},enabled:u||g})}),Hw=x.createContext(void 0);function bX(){const e=x.useContext(Hw);if(e===void 0)throw new Error(rn(31));return e}const vX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,[f,h]=x.useState(void 0),m=Ct("div",t,{ref:r,props:{role:"group","aria-labelledby":f,...u}});return n.jsx(Hw.Provider,{value:h,children:m})}),yX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,id:u,...f}=t,h=ws(u),m=bX();return We(()=>(m(h),()=>{m(p=>p===h?void 0:p)}),[m,h]),Ct("div",t,{ref:r,props:{id:h,"aria-hidden":!0,...f}})}),wX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:h=!1,closeOnClick:m=!0,style:p,...g}=t,b=pc({guess:!0,label:u}),v=zx(!0),w=ws(c),{store:C}=ll(),S=C.useState("disabled"),N=h||S,E=C.useState("isActive",b.index),k=C.useState("itemProps"),{getItemProps:A,itemRef:M}=Uw({closeOnClick:m,disabled:N,highlighted:E,id:w,store:C,nativeButton:f,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:Vw});return Ct("div",t,{state:{disabled:N,highlighted:E},props:[k,g,A],ref:[M,r,b.ref]})}),jX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,finalFocus:u,...f}=t,{store:h}=ll(),{side:m,align:p}=zx(),g=vx()!=null,b=h.useState("open"),v=h.useState("transitionStatus"),w=h.useState("popupProps"),C=h.useState("mounted"),S=h.useState("instantType"),N=h.useState("activeTriggerElement"),E=h.useState("parent"),k=h.useState("lastOpenChangeReason"),A=h.useState("rootId"),M=h.useState("floatingRootContext"),R=h.useState("floatingTreeRoot"),T=h.useState("closeDelay"),O=h.useState("hoverEnabled"),D=h.useState("disabled"),B=h.useState("openMethod"),F=E.type==="context-menu";Sr({open:b,ref:h.context.popupRef,onComplete(){var H,W;b&&((W=(H=h.context).onOpenChangeComplete)==null||W.call(H,!0))}}),x.useEffect(()=>{function H(W){h.setOpen(!1,yt(W.reason,W.domEvent))}return R.events.on("close",H),()=>{R.events.off("close",H)}},[R.events,h]),L2(M,{enabled:O&&!D&&!F&&E.type!=="menubar",closeDelay:T});const K=h.useStateSetter("popupElement"),$={transitionStatus:v,side:m,align:p,open:b,nested:E.type==="menu",instant:S},P=Ct("div",t,{state:$,ref:[r,h.context.popupRef,K],stateAttributesMapping:Hg,props:[w,{onKeyDown(H){g&&Zf.has(H.key)&&H.stopPropagation()}},th(v),f,{"data-rootownerid":A}]});let U=E.type===void 0||F;return(N||E.type==="menubar"&&k!==Vg)&&(U=!0),n.jsx(Jg,{context:M,openInteractionType:B,modal:F,disabled:!C,returnFocus:u===void 0?U:u,initialFocus:E.type!=="menu",restoreFocus:!0,externalTree:E.type!=="menubar"?R:void 0,previousFocusableElement:N,nextFocusableElement:E.type===void 0?h.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:E.type===void 0?h.context.beforeContentFocusGuardRef:void 0,children:P})}),M4=x.createContext(void 0);function SX(){const e=x.useContext(M4);if(e===void 0)throw new Error(rn(32));return e}const NX=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t,{store:c,parent:u}=ll();if(!(c.useState("mounted")||a))return null;const m=u.type==="menu"||u.type==="menubar"?"group":void 0;return n.jsx(M4.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i,portalOwnerRole:m})})}),CX=x.forwardRef(function(t,r){var Ie;const{anchor:a,positionMethod:i="absolute",className:c,render:u,side:f,align:h,sideOffset:m=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=wM,style:N,...E}=t,{store:k}=ll(),A=SX(),M=Bw(!0),R=k.useState("parent"),T=k.useState("floatingRootContext"),O=k.useState("floatingTreeRoot"),D=k.useState("mounted"),B=k.useState("open"),F=k.useState("modal"),K=k.useState("openMethod"),$=k.useState("activeTriggerElement"),P=k.useState("transitionStatus"),U=k.useState("positionerElement"),H=k.useState("instantType"),W=k.useState("adaptiveOrigin"),q=k.useState("lastOpenChangeReason"),Z=k.useState("floatingNodeId"),z=k.useState("floatingParentNodeId"),L=T.useState("domReferenceElement"),X=x.useRef(null),ee=Gf(U);let _=a,V=m,G=p,Y=h,ne=S;R.type==="context-menu"&&(_=a??((Ie=R.context)==null?void 0:Ie.anchor),Y=Y??"start",!f&&Y!=="center"&&(G=t.alignOffset??2,V=t.sideOffset??-5));let te=f,ye=Y;R.type==="menu"?(te=te??"inline-end",ye=ye??"start",ne=t.collisionAvoidance??j2):R.type==="menubar"&&(te=te??(R.context.orientation==="vertical"?"inline-end":"bottom"),ye=ye??"start");const ae=R.type==="context-menu",ue=xx({anchor:_,floatingRootContext:T,positionMethod:M?"fixed":i,mounted:D,side:te,sideOffset:V,align:ye,alignOffset:G,arrowPadding:ae?0:v,collisionBoundary:g,collisionPadding:b,sticky:w,nodeId:Z,keepMounted:A,disableAnchorTracking:C,collisionAvoidance:ne,shift:ae?{crossAxis:!("side"in ne&&ne.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:O,adaptiveOrigin:W});x.useEffect(()=>{function ce(Te){Te.open&&(Te.parentNodeId===Z&&k.set("hoverEnabled",!1),Te.nodeId!==Z&&Te.parentNodeId===k.select("floatingParentNodeId")&&k.setOpen(!1,yt(Xd)))}return O.events.on("menuopenchange",ce),()=>{O.events.off("menuopenchange",ce)}},[k,O.events,Z]),x.useEffect(()=>{if(k.select("floatingParentNodeId")==null)return;function ce(Te){if(Te.open||Te.nodeId!==k.select("floatingParentNodeId"))return;const re=Te.reason??Xd;k.setOpen(!1,yt(re))}return O.events.on("menuopenchange",ce),()=>{O.events.off("menuopenchange",ce)}},[O.events,k]);const se=us();x.useEffect(()=>{B||se.clear()},[B,se]),x.useEffect(()=>{function ce(Te){if(!(!B||Te.nodeId!==k.select("floatingParentNodeId")))if(Te.target&&$&&$!==Te.target){const re=k.select("closeDelay");re>0?se.isStarted()||se.start(re,()=>{k.setOpen(!1,yt(Xd))}):k.setOpen(!1,yt(Xd))}else se.clear()}return O.events.on("itemhover",ce),()=>{O.events.off("itemhover",ce)}},[O.events,B,$,k,se]),x.useEffect(()=>{const ce={open:B,nodeId:Z,parentNodeId:z,reason:k.select("lastOpenChangeReason")};O.events.emit("menuopenchange",ce)},[O.events,B,k,Z,z]),We(()=>{const ce=L,Te=X.current;if(ce&&(X.current=ce),Te&&ce&&ce!==Te){k.set("instantType",void 0);const re=new AbortController;return ee(()=>{k.set("instantType","trigger-change")},re.signal),()=>{re.abort()}}},[L,ee,k]);const Q={open:B,side:ue.side,align:ue.align,anchorHidden:ue.anchorHidden,nested:R.type==="menu",instant:H},ie=R.type==="menubar"&&R.context.modal;q2(B&&(ie||F&&q!==Qn),K==="touch",U,$);const pe=bx(t,Q,{styles:ue.positionerStyles,transitionStatus:P,props:E,refs:[r,k.useStateSetter("positionerElement")],hidden:!D,inert:!B}),xe=D&&R.type!=="menu"&&(R.type!=="menubar"&&F&&q!==Qn||R.type==="menubar"&&R.context.modal);let je=null;return R.type==="menubar"?je=R.context.contentElement:R.type===void 0&&(je=$),n.jsxs(E4.Provider,{value:ue,children:[xe&&n.jsx(cx,{ref:R.type==="context-menu"||R.type==="nested-context-menu"?R.context.internalBackdropRef:null,inert:Jf(!B),cutout:je}),n.jsx(EM,{id:Z,children:n.jsx(eh,{elementsRef:k.context.itemDomElements,labelsRef:k.context.itemLabels,children:pe})})]})}),O4=x.createContext(void 0);function kX(){const e=x.useContext(O4);if(e===void 0)throw new Error(rn(34));return e}const TX=x.memo(x.forwardRef(function(t,r){const{render:a,className:i,value:c,defaultValue:u,onValueChange:f,disabled:h=!1,style:m,"aria-labelledby":p,...g}=t,[b,v]=x.useState(void 0),[w,C]=po({controlled:c,default:u,name:"MenuRadioGroup"}),S=st((A,M)=>{f==null||f(A,M),!M.isCanceled&&C(A)}),E=Ct("div",t,{state:{disabled:h},ref:r,props:{role:"group","aria-labelledby":p??b,"aria-disabled":h||void 0,...g}}),k=x.useMemo(()=>({value:w,setValue:S,disabled:h}),[w,S,h]);return n.jsx(Hw.Provider,{value:v,children:n.jsx(O4.Provider,{value:k,children:E})})})),D4=x.createContext(void 0);function EX(){const e=x.useContext(D4);if(e===void 0)throw new Error(rn(35));return e}const RX=x.forwardRef(function(t,r){const{render:a,className:i,id:c,label:u,nativeButton:f=!1,disabled:h=!1,closeOnClick:m=!1,value:p,style:g,...b}=t,v=pc({guess:!0,label:u}),w=zx(!0),C=ws(c),{store:S}=ll(),N=S.useState("isActive",v.index),E=S.useState("itemProps"),{value:k,setValue:A,disabled:M}=kX(),R=S.useState("disabled"),T=h||M||R,O=k===p,{getItemProps:D,itemRef:B}=Uw({closeOnClick:m,disabled:T,highlighted:N,id:C,store:S,nativeButton:f,nodeId:w==null?void 0:w.context.nodeId,itemMetadata:Vw}),F=x.useMemo(()=>({disabled:T,highlighted:N,checked:O}),[T,N,O]);function K(P){const U=yt(Zl,P.nativeEvent,void 0,{preventUnmountOnClose:$n});A(p,U)}const $=Ct("div",t,{state:F,stateAttributesMapping:Ix,props:[E,{role:"menuitemradio","aria-checked":O,onClick:K},b,D],ref:[B,r,v.ref]});return n.jsx(D4.Provider,{value:F,children:$})}),AX=x.forwardRef(function(t,r){const{render:a,className:i,style:c,keepMounted:u=!1,...f}=t,h=EX(),m=x.useRef(null),{transitionStatus:p,mounted:g,setMounted:b}=ni(h.checked);Sr({batch:!0,enabled:!h.checked,open:h.checked,ref:m,onComplete(){h.checked||b(!1)}});const v={checked:h.checked,disabled:h.disabled,highlighted:h.highlighted,transitionStatus:p};return Ct("span",t,{state:v,stateAttributesMapping:Ix,ref:[r,m],props:{"aria-hidden":!0,...f},enabled:u||g})}),MX=x.createContext(null);function z4(e){return x.useContext(MX)}const OX={...ix,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class DX extends _u{constructor(r,a,i=!1){const c=new Qf,u=IX(c,a,i,r);super(u,zX(c),OX);ln(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",f=>{var h;if((h=this.unsubscribeParentListener)==null||h.call(this),f.type==="menu"){let m=f.store.select("rootId"),p=f.store.select("floatingTreeRoot"),g=f.store.select("keyboardEventRelay");this.unsubscribeParentListener=f.store.subscribe(()=>{const b=f.store.select("rootId"),v=f.store.select("floatingTreeRoot"),w=f.store.select("keyboardEventRelay");m===b&&p===v&&g===w||(m=b,p=v,g=w,this.notifyAll())}),this.context.allowMouseUpTriggerRef=f.store.context.allowMouseUpTriggerRef;return}f.type!==void 0&&(this.context.allowMouseUpTriggerRef=f.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(r,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:r,eventDetails:a})}}function zX(e){return{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function IX(e,t,r=!1,a){return{...ax(e,t,r),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new S2,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:En,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...a}}const PX=x.createContext(void 0);function _X(){return x.useContext(PX)}const LX=Xf(function(t){const{children:r,open:a,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:f=!1,modal:h,loopFocus:m=!0,orientation:p="vertical",actionsRef:g,closeParentOnEsc:b=!1,handle:v,triggerId:w,defaultTriggerId:C=null,highlightItemOnHover:S=!0}=t,N=Bw(!0),E=ll(!0),k=z4(!0),A=_X(),M=x.useMemo(()=>A&&E?{type:"menu",store:E.store}:k?{type:"menubar",context:k}:N&&!E?{type:"context-menu",context:N}:{type:void 0},[N,E,k,A]),R=sc(),T=sc(),O=ol(),D=M.type==="menu"?M.store:void 0,B=(a??u)&&(D==null?void 0:D.state.transitionStatus)==="starting",F=vs(()=>B?D==null?void 0:D.state.instantType:void 0).current,K=$X({open:u,openProp:a,activeTriggerId:C,triggerIdProp:w,parent:M,disabled:f,highlightItemOnHover:S,modal:M.type===void 0?h:void 0,rootId:R,instantType:F},T,O!=null);K.useControlledProp("openProp",a),K.useControlledProp("triggerIdProp",w),K.useContextCallback("onOpenChangeComplete",c);const $=K.useState("floatingTreeRoot"),P=N2($),U=K.useState("open"),H=K.useState("activeTriggerElement"),W=K.useState("positionerElement"),q=K.useState("hoverEnabled"),Z=K.useState("disabled"),z=K.useState("lastOpenChangeReason"),L=K.useState("parent"),X=K.useState("activeIndex"),ee=K.useState("payload"),_=K.useState("floatingParentNodeId"),V=x.useRef(null),G=x.useRef(L.type!=="context-menu"),Y=us(),ne=x.useRef(!0),te=us(),ye=_!=null,{openMethod:ae,triggerProps:ue}=JM(U);K.useSyncedValues({disabled:f,highlightItemOnHover:S,modal:L.type===void 0?h:void 0,openMethod:ae,rootId:R}),sx(K);const{forceUnmount:se,transitionStatus:Q}=rx(U,K,()=>{K.set("allowMouseEnter",!1)},B),ie=Gf(K.context.popupRef);x.useEffect(()=>{if(F===void 0)return;const _e=()=>{K.state.instantType===F&&K.set("instantType",void 0)};if(!U){_e();return}if(Q!==void 0)return;if(K.context.popupRef.current==null){_e();return}const Xe=new AbortController;return ie(_e,Xe.signal),()=>{Xe.abort()}},[F,U,Q,ie,K]),We(()=>{N&&!E?K.update({parent:{type:"context-menu",context:N},floatingNodeId:P,floatingParentNodeId:O}):E&&K.update({floatingNodeId:P,floatingParentNodeId:O})},[N,E,P,O,K]),x.useEffect(()=>{if(U||(V.current=null),L.type==="context-menu"){if(!U){Y.clear(),G.current=!1;return}Y.start(500,()=>{G.current=!0})}},[Y,U,L.type]),We(()=>{!U&&!q&&K.set("hoverEnabled",!0)},[U,q,K]);const oe=st((_e,Xe)=>{const Je=Xe.reason;if(!_e&&!K.select("open")||U===_e&&Xe.trigger===H&&z===Je)return;const ct=O2(Xe);if(!_e&&Xe.trigger==null&&(Xe.trigger=H??void 0),i==null||i(_e,Xe),Xe.isCanceled)return;K.state.floatingRootContext.dispatchOpenChange(_e,Xe);const At=Xe.event;if(_e===!1&&(At==null?void 0:At.type)==="click"&&At.pointerType==="touch"&&!ne.current)return;_e&&Je===gu?(ne.current=!1,te.start(300,()=>{ne.current=!0})):(ne.current=!0,te.clear());const rt=(Je===ma||Je===Zl)&&At.detail===0,ve=!_e&&(Je===Hf||Je==null);V.current=Xe.event;const Ue=nx(K.state,_e,Xe.trigger,ct());Ue.openChangeReason=Je,L.type==="menubar"&&(Je===gu||Je===Ji||Je===Qn||Je===Ry||Je===Xd)?Ue.instantType="group":rt||ve?Ue.instantType=rt?"click":"dismiss":Ue.instantType=void 0,K.update(Ue)}),pe=BM({popupStore:K,floatingRootContext:K.state.floatingRootContext,floatingId:T,nested:O!=null,onOpenChange:oe}),xe=pe.context.events;We(()=>{const _e=({open:Xe,eventDetails:Je})=>oe(Xe,Je);return xe.on("setOpen",_e),()=>{xe==null||xe.off("setOpen",_e)}},[xe,oe]);const je=x.useCallback(()=>{K.setOpen(!1,yt(Ug))},[K]);x.useImperativeHandle(g,()=>({unmount:se,close:je}),[se,je]);let Ie;L.type==="context-menu"&&(Ie=L.context),x.useImperativeHandle(Ie==null?void 0:Ie.positionerRef,()=>W,[W]),x.useImperativeHandle(Ie==null?void 0:Ie.actionsRef,()=>({setOpen:oe}),[oe]);const ce=Kf(pe,{enabled:!Z,bubbles:{escapeKey:b&&L.type==="menu"},outsidePress(){var _e;return L.type!=="context-menu"||((_e=V.current)==null?void 0:_e.type)==="contextmenu"?!0:G.current},externalTree:ye?$:void 0}),Te=gx(),re=x.useCallback(_e=>{K.select("activeIndex")!==_e&&K.set("activeIndex",_e)},[K]),fe=qM(pe,{enabled:!Z,listRef:K.context.itemDomElements,activeIndex:X,nested:L.type!==void 0,loopFocus:m,orientation:p,parentOrientation:L.type==="menubar"?L.context.orientation:void 0,rtl:Te==="rtl",disabledIndices:Vr,onNavigate:re,openOnArrowKeyDown:L.type!=="context-menu",externalTree:ye?$:void 0,focusItemOnHover:S}),Re=x.useCallback(_e=>{K.context.typingRef.current=_e},[K]),Oe=YM(pe,{enabled:!Z,listRef:K.context.itemLabels,elementsRef:K.context.itemDomElements,activeIndex:X,resetMs:Y$,onMatch:_e=>{U&&_e!==X&&K.set("activeIndex",_e)},onTyping:Re}),ke=x.useMemo(()=>{const _e=Qs(Oe.reference,fe.reference,ce.reference,{onMouseMove(){K.set("allowMouseEnter",!0)}},ue);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=U,_e},[K,Oe.reference,fe.reference,ce.reference,ue,U]),he=x.useMemo(()=>{const _e=Qs(fe.trigger,ce.trigger,ue);return _e["aria-haspopup"]="menu",_e["aria-expanded"]=!1,_e},[fe.trigger,ce.trigger,ue]);vs(()=>(K.update({inactiveTriggerProps:he}),null));const Ae=x.useMemo(()=>Qs(Wf,{id:T,role:"menu","aria-orientation":p==="horizontal"?"horizontal":void 0,"aria-labelledby":H==null?void 0:H.id,onMouseMove(){K.set("allowMouseEnter",!0),L.type==="menu"&&K.set("hoverEnabled",!1)},onClick(){K.select("hoverEnabled")&&K.set("hoverEnabled",!1)},onKeyDown(_e){const Xe=K.select("keyboardEventRelay");Xe&&!_e.isPropagationStopped()&&Xe(_e)}},Oe.floating,fe.floating,ce.floating),[H,T,p,L.type,K,Oe.floating,fe.floating,ce.floating]),ge=fe.item??En;ox(K,{floatingRootContext:pe,activeTriggerProps:ke,inactiveTriggerProps:he,popupProps:Ae,itemProps:ge});const Pe=x.useMemo(()=>({store:K,parent:M}),[K,M]),Fe=n.jsxs(R4.Provider,{value:Pe,children:[v&&n.jsx(tx,{handle:v,store:K}),typeof r=="function"?r({payload:ee}):r]});return L.type===void 0||L.type==="context-menu"?n.jsx(RM,{externalTree:$,children:Fe}):Fe});function $X(e,t,r){return vs(()=>new DX(e,t,r)).current}function I4(e){const{render:t,className:r,style:a,state:i=En,props:c=Vr,refs:u=Vr,metadata:f,stateAttributesMapping:h,tag:m="div",...p}=e,{compositeProps:g,compositeRef:b}=w3({metadata:f});return Ct(m,e,{state:i,ref:[b,...u],props:[g,...c,p],stateAttributesMapping:h})}function P4(e){if(wn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Ha(e))return P4(Ka(e))}function _4(e,t){const r=x.useRef(null);function a(c){go.flushSync(()=>{e.setOpen(!1,yt(Ji,c.nativeEvent,c.currentTarget))});const u=H$(r.current);u==null||u.focus()}function i(c){var f;const u=e.select("positionerElement");if(u&&bu(c,u))(f=e.context.beforeContentFocusGuardRef.current)==null||f.focus();else{go.flushSync(()=>{e.setOpen(!1,yt(Ji,c.nativeEvent,c.currentTarget))});let h=U$(e.context.triggerFocusTargetRef.current||t.current);for(;h!==null&>(u,h);){const m=h;if(h=w2(h),h===m)break}h==null||h.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:a,handleFocusTargetFocus:i}}function BX(e){const{enabled:t=!0,mouseDownAction:r,open:a}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(i.current=!0,Ht(c.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:c=>{i.current&&(i.current=!1,c.preventBaseUIHandler())}}:En,[t,r,a])}const VX=R2(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,id:h,openOnHover:m,delay:p=100,closeDelay:g=0,handle:b,payload:v,...w}=t,C=ll(!0),N=I2(b)??(C==null?void 0:C.store);if(!N)throw new Error(rn(85));const E=ws(h),k=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),M=N.useState("isOpenedByTrigger",E),R=N.useState("triggerPopupId",E),T=x.useRef(null),O=HX(),D=Dg(!0),B=al(),F=x.useMemo(()=>B??new S2,[B]),K=N2(F),$=ol(),{registerTrigger:P,isMountedByThisTrigger:U}=D2(E,T,N,{payload:v,closeDelay:g,parent:O,floatingTreeRoot:F,floatingNodeId:K,floatingParentNodeId:$,keyboardEventRelay:D==null?void 0:D.relayKeyboardEvent}),H=O.type==="menubar",W=N.useState("disabled"),q=u||W||H&&O.context.disabled,{getButtonProps:Z,buttonRef:z}=bo({disabled:q,native:f});x.useEffect(()=>{!M&&O.type===void 0&&(N.context.allowMouseUpTriggerRef.current=!1)},[N,M,O.type]);const L=x.useRef(null),X=us(),ee=st(Ie=>{if(!L.current)return;X.clear(),N.context.allowMouseUpTriggerRef.current=!1;const ce=Ie.target;gt(L.current,ce)||gt(N.select("positionerElement"),ce)||ce===L.current||ce!=null&&P4(ce)===N.select("rootId")||f3(Ie,L.current)||F.events.emit("close",{domEvent:Ie,reason:ZA})});x.useEffect(()=>{M&&N.select("lastOpenChangeReason")===Qn&&Ht(L.current).addEventListener("mouseup",ee,{once:!0})},[M,ee,N]);const _=H&&O.context.hasSubmenuOpen,G=$2(A,{enabled:(m??_)&&!q&&(!H||_&&!U),handleClose:B2({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:O.type===void 0?p:void 0,delay:{close:g},triggerElementRef:T,externalTree:F,isActiveTrigger:k,isClosing:()=>N.select("transitionStatus")==="ending"}),Y=UX(M,N.select("lastOpenChangeReason")),ne=k2(A,{enabled:!q,event:M&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?Y:!1}),te=FM(A,{enabled:!q&&_}),ye=BX({open:M,enabled:H,mouseDownAction:"open"}),ae=x.useMemo(()=>Qs(te.reference,ne.reference),[te.reference,ne.reference]),ue=N.useState("triggerProps",U),{preFocusGuardRef:se,handlePreFocusGuardFocus:Q,handleFocusTargetFocus:ie}=_4(N,T),oe={disabled:q,open:M},pe=[L,r,z,P,T],xe=[ae,G??En,ue,{"aria-haspopup":"menu","aria-controls":R,id:E,onMouseDown:Ie=>{if(N.select("open"))return;X.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),Ht(Ie.currentTarget).addEventListener("mouseup",ee,{once:!0})}},H?{role:"menuitem"}:{},ye,w,Z],je=Ct("button",t,{enabled:!H,stateAttributesMapping:Xp,state:oe,ref:pe,props:xe});return H?n.jsx(I4,{tag:"button",render:a,className:i,style:c,state:oe,refs:pe,props:xe,stateAttributesMapping:Xp}):M?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:se,onFocus:Q},`${E}-pre-focus-guard`),n.jsx(x.Fragment,{children:je},E),n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:ie},`${E}-post-focus-guard`)]}):n.jsx(x.Fragment,{children:je},E)});function UX(e,t){const r=us(),[a,i]=x.useState(!1);return We(()=>{e&&t===Qn?(i(!0),r.start(vM,()=>{i(!1)})):e||(r.clear(),i(!1))},[e,t,r]),a}function HX(){const e=z4();return x.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const FX=x.forwardRef(function(t,r){const{className:a,render:i,orientation:c="horizontal",style:u,...f}=t;return Ct("div",t,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})});function Fi({...e}){return n.jsx(LX,{"data-slot":"dropdown-menu",...e})}function Gi({...e}){return n.jsx(VX,{"data-slot":"dropdown-menu-trigger",...e})}function qi({align:e="start",alignOffset:t=0,side:r="bottom",sideOffset:a=4,className:i,positionerRender:c,...u}){return n.jsx(NX,{children:n.jsx(CX,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:r,sideOffset:a,render:c,children:n.jsx(jX,{"data-slot":"dropdown-menu-content",className:Ve("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",i),...u})})})}function Ip({...e}){return n.jsx(vX,{"data-slot":"dropdown-menu-group",...e})}function T1({className:e,inset:t,...r}){return n.jsx(yX,{"data-slot":"dropdown-menu-label","data-inset":t,className:Ve("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...r})}function Rs({className:e,inset:t,variant:r="default",...a}){return n.jsx(wX,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Ve("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...a})}x.createContext(null);function Fw({className:e,children:t,checked:r,inset:a,...i}){return n.jsxs(gX,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:Ve("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:r,...i,children:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:n.jsx(xX,{children:n.jsx(Yn,{})})}),t]})}function GX({...e}){return n.jsx(TX,{"data-slot":"dropdown-menu-radio-group",...e})}function yE({className:e,children:t,inset:r,...a}){return n.jsxs(RX,{"data-slot":"dropdown-menu-radio-item","data-inset":r,className:Ve("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:n.jsx(AX,{children:n.jsx(Yn,{})})}),t]})}function ju({className:e,...t}){return n.jsx(FX,{"data-slot":"dropdown-menu-separator",className:Ve("-mx-1 my-1 h-px bg-border",e),...t})}const qX=[{id:"rest",label:"HTTP",hint:"Inspect each request: method and path"},{id:"tcp",label:"TCP",hint:"Connection only; nothing inside is inspected"},{id:"websocket",label:"WebSocket"},{id:"graphql",label:"GraphQL"}],L4=[{id:"read-only",label:"Read only",hint:"GET, HEAD and OPTIONS"},{id:"read-write",label:"Read & write",hint:"Adds POST, PUT, PATCH and DELETE"},{id:"full",label:"Full",hint:"Any request"},{id:"custom",label:"Specific requests",hint:"Only the method and path pairs listed"}],YX=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],Oo=(e={})=>({host:"",ports:"443",protocol:"rest",access:"read-only",allow:[],deny:[],enforcement:"enforce",allowedIps:"",...e}),KX=[{id:"github-api-read",label:"GitHub API · read",rule:{name:"github-api-read",binaries:[],endpoints:[Oo({host:"api.github.com",access:"custom",allow:[{method:"GET",path:"/repos/**"}]})]}},{id:"github-git",label:"git clone from GitHub",rule:{name:"github-git",binaries:["/usr/lib/git-core/git-remote-http","/usr/lib/git-core/git-remote-https"],endpoints:[Oo({host:"github.com"}),Oo({host:"codeload.github.com"})]}},{id:"npm",label:"npm registry",rule:{name:"npm-registry",binaries:["/usr/bin/node","/usr/local/bin/node"],endpoints:[Oo({host:"registry.npmjs.org"})]}},{id:"pypi",label:"PyPI",rule:{name:"pypi",binaries:["/usr/bin/python3*","/usr/local/bin/pip*"],endpoints:[Oo({host:"pypi.org"}),Oo({host:"files.pythonhosted.org"})]}},{id:"huggingface",label:"Hugging Face · downloads",rule:{name:"huggingface",binaries:["/usr/bin/python3*"],endpoints:[Oo({host:"huggingface.co"}),Oo({host:"**.hf.co"})]}}];function sy(e){var t;return{name:(e==null?void 0:e.name)??"",binaries:[...(e==null?void 0:e.binaries)??[]],endpoints:((t=e==null?void 0:e.endpoints)!=null&&t.length?e.endpoints:[Oo()]).map(r=>{var a;return Oo({...r,ports:Array.isArray(r.ports)?r.ports.join(", "):String(r.ports??r.port??"443"),access:(a=r.allow)!=null&&a.length?"custom":r.access&&r.access!=="custom"?r.access:"read-only",protocol:r.protocol??"rest",allowedIps:Array.isArray(r.allowedIps)?r.allowedIps.join(", "):r.allowedIps??"",allow:[...r.allow??[]],deny:[...r.deny??[]]})})}}function XX(e){return{name:e.name.trim(),binaries:e.binaries,endpoints:e.endpoints.map(t=>({host:t.host.trim(),ports:t.ports.split(/[\s,]+/).filter(Boolean).map(Number),protocol:t.protocol,...t.protocol==="tcp"&&t.tlsSkip?{tlsSkip:!0}:{},access:t.protocol==="tcp"||t.access==="custom"?null:t.access,allow:t.protocol==="tcp"||t.access!=="custom"?[]:t.allow.filter(r=>r.path),deny:t.protocol==="tcp"?[]:t.deny.filter(r=>r.path),enforcement:t.enforcement,allowedIps:t.allowedIps.split(/[\s,]+/).filter(Boolean)}))}}function WX(e){const t={binaries:e.binaries??[],endpoints:(e.endpoints??[]).map(u=>({...u,ports:u.ports??(u.port?[u.port]:[]),allow:u.allow??[],deny:u.deny??[]}))},r=t.binaries.length?[...new Set(t.binaries.map(u=>u.split("/").pop()))].join(", "):"no program",a=t.endpoints.map(u=>{var h;const f=`${u.host||"…"}:${u.ports.join(",")||"…"}`;return u.protocol==="tcp"?`open connections to ${f}`:u.allow.length?`send ${u.allow.map(m=>`${m.method} ${m.path}`).join(", ")} to ${f}`:`make ${((h=L4.find(m=>m.id===u.access))==null?void 0:h.label.toLowerCase())??""} requests to ${f}`}),i=t.endpoints.flatMap(u=>u.deny.map(f=>`${f.method} ${f.path}`)),c=t.endpoints.some(u=>u.enforcement==="audit");return`${r} may ${a.join("; and ")}${i.length?`, except ${i.join(", ")}`:""}.${c?" Audit only: violations are logged but allowed.":""}`}function Su({options:e,value:t,onChange:r,label:a}){return n.jsx("div",{role:"radiogroup","aria-label":a,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:e.map(i=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===i.id,onClick:()=>r(i.id),title:i.hint,className:`flex-1 rounded px-2 py-1 text-[11px] whitespace-nowrap outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${t===i.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i.label},i.id))})}function Sg({items:e,onChange:t,kind:r}){return n.jsxs("div",{className:"space-y-1.5",children:[e.map((a,i)=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(pn,{value:a.method,onChange:c=>t(e.map((u,f)=>f===i?{...u,method:c.target.value}:u)),"aria-label":"Method",className:"h-8 rounded-md border border-input bg-transparent px-1.5 font-mono text-[11px] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:YX.map(c=>n.jsx("option",{children:c},c))}),n.jsx(Ot,{value:a.path,onChange:c=>t(e.map((u,f)=>f===i?{...u,path:c.target.value}:u)),className:"h-8 font-mono text-[11px]",placeholder:"/repos/**","aria-label":"Path pattern"}),n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r} rule`,onClick:()=>t(e.filter((c,u)=>u!==i)),children:n.jsx(Pn,{className:"size-3.5"})})]},i)),n.jsxs("button",{type:"button",onClick:()=>t([...e,{method:"GET",path:""}]),className:`flex items-center gap-1 text-[11px] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring ${r==="deny"?"text-red-700":"text-muted-foreground"}`,children:[n.jsx(ys,{className:"size-3"}),r==="deny"?"Block request":"Allow request"]})]})}function QX({open:e,onOpenChange:t,initial:r,onSubmit:a,knownPrograms:i=[],title:c="New rule",submitLabel:u="Add rule",lockName:f=!1}){const[h,m]=x.useState(()=>sy(r)),[p,g]=x.useState(""),[b,v]=x.useState(!1),[w,C]=x.useState(null);x.useEffect(()=>{e&&(m(sy(r)),C(null),g(""))},[e,r]);const S=(M,R)=>m(T=>({...T,endpoints:T.endpoints.map((O,D)=>D===M?{...O,...R}:O)})),N=M=>{const R=M.trim();R&&!h.binaries.includes(R)&&m(T=>({...T,binaries:[...T.binaries,R]})),g("")},E=XX(h),k=i.filter(M=>!h.binaries.includes(M));async function A(M){M.preventDefault(),v(!0),C(null);try{await a(E),t(!1)}catch(R){C(R.message)}finally{v(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:A,className:"grid gap-5",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:c}),n.jsx(Sn,{className:"sr-only",children:"Everything not allowed by a rule stays denied."})]}),!f&&n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Presets"}),KX.map(M=>n.jsx("button",{type:"button",onClick:()=>m(sy(M.rule)),className:"rounded border border-border px-2 py-0.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:M.label},M.id))]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"rule-name",className:"text-xs",children:"Rule name"}),n.jsx(Ot,{id:"rule-name",value:h.name,disabled:f,onChange:M=>m(R=>({...R,name:M.target.value.toLowerCase()})),className:"font-mono text-xs",placeholder:"github-api-read",required:!0})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Programs"}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[h.binaries.map(M=>n.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[M,n.jsx("button",{type:"button","aria-label":`Remove ${M}`,onClick:()=>m(R=>({...R,binaries:R.binaries.filter(T=>T!==M)})),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-3"})})]},M)),!h.binaries.length&&n.jsx("span",{className:"text-[11px] text-amber-700",children:"Add at least one program"})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{value:p,onChange:M=>g(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),N(p))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/curl",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>N(p),disabled:!p.trim(),children:"Add"})]}),k.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),k.slice(0,6).map(M=>n.jsxs("button",{type:"button",onClick:()=>N(M),className:"rounded border border-dashed border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["+ ",M]},M))]})]}),n.jsxs("div",{className:"grid gap-3",children:[n.jsx("span",{className:"text-xs font-medium",children:"Destinations"}),h.endpoints.map((M,R)=>n.jsxs("div",{className:"grid gap-3 rounded-lg border border-border p-3",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"grid flex-1 gap-1",children:[n.jsx(zn,{className:"text-[11px] text-muted-foreground",htmlFor:`host-${R}`,children:"Host"}),n.jsx(Ot,{id:`host-${R}`,value:M.host,onChange:T=>S(R,{host:T.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"api.github.com",title:"Wildcards like *.example.com work",required:!0})]}),n.jsxs("div",{className:"grid w-24 gap-1",children:[n.jsx(zn,{className:"text-[11px] text-muted-foreground",htmlFor:`ports-${R}`,children:"Ports"}),n.jsx(Ot,{id:`ports-${R}`,value:M.ports,onChange:T=>S(R,{ports:T.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"443",required:!0})]}),h.endpoints.length>1&&n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Remove destination",onClick:()=>m(T=>({...T,endpoints:T.endpoints.filter((O,D)=>D!==R)})),children:n.jsx(ts,{className:"size-3.5"})})]}),n.jsx(Su,{label:"Inspection",options:qX,value:M.protocol,onChange:T=>S(R,{protocol:T})}),M.protocol!=="tcp"&&n.jsxs(n.Fragment,{children:[n.jsx(Su,{label:"Access",options:L4,value:M.access,onChange:T=>S(R,{access:T,allow:T==="custom"&&!M.allow.length?[{method:"GET",path:""}]:M.allow})}),M.access==="custom"&&n.jsx(Sg,{kind:"allow",items:M.allow,onChange:T=>S(R,{allow:T})}),n.jsx(Sg,{kind:"deny",items:M.deny,onChange:T=>S(R,{deny:T})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("div",{className:"w-52",children:n.jsx(Su,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:M.enforcement,onChange:T=>S(R,{enforcement:T})})}),M.enforcement==="audit"&&n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[n.jsx(ti,{className:"size-3"}),"Logged, not blocked"]})]}),n.jsxs("details",{className:"group",children:[n.jsx("summary",{title:"Only for hosts resolving to private addresses. Loopback and metadata are always blocked.",className:"cursor-pointer text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Private network access"}),n.jsx("div",{className:"mt-2 grid gap-1",children:n.jsx(Ot,{value:M.allowedIps,onChange:T=>S(R,{allowedIps:T.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.20/32","aria-label":"Allowed IPs"})})]})]},R)),n.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>m(M=>({...M,endpoints:[...M.endpoints,Oo()]})),children:[n.jsx(ys,{}),"Add destination"]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:WX(E)}),w&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:w}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:b||!h.binaries.length,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[b&&n.jsx(Nt,{"aria-hidden":"true"}),u]})]})]})})})}function Hu({className:e,...t}){return n.jsx("textarea",{"data-slot":"textarea",className:js("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}const Yi={ports:[443,80],programs:[],requests:"any",allow:[],deny:[],enforcement:"enforce",privateIps:[]},$4=[{id:"any",label:"Any",hint:"Every method and path"},{id:"read-only",label:"Read only",hint:"GET, HEAD and OPTIONS"},{id:"read-write",label:"Read & write",hint:"Adds POST, PUT and PATCH"},{id:"custom",label:"Specific",hint:"Only the method and path pairs listed"}],ZX=[{label:"GitHub · read and clone",policy:{name:"GitHub read",destinations:["github.com","api.github.com","codeload.github.com"],advanced:{...Yi,ports:[443],requests:"custom",allow:[{method:"GET",path:"/**"},{method:"HEAD",path:"/**"},{method:"POST",path:"/*/*/git-upload-pack"}],deny:[{method:"*",path:"/*/*/git-receive-pack"}]}}},{label:"npm",policy:{name:"npm registry",destinations:["registry.npmjs.org"],advanced:{...Yi,ports:[443]}}},{label:"PyPI",policy:{name:"PyPI",destinations:["pypi.org","files.pythonhosted.org"],advanced:{...Yi,ports:[443],requests:"read-only"}}}],Ki=(e={})=>({name:"",action:"allow",destinations:[],appliesTo:{everyone:!1,groups:[],sandboxes:[]},advanced:Yi,...e}),JX=e=>e.split(`
|
|
519
|
+
`).map(t=>t.trim()).filter(Boolean),Ng=e=>e.split(/[\s,]+/).filter(Boolean),eW=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40).replace(/-$/,""),Pp=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`,tW=e=>JSON.stringify({...Yi,...e})===JSON.stringify(Yi);function np(e){const t={...Yi,...(e==null?void 0:e.advanced)??{}};return{id:(e==null?void 0:e.id)??"",name:(e==null?void 0:e.name)??"",action:(e==null?void 0:e.action)??"allow",setup:(e==null?void 0:e.setup)??null,destinations:[...(e==null?void 0:e.destinations)??[]],appliesTo:{everyone:!1,groups:[],sandboxes:[],...(e==null?void 0:e.appliesTo)??{}},ports:t.ports.join(", "),programs:[...t.programs],requests:t.requests,allow:[...t.allow],deny:[...t.deny],enforcement:t.enforcement,privateIps:t.privateIps.join(", ")}}function nW(e,t){return{id:t?eW(e.name):e.id,name:e.name.trim(),action:e.action,destinations:e.destinations,appliesTo:e.appliesTo,...e.setup?{setup:e.setup}:{},...e.action==="allow"?{advanced:{ports:Ng(e.ports).map(Number),programs:e.programs,requests:e.requests,allow:e.requests==="custom"?e.allow.filter(r=>r.path):[],deny:e.deny.filter(r=>r.path),enforcement:e.enforcement,privateIps:Ng(e.privateIps)}}:{}}}const sW=e=>{var t;return((t=e.setup)==null?void 0:t.name)??"an MCPs & Skills setup"};function uf(e,t){var i;const r=e.appliesTo;if(r.everyone)return"every sandbox";const a=[...r.groups.map(c=>{var u;return((u=t.find(f=>f.id===c))==null?void 0:u.name)??c}),...r.sandboxes,...(i=r.setups)!=null&&i.length?[`sandboxes using “${sW(e)}”`]:[]];return a.length?Pp(a):null}function rW(e,t=[]){var p;const r=e.destinations.length>3?`${e.destinations.slice(0,3).join(", ")} and ${e.destinations.length-3} more`:Pp(e.destinations),a=uf(e,t),i=a?`Applies to ${a}.`:"Not applied to any sandbox yet.";if(e.action==="block")return`Blocks ${r||"…"} and their subdomains, for every program. Beats every allow. ${i}`;const c={...Yi,...e.advanced},u=c.requests==="custom"?`only ${c.allow.map(g=>`${g.method} ${g.path}`).join(", ")||"the listed requests"}`:((p=$4.find(g=>g.id===c.requests))==null?void 0:p.label.toLowerCase())+" requests",f=c.programs.length?`from ${Pp([...new Set(c.programs.map(g=>g.split("/").pop()))])}`:"from any program",h=c.deny.length?`, except ${c.deny.map(g=>`${g.method} ${g.path}`).join(", ")}`:"",m=c.enforcement==="audit"?" Audit only: violations are logged, not blocked.":"";return`Allows ${u}${h} to ${r||"…"} on port${c.ports.length===1?"":"s"} ${Pp(c.ports.map(String))}, ${f}.${m} ${i}`}function Gw({open:e,onOpenChange:t,initial:r,groups:a=[],sandboxes:i=[],assignments:c={},setupMembers:u={},knownPrograms:f=[],onSaved:h,onGroupCreated:m,sourceControl:p}){var ee,_;const g=Pt(),b=!(r!=null&&r.id),[v,w]=x.useState(()=>np(r)),[C,S]=x.useState([]),N=[...a,...C.filter(V=>!a.some(G=>G.id===V.id))].sort((V,G)=>V.name.localeCompare(G.name)),[E,k]=x.useState(""),[A,M]=x.useState(""),[R,T]=x.useState(!1),[O,D]=x.useState(null),[B,F]=x.useState(!1);x.useEffect(()=>{e&&(w(np(r)),D(null),k(""),M(""),F(!1))},[e,r]);const K=V=>w(G=>({...G,...V})),$=V=>w(G=>({...G,appliesTo:{...G.appliesTo,...V}})),P=((ee=v.appliesTo.setups)==null?void 0:ee.length)>0,U=!v.appliesTo.everyone&&!v.appliesTo.sandboxes.length&&(P||v.appliesTo.groups.length>0)&&v.appliesTo.groups.every(V=>N.some(G=>G.id===V)),H=nW(v,b),W=V=>{const G=Ng(V).filter((Y,ne,te)=>!v.destinations.includes(Y)&&te.indexOf(Y)===ne);G.length&&K({destinations:[...v.destinations,...G]}),M("")},q=V=>{const G=V.trim();G&&!v.programs.includes(G)&&K({programs:[...v.programs,G]}),k("")},Z=Object.fromEntries(N.map(V=>[V.id,i.filter(G=>ir({assignments:c},G).includes(V.id)).length])),z=i.filter(V=>Mx(H,{name:V,groups:ir({assignments:c},V),setups:u[V]??[]}));async function L(V){if(V.preventDefault(),!U){D("Choose at least one group for this network rule.");return}T(!0),D(null);const G=Ng(A).filter(ne=>!H.destinations.includes(ne)),Y={...H,destinations:[...H.destinations,...G]};try{h(await g.savePolicy({...Y,isNew:b}),Y),t(!1)}catch(ne){D(ne.message)}finally{T(!1)}}async function X(){T(!0),D(null);try{h({...await g.deletePolicy(r.id),deleted:!0},r),t(!1)}catch(V){D(V.message)}finally{T(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:n.jsxs("form",{onSubmit:L,className:"grid gap-5",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:b?"Add network rule":`Edit ${r.name}`}),n.jsx(Sn,{className:"text-xs",children:"Sandboxes start locked down: nothing leaves them unless a rule allows it. A block beats every allow."})]}),n.jsx("fieldset",{disabled:R||JSON.stringify(v)!==JSON.stringify(np(r))||!!(A||E),children:p}),b&&n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Start from"}),ZX.map(V=>n.jsx("button",{type:"button",onClick:()=>w(G=>({...np(Ki(V.policy)),appliesTo:G.appliesTo})),className:"rounded border border-border px-2 py-0.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:V.label},V.label))]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"policy-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"policy-name",value:v.name,onChange:V=>K({name:V.target.value}),className:"text-xs",placeholder:"GitHub read",required:!0,autoFocus:b})]}),n.jsxs("fieldset",{className:"grid gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("legend",{className:"px-1 text-xs font-medium",children:["Groups ",n.jsxs("span",{className:"text-muted-foreground",children:["· ",P?"Optional":"Required"]})]}),P&&n.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:["Applies to sandboxes that use the MCPs & Skills setup",(_=v.setup)!=null&&_.name?n.jsxs(n.Fragment,{children:[" “",n.jsx("span",{className:"text-foreground",children:v.setup.name}),"”"]}):"",". Groups you pick here also get it."]}),n.jsx(cc,{multiple:!0,required:!P,groups:N,counts:Z,value:v.appliesTo.groups,onChange:V=>$({everyone:!1,groups:V,sandboxes:[]}),onCreated:V=>{S(G=>[...G,V]),m==null||m(V)}}),z.length>0&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[z.length," ",z.length===1?"sandbox":"sandboxes"," currently in scope."]}),!b&&!P&&(r.appliesTo.everyone||r.appliesTo.sandboxes.length||!r.appliesTo.groups.length)&&n.jsx("p",{className:"text-[11px] text-amber-700",children:"This rule uses a legacy scope. Choose its groups before saving; saving replaces the previous scope."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Action"}),n.jsx("div",{className:"w-48",children:n.jsx(Su,{label:"Action",options:[{id:"allow",label:"Allow"},{id:"block",label:"Block"}],value:v.action,onChange:V=>K({action:V})})})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"policy-destinations",className:"text-xs",children:"Destinations"}),n.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 focus-within:ring-2 focus-within:ring-ring",children:[v.destinations.map(V=>n.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[V,n.jsx("button",{type:"button","aria-label":`Remove ${V}`,onClick:()=>K({destinations:v.destinations.filter(G=>G!==V)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-3"})})]},V)),n.jsx("input",{id:"policy-destinations",value:A,onChange:V=>/[\s,]$/.test(V.target.value)?W(V.target.value):M(V.target.value),onKeyDown:V=>{V.key==="Enter"?(V.preventDefault(),W(A)):V.key==="Backspace"&&!A&&v.destinations.length&&K({destinations:v.destinations.slice(0,-1)})},onBlur:()=>W(A),className:"min-w-32 flex-1 bg-transparent font-mono text-[11px] outline-none placeholder:text-muted-foreground",placeholder:v.destinations.length?"":v.action==="block"?"pastebin.com":"github.com","aria-label":"Destinations"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:v.action==="block"?"Press Enter after each host. Blocking a host also blocks its subdomains.":"Press Enter after each host. *.example.com matches one level, **.example.com any depth."})]}),v.action==="allow"&&n.jsxs("details",{className:"group rounded-lg border border-border",open:!tW(r==null?void 0:r.advanced)||void 0,children:[n.jsx("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Advanced"}),n.jsxs("div",{className:"grid gap-4 border-t border-border p-3",children:[n.jsxs("div",{className:"grid gap-1",children:[n.jsx(zn,{htmlFor:"policy-ports",className:"text-[11px] text-muted-foreground",children:"Ports"}),n.jsx(Ot,{id:"policy-ports",value:v.ports,onChange:V=>K({ports:V.target.value}),className:"h-8 w-40 font-mono text-[11px]",placeholder:"443, 80"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Requests"}),n.jsx(Su,{label:"Requests",options:$4,value:v.requests,onChange:V=>K({requests:V,allow:V==="custom"&&!v.allow.length?[{method:"GET",path:""}]:v.allow})}),v.requests==="custom"&&n.jsx(Sg,{kind:"allow",items:v.allow,onChange:V=>K({allow:V})}),n.jsx(Sg,{kind:"deny",items:v.deny,onChange:V=>K({deny:V})})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Programs"}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[v.programs.map(V=>n.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[V,n.jsx("button",{type:"button","aria-label":`Remove ${V}`,onClick:()=>K({programs:v.programs.filter(G=>G!==V)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-3"})})]},V)),!v.programs.length&&n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Any program"})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{value:E,onChange:V=>k(V.target.value),onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),q(E))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/git",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>q(E),disabled:!E.trim(),children:"Add"})]}),f.filter(V=>!v.programs.includes(V)).length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),f.filter(V=>!v.programs.includes(V)).slice(0,6).map(V=>n.jsxs("button",{type:"button",onClick:()=>q(V),className:"rounded border border-dashed border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["+ ",V]},V))]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("div",{className:"w-52",children:n.jsx(Su,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:v.enforcement,onChange:V=>K({enforcement:V})})}),v.enforcement==="audit"&&n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[n.jsx(ti,{className:"size-3"}),"Request rules are logged, not enforced"]})]}),n.jsxs("div",{className:"grid gap-1",children:[n.jsx(zn,{htmlFor:"policy-ips",className:"text-[11px] text-muted-foreground",title:"Loopback and cloud metadata stay blocked",children:"Private addresses"}),n.jsx(Ot,{id:"policy-ips",value:v.privateIps,onChange:V=>K({privateIps:V.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.0/24"})]})]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:rW(H,N)}),O&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:O}),n.jsxs(Hr,{className:"sm:justify-between",children:[b?n.jsx("span",{}):B?n.jsxs("span",{className:"grid gap-1.5",children:[v.setup&&n.jsxs("span",{className:"max-w-64 text-[11px] text-muted-foreground",children:["Sandboxes that use “",v.setup.name,"” lose access to these websites. Enabling the setup again asks you to approve them for each sandbox."]}),n.jsx(le,{type:"button",variant:"destructive",disabled:R,onClick:X,children:"Delete rule"})]}):n.jsx(le,{type:"button",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>F(!0),children:"Delete"}),n.jsxs("span",{className:"flex gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:R||!U||!v.name.trim()||!v.destinations.length&&!A.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[R&&n.jsx(Nt,{"aria-hidden":"true"}),b?"Add rule":"Save rule"]})]})]})]})})})}function B4({open:e,onOpenChange:t,org:r,onSaved:a}){const i=Pt(),[c,u]=x.useState(""),[f,h]=x.useState(!1),[m,p]=x.useState(null);x.useEffect(()=>{e&&(u(((r==null?void 0:r.blocked)??[]).join(`
|
|
520
|
+
`)),p(null))},[e,r]);async function g(b){b.preventDefault(),h(!0),p(null);try{a(await i.saveOrg({...r,blocked:JX(c)})),t(!1)}catch(v){p(v.message)}finally{h(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:g,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Blocked everywhere"}),n.jsx(Sn,{className:"text-xs",children:"Blocked in every sandbox, with their subdomains. No rule can open them."})]}),n.jsx(Hu,{rows:6,value:c,onChange:b=>u(b.target.value),className:"font-mono text-[11px]",placeholder:`pastebin.com
|
|
521
|
+
**.ngrok.io`,"aria-label":"Blocked hosts"}),m&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:m}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Nt,{"aria-hidden":"true"}),"Save"]})]})]})})})}function wE({className:e,size:t="default",...r}){return n.jsx("div",{"data-slot":"card","data-size":t,className:Ve("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-lg border border-border bg-card py-(--card-spacing) text-sm text-card-foreground [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg",e),...r})}function V4({borderWidth:e=1,duration:t=14,shineColor:r="#000000",className:a,style:i,...c}){return n.jsx("div",{style:{"--border-width":`${e}px`,"--duration":`${t}s`,backgroundImage:`radial-gradient(transparent,transparent, ${Array.isArray(r)?r.join(","):r},transparent,transparent)`,backgroundSize:"300% 300%",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",padding:"var(--border-width)",...i},className:Ve("motion-safe:animate-shine pointer-events-none absolute inset-0 size-full rounded-[inherit] will-change-[background-position]",a),...c})}const U4=x.createContext(void 0);function ch(e){const t=x.useContext(U4);if(t===void 0&&!e)throw new Error(rn(72));return t}const oW={...ix,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class aW extends _u{constructor(r,a,i){const c=new Qf;super(iW(r,c,a,i),lW(c),oW);ln(this,"setOpen",(r,a)=>{nV(this,r,a,{extraState:{openChangeReason:a.reason}})})}cancelPendingOpen(r){this.state.floatingRootContext.dispatchOpenChange(!1,yt(ma,r))}}function iW(e,t,r,a=!1){return{...ax(t,r,a),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function lW(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const cW=Xf(function(t){const{disabled:r=!1,defaultOpen:a=!1,open:i,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:f,onOpenChange:h,onOpenChangeComplete:m,handle:p,triggerId:g,defaultTriggerId:b=null,children:v}=t,w=M2((F,K)=>new aW({open:a,openProp:i,activeTriggerId:b,triggerIdProp:g},F,K));w.useControlledProp("openProp",i),w.useControlledProp("triggerIdProp",g),w.useContextCallback("onOpenChange",h),w.useContextCallback("onOpenChangeComplete",m);const C=w.useState("open"),S=!r&&C,N=w.useState("activeTriggerId"),E=w.useState("mounted"),k=w.useState("payload");w.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c,disabled:r}),sx(w,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:M}=rx(S,w),R=w.useState("isInstantPhase"),T=w.useState("instantType"),O=w.useState("lastOpenChangeReason"),D=x.useRef(null);We(()=>{C&&r&&w.setOpen(!1,yt(JA))},[C,r,w]),We(()=>{M==="ending"&&O===Ur||M!=="ending"&&R?(T!=="delay"&&(D.current=T),w.set("instantType","delay")):D.current!==null&&(w.set("instantType",D.current),D.current=null)},[M,R,O,T,w]),We(()=>{S&&N==null&&w.set("payload",void 0)},[w,N,S]),x.useImperativeHandle(f,()=>({unmount:A,close:()=>w.setOpen(!1,yt(Ug))}),[A,w]);const B=S||E||!r&&u!=="none";return n.jsxs(U4.Provider,{value:w,children:[p&&n.jsx(tx,{handle:p,store:w}),B&&n.jsx(uW,{store:w,disabled:r,trackCursorAxis:u}),typeof v=="function"?v({payload:k}):v]})});function uW({store:e,disabled:t,trackCursorAxis:r}){const a=e.useState("floatingRootContext"),i=Kf(a,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=eB(a,{enabled:!t&&r!=="none",axis:r==="none"?void 0:r}),u=x.useMemo(()=>Qs(c.reference,i.reference),[c.reference,i.reference]);return ox(e,{activeTriggerProps:u,inactiveTriggerProps:u,popupProps:i.floating??En}),null}const H4=x.createContext(void 0);function dW(){return x.useContext(H4)}const fW=600,F4="data-base-ui-tooltip-trigger";function jE(e){if("composedPath"in e){const r=e.composedPath();for(let a=0;a<r.length;a+=1){const i=r[a];if(Ft(i))return i}}const t=e.target;return Ft(t)?t:null}function hW(e){let t=e;for(;t;){const r=t.closest(`[${F4}]`);if(r)return r;const a=t.getRootNode();t="host"in a&&Ft(a.host)?a.host:null}return null}const mW=R2(function(t,r){const{render:a,className:i,style:c,handle:u,payload:f,disabled:h,delay:m,closeOnClick:p=!0,closeDelay:g,id:b,...v}=t,w=ch(!0),S=I2(u)??w;if(!S)throw new Error(rn(82));const N=ws(b),E=S.useState("isTriggerActive",N),k=S.useState("isOpenedByTrigger",N),A=S.useState("floatingRootContext"),M=x.useRef(null),R=g??0,{registerTrigger:T,isMountedByThisTrigger:O}=D2(N,M,S,{payload:f,closeOnClick:p,closeDelay:R}),D=dW(),{activeIdRef:B,delayRef:F,isInstantPhase:K,hasProvider:$}=k$(A,{open:k}),P=_2(A);S.useSyncedValue("isInstantPhase",K);const U=S.useState("disabled"),H=h??U,W=qn(H),q=S.useState("trackCursorAxis"),Z=S.useState("disableHoverablePopup"),z=x.useRef(!1),L=us(),X=x.useRef(void 0);function ee(){return $&&B.current!=null?0:m??D??fW}function _(se){const Q=M.current;if(!Q||!se)return!1;const ie=hW(se);return ie!==null&&ie!==Q&>(Q,ie)}function V(se){const Q=_(se);return z.current=Q,Q&&(P.openChangeTimeout.clear(),P.restTimeout.clear(),P.restTimeoutPending=!1,L.clear()),Q}const G=$2(A,{enabled:!H,mouseOnly:!0,move:!1,handleClose:!Z&&q!=="both"?B2():null,restMs:ee,delay(){return g==null&&$?{close:rc(F.current,"close")}:{close:R}},triggerElementRef:M,isActiveTrigger:E,isClosing:()=>S.select("transitionStatus")==="ending",shouldOpen(){return!z.current}}),Y=FM(A,{enabled:!H}).reference,ne=se=>{const Q=z.current,ie=jE(se),oe=V(ie),pe=M.current,xe=pe&&ie&>(pe,ie);if(oe&&S.select("open")&&S.select("lastOpenChangeReason")===Qn){S.setOpen(!1,yt(Qn,se));return}if(Q&&!oe&&xe&&!W.current&&!S.select("open")&&pe&&Hi(X.current)){const je=()=>{!z.current&&!W.current&&!S.select("open")&&S.setOpen(!0,yt(Qn,se,pe))},Ie=ee();Ie===0?(L.clear(),je()):L.start(Ie,je)}},te=S.useState("triggerProps",O);return Ct("button",t,{state:{open:k},ref:[r,T,M],props:[G,Y,O||q!=="none"?te:void 0,{onMouseOver(se){ne(se.nativeEvent)},onFocus(se){_(jE(se.nativeEvent))&&se.preventBaseUIHandler()},onMouseLeave(){z.current=!1,L.clear(),X.current=void 0},onPointerEnter(se){X.current=se.pointerType},onPointerDown(se){X.current=se.pointerType,S.set("closeOnClick",p),p&&!S.select("open")&&S.cancelPendingOpen(se.nativeEvent)},onClick(se){p&&!S.select("open")&&S.cancelPendingOpen(se.nativeEvent)},id:N,[Oy]:H?"":void 0,[F4]:H?void 0:""},v],stateAttributesMapping:u2})}),G4=x.createContext(void 0);function pW(){const e=x.useContext(G4);if(e===void 0)throw new Error(rn(70));return e}const gW=x.forwardRef(function(t,r){const{children:a,container:i,className:c,render:u,style:f,...h}=t,{node:m,subtree:p}=NM({container:i,ref:r,componentProps:t,elementProps:h});return!p&&!m?null:n.jsxs(x.Fragment,{children:[p,m&&go.createPortal(a,m)]})}),xW=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return ch().useState("mounted")||a?n.jsx(G4.Provider,{value:a,children:n.jsx(gW,{ref:r,...i})}):null}),q4=x.createContext(void 0);function Y4(){const e=x.useContext(q4);if(e===void 0)throw new Error(rn(71));return e}const bW=x.forwardRef(function(t,r){const{render:a,className:i,anchor:c,positionMethod:u="absolute",side:f="top",align:h="center",sideOffset:m=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:w=!1,disableAnchorTracking:C=!1,collisionAvoidance:S=j2,style:N,...E}=t,k=ch(),A=pW(),M=k.useState("open"),R=k.useState("mounted"),T=k.useState("trackCursorAxis"),O=k.useState("disableHoverablePopup"),D=k.useState("floatingRootContext"),B=k.useState("instantType"),F=k.useState("transitionStatus"),K=k.useState("adaptiveOrigin"),$=xx({anchor:c,positionMethod:u,floatingRootContext:D,mounted:R,side:f,sideOffset:m,align:h,alignOffset:p,collisionBoundary:g,collisionPadding:b,sticky:w,arrowPadding:v,disableAnchorTracking:C,keepMounted:A,collisionAvoidance:S,adaptiveOrigin:K}),P=x.useMemo(()=>({open:M,side:$.side,align:$.align,anchorHidden:$.anchorHidden,instant:T!=="none"?"tracking-cursor":B}),[M,$.side,$.align,$.anchorHidden,T,B]),U=bx(t,P,{styles:$.positionerStyles,transitionStatus:F,props:E,refs:[r,k.useStateSetter("positionerElement")],hidden:!R,inert:!M||T==="both"||O});return n.jsx(q4.Provider,{value:$,children:U})}),vW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=ch(),{side:h,align:m}=Y4(),p=f.useState("open"),g=f.useState("instantType"),b=f.useState("transitionStatus"),v=f.useState("popupProps"),w=f.useState("floatingRootContext"),C=f.useState("disabled"),S=f.useState("closeDelay");Sr({open:p,ref:f.context.popupRef,onComplete(){var A,M;p&&((M=(A=f.context).onOpenChangeComplete)==null||M.call(A,!0))}}),L2(w,{enabled:!C,closeDelay:S});const N=f.useStateSetter("popupElement");return Ct("div",t,{state:{open:p,side:h,align:m,instant:g,transitionStatus:b},ref:[r,f.context.popupRef,N],props:[Wf,v,th(b),u],stateAttributesMapping:Hg})}),yW=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=ch(),{arrowRef:h,side:m,align:p,arrowUncentered:g,arrowStyles:b}=Y4(),v=f.useState("open"),w=f.useState("instantType");return Ct("div",t,{state:{open:v,side:m,align:p,uncentered:g,instant:w},ref:[r,h],props:[{style:b,"aria-hidden":!0},u],stateAttributesMapping:qf})}),wW=function(t){const{delay:r,closeDelay:a,timeout:i=400}=t,c=x.useMemo(()=>({open:r,close:a}),[r,a]);return n.jsx(H4.Provider,{value:r,children:n.jsx(C$,{delay:c,timeoutMs:i,children:t.children})})};function Fu({delay:e=0,...t}){return n.jsx(wW,{"data-slot":"tooltip-provider",delay:e,...t})}function ba({...e}){return n.jsx(cW,{"data-slot":"tooltip",...e})}function va({...e}){return n.jsx(mW,{"data-slot":"tooltip-trigger",...e})}function ya({className:e,side:t="top",sideOffset:r=4,align:a="center",alignOffset:i=0,children:c,...u}){return n.jsx(xW,{children:n.jsx(bW,{align:a,alignOffset:i,side:t,sideOffset:r,className:"isolate z-50",children:n.jsxs(vW,{"data-slot":"tooltip-content",className:Ve("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[c,n.jsx(yW,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function qw({host:e,tone:t="default",className:r}){return n.jsx("span",{"aria-hidden":"true",className:Ve("flex size-6 shrink-0 items-center justify-center rounded-md border font-sans text-xs font-medium",t==="denied"?"border-red-200/60 bg-red-50 text-red-700":"border-border bg-muted/50 text-muted-foreground",r),children:qK(e).charAt(0).toUpperCase()})}const SE=x.forwardRef(function({item:t,denied:r,active:a,onFocus:i,onBlur:c,onAllow:u},f){const h=ia[t.source]??ia.own;return n.jsxs("div",{ref:f,className:Ve("relative z-10 flex h-[23px] w-full min-w-0 items-center rounded-md border bg-card transition-colors",a?"border-stone-400":"border-border/80"),children:[n.jsxs(ba,{children:[n.jsxs(va,{render:n.jsx("button",{type:"button"}),onMouseEnter:i,onMouseLeave:c,onFocus:i,onBlur:c,"aria-label":`${t.host}, ${r?`${t.count} blocked attempts`:`allowed · ${h.label}`}`,className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-foreground",children:t.host}),r?n.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-muted-foreground",children:[t.count,"×"]}):n.jsx("span",{className:Ve("size-1 shrink-0 rounded-full",h.swatch)})]}),n.jsxs(ya,{className:"max-w-sm break-all font-sans",children:[t.host," · ",r?"Blocked in recent activity":`Allowed · ${h.label}`]})]}),r&&u&&n.jsx(le,{size:"sm",variant:"ghost",className:"mr-1 px-2 text-[11px]",onClick:u,children:"Review"})]})}),sp=x.forwardRef(function({title:t,count:r,icon:a,summary:i,open:c,onToggle:u,tone:f="neutral",children:h,className:m,...p},g){const b=x.useId();return n.jsxs("section",{ref:g,...p,className:Ve("relative z-10 min-w-0 overflow-hidden rounded-none border shadow-[0_2px_6px_#1c191703]",f==="blocked"?"border-red-200/60 bg-[var(--graph-blocked)]":f==="allowed"?"border-emerald-200/60 bg-[var(--graph-allowed)]":"border-stone-200 bg-[var(--graph-neutral)]",m),children:[n.jsxs("button",{type:"button","aria-expanded":c,"aria-controls":b,"aria-label":`${c?"Collapse":"Expand"} ${t}`,onClick:u,className:"group flex w-full items-center gap-2.5 rounded-none px-4 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[n.jsx("span",{className:Ve("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",f==="blocked"?"border-red-200/60 text-red-500":f==="allowed"?"border-emerald-200/60 text-emerald-600":"border-border text-stone-500"),children:n.jsx(a,{className:"size-3.5",strokeWidth:1.5})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2 text-[11px] font-medium",children:[t,n.jsx("span",{className:"text-[10px] font-normal tabular-nums text-muted-foreground",children:r})]}),n.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",title:i,children:i})]}),n.jsx(ha,{className:Ve("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",c&&"rotate-180")})]}),n.jsx(In.div,{id:b,initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:Zs()?0:.22,ease:[.22,1,.36,1]},inert:!c,"aria-hidden":!c,className:"overflow-hidden",children:n.jsx("div",{className:"space-y-0.5 border-t border-black/5 p-2",children:h})})]})});function au({children:e,canvas:t,label:r}){var h;const[a,i]=x.useState({x:0,y:0}),c=x.useRef(null),u=x.useRef(!1),f=(m,p,g)=>{const b=t.current.getBoundingClientRect(),v=m.getBoundingClientRect(),w=b.width/t.current.offsetWidth||1,C=(v.left-b.left)/w-a.x,S=(v.top-b.top)/w-a.y;return{x:Math.max(-C,Math.min(p,b.width/w-C-v.width/w)),y:Math.max(-S,Math.min(g,b.height/w-S-v.height/w))}};return x.useLayoutEffect(()=>{var m;(m=t.current)==null||m.dispatchEvent(new Event("graph-move"))},[a,t]),x.cloneElement(e,{tabIndex:0,"aria-label":`${r}. Drag to move or use arrow keys`,className:Ve(e.props.className,"cursor-grab touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"),style:{...e.props.style,transform:`translate(${a.x}px, ${a.y}px)`,zIndex:(h=c.current)!=null&&h.moved?30:10},onDragStart:m=>m.preventDefault(),onPointerDown:m=>{m.button!==0||!m.isPrimary||m.target.closest("[data-resource-list]")||m.target.closest("button")&&!m.target.closest("button[aria-expanded], [data-graph-drag-handle]")||(u.current=!1,c.current={id:m.pointerId,x:m.clientX,y:m.clientY,offset:a,moved:!1})},onPointerLeave:()=>{var m;(m=c.current)!=null&&m.moved||(c.current=null)},onPointerMove:m=>{const p=c.current;if(!p||p.id!==m.pointerId)return;const g=m.clientX-p.x,b=m.clientY-p.y;if(!p.moved&&Math.hypot(g,b)<5)return;p.moved=!0,u.current=!0,m.currentTarget.setPointerCapture(m.pointerId);const v=t.current.getBoundingClientRect().width/t.current.offsetWidth||1;i(f(m.currentTarget,p.offset.x+g/v,p.offset.y+b/v))},onPointerUp:m=>{m.currentTarget.hasPointerCapture(m.pointerId)&&m.currentTarget.releasePointerCapture(m.pointerId),c.current=null,i(p=>({...p}))},onPointerCancel:()=>{c.current=null,u.current=!1},onLostPointerCapture:()=>{c.current=null},onClickCapture:m=>{u.current&&(m.preventDefault(),m.stopPropagation(),u.current=!1)},onKeyDown:m=>{if(m.target!==m.currentTarget)return;const p={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[m.key];if(!p)return;m.preventDefault();const g=m.shiftKey?20:5;i(f(m.currentTarget,a.x+p[0]*g,a.y+p[1]*g))}})}function jW({name:e,phase:t,agents:r=[],agentStatus:a="Agent inventory not checked",allowed:i,denied:c,onAllow:u,compact:f=!1,fill:h=!1,owner:m="Not reported",secrets:p=[],gateway:g}){const b=x.useRef(null),v=x.useRef(null),w=x.useRef(null),C=x.useMemo(()=>({agents:x.createRef(),owner:x.createRef(),secrets:x.createRef(),blocked:x.createRef(),allowed:x.createRef()}),[]),[S,N]=x.useReducer(D=>D+1,0);x.useEffect(()=>{var F;let D=(F=b.current)==null?void 0:F.clientWidth;const B=new ResizeObserver(()=>{var $;const K=($=b.current)==null?void 0:$.clientWidth;K!==D&&(D=K,N())});return B.observe(b.current),()=>B.disconnect()},[]);const[E,k]=x.useState({}),[A,M]=x.useState(null),R=D=>k(B=>({...B,[D]:!B[D]})),T=["secrets","blocked","allowed",...r.flatMap(D=>[`${D.name}:mcps`,`${D.name}:skills`])],O=T.every(D=>E[D]);return n.jsx(Fu,{delay:150,children:n.jsxs("div",{className:Ve("@container flex flex-col overflow-hidden rounded-xl border border-border/70 bg-card font-sans",h&&"flex-1"),"aria-label":`Access graph for ${e}`,children:[n.jsx("div",{className:"flex items-center justify-end gap-3 border-b border-border/50 px-4 py-1.5",children:n.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[n.jsx("button",{type:"button",onClick:N,className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Reset layout"}),n.jsx("button",{type:"button",onClick:()=>k(Object.fromEntries(T.map(D=>[D,!O]))),className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:O?"Collapse all":"Expand all"})]})}),n.jsxs("div",{ref:b,className:Ve("relative mx-auto grid w-full flex-1 max-w-[1020px] grid-cols-1 items-center gap-5 px-4 @2xl:grid-cols-[minmax(0,1fr)_160px_minmax(0,1.3fr)] @2xl:gap-x-8 @2xl:gap-y-7 @2xl:px-6",f?"py-3":"py-7"),children:[n.jsx("div",{ref:C.agents,"aria-label":"Agent types",className:"relative z-10 order-3 flex flex-col items-center gap-7 @2xl:order-none @2xl:col-start-1 @2xl:row-start-1 @2xl:row-span-4",children:(r.length?r:[{name:a,logo:null}]).map(D=>n.jsx(au,{canvas:b,label:D.name,children:n.jsxs("div",{className:"flex w-full max-w-[280px] flex-col items-center gap-2",children:[n.jsxs(wE,{"data-agent-node":!0,className:"relative isolate size-[52px] shrink-0 items-center justify-center gap-0 overflow-visible rounded-[14px] border-stone-300/80 bg-gradient-to-b from-stone-50 to-stone-100 p-1.5 shadow-[0_3px_0_-1px_var(--color-stone-200),0_3px_0_0_var(--edge-neutral),0_6px_10px_-5px_#1c191725,inset_0_1px_0_var(--frame-highlight)]",children:[n.jsx(V4,{shineColor:["var(--edge-neutral)","var(--frame-highlight)","var(--ink-faint)"],duration:18,"aria-hidden":"true"}),n.jsx("div",{className:"flex size-full items-center justify-center rounded-[9px] border border-stone-200/80 bg-card shadow-[inset_0_2px_4px_#1c191708,0_1px_0_var(--frame-highlight)]",children:D.logo?n.jsx("img",{src:D.logo,alt:"",className:"size-6 object-contain"}):n.jsx(MA,{className:"size-5 text-muted-foreground",strokeWidth:1.3,"aria-hidden":"true"})})]}),n.jsx("span",{className:"max-w-full break-words bg-card px-2 text-center text-xs font-medium",children:D.name}),r.length>0&&n.jsx("div",{className:"relative w-full pt-4 before:absolute before:left-1/2 before:top-0 before:h-4 before:border-l before:border-[var(--edge-neutral)]",children:n.jsx("div",{role:"group","aria-label":`${D.name} resources`,className:"overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705]",children:[{kind:"mcps",title:"MCPs",icon:n2},{kind:"skills",title:"Skills",icon:bL}].map(({kind:B,title:F,icon:K})=>{var q;const $=(q=D.resources)==null?void 0:q[B],P=($==null?void 0:$.status)==="checked",U=($==null?void 0:$.status)==="unsupported",H=P?$.items:[],W=`${D.name}:${B}`;return n.jsx(sp,{title:F,"aria-label":`${D.name} ${F}`,count:P?H.length:"-",icon:K,summary:U?"Setup integration unavailable":P?"In agent user configuration":"Inventory unavailable",open:!!E[W],onToggle:()=>R(W),className:Ve("border-0 shadow-none",B==="skills"&&"border-t border-border/60"),children:n.jsxs("div",{"data-resource-list":!0,className:"max-h-48 touch-pan-y select-text space-y-0.5 overflow-y-auto overscroll-contain",children:[H.map(Z=>n.jsxs("div",{className:"flex min-h-[23px] items-center gap-2 rounded-md border border-border/80 bg-card px-2.5 py-1 text-[11px]",children:[n.jsx("span",{className:"min-w-0 flex-1 break-words",children:B==="skills"?Z.name.replace(/^os-[a-f0-9]{8}-(?=.)/i,""):Z.name}),Z.disabled&&n.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"Disabled"})]},Z.name)),!H.length&&n.jsx("p",{className:"px-2 py-2 text-center text-[11px] text-muted-foreground",children:U?`${F} integration unavailable`:P?`No ${F} found in user configuration`:`${F} inventory unavailable`})]})},B)})})})]})},`${e}-${S}-${D.name}`))}),n.jsx(au,{canvas:b,label:"Owner",children:n.jsxs(wE,{ref:C.owner,role:"group","aria-label":"Owner",className:"relative z-10 w-max min-w-0 max-w-full justify-self-center gap-1.5 border-stone-200 bg-[var(--graph-neutral)] px-3 py-2.5 shadow-[0_2px_6px_#1c191703] @2xl:col-start-2 @2xl:row-start-1",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[n.jsx(n7,{className:"size-3 shrink-0",strokeWidth:1.5,"aria-hidden":"true"}),n.jsx("span",{children:"Owner"})]}),n.jsx("p",{className:"min-w-0 whitespace-normal text-[11px] font-medium leading-relaxed [overflow-wrap:anywhere]",children:m})]})},`${e}-${S}-owner`),n.jsx(au,{canvas:b,label:e,children:n.jsxs("div",{ref:w,className:"relative z-10 flex min-w-0 flex-col items-center justify-self-center rounded-xl px-3 @2xl:col-start-2 @2xl:row-start-2",children:[n.jsx("div",{ref:v,className:"flex size-14 items-center justify-center rounded-2xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:n.jsx(hc,{className:"size-6 text-stone-600",strokeWidth:1.3})}),n.jsx("p",{className:"mt-2 max-w-[156px] truncate text-xs font-medium",title:e,children:e})]})},`${e}-${S}-sandbox`),n.jsx(au,{canvas:b,label:"Gateway",children:n.jsx("div",{className:"relative z-10 flex justify-center @2xl:col-start-2 @2xl:row-start-3",children:n.jsxs(ba,{children:[n.jsxs(va,{"data-graph-drag-handle":!0,render:n.jsx("button",{type:"button"}),className:"relative z-10 flex min-h-10 max-w-full items-center gap-1.5 bg-card px-2 text-[10px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx($f,{className:"size-3 shrink-0",strokeWidth:1.5}),n.jsx("span",{children:g?g.remote?"Remote endpoint":"Local/tunnel endpoint":"Gateway not reported"})]}),n.jsxs(ya,{className:"max-w-64 font-sans",children:[g?`Connected through ${g.name}. `:"","The sandbox’s host machine is not reported."]})]})})},`${e}-${S}-gateway`),n.jsx(au,{canvas:b,label:"Network access",children:n.jsxs("section",{"aria-label":"Network access",className:"relative z-10 order-4 overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705] @2xl:order-none @2xl:col-start-3 @2xl:row-start-1 @2xl:row-span-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-4 py-3",children:[n.jsx(Ig,{className:"size-3.5 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),n.jsx("h4",{className:"text-[11px] font-medium",children:"Network"}),n.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Outbound access"})]}),n.jsxs(sp,{ref:C.allowed,title:"Approved network",count:i.length,icon:Yn,summary:"Destinations in policy",tone:"allowed",open:!!E.allowed,onToggle:()=>R("allowed"),className:"border-0 shadow-none",children:[i.map(D=>n.jsx(SE,{item:D,active:A===D.host,onFocus:()=>M(D.host),onBlur:()=>M(null)},D.host)),!i.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No approved destinations"})]}),n.jsxs(sp,{ref:C.blocked,title:"Blocked network",count:c.length,icon:gL,summary:"Recent connection attempts",tone:"blocked",open:!!E.blocked,onToggle:()=>R("blocked"),className:"border-0 border-t border-border/60 shadow-none",children:[c.map(D=>n.jsx(SE,{item:D,denied:!0,active:A===D.host,onFocus:()=>M(D.host),onBlur:()=>M(null),onAllow:u?()=>u(D):void 0},D.host)),!c.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No blocked attempts"})]})]})},`${e}-${S}-network`),n.jsx(au,{canvas:b,label:"Secrets",children:n.jsxs(sp,{ref:C.secrets,title:"Secrets",count:p.length,icon:zu,summary:p.length?p.map(D=>D.name).join(", "):"None attached",open:!!E.secrets,onToggle:()=>R("secrets"),className:"@2xl:col-start-2 @2xl:row-start-4",children:[p.map(D=>{var B;return n.jsxs(ba,{children:[n.jsx(va,{render:n.jsx("button",{type:"button"}),className:"block w-full truncate rounded-lg border border-border/70 bg-card px-2.5 py-1.5 text-left text-[11px] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:D.name}),n.jsxs(ya,{className:"max-w-72 break-words font-sans",children:[D.name,D.type?` · ${D.type}`:"",(B=D.credentialKeys)!=null&&B.length?` · ${D.credentialKeys.join(", ")}`:""]})]},D.name)}),!p.length&&n.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No secrets attached"})]})},`${e}-${S}-secrets`),n.jsx(SW,{container:b,core:v,hub:w,groups:C},`${e}-${S}-${r.map(D=>D.name).join(",")}`)]})]})})}function SW({container:e,core:t,hub:r,groups:a}){const i=x.useRef(null),[c,u]=x.useState([]);return x.useEffect(()=>{function f(){var N;if(!e.current||!t.current||!r.current)return;const p=(N=i.current)==null?void 0:N.getScreenCTM();if(!p)return;const g=p.inverse(),b=E=>{const k=E.getBoundingClientRect(),A=new DOMPoint(k.left,k.top).matrixTransform(g),M=new DOMPoint(k.right,k.bottom).matrixTransform(g);return{left:A.x,top:A.y,right:M.x,bottom:M.y,width:M.x-A.x,height:M.y-A.y}},v=b(t.current),w=b(r.current),C=v.left+v.width/2,S=v.top+v.height/2;u(Object.entries(a).flatMap(([E,k])=>{const A=k.current?b(k.current):null;if(!A)return[];if(E==="owner"||E==="secrets"){const F=E==="owner"?v.top:w.bottom,K=E==="owner"?A.bottom:A.top,$=A.left+A.width/2,P=(F+K)/2;return[{key:E,d:`M ${C} ${F} C ${C} ${P}, ${$} ${P}, ${$} ${K}`,x:$,y:K}]}if(E==="agents")return[...k.current.querySelectorAll("[data-agent-node]")].map((F,K)=>{const $=b(F),P=v.left,U=$.right,H=$.top+$.height/2,W=(P+U)/2;return{key:`agent-${K}`,d:`M ${P} ${S} C ${W} ${S}, ${W} ${H}, ${U} ${H}`,x:U,y:H}});const M=v.right,R=A.left,T=b(k.current.querySelector("button")),O=T.top+T.height/2,D=M+(R-M)*.4,B=D+(R-D)*.5;return[{key:E,d:`M ${M} ${S} H ${D} C ${B} ${S}, ${B} ${O}, ${R} ${O}`,x:R,y:O}]}))}f();const h=new ResizeObserver(f);[e.current,t.current,r.current,...Object.values(a).map(p=>p.current)].filter(Boolean).forEach(p=>h.observe(p));const m=e.current;return m.addEventListener("graph-move",f),()=>{h.disconnect(),m.removeEventListener("graph-move",f)}},[e,t,r,a]),n.jsx("svg",{ref:i,className:"pointer-events-none absolute inset-0 hidden size-full overflow-visible @2xl:block","aria-hidden":"true",fill:"none",children:c.map(f=>n.jsxs("g",{children:[n.jsx("path",{d:f.d,stroke:f.key==="blocked"?"var(--edge-blocked)":f.key==="allowed"?"var(--edge-allowed)":"var(--edge-neutral)",strokeWidth:"1.5",strokeLinecap:"round"}),n.jsx("circle",{cx:f.x,cy:f.y,r:"2.5",fill:"var(--card)",stroke:"var(--edge-neutral)"})]},f.key))})}async function NW(e,t){const r=[],a=[],i=[];for(const c of e)try{const u=await t(c.id);r.push(c.id);for(const f of u.failed??[])i.push({...f,rule:c.name})}catch(u){a.push({id:c.id,name:c.name,message:u.message})}return{deleted:r,failed:a,syncFailures:i}}const Gl={running:{label:"Ready",bar:"bg-emerald-500",strip:"bg-emerald-500",cell:"bg-emerald-500/85",ring:"ring-emerald-600/30"},sleeping:{label:"Stopped",bar:"bg-stone-300",strip:"bg-stone-400",cell:"bg-stone-300",ring:"ring-stone-400/40"},provisioning:{label:"Preparing",bar:"bg-amber-400",strip:"bg-amber-400",cell:"bg-amber-400",ring:"ring-amber-600/30"},error:{label:"Needs attention",bar:"bg-red-500",strip:"bg-red-500",cell:"bg-red-500",ring:"ring-red-600/40"},unknown:{label:"Unverified",bar:"bg-stone-200",strip:"bg-stone-300",cell:"bg-stone-200",ring:"ring-stone-400/30"}},E1=["running","sleeping","provisioning","error","unknown"],CW={ready:"running",provisioning:"provisioning",starting:"provisioning",stopping:"provisioning",stopped:"sleeping",completed:"sleeping",error:"error",deleting:"unknown",unknown:"unknown",unspecified:"unknown"},Cg={ready:"Ready",provisioning:"Provisioning",starting:"Starting",stopping:"Stopping",stopped:"Stopped",completed:"Completed",error:"Error",deleting:"Deleting",unknown:"Unknown",unspecified:"Unknown"},Px=e=>CW[e]??"unknown",Za=e=>Gl[Px(e)],kW=e=>["ready","provisioning","starting"].includes(e),TW=e=>e==="stopped",EW=e=>e!=null&&e.length?e.join(" "):"Scratch shell",_p=(e,t)=>t||(/^sha256:[a-f0-9]{64}$/i.test(e??"")?"Unknown template":e)||"Gateway default";function RW(e){const t=Object.fromEntries(E1.map(r=>[r,0]));for(const r of e)t[Px(r.phase)]+=1;return{total:e.length,status:t}}function df(e,t){var a,i;const r=e.owner||((a=e.labels)==null?void 0:a["openshell.console/owner"])||((i=e.labels)==null?void 0:i.owner);return r&&r===(t==null?void 0:t.uid)&&t.email||r||"Not reported"}function K4(e,t=Date.now()){const r=Date.parse(e);if(!Number.isFinite(r))return"Not reported";const a=Math.max(0,Math.floor((t-r)/6e4));return a<1?"<1m":a<60?`${a}m`:a<1440?`${Math.floor(a/60)}h ${a%60}m`:`${Math.floor(a/1440)}d ${Math.floor(a%1440/60)}h`}function AW(e,t=Date.now()){return["stopped","completed"].includes(e.phase)?"Not running":e.phase==="ready"?K4(e.startedAt,t):"-"}const fa={loaded:{label:"Enforced",dot:"bg-emerald-500",cls:"bg-emerald-50 text-emerald-800 border-emerald-600/20"},pending:{label:"Loading",dot:"bg-amber-400",cls:"bg-amber-50 text-amber-800 border-amber-500/30"},failed:{label:"Failed",dot:"bg-red-500",cls:"bg-red-50 text-red-700 border-red-200"},superseded:{label:"Superseded",dot:"bg-stone-300",cls:"bg-muted text-muted-foreground border-border"},unspecified:{label:"Unknown",dot:"bg-stone-200",cls:"bg-muted text-muted-foreground border-border"}},Yw={"read-only":"Read only","read-write":"Read & write",full:"Any request",custom:"Specific requests",connect:"Connection",none:"No access",blocked:"Blocked"},MW=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],OW={own:zA,agent:hc,org:jL,group:Xa,policy:Iu,secret:zu},Po=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,X4=e=>e.replace(/^\*\*?\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,56);function Gd({children:e,tone:t="",title:r}){return n.jsx("span",{title:r,className:Ve("rounded-md border px-1.5 py-px font-mono text-[10.5px]",t||"border-border text-muted-foreground"),children:e})}function W4({source:e}){return n.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 text-[11.5px] text-foreground/80",children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",ia[e].swatch),"aria-hidden":"true"}),ia[e].label]})}function Nu({className:e,children:t}){return n.jsx("div",{className:Ve("rounded-lg border border-border bg-card",e),children:t})}function DW({options:e,value:t,onChange:r,label:a}){return n.jsx("div",{role:"tablist","aria-label":a,className:"flex items-center gap-0.5 rounded-lg bg-muted p-0.5",children:e.map(i=>n.jsxs("button",{role:"tab","aria-selected":t===i.id,onClick:()=>r(i.id),className:Ve("rounded-md px-2.5 py-1 text-[12px] outline-none transition-all focus-visible:ring-2 focus-visible:ring-ring",t===i.id?"bg-card text-foreground shadow-[0_1px_2px_#0000001a]":"text-muted-foreground hover:text-foreground"),children:[i.label,i.count!=null&&n.jsx("span",{className:"ml-1 text-faint tabular-nums",children:i.count})]},i.id))})}function Q4({n:e,total:t}){return n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"h-1 w-14 overflow-hidden rounded-full bg-muted",children:n.jsx("span",{className:"block h-full rounded-full bg-stone-700",style:{width:`${t?e/t*100:0}%`}})}),n.jsxs("span",{className:"text-[12px] tabular-nums",children:[n.jsx("span",{className:"text-foreground",children:e}),n.jsxs("span",{className:"text-faint",children:["/",t]})]})]})}const Z4="grid-cols-[minmax(0,2fr)_minmax(0,1fr)_8rem_7rem_5rem_1rem]",J4="grid-cols-[minmax(0,1.6fr)_7.5rem_5rem_minmax(0,1fr)_13.5rem]",NE="grid-cols-[minmax(0,1.2fr)_minmax(0,1.3fr)_8rem_5rem_1rem]",zW="grid-cols-[1rem_minmax(0,1.1fr)_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]",eD="grid-cols-[minmax(0,2fr)_5.5rem_minmax(0,1fr)_8rem_7rem_5rem_1rem]",tD="grid-cols-[minmax(0,1.6fr)_5.5rem_7.5rem_5rem_minmax(0,1fr)_13.5rem]",CE="grid-cols-[minmax(0,1.2fr)_5.5rem_minmax(0,1.3fr)_8rem_5rem_1rem]",IW="grid-cols-[1rem_minmax(0,1.1fr)_5.5rem_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]";function PW({d:e,total:t,onOpen:r}){const[a,i]=x.useState(!1),c=Zs(),u=x.useId(),f=yg.filter(m=>e.sources.has(m)),h=[...e.grants].sort((m,p)=>m.sandbox.localeCompare(p.sandbox)||m.key.localeCompare(p.key));return n.jsxs("li",{children:[n.jsxs("button",{onClick:()=>i(!a),"aria-expanded":a,"aria-controls":u,className:Ve("grid min-h-10 w-full items-center gap-4 px-6 py-2 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:bg-muted/60",a&&"bg-muted/60",e.location?eD:Z4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(qw,{host:e.host,className:"size-6 text-[13px]"}),n.jsx("span",{className:"min-w-0",children:n.jsxs("span",{className:"block truncate font-mono text-[11px]",title:e.host,children:[e.host,n.jsx("span",{className:"ml-2 text-faint",children:[...e.ports].map(m=>`:${m}`).join(" ")})]})})]}),e.location&&n.jsx(Hs,{location:e.location}),n.jsx("span",{className:"flex flex-wrap gap-1",children:f.map(m=>n.jsx(W4,{source:m},m))}),n.jsx("span",{className:"text-[12px] text-muted-foreground",children:e.access.size===1?Yw[[...e.access][0]]??[...e.access][0]:"Mixed"}),n.jsx("span",{className:"block",children:n.jsx(Q4,{n:e.sandboxes.size,total:t})}),n.jsx("span",{className:"text-right text-[12px] tabular-nums text-muted-foreground",children:e.hits?e.hits.toLocaleString():"-"}),n.jsx(Lr,{className:Ve("size-3.5 text-faint transition-transform",a&&"rotate-90"),"aria-hidden":"true"})]}),n.jsx(lc,{initial:!1,children:a&&n.jsx(In.div,{id:u,role:"region","aria-label":`Access to ${e.host}`,initial:c?!1:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:c?0:.18,ease:[.2,0,0,1]},className:"overflow-hidden bg-muted/30",children:n.jsxs(In.div,{initial:c?!1:{opacity:0,y:-3},animate:{opacity:1,y:0},transition:{duration:c?0:.2},className:"px-6 pt-3 pb-4 pl-[3.75rem]",children:[n.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[n.jsx("h3",{className:"text-xs font-medium",children:"Sandbox access"}),n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[Po(e.sandboxes.size,"sandbox","sandboxes")," · ",Po(h.length,"rule assignment")]})]}),n.jsx("div",{className:"overflow-hidden rounded-md border border-border bg-card",children:n.jsxs("table",{className:"w-full table-fixed text-left text-xs","aria-label":`Sandbox access to ${e.host}`,children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-[35%]"}),n.jsx("col",{className:"w-[35%]"}),n.jsx("col",{className:"w-[15%]"}),n.jsx("col",{className:"w-[15%]"})]}),n.jsx("thead",{className:"border-b border-border bg-muted/40 text-[11px] text-muted-foreground",children:n.jsxs("tr",{children:[["Sandbox","Rule","Source"].map(m=>n.jsx("th",{scope:"col",className:"h-8 px-3 font-medium",children:m},m)),n.jsx("th",{scope:"col",className:"px-3",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx("tbody",{className:"divide-y divide-border/60",children:h.map(m=>{const p=ia[Ya(m.key)];return n.jsxs("tr",{className:"transition-colors hover:bg-muted/30 focus-within:bg-muted/30",children:[n.jsx("td",{className:"h-10 px-3",children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate font-medium",title:m.sandbox,children:m.sandbox})]})}),n.jsx("td",{className:"px-3",children:n.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:cf(m.key),children:cf(m.key)})}),n.jsx("td",{className:"px-3 text-muted-foreground",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{"aria-hidden":"true",className:Ve("size-1.5 shrink-0 rounded-full",p.swatch)}),p.label]})}),n.jsx("td",{className:"px-2 text-right",children:n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-muted-foreground","aria-label":`View ${m.sandbox} policy for ${cf(m.key)}`,onClick:()=>r(m.sandbox),children:["View rules",n.jsx(Zi,{className:"size-3"})]})})]},`${m.sandbox}:${m.key}`)})})]})})]})})})]})}function _W({b:e,onDecide:t}){var r,a;return n.jsxs("li",{className:Ve("grid items-center gap-4 px-6 py-2",e.location?tD:J4),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[n.jsx(qw,{host:e.host,tone:"denied",className:"size-6 text-[13px]"}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate font-mono text-xs",children:e.host}),n.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[":",e.port,e.lastAt?` · ${Lu(e.lastAt)}`:""]})]})]}),e.location&&n.jsx(Hs,{location:e.location}),n.jsx("span",{className:"text-[12px] tabular-nums",children:Po(e.sandboxes.size,"sandbox","sandboxes")}),n.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[e.attempts,"×"]}),n.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:[...e.programs].map(wg).join(", ")||"-"}),n.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[n.jsxs(Fi,{children:[n.jsxs(Gi,{disabled:((r=e.location)==null?void 0:r.connected)===!1,className:"inline-flex h-7 items-center gap-1 rounded-md bg-[var(--action)] px-2.5 text-[12px] font-medium text-[var(--action-foreground)] outline-none transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:["Allow",n.jsx(ha,{className:"size-3 opacity-70"})]}),n.jsx(qi,{align:"end",className:"w-60",children:n.jsxs(Ip,{children:[n.jsxs(T1,{children:["Allow ",e.host]}),n.jsxs(Rs,{onClick:()=>t("allow-org",e),children:[n.jsx(Xa,{}),"Choose groups",n.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"new rule"})]}),e.sandboxes.size===1&&n.jsxs(Rs,{onClick:()=>t("allow-one",e),children:[n.jsx(Xa,{}),"Groups of ",[...e.sandboxes][0]]})]})})]}),n.jsx(le,{disabled:((a=e.location)==null?void 0:a.connected)===!1,variant:"ghost",size:"sm",className:"h-7 rounded-lg px-2.5 text-[12px] text-muted-foreground hover:text-red-700",onClick:()=>t("block-org",e),title:"Add to the shared blocked hosts",children:"Block everywhere"})]})]})}function R1({title:e,count:t,actions:r,children:a}){return n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("h3",{className:"text-[16px] font-semibold tracking-[-0.01em]",children:e}),t!=null&&n.jsx("span",{className:"rounded-full bg-muted px-2 py-px text-[12px] tabular-nums text-muted-foreground",children:t}),r&&n.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:r})]}),a]})}function Lp({className:e,children:t}){return n.jsx("div",{className:Ve("sticky top-0 z-10 grid h-9 items-center gap-4 border-b border-border bg-muted px-6 text-xs font-medium text-muted-foreground",e),children:t})}function kE({action:e}){return e==="block"?n.jsx("span",{className:"w-fit rounded-full border border-red-200 bg-red-50 px-2 py-px text-[11.5px] text-red-700",children:"Block"}):n.jsx("span",{className:"w-fit rounded-full border border-emerald-600/20 bg-emerald-50 px-2 py-px text-[11.5px] text-emerald-800",children:"Allow"})}function TE({hosts:e}){return n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",title:e.join(`
|
|
522
|
+
`),children:e.slice(0,3).join(", ")}),e.length>3&&n.jsxs("span",{className:"shrink-0 text-[11px] text-faint",children:["+",e.length-3]})]})}function EE({label:e,checked:t,mixed:r=!1,disabled:a,onChange:i}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),n.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:i,className:"block size-4 cursor-pointer rounded border-border accent-[var(--action)] focus-visible:outline-2 focus-visible:outline-ring disabled:cursor-not-allowed"})}function RE({policies:e,org:t,sandboxes:r,groups:a,assignments:i,setupMembers:c,onEdit:u,onEditBlocked:f,onClearBlocked:h,selected:m,onSelect:p,onSelectAll:g,onDelete:b,deleting:v,location:w,sources:C,selectionSummary:S,showHeader:N=!0}){var T;const E=w?IW:zW,k=w?"col-span-6":"col-span-5",A=((T=t==null?void 0:t.org)==null?void 0:T.blocked)??[],M=e.filter(O=>m.has(O.id)).length,R=e.length>0&&M===e.length;return n.jsxs(n.Fragment,{children:[N&&n.jsxs(Lp,{className:E,children:[n.jsx(EE,{label:"Select all matching network rules",checked:(S==null?void 0:S.all)??R,mixed:(S==null?void 0:S.mixed)??(M>0&&!R),disabled:v||(S?!S.count:!e.length),onChange:g}),n.jsx("span",{children:"Rule"}),w&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Action"}),n.jsx("span",{children:"Destinations"}),n.jsx("span",{children:"Groups"}),n.jsx("span",{children:"Enforced"}),n.jsx("span",{className:"text-right",children:"Actions"})]}),n.jsxs("ul",{className:"divide-y divide-border/60",children:[A.length>0&&n.jsxs("li",{className:Ve("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",E),children:[n.jsx("span",{}),n.jsxs("button",{disabled:v,onClick:f,"aria-label":"Edit blocked everywhere",className:Ve(k,"grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx(s2,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate text-xs font-medium",children:"Blocked everywhere"})]}),w&&n.jsx(Hs,{location:w}),n.jsx(kE,{action:"block"}),n.jsx(TE,{hosts:A}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Every sandbox · beats every rule"}),n.jsx("span",{className:"text-[12px] text-faint",children:"Always"})]}),n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":"Clear blocked everywhere",disabled:v,onClick:h,children:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]}),e.map(O=>{var H;const D=O.copies??[O],B=D.map(W=>{var L,X,ee;const q=C==null?void 0:C.find(_=>{var V;return _.location.id===((V=W.location)==null?void 0:V.id)}),Z=(L=q==null?void 0:q.data)==null?void 0:L.org,z=(((ee=(X=q==null?void 0:q.data)==null?void 0:X.fleetPolicy)==null?void 0:ee.sandboxes)??r).filter(_=>{var V;return Mx(W,{name:_.name,groups:ir({assignments:(Z==null?void 0:Z.assignments)??i},_.name),setups:((V=(Z==null?void 0:Z.setupMembers)??c)==null?void 0:V[_.name])??[]})});return{total:z.length,enforced:z.filter(_=>_.status==="loaded"&&_.rules.some(V=>V.key===`egress_${W.id}`)).length}}),F=B.reduce((W,q)=>W+q.total,0),K=B.reduce((W,q)=>W+q.enforced,0),$=[...new Set(D.map(W=>W.action))],P=[...new Set(D.flatMap(W=>W.destinations))],U=[...new Set(D.map(W=>{var q;return uf(W,((q=W.sourceOrg)==null?void 0:q.groups)??a)}))];return n.jsxs("li",{className:Ve("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",E,m.has(O.id)&&"bg-accent/40"),children:[n.jsx(EE,{label:`Select ${O.name}`,checked:m.has(O.id),disabled:v,onChange:()=>p(O.id)}),n.jsxs("button",{onClick:()=>u(O),disabled:v,"aria-label":`Edit ${O.name}`,title:w?`Details shown for ${w.label}. Open to choose a source.`:void 0,className:Ve(k,"grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx(Iu,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate text-xs font-medium",children:O.name})]}),w&&n.jsx(fx,{record:O}),n.jsx("span",{className:"flex flex-wrap gap-1",children:$.map(W=>n.jsx(kE,{action:W},W))}),n.jsx(TE,{hosts:P}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:U.length>1?n.jsx("span",{title:U.join(`
|
|
523
|
+
`),children:"Varies by source"}):O.appliesTo.everyone||O.appliesTo.sandboxes.length||!O.appliesTo.groups.length&&!((H=O.appliesTo.setups)!=null&&H.length)?n.jsx("span",{className:"text-amber-700",title:`Current scope: ${uf(O,a)||"none"}`,children:"Assign a group"}):uf(O,a)}),F?n.jsx(Q4,{n:K,total:F}):n.jsx("span",{className:"text-[12px] text-faint",children:"No sandboxes"})]}),n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":`Delete ${O.name}`,title:w?`Delete from ${w.label}`:void 0,disabled:v,onClick:()=>b([O]),children:[n.jsx(ts,{className:"size-3.5"}),"Delete"]})]},O.id)})]})]})}function nD({model:e,fleet:t,org:r,events:a,onOpen:i,onOpenGlobal:c,onDecide:u,onNavigate:f,onRefresh:h,onEditPolicy:m,onAddPolicy:p,onEditBlocked:g,onClearBlocked:b,forSandbox:v,onClearSandbox:w}){var he,Ae;const C=Pt(),[S,N]=x.useState(()=>new Set),[E,k]=x.useState(null),[A,M]=x.useState(!1),[R,T]=x.useState([]),O=x.useRef(!1),[D,B]=x.useState("all"),[F,K]=x.useState(""),[$,P]=x.useState(100),[U,H]=x.useState("rules"),[W,q]=x.useState(Date.now),Z=x.useRef(null),z=x.useRef(null);x.useEffect(()=>{const ge=setInterval(()=>q(Date.now()),3e4),Pe=Fe=>{var _e;(Fe.metaKey||Fe.ctrlKey)&&Fe.key.toLowerCase()==="k"&&(Fe.preventDefault(),(_e=Z.current)==null||_e.focus())};return window.addEventListener("keydown",Pe),()=>{clearInterval(ge),window.removeEventListener("keydown",Pe)}},[]),x.useEffect(()=>{var ge;P(100),(ge=z.current)==null||ge.scrollTo({top:0})},[F,D,U]);const L=x.useMemo(()=>k4(a,15,W),[a,W]),X=t.sandboxes,ee=X.length,_=e?xf("network",e.sources.flatMap(ge=>{var Pe,Fe;return(((Fe=(Pe=ge.data)==null?void 0:Pe.org)==null?void 0:Fe.policies)??[]).map(_e=>({..._e,location:ge.location,sourceOrg:ge.data.org,sourceSetups:ge.data.setups}))})):(r==null?void 0:r.policies)??[],V=(r==null?void 0:r.groups)??[],G=ge=>e?ht(ge):ge.id,{destinations:Y,blocked:ne,perSandbox:te}=x.useMemo(()=>e?YK(e.sources):v4(X,a,r),[X,a,r,e==null?void 0:e.sources]),ye=X.filter(ge=>ge.status==="loaded").length,ae=F.trim().toLowerCase(),ue=Y.filter(ge=>(D==="all"||ge.sources.has(D))&&(!ae||[ge.host,...ge.grants.flatMap(Pe=>[Pe.sandbox,Pe.key])].join(" ").toLowerCase().includes(ae))),se=ue.length,Q=[{id:"all",label:"All"},...yg.filter(ge=>ge===D||Y.some(Pe=>Pe.sources.has(ge))).map(ge=>({id:ge,label:ia[ge].label}))],ie=ne.filter(ge=>!ae||[ge.host,...ge.programs,...ge.sandboxes].join(" ").toLowerCase().includes(ae)),oe=X.filter(ge=>!ae||ge.name.toLowerCase().includes(ae)),pe=ge=>{var Pe;return!v||Mx(ge,{name:v,groups:ir(r,v),setups:((Pe=r==null?void 0:r.setupMembers)==null?void 0:Pe[v])??[]})},xe=_.filter(ge=>pe(ge)).filter(ge=>!ae||(ge.copies??[ge]).some(Pe=>{var Fe;return[Pe.name,Pe.action,...Pe.destinations,uf(Pe,((Fe=Pe.sourceOrg)==null?void 0:Fe.groups)??V)].join(" ").toLowerCase().includes(ae)})),je=_.filter(ge=>S.has(G(ge))),Ie=xe.filter(ge=>S.has(G(ge))).length;function ce(ge){N(Pe=>{const Fe=new Set(Pe);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})}function Te(){N(ge=>{const Pe=new Set(ge),Fe=xe.filter(Xe=>{var Je;return((Je=Xe.location)==null?void 0:Je.connected)!==!1}),_e=Fe.every(Xe=>ge.has(G(Xe)));for(const Xe of Fe)_e?Pe.delete(G(Xe)):Pe.add(G(Xe));return Pe})}async function re(){if(!(O.current||!(E!=null&&E.length))){O.current=!0,M(!0),T([]);try{const ge=e?E.map(Fe=>({...Fe,id:G(Fe)})):E,Pe=await NW(ge,Fe=>{if(!e)return C.deletePolicy(Fe);const _e=E.find(Xe=>G(Xe)===Fe);return e.apiFor(_e.location).deletePolicy(_e.id)});N(Fe=>{const _e=new Set(Fe);return Pe.deleted.forEach(Xe=>_e.delete(Xe)),Pe.failed.forEach(({id:Xe})=>_e.add(Xe)),_e}),T(Pe.failed),Pe.deleted.length&&He.success(`Deleted ${Po(Pe.deleted.length,"network rule")}`),Pe.failed.length&&He.error(`${Po(Pe.failed.length,"network rule")} could not be deleted. Review the errors and retry.`),Pe.syncFailures.length&&He.warning("Rules deleted, but some sandboxes could not be updated",{description:Pe.syncFailures.map(Fe=>`${Fe.rule} · ${Fe.sandbox}: ${Fe.error}`).join(`
|
|
524
|
+
`)}),k(null),await h()}finally{M(!1),O.current=!1}}}const fe=U==="rules"?xe.length:U==="destinations"?se:U==="blocked"?ie.length:oe.length,Re=U==="rules"?_.length:U==="destinations"?Y.length:U==="blocked"?ne.length:ee,Oe=!!(F||U==="destinations"&&D!=="all"),ke=()=>{K(""),B("all")};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Egress inventory",children:[{id:"rules",label:"Rules",count:_.length},{id:"destinations",label:"Destinations",count:Y.length},{id:"blocked",label:"Blocked hosts",count:ne.length,dot:"bg-red-500"},{id:"sandboxes",label:"Sandboxes",count:ee}].map(ge=>n.jsxs("button",{"aria-pressed":U===ge.id,onClick:()=>{H(ge.id),ke()},className:Ve("rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",U===ge.id?"bg-accent/70":"hover:bg-muted/60"),children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[ge.dot&&n.jsx("span",{className:Ve("size-1.5 rounded-full",ge.dot)}),ge.label]}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:ge.count})})]},ge.id))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(T4,{points:L,height:34,title:"Connections · 15m"})})]}),n.jsxs("div",{className:"flex h-[3px] shrink-0 overflow-hidden bg-border",role:"img","aria-label":`${ye} of ${ee} sandbox policies enforced`,children:[ye>0&&n.jsx("span",{className:"bg-emerald-400/70",style:{width:`${ye/ee*100}%`}}),ee>ye&&n.jsx("span",{className:"flex-1 bg-amber-400/70"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:Z,value:F,onValueChange:K,placeholder:U==="sandboxes"?"Search sandbox…":U==="rules"?"Search rule, destination…":"Search destination, sandbox, rule…","aria-label":"Search egress",className:"mr-auto w-full sm:w-64"}),U==="destinations"&&n.jsx(pn,{"aria-label":"Filter by source",value:D,onChange:ge=>B(ge.target.value),className:"h-8 max-w-44 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:Q.map(ge=>n.jsx("option",{value:ge.id,children:ge.id==="all"?"All sources":ge.label},ge.id))}),Oe&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:ke,children:[n.jsx(Pn,{className:"size-3"}),"Clear"]}),v&&U==="rules"&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 text-[12px]",children:["For ",n.jsx("span",{className:"font-mono",children:v}),n.jsx("button",{"aria-label":"Show every rule",onClick:w,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-3"})})]}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>i(v),children:["Rules & history",n.jsx(Zi,{className:"size-3"})]})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh egress",onClick:h,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:p,children:[n.jsx(ys,{className:"size-3.5"}),"Add rule"]})]}),U==="rules"&&je.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[n.jsx("strong",{children:je.length})," selected",je.length>Ie&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",je.length-Ie," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:A,onClick:()=>N(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:A||je.some(ge=>{var Pe;return((Pe=ge.location)==null?void 0:Pe.connected)===!1}),onClick:()=>k([...je]),children:[n.jsx(ts,{className:"size-3.5"}),A?"Deleting…":"Delete selected"]})]}),X.some(ge=>ge.source==="global")&&n.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-2 border-b border-amber-500/30 bg-amber-50/60 px-6 py-2 text-xs text-amber-800",children:[n.jsx(ti,{className:"size-3.5"}),n.jsx("span",{className:"mr-auto",children:"A global policy overrides every sandbox's network rules."}),n.jsx(le,{variant:"outline",size:"sm",onClick:c,children:"Review"})]}),R.length>0&&n.jsxs(xa,{id:"egress:delete-errors",tone:"error",title:"Some rules could not be deleted",onDismiss:()=>T([]),dismissLabel:"Dismiss deletion errors",children:[n.jsx("p",{children:"Failed rules remain selected for retry."}),n.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:R.map(ge=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:ge.name}),": ",ge.message]},ge.id))})]}),e&&n.jsx(Mu,{model:e,what:"network rules"}),n.jsx("div",{ref:z,tabIndex:0,role:"region","aria-label":"Egress inventory results",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:fe===0&&!(U==="rules"&&!Oe&&((Ae=(he=r==null?void 0:r.org)==null?void 0:he.blocked)!=null&&Ae.length||e!=null&&e.sources.some(ge=>{var Pe,Fe,_e,Xe;return(Xe=(_e=(Fe=(Pe=ge.data)==null?void 0:Pe.org)==null?void 0:Fe.org)==null?void 0:_e.blocked)==null?void 0:Xe.length})))?n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(zA,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:Oe?"No matching results":e!=null&&e.status.unavailable?"Egress unavailable":U==="rules"?v?`No rule applies to ${v} yet`:"No network rules yet":U==="blocked"?"No blocked hosts to review":U==="sandboxes"?"No sandboxes yet":"No open destinations"}),n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e!=null&&e.status.unavailable?"":!Oe&&U==="rules"?"Sandboxes are locked down: nothing leaves them until a rule allows it.":!Oe&&U==="destinations"?"Destinations appear when a sandbox policy allows access.":!Oe&&U==="blocked"?"Blocked connection attempts will appear here.":""}),Oe?n.jsx(le,{variant:"outline",className:"mt-4",onClick:ke,children:"Clear filters"}):U==="rules"&&!(e!=null&&e.status.any)&&n.jsxs(le,{className:"mt-4 bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:p,children:[n.jsx(ys,{}),"Add rule"]})]}):n.jsxs("div",{className:"min-w-[960px] bg-card",children:[U==="rules"&&e&&e.sources.map((ge,Pe)=>{var Xe,Je,ct;const Fe=(Xe=ge.data)==null?void 0:Xe.org,_e=xe.filter(At=>At.location.id===ge.location.id);return n.jsx(RE,{sources:e.sources,selectionSummary:{all:xe.length>0&&Ie===xe.length,mixed:Ie>0&&Ie<xe.length,count:xe.length},location:ge.location,showHeader:Pe===0,policies:_e,org:Oe?null:Fe,sandboxes:((ct=(Je=ge.data)==null?void 0:Je.fleetPolicy)==null?void 0:ct.sandboxes)??[],groups:(Fe==null?void 0:Fe.groups)??[],assignments:Fe==null?void 0:Fe.assignments,setupMembers:Fe==null?void 0:Fe.setupMembers,onEdit:m,onEditBlocked:()=>g(ge.location),onClearBlocked:()=>b(ge.location),selected:new Set(_e.filter(At=>S.has(G(At))).map(At=>At.id)),onSelect:At=>ce(G(_e.find(rt=>rt.id===At))),onSelectAll:Te,onDelete:k,deleting:A||!ge.location.connected},ge.location.id)}),U==="rules"&&!e&&n.jsx(RE,{policies:xe,org:Oe?null:r,sandboxes:X,groups:V,assignments:r==null?void 0:r.assignments,setupMembers:r==null?void 0:r.setupMembers,onEdit:m,onEditBlocked:g,onClearBlocked:b,selected:S,onSelect:ce,onSelectAll:Te,onDelete:k,deleting:A}),U==="destinations"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?eD:Z4,children:[n.jsx("span",{children:"Destination"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:e?"Granted by":"Source"}),n.jsx("span",{children:"Access"}),n.jsx("span",{children:"Sandboxes"}),n.jsx("span",{className:"text-right",children:"Requests"}),n.jsx("span",{})]}),n.jsx("ul",{className:"divide-y divide-border/60",children:ue.slice(0,$).map(ge=>{var Pe,Fe,_e,Xe;return n.jsx(PW,{d:ge,total:e?((Xe=(_e=(Fe=(Pe=e.sources.find(Je=>Je.location.id===ge.location.id))==null?void 0:Pe.data)==null?void 0:Fe.fleetPolicy)==null?void 0:_e.sandboxes)==null?void 0:Xe.length)??0:ee,onOpen:Je=>{var ct;((ct=ge.location)==null?void 0:ct.connected)!==!1&&i(Je,ge.location)}},ht({name:ge.host,location:ge.location}))})})]}),U==="blocked"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?tD:J4,children:[n.jsx("span",{children:"Destination"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Sandboxes"}),n.jsx("span",{children:"Attempts"}),n.jsx("span",{children:"Program"}),n.jsx("span",{className:"text-right",children:"Actions"})]}),n.jsx("ul",{className:"divide-y divide-border/60",children:ie.slice(0,$).map(ge=>n.jsx(_W,{b:ge,onDecide:(Pe,Fe)=>{var _e;((_e=ge.location)==null?void 0:_e.connected)!==!1&&u(Pe,Fe,ge.location)}},ht({name:ge.host,location:ge.location})))})]}),U==="sandboxes"&&n.jsxs(n.Fragment,{children:[n.jsxs(Lp,{className:e?CE:NE,children:[n.jsx("span",{children:"Sandbox"}),e&&n.jsx("span",{children:"Source"}),n.jsx("span",{children:"Rules by source"}),n.jsx("span",{children:"Policy"}),n.jsx("span",{className:"text-right",children:"Blocked"}),n.jsx("span",{})]}),n.jsx("ul",{className:"divide-y divide-border/70",children:oe.slice(0,$).map(ge=>{var Fe,_e,Xe;const Pe=te.get(e?ht({name:ge.name,location:ge.location}):ge.name)??{counts:{},blocked:0};return n.jsx("li",{children:n.jsxs("button",{disabled:((Fe=ge.location)==null?void 0:Fe.connected)===!1,onClick:()=>i(ge.name,ge.location),className:Ve("grid min-h-10 w-full items-center gap-4 px-6 py-2 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:bg-muted/60",e?CE:NE),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx("span",{className:Ve("size-2 shrink-0 rounded-[3px]",Za(ge.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono text-xs",children:ge.name})]}),ge.location&&n.jsx(Hs,{location:ge.location}),n.jsx("span",{className:"items-center gap-3 flex",children:yg.filter(Je=>Pe.counts[Je]).map(Je=>n.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] tabular-nums",title:ia[Je].label,children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",ia[Je].swatch)}),Pe.counts[Je]]},Je))}),n.jsxs("span",{className:"items-center gap-1.5 text-[12px] flex",children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",((_e=fa[ge.status])==null?void 0:_e.dot)??"bg-stone-200")}),ge.error?"Unavailable":ge.version?`v${ge.version} ${(Xe=fa[ge.status])==null?void 0:Xe.label.toLowerCase()}`:"-"]}),n.jsx("span",{className:Ve("text-right text-[12px] tabular-nums",Pe.blocked?"text-red-600/90":"text-faint"),children:Pe.blocked||"-"}),n.jsx(Lr,{className:"size-3.5 text-faint","aria-hidden":"true"})]})},ht(ge))})})]}),U!=="rules"&&fe>$&&n.jsxs("button",{onClick:()=>P(ge=>ge+100),className:"w-full border-t border-border py-3 text-xs text-muted-foreground outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:["Show ",Math.min(100,fe-$)," more"]})]})}),n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:fe.toLocaleString()}),Oe?` of ${Re.toLocaleString()}`:""," ",U==="blocked"?"blocked hosts":U]}),n.jsxs("span",{className:"hidden sm:inline",children:[ye,"/",ee," policies enforced · ⌘K to search"]})]}),n.jsx(Fr,{open:E!==null,onOpenChange:ge=>{!ge&&!O.current&&k(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",Po((E==null?void 0:E.length)??0,"network rule"),"?"]}),n.jsx(Xr,{children:"Removes these rules and updates the affected sandboxes. Deleting an allow rule can remove access; deleting a block rule can permit access allowed by other rules. Each sandbox must keep at least one network rule across its groups."})]}),n.jsx("ul",{"aria-label":"Network rules to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:E==null?void 0:E.map(ge=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[ge.location&&n.jsx(Hs,{location:ge.location}),ge.name]},G(ge)))}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:A,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:A||!(E!=null&&E.length),onClick:re,children:A?"Deleting…":"Delete rules"})]})]})})]})}function AE({kind:e,onAdd:t}){const[r,a]=x.useState(!1),[i,c]=x.useState("GET"),[u,f]=x.useState("");return r?n.jsxs("form",{className:"flex items-center gap-1.5",onSubmit:async h=>{h.preventDefault(),await t({method:i,path:u})&&(a(!1),f(""))},children:[n.jsx(pn,{value:i,onChange:h=>c(h.target.value),"aria-label":"Method",className:"h-7 rounded-md border border-input bg-card px-1 font-mono text-[11px]",children:MW.map(h=>n.jsx("option",{children:h},h))}),n.jsx(Ot,{value:u,onChange:h=>f(h.target.value),className:"h-7 w-48 bg-card font-mono text-[11px]",placeholder:"/path/**","aria-label":"Path pattern",autoFocus:!0}),n.jsx(le,{type:"submit",size:"xs",variant:e==="deny"?"destructive":"outline",disabled:!u.startsWith("/"),children:e==="deny"?"Block":"Allow"}),n.jsx(le,{type:"button",size:"icon-xs",variant:"ghost",onClick:()=>a(!1),"aria-label":"Cancel",children:n.jsx(Pn,{})})]}):n.jsxs("button",{onClick:()=>a(!0),className:Ve("flex items-center gap-1 text-[12px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e==="deny"?"text-red-600/80 hover:text-red-700":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ys,{className:"size-3"}),e==="deny"?"Block request":"Allow request"]})}function LW(e){const t=[...new Set(e.endpoints.map(r=>Yw[r.access]??r.access))];return t.length===1?t[0]:"Mixed"}function Kw({rule:e,onOp:t,onDelete:r,busy:a,locked:i,managedBy:c,onManage:u}){const[f,h]=x.useState(!1),m=Ya(e.key),p=OW[m],g=e.endpoints.map(v=>v.host),b=e.endpoints.some(v=>v.protocol!=="tcp"&&v.enforcement==="audit"||v.credentialRisk);return n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>h(!f),"aria-expanded":f,className:"flex w-full items-center gap-4 px-5 py-3.5 text-left outline-none transition-colors hover:bg-stone-50/70 focus-visible:bg-stone-50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border border-border bg-linear-to-b from-card to-stone-100",title:ia[m].label,children:n.jsx(p,{strokeWidth:1.5,className:"size-3.5 text-stone-600"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13.5px] font-medium",children:cf(e.key)}),b&&n.jsx(ti,{className:"size-3 shrink-0 text-amber-600","aria-label":"Audit only or uninspected"})]}),n.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:g[0]}),g.length>1&&n.jsxs("span",{className:"shrink-0 text-[11.5px] text-faint",children:["+",g.length-1]})]})]}),n.jsx("span",{className:"hidden shrink-0 sm:block",children:n.jsx(W4,{source:m})}),n.jsx("span",{className:"hidden w-24 shrink-0 text-[12px] text-muted-foreground sm:block",children:LW(e)}),n.jsx("span",{className:"hidden w-28 shrink-0 truncate text-right font-mono text-[11px] text-faint lg:block",children:[...new Set(e.binaries.map(wg))].join(", ")}),n.jsx(Lr,{className:Ve("size-3.5 shrink-0 text-faint transition-transform duration-200",f&&"rotate-90 text-muted-foreground"),"aria-hidden":"true"})]}),n.jsx(lc,{initial:!1,children:f&&n.jsx(In.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:[.2,0,0,1]},className:"overflow-hidden",children:n.jsxs("div",{className:"space-y-4 px-5 pt-1 pb-5 pl-[4.25rem]",children:[m==="agent"&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Included for this agent at launch. Only the destinations and programs listed here are allowed by this rule."}),e.endpoints.map(v=>n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs("span",{className:"font-mono text-[12.5px] font-medium",children:[v.host,n.jsx("span",{className:"text-muted-foreground",children:v.ports.length?`:${v.ports.join(",")}`:""}),v.path?` ${v.path}`:""]}),n.jsx(Gd,{children:v.protocol}),n.jsx(Gd,{children:(Yw[v.access]??v.access).toLowerCase()}),v.protocol!=="tcp"&&v.enforcement==="audit"&&n.jsx(Gd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:v.enforcementUnset?"Unset, treated as audit":void 0,children:"audit only"}),v.allowedIps.length>0&&n.jsxs(Gd,{title:"Private addresses allowed",children:["ips ",v.allowedIps.join(", ")]}),v.credentialRisk&&n.jsx(Gd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:v.tlsSkip?"Encrypted traffic passes through without request inspection":"Credentials are uninspected",children:v.tlsSkip?"TLS passthrough":"uninspected"}),!i&&e.endpoints.length>1&&n.jsx("button",{onClick:()=>t({kind:"removeEndpoint",ruleName:e.key,host:v.host,port:v.port}),disabled:a,className:"ml-auto text-[12px] text-faint outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:"Remove"})]}),(v.allow.length>0||v.deny.length>0)&&n.jsxs("ul",{className:"space-y-1 border-l border-border pl-3 font-mono text-[11.5px]",children:[v.allow.map((w,C)=>n.jsxs("li",{children:[n.jsx("span",{className:"text-emerald-700",children:"allow"})," ",n.jsxs("span",{className:"text-foreground/75",children:[w.method," ",w.path]})]},`a${C}`)),v.deny.map((w,C)=>n.jsxs("li",{children:[n.jsx("span",{className:"text-red-600",children:"block"})," ",n.jsxs("span",{className:"text-foreground/75",children:[w.method," ",w.path]})]},`d${C}`))]}),!i&&v.protocol!=="tcp"&&n.jsxs("div",{className:"flex flex-wrap gap-x-5 gap-y-1.5",children:[n.jsx(AE,{kind:"allow",onAdd:w=>t({kind:"addAllow",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:w})}),n.jsx(AE,{kind:"deny",onAdd:w=>t({kind:"addDeny",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:w})})]})]},`${v.host}:${v.ports.join(",")}:${v.path??""}`)),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.binaries.map(v=>n.jsxs("span",{title:v,className:"flex items-center gap-0.5 rounded-md bg-muted py-0.5 pr-1 pl-2 font-mono text-[10.5px] text-foreground/75",children:[wg(v),!i&&e.binaries.length>1?n.jsx("button",{onClick:()=>t({kind:"removeBinary",ruleName:e.key,binary:v}),disabled:a,"aria-label":`Remove ${v}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-2.5"})}):n.jsx("span",{className:"w-1"})]},v)),n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[c&&(u?n.jsxs("button",{onClick:u,className:"text-[12px] text-muted-foreground underline-offset-2 outline-none hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:["Managed in ",c]}):n.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["Managed in ",c]})),!i&&r&&n.jsxs(le,{variant:"ghost",size:"xs",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:r,children:[n.jsx(ts,{}),"Delete"]})]})]})]})})})]})}function $W({revisions:e,onOpen:t}){const r=e.slice(0,10).reverse();return n.jsx("div",{className:"flex items-center gap-1","aria-label":"Revisions",children:r.map((a,i)=>{var c,u;return n.jsx("button",{onClick:()=>t(a.version),title:`v${a.version} · ${(c=fa[a.status])==null?void 0:c.label} · ${Lu(a.createdAt)}`,className:Ve("rounded-full outline-none transition-transform hover:scale-125 focus-visible:ring-2 focus-visible:ring-ring",i===r.length-1?"size-2.5":"size-1.5",((u=fa[a.status])==null?void 0:u.dot)??"bg-stone-200"),"aria-label":`Revision ${a.version}`},a.version)})})}function BW({sandbox:e,version:t,latest:r,onClose:a,onRestore:i}){var h,m,p,g;const c=Pt(),[u,f]=x.useState(null);return x.useEffect(()=>{f(null),t!=null&&c.revision(e,t).then(f).catch(b=>f({error:b.message}))},[e,t,c]),n.jsx(Lo,{open:t!=null,onOpenChange:b=>{b||a()},children:n.jsxs(la,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[n.jsxs(ca,{className:"border-b p-6",children:[n.jsxs(ua,{className:"font-mono text-base",children:[e," · v",t]}),n.jsx(da,{children:u!=null&&u.revision?`${(h=fa[u.revision.status])==null?void 0:h.label} · ${jf(u.revision.createdAt)}`:"Loading…"})]}),n.jsxs("div",{className:"space-y-4 px-6 pb-6",children:[(u==null?void 0:u.error)&&n.jsx("p",{className:"text-sm text-muted-foreground",children:u.error}),((m=u==null?void 0:u.revision)==null?void 0:m.loadError)&&n.jsx("p",{className:"rounded-md border border-red-200 bg-red-50/60 p-2 font-mono text-[11px] text-red-700",children:u.revision.loadError}),((g=(p=u==null?void 0:u.revision)==null?void 0:p.provenance)==null?void 0:g["console.openshell/change"])&&n.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:u.revision.provenance["console.openshell/change"]}),(u==null?void 0:u.policy)&&(u.policy.rules.length?n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:u.policy.rules.map(b=>n.jsx(Kw,{rule:b,locked:!0,onOp:()=>{}},b.key))}):n.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No rules."})),(u==null?void 0:u.policy)&&t!==r&&n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>i(t),children:[n.jsx(M8,{}),"Restore"]})]})]})})}function sD({onClick:e}){return n.jsxs("button",{onClick:e,className:"group flex items-center gap-1.5 text-[12.5px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(W1,{className:"size-3.5 transition-transform group-hover:-translate-x-0.5"}),"All sandboxes"]})}function VW({onBack:e}){var f,h,m;const t=Pt(),[r,a]=x.useState(null),[i,c]=x.useState(!1),u=x.useCallback(()=>t.globalPolicy().then(a).catch(p=>a({error:p.message})),[t]);return x.useEffect(()=>{u()},[u]),n.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[n.jsx(sD,{onClick:e}),r?r.error?n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:r.error}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:r.active?`Global policy · v${(f=r.current)==null?void 0:f.revision.version}`:"No global policy"}),n.jsx("p",{className:"mt-3 text-[13px] text-muted-foreground",children:r.active?"Overrides every sandbox's own rules.":"Each sandbox follows its own rules."}),r.active&&n.jsxs(le,{variant:"outline",className:"mt-5 rounded-lg border-destructive/30 text-destructive hover:bg-destructive/5",onClick:()=>c(!0),children:[n.jsx(s2,{}),"Remove"]})]}),((m=(h=r.current)==null?void 0:h.policy)==null?void 0:m.rules.length)>0&&n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:r.current.policy.rules.map(p=>n.jsx(Kw,{rule:p,locked:!0,onOp:()=>{}},p.key))}),r.revisions.length>0&&n.jsx(R1,{title:"History",children:n.jsx(Nu,{className:"divide-y divide-border/60",children:r.revisions.map(p=>{var g,b;return n.jsxs("div",{className:"flex h-11 items-center gap-3 px-5 text-[12.5px]",children:[n.jsx("span",{className:Ve("size-1.5 rounded-full",(g=fa[p.status])==null?void 0:g.dot),"aria-hidden":"true"}),n.jsxs("span",{className:"font-mono",children:["v",p.version]}),n.jsx("span",{className:"text-muted-foreground",children:(b=fa[p.status])==null?void 0:b.label}),n.jsx("span",{className:"ml-auto text-muted-foreground",children:Lu(p.createdAt)})]},p.version)})})})]}):n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}),n.jsx(Fr,{open:i,onOpenChange:c,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:"Remove the global policy?"}),n.jsx(Xr,{children:"Every sandbox reverts to its own rules."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:async()=>{try{await t.removeGlobal(),He.success("Global policy removed"),u()}catch(p){He.error(p.message)}finally{c(!1)}},children:"Remove"})]})]})})]})}const ME=[{id:"all",label:"All"},...yg.map(e=>({id:e,label:ia[e].label}))];function UW({name:e,sandbox:t,events:r,onBack:a,onNavigate:i,onDraft:c,onEditPolicy:u,onEditBlocked:f,onOpenGlobal:h,reloadSignal:m}){var H,W,q,Z,z,L;const p=Pt(),g=gn(),[b,v]=x.useState(null),[w,C]=x.useState(!1),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,M]=x.useState("all"),R=x.useCallback(async()=>{try{const X=await p.policy(e);return v(X),X}catch(X){v({error:X.message})}},[e,p]);x.useEffect(()=>{v(null),R()},[R]),x.useEffect(()=>{m&&R()},[m]);async function T(X){var ee;for(let _=0;_<20;_++){const V=await R(),G=(ee=V==null?void 0:V.revisions)==null?void 0:ee.find(Y=>Y.version===X);if((G==null?void 0:G.status)==="loaded"){He.success(`Policy v${X} is enforced in ${e}`);return}if((G==null?void 0:G.status)==="failed"){He.error(`v${X} failed to load: ${G.loadError??"unknown error"}`);return}await new Promise(Y=>setTimeout(Y,1500))}He.warning(`v${X} saved; not yet loaded by ${e}`)}async function O(X){C(!0);try{const ee=await p.applyOps(e,X);return He(`Saved as v${ee.version}`),T(ee.version),!0}catch(ee){return He.error(ee.message),!1}finally{C(!1)}}async function D(X){C(!0);try{const ee=await p.restore(e,X);He(`Restored v${X} as v${ee.version}`),k(null),T(ee.version)}catch(ee){He.error(ee.message)}finally{C(!1)}}const B=((H=b==null?void 0:b.effective)==null?void 0:H.rules)??[],F=new Set(B.flatMap(X=>X.endpoints.filter(ee=>!ee.blocked).map(ee=>ee.host))),K=x.useMemo(()=>{const X=new Map;for(const ee of r){if(ee.sandbox!==e||ee.verdict!=="denied")continue;const _=Iw(ee.destination);if(!_||b4(_)||F.has(_))continue;const V=X.get(_)??{host:_,port:x4(ee.destination),count:0,binary:null,lastAt:null};V.count+=1,!V.binary&&ee.binary&&(V.binary=ee.binary),ee.at&&(!V.lastAt||ee.at>V.lastAt)&&(V.lastAt=ee.at),X.set(_,V)}return[...X.values()].sort((ee,_)=>_.count-ee.count)},[r,e,b]),$=(b==null?void 0:b.source)==="global",P=Object.fromEntries(ME.map(X=>[X.id,B.filter(ee=>X.id==="all"||Ya(ee.key)===X.id).length])),U=B.filter(X=>A==="all"||Ya(X.key)===A);return n.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[n.jsxs("div",{className:"space-y-5",children:[n.jsx(sD,{onClick:a}),b?b.error?n.jsx("p",{role:"alert",className:"py-16 text-center text-sm text-muted-foreground",children:b.error}):n.jsxs("header",{className:"flex flex-wrap items-end gap-x-6 gap-y-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[n.jsx("span",{className:Ve("size-2 rounded-[3px]",Za(t==null?void 0:t.phase).cell)}),"Sandbox"]}),n.jsx("h2",{className:"mt-2 truncate text-xl font-semibold tracking-tight",children:e}),n.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[b.latest&&n.jsxs("span",{className:Ve("flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px]",(W=fa[b.latest.status])==null?void 0:W.cls),children:[n.jsxs("span",{className:"relative flex size-1.5",children:[b.latest.status==="loaded"&&n.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60"}),n.jsx("span",{className:Ve("relative inline-flex size-1.5 rounded-full",(q=fa[b.latest.status])==null?void 0:q.dot)})]}),"v",b.latest.version," ",(Z=fa[b.latest.status])==null?void 0:Z.label.toLowerCase()]}),n.jsx($W,{revisions:b.revisions,onOpen:k}),n.jsxs("span",{className:"text-[12.5px] text-muted-foreground tabular-nums",children:[Po(F.size,"destination")," open"]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(le,{variant:"outline",className:"rounded-lg",onClick:()=>{try{sessionStorage.setItem("gateway-box",g?JSON.stringify({name:e,location:g}):e)}catch{}i("sandboxes")},children:[n.jsx(Ig,{}),"View sandbox"]}),n.jsxs(le,{className:"rounded-lg bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:w||$,onClick:()=>c(null,T),children:[n.jsx(ys,{}),"Add rule"]})]})]}):n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"})]}),b&&!b.error&&n.jsxs(n.Fragment,{children:[$&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-amber-500/30 bg-amber-50/60 px-4 py-2 text-[12.5px] text-amber-800",children:[n.jsx(ti,{className:"size-3.5"}),n.jsx("span",{className:"mr-auto",children:"Global policy in force · editing disabled"}),n.jsx(le,{variant:"outline",size:"sm",onClick:h,children:"Review"})]}),b.configurationError&&n.jsx("p",{className:"rounded-xl border border-red-200 bg-red-50/60 px-4 py-3 font-mono text-[11.5px] text-red-700",children:b.configurationError}),K.length>0&&!$&&n.jsx(R1,{title:"Blocked recently",count:K.length,children:n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:K.slice(0,6).map(X=>n.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",children:[n.jsx(qw,{host:X.host,tone:"denied",className:"size-7 text-[15px]"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block truncate font-mono text-[12.5px]",children:[X.host,n.jsxs("span",{className:"text-muted-foreground",children:[":",X.port]})]}),n.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[X.binary?wg(X.binary):"Unknown program",X.lastAt?` · ${Lu(X.lastAt)}`:""]})]}),n.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[X.count,"×"]}),n.jsx(le,{variant:"outline",size:"sm",className:"h-7 rounded-lg text-[12px]",onClick:()=>c({name:X4(X.host),binaries:X.binary?[X.binary]:[],endpoints:[{host:X.host,ports:[X.port],protocol:X.port===443||X.port===80?"rest":"tcp",access:"read-only",enforcement:"enforce"}]},T),children:"Allow"})]},X.host))})}),n.jsx(R1,{title:"Rules",count:B.length,actions:n.jsx(DW,{label:"Filter rules",options:ME.filter(X=>X.id==="all"||P[X.id]>0).map(X=>({...X,count:P[X.id]})),value:A,onChange:M}),children:U.length===0?n.jsx(Nu,{className:"flex flex-col items-center border-dashed py-12 shadow-none",children:n.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No rules yet"})}):n.jsx(Nu,{className:"divide-y divide-border/70 overflow-hidden",children:U.map(X=>{const ee=Ya(X.key);return n.jsx(Kw,{rule:X,busy:w,locked:!["own","agent"].includes(ee)||$,onOp:_=>O([_]),onDelete:["own","agent"].includes(ee)?()=>N(X.key):null,managedBy:ee==="secret"?"Secrets":ee==="policy"?"Network rules":ee==="org"?"Blocked everywhere":ee==="group"?"Groups":null,onManage:ee==="secret"?()=>i("secrets"):ee==="policy"?()=>u(X.key.replace(/^egress_/,"")):ee==="org"?f:ee==="group"?()=>i("groups"):void 0},X.key)})})})]}),n.jsx(Fr,{open:!!S,onOpenChange:X=>{X||N(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete rule ",S,"?"]}),n.jsxs(Xr,{children:[e," loses access immediately. Restorable from revisions."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:async()=>{await O([{kind:"removeRule",ruleName:S}]),N(null)},children:"Delete rule"})]})]})}),n.jsx(BW,{sandbox:e,version:E,latest:(L=(z=b==null?void 0:b.revisions)==null?void 0:z[0])==null?void 0:L.version,onClose:()=>k(null),onRestore:D})]})}function HW(e){const t=e.port===443||e.port===80;return{name:X4(e.host),binaries:[...e.programs],endpoints:[{host:e.host,ports:[e.port],protocol:t?"rest":"tcp",...t?{access:"read-only"}:{},enforcement:"enforce"}]}}const A1="egress-allow",kg="egress-sandbox",Ja="egress-policy",Tg=()=>{try{const e=JSON.parse(sessionStorage.getItem(Ja)??"null");return sessionStorage.removeItem(Ja),e}catch{return null}};function FW({combined:e,...t}){const r=gn();return e?n.jsx(GW,{...t}):n.jsx(M1,{...t},(r==null?void 0:r.id)??(r==null?void 0:r.context)??"default")}function M1({onNavigate:e,initialScope:t,initialGlobal:r=!1}){var ye,ae,ue,se,Q;const a=Pt(),i=gn(),c=ie=>e(ie,i),u=oi(),[f,h]=x.useState(t??null),[m,p]=x.useState(r),[g,b]=x.useState(()=>{try{const ie=sessionStorage.getItem(kg);return sessionStorage.removeItem(kg),ie}catch{return null}}),[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[k,A]=x.useState(null),[M,R]=x.useState(!1),[T,O]=x.useState(!1),[D,B]=x.useState(!1),[F,K]=x.useState(null),[$,P]=x.useState(0),U=x.useRef(null),H=x.useCallback(async()=>{try{w(await a.fleetPolicy())}catch(ie){w({error:ie.message,sandboxes:[]})}try{S(await a.org())}catch{S(null)}},[a]);x.useEffect(()=>{H()},[H]);const[W,q]=x.useState(Tg);x.useEffect(()=>{const ie=()=>{const oe=Tg();oe&&(q(oe),H())};return window.addEventListener(Ja,ie),()=>window.removeEventListener(Ja,ie)},[H]),x.useEffect(()=>{W!=null&&W.new&&A({initial:Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...W.new.appliesTo}})})},[W]);const Z=x.useRef(null);x.useEffect(()=>{if(!(W!=null&&W.edit)||!C||Z.current===W)return;const ie=C.policies.find(oe=>oe.id===W.edit);ie&&(Z.current=W,A({initial:ie}))},[W,C]),x.useEffect(()=>{let ie=null;try{ie=JSON.parse(sessionStorage.getItem(A1)??"null"),sessionStorage.removeItem(A1)}catch{}!(ie!=null&&ie.sandbox)||!(ie!=null&&ie.host)||(h(ie.sandbox),E({sandbox:ie.sandbox,initial:HW({host:ie.host,port:Number(ie.port)||443,programs:new Set(ie.binary?[ie.binary]:[])}),after:()=>P(oe=>oe+1)}))},[]);const z=x.useMemo(()=>{const ie=new Set;for(const oe of u.events)oe.binary&&ie.add(oe.binary);return[...ie].sort()},[u.events]),L=ie=>{var oe;h(ie),(oe=U.current)==null||oe.scrollTo({top:0})},X=()=>{var ie;p(!0),(ie=U.current)==null||ie.scrollTo({top:0})},ee=()=>{var ie;h(null),p(!1),H(),(ie=U.current)==null||ie.scrollTo({top:0})};function _(ie,oe){const xe={everyone:!1,groups:ie==="allow-one"?ir(C,[...oe.sandboxes][0]):[],sandboxes:[]};if(ie.startsWith("allow")){A({initial:Ki({name:oe.host,destinations:[oe.host],appliesTo:xe})});return}K({kind:ie,b:oe})}function V(ie){const oe=((C==null?void 0:C.policies)??[]).find(pe=>pe.id===ie);oe&&A({initial:oe})}function G(ie,oe){var xe,je;const pe=((xe=ie.applied)==null?void 0:xe.length)??0;(je=ie.failed)!=null&&je.length?He.warning(`${oe}. ${Po(ie.failed.length,"sandbox","sandboxes")} could not be updated`,{description:ie.failed.map(Ie=>`${Ie.sandbox}: ${Ie.error}`).join(`
|
|
525
|
+
`)}):He.success(oe,{description:pe?`Updated ${Po(pe,"sandbox","sandboxes")}.`:void 0}),H(),P(Ie=>Ie+1)}async function Y(){B(!0);try{const ie=C??await a.org();G(await a.saveOrg({...ie.org,blocked:[]}),"Cleared blocked hosts"),O(!1)}catch(ie){He.error(ie.message)}finally{B(!1)}}async function ne(){const{b:ie}=F;try{const oe=C??await a.org();G(await a.saveOrg({...oe.org,blocked:[...oe.org.blocked,ie.host]}),`${ie.host} blocked everywhere`),K(null)}catch(oe){He.error(oe.message)}}const te=((ye=v==null?void 0:v.sandboxes)==null?void 0:ye.length)??0;return n.jsxs("div",{ref:U,className:"h-full overflow-y-auto",children:[m?n.jsx(VW,{onBack:ee}):f?n.jsx(UW,{name:f,sandbox:((ae=v==null?void 0:v.sandboxes)==null?void 0:ae.find(ie=>ie.name===f))??((ue=u.sandboxes)==null?void 0:ue.find(ie=>ie.name===f)),events:u.events,onBack:ee,onNavigate:c,onOpenGlobal:X,reloadSignal:$,onDraft:(ie,oe)=>E({sandbox:f,initial:ie,after:oe}),onEditPolicy:V,onEditBlocked:()=>R(!0)},f):v?v.error?n.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:v.error}):n.jsx(nD,{fleet:v,org:C,events:u.events,onOpen:L,onOpenGlobal:X,onDecide:_,onNavigate:c,onRefresh:H,onEditPolicy:ie=>A({initial:ie}),onEditBlocked:()=>R(!0),onClearBlocked:()=>O(!0),onAddPolicy:()=>A({initial:Ki(g?{appliesTo:{everyone:!1,groups:ir(C,g),sandboxes:[]}}:{})}),forSandbox:g,onClearSandbox:()=>b(null)}):n.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"}),n.jsx(Gw,{open:!!k,onOpenChange:ie=>{ie||A(null)},initial:k==null?void 0:k.initial,groups:(C==null?void 0:C.groups)??[],sandboxes:((v==null?void 0:v.sandboxes)??u.sandboxes??[]).map(ie=>ie.name),assignments:(C==null?void 0:C.assignments)??{},setupMembers:(C==null?void 0:C.setupMembers)??{},knownPrograms:z,onGroupCreated:()=>a.org().then(S).catch(()=>{}),onSaved:(ie,oe)=>G(ie,`${ie.deleted?"Deleted":"Saved"} ${oe.name}`)}),n.jsx(Fr,{open:T,onOpenChange:ie=>{!ie&&!D&&O(!1)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Unblock ",Po(((Q=(se=C==null?void 0:C.org)==null?void 0:se.blocked)==null?void 0:Q.length)??0,"host")," everywhere?"]}),n.jsx(Xr,{children:"Removes the shared blocked list and updates every sandbox. These hosts can then be reached if another rule allows them."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:D,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:D,onClick:Y,children:D?"Removing…":"Unblock all"})]})]})}),n.jsx(B4,{open:M,onOpenChange:R,org:C==null?void 0:C.org,onSaved:ie=>G(ie,"Saved blocked hosts")}),n.jsx(QX,{open:!!N,onOpenChange:ie=>{ie||E(null)},initial:N==null?void 0:N.initial,knownPrograms:z,onSubmit:async ie=>{var pe;const oe=await a.applyOps(N.sandbox,[{kind:"addRule",rule:ie}]);He(`Saved as v${oe.version}`),P(xe=>xe+1),(pe=N.after)==null||pe.call(N,oe.version)}}),n.jsx(Fr,{open:!!F,onOpenChange:ie=>{ie||K(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Block ",F==null?void 0:F.b.host," everywhere?"]}),n.jsxs(Xr,{children:["Adds it, with its subdomains, to the hosts blocked in every sandbox. No rule can open it. Applies to ",Po(te,"sandbox","sandboxes"),"."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:ne,children:"Block everywhere"})]})]})})]})}function GW({onNavigate:e,requestedLocation:t}){var k,A,M;const r=Uu(["fleetPolicy","org","activity","setups"]),a=r.sources.flatMap(R=>{var T,O;return(((O=(T=R.data)==null?void 0:T.org)==null?void 0:O.policies)??[]).map(D=>({...D,location:R.location,sourceOrg:R.data.org,sourceSetups:R.data.setups}))}),i=mx(a,r.apiFor,r.refresh),[c,u]=x.useState(null),[f,h]=x.useState(!1),[m,p]=x.useState(null),[g,b]=x.useState(null),[v,w]=x.useState(Tg);x.useEffect(()=>{const R=()=>w(Tg());return window.addEventListener(Ja,R),()=>window.removeEventListener(Ja,R)},[]),x.useEffect(()=>{var D,B;if(!v||r.loading)return;const R=v.location??t??r.locations.find(F=>F.connected&&!F.remote),T=(B=(D=r.sources.find(F=>F.location.id===(R==null?void 0:R.id)))==null?void 0:D.data)==null?void 0:B.org;if(!(R!=null&&R.connected)||!T)return;const O=v.new?Ki({appliesTo:{everyone:!1,groups:[],sandboxes:[],...v.new.appliesTo}}):T.policies.find(F=>F.id===v.edit);O&&(u({initial:O,location:R}),w(null))},[v,r.sources,r.loading,t]),x.useEffect(()=>{let R,T;try{R=sessionStorage.getItem(kg),sessionStorage.removeItem(kg),T=JSON.parse(sessionStorage.getItem(A1)??"null")}catch{}if(R||T!=null&&T.sandbox){const O=t;O!=null&&O.connected&&p({location:O,name:R??T.sandbox})}},[t]);const C=R=>r.sources.find(T=>T.location.id===(R==null?void 0:R.id)),S=r.sources.flatMap(R=>{var T,O;return(((O=(T=R.data)==null?void 0:T.fleetPolicy)==null?void 0:O.sandboxes)??[]).map(D=>({...D,location:R.location}))}),N=r.sources.flatMap(R=>{var T,O;return((O=(T=R.data)==null?void 0:T.activity)==null?void 0:O.events)??[]});function E(R,T,O){var F,K,$,P,U;const D=C(R),B=(F=D==null?void 0:D.data)==null?void 0:F.org;return n.jsx(Zn,{location:R,children:n.jsx(hx,{record:{...T,location:R},type:"network",offer:i.offer,children:n.jsx(Gw,{sourceControl:T.copies&&n.jsx(wf,{record:{...T,location:R},onChange:H=>u({initial:{...H,...a.find(W=>ht(W)===ht(H)),copies:T.copies,configurationCount:T.configurationCount},location:H.location})}),open:!0,onOpenChange:H=>{H||O()},initial:T,groups:(B==null?void 0:B.groups)??[],sandboxes:((($=(K=D==null?void 0:D.data)==null?void 0:K.fleetPolicy)==null?void 0:$.sandboxes)??[]).map(H=>H.name),assignments:(B==null?void 0:B.assignments)??{},setupMembers:(B==null?void 0:B.setupMembers)??{},knownPrograms:[...new Set((((U=(P=D==null?void 0:D.data)==null?void 0:P.activity)==null?void 0:U.events)??[]).map(H=>H.binary).filter(Boolean))],onGroupCreated:r.refresh,onSaved:()=>{r.refresh(),He.success("Saved rule")}},ht({...T,location:R}))})})}return r.loading&&!r.sources.length?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading egress…"}):n.jsxs(n.Fragment,{children:[n.jsx(nD,{model:r,fleet:{sandboxes:S},events:N,org:null,onRefresh:r.refresh,onNavigate:e,onOpen:(R,T)=>p({name:R,location:T}),onOpenGlobal:()=>h("global"),onEditPolicy:R=>u({initial:R,location:R.location}),onAddPolicy:()=>h({initial:Ki()}),onEditBlocked:R=>{var T,O,D;return b({location:R,org:(D=(O=(T=C(R))==null?void 0:T.data)==null?void 0:O.org)==null?void 0:D.org})},onClearBlocked:R=>{var T,O,D;return b({location:R,org:{...(D=(O=(T=C(R))==null?void 0:T.data)==null?void 0:O.org)==null?void 0:D.org,blocked:[]}})},onDecide:(R,T,O)=>{var D,B,F,K,$;if(R.startsWith("allow")){const P=(B=(D=C(O))==null?void 0:D.data)==null?void 0:B.org;u({location:O,initial:Ki({name:T.host,destinations:[T.host],appliesTo:{everyone:!1,groups:R==="allow-one"?ir(P,[...T.sandboxes][0]):[],sandboxes:[]}})})}else{const P=($=(K=(F=C(O))==null?void 0:F.data)==null?void 0:K.org)==null?void 0:$.org;b({location:O,org:{...P,blocked:[...(P==null?void 0:P.blocked)??[],T.host]}})}}}),f&&n.jsx(Dx,{onClose:()=>h(!1),children:(R,T)=>f==="global"?n.jsx(Lo,{open:!0,onOpenChange:O=>{O||T()},children:n.jsxs(la,{className:"overflow-auto sm:max-w-4xl",children:[n.jsxs(ca,{children:[n.jsx(ua,{children:"Global policy"}),n.jsx(da,{children:n.jsx(Hs,{location:R})})]}),n.jsx(Zn,{location:R,children:n.jsx(Rf,{children:n.jsx(M1,{onNavigate:e,initialGlobal:!0})})})]})}):E(R,f.initial,T)}),c&&E(c.location,c.initial,()=>u(null)),i.dialog,g&&n.jsx(Zn,{location:g.location,children:n.jsx(B4,{open:!0,onOpenChange:R=>{R||b(null)},org:g.org??{...(M=(A=(k=C(g.location))==null?void 0:k.data)==null?void 0:A.org)==null?void 0:M.org,...g.clear?{blocked:[]}:{}},onSaved:()=>{r.refresh(),He.success("Saved blocked hosts")}})}),m&&n.jsx(Lo,{open:!0,onOpenChange:R=>{R||(p(null),r.refresh())},children:n.jsxs(la,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-5xl",children:[n.jsxs(ca,{className:"shrink-0 border-b px-6 py-4",children:[n.jsx(ua,{children:m.name}),n.jsx(da,{children:n.jsx(Hs,{location:m.location})})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Zn,{location:m.location,children:n.jsx(Rf,{children:n.jsx(M1,{onNavigate:e,initialScope:m.name})})})})]})})]})}const qW=e=>e!=null&&e.egressPolicy?` ${e.egressPolicy.created?"Created":"Updated"} the egress policy “${e.egressPolicy.name}”.`:e!=null&&e.egressPolicyError?" Its egress policy wasn’t saved.":"";function YW(e,t=GK){let r=[];const a=new Set,i=new Map,c=(u,f)=>{r=r.map(h=>h.id===u?{...h,...f}:h),a.forEach(h=>h())};return{subscribe:u=>(a.add(u),()=>a.delete(u)),getSnapshot:()=>r,updateReview(u,f,h){if(i.has(u))throw new Error("Wait for the import to finish before removing items.");c(u,{review:f,prepared:h,preparation:null,status:"needs-attention",message:f.items.length?"Import selection updated. Review it to finish importing.":"No items remain in this import."})},dismiss(u){r=r.filter(f=>f.id!==u),a.forEach(f=>f())},async cancel(u){var m;const f=i.get(u);if(!f)return;f.cancelled=!0;const h=r.find(p=>p.id===u);((m=h==null?void 0:h.preparation)==null?void 0:m.status)==="running"&&await f.api.cancelSetupPreparation(h.preparation.id)},start({id:u=crypto.randomUUID(),review:f,name:h,choices:m={},resumeJob:p,saveOnly:g=!1,api:b=e,location:v=null},w={}){if(i.has(u))return{id:u,promise:i.get(u).promise};const C={cancelled:!1,api:b};return i.set(u,C),r=[...r.filter(S=>S.id!==u),{id:u,name:h,review:f,location:v,prepared:g,status:"importing",message:g?"Saving your setup…":"Preparing your tools…"}],a.forEach(S=>S()),C.promise=(async()=>{var S;try{const N=g?{status:"saved",setup:await b.saveSetup(f.token,h,!0),inactive:f.items.filter(E=>{var k;return!E.disabled&&((k=E.issues)==null?void 0:k.length)}).map(E=>E.name)}:await t(b,f,h,m,{resumeJob:p,isCancelled:()=>C.cancelled,onProgress:E=>{var k;c(u,{preparation:E,message:E.message}),(k=w.onProgress)==null||k.call(w,E)},onReview:E=>{var k;c(u,{review:E,prepared:!0}),(k=w.onReview)==null||k.call(w,E)}});return c(u,{status:N.status,setup:N.setup,...N.status==="cancelled"?{prepared:!1}:{},message:N.status==="saved"?`Available in templates and sandboxes.${(S=N.inactive)!=null&&S.length?` Inactive: ${N.inactive.join(", ")}.`:""}${qW(N.setup)}`:N.status==="needs-attention"?"Some items need attention. Open the import to remove or fix them.":"Import cancelled. You can resume from the completed preparation."}),N}catch(N){throw c(u,{status:"failed",message:N.message}),N}finally{i.delete(u)}})(),{id:u,promise:C.promise}}}}const Xi=YW(cs),KW=(e,t)=>(e??[]).filter(r=>{var a;return r.action==="allow"&&(((a=r.appliesTo)==null?void 0:a.setups)??[]).some(i=>{var c;return i===t.id||i===((c=t.preparedFrom)==null?void 0:c.id)})}),XW=(e={})=>{var t,r,a;return!((t=e.programs)!=null&&t.length)&&(e.requests??"any")==="any"&&!((r=e.deny)!=null&&r.length)&&!((a=e.privateIps)!=null&&a.length)},WW=(e,t,r)=>KW(e,t).some(a=>{var i;return XW(a.advanced)&&(((i=a.advanced)==null?void 0:i.ports)??[443,80]).map(Number).includes(Number(r.port??443))&&a.destinations.some(c=>d4(c,r.host))}),rD=e=>{var t;return!!(e.credentialRef||(t=e.credentialFields)!=null&&t.length)},QW=(e,t)=>String(e??"").toLowerCase()===String(t??"").toLowerCase(),OE=(e,t)=>!rD(e)&&(t.phase==="runtime"||t.phase==="auth"&&(e.requirements??[]).some(r=>r.phase==="runtime"&&QW(r.host,t.host))),O1=e=>`${e.host}${Number(e.port??443)===443?"":`:${e.port}`}`,ZW=e=>`${O1(e)}${e.path||""}`;function JW(e,t,r,a=i=>i.requirements??[]){const i=new Set,c=new Map;for(const f of e)for(const h of r(f))for(const m of a(h).filter(p=>["runtime","auth"].includes(p.phase)))t&&!(m.phase==="runtime"&&rD(h))&&WW(t,f,m)?i.add(O1(m)):c.set(ZW(m),O1(m));const u=new Set(c.values());return{covered:[...i].filter(f=>!u.has(f)),uncovered:[...c.keys()]}}function eQ(e){const t=(e==null?void 0:e.hosts)??[],r=a=>[...new Set(t.filter(i=>i.host===a).flatMap(i=>i.items??[]))];return[...new Set((e==null?void 0:e.destinations)??t.map(a=>a.host))].filter(a=>{var i;return!((i=e==null?void 0:e.blocked)!=null&&i.includes(a))}).map(a=>({host:a,items:r(a)}))}const Xw=[{id:"codex",name:"Codex",logo:"codex"},{id:"claude",name:"Claude Code",logo:"claudecode"},{id:"cursor",name:"Cursor",logo:"cursor"}],D1=(e,t)=>e.items.filter(r=>r.kind===t).length,Ua=e=>e.issues.filter(t=>!Dw(t)),tQ=e=>e.items.filter(t=>!t.disabled&&!Ua(t).length).length,Eg=e=>e.items.filter(t=>Ua(t).length).length,DE=e=>e.sources.map(t=>{var r;return((r=Xw.find(a=>a.id===t))==null?void 0:r.name)||t}).join(", "),nQ=e=>`${e.host}${e.port&&Number(e.port)!==443?`:${e.port}`:""}${e.path||""}`,sQ={build:"Downloads from",runtime:"Connects to",auth:"Sign-in"},zE={connected:"Connected","needs-sign-in":"Needs sign-in","needs-credentials":"Needs credentials",unverified:"Couldn’t check"},rQ={prepared:"Ready","sign-in-in-sandbox":"Sign in after install","needs-attention":"Needs attention",disabled:"Inactive"},IE=e=>{var t,r,a;return e.disabled?"Inactive":zw(e)?"Can’t run in a sandbox":Ua(e).length?"Needs attention":e.issues.length?"Installs on import":e.kind==="skill"?`${((t=e.files)==null?void 0:t.length)??0} files`:((r=e.auth)==null?void 0:r.mode)==="agent-session"?"Sign in after install":((a=e.verification)==null?void 0:a.status)==="connected"?"Connected":e.artifact?"Package ready":"Not checked yet"},oQ=e=>/^(?=.{1,253}$)[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?\.[a-z]{2,63}$/i.test(e)&&!e.includes("..")&&!e.includes("*")&&!e.endsWith(".local"),oD=(e=[])=>e.some(t=>!oQ(t))?"Enter domain names like api.github.com (no wildcards, IP addresses or local names).":e.length>20?"Add up to 20 websites.":"",aD=e=>{var t;return((t=e.credentialFields)==null?void 0:t.length)>0&&!e.requirements.some(r=>r.phase==="runtime")},iD=(e,t)=>{var r;return aD(e)&&p4(t)&&!((r=t==null?void 0:t.hosts)!=null&&r.length)},ff=e=>(e==null?void 0:e.egressPolicy)??(e!=null&&e.egressPolicyError?{error:e.egressPolicyError}:null),aQ=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function Mf({children:e}){return e?n.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive",children:e}):null}function lD({children:e}){return n.jsxs("div",{className:"flex gap-2 rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground",children:[n.jsx(Iu,{className:"mt-0.5 size-3.5 shrink-0"}),n.jsx("span",{children:e})]})}const PE=[{kind:"mcp",label:"MCPs",icon:n2},{kind:"skill",label:"Skills",icon:Z1}];function cD({items:e,children:t}){return n.jsxs(nh,{defaultValue:e.some(r=>r.kind==="mcp")?"mcp":"skill",className:"min-w-0 gap-3",children:[n.jsx(sh,{"aria-label":"Setup item categories",className:"w-full",children:PE.map(({kind:r,label:a,icon:i})=>n.jsxs(Pr,{value:r,className:"gap-2 text-xs",children:[n.jsx(i,{className:"size-3.5"}),a,n.jsx("span",{className:"rounded bg-foreground/5 px-1.5 text-[10px] tabular-nums text-muted-foreground",children:e.filter(c=>c.kind===r).length})]},r))}),PE.map(({kind:r,label:a,icon:i})=>n.jsx(Io,{value:r,keepMounted:!0,className:"min-w-0",children:n.jsx(ho,{duration:.16,offset:2,blur:"0px",children:e.some(c=>c.kind===r)?t(e.filter(c=>c.kind===r)):n.jsxs("div",{className:"rounded-lg border border-dashed px-4 py-8 text-center",children:[n.jsx(i,{className:"mx-auto mb-2 size-5 text-muted-foreground",strokeWidth:1.5}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["No ",a," in this setup."]})]})})},r))]})}function iQ(e){const t=Uu(["setups"]);return n.jsx(dD,{...e,model:t})}function uD({combined:e,...t}){const r=gn();return e?n.jsx(iQ,{...t}):n.jsx(dD,{...t},(r==null?void 0:r.id)??(r==null?void 0:r.context)??"default")}function dD({sandbox:e=null,setupIds:t=[],model:r}){const a=Pt(),i=gn(),{locations:c}=vo(),[u,f]=x.useState(null),h=i??c.find(G=>G.context===u&&G.target===(a.target??"local"))??null;x.useEffect(()=>{if(i)return;let G=!0;return a.contextKey().then(Y=>{G&&f(Y)}).catch(()=>{}),()=>{G=!1}},[a,i]);const[m,p]=x.useState(null),g=x.useMemo(()=>r?r.sources.flatMap(G=>{var Y;return(((Y=G.data)==null?void 0:Y.setups)??[]).map(ne=>({...ne,location:G.location}))}):m,[r==null?void 0:r.sources,m]),b=x.useMemo(()=>r?xf("setups",g??[]):g,[g,!!r]),v=G=>r&&G.location?r.apiFor(G.location):a,[w,C]=x.useState(""),[S,N]=x.useState(!1),[E,k]=x.useState(null),[A,M]=x.useState(null),[R,T]=x.useState(!1),[O,D]=x.useState(""),[B,F]=x.useState(""),[K,$]=x.useState("all"),[P,U]=x.useState(!1),[H,W]=x.useState(!1),[q,Z]=x.useState(null),z=x.useCallback(async()=>{W(!0);try{r?await r.refresh():p(await a.setups()),C("")}catch(G){C(G.message)}finally{W(!1)}},[a,r==null?void 0:r.refresh]),L=mx(g??[],G=>r.apiFor(G),z),ee=x.useSyncExternalStore(Xi.subscribe,Xi.getSnapshot).filter(G=>{var Y;return G.status==="saved"&&(r||((Y=G.location)==null?void 0:Y.context)===(h==null?void 0:h.context))}).map(G=>G.id).join(",");x.useEffect(()=>{z()},[z,ee]);const _=x.useMemo(()=>(b||[]).filter(G=>{const Y=G.copies??[G],ne=Y.some(te=>[te.name,...te.items.flatMap(ye=>[ye.name,...ye.sources||[]])].join(" ").toLowerCase().includes(B.trim().toLowerCase()));return(!e||t.includes(G.id))&&ne&&(K==="all"||(K==="review"?Y.some(te=>Eg(te)>0):Y.every(te=>Eg(te)===0)))}).sort((G,Y)=>G.name.localeCompare(Y.name,void 0,{numeric:!0})*(P?-1:1)),[b,B,K,P,e,t]),V=!!(B||K!=="all");return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search setups",placeholder:"Search…",value:B,onValueChange:F,className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),n.jsxs(pn,{"aria-label":"Filter setups by status",value:K,onChange:G=>$(G.target.value),className:"h-8 w-36 bg-card text-xs",children:[n.jsx("option",{value:"all",children:"All statuses"}),n.jsx("option",{value:"imported",children:"Imported"}),n.jsx("option",{value:"review",children:"Needs review"})]}),V&&n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>{F(""),$("all")},children:"Clear"}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh setups",disabled:H,onClick:z,children:H?n.jsx(Nt,{className:"size-3.5"}):n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>N(!0),children:[n.jsx(ys,{}),"Bring my setup"]})]}),w&&n.jsxs("div",{className:"space-y-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(Mf,{children:w}),n.jsx(le,{variant:"outline",size:"sm",disabled:H,onClick:z,children:"Try again"})]}),r&&n.jsx(Mu,{model:r,what:"setups"}),n.jsx("div",{className:"flex-1",children:(!b||r!=null&&r.loading&&!r.sources.length)&&!w?n.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-12 text-xs text-muted-foreground",children:[n.jsx(Nt,{}),"Loading setups…"]}):r!=null&&r.status.unavailable?n.jsx("p",{className:"px-4 py-16 text-center text-sm text-muted-foreground",children:"Setups unavailable"}):b&&!_.length?n.jsxs("div",{className:"px-4 py-16 text-center",children:[n.jsx(gf,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),n.jsx("p",{className:"text-sm font-medium",children:e&&!V?"No setups in this sandbox":b.length?"No matching setups":"No setups yet"}),n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e&&!V?"Choose a setup from MCPs & Skills to enable it here.":b.length?"Try another name, tool, source agent, or status.":"Import MCPs and Skills from Codex, Claude Code, or Cursor."}),(!e||V)&&(b.length>0||!(r!=null&&r.status.any))&&n.jsx(le,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>b.length?(F(""),$("all")):N(!0),children:b.length?"Clear filters":"Bring my setup"})]}):b&&n.jsx(ho,{duration:.15,offset:0,blur:"0px",children:n.jsxs($V,{"aria-label":"MCPs & Skills",className:"min-w-[740px] text-xs",children:[n.jsx(BV,{children:n.jsxs(T5,{className:"hover:bg-transparent",children:[n.jsx(zv,{scope:"col","aria-sort":P?"descending":"ascending",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground sm:pl-6",children:n.jsxs("button",{className:"flex items-center gap-1.5 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>U(G=>!G),children:["Name",P?n.jsx(Pf,{className:"size-3"}):n.jsx(_f,{className:"size-3"})]})}),["Source","Source agents","MCPs","Skills","Created"].map(G=>n.jsx(zv,{scope:"col",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground",children:G},G)),n.jsx(zv,{className:"w-12",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx(VV,{children:_.map(G=>{var ye,ae,ue;const Y=G.copies??[G],ne=Xw.filter(se=>Y.some(Q=>Q.items.some(ie=>{var oe;return(oe=ie.sources)==null?void 0:oe.includes(se.id)}))),te=se=>{const Q=Y.map(pe=>D1(pe,se)),ie=Math.min(...Q),oe=Math.max(...Q);return ie===oe?ie:`${ie}–${oe}`};return n.jsxs(T5,{className:((ye=G.location)==null?void 0:ye.connected)===!1?"opacity-60":"cursor-pointer hover:bg-muted/40",onClick:()=>{var se;((se=G.location)==null?void 0:se.connected)!==!1&&k(G)},children:[n.jsx($l,{className:"max-w-72 px-4 py-2 sm:pl-6",children:n.jsxs("button",{disabled:((ae=G.location)==null?void 0:ae.connected)===!1,"aria-label":`Open setup ${G.name}`,onClick:se=>{se.stopPropagation(),k(G)},className:"group flex max-w-full items-center gap-2 rounded text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-muted/40 text-muted-foreground",children:n.jsx(t2,{className:"size-3.5",strokeWidth:1.5})}),n.jsx("span",{className:"truncate font-mono text-xs font-medium group-hover:underline",children:G.name})]})}),n.jsx($l,{className:"px-4 py-2",children:G.location??h?n.jsx(fx,{record:{...G,location:G.location??h}}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Loading…"})}),n.jsx($l,{className:"px-4 py-2",children:n.jsxs("div",{className:"flex items-center gap-2",children:[ne.map(se=>n.jsx("img",{src:`/logos/agents/${se.logo}.svg`,alt:se.name,title:se.name,className:"size-4 object-contain"},se.id)),!ne.length&&n.jsx("span",{className:"text-muted-foreground",children:"Not reported"})]})}),n.jsx($l,{className:"px-4 py-2 tabular-nums",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(n2,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),te("mcp")]})}),n.jsx($l,{className:"px-4 py-2 tabular-nums",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(Z1,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),te("skill")]})}),n.jsx($l,{className:"px-4 py-2 text-[11px] text-muted-foreground",children:G.createdAt?jf(G.createdAt):"Not reported"}),n.jsx($l,{className:"px-4 py-2 text-right sm:pr-6",children:n.jsx(le,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:((ue=G.location)==null?void 0:ue.connected)===!1,"aria-label":`Delete setup ${G.name}`,title:G.location?`Delete from ${G.location.label}`:void 0,onClick:se=>{se.stopPropagation(),D(""),M(G)},children:n.jsx(ts,{className:"size-3.5"})})})]},ht(G))})})]})})}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t bg-card px-4 py-2 text-[11px] text-muted-foreground sm:px-6",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:_.length}),V?` of ${(b==null?void 0:b.length)||0}`:""," ",(b==null?void 0:b.length)===1?"setup":"setups"]}),n.jsx("span",{children:"Available in templates and sandboxes"})]}),A&&n.jsx(tn,{open:!0,onOpenChange:G=>{!G&&!R&&M(null)},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Delete “",A.name,"”?"]}),n.jsx(Sn,{children:"This deletes the setup and its egress policy. MCPs already installed in sandboxes stay, but lose access to the websites that policy allowed. Templates that use this setup need another setup before reuse."})]}),n.jsx(Mf,{children:O}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:R,onClick:()=>M(null),children:"Cancel"}),n.jsxs(le,{variant:"destructive",disabled:R,onClick:async()=>{T(!0),D("");try{await v(A).deleteSetup(A.id,A.revision),r?z():p(G=>G.filter(Y=>ht(Y)!==ht(A))),k(G=>G&&ht(G)===ht(A)?null:G),M(null)}catch(G){D(G.message)}finally{T(!1)}},children:[R&&n.jsx(Nt,{}),"Delete setup"]})]})]})}),S&&n.jsx(Zn,{location:S.location??h,children:n.jsx(hD,{initialReview:S.review,initialName:S.name,onClose:()=>N(!1),onSaved:(G,Y=S.location??h)=>{N(!1),!r&&Y&&(Y.context!==(h==null?void 0:h.context)||Y.target!==(h==null?void 0:h.target))?window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"setups",location:Y}})):(z(),Z(ff(G)?{...ff(G),location:Y}:null))}})}),q&&n.jsx(Zn,{location:q.location??h,children:n.jsx(fD,{policy:q,onClose:()=>Z(null)})}),E&&n.jsx(Zn,{location:E.location??h,children:n.jsx(hx,{record:E,type:"setups",offer:L.offer,children:n.jsx(hQ,{sourceControl:n.jsx(wf,{record:E,onChange:G=>k({...G,...g.find(Y=>ht(Y)===ht(G)),copies:E.copies})}),setup:E,sandbox:e,onPrepare:async()=>{try{const G=await v(E).prepareSavedSetup(E.id);N({review:G,name:E.name+" (updated)",location:E.location??h}),k(null)}catch(G){C(G.message)}},onUpdated:G=>{var Y;k({...G,location:E.location,copies:(Y=E.copies)==null?void 0:Y.map(ne=>ht(ne)===ht(E)?{...G,location:E.location}:ne)}),r?z():p(ne=>ne.map(te=>te.id===G.id?G:te))},onClose:()=>k(null)},ht(E))})}),L.dialog]})}function lQ(){const e=x.useSyncExternalStore(Xi.subscribe,Xi.getSnapshot),[t,r]=x.useState(null),[a,i]=x.useState(null);return n.jsxs(n.Fragment,{children:[e.map(c=>n.jsx(xa,{id:`setup-import:${c.id}`,tone:c.status==="importing"?"progress":c.status==="saved"?"success":c.status==="failed"?"error":"warning",title:n.jsxs(n.Fragment,{children:[c.name," · ",c.status==="importing"?"Importing":c.status==="saved"?"Imported":c.status==="cancelled"?"Import cancelled":c.status==="failed"?"Import failed":"Import needs attention"]}),actions:n.jsxs(n.Fragment,{children:[n.jsx(ga,{location:c.location}),!["importing","saved"].includes(c.status)&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>r(c),children:"Review import"}),c.status==="saved"&&ff(c.setup)&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>i({policy:ff(c.setup),location:c.location}),children:"View egress policy"})]}),onDismiss:c.status==="importing"?void 0:()=>Xi.dismiss(c.id),dismissLabel:`Dismiss import notification for ${c.name}`,children:c.message},c.id)),t&&n.jsx(Zn,{location:t.location,children:n.jsx(hD,{initialJob:t,initialReview:t.review,initialName:t.name,onClose:()=>r(null),onSaved:c=>{i({policy:ff(c),location:t.location}),r(null)}},t.id)}),(a==null?void 0:a.policy)&&n.jsx(Zn,{location:a.location,children:n.jsx(fD,{policy:a.policy,onClose:()=>i(null)})})]})}function fD({policy:e,onClose:t}){var A,M,R,T,O;const r=Pt(),a=gn(),[i,c]=x.useState([]),[u,f]=x.useState(null),[h,m]=x.useState([]),[p,g]=x.useState(!1),[b,v]=x.useState(""),[w,C]=x.useState(!1);x.useEffect(()=>{if(e.error)return;let D=!0;return r.org().then(B=>{var K;if(!D)return;const F=(B.policies??[]).find($=>$.id===e.id);m(B.groups??[]),f(F??null),c(((K=F==null?void 0:F.appliesTo)==null?void 0:K.groups)??[])}).catch(B=>{D&&v(`Could not load groups: ${B.message}`)}),()=>{D=!1}},[r,e.id,e.error]);const S=async()=>{g(!0),v("");try{await r.savePolicy({...u,appliesTo:{...u.appliesTo,everyone:!1,groups:i},isNew:!1}),f({...u,appliesTo:{...u.appliesTo,groups:i}}),C(!0)}catch(D){v(D.message)}finally{g(!1)}},N=u&&(i.length!==u.appliesTo.groups.length||i.some(D=>!u.appliesTo.groups.includes(D))),E=eQ(e),k=()=>{try{sessionStorage.setItem(Ja,JSON.stringify({edit:e.id}))}catch{}t(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:a}})),window.dispatchEvent(new Event(Ja))};return e.error?n.jsx(tn,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Egress policy not saved"}),n.jsx(Sn,{children:"The setup was saved, but its egress policy wasn’t. When you enable the setup on a sandbox, you approve its websites there instead."})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e.error}),n.jsx("div",{className:"flex justify-end",children:n.jsx(le,{onClick:t,children:"Done"})})]})}):n.jsx(tn,{open:!0,onOpenChange:D=>{D||t()},children:n.jsxs(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:e.created?"Egress policy created":"Egress policy updated"}),n.jsxs(Sn,{children:["We ",e.created?"created":"updated"," the egress policy “",e.name,"”. Sandboxes that use this setup can now reach the websites below. This policy doesn’t open anything else."]})]}),E.length>0&&n.jsx("ul",{"aria-label":"Allowed websites",className:"max-h-64 divide-y overflow-y-auto rounded-lg border text-xs",children:E.map(D=>n.jsxs("li",{className:"flex items-baseline justify-between gap-3 px-3 py-2",children:[n.jsx("span",{className:"min-w-0 break-all font-mono",children:D.host}),D.items.length>0&&n.jsx("span",{className:"max-w-[50%] text-right text-muted-foreground",children:D.items.join(", ")})]},D.host))}),((A=e.blocked)==null?void 0:A.length)>0&&n.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:["Not allowed because your organization blocks them: ",e.blocked.join(", "),"."]}),((M=e.approval)==null?void 0:M.length)>0&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Not in this policy, because an MCP sends credentials there or names it as its sign-in service: ",e.approval.map(D=>`${D.host} (${D.items.join(", ")})`).join(", "),". You approve these for each sandbox when you enable the setup there."]}),(((R=e.sync)==null?void 0:R.error)||((O=(T=e.sync)==null?void 0:T.failed)==null?void 0:O.length)>0)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"The policy is saved, but some sandboxes that use this setup weren’t updated yet. The console keeps retrying in the background."}),u&&n.jsxs("fieldset",{className:"grid gap-1.5 text-xs",children:[n.jsx("legend",{className:"font-medium",children:"Assign to groups"}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sandboxes in these groups get this policy, whether or not they use the setup."}),n.jsx(cc,{multiple:!0,groups:h,value:i,onChange:D=>{C(!1),c(D)},onCreated:D=>m(B=>[...B,D])}),b&&n.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),w&&!N&&n.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"Groups saved."})]}),!u&&b&&n.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"To let an MCP reach another website, add it to this policy in Network › Egress."}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"outline",onClick:k,children:"Edit policy"}),N&&n.jsxs(le,{disabled:p,onClick:S,children:[p&&n.jsx(Nt,{}),"Save groups"]}),n.jsx(le,{variant:N?"ghost":"default",disabled:p,onClick:t,children:N?"Skip":"Done"})]})]})})}function cQ({item:e}){var i;const t=c=>[...new Set(e.requirements.filter(u=>["runtime","auth"].includes(u.phase)&&c(u)).map(u=>u.host.toLowerCase()))],r=t(c=>OE(e,c)),a=t(c=>!OE(e,c));return n.jsxs(n.Fragment,{children:[r.length>0&&n.jsxs("p",{className:"text-muted-foreground",children:["Import adds ",r.join(", ")," to this setup’s egress policy."]}),a.length>0&&n.jsxs("p",{className:"text-muted-foreground",children:["You approve ",a.join(", ")," for each sandbox when you enable the setup there",e.credentialRef||(i=e.credentialFields)!=null&&i.length?", because this MCP sends credentials":"","."]})]})}function uQ({preparation:e,onCancel:t}){var g,b;const r=e.status==="running",[a,i]=x.useState(Date.now);x.useEffect(()=>{if(!r)return;i(Date.now());const v=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(v)},[r]);const c=Date.parse(e.createdAt),u=r?e.current:null,f=((g=e.items)==null?void 0:g.filter(v=>v.kind==="mcp"))??[],h=((b=e.items)==null?void 0:b.filter(v=>v.kind==="skill"))??[],m=h.every(v=>v.state),p=n.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/40"});return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Nt,{}),n.jsx("span",{className:"min-w-0 flex-1",children:u&&f.length?"Preparing your tools…":e.message}),r&&!Number.isNaN(c)&&n.jsx("span",{"aria-hidden":"true",className:"tabular-nums text-muted-foreground",children:aQ(Math.max(0,Math.floor((a-c)/1e3)))}),r&&n.jsx(le,{size:"sm",variant:"outline",onClick:t,children:"Cancel import"})]}),(f.length>0||h.length>0)&&n.jsxs("ul",{"aria-label":"Import progress",className:"space-y-1.5 border-t pt-2",children:[f.map(v=>{const w=(u==null?void 0:u.id)===v.id,C=!w&&zw(v);return n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:w?n.jsx(Nt,{className:"size-3.5"}):C||!v.state||v.state==="disabled"?p:v.state==="needs-attention"?n.jsx(Iu,{className:"size-3.5 text-amber-600"}):n.jsx(Yn,{className:"size-3.5 text-emerald-600"})}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.name}),n.jsx("span",{className:"min-w-0 max-w-[60%] truncate text-right text-muted-foreground",children:w?u.message:C?"Skipped":rQ[v.state]||"Waiting"})]},v.id)}),h.length>0&&n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:m?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):p}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[h.length," ",h.length===1?"skill":"skills"]}),n.jsx("span",{className:"text-muted-foreground",children:m?"Done":"Waiting"})]})]})]})}function dQ({item:e,choice:t,disabled:r,onChange:a}){const i=oD(t==null?void 0:t.hosts)||(iD(e,t)?"Enter at least one website, for example api.github.com.":"");return aD(e)?n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"font-medium",children:"Where should this MCP send its credentials?"}),n.jsxs("p",{className:"text-muted-foreground",children:[e.name," needs at least one website it may send ",e.credentialFields.join(", ")," to, for example api.github.com."]}),n.jsx(Ot,{"aria-label":`Websites for ${e.name}`,"aria-invalid":i?!0:void 0,disabled:r,placeholder:"e.g. api.github.com",value:(t==null?void 0:t.hostsText)??"",onChange:c=>a(c.target.value)}),n.jsx("span",{className:"text-muted-foreground",children:"Domain names only, separated by commas or spaces. HTTPS only."}),i&&n.jsx("p",{className:"text-amber-700 dark:text-amber-400",children:i})]}):null}function hD(e){return e.initialReview||e.initialJob?n.jsx(mD,{...e}):n.jsx(fQ,{...e})}function fQ({onClose:e,onSaved:t,...r}){const a=ds(),{locations:i,refresh:c}=vo(),[u,f]=x.useState(null),[h,m]=x.useState(null);return x.useEffect(()=>{if(!h)return;const p=i.find(g=>g.gateway===h&&g.connected);p&&(f(p),m(null))},[h,i]),u?n.jsx(Zn,{location:u,children:n.jsx(mD,{...r,onClose:e,onChangeLocation:()=>f(null),onSaved:p=>t(p,u)})}):n.jsx(tn,{open:!0,onOpenChange:p=>{p||e()},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:i,allowRemote:!!(a!=null&&a.localViewer),subject:"setup",connecting:!!h,onPick:p=>{const g=i.find(b=>(b.id??b.context)===p&&b.connected);if(g){if(a!=null&&a.localViewer&&(g.cloud||g.target==="cloud")){e(),window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:g,type:"setups"}}));return}f(g)}},onConnected:p=>{m(p.gateway),c()},onCancel:e})})})}function mD({onClose:e,onSaved:t,onChangeLocation:r,initialReview:a=null,initialName:i="My setup",initialJob:c=null}){const u=Pt(),f=gn(),[h,m]=x.useState([]),[p,g]=x.useState(null),[b,v]=x.useState([]),[w,C]=x.useState(a),[S,N]=x.useState(i),[E,k]=x.useState(""),[A,M]=x.useState(null),[R,T]=x.useState(!1),[O,D]=x.useState("");async function B(se){T(!0),D("");try{await se()}catch(Q){D(Q.message)}finally{T(!1)}}const[F,K]=x.useState({}),[$,P]=x.useState((c==null?void 0:c.preparation)??null),[U,H]=x.useState((c==null?void 0:c.prepared)??!1),[W,q]=x.useState(!1),[Z,z]=x.useState(!!c),L=x.useRef(c==null?void 0:c.id),X=x.useRef(!0);x.useEffect(()=>(X.current=!0,()=>{X.current=!1}),[]);const ee=($==null?void 0:$.status)==="running"||R&&!!$,_=(se,Q)=>{H(!1),K(ie=>({...ie,[se]:{...ie[se],...Q}}))};async function V(se){const Q=await u.removeSetupReviewItem(w.token,se);C(Q),v(ie=>ie.filter(oe=>oe!==se)),K(ie=>Object.fromEntries(Object.entries(ie).filter(([oe])=>oe!==se))),P(null),L.current&&Xi.updateReview(L.current,Q,U)}async function G(se=!1){z(!0),q(!0);const Q=Xi.start({id:L.current,review:w,name:S,choices:F,saveOnly:se,api:u,location:f,resumeJob:($==null?void 0:$.status)==="running"?$:void 0},{onProgress:ie=>{X.current&&P(ie)},onReview:ie=>{X.current&&(C(ie),H(!0),K({}))}});L.current=Q.id;try{const ie=await Q.promise;if(!X.current)return;ie.status==="saved"?t(ie.setup):ie.status==="needs-attention"?D("Some items couldn’t be prepared. Remove them or fix them, then retry the import."):(H(!1),D("Import cancelled. Completed preparation is kept here for retry."))}finally{X.current&&q(!1)}}const Y=(p==null?void 0:p.items.filter(se=>`${se.name} ${se.kind} ${se.sources.join(" ")}`.toLowerCase().includes(E.toLowerCase())))??[],ne=new Set(b),te=(se,Q)=>v(ie=>{const oe=new Set(ie);for(const pe of se)Q?oe.add(pe.id):oe.delete(pe.id);return[...oe]}),ye=Y.length>0&&Y.every(se=>ne.has(se.id)),ae=w?HK(w,F):[],ue=Object.values(F).some(se=>oD(se.hosts))||!!(w!=null&&w.items.some(se=>!se.disabled&&iD(se,F[se.id])));return n.jsxs(tn,{open:!0,onOpenChange:se=>{!se&&(L.current||W||!R&&!ee)&&e()},children:[n.jsxs(nn,{className:"flex max-h-[90svh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[n.jsxs(sn,{className:"shrink-0 px-6 pb-4 pt-6 pr-12",children:[n.jsx(Qt,{children:w?"Import setup":p?"Choose what to bring":"Bring my setup"}),n.jsx(Sn,{children:w?"Import downloads and checks your MCPs, then saves the setup.":p?"Select the MCPs and skills to import. Items found in more than one agent are listed once.":"Choose the agents to import MCPs and skills from."})]}),n.jsxs("div",{className:"min-h-0 space-y-5 overflow-y-auto px-6 pb-5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx(ga,{location:f}),r&&!L.current&&n.jsx(le,{size:"sm",variant:"ghost",disabled:R||ee,onClick:r,children:"Change"})]}),!p&&!w&&n.jsx(n.Fragment,{children:n.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:Xw.map(se=>n.jsxs("button",{type:"button","aria-pressed":h.includes(se.id),onClick:()=>m(Q=>Q.includes(se.id)?Q.filter(ie=>ie!==se.id):[...Q,se.id]),className:`flex items-center gap-2 rounded-xl border px-3 py-4 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring ${h.includes(se.id)?"border-ring bg-muted":"bg-card"}`,children:[n.jsx("span",{className:"flex size-7 items-center justify-center rounded-lg border bg-muted/30",children:n.jsx("img",{src:`/logos/agents/${se.logo}.svg`,alt:"",className:"size-4"})}),se.name,h.includes(se.id)&&n.jsx(Yn,{className:"ml-auto size-3.5"})]},se.id))})}),p&&!w&&n.jsxs(n.Fragment,{children:[n.jsx(yo,{"aria-label":"Search discovered tools",placeholder:"Search MCPs and Skills…",value:E,onValueChange:k}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:[b.length," of ",p.items.length," selected",E.trim()?` · ${Y.length} matching`:""]}),n.jsx(le,{size:"sm",variant:"outline",disabled:R||!Y.length,onClick:()=>te(Y,!ye),children:ye?E.trim()?"Clear results":"Clear all":E.trim()?"Select all results":"Select all"})]}),n.jsx("div",{className:"grid items-start gap-3 sm:grid-cols-2",children:[{kind:"mcp",label:"MCPs"},{kind:"skill",label:"Skills"}].map(({kind:se,label:Q})=>{const ie=Y.filter(xe=>xe.kind===se),oe=ie.filter(xe=>ne.has(xe.id)).length,pe=ie.length>0&&oe===ie.length;return n.jsxs("section",{"aria-label":Q,className:"min-w-0 overflow-hidden rounded-xl border",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 border-b bg-muted px-3 py-2",children:[n.jsxs("h3",{className:"text-xs font-medium",children:[Q,n.jsxs("span",{className:"ml-2 font-normal text-muted-foreground",children:[oe,"/",ie.length]})]}),n.jsx(le,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:R||!ie.length,"aria-label":`${pe?"Clear":"Select all"} ${Q}${E.trim()?" in search results":""}`,onClick:()=>te(ie,!pe),children:pe?"Clear":"Select all"})]}),n.jsxs("div",{className:"max-h-64 divide-y overflow-y-auto",children:[ie.map(xe=>n.jsxs("label",{className:"flex cursor-pointer items-start gap-3 p-3",children:[n.jsx($o,{disabled:R,"aria-label":`Import ${xe.name} from ${DE(xe)}`,checked:ne.has(xe.id),onCheckedChange:je=>te([xe],je)}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:xe.name}),n.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[DE(xe),zw(xe)?" · Can’t run in a sandbox":Ua(xe).length?" · Needs attention":""]})]})]},xe.id)),!ie.length&&n.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:E.trim()?`No matching ${Q}`:`No ${Q} found`})]})]},se)})}),E.trim()&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select all only affects the search results. Other selections are kept."}),p.warnings.map(se=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:se},se))]}),w&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Setup name",n.jsx(Ot,{disabled:R,value:S,onChange:se=>N(se.target.value),maxLength:80})]}),n.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground",children:n.jsxs("span",{children:[tQ(w)," ready · ",Eg(w)," need attention"]})}),n.jsx(cD,{items:w.items,children:se=>n.jsx(RU,{className:"overflow-hidden rounded-lg border",children:se.map(Q=>{var ie,oe,pe,xe,je,Ie,ce,Te;return n.jsxs(AU,{value:Q.id,children:[n.jsxs("div",{className:"flex items-center [&>h3]:min-w-0 [&>h3]:flex-1",children:[n.jsxs(MU,{className:"items-center gap-3 rounded-none px-3 py-3 text-xs hover:bg-muted/30 hover:no-underline",children:[n.jsx("span",{className:"min-w-0 flex-1 break-words",children:Q.name}),n.jsx("span",{className:`shrink-0 text-[11px] font-normal ${["Needs attention","Can’t run in a sandbox"].includes(IE(Q))?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:IE(Q)})]}),n.jsx(le,{variant:"ghost",size:"icon",className:"mr-2 size-7 shrink-0 text-muted-foreground hover:text-destructive",disabled:R||ee,"aria-label":`Remove ${Q.name} from import`,title:"Remove from this import",onClick:()=>B(()=>V(Q.id)),children:n.jsx(ts,{className:"size-3.5"})})]}),n.jsxs(OU,{className:"space-y-3 border-t bg-muted/10 px-4 py-4 text-xs leading-relaxed [&_p:not(:last-child)]:mb-0",children:[Ua(Q).length>0&&n.jsx("div",{className:"space-y-1 text-amber-700 dark:text-amber-400",children:Ua(Q).map(re=>n.jsx("p",{children:re},re))}),Q.requirements.length>0&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-[11px] font-medium text-muted-foreground",children:"Network access"}),Q.requirements.map((re,fe)=>n.jsxs("p",{children:[n.jsxs("span",{className:"font-medium",children:[sQ[re.phase]||re.phase,":"]})," ",nQ(re),n.jsxs("span",{className:"text-muted-foreground",children:[" · ",re.reason]})]},fe)),Q.kind==="mcp"&&!Q.disabled&&!Ua(Q).some(re=>!re.startsWith("Connect credentials"))&&n.jsx(cQ,{item:Q})]}),Q.package&&n.jsxs("p",{children:["npm package ",Q.package.name,"@",((ie=Q.artifact)==null?void 0:ie.version)||Q.package.requested,Q.artifact?" · downloaded and version-locked":" · downloads when you press Import"]}),Q.verification&&n.jsxs("p",{children:["Connection: ",zE[Q.verification.status]||Q.verification.status,Q.verification.reason?` · ${Q.verification.reason}`:""]}),((oe=Q.artifact)==null?void 0:oe.verification)&&n.jsxs("p",{children:["Startup check: ",zE[Q.artifact.verification.status]||Q.artifact.verification.status,Q.artifact.verification.toolCount!==void 0?` · ${Q.artifact.verification.toolCount} tools found`:""]}),Q.credentialRef&&n.jsxs("p",{children:["Credentials connected · ",Q.credentialRef.provider,". Values are held by the gateway."]}),((pe=Q.configuration)==null?void 0:pe.endpoint)&&!Q.credentialRef&&n.jsx(lD,{children:"If this MCP needs an account, sign in from the agent inside the sandbox. Your desktop sign-in isn’t copied."}),Q.kind==="mcp"&&!Q.disabled&&(Q.configuration||Q.package)&&!((xe=Q.configuration)!=null&&xe.endpoint)&&n.jsx(dQ,{item:Q,choice:F[Q.id],disabled:R||ee,onChange:re=>_(Q.id,{hostsText:re,hosts:re.split(/[\s,]+/).map(fe=>fe.replace(/^https?:\/\//i,"").split("/")[0].toLowerCase()).filter(Boolean)})}),((je=Q.credentialFields)==null?void 0:je.length)>0&&n.jsxs("div",{className:"space-y-2 rounded border p-3",children:[n.jsx("p",{className:"font-medium",children:"Connect credentials"}),((Ie=Q.sourceCredentialFields)==null?void 0:Ie.length)>0&&n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{disabled:R||ee,checked:((ce=F[Q.id])==null?void 0:ce.useSourceSecrets)||!1,onCheckedChange:re=>_(Q.id,{useSourceSecrets:!!re})}),"Use the credentials from your config file (",Q.sourceCredentialFields.join(", "),")."]}),Q.credentialFields.filter(re=>{var fe,Re;return!((fe=F[Q.id])!=null&&fe.useSourceSecrets)||!((Re=Q.sourceCredentialFields)!=null&&Re.includes(re))}).map(re=>{var fe,Re;return n.jsxs("label",{className:"grid gap-1",children:[re,n.jsx(Ot,{type:"password",autoComplete:"new-password","aria-label":`${Q.name} ${re}`,disabled:R||ee,value:((Re=(fe=F[Q.id])==null?void 0:fe.secrets)==null?void 0:Re[re])||"",onChange:Oe=>{var ke;return _(Q.id,{secrets:{...(ke=F[Q.id])==null?void 0:ke.secrets,[re]:Oe.target.value}})}})]},re)}),n.jsx("p",{className:"text-muted-foreground",children:"Stored in the gateway and sent only to this MCP’s server. Never saved in the setup or in images."})]}),Q.configuration&&n.jsxs("details",{className:"group/config",children:[n.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-sm text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[n.jsx(Lr,{className:"size-3 transition-transform group-open/config:rotate-90"}),"Configuration"]}),n.jsx("pre",{className:"mt-2 overflow-x-auto rounded border bg-muted/30 p-3 text-[11px]",children:JSON.stringify(Q.configuration,null,2)})]}),(Te=Q.files)==null?void 0:Te.map(re=>n.jsxs("button",{disabled:R,onClick:()=>B(async()=>M({path:re.path,...await u.setupFile(w.token,Q.id,re.path)})),className:"flex w-full items-center gap-1.5 rounded px-1 py-1 text-left hover:bg-muted",children:[n.jsx(Z1,{className:"size-3"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:re.path}),n.jsxs("span",{className:"text-muted-foreground",children:[re.bytes," B"]})]},re.path))]})]},Q.id)})})}),$&&n.jsx("div",{role:"status","aria-live":"polite",className:"space-y-2 rounded-lg border bg-muted/30 p-3 text-xs",children:ee?n.jsx(uQ,{preparation:$,onCancel:()=>{Xi.cancel(L.current).catch(se=>D(se.message))}}):n.jsx("p",{children:U?pE(w)?"Checks finished. Some items need attention.":"Checks finished. Ready to save.":"Not finished. Press Import to continue."})}),a&&n.jsx(le,{variant:"ghost",disabled:ee||R,onClick:()=>{C(null),m([...new Set(a.items.flatMap(se=>se.sources))]),P(null),H(!1),K({})},children:"Re-scan sources"})]}),n.jsx(Mf,{children:O})]}),n.jsxs("div",{className:"shrink-0 space-y-4 border-t bg-muted/20 px-6 py-4",children:[w&&!ee&&!U&&ae.length>0&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[ae.map(se=>se.name).join(", ")," will be saved as inactive. You can fix ",ae.length===1?"it":"them"," later."]}),n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p&&n.jsx(le,{variant:"ghost",disabled:R||ee,onClick:()=>{w?(C(null),H(!1),P(null),K({})):(g(null),v([])),D("")},children:"Back"}),n.jsx(le,{variant:"ghost",disabled:!L.current&&!W&&(R||ee),onClick:e,children:W?"Continue in background":L.current?"Close":"Cancel"}),w?n.jsxs(le,{disabled:R||!S.trim()||!w.items.length||ue,onClick:()=>B(()=>G(U&&!pE(w))),children:[R&&n.jsx(Nt,{}),R?"Importing…":ee?"Resume import":Z?"Retry import":"Import"]}):p?n.jsxs(le,{disabled:R||!b.length,onClick:()=>B(async()=>{C(await u.reviewSetup(p.token,b)),z(!1)}),children:[R&&n.jsx(Nt,{}),"Review selection"]}):n.jsxs(le,{disabled:R||!h.length,onClick:()=>B(async()=>g(await u.discoverSetups(h))),children:[R&&n.jsx(Nt,{}),"Discover tools"]})]})]})]}),A&&n.jsx(tn,{open:!0,onOpenChange:()=>M(null),children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-3xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:A.path}),n.jsx(Sn,{children:"Read-only file preview. Content is not executed."})]}),n.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg border bg-muted/30 p-4 font-mono text-xs",children:A.content})]})})]})}function hQ({setup:e,sandbox:t,onUpdated:r,onClose:a,onPrepare:i,sourceControl:c}){var K,$;const u=Pt(),f=gn(),[h,m]=x.useState([]),[p,g]=x.useState(null),[b,v]=x.useState(t||""),[w,C]=x.useState([]),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,M]=x.useState([]),[R,T]=x.useState(!1),[O,D]=x.useState("");x.useEffect(()=>{let P=!0;return u.overview().then(U=>{P&&(m(U.sandboxes),g({...U.gateway,target:f==null?void 0:f.target}))}).catch(U=>{P&&D(U.message)}),()=>{P=!1}},[u]),x.useEffect(()=>{let P=!1,U;const H=async()=>{try{const W=await u.setupJobs(e.id);if(P)return;M(W),W.some(q=>q.status==="waiting")&&(U=setTimeout(H,2e3))}catch{}};return H(),()=>{P=!0,clearTimeout(U)}},[e.id,E,u]);async function B(P){T(!0),D("");try{await P()}catch(U){D(U.message),N(null)}finally{T(!1)}}const F=e.items.filter(P=>{var U;return!P.disabled&&!P.issues.length&&!P.credentialRef&&((U=P.auth)==null?void 0:U.mode)==="agent-session"});return n.jsx(tn,{open:!0,onOpenChange:P=>{!P&&!R&&a()},children:n.jsxs(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-lg",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:e.name}),n.jsx(Sn,{className:"sr-only",children:"Manage the MCPs and Skills in this saved setup."})]}),n.jsx("fieldset",{disabled:R,children:c}),n.jsx(cD,{items:e.items,children:P=>n.jsx("div",{className:"max-h-72 divide-y overflow-y-auto rounded-lg border",children:P.map(U=>{var H,W;return n.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[n.jsx("div",{className:"min-w-0 flex-1 self-center",children:U.issues.length||((H=U.auth)==null?void 0:H.mode)==="agent-session"?n.jsxs("details",{className:"group/item",children:[n.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-sm text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[n.jsx(Lr,{className:"size-3 shrink-0 text-muted-foreground transition-transform group-open/item:rotate-90"}),n.jsx("span",{className:"min-w-0 flex-1 break-words font-medium",children:U.name}),n.jsx("span",{className:`shrink-0 text-[10px] ${Ua(U).length?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:Ua(U).length?"Needs review":U.issues.length?"Installs automatically":"Sign-in needed"})]}),n.jsxs("div",{className:"space-y-1.5 pb-1 pl-5 pt-2 text-[11px] leading-relaxed text-muted-foreground",children:[U.issues.map(q=>n.jsx("p",{children:q},q)),((W=U.auth)==null?void 0:W.mode)==="agent-session"&&n.jsx("p",{children:"Sign in inside the sandbox after installation."})]})]}):n.jsx("p",{className:"break-words pl-5 text-xs font-medium",children:U.name})}),n.jsx(le,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground hover:text-destructive",disabled:R,"aria-label":`Delete ${U.name} from setup`,title:U.kind==="mcp"?"Remove from this setup. Copies already installed in sandboxes stay, but lose the website access only this MCP needed.":"Remove from this setup. Copies already installed in sandboxes stay.",onClick:()=>B(async()=>{const{egressPolicyError:q,...Z}=await u.deleteSetupItem(e.id,U.id,e.revision);N(null),k(null),r(Z),q&&D(`Removed. The setup’s egress policy wasn’t updated: ${q}`)}),children:n.jsx(ts,{className:"size-3.5"})})]},U.id)})})}),n.jsx("div",{className:"flex items-center justify-between gap-3",children:n.jsxs(le,{variant:"outline",size:"sm",onClick:i,disabled:R,children:[Eg(e)?"Resolve issues":"Prepare setup",n.jsx(Lr,{className:"size-3.5"})]})}),n.jsxs("details",{className:"group/install border-t pt-3",open:t?!0:void 0,children:[n.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-sm text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:["Install in a sandbox",n.jsx(Lr,{className:"size-3.5 text-muted-foreground transition-transform group-open/install:rotate-90"})]}),n.jsxs("div",{className:"space-y-3 pt-4",children:[n.jsxs("fieldset",{disabled:R,className:"grid gap-3",children:[n.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Sandbox",n.jsxs(pn,{"aria-label":"Setup destination",value:b,onChange:P=>{v(P.target.value),N(null),k(null)},className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose a sandbox"}),h.map(P=>n.jsxs("option",{value:P.name,children:[P.name," · ",P.phase]},P.name))]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"mb-2 text-xs",children:"Enable for agents"}),n.jsx("div",{className:"flex flex-wrap gap-4",children:zV.map(P=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx($o,{disabled:!P.config,title:P.reason,checked:w.includes(P.id),onCheckedChange:U=>{C(H=>U?[...H,P.id]:H.filter(W=>W!==P.id)),N(null),k(null)}}),P.name,!P.config&&n.jsx("span",{className:"text-muted-foreground",children:" · Unavailable"})]},P.id))})]}),n.jsxs(le,{variant:"outline",disabled:!b||!w.length||R,onClick:()=>B(async()=>{k(null),N(await u.previewSetup(e.id,b,w))}),children:[R&&n.jsx(Nt,{}),"Check requirements"]})]}),S&&n.jsxs("div",{className:"space-y-3",children:[S.problems.map(P=>n.jsx("p",{className:"text-xs text-amber-700",children:P},P)),S.network.map((P,U)=>{var H;return n.jsxs("div",{className:"rounded-lg border p-3 text-xs",children:[n.jsxs("p",{className:"flex justify-between gap-2 font-medium",children:[n.jsxs("span",{children:[P.item," · ",P.host,":",P.port,P.path||""]}),n.jsx("span",{children:P.status==="allowed"?"Existing access":P.status==="policy"?"Allowed by setup policy":P.status==="blocked"?"Blocked":P.status==="proposed"?"Requested access":"Needs review"})]}),n.jsx("p",{className:"mt-1 text-muted-foreground",children:P.reason}),((H=P.binaries)==null?void 0:H.length)>0&&n.jsx("p",{className:"mt-1 break-all font-mono text-muted-foreground",children:P.binaries.join(", ")}),P.credentialProvider&&n.jsxs("p",{children:["Credential binding: ",P.credentialProvider]})]},U)}),(K=S.inactive)==null?void 0:K.map(P=>n.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.name,": inactive · ",P.issues.join(" ")]},P.name)),S.notes.length>0&&n.jsx(lD,{children:S.notes.join(" ")}),!S.canEnable&&n.jsx("button",{type:"button",onClick:()=>{a(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:f}}))},className:"inline-block text-xs underline underline-offset-4",children:"Review access in Network › Egress"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[S.installed&&n.jsx(le,{variant:"outline",disabled:R,onClick:()=>B(async()=>{k(await u.removeSetup(e.id,b,S.token)),N(null)}),children:"Remove from sandbox"}),n.jsxs(le,{disabled:R||!S.canEnable,onClick:()=>B(async()=>{k(await u.enableSetup(e.id,b,S.token,S.requiresApproval)),N(null)}),children:[R&&n.jsx(Nt,{}),S.requiresApproval?"Approve access & enable":S.installed?"Check & reapply":"Enable & check"]})]})]}),E&&n.jsx("p",{role:"status",className:"rounded-lg border bg-muted/30 p-3 text-xs",children:E.status==="removed"?"Removed from this sandbox. Restart the agent to unload it. The sandbox no longer gets this setup’s egress policy; access you approved for it separately stays.":"Prepared configuration installed. Restart the agent to load it. Connection checks below apply to this sandbox; they do not execute tools."}),($=E==null?void 0:E.checks)==null?void 0:$.map((P,U)=>n.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.item,": ",P.status,P.toolCount!==void 0?` · ${P.toolCount} tools discovered`:"",P.reason?` · ${P.reason}`:""]},U)),((E==null?void 0:E.status)==="installed"||(S==null?void 0:S.installed)||A.some(P=>P.sandbox===b&&P.status==="installed"))&&b&&(p==null?void 0:p.name)&&(p==null?void 0:p.workspace)&&F.length>0&&n.jsxs("div",{className:"space-y-2 text-xs",children:[n.jsxs("p",{className:"font-medium",children:["Sign in to ",F.map(P=>P.name).join(", ")]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(P=>{var U,H;return n.jsxs("a",{className:"rounded-md border px-3 py-2 hover:bg-muted",href:vg(b,((U=qy(P))==null?void 0:U.command)||P,p),target:"_blank",rel:"noreferrer",children:["Open ",(H=qy(P))==null?void 0:H.name]},P)})}),w.includes("codex")&&F.filter(P=>{var U;return(U=P.configuration)==null?void 0:U.endpoint}).map(P=>n.jsxs("a",{className:"block underline underline-offset-4",href:`${vg(b,"codex",p)}&setupLogin=${e.id}&mcp=${encodeURIComponent(P.id)}`,target:"_blank",rel:"noreferrer",children:["Sign in to ",P.name," with Codex"]},P.id)),n.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer",children:"About sign-in"}),n.jsx("p",{className:"mt-2",children:"Use the agent’s MCP menu to authenticate and confirm tool availability. Sessions stay in this sandbox and are not baked into images. Console connection checks do not use these sessions."})]})]}),A.filter(P=>!b||P.sandbox===b).map((P,U)=>n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[P.sandbox,": ",P.status,P.error?` · ${P.error}`:""]},U))]})]}),n.jsx(Mf,{children:O})]})})}function pD(e){const t=gn();return n.jsx(mQ,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}const _E=[];function mQ({value:e=[],onChange:t,inherited:r=_E,accessReview:a,onAccessReview:i,automaticAccess:c=!1,autoPrepare:u=!1,preparationContext:f="sandbox",localCatalog:h,retained:m=_E}){const p=Pt(),[g,b]=x.useState([]),[v,w]=x.useState(""),[C,S]=x.useState(null),N=!!i;x.useEffect(()=>{let D=!0;return p.setups().then(B=>{D&&b(B.filter(F=>!(h!=null&&h.available)||!F.localSource||h.setups.includes(F.id)||r.includes(F.id)||m.includes(F.id)))}).catch(B=>{D&&w(B.message)}),()=>{D=!1}},[p,h,r,m]),x.useEffect(()=>{if(!N)return;let D=!0;return p.org().then(B=>{D&&S(B.policies??null)}).catch(()=>{D&&S(null)}),()=>{D=!1}},[N,p]);const E=g.filter(D=>e.includes(D.id)||r.includes(D.id)),k=D=>u?BK(D):!D.disabled&&!D.issues.length,A=D=>u?D.items.filter(m4):[],M=D=>D.items.filter(B=>!k(B)),R=JW(E,C,D=>D.items.filter(k),D=>u?VK(D):D.requirements),T=E.some(D=>D.items.some(B=>{var F;return k(B)&&!B.credentialRef&&((F=B.auth)==null?void 0:F.mode)==="agent-session"})),O=JSON.stringify(E.map(D=>[D.id,D.revision]));return x.useEffect(()=>{i==null||i(c?Object.fromEntries(JSON.parse(O)):null)},[O,c,i]),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs font-medium",children:"MCPs & Skills"}),g.map(D=>n.jsxs("div",{className:"rounded-lg border p-2.5 text-xs",children:[n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{"aria-label":`Use ${D.name}`,disabled:r.includes(D.id)||!D.items.some(k),checked:e.includes(D.id)||r.includes(D.id),onCheckedChange:B=>t(B?[...e,D.id]:e.filter(F=>F!==D.id))}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block truncate",children:[D.name,r.includes(D.id)?" · From image template":""]}),n.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[D1(D,"mcp")," MCPs · ",D1(D,"skill")," Skills",A(D).length?` · ${A(D).length} install automatically`:"",M(D).length?` · ${M(D).length} inactive`:""]})]})]}),M(D).length>0&&n.jsxs("details",{className:"mt-2 pl-6 text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer",children:"Items that will stay inactive"}),n.jsxs("div",{className:"mt-2 space-y-2",children:[M(D).map(B=>n.jsxs("p",{children:[n.jsxs("span",{className:"font-medium text-foreground",children:[B.name,":"]})," ",B.issues.join(" ")]},B.id)),n.jsx("p",{children:"Resolve these items in MCPs & Skills."})]})]})]},D.id)),i&&R.uncovered.length>0&&n.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[n.jsx("p",{className:"font-medium",children:c?"Required access":"Network access"}),n.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:R.uncovered.map(D=>n.jsx("li",{className:"break-all py-1",children:D},D))}),!c&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"flex items-start gap-2",children:[n.jsx($o,{checked:!!a,onCheckedChange:D=>i(D?Object.fromEntries(E.map(B=>[B.id,B.revision])):null)}),"Allow these destinations for tools and connection checks."]}),!a&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Otherwise, review access in MCPs & Skills before installation."})]})]}),i&&R.covered.length>0&&n.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[n.jsx("p",{className:"font-medium",children:E.length>1?"Allowed by the setups’ egress policies":"Allowed by the setup’s egress policy"}),n.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:R.covered.map(D=>n.jsx("li",{className:"break-all py-1",children:D},D))})]}),n.jsx(Mf,{children:v}),T&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:f==="template"?"Sign in after launching the sandbox.":"Sign in inside the sandbox after installation."})]})}const pQ=e=>/failed to resolve .*image/i.test(e??"")&&/docker\.io/.test(e??""),gQ=e=>{var t;return Array.isArray(e==null?void 0:e.sandboxes)&&!e.sandboxes.length&&!((t=e.stranded)!=null&&t.length)&&!e.conflict},LE=e=>(e??[]).map(t=>typeof t=="string"?t:`${t.workspace}/${t.name}`);function xQ(e,{schedule:t=setTimeout,cancel:r=clearTimeout}={}){let a={status:null,asking:null,error:null},i=null,c=null;const u=new Set,f=b=>{a={...a,...b},u.forEach(v=>v())};function h(){var b;r(i),i=null,u.size&&(i=t(()=>{p()},((b=a.status)==null?void 0:b.state)==="working"?2e3:15e3))}function m(b){var C,S;if(!c||((C=b==null?void 0:b.job)==null?void 0:C.status)==="working")return;const{id:v,then:w}=c;c=null,((S=b==null?void 0:b.job)==null?void 0:S.id)===v&&b.job.status==="done"&&(w==null||w())}async function p(b=!1){try{const v=await e.gatewayDocker(b);return f({status:v}),m(v),v}catch{return a.status}finally{h()}}async function g(b,v,w,C=!0){var S;f({asking:a.asking&&{...a.asking,busy:!0},error:null});try{const N=await(b==="undo"?e.undoGatewayDocker(LE(v)):e.connectGatewayDocker(LE(v),C));return f({status:N,asking:null}),N.state==="working"&&N.job?c={id:N.job.id,then:w}:N.state!=="mismatch"&&(w==null||w()),N}catch(N){if(N.code==="GATEWAY_DOCKER_MISMATCH"&&!(b==="undo"&&N.fix==="manual")){const E=await p(!0);f({asking:{kind:N.fix==="manual"?"steps":b,then:w,sandboxes:b==="undo"?N.sandboxes??null:(E==null?void 0:E.sandboxes)??N.sandboxes??null,busy:!1}})}else f({error:N.message,asking:{...a.asking??{kind:b,then:w,sandboxes:((S=a.status)==null?void 0:S.sandboxes)??null},busy:!1}});return null}finally{h()}}return{subscribe(b){return u.add(b),u.size===1&&p(),()=>{u.delete(b),u.size||(r(i),i=null)}},getSnapshot:()=>a,refresh:p,connect:(b=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var w;return g("connect",b,(w=a.asking)==null?void 0:w.then)},undo:(b=(v=>(v=a.asking)==null?void 0:v.sandboxes)())=>{var w;return g("undo",b,(w=a.asking)==null?void 0:w.then)},ask({kind:b,then:v}={}){const w=a.status;if(b??(b=(w==null?void 0:w.fix)==="manual"?"steps":"connect"),b==="connect"&&((w==null?void 0:w.state)!=="mismatch"||gQ(w)))return g("connect",[],v,(w==null?void 0:w.state)==="mismatch");f({asking:{kind:b,then:v,sandboxes:b==="connect"?(w==null?void 0:w.sandboxes)??null:null,busy:!1},error:null})},close:()=>f({asking:null,error:null})}}const jr=xQ(lr("local"));function bQ({telemetry:e=en}={}){let t=[];const r=new Set,a=new Map,i=()=>r.forEach(f=>f()),c=(f,h)=>{t=t.map(p=>p.id===f?{...p,...typeof h=="function"?h(p):h}:p);const m=t.find(p=>p.id===f);(m==null?void 0:m.status)==="created"&&m.phase==="ready"&&e.ready(m.analyticsFlow),i()};function u(f){const h=t.find(v=>v.id===f),{task:m}=a.get(f),p=new AbortController,g=e.startFlow("sandbox_creation",h.analyticsProperties,h.analyticsFlow);a.set(f,{task:m,controller:p}),c(f,{status:"preparing",message:"Preparing environment…",error:null,build:null,analyticsFlow:g});const b={signal:p.signal,progress:v=>c(f,{message:v}),build:v=>{e.step(g,"building_image"),c(f,w=>{var C;return{build:{...v,logs:v.logs??((C=w.build)==null?void 0:C.logs)}}})},creating:()=>{e.step(g,"creating"),c(f,{status:"creating",message:"Creating sandbox…"})}};m(b).then(v=>{if(p.signal.aborted)return e.finishFlow(g,"cancelled"),c(f,{status:"cancelled",message:"Creation cancelled."});e.finishFlow(g,"created"),c(f,{status:"created",sandbox:{...v,location:v.location??h.location},message:""})}).catch(v=>{var w,C;p.signal.aborted||v.name==="AbortError"?(e.finishFlow(g,"cancelled"),c(f,{status:"cancelled",message:"Creation cancelled."})):(e.finishFlow(g,"failed",((C=(w=t.find(S=>S.id===f))==null?void 0:w.build)==null?void 0:C.status)==="failed"?"image_build":Cu(v)),c(f,{status:"failed",error:v.message,code:v.code??null,fix:v.fix??null,message:""}))})}return{subscribe:f=>(r.add(f),()=>r.delete(f)),getSnapshot:()=>t,start({name:f,location:h,task:m,analyticsProperties:p,analyticsFlow:g}){const b=crypto.randomUUID();return t=[...t,{id:b,name:f,location:h,status:"preparing",analyticsProperties:p,analyticsFlow:g}],a.set(b,{task:m}),u(b),b},retry(f){var h;a.has(f)&&((h=t.find(m=>m.id===f))==null?void 0:h.status)==="failed"&&u(f)},cancel(f){var m,p;const h=t.find(g=>g.id===f);(h==null?void 0:h.status)==="preparing"&&((p=(m=a.get(f))==null?void 0:m.controller)==null||p.abort(),c(f,{message:"Cancelling…"}))},update:c,dismiss(f){a.delete(f),t=t.filter(h=>h.id!==f),i()}}}const lo=bQ(),ql="gateway-box",gD=["error","stopped","completed","deleting"],$E=(e,t)=>JSON.stringify([e==null?void 0:e.context,t]),BE=e=>e.status==="created"&&e.phase!=="ready"&&!gD.includes(e.phase);function vQ({jobs:e}){const{sandboxes:t,loading:r}=vo();return x.useEffect(()=>{if(r)return;const a=new Map(t.map(i=>[$E(i.location,i.name),i]));for(const i of e){const c=a.get($E(i.location,i.name));c?(c.phase!==i.phase||!i.reported)&&lo.update(i.id,{phase:c.phase,reported:!0,sandbox:c}):i.reported&&lo.dismiss(i.id)}},[t,r,e]),null}function VE(e){try{sessionStorage.setItem(ql,JSON.stringify({name:e.name,location:e.location}))}catch{}window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new Event(ql))}function yQ({job:e,onClose:t}){const r=x.useRef(null),a=x.useRef(!0),i=e.build;return x.useEffect(()=>{a.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[i==null?void 0:i.logs,e.message]),n.jsx(tn,{open:!0,onOpenChange:c=>{c||t()},children:n.jsxs(nn,{className:"flex h-[min(36rem,90svh)] flex-col gap-3 sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Build logs · ",e.name]}),n.jsx(Sn,{children:(i==null?void 0:i.status)==="failed"?"Build failed":e.status==="failed"?"Creation failed":e.status==="cancelled"?"Creation cancelled":(i==null?void 0:i.status)==="ready"?"Build complete":e.message||"Preparing environment…"})]}),(i==null?void 0:i.name)&&n.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",children:i.name}),n.jsx("pre",{ref:r,tabIndex:0,"aria-label":"Build output",onScroll:c=>{const u=c.currentTarget;a.current=u.scrollHeight-u.scrollTop-u.clientHeight<40},className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-all rounded-md border bg-muted/30 p-3 font-mono text-[10px] leading-relaxed",children:(i==null?void 0:i.logs)||((i==null?void 0:i.status)==="ready"?"Using a ready image template. No build was needed.":"Waiting for build output…")}),((i==null?void 0:i.error)||e.error)&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:(i==null?void 0:i.error)||e.error})]})})}function wQ(){const e=x.useSyncExternalStore(lo.subscribe,lo.getSnapshot),[t,r]=x.useState(null),a=e.filter(c=>c.status==="created"),i=e.find(c=>c.id===t);return n.jsxs(n.Fragment,{children:[a.some(BE)&&n.jsx(vQ,{jobs:a}),e.map(c=>{var g;const u=c.status==="created"&&c.phase==="ready",f=c.status==="created"&&gD.includes(c.phase),h=c.status==="preparing"||c.status==="creating"||BE(c),m=c.build&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>r(c.id),children:"Show build"}),p=c.status==="preparing"?{tone:"progress",title:`Preparing ${c.name}…`,body:c.message,actions:n.jsxs(n.Fragment,{children:[m,n.jsx(le,{size:"xs",variant:"ghost",onClick:()=>lo.cancel(c.id),children:"Cancel"})]})}:c.status==="creating"?{tone:"progress",title:`Creating ${c.name}…`,body:c.message}:c.status==="failed"?{tone:"error",title:`Couldn’t create ${c.name}`,body:c.error,actions:n.jsxs(n.Fragment,{children:[m,c.code==="GATEWAY_DOCKER_MISMATCH"&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:c.fix==="manual"?"steps":void 0,then:()=>lo.retry(c.id)}),children:c.fix==="manual"?"Show steps":"Connect"}),n.jsx(le,{size:"xs",variant:"outline",onClick:()=>lo.retry(c.id),children:"Try again"})]})}:c.status==="cancelled"?{tone:"info",title:`${c.name} not created`,body:"Creation was cancelled."}:u?{tone:"success",title:`${c.name} is ready`,body:"Your sandbox is ready to use.",actions:n.jsxs(le,{size:"xs",variant:"outline",disabled:((g=c.location)==null?void 0:g.connected)===!1,onClick:()=>VE(c),children:["Open sandbox",n.jsx(Zi,{className:"size-3"})]})}:f?{tone:"error",title:`${c.name} needs attention`,body:`Status: ${Cg[c.phase]}. Open the sandbox to inspect it.`,actions:n.jsxs(le,{size:"xs",variant:"outline",onClick:()=>VE(c),children:["Open sandbox",n.jsx(Zi,{className:"size-3"})]})}:{tone:"progress",title:`Starting ${c.name}…`,body:"Your new sandbox is starting. You can keep browsing while it gets ready."};return n.jsx(xa,{id:`sandbox-creation:${c.id}`,tone:p.tone,title:p.title,actions:n.jsxs(n.Fragment,{children:[n.jsx(ga,{location:c.location}),p.actions]}),onDismiss:h?void 0:()=>lo.dismiss(c.id),dismissLabel:`Dismiss status for ${c.name}`,children:p.body},c.id)}),i&&n.jsx(yQ,{job:i,onClose:()=>r(null)})]})}function jQ(){const e=ds(),t=e==null?void 0:e.cloudSetup;if(!t||e.cloudSetupWatched)return null;const r=t.stage==="signing-in"?{tone:"progress",title:"Signing in to OpenRod Cloud…",body:"Complete sign-in in the new window.",actions:n.jsx(le,{size:"xs",variant:"ghost",onClick:e.cancelCloudSetup,children:"Cancel"})}:t.stage==="preparing"?{tone:"progress",title:"Setting up your cloud machine…",body:"High demand may slow this down.",actions:n.jsx(le,{size:"xs",variant:"ghost",onClick:e.cancelCloudSetup,children:"Cancel"})}:t.stage==="ready"?{tone:"success",title:"OpenRod Cloud is ready",body:"Choose OpenRod Cloud as the location to use it.",dismiss:!0}:{tone:"error",title:"Couldn’t set up OpenRod Cloud",body:t.error,actions:n.jsx(le,{size:"xs",variant:"outline",onClick:e.startCloudSetup,children:"Try again"}),dismiss:!0};return n.jsx(xa,{id:"cloud-setup",tone:r.tone,title:r.title,actions:r.actions,onDismiss:r.dismiss?e.dismissCloudSetup:void 0,dismissLabel:"Dismiss cloud setup status",children:r.body})}function uc({command:e,label:t}){const[r,a]=x.useState(!1);return n.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-muted/40 py-1.5 pr-1.5 pl-3",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",title:t?void 0:e,children:t??e}),n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Copy command",onClick:async()=>{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)},children:r?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):n.jsx(Lf,{className:"size-3.5"})})]})}const ry="openrod.gateway-docker.dismissed",UE="openrod.gateway-docker.shown",HE="openrod.gateway-docker.failed",oy=e=>{try{return localStorage.getItem(e)}catch{return null}},rp=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},qd=e=>{var t,r;return`${((t=e.build)==null?void 0:t.engineId)??""}|${((r=e.conflict)==null?void 0:r.dockerHost)??""}`},xD=()=>x.useSyncExternalStore(jr.subscribe,jr.getSnapshot),SQ=e=>`${e.workspace}/${e.name}`;function FE({label:e,sandboxes:t,className:r=""}){return n.jsx("ul",{"aria-label":e,className:`max-h-48 overflow-auto rounded-md border border-border p-3 text-xs ${r}`,children:t.map(a=>n.jsxs("li",{className:"break-all py-1",children:[a.name,n.jsxs("span",{className:"text-muted-foreground",children:[" · ",a.workspace]})]},SQ(a)))})}function NQ({status:e,asking:t,error:r}){var m;const a=t.kind==="undo",{sandboxes:i,busy:c}=t,u=!a&&(e==null?void 0:e.conflict),f=a?[]:(e==null?void 0:e.stranded)??[],h=(m=e==null?void 0:e.steps)!=null&&m.file?n.jsx("span",{className:"font-mono",children:e.steps.file}):"OpenShell’s settings";return n.jsx(Fr,{open:!0,onOpenChange:p=>{!p&&!c&&jr.close()},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:a?"Undo the Docker change?":"Connect OpenShell to Docker?"}),n.jsxs(Xr,{children:[u&&n.jsxs("span",{className:"mb-2 block break-all font-mono text-[11px]",children:["OpenShell is set to use Docker at ",u.dockerHost,". OpenRod adds its own line after it."]}),a?n.jsxs(n.Fragment,{children:["OpenRod removes its line from ",h," and restarts OpenShell. Sandboxes from templates won’t start after that."]}):n.jsxs(n.Fragment,{children:["OpenRod will set DOCKER_HOST in ",h," and restart OpenShell."]})]})]}),i==null&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Running sandboxes restart too. Files in /sandbox are kept; open sessions end."}),(i==null?void 0:i.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"These sandboxes restart. Files in /sandbox are kept; open sessions end."}),n.jsx(FE,{label:"Sandboxes that restart",sandboxes:i})]}),f.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-destructive",children:"These won’t start again: their images aren’t in this Docker."}),n.jsx(FE,{label:"Sandboxes that won’t start again",sandboxes:f,className:"text-destructive"})]}),!a&&(e==null?void 0:e.alternative)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"To skip the restart, turn on “Allow the default Docker socket to be used” in Docker Desktop → Settings → Advanced."}),r&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:c,children:"Cancel"}),n.jsx(Wr,{variant:f.length?"destructive":"default",disabled:c,onClick:()=>a?jr.undo():jr.connect(),children:c?"Restarting…":a?"Undo and restart":u?"Switch and restart":"Restart OpenShell"})]})]})})}function CQ({status:e,asking:t}){const[r,a]=x.useState(!1),[i,c]=x.useState(!1),u=e==null?void 0:e.steps;async function f(){var m;a(!0);const h=await jr.refresh(!0);if(a(!1),(h==null?void 0:h.state)!=="ok")return c(!0);He.success("OpenShell can see Docker now"),jr.close(),(m=t.then)==null||m.call(t)}return n.jsx(tn,{open:!0,onOpenChange:h=>{h||jr.close()},children:n.jsxs(nn,{className:"sm:max-w-xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Connect OpenShell to Docker"}),n.jsx(Sn,{children:[(e==null?void 0:e.blocked)!=="Add one setting to OpenShell and restart it."&&(e==null?void 0:e.blocked),u&&"Add this line to OpenShell’s settings, then restart it. Running sandboxes restart too."].filter(Boolean).join(" ")})]}),u&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"break-all font-mono text-[11px]",children:u.file}),n.jsx(uc,{command:u.append,label:u.line}),u.restart?n.jsx(uc,{command:u.restart}):n.jsx("p",{className:"text-xs text-muted-foreground",children:"Then restart the OpenShell gateway the way you started it."})]}),(e==null?void 0:e.alternative)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"No restart: in Docker Desktop, open Settings → Advanced and turn on “Allow the default Docker socket to be used”."}),i&&!r&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"OpenShell still can’t see your Docker images."}),n.jsx(le,{variant:"outline",disabled:r,onClick:f,children:r?"Checking…":"Check again"})]})})}function kQ(){const{status:e,asking:t,error:r}=xD(),[a,i]=x.useState(()=>oy(ry)),[c,u]=x.useState(()=>oy(HE)),[f,h]=x.useState(null),m=x.useRef(null),p=e==null?void 0:e.lastChange,g=e==null?void 0:e.job;x.useEffect(()=>{if(!p)return;const S=()=>{if(!(document.visibilityState!=="visible"||oy(UE)===p.id||Date.now()-Date.parse(p.at)>36e5)){if(document.removeEventListener("visibilitychange",S),rp(UE,p.id),p.kind==="connect")return h(p.id);He.success("Undid the Docker change"),e.build&&(rp(ry,qd(e)),i(qd(e)))}};return S(),document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[p==null?void 0:p.id]),x.useEffect(()=>{if(!f)return;let S;const N=()=>{clearTimeout(S),document.visibilityState==="visible"&&(S=setTimeout(()=>h(null),15e3))};return N(),document.addEventListener("visibilitychange",N),()=>{clearTimeout(S),document.removeEventListener("visibilitychange",N)}},[f]),x.useEffect(()=>{(g==null?void 0:g.status)==="working"?m.current=g.id:g&&m.current===g.id&&(m.current=null,g.kind==="undo"&&g.status==="failed"&&He.error("Couldn’t undo the Docker change",{description:g.error}))},[g==null?void 0:g.id,g==null?void 0:g.status]);const b=()=>{rp(ry,qd(e)),i(qd(e))},v=!!(e!=null&&e.build)&&a===qd(e),w=(g==null?void 0:g.kind)==="undo"?"Undoing the Docker change…":"Connecting OpenShell to Docker…",C=(e==null?void 0:e.state)==="working"&&g?{tone:"progress",title:w,body:g.stage!==w&&g.stage}:["mismatch","unknown","no-docker"].includes(e==null?void 0:e.state)&&(g==null?void 0:g.kind)==="connect"&&g.status==="failed"&&c!==g.id?{tone:"error",title:"Couldn’t connect OpenShell to Docker",body:g.error,onDismiss:()=>{b(),rp(HE,g.id),u(g.id)},actions:n.jsxs(n.Fragment,{children:[e.state==="mismatch"&&e.fix!=="manual"&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"connect"}),children:"Try again"}),e.steps&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"steps"}),children:"Show steps"})]})}:f&&(p==null?void 0:p.id)===f?{tone:"success",title:"Connected OpenShell to Docker",onDismiss:()=>h(null),body:p.auto?"OpenShell restarted so new sandboxes can use your Docker images.":"New sandboxes can use your Docker images.",actions:p.undoable&&n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask({kind:"undo"}),children:"Undo"})}:(e==null?void 0:e.state)==="mismatch"&&e.fix!=="auto"&&!v?{tone:"warning",title:"OpenShell can’t see your Docker images",body:e.fix==="manual"?"Add one setting to OpenShell and restart it.":"Sandboxes from templates won’t start until it can.",actions:n.jsxs(n.Fragment,{children:[n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"}),n.jsx(le,{size:"xs",variant:"ghost",onClick:b,children:"Not now"})]})}:null;return n.jsxs(n.Fragment,{children:[C&&n.jsx(xa,{id:"gateway-docker",tone:C.tone,title:C.title,actions:C.actions||void 0,onDismiss:C.onDismiss,children:C.body}),t&&(t.kind==="steps"?n.jsx(CQ,{status:e,asking:t}):n.jsx(NQ,{status:e,asking:t,error:r}))]})}const z1="mt-1 text-[11px] text-red-700";function TQ(){const{status:e}=xD();return(e==null?void 0:e.state)==="mismatch"?n.jsxs("div",{className:`${z1} flex flex-wrap items-center gap-2`,children:["OpenShell can’t see your Docker images.",n.jsx(le,{size:"xs",variant:"outline",onClick:()=>jr.ask(),children:e.fix==="manual"?"Show steps":"Connect"})]}):n.jsx("p",{className:z1,children:(e==null?void 0:e.state)==="working"?"Connecting OpenShell to Docker…":(e==null?void 0:e.state)==="ok"?"OpenShell can see Docker now. Delete this sandbox and create it again.":"Start Docker, then delete this sandbox and create it again."})}function EQ({local:e}){return e?n.jsx(TQ,{}):n.jsx("p",{className:z1,children:"Start Docker, then delete this sandbox and create it again."})}const bD=x.createContext(void 0);function RQ(){return x.useContext(bD)}const AQ=x.forwardRef(function(t,r){const{className:a,defaultPressed:i=!1,disabled:c=!1,form:u,onPressedChange:f,pressed:h,render:m,type:p,value:g,nativeButton:b=!0,style:v,...w}=t,C=ws(g||void 0),S=RQ(),N=(S==null?void 0:S.value)??[],E=(c||(S==null?void 0:S.disabled))??!1,[k,A]=po({controlled:S?C!==void 0&&N.indexOf(C)>-1:h,default:i,name:"Toggle",state:"pressed"}),{getButtonProps:M,buttonRef:R}=bo({disabled:E,native:b}),T={disabled:E,pressed:k},O=[R,r],D=[{"aria-pressed":k,onClick(K){var U;const $=!k,P=yt(Ur,K.nativeEvent);f==null||f($,P),!P.isCanceled&&(C&&((U=S==null?void 0:S.setGroupValue)==null||U.call(S,C,$,P)),!P.isCanceled&&A($))}},w,M],B=Ct("button",t,{enabled:!S,state:T,ref:O,props:D}),F=x.useMemo(()=>({disabled:E,focusableWhenDisabled:!1}),[E]);return S?n.jsx(I4,{tag:"button",render:m,className:a,style:v,metadata:F,state:T,refs:O,props:D}):B}),MQ=x.createContext(void 0);function OQ(){return x.useContext(MQ)}const DQ=x.forwardRef(function(t,r){const{defaultValue:a,disabled:i=!1,loopFocus:c=!0,onValueChange:u,orientation:f="horizontal",multiple:h=!1,value:m,className:p,render:g,style:b,...v}=t,w=vx(),C=OQ(),S=a??Vr,N=m!==void 0||a!==void 0,E=((w==null?void 0:w.disabled)??!1)||((C==null?void 0:C.disabled)??!1)||i,[k,A]=po({controlled:m,default:S,name:"ToggleGroup",state:"value"}),M=st((B,F,K)=>{let $;h?($=k.slice(),F?$.push(B):$.splice(k.indexOf(B),1)):$=F?[B]:[],u==null||u($,K),!K.isCanceled&&A($)}),R={disabled:E,multiple:h,orientation:f},T=x.useMemo(()=>({disabled:E,setGroupValue:M,value:k,isValueInitialized:N}),[E,M,k,N]),O={role:"group"},D=Ct("div",t,{enabled:!!w,state:R,ref:r,props:[O,v]});return n.jsx(bD.Provider,{value:T,children:w?D:n.jsx(S3,{render:g,className:p,style:b,state:R,refs:[r],props:[O,v],loopFocus:c,enableHomeAndEndKeys:!0,orientation:f})})}),zQ=If("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),vD=x.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function IQ({className:e,variant:t,size:r,spacing:a=2,orientation:i="horizontal",children:c,...u}){return n.jsx(DQ,{"data-slot":"toggle-group","data-variant":t,"data-size":r,"data-spacing":a,"data-orientation":i,style:{"--gap":a},className:Ve("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...u,children:n.jsx(vD.Provider,{value:{variant:t,size:r,spacing:a,orientation:i},children:c})})}function PQ({className:e,children:t,variant:r="default",size:a="default",...i}){const c=x.useContext(vD);return n.jsx(AQ,{"data-slot":"toggle-group-item","data-variant":c.variant||r,"data-size":c.size||a,"data-spacing":c.spacing,className:Ve("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",zQ({variant:c.variant||r,size:c.size||a}),e),...i,children:t})}const GE=[{value:"light",label:"Light mode",icon:K8},{value:"dark",label:"Dark mode",icon:x8},{value:"system",label:"Auto · Follow computer",icon:p8}];function _Q(){const{theme:e="system",setTheme:t}=YR(),r=Zs(),a=Math.max(0,GE.findIndex(i=>i.value===e));return n.jsx(Fu,{delay:200,children:n.jsxs(IQ,{"aria-label":"Appearance",value:[e],onValueChange:i=>{i.length&&t(i[0])},spacing:1,className:"relative isolate mb-3 gap-1 rounded-xl border border-sidebar-border bg-background/70 p-1 shadow-[inset_0_1px_3px_#00000008]",children:[n.jsx(In.span,{"aria-hidden":"true",initial:!1,animate:{x:a*36},transition:r?{duration:0}:{type:"spring",stiffness:450,damping:32},className:"pointer-events-none absolute left-1 top-1 size-8 rounded-lg border border-border bg-card shadow-[0_2px_4px_#00000014,inset_0_1px_0_var(--button-highlight)]",children:n.jsx(V4,{duration:12,shineColor:["var(--border)","var(--frame-highlight)","var(--ink-faint)"]})}),GE.map(({value:i,label:c,icon:u})=>n.jsxs(ba,{children:[n.jsx(va,{render:n.jsx(PQ,{value:i,"aria-label":c}),className:Ve("relative z-10 size-8 min-w-8 rounded-lg p-0 text-muted-foreground hover:bg-transparent aria-pressed:bg-transparent data-[state=on]:bg-transparent motion-reduce:transition-none",e===i&&"text-foreground"),children:n.jsx(In.span,{"aria-hidden":"true",initial:!1,animate:{rotate:e===i&&i==="light"?45:e===i&&i==="dark"?-12:0,scale:e===i?1:.9},transition:{duration:r?0:.22},className:"flex items-center justify-center",children:n.jsx(u,{className:"size-3.5",strokeWidth:1.7})})}),n.jsx(ya,{side:"top",children:c})]},i))]})})}const yD=x.createContext(void 0);function uh(e){const t=x.useContext(yD);if(t===void 0&&!e)throw new Error(rn(47));return t}const LQ={...ix,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class $Q extends _u{constructor(r,a,i){const c=new Qf;super(BQ(r,c,a,i),VQ(c),LQ);ln(this,"setOpen",(r,a)=>{var g,b;const i=a.reason===Qn,c=a.reason===ma&&a.event.detail===0,u=!r&&(a.reason===Hf||a.reason==null),f=O2(a),h=this.select("activeTriggerId");if(!r&&a.reason===QA&&a.trigger==null&&h!=null&&(a.trigger=this.context.triggerElements.getById(h)??this.select("activeTriggerElement")??void 0),(b=(g=this.context).onOpenChange)==null||b.call(g,r,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(r,a);const m=()=>{const v=nx(this.state,r,a.trigger,f());v.openChangeReason=a.reason,this.update(v)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(vM,()=>{this.set("stickIfOpen",!1)}),go.flushSync(m)):m();let p;c?p="click":u?p="dismiss":a.reason===Ji&&(p="focus"),this.set("instantType",p)})}}function BQ(e,t,r,a=!1){const i={...ax(t,r,a),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&(e==null?void 0:e.mounted)===void 0&&(i.mounted=!0),i}function VQ(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new xo,triggerElements:e}}const qE=Xf(function({props:t}){const{children:r,open:a,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:u,modal:f=!1,handle:h,triggerId:m,defaultTriggerId:p=null}=t,g=HQ(h,{modal:f,open:i,openProp:a,activeTriggerId:p,triggerIdProp:m});g.useControlledProp("openProp",a),g.useControlledProp("triggerIdProp",m);const b=g.useState("open"),v=g.useState("mounted"),w=g.useState("payload");g.useContextCallback("onOpenChange",c),g.useContextCallback("onOpenChangeComplete",u),UM(g,b),sx(g);const{forceUnmount:C}=rx(b,g,()=>{g.update({stickIfOpen:!0,openChangeReason:null})});g.useSyncedValues({modal:f}),x.useEffect(()=>{b||g.context.stickIfOpenTimeout.clear()},[g,b]),x.useImperativeHandle(t.actionsRef,()=>({unmount:C,close:()=>g.setOpen(!1,yt(Ug))}),[C,g]);const S=b||v;return n.jsxs(yD.Provider,{value:g,children:[h&&n.jsx(tx,{handle:h,store:g}),S&&n.jsx(FQ,{store:g,modal:f}),typeof r=="function"?r({payload:w}):r]})});function UQ(e){return uh(!0)?n.jsx(qE,{props:e}):n.jsx(RM,{children:n.jsx(qE,{props:e})})}function HQ(e,t){const r=M2((a,i)=>new $Q(t,a,i));return x.useEffect(()=>r.context.stickIfOpenTimeout.disposeEffect(),[r]),r}function FQ({store:e,modal:t}){const r=e.useState("floatingRootContext"),a=Kf(r,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=a.reference,c=a.floating;return ox(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:c}),null}const GQ=300,qQ=R2(function(t,r){const{render:a,className:i,style:c,disabled:u=!1,nativeButton:f=!0,handle:h,payload:m,openOnHover:p=!1,delay:g=GQ,closeDelay:b=0,id:v,...w}=t,C=uh(!0),N=I2(h)??C;if(!N)throw new Error(rn(74));const E=ws(v),k=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),M=N.useState("isOpenedByTrigger",E),R=N.useState("triggerPopupId",E),T=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:D}=D2(E,T,N,{payload:m,disabled:u,openOnHover:p,closeDelay:b}),B=N.useState("openChangeReason"),F=N.useState("stickIfOpen"),K=N.useState("openMethod"),$=N.useState("focusManagerModal"),P=$2(A,{enabled:!u&&p&&(K!=="touch"||B!==ma),mouseOnly:!0,move:!1,handleClose:B2(),restMs:g,delay:{close:b},triggerElementRef:T,isActiveTrigger:k,isClosing:()=>N.select("transitionStatus")==="ending"}),U=k2(A,{stickIfOpen:F}),H=ZM(()=>N.select("open"),Y=>{N.set("openMethod",Y)}),W=N.useState("triggerProps",D),{getButtonProps:q,buttonRef:Z}=bo({disabled:u,native:f}),z={open(Y){return Y&&B===ma?Xp.open(Y):u2.open(Y)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:X,handleFocusTargetFocus:ee}=_4(N,T),V=Ct("button",t,{state:{disabled:u,open:M},ref:[Z,r,O,T],props:[U.reference,P,W,H,{[yM]:"",id:E,"aria-haspopup":"dialog","aria-expanded":M,"aria-controls":R},w,q],stateAttributesMapping:z}),G=n.jsx(x.Fragment,{children:V},E);return D&&!$?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:L,onFocus:X}),G,n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:ee})]}):G}),wD=x.createContext(void 0);function YQ(){const e=x.useContext(wD);if(e===void 0)throw new Error(rn(45));return e}const KQ=x.forwardRef(function(t,r){const{keepMounted:a=!1,...i}=t;return uh().useState("mounted")||a?n.jsx(wD.Provider,{value:a,children:n.jsx(Zg,{ref:r,...i})}):null}),jD=x.createContext(void 0);function XQ(){const e=x.useContext(jD);if(!e)throw new Error(rn(46));return e}const WQ=x.forwardRef(function(t,r){const{render:a,className:i,style:c,anchor:u,positionMethod:f,side:h,align:m,sideOffset:p,alignOffset:g,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:w,sticky:C,disableAnchorTracking:S=!1,collisionAvoidance:N=j2,...E}=t,k=uh(),A=YQ(),M=N2(),R=k.useState("floatingRootContext"),T=k.useState("mounted"),O=k.useState("open"),D=k.useState("openChangeReason"),B=k.useState("activeTriggerElement"),F=k.useState("modal"),K=k.useState("openMethod"),$=k.useState("positionerElement"),P=k.useState("instantType"),U=k.useState("transitionStatus"),H=k.useState("adaptiveOrigin"),W=x.useRef(null),q=Gf($),Z=xx({anchor:u,floatingRootContext:R,positionMethod:f,mounted:T,side:h,sideOffset:p,align:m,alignOffset:g,arrowPadding:w,collisionBoundary:b,collisionPadding:v,sticky:C,disableAnchorTracking:S,keepMounted:A,nodeId:M,collisionAvoidance:N,adaptiveOrigin:H}),z=R.useState("domReferenceElement");We(()=>{const V=z,G=W.current;if(V&&(W.current=V),G&&V&&V!==G){k.set("instantType",void 0);const Y=new AbortController;return q(()=>{k.set("instantType","trigger-change")},Y.signal),()=>{Y.abort()}}},[z,q,k]);const L=F===!0&&D!==Qn;q2(O&&L,K==="touch",$,B);const X=k.useStateSetter("positionerElement"),ee={open:O,side:Z.side,align:Z.align,anchorHidden:Z.anchorHidden,instant:P},_=bx(t,ee,{styles:Z.positionerStyles,transitionStatus:U,props:E,refs:[r,X],hidden:!T,inert:!O});return n.jsxs(jD.Provider,{value:Z,children:[T&&L&&n.jsx(cx,{inert:Jf(!O),cutout:B}),n.jsx(EM,{id:M,children:_})]})}),QQ=x.createContext(void 0);function ZQ(){const[e,t]=x.useState(0),r=st(()=>(t(i=>i+1),()=>{t(i=>Math.max(0,i-1))}));return{context:x.useMemo(()=>({register:r}),[r]),hasClosePart:e>0}}const JQ=x.forwardRef(function(t,r){const{render:a,className:i,style:c,initialFocus:u,finalFocus:f,...h}=t,m=uh(),p=XQ(),g=vx()!=null,{context:b,hasClosePart:v}=ZQ(),w=m.useState("open"),C=m.useState("openMethod"),S=m.useState("instantType"),N=m.useState("transitionStatus"),E=m.useState("popupProps"),k=m.useState("titleElementId"),A=m.useState("descriptionElementId"),M=m.useState("modal"),R=m.useState("mounted"),T=m.useState("openChangeReason"),O=m.useState("activeTriggerElement"),D=m.useState("floatingRootContext"),B=D.useState("floatingId"),F=m.useState("disabled"),K=m.useState("openOnHover"),$=m.useState("closeDelay");Sr({open:w,ref:m.context.popupRef,onComplete(){var Z,z;w&&((z=(Z=m.context).onOpenChangeComplete)==null||z.call(Z,!0))}}),L2(D,{enabled:K&&!F,closeDelay:$});const P=u===void 0?VM(m.context.popupRef):u,U=M!==!1&&v;m.useSyncedValue("focusManagerModal",U);const H=m.useStateSetter("popupElement"),W={open:w,side:p.side,align:p.align,instant:S,transitionStatus:N},q=Ct("div",t,{state:W,ref:[r,m.context.popupRef,H],props:[E,{id:B,role:"dialog",...Wf,"aria-labelledby":k,"aria-describedby":A,onKeyDown(Z){g&&Zf.has(Z.key)&&Z.stopPropagation()}},th(N),h],stateAttributesMapping:Hg});return n.jsx(Jg,{context:D,openInteractionType:C,modal:U,disabled:!R||T===Qn,initialFocus:P,returnFocus:f,restoreFocus:"popup",previousFocusableElement:wn(O)?O:void 0,nextFocusableElement:m.context.triggerFocusTargetRef,beforeContentFocusGuardRef:m.context.beforeContentFocusGuardRef,children:n.jsx(QQ.Provider,{value:b,children:q})})});function $p({...e}){return n.jsx(UQ,{"data-slot":"popover",...e})}function Bp({...e}){return n.jsx(qQ,{"data-slot":"popover-trigger",...e})}function Vp({className:e,align:t="center",alignOffset:r=0,side:a="bottom",sideOffset:i=4,...c}){return n.jsx(KQ,{children:n.jsx(WQ,{align:t,alignOffset:r,side:a,sideOffset:i,className:"isolate z-50",children:n.jsx(JQ,{"data-slot":"popover-content",className:js("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c})})})}function Ww(e){return Ct(e.defaultTagName??"div",e,e)}const ay=768;function eZ(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const r=window.matchMedia(`(max-width: ${ay-1}px)`),a=()=>{t(window.innerWidth<ay)};return r.addEventListener("change",a),t(window.innerWidth<ay),()=>r.removeEventListener("change",a)},[]),!!e}const tZ="sidebar_state",nZ=3600*24*7,sZ="16rem",rZ="18rem",oZ="3rem",aZ="b",SD=x.createContext(null);function Qw(){const e=x.useContext(SD);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function iZ({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:i,children:c,...u}){const f=eZ(),[h,m]=x.useState(!1),[p,g]=x.useState(e),b=t??p,v=x.useCallback(N=>{const E=typeof N=="function"?N(b):N;r?r(E):g(E),document.cookie=`${tZ}=${E}; path=/; max-age=${nZ}`},[r,b]),w=x.useCallback(()=>f?m(N=>!N):v(N=>!N),[f,v,m]);x.useEffect(()=>{const N=E=>{E.key===aZ&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[w]);const C=b?"expanded":"collapsed",S=x.useMemo(()=>({state:C,open:b,setOpen:v,isMobile:f,openMobile:h,setOpenMobile:m,toggleSidebar:w}),[C,b,v,f,h,m,w]);return n.jsx(SD.Provider,{value:S,children:n.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":sZ,"--sidebar-width-icon":oZ,...i},className:Ve("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...u,children:c})})}function lZ({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:a,children:i,dir:c,...u}){const{isMobile:f,state:h,openMobile:m,setOpenMobile:p}=Qw();return r==="none"?n.jsx("div",{"data-slot":"sidebar",className:Ve("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...u,children:i}):f?n.jsx(Lo,{open:m,onOpenChange:p,...u,children:n.jsxs(la,{dir:c,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":rZ},side:e,children:[n.jsxs(ca,{className:"sr-only",children:[n.jsx(ua,{children:"Sidebar"}),n.jsx(da,{children:"Displays the mobile sidebar."})]}),n.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):n.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":h,"data-collapsible":h==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[n.jsx("div",{"data-slot":"sidebar-gap",className:Ve("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),n.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:Ve("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...u,children:n.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:i})})]})}function cZ({className:e,onClick:t,...r}){const{toggleSidebar:a}=Qw();return n.jsxs(le,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:Ve(e),onClick:i=>{t==null||t(i),a()},...r,children:[n.jsx(j8,{}),n.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function uZ({className:e,...t}){return n.jsx("main",{"data-slot":"sidebar-inset",className:Ve("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function dZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ve("flex flex-col gap-2 p-2",e),...t})}function fZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ve("flex flex-col gap-2 p-2",e),...t})}function hZ({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ve("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function YE({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ve("relative flex w-full min-w-0 flex-col p-2",e),...t})}function KE({className:e,render:t,...r}){return Ww({defaultTagName:"div",props:Qs({className:Ve("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},r),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function XE({className:e,...t}){return n.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Ve("w-full text-sm",e),...t})}function WE({className:e,...t}){return n.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ve("flex w-full min-w-0 flex-col gap-0",e),...t})}function QE({className:e,...t}){return n.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ve("group/menu-item relative",e),...t})}const mZ=If("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function I1({render:e,isActive:t=!1,variant:r="default",size:a="default",tooltip:i,className:c,...u}){const{isMobile:f,state:h}=Qw(),m=Ww({defaultTagName:"button",props:Qs({className:Ve(mZ({variant:r,size:a}),c)},u),render:i?n.jsx(va,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:t}});return i?(typeof i=="string"&&(i={children:i}),n.jsxs(ba,{children:[m,n.jsx(ya,{side:"right",align:"center",hidden:h!=="collapsed"||f,...i})]})):m}const pZ=If("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function gZ({className:e,variant:t="default",render:r,...a}){return Ww({defaultTagName:"span",props:Qs({className:Ve(pZ({variant:t}),e)},a),render:r,state:{slot:"badge",variant:t}})}const ND=x.createContext(null),Zw=()=>x.useSyncExternalStore(en.subscribe,en.getSnapshot);function xZ({children:e}){const t=Zw(),[r,a]=x.useState(null),i=x.useRef(!1);x.useEffect(()=>{(r==="usage"||r==="usage-details")&&(!t.available||t.sharing!==null)?a(null):t.available&&t.sharing===null&&!r&&!i.current&&!window.location.hash.startsWith("#terminal/")&&(i.current=!0,a("usage"))},[t.available,t.sharing,r]),x.useEffect(()=>{const m=()=>en.refresh();return window.addEventListener("storage",m),window.addEventListener("focus",m),()=>{window.removeEventListener("storage",m),window.removeEventListener("focus",m)}},[]);const c=x.useCallback((m="settings")=>a(m),[]);function u(m,p=!0){!m&&p?en.declineSharing():en.setSharing(m),a(null)}function f(){r==="usage-details"?a("usage"):r==="usage"?u(!1,!1):a(null)}const h=r==="details"||r==="usage-details";return n.jsxs(ND.Provider,{value:c,children:[e,n.jsx(tn,{open:!!r,onOpenChange:m=>{m||f()},children:n.jsx(nn,{className:h?"flex max-h-[calc(100dvh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-lg":"sm:max-w-sm",children:r==="usage"?n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Help improve OpenRod"}),n.jsx(Sn,{children:"Share anonymous usage data with us? Declining sends one anonymous count, then stops usage sharing."})]}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(le,{type:"button",size:"sm",variant:"outline",onClick:()=>u(!1),children:"Don’t send data"}),n.jsx(le,{type:"button",size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:"Share"})]}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>a("usage-details"),children:"What do you collect?"})]}):r==="settings"?n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Usage and feedback"}),n.jsx(Sn,{children:"Anonymous usage data helps us improve OpenRod."})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",role:"status",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"Usage sharing"}),n.jsx(gZ,{variant:t.available&&t.sharing?"secondary":"outline",children:t.available&&t.sharing?"On":"Off"})]}),t.available&&(t.sharing?n.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(!1),children:"Turn off"}):n.jsx(le,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:"Share"}))]}),!t.available&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage sharing and feedback are turned off for this console."}),n.jsxs("div",{className:"flex flex-wrap gap-2 border-t pt-3",children:[n.jsx(le,{size:"sm",variant:"outline",onClick:()=>a("feedback"),children:"Give feedback"}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>c("details"),children:"What do you collect?"})]})]}):h?n.jsx(vZ,{onClose:f}):r==="feedback"?n.jsx(yZ,{canSend:t.available,onClose:()=>a(null)}):null})})]})}function bZ(){const e=x.useContext(ND);return e?n.jsxs(I1,{size:"sm",className:"text-muted-foreground",onClick:()=>e(),children:[n.jsx(h8,{"aria-hidden":"true"}),"Usage & feedback"]}):null}function vZ({onClose:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(sn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[n.jsx(Qt,{children:"What we collect"}),n.jsx(Sn,{className:"sr-only",children:"What usage sharing sends"})]}),n.jsxs("div",{className:"grid gap-3 px-5 py-4 text-xs leading-relaxed",children:[n.jsxs("ul",{className:"grid list-disc gap-1 pl-4",children:[n.jsx("li",{children:"Which features you use and whether they work"}),n.jsx("li",{children:"Your OpenRod version and approximate location (country, city)"}),n.jsx("li",{children:"A random ID, never your name or account"})]}),n.jsx("p",{className:"text-muted-foreground",children:"Choosing “Don’t send data” or “Turn off” sends one anonymous choice event, without a saved ID or location. Closing this prompt sends nothing."}),n.jsx("p",{className:"text-muted-foreground",children:"Never your commands, files, terminal output, names, paths or credentials. Change this anytime in Usage & feedback."})]}),n.jsx(Hr,{className:"mx-0 mb-0 shrink-0 rounded-none px-5 py-3",children:n.jsx(le,{type:"button",size:"sm",variant:"outline",onClick:e,children:"Done"})})]})}function yZ({canSend:e,onClose:t}){const[r,a]=x.useState(""),[i,c]=x.useState(!1),u=x.useId(),f=()=>{try{navigator.clipboard.writeText(r).then(()=>He.success("Copied"),()=>{})}catch{}};function h(m){if(m.preventDefault(),!en.submitFeedback({prompt:"general",category:"general",text:r})){c(!0);return}He.success("Thanks for the feedback"),t()}return n.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Give feedback"}),n.jsx(Sn,{children:"Sent to the OpenRod team through PostHog. Leave out private details."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${u}-text`,children:"Feedback"}),n.jsx(Hu,{id:`${u}-text`,value:r,onChange:m=>{a(m.target.value),c(!1)},maxLength:2e3,rows:4})]}),e?i&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Couldn’t send it right now. Copy your text, or try again."}):n.jsx("p",{className:"text-xs text-muted-foreground",children:"Feedback is turned off for this console. Copy your text to share it another way."}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),n.jsx(le,{type:"button",variant:"outline",size:"sm",disabled:!r.trim(),onClick:f,children:"Copy text"}),n.jsx(le,{type:"submit",size:"sm",disabled:!e||!r.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:"Send feedback"})]})]})}const wZ=[{label:"Sandboxes",icon:hc,view:"sandboxes"},{label:"Templates",icon:a8,view:"templates"},{label:"MCPs & Skills",icon:t2,view:"setups"},{label:"Activity",icon:cL,view:"activity"},{label:"Connections",icon:NL,view:"connections"}],jZ=[{label:"Groups",icon:Xa,view:"groups"},{label:"Network",icon:Ig,view:"egress",also:["ingress"]},{label:"Secrets",icon:zu,view:"secrets"}],ZE={live:{label:"Live",dot:"bg-emerald-500"},connecting:{label:"Connecting",dot:"bg-amber-400"},reconnecting:{label:"Reconnecting",dot:"bg-amber-400"},"gateway-down":{label:"Unreachable",dot:"bg-red-500"},"setup-required":{label:"Not connected",dot:"bg-muted-foreground"}};function SZ({view:e,onNavigate:t}){const{connection:r,overview:a}=oi(),i=ZE[r]??ZE.connecting,c=a==null?void 0:a.gateway;return n.jsxs(lZ,{collapsible:"offcanvas",className:"border-r border-sidebar-border",children:[n.jsx(dZ,{className:"h-14 shrink-0 justify-center px-6 py-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"sidebar-icon-hover inline-flex shrink-0",children:n.jsx("img",{src:"/openrod.png",alt:"","aria-hidden":"true",className:"sidebar-icon size-9 object-contain"})}),n.jsxs("span",{className:"flex flex-col leading-none",children:[n.jsx("span",{className:"sidebar-wordmark text-lg font-normal tracking-tight whitespace-nowrap",children:"OpenRod"}),n.jsx("span",{className:"mt-0.5 text-[10px] whitespace-nowrap text-muted-foreground",children:"for OpenShell"})]})]})}),n.jsxs(hZ,{className:"px-3 pt-4",children:[n.jsxs(YE,{className:"p-0",children:[n.jsx(KE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Environment"}),n.jsx(XE,{children:n.jsx(WE,{children:wZ.map(({label:u,icon:f,view:h})=>n.jsx(QE,{children:n.jsxs(I1,{isActive:e===h,onClick:()=>t(h),children:[n.jsx(f,{}),u]})},h))})})]}),n.jsxs(YE,{className:"p-0 pt-4",children:[n.jsx(KE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Security"}),n.jsx(XE,{children:n.jsx(WE,{children:jZ.map(({label:u,icon:f,view:h,also:m=[]})=>n.jsx(QE,{children:n.jsxs(I1,{isActive:e===h||m.includes(e),onClick:()=>t(m.includes(e)?e:h),children:[n.jsx(f,{}),u]})},h))})})]})]}),n.jsxs(fZ,{className:"border-t border-sidebar-border p-4",children:[n.jsx(bZ,{}),n.jsx(_Q,{}),n.jsxs($p,{children:[n.jsxs(Bp,{className:"flex w-full items-center gap-2 rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring","aria-label":"Gateway details",children:[n.jsxs("span",{className:"relative flex size-1.5 shrink-0","aria-hidden":"true",children:[r==="live"&&n.jsx("span",{className:"absolute inline-flex size-full rounded-full bg-emerald-400/55 motion-safe:animate-ping"}),n.jsx("span",{className:`relative inline-flex size-1.5 rounded-full ${i.dot}`})]}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:(c==null?void 0:c.name)??"Gateway"}),n.jsxs("span",{className:"block truncate font-mono text-[10px] text-muted-foreground",children:[i.label,c!=null&&c.version?` · v${c.version}`:""]})]})]}),n.jsxs(Vp,{side:"top",align:"start",sideOffset:10,className:"w-64 gap-3 p-4",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium",children:[n.jsx("span",{className:`size-1.5 rounded-full ${(c==null?void 0:c.status)==="healthy"?"bg-emerald-500":"bg-red-500"}`,"aria-hidden":"true"}),c?c.status==="healthy"?"Healthy":c.status:r==="setup-required"?"No connection selected":a!=null&&a.error?"Unreachable":"Reading…"]}),c?n.jsx("dl",{className:"grid gap-2.5",children:[["Endpoint",c.endpoint,!0],["Authentication",c.authMode==="mtls"?"mTLS":c.authMode],["Runtime",c.drivers.map(u=>`${u.driver}${u.version?` ${u.version}`:""}`).join(", ")||"-",!0],["Registration",c.remote?"Remote":"Local / tunnel endpoint"]].map(([u,f,h])=>n.jsxs("div",{children:[n.jsx("dt",{className:"text-[10px] text-muted-foreground",children:u}),n.jsx("dd",{className:`break-all ${h?"font-mono text-[11px]":"text-xs"}`,children:f})]},u))}):a!=null&&a.error?n.jsx("p",{className:"font-mono text-[10px] text-muted-foreground",children:a.error}):null,n.jsx(NZ,{})]})]})]})]})}function NZ(){const[e,t]=x.useState(null),[r,a]=x.useState(!1),[i,c]=x.useState(null);if(x.useEffect(()=>{let f=!0;return cs.connections().then(h=>{f&&t(h.active)}).catch(()=>{}),()=>{f=!1}},[]),!e||e.status!=="connected")return null;async function u(){a(!0),c(null);try{await cs.disconnectRemote(),t(null)}catch(f){c(f.message)}finally{a(!1)}}return n.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx($f,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:e.host}),n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:"SSH machine · connected"})]}),n.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:r,onClick:u,children:r?"Disconnecting…":"Disconnect"})]}),i&&n.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:i})]})}const CZ=864e5;function kZ(e,t,r){const a=e.map(f=>Date.parse(f.createdAt)).filter(Number.isFinite).sort((f,h)=>f-h),i=e.length-a.length,c=[];let u=0;for(let f=t-1;f>=0;f--){const h=r-f*CZ;for(;u<a.length&&a[u]<=h;)u++;c.push({at:h,count:u+i})}return c}const TZ=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});function EZ({points:e,height:t=34,title:r}){const a=x.useRef(null),i=x.useId(),c=Zs(),[u,f]=x.useState(280),[h,m]=x.useState(null);x.useLayoutEffect(()=>{const A=a.current;if(!A)return;const M=()=>f(A.clientWidth);M();const R=new ResizeObserver(M);return R.observe(A),()=>R.disconnect()},[]);const p=Math.max(4,Math.round(t*.18)),g=e.map(A=>A.count),b=Math.max(1,...g),v=A=>(e.length<2?u-12:A/(e.length-1)*(u-12))+6,w=A=>t-p-A/b*(t-p*2),C=C4(g.map((A,M)=>[v(M),w(A)])),S=`${C} L${v(e.length-1).toFixed(2)} ${t} L${v(0).toFixed(2)} ${t} Z`,N=h===null?null:e[h],E=g[0]??0,k=g[g.length-1]??0;return n.jsxs("div",{className:"relative w-full",onMouseLeave:()=>m(null),onMouseMove:A=>{const M=A.currentTarget.getBoundingClientRect(),R=(A.clientX-M.left)/Math.max(1,M.width);m(Math.min(e.length-1,Math.max(0,Math.round(R*(e.length-1)))))},children:[n.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:N?n.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[TZ(N.at)," · ",N.count.toLocaleString("en-US")," ",N.count===1?"box":"boxes"]}):r}),n.jsx("div",{ref:a,className:"w-full",children:n.jsxs("svg",{width:u,height:t,role:"img","aria-label":`${E} boxes ${e.length} days ago, ${k} now`,children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),n.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),n.jsx("path",{d:S,fill:`url(#${i})`}),n.jsx(In.path,{d:C,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:c?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),N&&n.jsxs("g",{children:[n.jsx("line",{x1:v(h),x2:v(h),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),n.jsx("circle",{cx:v(h),cy:w(g[h]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}const RZ=e=>e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"",AZ={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},MZ=e=>e?AZ[e]??e:null;function OZ({event:e,dense:t=!1,showSandbox:r=!1}){var i;const a=e.verdict==="denied";return n.jsxs("div",{className:`flex items-center gap-3 border-b border-border/50 px-3 font-mono text-[11px] last:border-b-0 ${t?"h-[26px]":"h-[30px] px-4"} ${a?"bg-red-50/40":""}`,title:e.message,children:[n.jsx("span",{className:"w-[4.5rem] shrink-0 tabular-nums text-muted-foreground",children:RZ(e.at)}),n.jsx("span",{className:`w-12 shrink-0 text-[10px] font-medium tracking-wide uppercase ${a?"text-red-600":"text-emerald-700"}`,children:a?"Denied":"Allowed"}),r&&n.jsx("span",{className:"hidden w-24 shrink-0 truncate text-muted-foreground md:block",children:e.sandbox}),!t&&n.jsx("span",{className:"hidden w-20 shrink-0 truncate text-muted-foreground lg:block",children:e.binary?e.binary.split("/").pop():e.category==="HTTP"?e.method:"-"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[e.method&&t?`${e.method} `:"",e.destination??e.detail]}),!t&&n.jsx("span",{className:"hidden w-56 shrink-0 truncate text-right text-[10px] text-muted-foreground xl:block",children:a?MZ(e.reason):(i=e.policy)==null?void 0:i.replace(/^_provider_/,"provider · ")})]})}function DZ({children:e,className:t,variant:r="outline",size:a="sm"}){return n.jsx(Fu,{delay:200,children:n.jsxs(ba,{children:[n.jsxs(va,{render:n.jsx(le,{type:"button",variant:r,size:a,disabled:!0,focusableWhenDisabled:!0,className:Ve("cursor-not-allowed opacity-50",t)}),children:[e,n.jsxs("span",{className:"sr-only",children:[" ",bk]})]}),n.jsx(ya,{side:"bottom",className:"max-w-60",children:bk})]})})}function CD(e=[],t){const r=Mw(t);return e.filter(a=>!a.appliesTo.everyone&&a.appliesTo.groups.some(i=>r.includes(i)))}function Jw(){const[e,t]=x.useState(null),[r,a]=x.useState(""),i=x.useRef(null),c=x.useRef(!0),u=x.useCallback((p,g,b=!0)=>{const v=i.current;v&&(i.current=null,v.cleanup(),b&&t(null),g?v.reject(g):v.resolve(p))},[]),f=x.useCallback(()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError")),[u]);x.useEffect(()=>(c.current=!0,()=>{c.current=!1,u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"),!1)}),[u]);const h=x.useCallback(async(p,g,b)=>{b==null||b.throwIfAborted();const v=await p.org();if(!c.current)throw new DOMException("Workspace transfer cancelled.","AbortError");b==null||b.throwIfAborted();const w=(v.groups??[]).filter(C=>CD(v.policies??[],[C.id]).length>0);if(!w.length)throw new Error(`Add a group with a network rule in ${g} before copying this workspace.`);if(w.length!==1){if(i.current)throw new Error("Finish the current workspace transfer first.");return a(""),t({groups:w,label:g}),new Promise((C,S)=>{const N=()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"));i.current={resolve:C,reject:S,cleanup:()=>b==null?void 0:b.removeEventListener("abort",N)},b==null||b.addEventListener("abort",N,{once:!0}),b!=null&&b.aborted&&N()})}},[u]),m=n.jsx(tn,{open:!!e,onOpenChange:p=>{p||f()},children:n.jsxs(nn,{className:"sm:max-w-md",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Choose a destination group"}),n.jsxs(Sn,{children:["The copied sandbox inherits this group’s network rules in ",e==null?void 0:e.label,"."]})]}),n.jsxs(pn,{"aria-label":"Destination sandbox group",value:r,onChange:p=>a(p.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm",children:[n.jsx("option",{value:"",children:"Choose a group"}),e==null?void 0:e.groups.map(p=>n.jsx("option",{value:p.id,children:p.name},p.id))]}),n.jsxs(Hr,{children:[n.jsx(le,{variant:"ghost",onClick:f,children:"Cancel"}),n.jsx(le,{disabled:!(e!=null&&e.groups.some(p=>p.id===r)),onClick:()=>u([r]),children:"Copy workspace"})]})]})});return{chooseGroups:h,dialog:m,cancel:f}}const Rg="http://127.0.0.1:4600",zZ=e=>`${Rg}/?handoff=cloud&target=local#cloud-return=${encodeURIComponent(e)}`;function JE(e,t,r,a){var i;return!!(t&&e.source===t&&e.origin===Rg&&((i=e.data)==null?void 0:i.type)===a&&e.data.nonce===r)}function IZ({name:e,sandbox:t}){const r=Pt(),a=ds(),i=gn(),{refresh:c}=vo(),{chooseGroups:u,dialog:f}=Jw(),h=x.useRef(null);x.useEffect(()=>()=>{var b;return(b=h.current)==null?void 0:b.abort()},[]);const[m,p]=x.useState(null);async function g(){if(m||(i==null?void 0:i.connected)===!1)return;const b=new AbortController;h.current=b;const v=r.signal?AbortSignal.any([r.signal,b.signal]):b.signal;p("signin");try{await a.prepare({signal:v,onProgress:()=>p("prepare")});const w=lr("cloud",v);p("groups");const C=await u(w,"cloud",v);p("transfer");const S=await HA(lr(r.target,v,i==null?void 0:i.context),w,e,C);v.throwIfAborted(),He.success("Workspace ready in cloud",{description:S.warning||"Reconnect your agent credentials to continue."});const N=await w.contextKey();try{sessionStorage.setItem("gateway-box",JSON.stringify({name:S.name,context:N,target:"cloud"}))}catch{}c(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:S.name,context:N,target:"cloud"}}))}catch(w){w.name!=="AbortError"&&He.error("Couldn’t continue in cloud",{description:w.message})}finally{b.signal.aborted||p(null),h.current===b&&(h.current=null)}}return(t==null?void 0:t.phase)!=="ready"?null:a!=null&&a.available?n.jsxs("div",{className:"flex items-center gap-1",children:[f,n.jsxs(le,{variant:"outline",size:"sm",className:"flex-1 justify-start text-xs",disabled:!!m||(i==null?void 0:i.connected)===!1,onClick:g,children:[m?n.jsx(Nt,{className:"size-3.5"}):n.jsx(Kp,{className:"size-3.5","aria-hidden":"true"}),m==="signin"?"Sign in to cloud…":m==="prepare"?"Preparing cloud machine…":m==="groups"?"Choose destination group…":m==="transfer"?"Copying and rebuilding…":"Continue in cloud"]}),n.jsx(Fu,{delay:200,children:n.jsxs(ba,{children:[n.jsx(va,{render:n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Du,{className:"size-3.5","aria-hidden":"true"})}),n.jsx(ya,{side:"bottom",className:"max-w-60",children:"Copies workspace files and rebuilds saved templates. Your local source stays available. Credential files are excluded; reconnect agents in cloud."})]})})]}):n.jsxs(DZ,{className:"w-full justify-start text-xs",children:[n.jsx(Kp,{className:"size-3.5","aria-hidden":"true"}),"Continue in cloud"]})}function PZ({name:e,sandbox:t}){const r=Pt(),a=ds(),i=gn(),{locations:c,refresh:u}=vo(),{chooseGroups:f,dialog:h}=Jw(),m=x.useRef(null);x.useEffect(()=>()=>{var w;return(w=m.current)==null?void 0:w.abort()},[]);const[p,g]=x.useState(null),b=x.useRef(null);if(x.useEffect(()=>{let w=!0;const C=async N=>{const E=b.current;if(E){if(JE(N,E.popup,E.nonce,"openrod-local-result")&&E.accepted){if(w){if(typeof N.data.error=="string")He.error("Couldn’t continue locally",{description:N.data.error});else if(typeof N.data.name=="string")He.success("Workspace ready locally",{description:N.data.warning||E.warning||"Reconnect your agent credentials locally to continue."});else return;g(null)}b.current=null;return}if(!(E.accepted||!JE(N,E.popup,E.nonce,"openrod-local-ready"))){E.accepted=!0,g("transfer");try{const k=await r.cloudExport(E.name);E.warning=k.warning,E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,bundle:k.bundle,warning:k.warning},Rg)}catch(k){E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,error:k.message},Rg),b.current===E&&(b.current=null),w&&(g(null),He.error("Couldn’t continue locally",{description:k.message}))}}}};window.addEventListener("message",C);const S=setInterval(()=>{const N=b.current;N&&(N.popup.closed||Date.now()>N.expires)&&(b.current=null,g(null),N.popup.closed||He.error("Local transfer timed out. Try again."))},1e3);return()=>{w=!1,window.removeEventListener("message",C),clearInterval(S),b.current=null}},[e,r]),(t==null?void 0:t.phase)!=="ready")return null;async function v(){if(p||(i==null?void 0:i.connected)===!1)return;const w=c.find(N=>N.target!=="cloud"&&!N.remote&&N.connected);if(!w){He.error("Connect a local gateway before importing this workspace.");return}const C=new AbortController;m.current=C;const S=r.signal?AbortSignal.any([r.signal,C.signal]):C.signal;g("transfer");try{const N=lr("local",S,w.context);g("groups");const E=await f(N,"local OpenRod",S);g("transfer");const k=await d7(lr(r.target,S,i==null?void 0:i.context),N,e,E);S.throwIfAborted(),He.success("Workspace running locally",{description:k.warning||"Your cloud source is unchanged. Reconnect agent credentials locally."});try{sessionStorage.setItem("gateway-box",JSON.stringify({name:k.name,context:w.context,target:"local"}))}catch{}u(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:k.name,context:w.context,target:"local"}}))}catch(N){N.name!=="AbortError"&&He.error("Couldn’t import locally",{description:N.message})}finally{C.signal.aborted||g(null),m.current===C&&(m.current=null)}}return a!=null&&a.localViewer&&!a.available?null:n.jsxs("div",{className:"flex items-center gap-1",children:[h,n.jsxs(le,{variant:"outline",size:"sm",className:"flex-1 justify-start text-xs",disabled:!!p||(i==null?void 0:i.connected)===!1,onClick:()=>{if(a!=null&&a.localViewer){v();return}const w=crypto.randomUUID(),C=window.open(zZ(w),"_blank");if(!C){He.error("Allow popups to continue locally.");return}b.current={popup:C,nonce:w,name:e,accepted:!1,expires:Date.now()+40*6e4},g("connect")},children:[p?n.jsx(Nt,{className:"size-3.5"}):n.jsx(e2,{className:"size-3.5","aria-hidden":"true"}),p==="connect"?"Connecting to local OpenRod…":p==="groups"?"Choose destination group…":p==="transfer"?"Copying and rebuilding…":"Import and run locally"]}),n.jsx(Fu,{delay:200,children:n.jsxs(ba,{children:[n.jsx(va,{render:n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:n.jsx(Du,{className:"size-3.5","aria-hidden":"true"})}),n.jsxs(ya,{side:"bottom",className:"max-w-60",children:[a!=null&&a.localViewer?"Creates a separate local sandbox, copies files and rebuilds the image for this computer. Your cloud source stays available.":"Open OpenRod on this computer first. Creates a local sandbox, copies files and rebuilds saved templates."," Reconnect agents locally."]})]})})]})}const Ba="/sandbox",eR=1024**3;function br(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let r=e/1024,a=0;for(;r>=1024&&a<t.length-1;)r/=1024,a++;return`${r>=10?Math.round(r):r.toFixed(1)} ${t[a]}`}function Ou(e){return/^[\w@%+=:,./~-]+$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}const kD=e=>e.startsWith("~/")?`~/${Ou(e.slice(2))}`:Ou(e),P1=(e,t,r=Ba)=>`openshell sandbox upload ${Ou(e)} ${kD(t)} ${Ou(r)}`,_Z=(e,t,r=".")=>`openshell sandbox download ${Ou(e)} ${Ou(t)} ${kD(r)}`,Up=new Set(["waiting","uploading","cloning"]),LZ=(e,t)=>e==="/"?`/${t}`:`${e}/${t}`,op=e=>e.type==="dir"||e.targetType==="dir";function $Z(e){const t=[...e.items??[]].map(r=>{var a;return(a=r.webkitGetAsEntry)==null?void 0:a.call(r)}).filter(Boolean);return t.length?t:[...e.files]}async function BZ(e){const t=[];async function r(a,i){if(a instanceof window.File){t.push({path:a.name,file:a});return}if(a.isFile)t.push({path:i+a.name,file:await new Promise((c,u)=>a.file(c,u))});else if(a.isDirectory){const c=a.createReader();for(;;){const u=await new Promise((f,h)=>c.readEntries(f,h));if(!u.length)break;for(const f of u)await r(f,`${i}${a.name}/`)}}}for(const a of e)await r(a,"");return t}function VZ({seed:e,onRetry:t}){if(!e)return null;const r=e.kind==="folder"?"Uploading":"Cloning";return Up.has(e.state)?n.jsxs("p",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-5 py-2 text-xs",children:[n.jsx(Nt,{"aria-hidden":"true"}),e.state==="waiting"?"Waiting for the sandbox to start, then "+r.toLowerCase():r,n.jsx("span",{className:"min-w-0 truncate font-mono text-[11px]",children:e.source}),"→",n.jsx("span",{className:"font-mono text-[11px]",children:e.dest})]}):e.state==="failed"?n.jsxs("div",{role:"alert",className:"flex items-start gap-3 border-b border-red-200 bg-red-50/60 px-5 py-2.5 text-xs text-red-700",children:[n.jsx(ti,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("p",{className:"font-medium",children:[e.kind==="folder"?"Upload":"Clone"," of ",n.jsx("span",{className:"font-mono text-[11px]",children:e.source})," failed"]}),n.jsx("p",{className:"mt-0.5 text-[11px]",children:e.error})]}),n.jsx(le,{variant:"outline",size:"sm",onClick:t,className:"shrink-0",children:"Retry"})]}):n.jsxs("p",{className:"flex items-center gap-2 border-b border-border px-5 py-2 text-[11px] text-muted-foreground",children:[n.jsx(WL,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Started from ",n.jsx("span",{className:"min-w-0 truncate font-mono",children:e.source}),e.files!=null&&n.jsxs("span",{children:["· ",e.files.toLocaleString()," files, ",br(e.bytes)]}),n.jsxs("span",{children:["→ ",n.jsx("span",{className:"font-mono",children:e.dest})]})]})}function UZ(e){const t=gn();return n.jsx(HZ,{...e},`${(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default"}:${e.sandbox.name}`)}function HZ({sandbox:e,demo:t}){const r=Pt(),a=gn(),i=e.name,c=e.phase==="ready",u=eK(e),[f,h]=x.useState(u?`${Ba}/${u}`:Ba),[m,p]=x.useState(null),[g,b]=x.useState(null),[v,w]=x.useState(!1),[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),[M,R]=x.useState(null),[T,O]=x.useState(null),D=x.useRef(null),B=x.useCallback(async z=>{w(!0);try{const L=await r.files(i,z);p(L),b(null),L.path!==z&&h(L.path)}catch(L){if(z!==Ba&&/does not exist/.test(L.message)){h(Ba);return}b(L.message)}finally{w(!1)}},[i,r]);x.useEffect(()=>{c&&!t&&B(f)},[f,c,t,B]);const F=C==null?void 0:C.state;x.useEffect(()=>{if(t)return;let z=!1,L;const X=async()=>{try{const ee=await r.seed(i);if(z)return;S(ee),ee&&Up.has(ee.state)&&(L=setTimeout(X,2e3))}catch{}};return(!C||Up.has(F))&&X(),()=>{z=!0,clearTimeout(L)}},[i,t,F,r]);const K=x.useRef(null);x.useEffect(()=>{if(Up.has(K.current)&&F==="done"&&c){const z=u?`${Ba}/${u}`:f;z!==f?h(z):B(f)}K.current=F},[F]);async function $(){try{S(await r.retrySeed(i))}catch(z){He.error(z.message)}}async function P(z,L){O(z);const X=He.loading(`Preparing ${L}…`);try{const{token:ee,filename:_,bytes:V}=await r.prepareDownload(i,z),G=document.createElement("a");G.href=r.url(`/downloads/${ee}`,{context:await r.contextKey(),...a?{location:"1"}:{}}),G.download=_,document.body.append(G),G.click(),G.remove(),He.success(`Downloading ${_}`,{id:X,description:br(V)})}catch(ee){He.error(ee.message,{id:X})}finally{O(null)}}function U(z){if(!z.length){He.error("Nothing to upload. Empty folders are skipped.");return}const L=z.reduce((V,G)=>V+G.file.size,0);if(L>eR){He.error(`That is ${br(L)}; the console uploads up to ${br(eR)}.`,{description:`From a terminal: ${P1(i,"./my-files",f)}`});return}if(m&&L>m.free){He.error(`The sandbox has ${br(m.free)} free; this is ${br(L)}.`);return}const ee=[...new Set(z.map(V=>V.path.split("/")[0]))].filter(V=>m==null?void 0:m.entries.some(G=>G.name===V)),_={files:z,bytes:L,dir:f,taken:ee};ee.length?R(_):H(_)}async function H({files:z,bytes:L,dir:X}){R(null);const ee=new AbortController;let _;A({done:0,total:z.length,sent:0,bytes:L,committing:!1,controller:ee});try{({id:_}=await r.startUpload(i));let V=0;await Promise.all(Array.from({length:Math.min(4,z.length)},async()=>{for(;V<z.length&&!ee.signal.aborted;){const Y=z[V++];try{await r.uploadFile(i,_,Y.path,Y.file,ee.signal)}catch(ne){throw ee.abort(),ne}A(ne=>ne&&{...ne,done:ne.done+1,sent:ne.sent+Y.file.size})}})),A(Y=>Y&&{...Y,committing:!0});const G=await r.commitUpload(i,_,X);He.success(`Uploaded ${G.files.toLocaleString()} ${G.files===1?"file":"files"} to ${G.dest}`,{description:br(G.bytes)}),X===f&&B(f)}catch(V){_&&r.cancelUpload(i,_).catch(()=>{}),He.error(ee.signal.aborted&&V.name==="AbortError"?"Upload cancelled.":V.message)}finally{A(null)}}async function W(z){if(z.preventDefault(),E(!1),!c||k)return;const L=$Z(z.dataTransfer);try{U(await BZ(L))}catch(X){He.error(`Could not read the dropped files: ${X.message}`)}}if(t)return n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Files are unavailable for synthetic sandboxes."});const q=f.split("/").filter(Boolean).map((z,L,X)=>({label:z,path:`/${X.slice(0,L+1).join("/")}`})),Z=(m==null?void 0:m.path)===f?m.entries:[];return n.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:z=>{c&&!k&&Array.from(z.dataTransfer.types).includes("Files")&&(z.preventDefault(),E(!0))},onDragLeave:z=>{z.currentTarget.contains(z.relatedTarget)||E(!1)},onDrop:W,children:[n.jsx(VZ,{seed:C,onRetry:$}),n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-5 py-2",children:[n.jsx("nav",{"aria-label":"Folder",className:"flex min-w-0 flex-1 items-center gap-0.5 font-mono text-[11px]",children:q.map((z,L)=>n.jsxs(x.Fragment,{children:[L>0&&n.jsx(Lr,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),L===q.length-1?n.jsx("span",{className:"truncate px-1 text-foreground","aria-current":"page",children:z.label}):n.jsx("button",{type:"button",onClick:()=>h(z.path),className:"truncate rounded px-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:z.label})]},z.path))}),m&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[br(m.free)," free"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh",disabled:!c||v,onClick:()=>B(f),children:n.jsx(rl,{className:v?"animate-spin":void 0,"aria-hidden":"true"})}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!c||!!T,onClick:()=>P(f,`${f.split("/").pop()}.tar.gz`),children:[T===f?n.jsx(Nt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"}),"Download folder"]}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!c||!!k,onClick:()=>{var z;return(z=D.current)==null?void 0:z.click()},children:[n.jsx(e7,{"aria-hidden":"true"}),"Upload"]}),n.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,onChange:z=>{const L=[...z.target.files].map(X=>({path:X.name,file:X}));z.target.value="",U(L)}})]}),k&&n.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border bg-muted/30 px-5 py-2 text-xs",role:"status",children:[n.jsx(Nt,{"aria-hidden":"true"}),n.jsx("span",{className:"flex-1",children:k.committing?`Sending ${k.total.toLocaleString()} ${k.total===1?"file":"files"} to ${f}…`:`Reading ${k.done.toLocaleString()} of ${k.total.toLocaleString()} files · ${br(k.sent)} of ${br(k.bytes)}`}),!k.committing&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>k.controller.abort(),children:[n.jsx(Pn,{"aria-hidden":"true"}),"Cancel"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:c?g?n.jsx("p",{role:"alert",className:"p-5 text-sm text-destructive",children:g}):m?n.jsxs("ul",{"aria-label":`Files in ${f}`,className:"divide-y divide-border/60",children:[f!==Ba&&n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>h(f.slice(0,f.lastIndexOf("/"))||"/"),className:"flex w-full items-center gap-2 px-5 py-1.5 text-left font-mono text-xs text-muted-foreground hover:bg-muted/50",children:[n.jsx(zk,{className:"size-3.5","aria-hidden":"true"}),".."]})}),Z.map(z=>{const L=LZ(f,z.name),X=z.type==="link"?_A:op(z)?zk:KL,ee=n.jsxs(n.Fragment,{children:[n.jsx(X,{className:`size-3.5 shrink-0 ${op(z)?"text-sky-600":"text-muted-foreground"}`,"aria-hidden":"true"}),n.jsx("span",{className:"truncate",children:z.name}),z.target&&n.jsxs("span",{className:"truncate text-muted-foreground",children:["→ ",z.target]})]});return n.jsxs("li",{className:"group flex items-center gap-3 px-5 py-1 hover:bg-muted/50",children:[op(z)?n.jsx("button",{type:"button",onClick:()=>h(L),className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 text-left font-mono text-xs",children:ee}):n.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 font-mono text-xs",children:ee}),n.jsx("span",{className:"w-16 shrink-0 text-right text-[11px] text-muted-foreground",children:z.size!=null?br(z.size):""}),n.jsx("span",{className:"hidden w-16 shrink-0 text-right text-[11px] text-muted-foreground sm:block",title:z.modifiedAt,children:Lu(z.modifiedAt)}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`Download ${z.name}`,className:"opacity-60 group-hover:opacity-100",disabled:!!T||z.targetType==="missing",onClick:()=>P(L,op(z)?`${z.name}.tar.gz`:z.name),children:T===L?n.jsx(Nt,{"aria-hidden":"true"}):n.jsx(pu,{"aria-hidden":"true"})})]},z.name)}),!Z.length&&n.jsx("li",{className:"px-5 py-3 text-xs text-muted-foreground",children:"This folder is empty. Drop files here to upload them."}),m.truncated&&n.jsxs("li",{className:"px-5 py-2 text-[11px] text-muted-foreground",children:["Showing the first ",Z.length.toLocaleString()," entries."]})]}):n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Loading files…"}):n.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Start the sandbox to browse its files."})}),n.jsxs("div",{className:"shrink-0 space-y-1.5 border-t border-border bg-muted/20 px-5 py-3",children:[n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Drop files or folders anywhere here to upload into this folder. Only /sandbox is reachable; symlinks stay links. From a terminal:"}),n.jsxs("div",{className:"grid gap-1.5 lg:grid-cols-2",children:[n.jsx(uc,{command:P1(i,"./my-files",f)}),n.jsx(uc,{command:_Z(i,f,".")})]})]}),N&&n.jsxs("div",{className:"pointer-events-none absolute inset-2 flex items-center justify-center rounded-lg border-2 border-dashed border-sky-500 bg-background/85 text-sm",children:["Drop to upload into ",n.jsx("span",{className:"ml-1 font-mono",children:f})]}),n.jsx(Fr,{open:!!M,onOpenChange:z=>{z||R(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Replace ",(M==null?void 0:M.taken.length)===1?`“${M.taken[0]}”`:`${M==null?void 0:M.taken.length} items`,"?"]}),n.jsxs(Xr,{children:[(M==null?void 0:M.taken.length)>1&&n.jsxs("span",{className:"mb-2 block font-mono text-[11px]",children:[M.taken.slice(0,6).join(", "),M.taken.length>6?", …":""]}),"Files with the same name in ",M==null?void 0:M.dir," are replaced. Folders are merged: matching files inside are replaced, and nothing is deleted."]})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{onClick:()=>H(M),children:"Replace"})]})]})})]})}function Hp({agent:e={name:"Not reported"}}){return n.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",title:`AI agent: ${e.name}`,children:[e.logo?n.jsx("img",{src:e.logo,alt:"",className:"size-3.5 shrink-0 object-contain"}):n.jsx(MA,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),n.jsx("span",{className:"truncate",children:e.name})]})}function tR({agents:e=[],status:t="Agent inventory not checked"}){return e.length?n.jsx("span",{title:t,className:"flex min-w-0 flex-col items-start gap-1.5",children:e.map(r=>n.jsx(Hp,{agent:r},r.name))}):n.jsx("span",{className:"text-muted-foreground",children:t})}function Yl({title:e,icon:t,children:r,aside:a,className:i}){return n.jsxs("section",{className:i,children:[n.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t&&n.jsx(t,{className:"size-3","aria-hidden":"true"}),e,a&&n.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal",children:a})]}),r]})}function FZ(){const e=Pt(),t=ds(),r=!!(t!=null&&t.nativeActions),[a,i]=x.useState([]);return x.useEffect(()=>{if(!r)return;let c=!1,u,f;const h=()=>{f??(f=e.editors().then(m=>m.filter(p=>p.installed))),f.then(m=>{c||i(m)}).catch(()=>{f=void 0,c||(u=setTimeout(h,3e3))})};return h(),()=>{c=!0,clearTimeout(u)}},[r,e]),a}function GZ({name:e,editors:t,cloud:r,context:a,cursorAgent:i=!1}){var K;const c=Pt(),u=gn(),f=x.useRef(null);function h($){const P=f.current;return f.current=en.startFlow("session_launch",{launch_target:$,location_type:mf(u)},(P==null?void 0:P.outcome)==="failed"&&P.properties.launch_target===$?P:null),f.current}const[m,p]=x.useState(null),[g,b]=x.useState(null),[v,w]=x.useState("ssh"),[C,S]=x.useState(!1),[N,E]=x.useState(!1),[k,A]=x.useState(null);x.useEffect(()=>{if(r)return;let $=!1;return p(null),b(null),w("ssh"),A(null),c.sshConnection(e).then(P=>{$||(p(P),w(P.defaultMode))}).catch(P=>{$||b(P.message)}),()=>{$=!0}},[e,r,c]);const M=(m==null?void 0:m.modes[v])??(m==null?void 0:m.modes.ssh),R=v==="ssh"?"Open SSH in terminal":v==="attach"?"Attach canonical TTY":`New ${((K=u4(M==null?void 0:M.session))==null?void 0:K.toLowerCase())??"session"}`,T=g||(m?m.cliInstalled?m.sshInstalled?m.terminalSupported?null:"Opening a system terminal is supported on macOS and Linux.":"Install OpenSSH to connect.":"Install the openshell CLI to connect.":"Checking connection…");async function O($){const P=h($.id);S(!0);try{await c.openEditor(e,$.id),en.finishFlow(P,"handoff_requested"),He.success(`Opening ${e} in ${$.label}`)}catch(U){en.finishFlow(P,"failed",Cu(U)),He.error(`Couldn’t open ${$.label}`,{description:U.message})}finally{S(!1)}}async function D(){const $=h("terminal");S(!0);try{await c.openSshTerminal(e,v),en.finishFlow($,"handoff_requested"),He.success(v==="ssh"?`Opening SSH to ${e}`:v==="attach"?`Attaching to ${e}`:`Starting a new session in ${e}`)}catch(P){en.finishFlow($,"failed",Cu(P)),He.error("Couldn’t open SSH terminal",{description:P.message})}finally{S(!1)}}async function B(){E(!0);try{A(await c.sshConfig(e))}catch($){He.error("Couldn’t generate SSH config",{description:$.message})}finally{E(!1)}}const F=n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",nativeButton:!1,disabled:!r&&(!(a!=null&&a.name)||!(a!=null&&a.workspace)),render:n.jsx("a",{href:r||a!=null&&a.name&&(a!=null&&a.workspace)?vg(e,void 0,a):void 0,onClick:$=>en.terminalClick($,{location_type:mf(u)}),target:"_blank",rel:"noreferrer"}),children:[n.jsx(J1,{className:"size-3.5"}),"Browser"]});return r?n.jsx(Yl,{title:"Open in",children:n.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:F})}):n.jsxs(n.Fragment,{children:[n.jsxs(Yl,{title:"Open in",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!(m!=null&&m.canOpenTerminal)||C,title:T??R,onClick:D,children:[C?n.jsx(Nt,{className:"size-3.5"}):n.jsx(VA,{className:"size-3.5"}),"Terminal"]}),[...i?[{id:"cursor",label:"Cursor"}]:[],{id:"vscode",label:"VS Code"}].map($=>{const P=t.some(U=>U.id===$.id);return n.jsxs(le,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!P||C,title:P?"Connects over SSH through OpenShell. The first time, OpenShell adds one Include line to ~/.ssh/config.":`${$.label} is not installed.`,onClick:()=>O($),children:[n.jsx("img",{src:`/logos/${$.id}.svg`,alt:"",className:"size-3.5 dark:invert"}),$.label]},$.id)}),F]}),T&&n.jsx("p",{role:g?"alert":"status",className:"mt-2 text-[11px] text-muted-foreground",children:T}),m&&n.jsxs("details",{className:"group mt-2 text-[11px] text-muted-foreground",children:[n.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1 py-1 hover:text-foreground [&::-webkit-details-marker]:hidden",children:[n.jsx(Lr,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":"true"}),"Connection options"]}),n.jsxs("div",{className:"mt-1.5 space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap gap-1 rounded-md bg-muted p-1",children:[n.jsx(le,{type:"button",variant:v==="ssh"?"secondary":"ghost",size:"xs",onClick:()=>w("ssh"),children:"SSH shell"}),n.jsx(le,{type:"button",variant:v==="exec"?"secondary":"ghost",size:"xs",onClick:()=>w("exec"),children:"New session"}),m.modes.attach&&n.jsx(le,{type:"button",variant:v==="attach"?"secondary":"ghost",size:"xs",onClick:()=>w("attach"),children:"Attach"})]}),n.jsx("p",{className:"text-[10px] leading-relaxed",children:v==="ssh"?"Login shell over SSH.":v==="attach"?"Reconnects to the sandbox’s running terminal.":"Starts a separate shell or agent in the sandbox."}),M&&n.jsx(uc,{command:M.command,label:v==="ssh"?`ssh ${M.alias}`:`openshell sandbox ${v==="attach"?"connect":"exec --name"} ${e}`}),m.gateway.remote&&n.jsxs("p",{className:"break-all text-[10px]",children:["Via gateway ",n.jsxs("span",{className:"font-mono",children:[m.gateway.name,"/",m.gateway.workspace]})," at ",n.jsx("span",{className:"font-mono",children:m.gateway.endpoint})]}),n.jsxs(le,{variant:"outline",size:"sm",className:"w-full justify-start text-xs font-normal text-muted-foreground",disabled:!m.cliInstalled||N,onClick:B,children:[N?n.jsx(Nt,{className:"size-3.5"}):n.jsx(V8,{className:"size-3.5"}),"SSH configuration"]})]})]})]}),n.jsx(tn,{open:!!k,onOpenChange:$=>{$||A(null)},children:n.jsxs(nn,{className:"sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["SSH configuration for ",e]}),n.jsx(Sn,{children:"The console does not change ~/.ssh/config. Review and add this Host block yourself, then connect with the command below."})]}),k&&n.jsxs(n.Fragment,{children:[n.jsx("pre",{className:"max-h-[50svh] overflow-auto whitespace-pre rounded-md border bg-muted/30 p-3 font-mono text-[11px]",children:k.config}),n.jsx(uc,{command:k.command}),n.jsx(le,{variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(k.config),He.success("SSH config copied")}catch{He.error("Couldn’t copy SSH config")}},children:"Copy Host block"})]})]})})]})}const qZ={"read-only":"read-only","read-write":"read-write",full:"full",custom:"custom rules",blocked:"blocked"},YZ={secret:"from provider",policy:"network rule",org:"blocked everywhere",group:"inherited",agent:"agent defaults",own:"rule"};function KZ(e){var r;const t=gn();return t&&!((r=e.liveData)!=null&&r.demo)?n.jsx(Rf,{children:n.jsx(nR,{...e,scoped:!0},e.name)},t.id??t.context):n.jsx(nR,{...e},e.name)}function nR({name:e,sandbox:t,onClose:r,onNavigate:a,onChanged:i,liveData:c,scoped:u}){var _,V,G,Y,ne,te,ye;const f=Pt(),h=gn(),m=oi(),p=u?m:c??m,g=ae=>a(ae,h),[b,v]=x.useState(15),[w,C]=x.useState(Date.now);x.useEffect(()=>{const ae=setInterval(()=>C(Date.now()),3e4);return()=>clearInterval(ae)},[]);const[S,N]=x.useState(null),[E,k]=x.useState(null),[A,M]=x.useState(null),[R,T]=x.useState(!1),O=ds(),D=!!(O!=null&&O.nativeActions),B=!!(h!=null&&h.cloud||((h==null?void 0:h.target)??(O==null?void 0:O.target))==="cloud"),F=FZ(),K=((_=p.sandboxes)==null?void 0:_.find(ae=>ae.name===e))??t,$=K?`${K.phase}|${K.policyVersion}`:null;x.useEffect(()=>{if(!e||(h==null?void 0:h.connected)===!1){N(null),k((h==null?void 0:h.error)??null);return}if(N(null),k(null),p.demo)return;let ae=!1,ue,se=3e4;const Q=async()=>{var ie;try{const oe=await f.sandbox(e);ae||(N(oe),k(null),se=(ie=oe.setupJobs)!=null&&ie.some(pe=>pe.status==="waiting")?2e3:3e4)}catch(oe){ae||k(oe.message)}ae||(ue=setTimeout(Q,se))};return Q(),()=>{ae=!0,clearTimeout(ue)}},[e,$,p.demo,f,h==null?void 0:h.connected,h==null?void 0:h.error]);const P=(S==null?void 0:S.name)===e?S:K,U=x.useMemo(()=>p.events.filter(ae=>ae.sandbox===e&&ae.kind==="audit"&&ae.verdict).slice(0,14),[p.events,e]);async function H(ae){var ue;if((h==null?void 0:h.connected)!==!1){M(ae);try{await f.lifecycle(e,ae),He.success(ae==="delete"?`Deleting ${e}`:ae==="stop"?`Stopping ${e}`:`Starting ${e}`),i==null||i(),(ue=p.refresh)==null||ue.call(p),ae==="delete"&&r()}catch(se){He.error(se.message)}finally{M(null),T(!1)}}}const W=x.useMemo(()=>p.events.filter(ae=>ae.sandbox===e),[p.events,e]),q=x.useMemo(()=>k4(W,b,w),[W,b,w]),Z=x.useMemo(()=>{var ue;const ae=new Map;for(const se of((ue=S==null?void 0:S.policy)==null?void 0:ue.rules)??[])for(const Q of se.endpoints)!Q.blocked&&!ae.has(Q.host)&&ae.set(Q.host,{host:Q.host,source:Ya(se.key)});return[...ae.values()]},[S]),z=x.useMemo(()=>{const ae=new Map;for(const ue of W){if(ue.kind!=="audit"||ue.verdict!=="denied")continue;const se=Iw(ue.destination);if(!se)continue;const Q=ae.get(se)??{host:se,count:0};Q.count+=1,ae.set(se,Q)}return[...ae.values()].sort((ue,se)=>se.count-ue.count)},[W]),L=c4(P),X=P==null?void 0:P.phase,ee=((V=S==null?void 0:S.policy)==null?void 0:V.rules)??[];return n.jsxs(n.Fragment,{children:[n.jsx(tn,{open:!!e,onOpenChange:ae=>{ae||r()},children:n.jsxs(nn,{className:"flex! h-[min(900px,94svh)] w-[calc(100%-1.5rem)]! max-w-[1280px]! flex-col gap-0! overflow-hidden p-0!",children:[n.jsxs(sn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-6 gap-y-3",children:[n.jsxs(Qt,{className:"flex min-w-0 items-center gap-2 text-base",children:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.5,className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate",children:e}),n.jsx(ga,{location:h}),X&&n.jsxs("span",{className:"ml-2 flex shrink-0 items-center gap-1.5 text-xs font-normal text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${Za(X).cell}`}),Cg[X]]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:S!=null&&S.policy?Z.length:"-"}),"allowed hosts"]}),n.jsxs("span",{children:[n.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:z.length}),"blocked hosts"]})]})]}),n.jsx(Sn,{className:"sr-only",children:"Sandbox access graph, details, rules, files, and connection activity."})]}),E&&n.jsx("p",{role:"alert",className:"shrink-0 border-b px-5 py-2 text-xs text-destructive",children:E}),P?n.jsxs(nh,{defaultValue:"overview",className:"min-h-0 flex-1 gap-0!",children:[n.jsx("div",{className:"shrink-0 border-b border-border px-5 py-2",children:n.jsxs(sh,{variant:"line","aria-label":"Sandbox information",className:"max-w-full",children:[n.jsx(Pr,{value:"overview",className:"px-3 text-xs",children:"Overview"}),n.jsxs(Pr,{value:"rules",className:"px-3 text-xs",children:["Rules",(S==null?void 0:S.policy)&&n.jsx("span",{className:"text-muted-foreground",children:ee.length})]}),n.jsx(Pr,{value:"setups",className:"px-3 text-xs",children:"MCPs & Skills"}),n.jsx(Pr,{value:"files",className:"px-3 text-xs",children:"Files"}),n.jsx(Pr,{value:"activity",className:"px-3 text-xs",children:"Activity"}),n.jsx(Pr,{value:"details",className:"px-3 text-xs",children:"Details"})]})}),n.jsx(Io,{value:"overview",className:"min-h-0 overflow-y-auto",children:n.jsxs("div",{className:"grid min-h-full grid-cols-1 lg:h-full lg:grid-cols-[minmax(0,1fr)_250px]",children:[n.jsx("div",{className:"flex min-w-0 flex-col p-4 sm:p-5",children:n.jsx(Yl,{title:"Access graph",className:"flex flex-1 flex-col",children:S!=null&&S.policy?n.jsx(jW,{compact:!0,fill:!0,agentStatus:Zv(P),agents:L,name:e,phase:X,allowed:Z,denied:z,owner:df(P,O!=null&&O.connected?O.user:null),gateway:p.demo||(G=p.overview)==null?void 0:G.gateway,secrets:(P.providers??[]).map(ae=>{var ue,se;return((se=(ue=p.overview)==null?void 0:ue.providers)==null?void 0:se.find(Q=>Q.name===ae))??{name:ae}})}):n.jsx("p",{className:"rounded-lg border border-border p-5 text-sm text-muted-foreground",children:p.demo?"Policy data is unavailable for synthetic sandboxes.":E?"The access graph is unavailable because the policy could not be loaded.":S?"No policy was reported by the gateway.":"Loading access graph…"})})}),n.jsxs("aside",{"aria-label":"Sandbox summary",className:"space-y-5 border-t border-border bg-muted/20 p-5 lg:border-t-0 lg:border-l",children:[X==="ready"&&!p.demo&&(h==null?void 0:h.connected)!==!1&&n.jsx(GZ,{name:e,editors:F,cursorAgent:L.some(ae=>ae.name==="Cursor"),cloud:!D,context:h?{name:h.gateway,workspace:h.workspace,target:h.target}:{...(Y=p.overview)==null?void 0:Y.gateway,target:O==null?void 0:O.target}},e),!p.demo&&X==="ready"&&(h==null?void 0:h.connected)!==!1&&(B?n.jsx(PZ,{name:e,sandbox:P},e):n.jsx(IZ,{name:e,sandbox:P},e)),n.jsxs(Yl,{title:"At a glance",children:[(ne=P.setupJobs)==null?void 0:ne.filter(ae=>["waiting","failed","blocked"].includes(ae.status)).map(ae=>n.jsx("p",{role:"status",className:"mb-3 text-xs text-muted-foreground",children:ae.status==="waiting"?"Installing included MCPs and skills…":`Included tools could not be activated: ${ae.error} Open MCPs & Skills to retry.`},ae.setup)),n.jsx("dl",{className:"grid grid-cols-2 gap-4 lg:grid-cols-1",children:[["Status",n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{className:`size-1.5 rounded-full ${Za(X).cell}`,"aria-hidden":"true"}),Cg[X]??"Unknown"]})],["Owner",df(P,O!=null&&O.connected?O.user:null)],[L.length===1?"AI agent":"AI agents",n.jsx(tR,{agents:L,status:Zv(P)})],["Image",_p(P.image,P.imageTemplateName)],["Providers",P.providers.join(", ")||"None"],["Created",jf(P.createdAt)],["Policy",S?`v${S.policyVersionNumber??P.policyVersion} · ${S.policySource??"sandbox"}`:"Not reported"]].map(([ae,ue])=>n.jsxs("div",{className:"min-w-0",children:[n.jsx("dt",{className:"text-[11px] text-muted-foreground",children:ae}),n.jsx("dd",{className:"mt-1 break-words text-xs",children:ue})]},ae))})]}),P.problem&&Px(X)==="error"&&n.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50/60 p-3",children:[n.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium text-red-700",children:[n.jsx(ti,{className:"size-3.5","aria-hidden":"true"}),"Failed to start"]}),pQ(P.problem)&&n.jsx(EQ,{local:!B&&!(h?h.remote:(ye=(te=p.overview)==null?void 0:te.gateway)!=null&&ye.remote)}),n.jsx("p",{className:"mt-1 max-h-28 overflow-y-auto font-mono text-[10px] leading-relaxed break-words text-red-700/80",children:P.problem})]})]})]})}),n.jsx(Io,{value:"rules",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:n.jsx(Yl,{title:"Network rules",icon:J1,aside:n.jsx("button",{disabled:(h==null?void 0:h.connected)===!1,onClick:()=>{try{sessionStorage.setItem("egress-sandbox",e)}catch{}r(),g("egress")},className:"text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"Edit"}),children:S!=null&&S.policy?ee.length===0?n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No rules. All outbound denied."}):n.jsx("ul",{className:"divide-y divide-border/70 rounded-md border border-border",children:ee.map(ae=>n.jsxs("li",{className:"px-3 py-2",children:[n.jsxs("p",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{className:"truncate font-mono font-medium",children:Ya(ae.key)==="own"?ae.name:cf(ae.key)}),n.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:YZ[Ya(ae.key)]})]}),n.jsx("ul",{className:"mt-1.5 space-y-0.5",children:ae.endpoints.map(ue=>n.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[n.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${ue.blocked?"bg-red-500":"bg-emerald-500"}`,"aria-hidden":"true"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[ue.host,ue.port?`:${ue.port}`:""]}),n.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[qZ[ue.access]??ue.access,ue.tlsSkip?" · TLS passthrough":"",ue.protocol!=="tcp"&&ue.enforcement==="audit"?" · audit only":""]})]},`${ue.host}:${ue.port}`))}),ae.binaries.length>0&&n.jsx("p",{className:"mt-1.5 truncate font-mono text-[10px] text-muted-foreground",title:ae.binaries.join(", "),children:ae.binaries.map(ue=>ue.split("/").pop()).filter((ue,se,Q)=>Q.indexOf(ue)===se).join(", ")})]},ae.key))}):n.jsx("p",{className:"text-sm text-muted-foreground",children:p.demo?"Policy data is unavailable in this preview.":E?"Rules could not be loaded. Close and reopen to retry.":S?"No policy reported.":"Loading rules…"})})}),n.jsx(Io,{value:"setups",className:"min-h-0 overflow-y-auto",children:(h==null?void 0:h.connected)===!1?n.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to manage MCPs & Skills."}):n.jsx(uD,{sandbox:e,setupIds:(S==null?void 0:S.setupIds)??[]})}),n.jsx(Io,{value:"files",className:"flex min-h-0 flex-col",children:(h==null?void 0:h.connected)===!1?n.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to access files."}):n.jsx(UZ,{sandbox:P,demo:p.demo})}),n.jsxs(Io,{value:"activity",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:[n.jsxs(Yl,{title:"Connection activity",aside:n.jsx("div",{className:"flex gap-1",children:[15,60].map(ae=>n.jsx("button",{onClick:()=>v(ae),"aria-pressed":b===ae,className:`rounded px-2 py-1 text-xs ${b===ae?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:ae===15?"15m":"1h"},ae))}),children:[n.jsx("div",{className:"rounded-lg border border-border p-4",children:n.jsx(T4,{points:q,height:100,title:"Outbound decisions per minute"})}),n.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Based on the recent event buffer",p.demo?" · synthetic preview":"","."]})]}),n.jsx(Yl,{title:"Egress",aside:U.length?n.jsx("button",{onClick:()=>{r(),g("activity")},className:"text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"All"}):null,children:U.length?n.jsx("div",{className:"rounded-md border border-border",children:U.map(ae=>n.jsx(OZ,{event:ae,dense:!0},`${ae.at}|${ae.message}`))}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No connections yet"})})]}),n.jsx(Io,{value:"details",className:"min-h-0 space-y-5 overflow-y-auto p-5",children:n.jsx("dl",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:[["Owner",df(P,O!=null&&O.connected?O.user:null)],["Image",_p(P.image,P.imageTemplateName),!0],...P.image&&_p(P.image,P.imageTemplateName)!==P.image?[["Image reference",P.image,!0]]:[],["Command",EW(P.command),!0],[L.length===1?"AI agent":"AI agents",n.jsx(tR,{agents:L,status:Zv(P)})],["Providers",P.providers.join(", ")||"None"],["Created",jf(P.createdAt)],["Workspace",P.workspace],["Policy",S?`v${S.policyVersionNumber??P.policyVersion} · ${S.policySource??"sandbox"}`:`v${P.policyVersion??"-"}`],["Sandbox ID",P.id,!0,!0]].map(([ae,ue,se,Q])=>n.jsxs("div",{className:Q?"sm:col-span-2":void 0,children:[n.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:ae}),n.jsx("dd",{className:`break-all ${se?"font-mono text-xs":"text-sm"}`,children:ue??"Not reported"})]},ae))})})]}):n.jsx("p",{role:"status",className:"flex-1 p-5 text-sm text-muted-foreground",children:E?"Sandbox details unavailable.":"Loading sandbox…"}),P&&!p.demo&&n.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2 border-t border-border bg-muted/20 px-5 py-3",children:[kW(X)&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!!A||(h==null?void 0:h.connected)===!1,onClick:()=>H("stop"),children:[A==="stop"?n.jsx(Nt,{"aria-hidden":"true"}):n.jsx(q8,{"aria-hidden":"true"}),"Stop"]}),TW(X)&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!!A||(h==null?void 0:h.connected)===!1,onClick:()=>H("start"),children:[A==="start"?n.jsx(Nt,{"aria-hidden":"true"}):n.jsx($A,{"aria-hidden":"true"}),"Start"]}),n.jsxs(le,{variant:"outline",size:"sm",disabled:!!A||(h==null?void 0:h.connected)===!1||X==="deleting",className:"border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",onClick:()=>T(!0),children:[n.jsx(ts,{"aria-hidden":"true"}),"Delete"]})]})]})}),n.jsx(Fr,{open:R,onOpenChange:T,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",e,"?"]}),n.jsx(Xr,{children:"All files inside will be lost."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsxs(Wr,{variant:"destructive",onClick:()=>H("delete"),disabled:A==="delete",children:[A==="delete"&&n.jsx(Nt,{"aria-hidden":"true"}),"Delete"]})]})]})})]})}function Kl({title:e,summary:t,children:r,...a}){return n.jsxs("details",{className:"group/setup min-w-0 border-t border-border",...a,children:[n.jsxs("summary",{className:"flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-sm py-2 outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[n.jsx(Lr,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-open/setup:rotate-90","aria-hidden":"true"}),n.jsx("span",{className:"shrink-0 text-xs font-medium",children:e}),n.jsx("span",{className:"ml-auto truncate text-right text-[11px] text-muted-foreground",title:t,children:t})]}),n.jsx("div",{className:"grid min-w-0 gap-4 pb-4 pt-1",children:r})]})}const Do=(e,t="read-write")=>({host:e,ports:[443],protocol:"rest",access:t,enforcement:"enforce"}),ap=["/usr/local/bin/node","/usr/bin/node"],iy=["generativelanguage.googleapis.com","cloudcode-pa.googleapis.com","oauth2.googleapis.com","accounts.google.com","www.googleapis.com","aiplatform.googleapis.com","*.aiplatform.googleapis.com"],XZ=new Set(["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]),WZ=e=>({...Do(e),...XZ.has(e)?{deny:["fetchFromTrawlerCache","rewriteUri","generateContent"].map(t=>({method:"*",path:`/**:${t}*`}))}:{}}),ip=["api.anthropic.com","api.openai.com","openrouter.ai","api.groq.com","api.deepseek.com","api.mistral.ai","api.x.ai","generativelanguage.googleapis.com"],Pi=(e,t,r)=>({name:e,binaries:t,endpoints:[...new Set(r)].map(a=>Do(a))}),hf={claude:{name:"Claude Code",binaries:["/usr/bin/claude","/usr/local/bin/claude"],endpoints:["api.anthropic.com","platform.claude.com","claude.ai"].map(e=>Do(e)),authentication:"Attach a Claude credential or sign in with your subscription after connecting.",connectors:{name:"claude.ai connectors",hosts:["mcp-proxy.anthropic.com"]}},opencode:{name:"OpenCode",binaries:["/usr/local/lib/node_modules/opencode-ai/bin/opencode.exe","/usr/local/bin/opencode","/sandbox/.opencode/bin/opencode"],endpoints:[Do("models.opencode.ai","read-only"),Do("models.dev","read-only"),Do("opencode.ai"),...ip.map(e=>Do(e))],authentication:"Includes connections for OpenCode’s hosted models. Use /connect for models that require an account. Other model providers need their own network rules and credentials."},codex:{name:"Codex",binaries:["/usr/bin/codex","/usr/local/bin/codex","/usr/local/lib/node_modules/@openai/**/codex","/usr/lib/node_modules/@openai/**/codex"],endpoints:["api.openai.com","auth.openai.com","chatgpt.com","ab.chatgpt.com"].map(e=>Do(e)),connectors:{name:"ChatGPT connectors and plugins",paths:{"chatgpt.com":["/backend-api/ps/mcp","/backend-api/ps/mcp/**","/backend-api/connectors/**"]}},authentication:"Attach a Codex credential, or run codex after connecting and choose “Sign in with Device Code” (ChatGPT plan) or “Provide your own API key”. “Sign in with ChatGPT” can’t complete from a sandbox."},gemini:Pi("Gemini CLI",[...ap,"/usr/local/bin/gemini"],iy),pi:{...Pi("Pi",[...ap,"/usr/local/bin/pi"],[...ip,...iy,"platform.claude.com","claude.ai","auth.openai.com","chatgpt.com","github.com","api.github.com","api.githubcopilot.com","*.githubcopilot.com","auth.x.ai","auth.kimi.com","api.kimi.com","auth.meta.com","api.meta.ai","radius.pi.dev"]),authentication:'Use /login inside Pi. If sign-in ends on a "site can’t be reached" page, copy the full URL from the address bar, paste it into Pi and press Enter.'},aider:Pi("Aider",["/usr/local/bin/aider","/opt/aider/bin/python*","/usr/bin/python3*","/usr/local/bin/python3*"],ip),copilot:Pi("GitHub Copilot",[...ap,"/usr/local/bin/copilot","/usr/local/lib/node_modules/@github/**/copilot","/usr/lib/node_modules/@github/**/copilot"],["github.com","api.github.com","api.githubcopilot.com","*.githubcopilot.com","copilot-proxy.githubusercontent.com"]),cursor:{...Pi("Cursor",["/sandbox/.local/bin/cursor-agent","/sandbox/.local/share/cursor-agent/**","/usr/local/bin/cursor-agent"],[]),endpoints:[...["cursor.com","api2.cursor.sh","api3.cursor.sh","*.cursor.sh","*.cursorapi.com"].map(e=>Do(e)),{host:"agentn.global.api5.cursor.sh",ports:[443],protocol:"tcp",tlsSkip:!0}]},antigravity:{...Pi("Antigravity",["/sandbox/.local/bin/agy","/sandbox/.antigravity/**","/sandbox/.local/share/antigravity/**","/usr/local/bin/agy",...ap],[]),endpoints:[...[...iy,"antigravity.google","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"].map(WZ),Do("lh3.googleusercontent.com","read-only")]},kiro:Pi("Kiro",["/sandbox/.local/bin/kiro-cli","/sandbox/.local/bin/kiro-cli-chat","/usr/local/bin/kiro-cli"],["app.kiro.dev","prod.us-east-1.auth.desktop.kiro.dev","runtime.us-east-1.kiro.dev","runtime.eu-central-1.kiro.dev","management.us-east-1.kiro.dev","management.eu-central-1.kiro.dev","q.us-east-1.amazonaws.com","q.eu-central-1.amazonaws.com","oidc.us-east-1.amazonaws.com","oidc.eu-central-1.amazonaws.com","cognito-identity.us-east-1.amazonaws.com","view.awsapps.com"]),droid:Pi("Factory Droid",["/sandbox/.local/bin/droid","/sandbox/.factory/bin/**","/usr/local/bin/droid"],["factory.ai","*.factory.ai",...ip])},QZ=e=>({host:e,ports:[443],protocol:"rest",enforcement:"enforce",allow:[{method:"GET",path:"/**"}]}),sR={vscode:{name:"VS Code Server",rule:"tool-vscode-server",binaries:["/usr/bin/curl","/usr/bin/wget","/sandbox/.vscode-server/**"],endpoints:["update.code.visualstudio.com","vscode.download.prss.microsoft.com"].map(QZ)}},ej=(e=[])=>e.filter(t=>{var r;return(r=hf[t])==null?void 0:r.connectors}),ZZ=["ANTHROPIC_API_KEY","CLAUDE_API_KEY","OPENAI_API_KEY"],JZ=e=>{var t;return!!((t=e==null?void 0:e.credentialKeys)!=null&&t.some(r=>ZZ.includes(r)))};function eJ(e,t){const{hosts:r=[],paths:a={}}=e.connectors??{},i=e.endpoints.map(c=>!t&&a[c.host]?{...c,deny:[...c.deny??[],...a[c.host].map(u=>({method:"*",path:u}))]}:c);return{...e,endpoints:t?[...i,...r.map(c=>Do(c))]:i}}function TD(e,{connectors:t=[]}={}){if((e==null?void 0:e.source)!=="build")return{profiles:[],unsupported:[]};const r=[...new Set(e.agents??[])];if(!Array.isArray(t)||t.some(a=>!ej(r).includes(a)))throw new Error("Connectors can be turned on only for this sandbox’s Claude Code or Codex.");return{profiles:[...r.filter(a=>hf[a]).map(a=>({id:a,rule:`agent-${a}`,...eJ(hf[a],t.includes(a))})),...[...new Set(e.runtimes??[])].filter(a=>sR[a]).map(a=>({id:a,...sR[a]}))],unsupported:r.filter(a=>!hf[a])}}const dc=Ws.filter(e=>!TD({source:"build",agents:[e.id]}).unsupported.length);function tj(e){const t=Array.isArray(e)?e:e==="terminal"?[]:[e];if(t.some(r=>!dc.some(a=>a.id===r)))throw new Error("Choose a supported agent.");return dc.filter(r=>t.includes(r.id)).map(r=>r.id)}function tJ(e,t){const r=tj(e);if(r.length!==1||t==="shell")return"shell";const a=dc.find(i=>i.id===t&&r.includes(i.id));if(!a)throw new Error("Choose Shell or a selected agent.");return a.command}function nj(e,t="",r="agent",a=!1,i=[]){if(!["agent","shell"].includes(r))throw new Error("Choose Shell or the selected agent.");const c=a||i.length?["python","node"]:[],u=tj(e),f=dc.find(h=>h.id===u[0]);return na({name:t,agents:u,runtimes:c,setups:i.map(h=>h.id),setupRevisions:Object.fromEntries(i.map(h=>[h.id,h.revision])),command:Array.isArray(e)||r==="shell"?"":(f==null?void 0:f.command)||""})}function nJ(e,t,r="agent",a=!1,i=[]){const c=nj(t,"",r,a,i);return e.find(u=>u.managed&&u.status==="ready"&&u.image&&u.build===WY(c)&&JSON.stringify(na({...u.recipe,name:""}))===JSON.stringify(c))}function rR(e,t){const r={claude:["claude-code"],codex:["codex"]}[t]||[];return e.filter(a=>r.includes(a.type))}const ED=(e,t)=>new Promise((r,a)=>{const i=()=>{clearTimeout(c),a(new DOMException("Preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);t==null||t.addEventListener("abort",i,{once:!0}),t!=null&&t.aborted&&i()});async function sJ(e,t,{openIn:r="agent",withSetups:a=!1,setups:i=[],signal:c,onProgress:u=()=>{},onBuild:f=()=>{},onBuildUpdate:h=()=>{},wait:m=ED}={}){const p=()=>{if(c!=null&&c.aborted)throw new DOMException("Preparation cancelled.","AbortError")};p();const g=await e.imageTemplates();p();const b=nJ(g,t,r,a,i);if(b)return h(b),b;const v=tj(t),C=`q-${(v.length>1?"agents":v[0]||"terminal").slice(0,9)}-${crypto.randomUUID().slice(0,6)}`;u("Preparing environment… First-time setup can take a few minutes.");const S=await e.buildImageTemplate(nj(t,C,r,a,i));if(f(C),h({...S,name:C}),p(),S.status==="failed")throw new Error(S.error||"Environment build failed.");for(let N=0;N<900;N++){await m(2e3,c),p();const E=(await e.imageTemplates()).find(k=>k.name===C);if(p(),!E)throw new Error("The environment build disappeared. Check Templates and try again.");if(h(E),E.status==="failed")throw new Error(E.error||"Environment build failed.");if(E.status==="ready")return E}throw new Error("The build is still running. Check Templates before trying again.")}async function RD(e,t,r,{signal:a,expectedRevisions:i={},onProgress:c=()=>{},wait:u=ED}={}){const f=()=>{if(a!=null&&a.aborted)throw new DOMException("Preparation cancelled.","AbortError")};if(f(),!t.length)return{setups:[],accessReview:null};const h=await e.setups(),m=[],p=r?{}:null;for(const g of t){f();const b=h.find(w=>w.id===g);if(!b||r&&r[g]!==b.revision||i[g]&&i[g]!==b.revision)throw new Error("A selected Setup changed. Reopen the dialog and review it again.");c(`Preparing MCP packages for ${b.name}…`);let v;try{v=await e.prepareLaunchSetup(g,b.revision);for(let w=0;v.status==="running"&&w<900;w++)f(),c(v.message||`Preparing ${b.name}…`),await u(2e3,a),f(),v=await e.setupPreparation(v.id);if(f(),v.status!=="complete"||!v.setup)throw new Error(v.message||"Package preparation did not finish. Retry creation.");m.push(v.setup),p&&(p[v.setup.id]=v.setup.revision)}catch(w){throw v!=null&&v.id&&v.status==="running"&&await e.cancelSetupPreparation(v.id).catch(()=>{}),w}}return{setups:m,accessReview:p}}const yr=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),AD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>dc.find(t=>t.id===e)).filter(Boolean),oR=dc.filter(e=>!AD.includes(e)),rJ=[{id:"empty",label:"Empty"},{id:"folder",label:"Local folder"},{id:"repo",label:"Git repository"}];function oJ(e){var t;try{const r=new URL(e.trim());if(r.protocol!=="https:")return null;const a=(t=r.pathname.split("/").filter(Boolean).pop())==null?void 0:t.replace(/\.git$/,"");return a?`${Ba}/${/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(a)?a:"repo"}`:null}catch{return null}}const aJ={gitignore:".gitignore applied","gitignore-empty":".gitignore matched nothing, so everything is sent",none:"Not a git repository, so everything is sent"},iJ={included:e=>`git history included (${br(e.gitBytes)})`,worktree:()=>"Git worktree: history not included",subfolder:()=>"Inside a repository: history not included",none:()=>null};function lJ({plan:e,sandbox:t}){return n.jsxs("div",{className:"grid min-w-0 gap-1 text-[11px]",children:[e.over?n.jsxs("p",{className:"text-red-700",children:["Over ",br(e.limit),". Add a .gitignore, or upload it from a terminal."]}):n.jsxs("p",{children:[e.files.toLocaleString()," ",e.files===1?"file":"files"," · ",br(e.bytes)," → ",n.jsx("span",{className:"font-mono",children:e.dest})]}),n.jsx("p",{className:"text-muted-foreground",children:[aJ[e.filter],iJ[e.git](e),e.links?`${e.links} ${e.links===1?"symlink":"symlinks"} kept as links`:null].filter(Boolean).join(" · ")}),e.secretCount>0&&n.jsxs("p",{className:"text-amber-700",children:["May hold secrets: ",n.jsx("span",{className:"font-mono",children:e.secrets.join(", ")}),e.secretCount>e.secrets.length?` and ${e.secretCount-e.secrets.length} more`:"",". Add ",e.secretCount===1?"it":"them"," to .gitignore to leave ",e.secretCount===1?"it":"them"," out."]}),n.jsxs("details",{className:"mt-1",children:[n.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Upload from a terminal instead"}),e.git==="included"&&n.jsx("p",{className:"mt-1 text-muted-foreground",children:"Without git history."}),n.jsx(uc,{command:P1(t||"NAME",e.display,Ba)})]})]})}function cJ({org:e,value:t,onChange:r,onCreated:a,onAddPolicy:i,invalid:c=!1}){const u=Zs(),f=CD(e.policies,t),h=Object.fromEntries(e.groups.map(p=>{var g,b;return[p.id,((b=(g=e.members)==null?void 0:g[p.id])==null?void 0:b.length)??0]})),m=e.groups.filter(p=>t.includes(p.id));return n.jsx("div",{id:"sandbox-groups",className:`-m-3 rounded-lg p-3 transition-colors ${c?"bg-destructive/5 ring-1 ring-destructive/60":""}`,children:n.jsxs("fieldset",{"aria-invalid":c||void 0,className:"grid min-w-0 gap-2.5",children:[n.jsxs("legend",{className:"mb-2.5 text-xs font-medium",children:["Groups ",n.jsx("span",{className:"text-muted-foreground",children:"· Optional"})]}),n.jsx(cc,{multiple:!0,groups:e.groups,counts:h,value:t,onChange:r,onCreated:a}),n.jsx(In.p,{initial:u?!1:{opacity:0,y:3},animate:{opacity:1,y:0},transition:{duration:.18},"aria-live":"polite",className:`text-[11px] leading-relaxed ${c?"text-destructive":"text-muted-foreground"}`,children:f.length?n.jsxs(n.Fragment,{children:["Gets ",f.length===1?"this network rule":`these ${f.length} network rules`,": ",n.jsx("span",{className:"text-foreground",children:f.map(p=>p.name).join(", ")}),"."]}):m.length?n.jsx(n.Fragment,{children:"No network rules yet: this sandbox starts locked down. Add a rule to allow more."}):e.groups.length?null:"Create a group to share network access between sandboxes. Network rules can then target the whole group."},t.join(",")||"empty"),m.length>0&&!f.length&&n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:i,children:"Add network rule"})]})})}function aR(e,t){const r=lo.getSnapshot().filter(a=>a.status!=="failed"&&a.status!=="cancelled"&&yr(a.location)===yr(t));return new Set([...e.map(a=>a.name),...r.map(a=>a.name)])}function iR(e,t="sandbox"){for(let r=1;r<1e3;r++){const a=`${t}-${r}`;if(!e.has(a))return a}return""}function MD({locations:e,location:t,onLocationChange:r,onRefreshLocations:a,allowRemote:i=!1,initialLocationConfirmed:c=!1,...u}){var O;const f=gn(),h=Pt(),[m,p]=x.useState(null),g=(O=u.initialImageTemplate)==null?void 0:O.location,b=e??[],v=g??t,w=v?b.find(D=>yr(D)===yr(v))??(yr(f)===yr(v)?f:v):b.find(D=>yr(D)===m)??f??b.find(D=>D.target===h.target&&D.connected)??null,C=!u.initialImageTemplate&&(i||b.length>1),[S,N]=x.useState("where"),[E,k]=x.useState(null),A=x.useRef(null);x.useEffect(()=>{u.open&&!A.current&&(A.current=en.exploreFlow("sandbox_creation")),u.open||(A.current=null)},[u.open]),x.useEffect(()=>{u.open&&en.step(A.current,C&&S==="where"?"location":"configuration")},[u.open,C,S]);function M(D){var B;!D&&!((B=A.current)!=null&&B.submitted)&&en.finishFlow(A.current,"cancelled"),u.onOpenChange(D)}x.useEffect(()=>{u.open||p(null),N(c?"form":"where"),k(null)},[u.open,c]);const R=D=>{const B=b.find(F=>yr(F)===D&&F.connected);B&&(p(D),r==null||r(B))};x.useEffect(()=>{if(!E)return;const D=b.find(F=>F.gateway===E&&F.connected);if(D){k(null),R(yr(D)),N("form");return}const B=setInterval(()=>a==null?void 0:a(),1500);return()=>clearInterval(B)},[E,b]);const T=C&&S==="where"?n.jsx(Ox,{locations:b,allowRemote:i,connecting:!!E,onPick:D=>{R(D),N("form")},onConnected:D=>{k(D.gateway),a==null||a()},onCancel:()=>M(!1)}):null;return n.jsx(Zn,{location:w,children:n.jsx(uJ,{...u,onOpenChange:M,analyticsFlow:A,locations:b,onLocationChange:R,chooser:T,onChangeLocation:C?()=>N("where"):void 0},yr(w)??"default")})}function uJ({open:e,onOpenChange:t,onStarted:r,initialImageTemplate:a=null,locations:i,onLocationChange:c,chooser:u,onChangeLocation:f,analyticsFlow:h}){var Ze,Tt;const m=Pt(),p=gn(),g=Zs(),[b,v]=x.useState([]),[w,C]=x.useState([]),[S,N]=x.useState(""),E=x.useRef(!1),[k,A]=x.useState([]),[M,R]=x.useState([]),[T,O]=x.useState(null),[D,B]=x.useState(""),[F,K]=x.useState([]),[$,P]=x.useState("quick"),[U,H]=x.useState([]),[W,q]=x.useState("shell"),[Z,z]=x.useState({}),[L,X]=x.useState([]),[ee,_]=x.useState(null),[V,G]=x.useState(null),[Y,ne]=x.useState("empty"),te=ds(),ye=!!(p!=null&&p.cloud||((p==null?void 0:p.target)??(te==null?void 0:te.target))==="cloud"),[ae,ue]=x.useState(""),[se,Q]=x.useState(null),[ie,oe]=x.useState(""),[pe,xe]=x.useState(null),[je,Ie]=x.useState([]),[ce,Te]=x.useState(null),[re,fe]=x.useState(!1),[Re,Oe]=x.useState(0),[ke,he]=x.useState(!1);x.useEffect(()=>{if(!e||(p==null?void 0:p.connected)===!1)return;let Se=!0;return E.current=!1,v([]),C([]),m.overview().then(et=>{if(!Se)return;const it=et.sandboxes??[],lt=et.providers??[];v(it),C(lt),E.current||N(iR(aR(it,p))),K(lt.map(wt=>wt.name))}).catch(et=>{Se&&_(et.message)}),N(""),P(a?"template":"quick"),H([]),q("shell"),z({}),X([]),R([]),B((a==null?void 0:a.name)||""),A(a?[a]:[]),m.imageTemplates().then(et=>{Se&&A(et.filter(it=>it.status==="ready"||it.exists))}).catch(et=>{Se&&_(et.message)}),K([]),_(null),G(null),xe(null),ne("empty"),ue(""),Q(null),oe(""),Ie([]),he(!1),Te(null),fe(zp(p)),(zp(p)?m.syncLocalCatalog():Promise.resolve(null)).then(async et=>{if(!Se)return;const it=await m.org();Se&&(et!=null&&et.available&&(it.groups=it.groups.filter(lt=>!et.importedGroups.includes(lt.id)||et.groups.includes(lt.id))),xe(it),Te(et))}).catch(et=>{Se&&(xe(null),_(`Could not load sandbox settings: ${et.message}`))}).finally(()=>{Se&&fe(!1)}),()=>{Se=!1}},[e,m,p==null?void 0:p.connected,p==null?void 0:p.remote,a,Re]);const Ae=$==="template"?k.find(Se=>Se.name===D):null,ge=dc.filter(Se=>U.includes(Se.id)),Pe=$==="quick"?[...new Set(ge.flatMap(Se=>{const Ye=Z[Se.id];return rR(w,Se.id).some(et=>et.name===Ye)?[Ye]:[]}))]:F,Fe=Ae!=null&&Ae.managed&&Ae.recipe.source==="build"?Ws.filter(Se=>Ae.recipe.agents.includes(Se.id)):null,_e=$==="quick"?U:(Fe??[]).map(Se=>Se.id),Xe=$==="quick"?Object.keys(Z).filter(Se=>JZ(w.find(Ye=>Ye.name===Z[Se]))):[],Je=ej(_e).filter(Se=>L.includes(Se)&&!Xe.includes(Se)),ct=TD($==="quick"?nj(U):Ae!=null&&Ae.managed?Ae.recipe:null,{connectors:Je}),At=PV(_e),rt=$==="quick"?M.length>0:!!((Tt=(Ze=Ae==null?void 0:Ae.recipe)==null?void 0:Ze.setups)!=null&&Tt.length),ve=rt&&!At.length;function Ue(Se){const Ye=U.includes(Se)?U.filter(et=>et!==Se):[...U,Se];H(Ye),_(null),(Ye.length!==1||!Ye.includes(W))&&q("shell"),z(et=>Object.fromEntries(Object.entries(et).filter(([it])=>Ye.includes(it)))),/^(sandbox|terminal|claude|codex|cursor|opencode|pi|antigravity|copilot|kiro|droid|aider)-\d+$/.test(S)&&N(iR(aR(b??[],p),Ye.length===1?Ye[0]:"sandbox"))}x.useEffect(()=>{if(Y!=="folder"||!ae.trim()){Q(null);return}let Se=!1;Q({loading:!0});const Ye=setTimeout(()=>{m.localFolder(ae.trim()).then(et=>{Se||Q({data:et})}).catch(et=>{Se||Q({error:et.message})})},400);return()=>{Se=!0,clearTimeout(Ye)}},[Y,ae,m]);const Qe=je.every(Se=>pe==null?void 0:pe.groups.some(Ye=>Ye.id===Se)),xt=Y==="repo"?oJ(ie):null,Ke=Y==="empty"||(Y==="folder"?!!(se!=null&&se.data&&!se.data.over):!!xt),Be=Y==="folder"?ae.trim():Y==="repo"?ie.trim():"";function jt(Se){var on;if(Se.preventDefault(),(p==null?void 0:p.connected)===!1)return;const Ye=[!S&&"sandbox-name",$==="template"&&!Ae&&"sandbox-image-template",!Qe&&"sandbox-groups"].find(Boolean);if(Ye||!Ke||ve){en.step(h==null?void 0:h.current,"validation","blocked","unknown"),he(!0),Ye&&((on=document.getElementById(Ye))==null||on.scrollIntoView({behavior:g?"auto":"smooth",block:"center"}));return}const et=Y==="folder"?{folder:se.data.path}:Y==="repo"?{repository:ie.trim()}:{},it=S.trim(),lt=$==="quick",wt=U,cn=lt?{session:tJ(U,W)}:{},Gt=M,fn=T,Bn=Je,Kn=Pe,de=At,tt=je,Et=Ae;h!=null&&h.current&&(h.current.submitted=!0),lo.start({name:it,location:p,analyticsFlow:h==null?void 0:h.current,analyticsProperties:{location_type:mf(p),creation_mode:$,file_source:Y,agent_ids:U,setup_count:Gt.length,provider_count:Kn.length,group_count:tt.length},task:async({signal:xn,progress:Wt,build:un,creating:ns})=>{let Jn=Et,wo=[],jo=null,cr=null;const Fs=()=>{cr&&m.cancelImageBuild(cr).catch(Ms=>He.error(Ms.message))};xn.addEventListener("abort",Fs);try{if(lt){const Ms=await RD(m,Gt,fn,{signal:xn,onProgress:Wt});wo=Ms.setups.map(_n=>_n.id),jo=Ms.accessReview,Jn=await sJ(m,wt,{withSetups:Gt.length>0,setups:Ms.setups,signal:xn,onProgress:Wt,onBuildUpdate:un,onBuild:_n=>{cr=_n,xn.aborted&&Fs()}})}}finally{xn.removeEventListener("abort",Fs)}if(xn.aborted)throw new DOMException("Cancelled","AbortError");ns();const fs=await m.create({name:it,imageTemplate:Jn.name,includeTemplateAccess:!lt,...cn,providers:Kn,setups:wo,setupAccessReview:jo,setupTargets:de,connectors:Bn,groups:tt,...et});fs.seed&&He(`${fs.seed.kind==="folder"?"Uploading":"Cloning"} ${fs.seed.source}`,{description:`Into ${fs.seed.dest} once the sandbox starts. Progress is in its Files tab.`});for(const Ms of fs.opened??[])He(`Opened ${Ms.name||"default"} on port ${Ms.port}`,{description:Ms.url??void 0});return{...fs,image:Jn.image,providers:Kn,createdAt:new Date().toISOString(),...p?{location:p}:{}}}}),t(!1),r==null||r()}return n.jsxs(n.Fragment,{children:[n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:u??n.jsx(n.Fragment,{children:n.jsx("form",{onSubmit:jt,className:"@container flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-popover ring-1 ring-foreground/10 max-h-[90svh]",children:n.jsxs(nh,{value:$,onValueChange:Se=>{P(Se),_(null)},className:"contents",children:[n.jsxs(sn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[f&&n.jsx("div",{className:"pr-8",children:n.jsx($w,{step:2})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[n.jsx(Qt,{children:"New sandbox"}),f?n.jsx(j4,{location:p,onChange:f}):!a&&i.length>0?null:n.jsx(ga,{location:p}),n.jsxs(sh,{className:"ml-auto w-fit","aria-label":"Sandbox creation method",children:[n.jsx(Pr,{value:"quick",className:"px-3 text-xs",children:"Quick setup"}),n.jsx(Pr,{value:"template",className:"px-3 text-xs",children:"From template"})]})]}),!f&&i.length>0&&!a&&n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-location",className:"text-xs",children:"Location"}),n.jsxs(jp,{value:yr(p)??"",onValueChange:c,items:i.map(Se=>({value:yr(Se),label:`${Dn(Se)}${Se.connected?"":" · Disconnected"}`})),children:[n.jsx(Np,{id:"sandbox-location",className:"w-full text-xs",children:n.jsx(Sp,{placeholder:"Choose a connected location"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:i.map(Se=>n.jsxs(Zd,{value:yr(Se),disabled:!Se.connected,children:[Dn(Se),Se.connected?"":" · Disconnected"]},yr(Se)))})]})]}),(p==null?void 0:p.connected)===!1&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to create a sandbox."}),re&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local network policies, MCPs & Skills, and Groups…"}),(ce==null?void 0:ce.available)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local network policies, MCPs & Skills, and Groups are available here. Existing remote sandboxes keep their settings."}),zp(p)&&!re&&!pe&&n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>Oe(Se=>Se+1),children:"Retry loading settings"})]}),n.jsx("div",{className:"grid min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border @3xl:grid-cols-[minmax(0,1fr)_19rem] @3xl:overflow-hidden",children:n.jsxs("fieldset",{disabled:(p==null?void 0:p.connected)===!1,className:"contents",children:[n.jsxs(In.div,{initial:g?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:[.22,1,.36,1]},className:"grid min-w-0 content-start gap-6 p-5 @3xl:overflow-y-auto @3xl:p-7",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"sandbox-name",value:S,onChange:Se=>{E.current=!0,N(Se.target.value.toLowerCase())},className:"h-10 font-mono text-sm",required:!0,"aria-invalid":ke&&!S||void 0,pattern:"[a-z0-9]([a-z0-9\\-]{0,17}[a-z0-9])?",maxLength:19,title:"Lowercase letters, digits and dashes, up to 19",autoFocus:!0})]}),n.jsxs(Io,{value:"quick",className:"grid gap-4",children:[n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),n.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:AD.map(Se=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"checkbox",checked:U.includes(Se.id),onChange:()=>Ue(Se.id),className:"peer sr-only"}),n.jsxs("span",{className:"flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-2 text-xs transition-all hover:-translate-y-px hover:bg-muted/50 hover:shadow-sm motion-reduce:hover:translate-y-0 @3xl:min-h-14 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:[n.jsx("img",{src:Se.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:Se.name}),U.includes(Se.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})]},Se.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(le,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:oR.filter(Se=>U.includes(Se.id)).map(Se=>Se.name).join(", ")||"More agents"}),n.jsx(ha,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:oR.map(Se=>n.jsxs(Fw,{checked:U.includes(Se.id),onCheckedChange:()=>Ue(Se.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:Se.logo,alt:"",className:"size-4 shrink-0 object-contain"}),Se.name]},Se.id))})]})]}),ge.length>0&&n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{id:"shell",name:"Shell"},...ge.length===1?ge:[]].map(Se=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"radio",name:"quick-open-in",value:Se.id,checked:W===Se.id,onChange:()=>q(Se.id),className:"peer sr-only"}),n.jsxs("span",{className:"flex min-h-16 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-3 text-xs transition-colors hover:bg-muted/50 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:[Se.id==="shell"?n.jsx(r2,{className:"size-5 shrink-0","aria-hidden":"true"}):n.jsx("img",{src:Se.logo,alt:"",className:"size-5 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1 font-medium",children:Se.name}),n.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${W===Se.id?"border-foreground":"border-muted-foreground/40"}`,children:W===Se.id&&n.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},Se.id))})]}),ge.map(Se=>{const Ye=rR(w,Se.id);return Ye.length?n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:`quick-sign-in-${Se.id}`,className:"text-xs",children:[Se.name," API key"]}),n.jsxs(jp,{value:Z[Se.id]||"",onValueChange:et=>z(it=>({...it,[Se.id]:et??""})),children:[n.jsx(Np,{id:`quick-sign-in-${Se.id}`,className:"w-full text-xs",children:n.jsx(Sp,{children:Z[Se.id]||"None, I’ll use my subscription"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:n.jsxs(P5,{children:[n.jsx(Zd,{value:"",className:"text-xs",children:"None, I’ll use my subscription"}),Ye.map(et=>n.jsx(Zd,{value:et.name,className:"text-xs",children:et.name},et.name))]})})]})]},Se.id):null}),n.jsx(lR,{agents:U,keyed:Xe,value:L,onChange:X})]}),n.jsxs(Io,{value:"template",className:"grid gap-4",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"sandbox-image-template",className:"text-xs",children:"Environment"}),n.jsxs(jp,{value:D,onValueChange:Se=>B(Se??""),children:[n.jsx(Np,{id:"sandbox-image-template","aria-invalid":ke&&!Ae||void 0,className:"w-full text-xs",children:n.jsx(Sp,{children:D||"Choose a template"})}),n.jsx(Cp,{align:"start",alignItemWithTrigger:!1,children:n.jsx(P5,{children:k.map(Se=>n.jsx(Zd,{value:Se.name,className:"text-xs",children:Se.name},Se.name))})})]}),ke&&!Ae&&k.length>0&&n.jsx("p",{className:"text-[11px] text-destructive",children:"Choose a template to create a sandbox."}),!k.length&&n.jsx("p",{className:`text-[11px] ${ke?"text-destructive":"text-muted-foreground"}`,children:"No ready templates. Use Quick setup or create one in Templates."}),Ae&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:Fe?`Included tools: ${[...Fe.map(Se=>Se.name),...(Ae.recipe.customAgents??[]).map(Se=>Se.name),"Terminal"].join(", ")}`:"Installed tools are not reported by this template."})]}),n.jsx(lR,{agents:_e,value:L,onChange:X})]}),$==="template"&&n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Providers"}),w.length?n.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map(Se=>{const Ye=F.includes(Se.name);return n.jsxs("button",{type:"button","aria-pressed":Ye,onClick:()=>K(et=>Ye?et.filter(it=>it!==Se.name):[...et,Se.name]),className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${Ye?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[n.jsx("span",{className:`size-1.5 rounded-full ${Ye?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),n.jsx("span",{className:"font-mono",children:Se.name}),n.jsx("span",{className:"text-muted-foreground",children:Se.type})]},Se.name)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No providers"})]}),ee&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:ee})]}),n.jsxs(In.aside,{initial:g?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:.06,ease:[.22,1,.36,1]},className:"grid min-w-0 content-start gap-6 border-t border-border bg-muted/25 p-5 @3xl:overflow-y-auto @3xl:border-t-0 @3xl:border-l @3xl:p-6",children:[pe?n.jsx(cJ,{org:pe,value:je,onChange:Ie,invalid:ke&&!Qe,onAddPolicy:()=>G(Ki({appliesTo:{everyone:!1,groups:je,sandboxes:[]}})),onCreated:Se=>xe(Ye=>({...Ye,groups:[...Ye.groups,Se].sort((et,it)=>et.name.localeCompare(it.name)),members:{...Ye.members,[Se.id]:[]}}))}):n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:ee?"Groups unavailable. Reopen this dialog to retry.":"Loading groups…"}),($==="quick"||rt&&(ve||_e.includes("aider")))&&n.jsxs("div",{className:"space-y-3",children:[$==="quick"&&!re&&n.jsx(pD,{localCatalog:ce,autoPrepare:!0,automaticAccess:!0,preparationContext:"sandbox",accessReview:T,onAccessReview:O,value:M,onChange:R}),rt&&ve&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:_e.includes("aider")?"Setup installation is unavailable for Aider. Choose another agent.":$==="quick"?"Choose an agent to use this Setup.":"Choose a template with a supported agent to use this Setup."}),rt&&!ve&&_e.includes("aider")&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Setup installation is unavailable for Aider."})]}),n.jsxs("div",{className:"grid min-w-0",children:[n.jsx(Kl,{title:"Add project files",summary:Be,children:n.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium",children:"Start with"}),n.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:rJ.filter(Se=>!ye||Se.id!=="folder").map(Se=>n.jsx("button",{type:"button",onClick:()=>ne(Se.id),"aria-pressed":Y===Se.id,className:`flex-1 rounded px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${Y===Se.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:Se.label},Se.id))}),Y==="folder"&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{value:ae,onChange:Se=>ue(Se.target.value),className:"font-mono text-xs",placeholder:"~/code/my-project","aria-label":"Folder on this computer"}),(se==null?void 0:se.loading)&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Checking the folder…"}),(se==null?void 0:se.error)&&n.jsx("p",{className:"text-[11px] text-red-700",children:se.error}),(se==null?void 0:se.data)&&n.jsx(lJ,{plan:se.data,sandbox:S})]}),Y==="repo"&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{value:ie,onChange:Se=>oe(Se.target.value),className:"font-mono text-xs",placeholder:"https://github.com/org/repo","aria-label":"Git repository URL"}),n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[xt?n.jsxs(n.Fragment,{children:["Cloned into ",n.jsx("span",{className:"font-mono",children:xt})," once the sandbox starts. "]}):"An https:// URL. ","Public repositories only. Your access rules must allow Git connections to this host."]})]})]})}),ct.profiles.length>0&&n.jsx(Kl,{title:ct.profiles.some(Se=>Se.rule.startsWith("tool-"))?"Agent and tool connections":"Agent connections",summary:`${new Set(ct.profiles.flatMap(Se=>Se.endpoints.map(Ye=>`${Ye.host}:${Ye.ports.join(",")}`))).size} destinations`,children:n.jsx("div",{className:"max-h-52 divide-y overflow-y-auto",children:ct.profiles.map(Se=>n.jsxs("details",{className:"px-3 py-2",children:[n.jsxs("summary",{className:"cursor-pointer text-xs",children:[Se.name,n.jsxs("span",{className:"ml-2 text-[11px] text-muted-foreground",children:[Se.endpoints.length," destinations · ",Se.rule]})]}),n.jsx("ul",{className:"mt-2 space-y-1",children:Se.endpoints.map(Ye=>{var et,it;return n.jsxs("li",{className:"flex flex-wrap items-baseline justify-between gap-x-3 text-[11px]",children:[n.jsxs("span",{className:"break-all font-mono",children:[Ye.host,":",Ye.ports.join(",")]}),n.jsxs("span",{className:"text-muted-foreground",children:[Ye.tlsSkip?"TLS passthrough":(et=Ye.allow)!=null&&et.length?`${Ye.allow.map(lt=>lt.method).join(", ")} only`:Ye.access==="read-only"?"Read only":"Read & write",(it=Ye.deny)!=null&&it.length?` · ${Ye.deny.length} paths blocked`:""]})]},Ye.host)})}),Se.authentication&&n.jsx("p",{className:"mt-2 text-[11px]",children:Se.authentication}),n.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"Allowed programs"}),n.jsx("ul",{className:"mt-1 space-y-1 break-all font-mono text-[10px] text-muted-foreground",children:Se.binaries.map(Ye=>n.jsx("li",{children:Ye},Ye))})]},Se.id))})})]})]})]})}),n.jsxs(Hr,{className:"mx-0 mb-0 shrink-0 items-center rounded-none border-t border-border bg-popover px-5 py-4 @3xl:px-7",children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsx(le,{type:"submit",disabled:(p==null?void 0:p.connected)===!1,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:"Create sandbox"})]})]})})})})}),n.jsx(Gw,{open:!!V,initial:V,onOpenChange:Se=>{Se||G(null)},groups:(pe==null?void 0:pe.groups)??[],sandboxes:(b??[]).map(Se=>Se.name),assignments:(pe==null?void 0:pe.assignments)??{},onGroupCreated:Se=>xe(Ye=>({...Ye,groups:[...Ye.groups,Se]})),onSaved:(Se,Ye)=>{var et;Ie(it=>[...new Set([...it,...Ye.appliesTo.groups])]),xe(it=>({...it,policies:[...it.policies.filter(lt=>lt.id!==Ye.id),Ye]})),(et=Se.failed)!=null&&et.length?He.error("Rule saved, but some sandboxes could not be updated."):He.success(`Saved ${Ye.name}`)}})]})}function lR({agents:e,keyed:t=[],value:r,onChange:a}){const i=ej(e);return i.length?n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Connectors"}),n.jsx("div",{className:"grid gap-2",children:i.map(c=>n.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs has-disabled:cursor-default has-disabled:text-muted-foreground",children:[n.jsx($o,{disabled:t.includes(c),checked:r.includes(c)&&!t.includes(c),onCheckedChange:u=>a(u?[...r,c]:r.filter(f=>f!==c))}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Use my ",hf[c].connectors.name]}),t.includes(c)&&n.jsx("span",{className:"text-[11px]",children:"Subscription only"})]},c))})]}):null}function _x({count:e,rowHeight:t,overscan:r=8}){const[a,i]=x.useState(null),[c,u]=x.useState(0),[f,h]=x.useState(0);x.useLayoutEffect(()=>{if(!a)return;const b=()=>h(a.clientHeight);b();const v=new ResizeObserver(b);return v.observe(a),()=>v.disconnect()},[a]);const m=Math.max(0,Math.floor(c/t)-r),p=Math.ceil((f||600)/t)+r*2,g=Math.min(e,m+p);return{ref:i,onScroll:b=>u(b.currentTarget.scrollTop),start:m,end:g,paddingTop:m*t,totalHeight:e*t,scrollToTop:()=>{a==null||a.scrollTo({top:0}),u(0)}}}const cR=["api.anthropic.com","api.openai.com","github.com","pypi.org","registry.npmjs.org","files.pythonhosted.org","objects.githubusercontent.com","huggingface.co","sentry.io","api.stripe.com","pastebin.com","ngrok.io","s3.amazonaws.com"],uR=new Set(["pastebin.com","ngrok.io","api.stripe.com"]);function dJ(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0)/2**32}const fJ=(e,t)=>t[Math.floor(e()*t.length)];function OD(e,t=Math.random,r=new Date().toISOString()){const a=e[Math.floor(t()**2.2*e.length)],i=t()<.08?fJ(t,[...uR]):cR[Math.floor(t()**1.8*(cR.length-3))],c=uR.has(i)?t()<.9:t()<.03;return{sandbox:a.name,at:r,kind:"audit",level:"OCSF",category:"NET",action:"OPEN",severity:c?"MED":"INFO",verdict:c?"denied":"allowed",destination:`${i}:443`,binary:"/usr/local/bin/claude",reason:c?"policy_dns_ineligible":null,policy:c?null:"_provider_my_claude",message:`NET:OPEN [${c?"MED":"INFO"}] ${c?"DENIED":"ALLOWED"} /usr/local/bin/claude(0) -> ${i}:443 #${Math.floor(t()*1e9)}`,detail:`/usr/local/bin/claude(0) -> ${i}:443`}}function hJ(e,t=2e3){const r=dJ(11),a=Date.now(),i=new Map(e.map(c=>[c.name,c.phase]));return Array.from({length:t},(c,u)=>OD(e,r,new Date(a-u*1500).toISOString())).filter(c=>["ready","error"].includes(i.get(c.sandbox)))}function DD(e){const t=x.useMemo(()=>null,[]),[r,a]=x.useState(()=>t?hJ(t):[]);return x.useEffect(()=>{if(!t)return;const i=t.filter(u=>u.phase==="ready"),c=setInterval(()=>{const u=Array.from({length:1+Math.floor(Math.random()*6)},()=>OD(i));a(f=>[...u,...f].slice(0,2e3))},450);return()=>clearInterval(c)},[t]),t?{...e,sandboxes:t,events:r,demo:!0}:e}const dR=[],mJ={context:'["preview","default"]',gateway:"preview",workspace:"default",label:"Local",remote:!1,connected:!0},fR=40,pJ=["all","running","sleeping","provisioning","error","unknown"],Ys=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),gr=ht,lp=e=>JSON.stringify([Ys(e.location),e.name]),Li=e=>e.toLocaleString("en-US"),ly=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),hR=[{id:"name",label:"Sandbox",width:"26%"},{id:"type",label:"Type",width:"11%",filter:"values"},{id:"phase",label:"Status",width:"11%",filter:"values"},{id:"owner",label:"Owner",width:"12%",filter:"values"},{id:"image",label:"Image",width:"22%",filter:"values"},{id:"startedAt",label:"Uptime",width:"8%"},{id:"createdAt",label:"Created",width:"10%",filter:"recent"}],gJ=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],cy={type:[],phase:[],owner:[],image:[],createdAt:""},xJ=Object.fromEntries(Object.entries(nc).map(([e,t])=>[t.label,e])),zD=()=>n.jsx(PA,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),uy={type:e=>n.jsx(qA,{type:xJ[e.value]}),phase:e=>n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${Gl[e.value].bar}`}),n.jsx("span",{className:"truncate",children:e.label})]}),image:e=>n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx(zD,{}),n.jsx("span",{className:"truncate font-mono text-[11px]",children:e.label})]})},mR={type:e=>e.type,phase:e=>Px(e.sandbox.phase),owner:e=>e.owner,image:e=>e.image},pR=Object.keys(nc);function bJ({onNavigate:e,allowRemote:t=!1,createRequest:r=0,onCreateRequestHandled:a}){const i=Pt(),c=ds(),u=DD(oi()),f=vo(),{locations:h}=f,[m,p]=x.useState(null),g=gn(),[b,v]=x.useState(null),w=Ys(g)??b,[C,S]=x.useState(null),[N,E]=x.useState(!1),[k,A]=x.useState(null),M=t;x.useEffect(()=>{let ve=!0;return i.contextKey().then(Ue=>{ve&&v(JSON.stringify([i.target,Ue]))}).catch(()=>{}),()=>{ve=!1}},[i]);const R=h.find(ve=>Ys(ve)===w),T=(R!=null&&R.connected?R:null)??h.find(ve=>ve.target===i.target&&!ve.remote&&ve.connected)??h.find(ve=>ve.target===i.target&&ve.connected),O=h.find(ve=>Ys(ve)===Ys(C))??C??T,D=x.useSyncExternalStore(lo.subscribe,lo.getSnapshot),B=x.useMemo(()=>D.filter(ve=>ve.status==="created"&&!ve.reported).map(ve=>ve.sandbox),[D]),F=x.useMemo(()=>u.demo?(u.sandboxes??dR).map((ve,Ue)=>{const Qe=R??T??mJ,xt=pR[Ue%pR.length];return{...ve,location:xt===xp(Qe)?Qe:{...Qe,placement:xt,host:`${xt}-demo`}}}):f.sandboxes,[u.demo,u.sandboxes,R,T,f.sandboxes]),K=x.useMemo(()=>{const ve=new Set(F.map(lp));return[...B.filter(Ue=>!ve.has(lp(Ue))).map(Ue=>({...Ue,location:h.find(Qe=>Ys(Qe)===Ys(Ue.location))??Ue.location})),...F]},[F,B,h]),[$,P]=x.useState(""),[U,H]=x.useState(cy),W=(ve,Ue)=>H(Qe=>({...Qe,[ve]:Ue})),[q,Z]=x.useState({key:"name",direction:"asc"}),z=x.useDeferredValue($),[L,X]=x.useState(null),[ee,_]=x.useState(()=>new Set),[V,G]=x.useState(null),[Y,ne]=x.useState(!1),te=x.useRef(!1),[ye,ae]=x.useState([]),[ue,se]=x.useState(!!(c!=null&&c.createRequested));x.useEffect(()=>{c!=null&&c.createRequested&&(c.createRequested.location&&(S(c.createRequested.location),E(!0)),se(!0),c.requestCreate(!1))},[c==null?void 0:c.createRequested]);const[Q,ie]=x.useState(Date.now),oe=x.useRef(null);x.useEffect(()=>{const ve=setInterval(()=>ie(Date.now()),3e4),Ue=Ke=>{var Be;(Ke.metaKey||Ke.ctrlKey)&&Ke.key.toLowerCase()==="k"&&(Ke.preventDefault(),(Be=oe.current)==null||Be.focus())};window.addEventListener("keydown",Ue);const Qe=()=>{try{const Ke=sessionStorage.getItem(ql);if(sessionStorage.removeItem(ql),Ke){let Be;try{Be=JSON.parse(Ke)}catch{}A(Be&&typeof Be.name=="string"?{name:Be.name,context:Ys(Be.location)??(Be.context&&Be.target?JSON.stringify([Be.target,Be.context]):Be.context)}:{name:Ke})}}catch{}},xt=Ke=>{var jt;const Be=Ke.detail;typeof(Be==null?void 0:Be.name)=="string"&&(A({name:Be.name,context:((jt=Be.location)==null?void 0:jt.id)??(Be.context?JSON.stringify([Be.target??i.target,Be.context]):void 0)}),f.refresh())};return Qe(),window.addEventListener("openrod-sandbox-handoff",xt),window.addEventListener(ql,Qe),()=>{clearInterval(ve),window.removeEventListener("keydown",Ue),window.removeEventListener(ql,Qe),window.removeEventListener("openrod-sandbox-handoff",xt)}},[]),x.useEffect(()=>{const ve=(k==null?void 0:k.context)??w;if(!k||!ve||f.loading)return;const Ue=K.find(Qe=>Qe.name===k.name&&Ys(Qe.location)===ve);if(Ue!=null&&Ue.location.connected){X(Ue),A(null);try{sessionStorage.removeItem(ql)}catch{}}},[k,w,f.loading,K]);const pe=x.useRef(null);x.useEffect(()=>{const ve=D.filter(Qe=>Qe.status==="created");if(!pe.current){pe.current=new Set(ve.map(Qe=>Qe.id));return}const Ue=ve.filter(Qe=>!pe.current.has(Qe.id));Ue.length&&(Ue.forEach(Qe=>pe.current.add(Qe.id)),X(null),P(""),H(cy),Z({key:"createdAt",direction:"desc"}),f.refresh())},[D]);const xe=x.useMemo(()=>RW(K),[K]),je=x.useMemo(()=>K.map(ve=>({sandbox:ve,owner:df(ve,c!=null&&c.connected?c.user:null),type:nc[xp(ve.location)].label,image:_p(ve.image,ve.imageTemplateName),search:[ve.name,ve.id,ve.image,ve.imageTemplateName,Dn(ve.location),nc[xp(ve.location)].label,df(ve,c!=null&&c.connected?c.user:null),...ve.providers??[]].join(" ").toLowerCase()})),[K,c==null?void 0:c.connected,c==null?void 0:c.user]),Ie=x.useMemo(()=>Object.fromEntries(Object.entries(mR).map(([ve,Ue])=>{const Qe=new Map;for(const Ke of je)Qe.set(Ue(Ke),(Qe.get(Ue(Ke))??0)+1);for(const Ke of U[ve])Qe.has(Ke)||Qe.set(Ke,0);const xt=[...Qe.keys()].sort(ve==="phase"?(Ke,Be)=>E1.indexOf(Ke)-E1.indexOf(Be):ly.compare);return[ve,xt.map(Ke=>({value:Ke,label:ve==="phase"?Gl[Ke].label:Ke,count:Qe.get(Ke)}))]})),[je,U]),ce=x.useMemo(()=>{const ve=z.trim().toLowerCase(),Ue=U.createdAt?Q-Number(U.createdAt)*864e5:null,Qe=je.filter(Ke=>Object.entries(mR).every(([Be,jt])=>!U[Be].length||U[Be].includes(jt(Ke)))&&(Ue===null||Date.parse(Ke.sandbox.createdAt)>=Ue)&&(!ve||Ke.search.includes(ve))),xt=Ke=>q.key==="owner"||q.key==="image"||q.key==="type"?Ke[q.key]:q.key==="startedAt"?Ke.sandbox.phase==="ready"?Ke.sandbox.startedAt:null:Ke.sandbox[q.key];return Qe.sort((Ke,Be)=>{const jt=xt(Ke),Ze=xt(Be);if(!jt&&Ze)return 1;if(jt&&!Ze)return-1;const Tt=ly.compare(jt??"",Ze??"");return(q.direction==="asc"?Tt:-Tt)||ly.compare(Ke.sandbox.name,Be.sandbox.name)})},[je,U,z,q,Q]);x.useEffect(()=>{const ve=new Set(K.filter(Ue=>{var Qe;return((Qe=Ue.location)==null?void 0:Qe.connected)&&!u.demo}).map(gr));_(Ue=>{const Qe=new Set([...Ue].filter(xt=>ve.has(xt)));return Qe.size===Ue.size?Ue:Qe})},[K,u.demo]);const Te=x.useMemo(()=>K.filter(ve=>{var Ue;return((Ue=ve.location)==null?void 0:Ue.connected)&&ee.has(gr(ve))}),[K,ee]),re=ce.filter(ve=>{var Ue;return((Ue=ve.sandbox.location)==null?void 0:Ue.connected)&&!u.demo}),fe=re.reduce((ve,Ue)=>ve+Number(ee.has(gr(Ue.sandbox))),0),Re=re.length>0&&fe===re.length,Oe=x.useCallback(ve=>{var Ue;(Ue=ve.location)!=null&&Ue.connected&&_(Qe=>{const xt=new Set(Qe),Ke=gr(ve);return xt.has(Ke)?xt.delete(Ke):xt.add(Ke),xt})},[]),ke=()=>_(ve=>{const Ue=new Set(ve);for(const{sandbox:Qe}of re)Re?Ue.delete(gr(Qe)):Ue.add(gr(Qe));return Ue});async function he(){if(te.current||u.demo||!(V!=null&&V.length))return;te.current=!0,ne(!0),ae([]);const ve=new Set,Ue=[];let Qe=0;const xt=async()=>{for(;Qe<V.length;){const Ke=V[Qe++];try{const Be=h.find(jt=>Ys(jt)===Ys(Ke.location));if(!(Be!=null&&Be.connected))throw new Error("Location is disconnected. Reconnect before deleting.");await lr(c!=null&&c.localViewer?Be.target??"local":i.target,i.signal,Be.context).lifecycle(Ke.name,"delete"),ve.add(gr(Ke))}catch(Be){Ue.push({key:gr(Ke),name:Ke.name,location:Ke.location,message:Be.message})}}};try{await Promise.all(Array.from({length:Math.min(4,V.length)},xt)),_(Ke=>new Set([...Ke].filter(Be=>!ve.has(Be)))),ae(Ue),ve.size&&He.success(`Deletion requested for ${Li(ve.size)} ${ve.size===1?"sandbox":"sandboxes"}`),Ue.length&&He.error(`${Li(Ue.length)} ${Ue.length===1?"sandbox could":"sandboxes could"} not be deleted. Review the errors and retry.`),f.refresh()}finally{te.current=!1,ne(!1),G(null)}}const Ae=_x({count:ce.length,rowHeight:fR});x.useEffect(()=>{Ae.scrollToTop()},[z,U,q]);const ge=x.useMemo(()=>kZ(K,30,Q),[K,Q]),Pe=()=>{P(""),H(cy)},Fe=$||Object.values(U).some(ve=>ve.length),_e=K.length===0&&f.loading&&!u.demo,Xe=K.length===0&&f.error,Je=L&&(K.find(ve=>gr(ve)===gr(L))??(L.id==null?K.find(ve=>lp(ve)===lp(L)):null)??L),ct=Je&&(h.find(ve=>Ys(ve)===Ys(Je.location))??Je.location),At=Je?{...u,sandboxes:[Je],events:Ys(ct)===w?u.events:dR,overview:Ys(ct)===w?u.overview:{gateway:{name:ct==null?void 0:ct.gateway,workspace:ct==null?void 0:ct.workspace,remote:ct==null?void 0:ct.remote}},refresh:f.refresh}:null,rt=()=>{E(!1),S(T??null),se(!0)};return x.useEffect(()=>{r&&(rt(),a==null||a())},[r]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Sandbox status",children:pJ.filter(ve=>["all","running","sleeping"].includes(ve)||xe.status[ve]>0||U.phase.includes(ve)).map(ve=>n.jsxs("button",{"aria-pressed":ve==="all"?!U.phase.length:U.phase.length===1&&U.phase[0]===ve,onClick:()=>W("phase",ve==="all"?[]:[ve]),className:`rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${(ve==="all"?!U.phase.length:U.phase.length===1&&U.phase[0]===ve)?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[ve!=="all"&&n.jsx("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${Gl[ve].bar}`}),ve==="all"?"Sandboxes":Gl[ve].label]}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:ve==="all"?xe.total:xe.status[ve]})})]},ve))}),n.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:n.jsx(EZ,{points:ge,height:34,title:"Boxes · 30d"})})]}),n.jsx("div",{className:"flex h-[3px] shrink-0 overflow-hidden",role:"img","aria-label":Object.entries(xe.status).map(([ve,Ue])=>`${Ue} ${Gl[ve].label}`).join(", "),children:Object.entries(xe.status).map(([ve,Ue])=>Ue>0&&n.jsx("span",{className:Gl[ve].strip,style:{width:`${Ue/xe.total*100}%`}},ve))}),f.error&&K.length>0&&n.jsxs(xa,{id:"sandboxes:inventory-error",tone:"warning",title:"Inventory refresh failed",actions:n.jsx(le,{size:"xs",variant:"outline",onClick:f.refresh,children:"Retry"}),children:["Showing the last reading. ",f.error]}),u.demo&&n.jsx("p",{className:"border-b border-border px-6 py-2 text-xs text-amber-700",children:"Preview · synthetic sandbox data"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:oe,value:$,onValueChange:P,placeholder:"Search name, owner, image…","aria-label":"Search sandboxes",className:"mr-auto w-full sm:w-64"}),Fe&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:Pe,children:[n.jsx(Pn,{className:"size-3"}),"Clear"]}),h.filter(ve=>ve.remote&&!ve.connected&&ve.host).map(ve=>n.jsxs(le,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 rounded-full px-2 text-[11px] text-muted-foreground",title:`Reconnect to ${ve.host}`,onClick:()=>p(ve.host),children:[n.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-stone-400"}),ve.host," · Offline"]},Ys(ve))),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh sandboxes",onClick:f.refresh,children:n.jsx(rl,{className:"size-3.5"})}),n.jsxs(le,{size:"sm",disabled:!T&&!M,onClick:rt,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{className:"size-3.5"}),"New sandbox"]})]}),Te.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[n.jsx("strong",{children:Li(Te.length)})," selected",Te.length>fe&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",Li(Te.length-fe)," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:Y,onClick:()=>_(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:Y||u.demo,title:u.demo?"Deletion is unavailable for synthetic preview data":void 0,onClick:()=>G([...Te]),children:[n.jsx(ts,{className:"size-3.5"}),Y?"Deleting…":"Delete selected"]})]}),ye.length>0&&n.jsxs(xa,{id:"sandboxes:delete-errors",tone:"error",title:"Some sandboxes could not be deleted",onDismiss:()=>ae([]),dismissLabel:"Dismiss deletion errors",children:[n.jsx("p",{children:"Failed boxes remain selected for retry."}),n.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:ye.map(ve=>n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:ve.name})," ",n.jsx(ga,{location:ve.location}),": ",ve.message]},ve.key))})]}),n.jsx("div",{ref:Ae.ref,onScroll:Ae.onScroll,tabIndex:0,role:"region","aria-label":"Sandbox inventory",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:_e?n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading sandboxes…"}):Xe?n.jsxs("div",{role:"alert",className:"py-16 text-center",children:[n.jsx("p",{children:"Inventory unavailable"}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:f.error}),n.jsx(le,{variant:"outline",onClick:f.refresh,className:"mt-4",children:"Retry"})]}):ce.length?n.jsxs("table",{"aria-label":"Sandboxes","aria-rowcount":ce.length+1,className:"w-full min-w-[1040px] table-fixed border-separate border-spacing-0 text-xs",children:[n.jsxs("colgroup",{children:[n.jsx("col",{style:{width:48}}),hR.map(ve=>n.jsx("col",{style:{width:ve.width}},ve.id))]}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsxs("tr",{"aria-rowindex":1,children:[n.jsx("th",{scope:"col",className:"h-9 border-b border-border px-4 sm:pl-6",children:n.jsx(ID,{label:"Select all matching sandboxes",checked:Re,mixed:fe>0&&!Re,disabled:Y||!re.length,onChange:ke})}),hR.map(ve=>n.jsx("th",{scope:"col","aria-sort":q.key===ve.id?q.direction==="asc"?"ascending":"descending":"none",className:"group/column h-9 border-b border-border px-4 text-left font-medium text-muted-foreground first:pl-6",children:n.jsxs("div",{className:"flex h-9 items-center gap-1",children:[n.jsxs("button",{onClick:()=>Z(Ue=>({key:ve.id,direction:Ue.key===ve.id&&Ue.direction==="asc"?"desc":"asc"})),className:"flex h-9 min-w-0 items-center gap-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("span",{className:"truncate",children:ve.label}),q.key===ve.id&&(q.direction==="asc"?n.jsx(_f,{className:"size-3 shrink-0"}):n.jsx(Pf,{className:"size-3 shrink-0"}))]}),n.jsx(yJ,{column:ve,sort:q,onSort:Ue=>Z({key:ve.id,direction:Ue}),values:Ie[ve.id],value:U[ve.id],onFilter:Ue=>W(ve.id,Ue)})]})},ve.id))]})}),n.jsxs("tbody",{children:[Ae.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:8,style:{height:Ae.paddingTop,padding:0,border:0}})}),ce.slice(Ae.start,Ae.end).map((ve,Ue)=>{var Qe;return n.jsx(vJ,{row:ve,now:Q,index:Ae.start+Ue+2,onOpen:X,selected:ee.has(gr(ve.sandbox)),onSelect:Oe,disabled:Y||u.demo||!((Qe=ve.sandbox.location)!=null&&Qe.connected)},gr(ve.sandbox))}),Ae.end<ce.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:8,style:{height:(ce.length-Ae.end)*fR,padding:0,border:0}})})]})]}):n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(hc,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:K.length?"No matching sandboxes":"No sandboxes yet"}),n.jsx(le,{variant:"outline",disabled:!K.length&&!T&&!M,className:"mt-4",onClick:()=>K.length?Pe():rt(),children:K.length?"Clear filters":"Create sandbox"})]})}),n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:Li(ce.length)}),Fe?` of ${Li(K.length)}`:""," sandboxes"]}),n.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),Je&&(ct==null?void 0:ct.connected)&&n.jsx(Zn,{location:ct,children:n.jsx(KZ,{name:Je.name,sandbox:Je,liveData:At,onClose:()=>X(null),onNavigate:e,onChanged:f.refresh})},gr(Je)),n.jsx(Fr,{open:V!==null,onOpenChange:ve=>{!ve&&!te.current&&G(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",Li((V==null?void 0:V.length)??0)," ",(V==null?void 0:V.length)===1?"sandbox":"sandboxes","?"]}),n.jsx(Xr,{children:"This permanently deletes the selected sandboxes and their data. This cannot be undone."})]}),n.jsx("ul",{"aria-label":"Sandboxes to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:V==null?void 0:V.map(ve=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[ve.name,n.jsx(ga,{location:ve.location})]},gr(ve)))}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:Y,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:Y||!(V!=null&&V.length),onClick:he,children:Y?"Deleting…":"Delete sandboxes"})]})]})}),n.jsx(tn,{open:!!m,onOpenChange:ve=>{ve||p(null)},children:n.jsxs(nn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsxs(Qt,{children:["Connect to ",m]})}),m&&n.jsx(Lw,{initialHost:m,onConnected:()=>{p(null),f.refresh()},onBack:()=>p(null)},m)]})}),n.jsx(Zn,{location:O,children:n.jsx(MD,{initialLocationConfirmed:N,open:ue,onOpenChange:se,locations:h,location:O,onLocationChange:S,onRefreshLocations:f.refresh,allowRemote:M})})]})}const vJ=x.memo(function({row:t,now:r,index:a,onOpen:i,selected:c,onSelect:u,disabled:f}){var w;const{sandbox:h,owner:m,image:p}=t,g="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground",b=!((w=h.location)!=null&&w.connected),v=`${h.name} at ${Dn(h.location)}`;return n.jsxs("tr",{"aria-rowindex":a,"aria-disabled":b||void 0,onClick:()=>{b||i(h)},className:`group transition-colors ${b?"opacity-60":"cursor-pointer hover:bg-muted/60 focus-within:bg-muted/60"} ${c?"bg-accent/40":"bg-card"}`,children:[n.jsx("td",{className:`${g} sm:pl-6`,onClick:C=>C.stopPropagation(),children:n.jsx(ID,{label:`Select ${v}`,checked:c,disabled:f,onChange:()=>u(h)})}),n.jsx("td",{className:`${g} pl-6`,children:n.jsxs("button",{disabled:b,"aria-haspopup":"dialog","aria-label":`Open ${v}`,onClick:C=>{C.stopPropagation(),b||i(h)},className:"flex h-9 w-full min-w-0 items-center gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed",children:[n.jsx(hc,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate font-medium text-foreground",title:h.name,children:h.name}),n.jsx(Zi,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),n.jsx("td",{className:g,children:n.jsx(Hs,{location:h.location})}),n.jsx("td",{className:g,children:n.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[n.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${Za(h.phase).bar}`}),Cg[h.phase]??"Unknown"]})}),n.jsx("td",{className:g,children:n.jsx("span",{className:"block truncate",title:m,children:m})}),n.jsx("td",{className:g,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",title:h.image||p,children:[n.jsx(zD,{}),n.jsx("span",{className:"truncate font-mono text-[11px]",children:p})]})}),n.jsx("td",{className:g,children:n.jsx("span",{className:"block truncate font-mono text-[11px]",title:"Uptime requires a reported start time",children:AW(h,r)})}),n.jsx("td",{className:g,children:n.jsxs("span",{className:"block truncate tabular-nums",title:h.createdAt||"Not reported",children:[K4(h.createdAt,r),h.createdAt?" ago":""]})})]})});function ID({label:e,checked:t,mixed:r=!1,disabled:a,onChange:i}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),n.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:i,className:"block size-4 cursor-pointer rounded border-border accent-[var(--action)] focus-visible:outline-2 focus-visible:outline-ring disabled:cursor-not-allowed"})}function yJ({column:e,sort:t,onSort:r,values:a,value:i,onFilter:c}){const u=e.filter==="values"?i.length>0:e.filter==="recent"?!!i:!1,f=t.key===e.id?t.direction:null,h=m=>c(i.includes(m)?i.filter(p=>p!==m):[...i,m]);return n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx("button",{type:"button","aria-label":`Sort and filter ${e.label}${u?" (filtered)":""}`,className:`flex h-6 shrink-0 items-center justify-center overflow-hidden rounded outline-none hover:bg-background/70 hover:text-foreground focus-visible:w-6 focus-visible:ring-2 focus-visible:ring-ring data-[popup-open]:w-6 ${u?"w-6 text-foreground":"w-0 group-hover/column:w-6"}`}),children:n.jsx(c8,{className:"size-3.5 shrink-0"})}),n.jsxs(qi,{align:"start",className:"w-56",children:[n.jsxs(Ip,{children:[n.jsxs(Rs,{className:"text-xs",onClick:()=>r("asc"),children:[n.jsx(_f,{className:"size-3.5"}),"Sort ascending",f==="asc"&&n.jsx(Yn,{className:"ml-auto size-3.5"})]}),n.jsxs(Rs,{className:"text-xs",onClick:()=>r("desc"),children:[n.jsx(Pf,{className:"size-3.5"}),"Sort descending",f==="desc"&&n.jsx(Yn,{className:"ml-auto size-3.5"})]})]}),e.filter==="values"&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Ip,{children:[n.jsx(T1,{className:"text-[11px]",children:"Show only"}),n.jsx("div",{className:"max-h-64 overflow-y-auto",children:a.map(m=>{var p;return n.jsxs(Fw,{checked:i.includes(m.value),onCheckedChange:()=>h(m.value),closeOnClick:!1,className:"text-xs",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:((p=uy[e.id])==null?void 0:p.call(uy,m))??m.label}),n.jsx("span",{className:"ml-2 font-mono text-[10px] tabular-nums text-muted-foreground",children:Li(m.count)})]},m.value)})})]})]}),e.filter==="recent"&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Ip,{children:[n.jsx(T1,{className:"text-[11px]",children:"Created"}),n.jsxs(GX,{value:i,onValueChange:c,children:[n.jsx(yE,{value:"",className:"text-xs",children:"Any time"}),gJ.map(m=>n.jsx(yE,{value:m.value,className:"text-xs",children:m.label},m.value))]})]})]}),u&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{className:"text-xs",onClick:()=>c(e.filter==="values"?[]:""),children:[n.jsx(Pn,{className:"size-3.5"}),"Clear filter"]})]})]})]})}const wJ=new Set(["time","sandbox","scope","sandboxId","agent","category","severity","logLevel","direction","verdict","outcome","process","action","destination","policy","session","correlation","why"]),_1=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;return r<e.length&&r<t.length?e.codePointAt(r)-t.codePointAt(r):e.length-t.length},jJ=e=>typeof e=="boolean"?Number(e):typeof e=="number"?Number.isFinite(e)?e:null:e==null?null:typeof e=="object"?JSON.stringify(e):String(e),gR=e=>e===null?0:typeof e=="number"?1:2,SJ=(e,t)=>gR(e)-gR(t)||(typeof e=="number"?e-t:typeof e=="string"?_1(e,t):0),NJ=e=>{const t=String(e??"").replace(/[a-z]+/g,r=>r.toUpperCase());return Object.hasOwn(jg,t)?jg[t]:-1};function CJ(e,t){const r=wJ.has(t==null?void 0:t.key)?t.key:"time",a=(t==null?void 0:t.direction)==="asc"?1:-1,i=c=>r==="time"?Number.isFinite(c.timestamp)?c.timestamp:0:r==="severity"?NJ(c.values.severity):jJ(c.values[r]);return e.map(c=>[i(c),c]).sort(([c,u],[f,h])=>a*SJ(c,f)||_1(String(u.event.originalId??u.event.id??""),String(h.event.originalId??h.event.id??""))||_1(u.key,h.key)).map(([,c])=>c)}function kJ(e,t,r){const a=new Map,i=new Map;let c=0;return{...e,async activity(u={}){const{offset:f=0,limit:h=50,snapshot:m={},exportAll:p,...g}=u,b=g.now??Date.now(),{now:v,...w}=g,C=JSON.stringify(w),S=t(),N=[],E=await Promise.all(S.map(async(R,T)=>{const O=R.id??R.context,D=`${O}:${C}`,B=p?null:a.get(D);if(!R.connected)return N[T]={label:Dn(R),offline:!0},B?{...B,total:B.events.length,events:B.events.map(F=>({...F,location:R}))}:null;try{const F=[];let K,$=0,P=m==null?void 0:m[O];const U=p?1/0:f+h;do K=await r(R).activity({...g,now:b,offset:$,limit:Math.min(1e3,U-$),...P!=null?{snapshot:P}:{}}),P=K.snapshot,F.push(...K.events.map(W=>({...W,originalId:W.id,id:ht({id:W.id,location:R}),location:R}))),$+=K.events.length;while($<U&&$<K.total&&K.events.length);const H={...K,events:F,identity:O,snapshot:P};return p||a.set(D,H),H}catch(F){return N[T]={label:Dn(R),error:F.message},B?{...B,total:B.events.length,events:B.events.map(K=>({...K,location:{...R,connected:!1}}))}:{error:F}}})),k=E.filter(R=>R&&!R.error);if(!k.length&&E.some(R=>R==null?void 0:R.error))throw E.find(R=>R==null?void 0:R.error).error;const A=CJ(k1(k.flatMap(R=>R.events).map(Pw),{...g,now:b,sort:{key:"time"}}),g.sort).map(R=>R.event),M=k.reduce((R,T)=>R+T.total,0);return{events:p?A:A.slice(f,f+h),total:M,now:b,snapshot:Object.fromEntries(k.map(R=>[R.identity,R.snapshot])),sandboxes:[...new Set(k.flatMap(R=>R.sandboxes??[]))],agents:[...new Set(k.flatMap(R=>R.agents??[]))],nextOffset:f+h<M?f+h:null,unavailable:N.filter(Boolean)}},async previewActivityDeletion({mode:u,ids:f=[],query:h}){const p=t().filter(v=>u!=="selected"||f.some(w=>{try{return JSON.parse(w)[0][0]===(v.target??"local")&&JSON.parse(w)[0][1]===v.context}catch{return!1}}));if(u==="selected"&&p.some(v=>!v.connected))throw new Error("Reconnect the source of the selected logs before deleting them.");const g=[];for(const v of p.filter(w=>w.connected)){const w=f.filter(S=>{try{const[N]=JSON.parse(S);return N[0]===(v.target??"local")&&N[1]===v.context}catch{return!1}}).map(S=>JSON.parse(S)[1]),C=await r(v).previewActivityDeletion({mode:u,...u==="selected"?{ids:w}:{},query:h});g.push({location:v,plan:C})}const b=`combined:${++c}`;return i.set(b,{entries:g,deleted:0}),{token:b,mode:u,count:g.reduce((v,w)=>v+w.plan.count,0),expiresAt:g.length?Math.min(...g.map(v=>v.plan.expiresAt)):Date.now(),sources:g.map(v=>({label:Dn(v.location),count:v.plan.count})),skipped:p.filter(v=>!v.connected).map(Dn)}},async deleteActivity(u){const f=i.get(u);if(!f)throw new Error("Review the log deletion again.");for(;f.entries.length;){const h=f.entries[0],m=await r(h.location).deleteActivity(h.plan.token);f.deleted+=m.deleted,f.entries.shift()}return i.delete(u),{deleted:f.deleted}}}}const dy=()=>({name:"",url:"",format:"ocsf",auth:"none",token:"",sandboxes:"",category:"",verdict:""}),cp="h-9 w-full rounded-md border border-border bg-card px-2 text-xs",fy=e=>e?new Date(e).toLocaleString():"Never";function xR(){const e=Pt(),[t,r]=x.useState([]),[a,i]=x.useState(dy),[c,u]=x.useState(!1),[f,h]=x.useState(null),[m,p]=x.useState(null),[g,b]=x.useState(null),[v,w]=x.useState(!1),C=x.useCallback(async()=>{try{r(await e.activityDestinations()),b(null),w(!0)}catch(k){b(k.message)}},[e]);x.useEffect(()=>{C();const k=setInterval(C,5e3);return()=>clearInterval(k)},[C]);const S=k=>({value:a[k],onChange:A=>i(M=>({...M,[k]:A.target.value}))});async function N(k,A){p(k);try{const M=await e.activityDestinationAction(k,A);A==="test"&&He.success(`Test accepted · HTTP ${M.status}`),await C(),h(null)}catch(M){He.error(M.message),await C()}finally{p(null)}}async function E(k){k.preventDefault(),p("new");try{await e.createActivityDestination({name:a.name,url:a.url,format:a.format,auth:a.auth,token:a.token,filters:{sandboxes:a.sandboxes.split(",").map(A=>A.trim()).filter(Boolean),categories:a.category?[a.category]:[],verdicts:a.verdict?[a.verdict]:[]}}),i(dy()),u(!1),await C(),He.success("Webhook saved. Test it, then enable forwarding.")}catch(A){He.error(A.message)}finally{p(null)}}return n.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[n.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Webhooks start paused. Test the connection, then enable forwarding."}),g&&n.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-xs",children:[g,n.jsx("button",{className:"ml-2 underline",onClick:C,children:"Retry"})]}),!v&&!g&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading webhooks…"}),t.map(k=>n.jsxs("section",{className:"space-y-3 rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h3",{className:"truncate text-sm font-medium",children:k.name}),n.jsx("span",{className:`text-xs ${k.error?"text-amber-700":"text-muted-foreground"}`,children:k.enabled?k.error?"Retrying":"Enabled":k.error?"Needs attention":"Paused"})]}),n.jsx("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:k.url}),n.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[k.delivered.toLocaleString()," delivered · ",k.backlog.toLocaleString()," pending"]}),n.jsxs("details",{className:"text-xs",children:[n.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Delivery details"}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.format==="ocsf"?"OCSF JSON":"Console JSON"," · ",k.auth==="none"?"No authentication":k.auth==="bearer"?"Bearer token":"API key"]}),n.jsxs("p",{className:"text-xs",children:[k.filters.sandboxes.join(", ")||"All sandboxes"," · ",k.filters.categories.join(", ")||"All event types"," · ",k.filters.verdicts.join(", ")||"All decisions"]}),n.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-xs",children:[n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Delivered"}),n.jsx("dd",{className:"mt-1",children:k.delivered.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Pending"}),n.jsx("dd",{className:"mt-1",children:k.backlog.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("dt",{className:"text-muted-foreground",children:"Filtered out"}),n.jsx("dd",{className:"mt-1",children:k.skipped.toLocaleString()})]})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Last delivery: ",fy(k.lastDeliveredAt),k.lastStatus?` · HTTP ${k.lastStatus}`:""]}),k.lastTest&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Test: ",k.lastTest.ok?`Accepted · HTTP ${k.lastTest.status}`:k.lastTest.error," · ",fy(k.lastTest.at)]})]})]}),k.error&&n.jsxs("p",{role:"status",className:"text-xs text-amber-700",children:[k.error," · Attempt ",k.attempts,"/8",k.enabled?` · Next retry ${fy(k.nextAttempt)}`:" · Forwarding paused; queued events retained"]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(le,{size:"xs",variant:"outline",disabled:!!m,onClick:()=>N(k.id,"test"),children:"Send test"}),n.jsx(le,{size:"xs",variant:"outline",disabled:!!m,onClick:()=>N(k.id,k.enabled?"pause":"resume"),children:k.enabled?"Pause":"Enable forwarding"}),k.error&&n.jsx(le,{size:"xs",variant:"outline",disabled:!!m,onClick:()=>N(k.id,"retry"),children:"Retry now"}),n.jsx(le,{size:"xs",variant:"ghost",disabled:!!m,onClick:()=>h(k.id),children:"Remove"})]}),f===k.id&&n.jsxs("div",{className:"space-y-2 border-t border-border pt-3 text-xs",children:[n.jsx("p",{children:"Remove this webhook and its delivery position? Activity history will remain."}),n.jsx(le,{size:"xs",variant:"destructive",disabled:!!m,onClick:()=>N(k.id,"remove"),children:"Remove webhook"}),n.jsx(le,{size:"xs",variant:"ghost",onClick:()=>h(null),children:"Cancel"})]})]},k.id)),v&&!t.length&&!c&&n.jsxs("div",{className:"rounded-lg border border-dashed border-border p-6 text-center",children:[n.jsx("p",{className:"text-sm",children:"No webhooks connected"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Send activity to your monitoring tools."})]}),c?n.jsxs("form",{onSubmit:E,className:"space-y-4 rounded-lg border border-border p-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:"New webhook"}),n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"Name"}),n.jsx(Ot,{required:!0,maxLength:80,placeholder:"Security monitoring",...S("name")})]}),n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"HTTPS endpoint"}),n.jsx(Ot,{required:!0,type:"url",placeholder:"https://logs.example.com/events",...S("url")})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use a public HTTPS endpoint that accepts JSON."}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Event format"}),n.jsxs(pn,{className:cp,...S("format"),children:[n.jsx("option",{value:"ocsf",children:"OCSF JSON"}),n.jsx("option",{value:"json",children:"Console JSON"})]})]}),n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Authentication"}),n.jsxs(pn,{className:cp,...S("auth"),children:[n.jsx("option",{value:"none",children:"None"}),n.jsx("option",{value:"bearer",children:"Bearer token"}),n.jsx("option",{value:"api-key",children:"X-API-Key"})]})]})]}),a.auth!=="none"&&n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:a.auth==="bearer"?"Bearer token":"API key"}),n.jsx(Ot,{required:!0,type:"password",autoComplete:"new-password",...S("token")})]}),n.jsxs("details",{className:"rounded-md border border-border p-3",children:[n.jsxs("summary",{className:"cursor-pointer text-xs font-medium",children:["Event filters ",n.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",a.sandboxes||a.category||a.verdict?"Custom":"All events"]})]}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsxs("label",{className:"block space-y-1 text-xs",children:[n.jsx("span",{children:"Sandboxes"}),n.jsx(Ot,{placeholder:"All sandboxes, or comma-separated names",...S("sandboxes")})]}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Event type"}),n.jsxs(pn,{className:cp,...S("category"),children:[n.jsx("option",{value:"",children:"All event types"}),Object.entries({NET:"Network",HTTP:"HTTP",SSH:"Session",AUTH:"Authentication",PROC:"Process",FILE:"File",CONFIG:"Configuration",FINDING:"Finding",EVENT:"Event"}).map(([k,A])=>n.jsx("option",{value:k,children:A},k))]})]}),n.jsxs("label",{className:"space-y-1 text-xs",children:[n.jsx("span",{children:"Decision"}),n.jsxs(pn,{className:cp,...S("verdict"),children:[n.jsx("option",{value:"",children:"All decisions"}),n.jsx("option",{value:"allowed",children:"Allowed"}),n.jsx("option",{value:"denied",children:"Denied"})]})]})]})]})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Forwarding includes original log data. You can enable it after saving."}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(le,{type:"submit",size:"sm",disabled:!!m,children:"Save paused"}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>{u(!1),i(dy())},children:"Cancel"})]})]}):n.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(!0),children:"Add webhook"}),n.jsxs("details",{className:"border-t border-border pt-4 text-[11px] text-muted-foreground",children:[n.jsx("summary",{className:"cursor-pointer text-xs hover:text-foreground",children:"Integration details"}),n.jsxs("div",{className:"mt-3 space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Events are collected from the time the webhook is created and sent while the console server runs, even with this drawer closed. Existing history is not backfilled."}),n.jsx("p",{children:"The endpoint receives one JSON event per HTTPS POST and must return HTTP 2xx. Vendor-specific formats such as Splunk HEC need an adapter. Acceptance confirms receipt, not indexing."}),n.jsx("p",{children:"Delivery is at least once. Deduplicate using the Idempotency-Key header or event ID. Failures retry with backoff and pause after 8 attempts. History and delivery positions survive restarts; collection gaps still apply."}),n.jsx("p",{children:"OCSF uses version 1.4.0, Base Event, with source fields in unmapped.openshell. Credentials are stored locally in a file restricted to your OS account and are never returned to the browser."})]})]})]})}const PD="1.4.0";function bR(e){const t=Date.parse(e.at),r=Date.parse(e.receivedAt);if(!Number.isFinite(t)&&!Number.isFinite(r))throw new Error("OCSF export requires an event or collection timestamp");const a={INFO:1,INFORMATIONAL:1,LOW:2,MED:3,MEDIUM:3,HIGH:4,CRITICAL:5,FATAL:6}[String(e.severity).toUpperCase()]??0,i=e.action||e.method;return{category_uid:0,class_uid:0,activity_id:i?99:0,type_uid:i?99:0,...i?{activity_name:i}:{},severity_id:a,time:Number.isFinite(t)?t:r,metadata:{version:PD,product:{name:"OpenRod",vendor_name:"OpenRod"},...e.id?{uid:e.id}:{},...Number.isFinite(r)?{logged_time:r}:{},...e.correlationId?{correlation_uid:e.correlationId}:{}},...e.message?{message:e.message}:{},status_id:e.outcome==="success"?1:e.outcome==="failure"?2:0,raw_data:JSON.stringify(e.original??e),unmapped:{openshell:e,time_basis:Number.isFinite(t)?"source_event":"collection_time; source timestamp unavailable"}}}function TJ(e,t="json",r){if(!Array.isArray(r))return t==="ocsf"?bR(e):e;const a=Pw(e).values,i=Object.fromEntries(r.filter(u=>Object.hasOwn(a,u)).map(u=>[u,a[u]]));if(t!=="ocsf")return i;const c=bR(e);return{category_uid:0,class_uid:0,activity_id:r.includes("action")?c.activity_id:0,type_uid:r.includes("action")?c.type_uid:0,...r.includes("action")&&c.activity_name?{activity_name:c.activity_name}:{},severity_id:r.includes("severity")?c.severity_id:0,time:c.time,metadata:{version:PD,product:c.metadata.product},unmapped:{openshell:i,time_basis:c.unmapped.time_basis}}}function EJ(e,t,r="json"){const a=e.map(i=>TJ(i,r,t==null?void 0:t.columns));return r==="ocsf"?a:{exportedAt:new Date().toISOString(),context:t,events:a}}function RJ(e,{paused:t,demo:r,activityRevision:a}){const i=Pt(),c=x.useRef(t);c.current=t;const u=JSON.stringify(e),[f,h]=x.useState({events:[],total:0,nextOffset:null}),[m,p]=x.useState(0),[g,b]=x.useState(null),[v,w]=x.useState(!1),[C,S]=x.useReducer(A=>A+1,0),N=x.useRef(0),E=x.useRef(0);return x.useEffect(()=>{const A=++N.current;if(r)return;let M=!0;const R=async(O=!1)=>{const D=++E.current;w(!0);try{const B=await i.activity(JSON.parse(u));M&&N.current===A&&D===E.current&&(!O||!c.current)&&(h(B),b(null))}catch(B){M&&D===E.current&&b(B.message)}finally{M&&D===E.current&&w(!1)}};p(0),h({events:[],total:0,nextOffset:null}),R();const T=setInterval(()=>{c.current||R(!0)},5e3);return()=>{M=!1,clearInterval(T)}},[u,r,C,a,i]),{...f,loading:v,error:g,page:m,goToPage:async A=>{if(v||A<0||A>=Math.ceil(f.total/e.limit))return;const M=N.current,R=++E.current;w(!0);try{const T=await i.activity({...JSON.parse(u),snapshot:f.snapshot,offset:A*e.limit,now:f.now});M===N.current&&R===E.current&&(h(T),p(A),b(null))}catch(T){M===N.current&&R===E.current&&b(T.message)}finally{M===N.current&&R===E.current&&w(!1)}},refresh:S}}const Vl=50,up=[{id:"time",label:"Time",width:150},{id:"severity",label:"Security severity",width:150},{id:"logLevel",label:"Log level",width:110},{id:"source",label:"Source",width:110},{id:"sandbox",label:"Sandbox",width:125},{id:"agent",label:"Observed agent",width:145},{id:"action",label:"Activity",width:200},{id:"verdict",label:"Decision",width:125},{id:"destination",label:"Target",width:260}],AJ=Object.fromEntries(Rx.map(e=>[e.name,{name:e.name,logo:`/logos/agents/${e.logo}.svg`}])),dp={all:"Available history",15:"Last 15 minutes",60:"Last hour",1440:"Last 24 hours",custom:"Custom range"},xr="h-8 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",MJ=e=>Number.isFinite(Date.parse(e))?new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-",vR=e=>new Intl.ListFormat("en",{type:"conjunction"}).format(e),yR=e=>e.offline?`${e.label} is offline`:`Could not load logs from ${e.label}`;function hy({options:e,selected:t,onChange:r,label:a}){const[i,c]=x.useState(""),u=x.useDeferredValue(i),f=x.useMemo(()=>e.filter(p=>p.toLowerCase().includes(u.toLowerCase())),[e,u]),h=_x({count:f.length,rowHeight:32});x.useEffect(()=>{h.scrollToTop()},[u]);const m=new Set(t);return n.jsxs(n.Fragment,{children:[n.jsx(yo,{"aria-label":`Search ${a}`,placeholder:`Search ${a.toLowerCase()}…`,value:i,onValueChange:c}),n.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[t.length.toLocaleString()," selected · ",f.length.toLocaleString()," matches"]}),n.jsx("button",{onClick:()=>r([]),className:"underline",children:"Clear"})]}),n.jsxs("div",{ref:h.ref,onScroll:h.onScroll,className:"h-56 overflow-auto",role:"group","aria-label":a,children:[n.jsx("div",{style:{height:h.totalHeight,position:"relative"},children:n.jsx("div",{style:{transform:`translateY(${h.paddingTop}px)`},children:f.slice(h.start,h.end).map(p=>n.jsxs("label",{className:"flex h-8 cursor-pointer items-center gap-2 rounded px-2 text-xs hover:bg-muted",children:[n.jsx("input",{type:"checkbox",checked:m.has(p),onChange:()=>r(m.has(p)?t.filter(g=>g!==p):[...t,p])}),n.jsx("span",{className:"truncate",title:p,children:p})]},p))})}),!f.length&&n.jsx("p",{className:"py-5 text-center text-xs text-muted-foreground",children:"No matches"})]})]})}function fp(e){if(!e||!Number.isFinite(Date.parse(e)))return e||"";const t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,19)}function OJ(){try{const e=JSON.parse(new URLSearchParams(window.location.search).get("investigation")||"{}");if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const r of["query","direction","range","from","to"])typeof e[r]=="string"&&(t[r]=e[r]);for(const r of["sandboxes","verdicts","agents"])Array.isArray(e[r])&&e[r].every(a=>typeof a=="string")&&(t[r]=e[r]);return e.filters&&typeof e.filters=="object"&&Object.values(e.filters).every(r=>r&&typeof r.value=="string"&&["equals","contains","excludes"].includes(r.mode))&&(t.filters=e.filters),e.sort&&typeof e.sort.key=="string"&&["asc","desc"].includes(e.sort.direction)&&(t.sort=e.sort),_D(t)}catch{return{}}}function _D(e){var a,i;if(((i=(a=e.filters)==null?void 0:a.agent)==null?void 0:i.mode)!=="equals")return e;const{agent:t,...r}=e.filters;return{...e,agents:e.agents??(t.value?[t.value]:[]),filters:r}}function DJ(){try{const e=JSON.parse(localStorage.getItem("openshell.activity.views")||"[]");return Array.isArray(e)?e.filter(t=>t&&typeof t.name=="string"&&t.query&&typeof t.query=="object"):[]}catch{return[]}}function wR(e,t,r){const a=new Blob([JSON.stringify(EJ(e,t,r),null,2)],{type:"application/json"}),i=URL.createObjectURL(a),c=document.createElement("a");c.href=i,c.download=r==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",c.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function zJ(){const e=Pt(),t=Uu([]),r=x.useRef(t.locations);r.current=t.locations;const a=JSON.stringify(t.locations.map(c=>[c.id,c.connected])),i=x.useMemo(()=>kJ(e,()=>r.current,t.apiFor),[e,t.apiFor]);return t.inventory.loading?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading activity…"}):n.jsx(e3,{api:i,children:n.jsx(LD,{combined:!0,sourceRevision:a})})}function IJ({combined:e}){const t=gn();return e?n.jsx(zJ,{}):n.jsx(LD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function LD({combined:e,sourceRevision:t}){var wt,cn,Gt,fn,Bn,Kn;const r=Pt(),a=gn(),i=DD(oi()),[c]=x.useState(OJ),[u,f]=x.useState(["time","source","sandbox","agent","action","verdict","destination"]),h=up.filter(de=>u.includes(de.id)),[m,p]=x.useState(DJ),[g,b]=x.useState(""),[v,w]=x.useState(!1),[C,S]=x.useState("columns"),[N,E]=x.useState(null),[k,A]=x.useState(!1),[M,R]=x.useState(null),[T,O]=x.useState(Date.now),[D,B]=x.useState(c.query??""),[F,K]=x.useState(c.direction??"all"),[$,P]=x.useState(c.sandboxes??[]),[U,H]=x.useState(c.agents??[]),[W,q]=x.useState(c.verdicts??[]),[Z,z]=x.useState(c.filters??{}),[L,X]=x.useState(c.range??"all"),[ee,_]=x.useState(fp(c.from)),[V,G]=x.useState(fp(c.to)),[Y,ne]=x.useState(c.sort??{key:"time",direction:"desc"}),[te,ye]=x.useState(null),[ae,ue]=x.useState(()=>new Set),[se,Q]=x.useState(null),[ie,oe]=x.useState(!1),[pe,xe]=x.useState(null),je=x.useDeferredValue(D),Ie={query:je,direction:F,sandboxes:$,verdicts:W,agents:U,filters:Z,range:L,from:ee&&Number.isFinite(Date.parse(ee))?new Date(ee).toISOString():ee,to:V&&Number.isFinite(Date.parse(V))?new Date(V).toISOString():V,sort:Y},ce=JSON.stringify(Ie),[Te,re]=x.useState({query:ce,page:0}),fe=RJ({...Ie,limit:Vl},{paused:!!M,demo:i.demo,activityRevision:e?`${i.activityRevision}:${t}`:i.activityRevision});x.useEffect(()=>{ue(new Set),ye(null)},[i.activityRevision]),x.useEffect(()=>{ue(new Set)},[je,F,$,W,U,Z,L,ee,V]);async function Re(de,tt){Xe(),oe(!0),xe(null);try{const Et=await r.previewActivityDeletion({mode:de,ids:tt||[...ae],query:Ie});Q(Et)}catch(Et){He.error(Et.message)}finally{oe(!1)}}async function Oe(){oe(!0),xe(null);try{const de=await r.deleteActivity(se.token);Q(null),ye(null),ue(new Set),R([]),fe.refresh(),i.refresh();const tt=se.skipped??[];He.success(`Deleted ${de.deleted.toLocaleString()} log${de.deleted===1?"":"s"}`,tt.length?{description:`${vR(tt)} ${tt.length===1?"was offline; its":"were offline; their"} logs were kept.`}:void 0)}catch(de){xe(de.message)}finally{oe(!1)}}function ke(de){Xe(),ue(tt=>{const Et=new Set(tt);return Et.has(de)?Et.delete(de):Et.size<5e3&&Et.add(de),Et})}const he=i.demo?M??i.events:fe.events;function Ae(de){i.demo||en.capture("feature_used",{feature:"activity",action:"filter_applied"}),de=_D(de),Xe(),B(de.query||""),K(de.direction||"all"),P(de.sandboxes||[]),q(de.verdicts||[]),H(de.agents||[]),z(de.filters||{}),X(de.range||"all"),_(fp(de.from)),G(fp(de.to)),ne(de.sort||{key:"time",direction:"desc"})}function ge(de,tt){Ae({filters:{[de]:{mode:"equals",value:tt}}}),ye(null)}function Pe(de){E({format:de,columns:[...u],range:L,from:ee,to:V})}const Fe=N&&(!N.columns.length||N.range==="custom"&&(!N.from&&!N.to||N.from&&!Number.isFinite(Date.parse(N.from))||N.to&&!Number.isFinite(Date.parse(N.to))||N.from&&N.to&&Date.parse(N.from)>Date.parse(N.to)));async function _e(){var un;if(!N||Fe)return;const{format:de,columns:tt,range:Et,from:on,to:xn}=N,Wt={...Ie,columns:tt,range:Et,from:on?new Date(on).toISOString():"",to:xn?new Date(xn).toISOString():""};A(!0);try{if(i.demo){wR(k1(ct,{...Wt,now:T}).map(Jn=>Jn.event),{...Wt,demo:!0},de),E(null);return}if(e){const Jn=await r.activity({...Wt,exportAll:!0});wR(Jn.events.map(({originalId:wo,id:jo,...cr})=>({...cr,id:wo})),Wt,de),E(null),(un=Jn.unavailable)!=null&&un.length&&He.warning("Some logs were not exported",{description:Jn.unavailable.map(yR).join(`
|
|
526
|
+
`)});return}const ns=document.createElement("a");ns.href=r.url("/activity/export",{format:de,query:JSON.stringify(Wt),context:await r.contextKey(),...a?{location:"1"}:{}}),ns.download=de==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",document.body.appendChild(ns),ns.click(),ns.remove(),E(null)}catch(ns){He.error(`Export failed: ${ns.message}`)}finally{A(!1)}}const Xe=()=>{M||(R(he),O(Date.now()))},Je=de=>tt=>{Xe(),de(tt)},ct=x.useMemo(()=>he.map(Pw),[he]),At=x.useMemo(()=>[...new Set([...(i.sandboxes??[]).map(de=>de.name),...fe.sandboxes??[],...he.map(de=>de.sandbox),...$].filter(Boolean))].sort(),[i.sandboxes,fe.sandboxes,he,$]),rt=x.useMemo(()=>[...new Set(i.demo?ct.map(de=>de.values.agent):fe.agents??ct.map(de=>de.values.agent))].filter(Boolean).sort((de,tt)=>de.localeCompare(tt)),[i.demo,ct,fe.agents]),ve=L==="custom"&&(!ee&&!V||ee&&V&&Date.parse(ee)>Date.parse(V)),Ue=x.useMemo(()=>ve?[]:i.demo?k1(ct,{query:je,direction:F,sandboxes:$,verdicts:W,agents:U,filters:Z,range:L,from:ee,to:V,now:T,sort:Y}):ct,[ct,je,F,$,W,U,Z,L,ee,V,T,Y,ve,i.demo]),Qe=ve?0:i.demo?Ue.length:fe.total||0,xt=Math.max(1,Math.ceil(Qe/Vl)),Ke=i.demo?Math.min(Te.query===ce?Te.page:0,xt-1):fe.page,Be=i.demo?Ue.slice(Ke*Vl,(Ke+1)*Vl):Ue;function jt(de){Xe(),ue(new Set),ye(null),i.demo?re({query:ce,page:de}):fe.goToPage(de)}const Ze=_x({count:Be.length,rowHeight:48});x.useEffect(()=>{Ze.scrollToTop()},[je,F,$,W,U,Z,L,ee,V,Y,Ke]);const Tt=x.useMemo(()=>{if(!M)return 0;const de=new Set(M.map(Ef));return i.events.filter(tt=>!de.has(Ef(tt))).length},[M,i.events]),Se=Be.filter(de=>de.values.verdict==="denied").length,Ye=Be.filter(de=>de.values.verdict==="allowed").length,et=D||$.length||W.length||U.length||F!=="all"||L!=="all"||Object.values(Z).some(de=>de.value);function it(){Xe(),B(""),K("all"),P([]),q([]),H([]),z({}),X("all"),_(""),G("")}const lt=[...F!=="all"?[{label:`Direction: ${F}`,clear:()=>K("all")}]:[],...D?[{label:`Search: ${D}`,clear:()=>B("")}]:[],...$.length?[{label:`${$.length} sandbox${$.length===1?`: ${$[0]}`:"es"}`,clear:()=>P([])}]:[],...U.length?[{label:`Observed agents: ${U.join(", ")}`,clear:()=>H([])}]:[],...W.length?[{label:`Decision: ${W.join(", ")}`,clear:()=>q([])}]:[],...L!=="all"?[{label:dp[L],clear:()=>X("all")}]:[],...Object.entries(Z).filter(([,de])=>de.value).map(([de,tt])=>{var Et;return{label:`${((Et=up.find(on=>on.id===de))==null?void 0:Et.label)??de}${de==="agent"?"":` ${tt.mode}`}: ${tt.value}`,clear:()=>z(on=>({...on,[de]:{...tt,value:""}}))}})];return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search activity",placeholder:"Search activity…",value:D,onValueChange:Je(B),className:"min-w-44 flex-1 basis-full sm:basis-44"}),n.jsxs($p,{children:[n.jsxs(Bp,{className:`${xr} flex items-center gap-2 hover:bg-muted`,children:[n.jsx(Ik,{className:"size-3.5"}),"Filters",(L!=="all"||F!=="all"||$.length>0||W.length>0||Object.values(Z).some(de=>de.value))&&n.jsx("span",{className:"rounded bg-foreground px-1.5 text-[10px] text-background",children:+(L!=="all")+ +(F!=="all")+ +($.length>0)+ +(W.length>0)+Object.values(Z).filter(de=>de.value).length})]}),n.jsxs(Vp,{align:"end",className:"max-h-[min(38rem,80svh)] w-80 max-w-[calc(100vw-2rem)] overflow-y-auto p-4",children:[n.jsx("p",{className:"text-xs font-medium",children:"Filter activity"}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Time frame",n.jsx(pn,{"aria-label":"Time range",className:xr,value:L,onChange:de=>Je(X)(de.target.value),children:Object.entries(dp).map(([de,tt])=>n.jsx("option",{value:de,children:tt},de))})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Direction",n.jsxs(pn,{"aria-label":"Direction",className:xr,value:F,onChange:de=>Je(K)(de.target.value),children:[n.jsx("option",{value:"all",children:"All directions"}),n.jsx("option",{value:"unknown",children:"Direction not applicable / unknown"}),n.jsx("option",{value:"out",children:"Outbound"}),n.jsx("option",{value:"in",children:"Inbound"})]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Event type",n.jsxs(pn,{"aria-label":"Event category",className:xr,value:((wt=Z.category)==null?void 0:wt.value)||"",onChange:de=>Je(z)({...Z,category:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All event types"}),["Network","HTTP","Session","Configuration","Process","File","Authentication","Finding","Event","Log","Unclassified"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Security severity",n.jsxs(pn,{"aria-label":"Security severity",className:xr,value:((cn=Z.severity)==null?void 0:cn.value)||"",onChange:de=>Je(z)({...Z,severity:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All severities"}),["FATAL","CRITICAL","HIGH","MED","LOW","INFO","Not reported"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Log level",n.jsxs(pn,{"aria-label":"Log level",className:xr,value:((Gt=Z.logLevel)==null?void 0:Gt.value)||"",onChange:de=>Je(z)({...Z,logLevel:{mode:"equals",value:de.target.value}}),children:[n.jsx("option",{value:"",children:"All log levels"}),["ERROR","WARN","INFO","DEBUG","TRACE","Not reported"].map(de=>n.jsx("option",{children:de},de))]})]}),n.jsxs("div",{className:"mt-1 border-t pt-3",children:[n.jsx("p",{className:"mb-2 text-[11px] font-medium",children:"Decision"}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:["allowed","denied","not reported","not applicable"].map(de=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:W.includes(de),onChange:()=>Je(q)(W.includes(de)?W.filter(tt=>tt!==de):[...W,de])}),de]},de))})]}),n.jsxs("div",{className:"mt-1 flex flex-col gap-2 border-t pt-3",children:[n.jsx("p",{className:"text-[11px] font-medium",children:"Sandboxes"}),n.jsx(hy,{label:"Sandboxes",options:At,selected:$,onChange:Je(P)})]})]})]}),n.jsxs($p,{children:[n.jsxs(Bp,{className:`${xr} flex items-center gap-2 hover:bg-muted`,children:[n.jsx($8,{className:"size-3.5"}),"View",n.jsx(ha,{className:"size-3"})]}),n.jsxs(Vp,{align:"end",className:"w-72 p-3",children:[n.jsx("div",{className:"mb-1 flex gap-1 rounded-md bg-muted p-1",role:"group","aria-label":"View options",children:[["columns","Columns"],["saved","Saved views"]].map(([de,tt])=>n.jsx("button",{"aria-pressed":C===de,onClick:()=>S(de),className:`flex-1 rounded px-2 py-1.5 text-xs transition-colors ${C===de?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:tt},de))}),C==="columns"?n.jsx("div",{children:up.map(de=>n.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",children:[n.jsx("input",{type:"checkbox",disabled:de.id==="time",checked:u.includes(de.id),onChange:tt=>f(tt.target.checked?[...u,de.id]:u.filter(Et=>Et!==de.id))}),de.label]},de.id))}):n.jsxs("div",{className:"flex max-h-80 flex-col gap-3 overflow-auto",children:[n.jsx(Ot,{"aria-label":"View name",value:g,onChange:de=>b(de.target.value),placeholder:"Name this investigation…"}),n.jsx(le,{size:"sm",disabled:!g.trim(),onClick:()=>{try{const de=[...m.filter(tt=>tt.name!==g.trim()),{name:g.trim(),query:Ie}];localStorage.setItem("openshell.activity.views",JSON.stringify(de)),p(de),b(""),He.success("View saved in this browser")}catch{He.error("Could not save view")}},children:"Save view"}),m.map(de=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{className:"min-w-0 flex-1 truncate text-left text-xs",onClick:()=>Ae(de.query),children:de.name}),n.jsx("button",{"aria-label":`Delete view ${de.name}`,onClick:()=>{try{const tt=m.filter(Et=>Et.name!==de.name);localStorage.setItem("openshell.activity.views",JSON.stringify(tt)),p(tt)}catch{He.error("Could not delete view")}},children:n.jsx(Pn,{className:"size-3"})})]},de.name)),!m.length&&n.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",children:"No saved views yet."})]})]})]}),n.jsxs(Fi,{children:[n.jsxs(Gi,{"aria-label":"Activity actions",className:`${xr} flex items-center gap-2 hover:bg-muted`,children:["Actions",n.jsx(ha,{className:"size-3"})]}),n.jsxs(qi,{align:"end",className:"w-60",children:[n.jsxs(Rs,{disabled:k||!!ve,onClick:()=>Pe("json"),children:[n.jsx(pu,{}),"Export Console JSON"]}),n.jsxs(Rs,{disabled:k||!!ve,onClick:()=>Pe("ocsf"),children:[n.jsx(pu,{}),"Export OCSF JSON"]}),n.jsxs(Rs,{onClick:()=>w(!0),children:[n.jsx($k,{}),"Webhooks"]}),!i.demo&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{disabled:ie||!ae.size,variant:"destructive",onClick:()=>Re("selected"),children:[n.jsx(ts,{}),"Delete selected logs",ae.size?` (${ae.size})`:""]}),n.jsxs(Rs,{disabled:ie||!!ve||fe.loading||!fe.total,variant:"destructive",onClick:()=>Re("matching"),children:[n.jsx(ts,{}),"Delete matching logs"]}),n.jsxs(Rs,{disabled:ie,variant:"destructive",onClick:()=>Re("all"),children:[n.jsx(ts,{}),"Delete all logs"]})]})]})]})]}),(fe.error||!e&&i.historyError)&&!i.demo&&n.jsx(xa,{id:"activity:history-error",tone:"error",title:"History unavailable",actions:n.jsx(le,{size:"xs",variant:"outline",onClick:fe.refresh,children:"Retry"}),children:fe.error||!e&&i.historyError}),L==="custom"&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border px-6 py-2 text-xs",children:[n.jsxs("label",{className:"flex items-center gap-2",children:["From",n.jsx("input",{type:"datetime-local","aria-label":"From time",className:xr,value:ee,onInput:de=>Je(_)(de.currentTarget.value)})]}),n.jsxs("label",{className:"flex items-center gap-2",children:["To",n.jsx("input",{type:"datetime-local","aria-label":"To time",className:xr,value:V,onInput:de=>Je(G)(de.currentTarget.value)})]}),n.jsx("span",{className:"text-muted-foreground",children:Intl.DateTimeFormat().resolvedOptions().timeZone}),ve&&n.jsx("span",{role:"alert",className:"text-red-600",children:"Choose a start or end time; the end must follow the start."})]}),!!et&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-6 py-2",children:[lt.map(de=>n.jsxs("button",{onClick:de.clear,title:`Remove ${de.label}`,className:"flex max-w-72 items-center gap-2 rounded border border-border bg-muted/40 px-2 py-1 text-[11px]",children:[n.jsx("span",{className:"truncate",children:de.label}),n.jsx(Pn,{className:"size-3 shrink-0"})]},de.label)),n.jsx(le,{size:"xs",variant:"ghost",onClick:it,children:"Clear all"})]}),n.jsxs("div",{className:"flex min-h-10 flex-wrap items-center gap-x-4 gap-y-1 border-b border-border px-6 py-2 text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-mono text-foreground",children:Qe.toLocaleString()})," ",i.demo?"demo events":"matching events"]}),n.jsxs("span",{children:[Ye.toLocaleString()," allowed · ",n.jsxs("span",{className:Se?"text-red-600":"",children:[Se.toLocaleString()," denied"]})," ",n.jsx("span",{className:"text-muted-foreground/70",children:"on this page"})]}),e&&!i.demo&&!fe.error&&((fn=fe.unavailable)==null?void 0:fn.map((de,tt)=>n.jsx("span",{title:de.error,className:"text-amber-700 dark:text-amber-400",children:yR(de)},tt))),n.jsxs("button",{className:"flex min-h-10 items-center gap-1.5 rounded px-2 text-xs hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>{M?(R(null),re({query:ce,page:0}),O(Date.now()),fe.refresh(),Ze.scrollToTop()):Xe()},children:[M?n.jsx($A,{className:"size-3"}):n.jsx(N8,{className:"size-3"}),M?"Resume":"Pause"]}),M&&n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{children:"View paused"}),n.jsx("button",{className:"rounded text-foreground underline underline-offset-4 disabled:opacity-40",disabled:i.demo&&!Tt,onClick:()=>{R(i.demo?i.events:he),O(Date.now()),fe.refresh(),Ze.scrollToTop()},children:i.demo?`${Tt.toLocaleString()} new events`:"Refresh"})]}),ae.size>0&&n.jsxs("span",{className:"flex items-center gap-2",children:[ae.size.toLocaleString()," selected",n.jsx("button",{className:"underline",onClick:()=>ue(new Set),children:"Clear selection"})]}),n.jsx("span",{className:"ml-auto",children:Intl.DateTimeFormat().resolvedOptions().timeZone})]}),n.jsxs("div",{ref:Ze.ref,onScroll:de=>{Ze.onScroll(de),de.currentTarget.scrollTop>0&&Xe()},tabIndex:0,role:"region","aria-label":"Activity events",className:"min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[n.jsxs("table",{style:{minWidth:h.reduce((de,tt)=>de+tt.width,i.demo?0:40)},className:"w-full table-fixed border-separate border-spacing-0 text-xs","aria-label":"Activity","aria-rowcount":Be.length+1,children:[n.jsxs("colgroup",{children:[!i.demo&&n.jsx("col",{style:{width:52}}),h.map(de=>n.jsx("col",{style:{width:de.width}},de.id))]}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsxs("tr",{children:[!i.demo&&n.jsx("th",{scope:"col",className:"h-10 border-b border-border pr-3 pl-4 text-left sm:pl-6",children:n.jsx("input",{type:"checkbox","aria-label":"Select logs on this page",disabled:!Be.length||Be.length>5e3,checked:Be.length>0&&Be.every(de=>ae.has(de.key)),ref:de=>{de&&(de.indeterminate=Be.some(tt=>ae.has(tt.key))&&!Be.every(tt=>ae.has(tt.key)))},onChange:de=>{Xe(),ue(de.target.checked?new Set(Be.filter(tt=>{var Et;return((Et=tt.event.location)==null?void 0:Et.connected)!==!1}).map(tt=>tt.key)):new Set)}})}),h.map(de=>{var tt,Et,on,xn;return n.jsx("th",{scope:"col","aria-sort":Y.key===de.id?Y.direction==="asc"?"ascending":"descending":"none",className:"h-10 border-b border-border px-3 text-left font-medium text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs("button",{className:"flex h-9 flex-1 items-center gap-1 outline-none focus-visible:ring-2 focus-visible:ring-ring",disabled:de.id==="source",onClick:()=>Je(ne)({key:de.id,direction:Y.key===de.id&&Y.direction==="asc"?"desc":"asc"}),children:[de.label,Y.key===de.id&&(Y.direction==="asc"?n.jsx(_f,{className:"size-3"}):n.jsx(Pf,{className:"size-3"}))]}),de.id!=="source"&&n.jsxs($p,{children:[n.jsx(Bp,{"aria-label":`Filter ${de.label}`,className:`rounded p-1 hover:bg-accent ${(de.id==="time"?L!=="all":de.id==="sandbox"?$.length:de.id==="verdict"?W.length:de.id==="agent"?U.length||(tt=Z.agent)!=null&&tt.value:(Et=Z[de.id])!=null&&Et.value)?"bg-accent text-foreground":""}`,children:n.jsx(Ik,{className:"size-3"})}),n.jsxs(Vp,{align:"start",children:[n.jsxs("p",{className:"text-xs font-medium",children:["Filter ",de.label.toLowerCase()]}),de.id==="agent"?n.jsxs("div",{role:"group","aria-label":"Observed agents",className:"max-h-64 overflow-y-auto",children:[n.jsxs("div",{className:"mb-1 flex items-center justify-between px-2 text-[11px] text-muted-foreground",children:[n.jsx("span",{children:U.length?`${U.length} selected`:"All agents"}),n.jsx("button",{className:"underline",onClick:()=>{Xe(),H([]),z(({agent:Wt,...un})=>un)},children:"Clear"})]}),rt.map(Wt=>n.jsxs("label",{className:"flex min-h-8 cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-muted",children:[n.jsx("input",{type:"checkbox",checked:U.includes(Wt),onChange:()=>{Xe(),z(({agent:un,...ns})=>ns),H(un=>un.includes(Wt)?un.filter(ns=>ns!==Wt):[...un,Wt])},className:"accent-foreground"}),n.jsx(Hp,{agent:AJ[Wt]??{name:Wt}})]},Wt)),!rt.length&&n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No agents in the logs"})]}):de.id==="sandbox"?n.jsx(hy,{label:"Sandboxes",options:At,selected:$,onChange:Je(P)}):de.id==="verdict"?n.jsx(hy,{label:"Decisions",options:["allowed","denied","not reported","not applicable"],selected:W,onChange:Je(q)}):de.id==="time"?n.jsxs(n.Fragment,{children:[n.jsx(pn,{"aria-label":"Filter time",className:xr,value:L,onChange:Wt=>Je(X)(Wt.target.value),children:Object.entries(dp).map(([Wt,un])=>n.jsx("option",{value:Wt,children:un},Wt))}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Custom dates appear above the table."})]}):n.jsxs(n.Fragment,{children:[n.jsxs(pn,{"aria-label":`${de.label} match mode`,className:xr,value:((on=Z[de.id])==null?void 0:on.mode)??"contains",onChange:Wt=>{var un;return Je(z)({...Z,[de.id]:{value:((un=Z[de.id])==null?void 0:un.value)??"",mode:Wt.target.value}})},children:[n.jsx("option",{value:"equals",children:"Equals"}),n.jsx("option",{value:"contains",children:"Contains"}),n.jsx("option",{value:"excludes",children:"Excludes"})]}),n.jsx(Ot,{"aria-label":`${de.label} filter value`,placeholder:`Filter ${de.label.toLowerCase()}…`,value:((xn=Z[de.id])==null?void 0:xn.value)??"",onChange:Wt=>{var un;return Je(z)({...Z,[de.id]:{mode:((un=Z[de.id])==null?void 0:un.mode)??"contains",value:Wt.target.value}})},className:"h-8 text-xs"})]})]})]})]})},de.id)})]})}),n.jsxs("tbody",{children:[Ze.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:h.length+(i.demo?0:1),style:{height:Ze.paddingTop,padding:0}})}),Be.slice(Ze.start,Ze.end).map((de,tt)=>{var Et;return n.jsxs("tr",{"aria-rowindex":Ze.start+tt+2,onClick:()=>{Xe(),ye(de)},className:`group cursor-pointer hover:bg-muted/70 ${(te==null?void 0:te.key)===de.key?"bg-accent":"bg-card"}`,children:[!i.demo&&n.jsx("td",{className:"h-12 border-b border-border/60 pr-3 pl-4 sm:pl-6",onClick:on=>on.stopPropagation(),children:n.jsx("input",{type:"checkbox","aria-label":`Select log ${de.values.sandbox} ${de.values.time}`,checked:ae.has(de.key),disabled:((Et=de.event.location)==null?void 0:Et.connected)===!1||!ae.has(de.key)&&ae.size>=5e3,onChange:()=>ke(de.key)})}),h.map(on=>n.jsx("td",{className:`h-12 border-b border-border/60 px-3 py-0 font-mono text-[11px] ${on.id==="verdict"?de.values.verdict==="denied"?"text-red-600":de.values.verdict==="allowed"?"text-emerald-700":"text-muted-foreground":on.id==="destination"?"text-foreground":"text-muted-foreground"}`,children:on.id==="source"?n.jsx(Hs,{location:de.event.location??a}):on.id==="time"?n.jsx("button",{"aria-label":`Inspect event ${de.values.sandbox} ${de.values.time}`,"aria-haspopup":"dialog",className:"h-8 w-full truncate text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:xn=>{xn.stopPropagation(),Xe(),ye(de)},children:MJ(de.values.time)}):on.id==="action"?n.jsxs("span",{className:"block truncate",title:`${de.values.category} · ${de.values.action} · ${de.values.process}`,children:[n.jsxs("span",{className:"block truncate text-foreground",children:[de.values.category," · ",de.event.method||de.event.action||"Not reported"]}),n.jsx("span",{className:"block truncate text-[10px]",children:de.values.process||de.event.detail||de.event.message||"Process not reported"})]}):on.id==="agent"&&de.agent?n.jsx("span",{className:"font-sans text-foreground",children:n.jsx(Hp,{agent:de.agent})}):n.jsx("span",{className:"block truncate",title:de.values[on.id],children:de.values[on.id]||"-"})},on.id))]},de.key)}),Ze.end<Be.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:h.length+(i.demo?0:1),style:{height:(Be.length-Ze.end)*48,padding:0}})})]})]}),!Be.length&&n.jsxs("div",{className:"py-20 text-center text-sm text-muted-foreground",children:[n.jsx("p",{children:fe.error&&!i.demo?"Could not load retained events":fe.loading&&!i.demo?"Searching retained events…":ve?"Set a valid time range":et?"No matching events in available history":"No activity available"}),!!et&&n.jsx(le,{variant:"outline",size:"sm",className:"mt-3",onClick:it,children:"Clear filters"})]})]}),Qe>Vl&&n.jsxs("nav",{"aria-label":"Activity pagination",className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border bg-card px-6 py-3",children:[n.jsxs("span",{"aria-live":"polite",className:"text-xs tabular-nums text-muted-foreground",children:[(Ke*Vl+1).toLocaleString(),"-",Math.min((Ke+1)*Vl,Qe).toLocaleString()," of ",Qe.toLocaleString()," logs"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{variant:"outline",size:"sm","aria-label":"First page",disabled:Ke===0||!i.demo&&fe.loading,onClick:()=>jt(0),children:"First"}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Previous page",disabled:Ke===0||!i.demo&&fe.loading,onClick:()=>jt(Ke-1),children:"Previous"}),n.jsx("span",{"aria-live":"polite",className:"px-2 text-xs tabular-nums text-muted-foreground",children:!i.demo&&fe.loading?"Loading…":`Page ${Ke+1} of ${xt.toLocaleString()}`}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Next page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(Ke+1),children:"Next"}),n.jsx(le,{variant:"outline",size:"sm","aria-label":"Last page",disabled:Ke>=xt-1||!i.demo&&fe.loading,onClick:()=>jt(xt-1),children:"Last"})]})]})]}),n.jsx(tn,{open:!!N,onOpenChange:de=>{de||E(null)},children:n.jsxs(nn,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Export ",(N==null?void 0:N.format)==="ocsf"?"OCSF JSON":"Console JSON"]}),n.jsx(Sn,{children:"Your current columns and time frame are ready to export. Other table filters still apply."})]}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["Time frame",n.jsx(pn,{className:xr,value:N.range,onChange:de=>E({...N,range:de.target.value}),children:Object.entries(dp).map(([de,tt])=>n.jsx("option",{value:de,children:tt},de))})]}),N.range==="custom"&&n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[["from","to"].map(de=>n.jsxs("label",{className:"grid gap-1 text-xs",children:[n.jsx("span",{children:de==="from"?"From":"To"}),n.jsx("input",{type:"datetime-local",className:xr+" w-full min-w-0",value:N[de],onChange:tt=>E({...N,[de]:tt.target.value})})]},de)),n.jsxs("p",{className:"text-[11px] text-muted-foreground sm:col-span-2",children:[Intl.DateTimeFormat().resolvedOptions().timeZone," · Leave one end empty for an open range."]})]}),n.jsxs("fieldset",{className:"space-y-3",children:[n.jsx("legend",{className:"text-xs font-medium",children:"Columns"}),n.jsx("div",{className:"grid grid-cols-2 gap-3",children:up.map(de=>n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:N.columns.includes(de.id),disabled:de.id==="time"&&N.format==="ocsf",onChange:tt=>E({...N,columns:tt.target.checked?[...N.columns,de.id]:N.columns.filter(Et=>Et!==de.id)})}),de.label]},de.id))})]}),N.format==="ocsf"&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"OCSF includes the required event time and schema fields alongside your selected columns."}),Fe&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one column and a valid time frame."}),n.jsxs(Hr,{children:[n.jsx(le,{variant:"outline",onClick:()=>E(null),children:"Cancel"}),n.jsxs(le,{disabled:k||Fe,onClick:_e,children:[n.jsx(pu,{}),k?"Exporting…":"Export"]})]})]})]})}),n.jsx(Fr,{open:!!se,onOpenChange:de=>{!de&&!ie&&Q(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsx(Kr,{children:(se==null?void 0:se.mode)==="all"?"Delete all retained logs?":(se==null?void 0:se.mode)==="matching"?"Delete matching logs?":"Delete selected logs?"}),n.jsxs(Xr,{children:[se==null?void 0:se.count.toLocaleString()," log",(se==null?void 0:se.count)===1?"":"s"," will be permanently removed from Activity and pending webhook delivery. This cannot be undone."]})]}),((Bn=se==null?void 0:se.sources)==null?void 0:Bn.length)>1&&n.jsx("p",{className:"text-xs text-muted-foreground",children:se.sources.map(de=>`${de.label}: ${de.count.toLocaleString()}`).join(", ")}),((Kn=se==null?void 0:se.skipped)==null?void 0:Kn.length)>0&&n.jsxs("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:[vR(se.skipped)," ",se.skipped.length===1?"is offline; its":"are offline; their"," logs won’t be deleted."]}),n.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:[(se==null?void 0:se.mode)==="all"?"This includes every sandbox and ignores the current filters. ":"","New logs arriving after this review will be kept. Copies in sandbox files, exports, or external systems are not deleted; a webhook request already in flight may still arrive."]}),pe&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:pe}),n.jsxs(Yr,{children:[n.jsx(Qr,{disabled:ie,children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:ie||!(se!=null&&se.count)||!!pe,onClick:Oe,children:ie?"Deleting…":`Delete ${se==null?void 0:se.count.toLocaleString()} log${(se==null?void 0:se.count)===1?"":"s"}`})]})]})}),n.jsx(Lo,{open:v&&!e,onOpenChange:w,children:n.jsxs(la,{className:"gap-0 data-[side=right]:w-full sm:data-[side=right]:max-w-2xl",children:[n.jsxs(ca,{className:"border-b border-border pr-12",children:[n.jsxs(ua,{className:"flex items-center gap-2",children:[n.jsx($k,{"aria-hidden":"true",className:"size-4 text-muted-foreground",strokeWidth:1.5}),"Webhooks"]}),n.jsx(da,{children:"Send activity to an HTTPS endpoint."})]}),v&&n.jsx(xR,{})]})}),e&&v&&n.jsx(Dx,{subject:"workspace",onClose:()=>w(!1),children:(de,tt)=>n.jsx(Lo,{open:!0,onOpenChange:Et=>{Et||tt()},children:n.jsxs(la,{className:"overflow-auto sm:max-w-xl",children:[n.jsxs(ca,{children:[n.jsx(ua,{children:"Webhooks"}),n.jsx(da,{children:n.jsx(Hs,{location:de})})]}),n.jsx(xR,{})]})})}),n.jsx(Lo,{open:!!te,onOpenChange:de=>{de||ye(null)},children:n.jsxs(la,{className:"w-full gap-0 sm:max-w-lg",children:[n.jsxs(ca,{className:"border-b border-border pr-12",children:[n.jsx(ua,{children:"Event details"}),n.jsx(da,{children:"Full values from this event. The activity view stays paused."})]}),te&&n.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-auto p-5",children:[n.jsx("div",{className:"flex flex-wrap gap-2",children:[[te.event.scope?"scope":"sandbox",te.event.scope||te.values.sandbox,"Sandbox timeline"],["destination",te.values.destination,"Same target"],["process",te.values.process,"Same executable"],["policy",te.values.policy,"Same policy"],["session",te.values.session,"Same session"],["correlation",te.values.correlation,"Same correlation"]].filter(([,de])=>de).map(([de,tt,Et])=>n.jsx(le,{size:"xs",variant:"outline",onClick:()=>ge(de,tt),children:Et},de))}),!i.demo&&n.jsxs(le,{size:"sm",variant:"destructive",disabled:ie,onClick:()=>Re("selected",[te.key]),children:[n.jsx(ts,{}),"Delete log"]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Pivots match recorded fields. An executable match does not prove the same process instance."}),n.jsx("dl",{className:"space-y-4",children:[["Timestamp",te.values.time],["Sandbox",te.values.sandbox],["Sandbox ID",te.values.sandboxId],["Collection scope",te.event.scope],["Direction",te.values.direction],["Category",te.values.category],["Security severity",te.values.severity],["Log level",te.values.logLevel],["Decision",te.values.verdict],["Agent",te.values.agent],["Attribution",te.agent?"Executable name match only; initiating agent and parent process are not reported.":"Initiating agent not reported by this event."],["Initiator","Not reported"],["Session ID",te.values.session],["Correlation ID",te.values.correlation],["Action",te.values.action],["Executable",te.event.binary],["Destination",te.values.destination],["Policy",te.event.policy],["Policy revision at event time",te.event.policyVersion??"Not reported"],["Enforcement mode at event time",te.event.enforcement??"Not reported"],["Event ID",te.key],["Source cursor",te.event.sourceCursor],["Identity evidence",te.event.idSource||"No source event ID reported"],["Received at",te.event.receivedAt],["Source",te.event.source],["Parser target",te.event.target],["Reason",te.event.reason],["Why",te.values.why]].map(([de,tt])=>n.jsxs("div",{children:[n.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:de}),n.jsxs("dd",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:de==="Agent"&&te.agent?n.jsx(Hp,{agent:te.agent}):tt||"-"}),tt&&n.jsx(jR,{label:de,value:tt})]})]},de))}),n.jsxs("div",{children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-medium",children:"Raw event"}),n.jsx(jR,{label:"raw event",value:JSON.stringify(te.event,null,2)})]}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-muted/40 p-3 text-[11px]",children:JSON.stringify(te.event,null,2)})]})]})]})})]})}function jR({label:e,value:t}){const[r,a]=x.useState(!1);return x.useEffect(()=>{if(r){const i=setTimeout(()=>a(!1),1500);return()=>clearTimeout(i)}},[r]),n.jsx("button",{className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted","aria-label":`Copy ${e}`,onClick:async()=>{try{await navigator.clipboard.writeText(t),a(!0)}catch{He.error("Could not copy to clipboard")}},children:r?n.jsx(Yn,{className:"size-3.5"}):n.jsx(Lf,{className:"size-3.5"})})}const Wi=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,SR="groups-show-sandboxes";function $D(e){try{sessionStorage.setItem(Ja,JSON.stringify(e))}catch{}}function Of(e,t){var r,a;(r=e.failed)!=null&&r.length?He.warning(`${t}. ${Wi(e.failed.length,"sandbox","sandboxes")} could not be updated`,{description:e.failed.map(i=>`${i.sandbox}: ${i.error}`).join(`
|
|
527
|
+
`)}):He.success(t,{description:(a=e.applied)!=null&&a.length?`Network access updated in ${Wi(e.applied.length,"sandbox","sandboxes")}.`:void 0})}function PJ({policy:e,onClick:t}){const r=e.action==="block"?s2:Iu;return n.jsxs("button",{type:"button",onClick:t,title:`${e.action==="block"?"Blocks":"Allows"} ${e.destinations.join(", ")}`,className:Ve("flex max-w-full items-center gap-1 rounded-full border px-2 py-px text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e.action==="block"?"border-red-200 bg-red-50 text-red-700 hover:bg-red-100/70":"border-emerald-600/20 bg-emerald-50 text-emerald-800 hover:bg-emerald-100/70"),children:[n.jsx(r,{className:"size-3 shrink-0","aria-hidden":"true"}),n.jsx("span",{className:"truncate",children:e.name})]})}function _J({names:e,limit:t=4}){return e.length?n.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.slice(0,t).map(r=>n.jsx("span",{title:r,className:"max-w-full truncate rounded border border-border bg-background px-1.5 py-px font-mono text-[10.5px] text-muted-foreground",children:r},r)),e.length>t&&n.jsxs("span",{className:"text-[11px] text-faint",children:["+",e.length-t]})]}):n.jsx("span",{className:"text-[11px] text-faint",children:"No sandboxes yet"})}const LJ=[{title:"Create a group",body:"Name it for a kind of work, like Frontend or Data."},{title:"Add network rules",body:"Choose the destinations this group can reach or must block."},{title:"Add sandboxes",body:"Choose one or more groups for each sandbox. Their network rules combine."}];function BD({onCreate:e,onPolicy:t}){return n.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[n.jsx(ho,{children:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:n.jsx(Xa,{className:"size-4.5 text-stone-600",strokeWidth:1.4})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-[15px] font-medium tracking-tight",children:"Give sandboxes the same network access, together"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Instead of one rule per sandbox, make a group and aim rules at the group."})]})]})}),n.jsxs("ol",{className:"relative mt-8 grid gap-3 sm:grid-cols-3",children:[n.jsx("span",{"aria-hidden":"true",className:"absolute top-[22px] right-[16%] left-[16%] hidden h-px bg-gradient-to-r from-border via-stone-300 to-border sm:block"}),LJ.map((r,a)=>n.jsx(ho,{delay:.08+a*.08,className:"relative",children:n.jsxs("li",{className:"flex h-full flex-col rounded-lg border border-border bg-card p-4",children:[n.jsx("span",{className:"relative z-10 flex size-[26px] items-center justify-center rounded-full border border-stone-300 bg-card font-mono text-[11px] text-stone-600",children:a+1}),n.jsx("p",{className:"mt-3 text-xs font-medium",children:r.title}),n.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:r.body})]})},r.title))]}),n.jsx(ho,{delay:.34,children:n.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-2",children:[n.jsxs(le,{onClick:e,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{}),"Create your first group"]}),n.jsxs(le,{variant:"ghost",onClick:t,className:"text-muted-foreground",children:["Network rules",n.jsx(mu,{})]})]})})]})}function VD({open:e,onOpenChange:t,groups:r,sandboxes:a,assignments:i,onCreated:c}){const u=Pt(),[f,h]=x.useState(""),[m,p]=x.useState(""),[g,b]=x.useState([]),[v,w]=x.useState(!1),[C,S]=x.useState(null);x.useEffect(()=>{e&&(h(""),p(""),b([]),S(null))},[e]);const N=f4(f),E=r.some(M=>M.id===N),k=M=>ir({assignments:i},M).map(R=>{var T;return(T=r.find(O=>O.id===R))==null?void 0:T.name}).filter(Boolean).join(", ");async function A(M){M.preventDefault(),w(!0),S(null);try{const{group:R}=await u.saveGroup({id:N,name:f.trim(),description:m.trim(),isNew:!0});let T=null;if(g.length)try{T=await u.setGroupMembers(g,[R.id],"add")}catch(O){He.warning(`Created ${R.name}, but could not add sandboxes`,{description:O.message})}t(!1),c(R,T,g.length)}catch(R){S(R.message)}finally{w(!1)}}return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsx(nn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:n.jsxs("form",{onSubmit:A,className:"grid gap-4",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"New group"}),n.jsx(Sn,{className:"text-xs",children:"Network rules aimed at this group reach every sandbox in it."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"group-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"group-name",value:f,onChange:M=>h(M.target.value),placeholder:"Frontend",className:"text-xs",required:!0,autoFocus:!0}),E&&n.jsx("p",{className:"text-[11px] text-red-700",children:"A group with this name already exists."})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:"group-description",className:"text-xs",children:["Description ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),n.jsx(Hu,{id:"group-description",rows:2,value:m,onChange:M=>p(M.target.value),placeholder:"Web apps: npm and GitHub",className:"text-xs"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs("span",{className:"text-xs font-medium",children:["Add sandboxes ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.length?n.jsx("ul",{className:"max-h-48 divide-y divide-border/60 overflow-y-auto rounded-md border border-border",children:a.map(M=>{const R=g.includes(M.name),T=k(M.name);return n.jsx("li",{children:n.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 px-3 py-1.5 text-xs hover:bg-muted/50",children:[n.jsx("input",{type:"checkbox",checked:R,onChange:()=>b(O=>R?O.filter(D=>D!==M.name):[...O,M.name]),className:"size-3.5"}),n.jsx("span",{className:Ve("size-1.5 shrink-0 rounded-full",Za(M.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono",children:M.name}),T&&n.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground",children:`also in ${T}`})]})},M.name)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No sandboxes yet. Pick this group when you create one."})]}),C&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:C}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:v||!N||E,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v&&n.jsx(Nt,{"aria-hidden":"true"}),"Create group",g.length?` with ${Wi(g.length,"sandbox","sandboxes")}`:""]})]})]})})})}function UD({group:e,org:t,sandboxes:r,onClose:a,onChanged:i,onPolicy:c,sourceControl:u}){const f=Pt(),[h,m]=x.useState(""),[p,g]=x.useState(""),[b,v]=x.useState(!1),[w,C]=x.useState(!1);if(x.useEffect(()=>{e&&(m(e.name),g(e.description))},[e]),!e)return n.jsx(Lo,{open:!1,onOpenChange:()=>{}});const S=t.members[e.id]??[],N=Ow(t.policies,e.id),E=t.policies.filter(D=>D.appliesTo.everyone),k=r.filter(D=>!S.includes(D.name)),A=D=>ir(t,D).map(B=>{var F;return(F=t.groups.find(K=>K.id===B))==null?void 0:F.name}).filter(Boolean).join(", "),M=h.trim()!==e.name||p.trim()!==e.description;async function R(){v(!0);try{await f.saveGroup({...e,name:h.trim()||e.name,description:p.trim()}),He.success(`Saved ${h.trim()||e.name}`),i()}catch(D){He.error(D.message)}finally{v(!1)}}async function T(D,B){v(!0);try{Of(await f.setGroupMembers(D,[e.id],B?"add":"remove"),B?`Added ${D.join(", ")} to ${e.name}`:`Removed ${D.join(", ")} from ${e.name}`),i()}catch(F){He.error(F.message)}finally{v(!1)}}async function O(){v(!0);try{Of(await f.deleteGroup(e.id),`Deleted ${e.name}`),a(),i()}catch(D){He.error(D.message)}finally{v(!1),C(!1)}}return n.jsx(Lo,{open:!0,onOpenChange:D=>{D||a()},children:n.jsxs(la,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[n.jsxs(ca,{className:"border-b p-6",children:[n.jsxs(ua,{className:"flex items-center gap-2 text-base",children:[n.jsx(Xa,{className:"size-4 text-muted-foreground",strokeWidth:1.5}),e.name]}),n.jsxs(da,{children:[Wi(S.length,"sandbox","sandboxes")," · ",Wi(N.length,"rule")," aimed at this group"]})]}),n.jsxs("div",{className:"space-y-6 px-6 pb-6",children:[n.jsx("fieldset",{disabled:b||M,children:u}),n.jsxs("section",{className:"grid gap-3",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"edit-group-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"edit-group-name",value:h,onChange:D=>m(D.target.value),className:"text-xs"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"edit-group-description",className:"text-xs",children:"Description"}),n.jsx(Hu,{id:"edit-group-description",rows:2,value:p,onChange:D=>g(D.target.value),className:"text-xs"})]}),M&&n.jsxs(le,{size:"sm",className:"w-fit bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:b,onClick:R,children:[b&&n.jsx(Nt,{}),"Save"]})]}),n.jsxs("section",{className:"grid gap-2",children:[n.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),S.length?n.jsx("ul",{className:"divide-y divide-border/60 rounded-md border border-border",children:S.map(D=>{const B=r.find(F=>F.name===D);return n.jsxs("li",{className:"flex items-center gap-2.5 px-3 py-1.5",children:[n.jsx("span",{className:Ve("size-1.5 shrink-0 rounded-full",Za(B==null?void 0:B.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:D}),n.jsx(le,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${D} from ${e.name}`,disabled:b,onClick:()=>T([D],null),children:n.jsx(Pn,{})})]},D)})}):n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["No sandboxes yet. Add one below, or pick ",e.name," when you create a sandbox."]}),k.length>0&&n.jsxs(pn,{value:"","aria-label":`Add a sandbox to ${e.name}`,disabled:b,onChange:D=>D.target.value&&T([D.target.value],e.id),className:"h-8 w-fit rounded-md border border-dashed border-border bg-transparent px-2 text-[11px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("option",{value:"",children:"+ Add sandbox"}),k.map(D=>n.jsxs("option",{value:D.name,children:[D.name,A(D.name)?` (also in ${A(D.name)})`:""]},D.name))]})]}),n.jsxs("section",{className:"grid gap-2",children:[n.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Network access"}),N.length?n.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(D=>n.jsx(PJ,{policy:D,onClick:()=>c({edit:D.id})},D.id))}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No network rules yet."}),E.length>0&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Also, like every sandbox: ",E.map(D=>D.name).join(", "),"."]}),n.jsxs(le,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>c({new:{appliesTo:{groups:[e.id]}}}),children:[n.jsx(ys,{}),"Add rule for ",e.name]})]}),n.jsxs("section",{className:"border-t border-border pt-4",children:[(S.length>0||N.length>0)&&n.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Move the sandboxes and move or delete the network rules before deleting this group."}),n.jsxs(le,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:b||S.length>0||N.length>0,onClick:()=>C(!0),children:[n.jsx(ts,{}),"Delete group"]})]})]}),n.jsx(Fr,{open:w,onOpenChange:C,children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",e.name,"?"]}),n.jsx(Xr,{children:"This empty group will be deleted."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:O,children:"Delete group"})]})]})})]})})}function HD({group:e,members:t,policies:r,onOpen:a,delay:i,disabled:c=!1}){return n.jsx(ho,{delay:i,className:"flex min-w-0 flex-1 flex-col",children:n.jsxs("button",{disabled:c,onClick:a,className:"group/card flex min-w-0 flex-1 w-full disabled:cursor-not-allowed disabled:opacity-60 flex-col gap-3 rounded-lg border border-border bg-card p-4 text-left outline-none transition-[border-color,box-shadow] hover:border-stone-300 hover:shadow-[0_3px_10px_#1c19170a] focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsxs("span",{className:"flex items-start gap-2",children:[n.jsx(Xa,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:e.name}),e.description&&n.jsx("span",{className:"mt-0.5 line-clamp-2 block text-[11px] text-muted-foreground",children:e.description})]}),n.jsx(Lr,{className:"size-3.5 shrink-0 text-faint transition-transform group-hover/card:translate-x-0.5","aria-hidden":"true"})]}),n.jsx(_J,{names:t}),n.jsxs("span",{className:"mt-auto flex min-w-0 flex-wrap items-center gap-1 border-t border-border/60 pt-3",children:[r.length?r.slice(0,3).map(u=>n.jsx("span",{className:Ve("max-w-full truncate rounded-full border px-2 py-px text-[10.5px]",u.action==="block"?"border-red-200 bg-red-50 text-red-700":"border-emerald-600/20 bg-emerald-50 text-emerald-800"),children:u.name},u.id)):n.jsx("span",{className:"text-[11px] text-faint",children:"No rules yet"}),r.length>3&&n.jsxs("span",{className:"text-[11px] text-faint",children:["+",r.length-3]})]})]})})}function $J({onNavigate:e}){const t=Pt(),r=oi(),[a,i]=x.useState(null),[c,u]=x.useState(!1),[f,h]=x.useState(null),[m,p]=x.useState(""),[g,b]=x.useState([]),[v,w]=x.useState([]),[C,S]=x.useState(!1),[N,E]=x.useState(()=>{try{return localStorage.getItem(SR)==="1"}catch{return!1}}),k=()=>E(U=>{try{localStorage.setItem(SR,U?"0":"1")}catch{}return!U}),A=x.useCallback(async()=>{try{i(await t.org())}catch(U){i({error:U.message})}},[]);x.useEffect(()=>{A()},[A]);const M=x.useMemo(()=>[...r.sandboxes??[]].filter(U=>U.phase!=="deleting").sort((U,H)=>U.name.localeCompare(H.name)),[r.sandboxes]),R=U=>{$D(U),e("egress")};if(!a)return n.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"});if(a.error)return n.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:a.error});const T=a.groups,O=a.assignments??{},D=M.filter(U=>ir(a,U.name).length).length,B=m.trim().toLowerCase(),F=M.filter(U=>!B||U.name.includes(B)||T.some(H=>ir(a,U.name).includes(H.id)&&H.name.toLowerCase().includes(B))),K=F.length>0&&F.every(U=>g.includes(U.name));async function $(U,H,W="replace"){S(!0);try{Of(await t.setGroupMembers(U,H,W),`Updated groups for ${Wi(U.length,"sandbox","sandboxes")}`),b([]),await A()}catch(q){He.error(q.message)}finally{S(!1)}}const P=n.jsx(VD,{open:c,onOpenChange:u,groups:T,sandboxes:M,assignments:O,onCreated:async(U,H,W)=>{H?Of(H,`Created ${U.name} with ${Wi(W,"sandbox","sandboxes")}`):He.success(`Created ${U.name}`,{description:"Add sandboxes and network rules to it in any order."}),await A(),h(U.id)}});return T.length?n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 pt-4 pb-3 sm:px-6",children:[n.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"Groups",value:T.length},{label:"In a group",value:D},{label:"No group",value:M.length-D}].map(U=>n.jsxs("div",{className:"rounded-md px-3 py-1.5",children:[n.jsx("span",{className:"block text-[11px] text-muted-foreground",children:U.label}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:U.value})})]},U.label))}),n.jsxs(le,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:[n.jsx(ys,{className:"size-3.5"}),"New group"]})]}),n.jsxs("section",{"aria-label":"Groups",className:"grid gap-3 px-4 py-5 sm:grid-cols-2 sm:px-6 xl:grid-cols-3",children:[T.map((U,H)=>n.jsx(HD,{group:U,members:a.members[U.id]??[],policies:Ow(a.policies,U.id),onOpen:()=>h(U.id),delay:H*.04},U.id)),n.jsx(ho,{delay:T.length*.04,className:"h-full",children:n.jsxs("button",{onClick:()=>u(!0),className:"flex h-full min-h-32 w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-dashed border-border text-[11px] text-muted-foreground outline-none transition-colors hover:border-foreground/30 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(ys,{className:"size-4",strokeWidth:1.5,"aria-hidden":"true"}),"New group"]})})]}),n.jsxs("section",{"aria-label":"Sandboxes and their groups",className:"border-t border-border",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 sm:px-6",children:[n.jsxs("button",{type:"button",onClick:k,"aria-expanded":N,className:"flex items-center gap-1.5 rounded text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(Lr,{className:Ve("size-3.5 text-muted-foreground transition-transform",N&&"rotate-90"),"aria-hidden":"true"}),n.jsx("span",{className:"font-medium",children:"Sandboxes"}),n.jsx("span",{className:"font-mono text-[11px] tabular-nums text-muted-foreground",children:M.length}),M.length-D>0&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["· ",M.length-D," not in a group"]})]}),N&&n.jsx(yo,{value:m,onValueChange:p,placeholder:"Search sandbox or group…","aria-label":"Search sandboxes",className:"ml-auto w-full sm:w-56"})]}),N&&n.jsxs(n.Fragment,{children:[g.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-y border-border bg-accent/50 px-4 py-2 text-xs sm:px-6",children:[n.jsx(Yn,{className:"size-3.5","aria-hidden":"true"}),Wi(g.length,"sandbox","sandboxes")," selected",n.jsx("fieldset",{disabled:C,className:"min-w-0",children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:T,value:v,onChange:w})}),n.jsx(le,{variant:"outline",size:"sm",disabled:C||!v.length,onClick:()=>$(g,v,"add"),children:"Add to groups"}),n.jsx(le,{variant:"outline",size:"sm",disabled:C||!v.length,onClick:()=>$(g,v,"remove"),children:"Remove from groups"}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>b([]),children:"Clear"}),C&&n.jsx(Nt,{"aria-hidden":"true"})]}),M.length?n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("div",{className:"min-w-[640px]",children:[n.jsxs("div",{className:"grid h-9 grid-cols-[28px_minmax(0,1.4fr)_minmax(180px,1fr)_minmax(0,1.2fr)] items-center gap-4 border-y border-border bg-muted px-4 text-xs font-medium text-muted-foreground sm:px-6",children:[n.jsx("input",{type:"checkbox","aria-label":"Select every sandbox shown",checked:K,onChange:()=>b(K?[]:F.map(U=>U.name)),className:"size-3.5"}),n.jsx("span",{children:"Sandbox"}),n.jsx("span",{children:"Groups"}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Ig,{className:"size-3","aria-hidden":"true"}),"Network rules"]})]}),n.jsxs("ul",{className:"divide-y divide-border/60 bg-card",children:[F.map(U=>{var Z;const H=ir(a,U.name),W=h4(a.policies,{name:U.name,groups:H,setups:((Z=a.setupMembers)==null?void 0:Z[U.name])??[]}),q=g.includes(U.name);return n.jsxs("li",{className:Ve("grid min-h-11 grid-cols-[28px_minmax(0,1.4fr)_minmax(180px,1fr)_minmax(0,1.2fr)] items-center gap-4 px-4 py-1.5 sm:px-6",q&&"bg-accent/40"),children:[n.jsx("input",{type:"checkbox","aria-label":`Select ${U.name}`,checked:q,onChange:()=>b(z=>q?z.filter(L=>L!==U.name):[...z,U.name]),className:"size-3.5"}),n.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[n.jsx("span",{className:Ve("size-2 shrink-0 rounded-[3px]",Za(U.phase).cell),"aria-hidden":"true"}),n.jsx("span",{className:"truncate font-mono text-xs",children:U.name})]}),n.jsx("fieldset",{disabled:C,"aria-label":`Groups for ${U.name}`,className:"min-w-0",children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:T,value:H,onChange:z=>{const L=z.filter(ee=>!H.includes(ee)),X=H.filter(ee=>!z.includes(ee));$([U.name],L.length?L:X,L.length?"add":"remove")}})}),n.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:W.map(z=>z.name).join(`
|
|
528
|
+
`),children:W.length?W.map(z=>z.name).join(", "):n.jsx("span",{className:"text-faint",title:"Its policy and agent rules still apply",children:"No network rules"})})]},U.name)}),!F.length&&n.jsxs("li",{className:"px-6 py-8 text-center text-xs text-muted-foreground",children:["No sandbox matches “",m,"”."]})]})]})}):n.jsx("p",{className:"px-6 py-10 text-center text-xs text-muted-foreground",children:"No sandboxes yet. When you create one, pick a group for it in the New sandbox dialog."})]})]}),P,n.jsx(UD,{group:T.find(U=>U.id===f)??null,org:a,sandboxes:M,onClose:()=>h(null),onChanged:A,onPolicy:R})]}):n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsx(BD,{onCreate:()=>u(!0),onPolicy:()=>e("egress")}),P]})}function BJ({combined:e,...t}){return e?n.jsx(VJ,{...t}):n.jsx($J,{...t})}function VJ({onNavigate:e}){const t=Uu(["org"]),[r,a]=x.useState(!1),[i,c]=x.useState(null),[u,f]=x.useState(""),[h,m]=x.useState(!1),[p,g]=x.useState([]),[b,v]=x.useState([]),[w,C]=x.useState(!1),S=t.sources.flatMap($=>{var P,U;return(((U=(P=$.data)==null?void 0:P.org)==null?void 0:U.groups)??[]).map(H=>({...H,location:$.location,sourceOrg:$.data.org}))}),N=xf("groups",S),E=mx(S,t.apiFor,t.refresh),k=$=>{var P,U;return(U=(P=t.sources.find(H=>H.location.id===$.id))==null?void 0:P.data)==null?void 0:U.org},A=t.inventory.sandboxes.filter($=>$.phase!=="deleting"),M=A.filter($=>ir(k($.location),$.name).length).length,R=A.filter($=>!u||[$.name,...ir(k($.location),$.name).map(P=>{var U,H;return((H=(U=k($.location))==null?void 0:U.groups.find(W=>W.id===P))==null?void 0:H.name)??""})].join(" ").toLowerCase().includes(u.toLowerCase())),T=A.filter($=>p.includes(ht($))),O=T.length>0&&T.every($=>$.location.id===T[0].location.id),D=O?T[0].location.id:null;x.useEffect(()=>v([]),[D]);const B=O?k(T[0].location):null;async function F($,P,U){C(!0);try{Of(await t.apiFor($[0].location).setGroupMembers($.map(H=>H.name),P,U),"Updated groups"),g([]),await t.refresh()}catch(H){He.error(H.message)}finally{C(!1)}}const K=r&&n.jsx(Dx,{onClose:()=>a(!1),children:($,P)=>{const U=k($);return n.jsx(VD,{open:!0,onOpenChange:H=>{H||P()},groups:(U==null?void 0:U.groups)??[],assignments:(U==null?void 0:U.assignments)??{},sandboxes:A.filter(H=>H.location.id===$.id),onCreated:async(H,W,q)=>{await t.refresh(),P(),He.success(`Created ${H.name}`)}})}});return t.loading&&!t.sources.length?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Reading groups…"}):t.status.unavailable?n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsx(Mu,{model:t,what:"groups"}),n.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"Groups unavailable"})]}):n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 pt-4 pb-3 sm:px-6",children:[[["Groups",N.length],["In a group",M],["No group",A.length-M]].map(([$,P])=>n.jsxs("div",{className:"rounded-md px-3 py-1.5",children:[n.jsx("span",{className:"block text-[11px] text-muted-foreground",children:$}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none",children:P})]},$)),n.jsxs(le,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)]",onClick:()=>a(!0),children:[n.jsx(ys,{}),"New group"]})]}),n.jsx(Mu,{model:t,what:"groups"}),n.jsx("section",{"aria-label":"Groups",className:"grid gap-3 px-4 py-5 sm:grid-cols-2 sm:px-6 xl:grid-cols-3",children:N.map($=>{var P;return n.jsxs("div",{className:"relative flex min-w-0 flex-col gap-2",children:[n.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[n.jsx(fx,{record:$}),$.location.connected===!1&&n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Offline"})]}),n.jsx(HD,{group:$,members:((P=$.sourceOrg.members)==null?void 0:P[$.id])??[],policies:Ow($.sourceOrg.policies,$.id),disabled:!$.location.connected,onOpen:()=>c($),delay:0})]},ht($))})}),!N.length&&!t.status.any&&n.jsx(BD,{onCreate:()=>a(!0),onPolicy:()=>e("egress")}),n.jsxs("section",{"aria-label":"Sandboxes and their groups",className:"border-t",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3 sm:px-6",children:[n.jsxs(le,{variant:"ghost",size:"sm","aria-expanded":h,onClick:()=>m(!h),children:[n.jsx(Lr,{className:h?"rotate-90":""}),"Sandboxes ",A.length]}),h&&n.jsx(yo,{className:"ml-auto w-full sm:w-56","aria-label":"Search sandboxes",value:u,onValueChange:f,placeholder:"Search sandboxes…"})]}),h&&n.jsxs(n.Fragment,{children:[T.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-y bg-accent/30 px-6 py-2 text-xs",children:[n.jsxs("span",{children:[T.length," selected"]}),O?n.jsxs(n.Fragment,{children:[n.jsx(cc,{multiple:!0,allowCreate:!1,groups:(B==null?void 0:B.groups)??[],value:b,onChange:v}),n.jsx(le,{size:"sm",disabled:w||!b.length||!T[0].location.connected,onClick:()=>F(T,b,"add"),children:"Add to groups"}),n.jsx(le,{size:"sm",variant:"outline",disabled:w||!b.length||!T[0].location.connected,onClick:()=>F(T,b,"remove"),children:"Remove from groups"})]}):n.jsx("span",{className:"text-muted-foreground",children:"Select sandboxes from one source to change their groups."}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>g([]),children:"Clear"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{"aria-label":"Sandboxes and groups",className:"w-full min-w-[640px] text-left text-xs",children:[n.jsx("thead",{className:"border-y bg-muted text-muted-foreground",children:n.jsx("tr",{children:["","Sandbox","Source","Groups","Network rules"].map(($,P)=>n.jsx("th",{className:"px-4 py-2 font-normal",children:$},P))})}),n.jsxs("tbody",{className:"divide-y",children:[R.map($=>{var q;const P=k($.location),U=ir(P,$.name),H=ht($),W=h4((P==null?void 0:P.policies)??[],{name:$.name,groups:U,setups:((q=P==null?void 0:P.setupMembers)==null?void 0:q[$.name])??[]});return n.jsxs("tr",{className:"bg-card",children:[n.jsx("td",{className:"px-4",children:n.jsx("input",{type:"checkbox","aria-label":`Select ${$.name} at ${$.location.label}`,disabled:!$.location.connected,checked:p.includes(H),onChange:()=>g(Z=>Z.includes(H)?Z.filter(z=>z!==H):[...Z,H])})}),n.jsx("td",{className:"px-4 py-3 font-mono",children:$.name}),n.jsx("td",{className:"px-4",children:n.jsx(Hs,{location:$.location})}),n.jsx("td",{className:"px-4",children:n.jsx("fieldset",{disabled:w||!$.location.connected,children:n.jsx(cc,{multiple:!0,allowCreate:!1,groups:(P==null?void 0:P.groups)??[],value:U,onChange:Z=>{const z=Z.filter(X=>!U.includes(X)),L=U.filter(X=>!Z.includes(X));F([$],z.length?z:L,z.length?"add":"remove")}})})}),n.jsx("td",{className:"px-4 text-muted-foreground",children:W.map(Z=>Z.name).join(", ")||"No network rules"})]},H)}),!R.length&&n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:u?`No sandbox matches “${u}”.`:"No sandboxes yet."})})]})]})})]})]}),K,i&&n.jsx(Zn,{location:i.location,children:n.jsx(hx,{record:i,type:"groups",offer:E.offer,children:n.jsx(UD,{sourceControl:n.jsx(wf,{record:i,onChange:$=>c({...$,...S.find(P=>ht(P)===ht($)),copies:i.copies})}),group:i,org:k(i.location),sandboxes:A.filter($=>$.location.id===i.location.id),onClose:()=>c(null),onChanged:async()=>{var U,H,W;const $=await t.refresh(),P=(W=(H=(U=$==null?void 0:$.find(q=>q.location.id===i.location.id))==null?void 0:U.data)==null?void 0:H.org)==null?void 0:W.groups.find(q=>q.id===i.id);P&&c({...i,...P})},onPolicy:$=>{$D({...$,location:i.location}),e("egress",i.location)}},ht(i))})}),E.dialog]})}const UJ=({className:e,size:t=50,delay:r=0,duration:a=6,colorFrom:i="#ffaa40",colorTo:c="#9c40ff",transition:u,style:f,reverse:h=!1,initialOffset:m=0,borderWidth:p=1})=>n.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] border-(length:--border-beam-width) border-transparent mask-[linear-gradient(transparent,transparent),linear-gradient(#000,#000)] mask-intersect [mask-clip:padding-box,border-box]",style:{"--border-beam-width":`${p}px`},children:n.jsx(In.div,{className:Ve("absolute aspect-square","bg-linear-to-l from-(--color-from) via-(--color-to) to-transparent",e),style:{width:t,offsetPath:`rect(0 auto auto 0 round ${t}px)`,"--color-from":i,"--color-to":c,...f},initial:{offsetDistance:`${m}%`},animate:{offsetDistance:h?[`${100-m}%`,`${-m}%`]:[`${m}%`,`${100+m}%`]},transition:{repeat:1/0,ease:"linear",duration:a,delay:-r,...u}})}),HJ=[{minutes:60,label:"1 hour"},{minutes:480,label:"8 hours"},{minutes:1440,label:"1 day"},{minutes:null,label:"Until I close it"}],FJ=[{label:"Dev server",port:3e3,name:"dev"},{label:"Vite",port:5173,name:"vite"},{label:"Jupyter",port:8888,name:"jupyter"},{label:"Web app",port:8080,name:"web"}];function GJ(e,t){const r=Date.parse(e)-t;if(r<=0)return"closing…";const a=Math.round(r/6e4);return a<60?`${a}m`:a<2880?`${Math.floor(a/60)}h ${a%60?`${a%60}m`:""}`.trim():`${Math.round(a/1440)}d`}function qJ(e=3e4){const[t,r]=x.useState(Date.now());return x.useEffect(()=>{const a=setInterval(()=>r(Date.now()),e);return()=>clearInterval(a)},[e]),t}function FD({value:e,onChange:t,label:r="Close automatically"}){return n.jsx("div",{role:"radiogroup","aria-label":r,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:HJ.map(a=>n.jsx("button",{type:"button",role:"radio","aria-checked":e===a.minutes,onClick:()=>t(a.minutes),className:`flex-1 rounded px-2 py-1 text-[11px] whitespace-nowrap outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${e===a.minutes?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:a.label},String(a.minutes)))})}function YJ({text:e}){const[t,r]=x.useState(!1);return n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Copy URL",onClick:async()=>{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},children:t?n.jsx(Yn,{className:"size-3.5 text-emerald-600"}):n.jsx(Lf,{className:"size-3.5"})})}function KJ({service:e,visits:t,now:r,onChanged:a,remote:i,canExpose:c}){var w;const u=Pt(),[f,h]=x.useState(null),[m,p]=x.useState(!1),g=e.name||"default",b=t.filter(C=>C.verdict==="denied").length;async function v(C,S,N){h(C);try{await S(),He.success(N),a()}catch(E){He.error(E.message)}finally{h(null),p(!1)}}return n.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-card",children:[e.expiresAt&&Date.parse(e.expiresAt)-r<15*6e4&&n.jsx(UJ,{size:60,duration:8,colorFrom:"#f59e0b",colorTo:"#fde68a"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3",children:[n.jsx(Q1,{strokeWidth:1.4,className:"size-4 text-emerald-600","aria-hidden":"true"}),n.jsx("span",{className:"font-mono text-[13px] font-medium",children:g}),n.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["→ port ",e.port]}),n.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-[11px]",children:[n.jsx(Lk,{className:`size-3.5 ${e.expiresAt?"text-amber-600":"text-muted-foreground"}`,"aria-hidden":"true"}),e.expiresAt?n.jsxs("span",{className:"text-amber-800",children:["closes in ",GJ(e.expiresAt,r)]}):n.jsx("span",{className:"text-muted-foreground",children:"no timer"})]})]}),i&&n.jsx("p",{className:"border-t border-border/70 px-4 py-2 text-[11px] text-muted-foreground",children:"Reachable by anyone with gateway access."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[e.url?n.jsxs(n.Fragment,{children:[n.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate font-mono text-[11px] underline-offset-2 hover:underline",children:e.url}),n.jsx(YJ,{text:e.url}),n.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer","aria-label":"Open in a new tab",className:"rounded p-1 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(FL,{className:"size-3.5"})})]}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"No URL"}),n.jsxs("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",title:"Visits recorded in the last hour",children:[t.length," visit",t.length===1?"":"s",b?n.jsxs("span",{className:"text-red-600",children:[" · ",b," failed"]}):null]})]}),b>0&&((w=t[0])==null?void 0:w.verdict)==="denied"&&n.jsxs("p",{className:"border-t border-border/70 bg-amber-50/50 px-4 py-1.5 text-[11px] text-amber-800",children:["Last visit failed: nothing listening on port ",e.port,"."]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[c&&(m?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-full sm:w-96",children:n.jsx(FD,{value:void 0,onChange:C=>v("extend",()=>u.extendService(e,C),C?"Timer reset":"Timer removed"),label:"New auto-close"})}),n.jsx(le,{size:"icon-xs",variant:"ghost",onClick:()=>p(!1),"aria-label":"Cancel",children:n.jsx(Pn,{})})]}):n.jsxs(le,{size:"xs",variant:"ghost",onClick:()=>p(!0),disabled:!!f,children:[n.jsx(Lk,{}),"Change timer"]})),n.jsxs(le,{size:"xs",variant:"outline",className:"ml-auto border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",disabled:!!f,onClick:()=>v("close",()=>u.closeService(e),`Closed ${g}`),children:[f==="close"?n.jsx(Nt,{}):n.jsx(DA,{}),"Close now"]})]})]})}function XJ({sandbox:e,onOpened:t}){const r=Pt(),[a,i]=x.useState(""),[c,u]=x.useState(""),[f,h]=x.useState(60),[m,p]=x.useState(!1),[g,b]=x.useState(null);async function v(w){w.preventDefault(),p(!0),b(null);try{const C=await r.exposeService({sandbox:e,name:c.trim(),port:Number(a),closeAfterMinutes:f});He.success(`Opened ${c||"default"} on port ${a}`,{description:C.url??void 0}),i(""),u(""),t()}catch(C){b(C.message)}finally{p(!1)}}return n.jsxs("form",{onSubmit:v,className:"space-y-3 rounded-lg border border-dashed border-border p-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Open a port"}),FJ.map(w=>n.jsxs("button",{type:"button",onClick:()=>{i(String(w.port)),u(w.name)},className:`rounded border px-2 py-0.5 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${a===String(w.port)?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[w.label," ",n.jsx("span",{className:"font-mono opacity-60",children:w.port})]},w.port))]}),n.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[n.jsxs("div",{className:"grid w-24 gap-1",children:[n.jsx(zn,{htmlFor:"door-port",className:"text-[11px] text-muted-foreground",children:"Port"}),n.jsx(Ot,{id:"door-port",value:a,onChange:w=>i(w.target.value.replace(/\D/g,"")),className:"h-8 font-mono text-xs",placeholder:"3000",required:!0,inputMode:"numeric",title:"App must listen on 127.0.0.1"})]}),n.jsxs("div",{className:"grid w-36 gap-1",children:[n.jsx(zn,{htmlFor:"door-name",className:"text-[11px] text-muted-foreground",children:"Name"}),n.jsx(Ot,{id:"door-name",value:c,onChange:w=>u(w.target.value.toLowerCase()),className:"h-8 font-mono text-xs",placeholder:"default"})]}),n.jsxs("div",{className:"min-w-72 flex-1",children:[n.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Auto-close"}),n.jsx(FD,{value:f,onChange:h})]}),n.jsxs(le,{type:"submit",size:"sm",disabled:m||!a,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[m?n.jsx(Nt,{}):n.jsx(Q1,{}),"Open"]})]}),g&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:g})]})}const hp={visit:e=>e.verdict==="denied"?`Visit to port ${e.port??"?"} failed`:`Visit to port ${e.port??"?"}`,session:()=>"Terminal session opened",command:()=>"Command run","service-opened":e=>`Opened ${e.service||"default"} → port ${e.port??"?"}`,"service-closed":e=>`Closed ${e.service||"default"}`};function WJ(e){const t=[];for(const r of e){const a=t[t.length-1];if(a&&r.type==="visit"&&a.type==="visit"&&a.port===r.port&&Math.abs(Date.parse(a.at)-Date.parse(r.at))<2e3){r.verdict==="denied"&&(t[t.length-1]=r);continue}t.push(r)}return t}function QJ({combined:e}){const t=gn();return e?n.jsx(ZJ,{}):n.jsx(GD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function GD({selectedSandbox:e}){var D,B,F,K,$;const t=Pt(),r=gn(),a=r?`ingress-scope:${r.context}`:"ingress-scope",i=oi(),c=qJ(),u=(i.sandboxes??[]).filter(P=>P.phase!=="deleting"),[f,h]=x.useState(()=>{try{return sessionStorage.getItem(a)}catch{return null}}),m=e??((D=u.find(P=>P.name===f))==null?void 0:D.name)??((B=u[0])==null?void 0:B.name)??null;x.useEffect(()=>{try{m&&sessionStorage.setItem(a,m)}catch{}},[m,a]);const[p,g]=x.useState(null),[b,v]=x.useState(null),[w,C]=x.useState("");x.useEffect(()=>{let P=!0;return v(null),C(""),t.capabilities().then(U=>{P&&v(U)}).catch(U=>{P&&C(U.message)}),()=>{P=!1}},[t]);const S=((F=b==null?void 0:b.features)==null?void 0:F.publicIngress)===!0,N=x.useCallback(()=>t.ingress().then(g).catch(P=>g({error:P.message})),[t]);x.useEffect(()=>{N();const P=setInterval(N,15e3);return()=>clearInterval(P)},[N]);const E=((p==null?void 0:p.services)??[]).filter(P=>P.sandbox===m),k=x.useMemo(()=>{const P={};for(const U of(p==null?void 0:p.services)??[])P[U.sandbox]=(P[U.sandbox]??0)+1;return P},[p]),A=x.useMemo(()=>WJ(i.events.filter(P=>P.kind==="inbound"&&P.sandbox===m)),[i.events,m]),M=P=>A.filter(U=>U.type==="visit"&&U.port===P&&Date.parse(U.at)>c-36e5),R=A.filter(P=>P.type==="session"||P.type==="command"),T=(K=p==null?void 0:p.sessions)==null?void 0:K.ttlSeconds,O=(p==null?void 0:p.error)??(i.sandboxes==null?(($=i.overview)==null?void 0:$.error)??(i.connection==="gateway-down"?"The gateway is unavailable.":null):null);return n.jsxs("div",{className:"flex h-full min-h-0",children:[!e&&n.jsxs("nav",{"aria-label":"Sandbox",className:"hidden w-56 shrink-0 overflow-y-auto border-r border-border bg-background p-3 md:block",children:[n.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),u.map(P=>n.jsxs("button",{onClick:()=>h(P.name),"aria-current":m===P.name,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${m===P.name?"bg-accent":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:`size-2 shrink-0 rounded-[2px] ${Za(P.phase).cell}`,"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px]",children:P.name}),k[P.name]?n.jsxs("span",{className:"rounded bg-emerald-50 px-1 font-mono text-[10px] text-emerald-800",title:"Open services",children:[k[P.name]," open"]}):n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"closed"})]},P.id))]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:O?n.jsxs("div",{role:"alert",className:"grid justify-items-center gap-3 py-16 text-center text-sm text-muted-foreground",children:[n.jsx("p",{children:O}),n.jsx(le,{variant:"outline",size:"sm",onClick:()=>{N(),i.refresh()},children:"Retry"})]}):!p||i.sandboxes==null?n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}):m?n.jsxs("div",{className:"mx-auto grid max-w-6xl gap-6 px-4 py-5 sm:px-6 xl:grid-cols-[minmax(0,1fr)_17rem]",children:[n.jsxs("div",{className:"min-w-0 space-y-6",children:[!e&&n.jsx(pn,{value:m,onChange:P=>h(P.target.value),className:"h-8 rounded-md border border-input bg-transparent px-2 font-mono text-xs md:hidden","aria-label":"Sandbox",children:u.map(P=>n.jsx("option",{children:P.name},P.id))}),n.jsx(ho,{duration:.22,offset:3,blur:"1px",children:n.jsx("div",{className:`rounded-lg border p-5 ${E.length?"border-emerald-600/20 bg-emerald-50/40":"border-border bg-card"}`,children:n.jsxs("p",{className:"flex items-center gap-2 text-sm font-medium",children:[E.length?n.jsx(Q1,{className:"size-4 text-emerald-600"}):n.jsx(DA,{className:"size-4 text-muted-foreground"}),E.length?`${E.length} service${E.length===1?"":"s"} open`:`${m} is closed`]})})}),n.jsxs("section",{className:"space-y-3",children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(J1,{className:"size-3"}),"Web services"]}),E.map(P=>n.jsx(KJ,{remote:p.auth.remote,canExpose:S,service:P,visits:M(P.port),now:c,onChanged:()=>{N(),i.refresh()}},`${P.sandbox}/${P.name}`)),S?n.jsx(XJ,{sandbox:m,onOpened:()=>{N(),i.refresh()}}):n.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/20 px-4 py-3 text-xs text-muted-foreground",children:w?`Could not check service forwarding: ${w}`:b?"Public service forwarding is not available at this location. Terminal and file access remain available.":"Checking service forwarding…"})]}),n.jsxs("section",{className:"space-y-2",children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(VA,{className:"size-3"}),"Terminal access"]}),n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsx("p",{className:"px-4 py-3 text-[11px] text-muted-foreground",children:T===null?"Default session lifetime":T===0?"Sessions never expire":`Sessions expire after ${Math.round(T/60)} min`}),n.jsx("div",{className:"border-t border-border/70",children:R.length?R.slice(0,8).map(P=>n.jsxs("div",{className:"flex h-[28px] items-center gap-3 border-b border-border/50 px-4 font-mono text-[11px] last:border-0",children:[n.jsx("span",{className:"w-16 shrink-0 text-muted-foreground",children:new Date(P.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),n.jsx("span",{children:hp[P.type](P)})]},`${P.at}|${P.message}`)):n.jsx("p",{className:"px-4 py-2.5 text-[11px] text-muted-foreground",children:"No recent sessions"})})]})]})]}),n.jsxs("aside",{className:"space-y-4",children:[n.jsxs("section",{className:"rounded-lg border border-border bg-card p-4",children:[n.jsxs("h3",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[n.jsx(zu,{className:"size-3"}),"Access"]}),n.jsx("p",{className:"mt-2 text-[11px] leading-relaxed",children:p.auth.mode==="mtls"?"Client certificate (this Mac)":`Sign-in: ${p.auth.mode}`})]}),n.jsxs("section",{children:[n.jsx("h3",{className:"mb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Recent inbound"}),n.jsx("ol",{className:"rounded-lg border border-border bg-card",children:A.length?A.slice(0,14).map(P=>{var U;return n.jsxs("li",{className:"flex items-start gap-2 border-b border-border/50 px-3 py-1.5 text-[11px] last:border-0",children:[n.jsx("span",{className:`mt-1.5 size-1.5 shrink-0 rounded-full ${P.verdict==="denied"?"bg-red-500":P.type.startsWith("service")?"bg-emerald-500":"bg-stone-400"}`,"aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1",children:((U=hp[P.type])==null?void 0:U.call(hp,P))??P.type}),n.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:Lu(P.at)})]},`${P.at}|${P.message}`)}):n.jsx("li",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:"Nothing yet."})})]})]})]}):n.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"No sandboxes yet."})})]})}function ZJ(){const e=Uu(["ingress","capabilities"]),[t,r]=x.useState(null),[a,i]=x.useState(""),c=e.inventory.sandboxes.filter(u=>u.phase!=="deleting"&&u.name.toLowerCase().includes(a.toLowerCase()));return n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsx("div",{className:"flex items-center gap-2 border-b px-4 py-3 sm:px-6",children:n.jsx(yo,{className:"w-60","aria-label":"Search ingress",placeholder:"Search sandboxes…",value:a,onValueChange:i})}),n.jsx(Mu,{model:e,offline:!1}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[n.jsxs("table",{"aria-label":"Ingress",className:"w-full min-w-[560px] text-left text-xs",children:[n.jsx("thead",{className:"sticky top-0 border-b bg-muted text-muted-foreground",children:n.jsx("tr",{children:["Sandbox","Source","Web services","Access"].map(u=>n.jsx("th",{className:"h-9 px-6 font-normal",children:u},u))})}),n.jsx("tbody",{className:"divide-y",children:c.map(u=>{var p,g,b,v;const f=e.sources.find(w=>w.location.id===u.location.id),h=(f==null?void 0:f.location)??u.location,m=((g=(p=f==null?void 0:f.data)==null?void 0:p.ingress)==null?void 0:g.services.filter(w=>w.sandbox===u.name))??[];return n.jsxs("tr",{className:"bg-card hover:bg-muted/40",children:[n.jsx("td",{className:"px-6 py-3 font-mono",children:u.name}),n.jsx("td",{className:"px-6",children:n.jsx(Hs,{location:h})}),n.jsx("td",{className:"px-6 text-muted-foreground",children:f!=null&&f.data?((v=(b=f.data.capabilities)==null?void 0:b.features)==null?void 0:v.publicIngress)===!1?"Not supported":m.length?m.map(w=>`${w.name} · ${w.port}`).join(", "):"Closed":h.connected?"Loading…":"Offline"}),n.jsx("td",{className:"px-6",children:n.jsx(le,{variant:"ghost",size:"sm",disabled:!h.connected,onClick:()=>r({...u,location:h}),children:h.connected?"Manage access":"Offline"})})]},ht(u))})})]}),!c.length&&n.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:e.inventory.loading?"Loading ingress…":"No matching sandboxes."})]}),t&&n.jsx(Lo,{open:!0,onOpenChange:u=>{u||(r(null),e.refresh())},children:n.jsxs(la,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-5xl",children:[n.jsxs(ca,{className:"shrink-0 border-b px-6 py-4",children:[n.jsx(ua,{children:t.name}),n.jsx(da,{children:n.jsx(Hs,{location:t.location})})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Zn,{location:t.location,children:n.jsx(Rf,{children:n.jsx(GD,{selectedSandbox:t.name})})})})]})})]})}function JJ({tab:e,onNavigate:t,combined:r,requestedLocation:a}){const i=gn();return n.jsxs(nh,{value:e,onValueChange:c=>t(c,r?void 0:i),className:"h-[calc(100svh-3.5rem)] min-h-0 gap-0",children:[n.jsx("div",{className:"shrink-0 border-b bg-card px-4 sm:px-8",children:n.jsxs(sh,{variant:"line",className:"h-11! gap-5 p-0",children:[n.jsx(Pr,{value:"egress",className:"h-full px-0 text-xs after:bottom-0!",children:"Egress"}),n.jsx(Pr,{value:"ingress",className:"h-full px-0 text-xs after:bottom-0!",children:"Ingress"})]})}),n.jsx(Io,{value:"egress",className:"min-h-0",children:n.jsx(FW,{onNavigate:t,combined:r,requestedLocation:a})}),n.jsx(Io,{value:"ingress",className:"min-h-0",children:n.jsx(QJ,{combined:r})})]})}const my=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function NR(e,t,r=Date.now()){const a=new Map(t.map(i=>[i.id,i]));return e.map(i=>{const c=a.get(i.type),u=Object.values(i.expires??{}).map(Date.parse).filter(Number.isFinite).sort((m,p)=>m-p)[0]??null,f=u===null?"none":u<=r?"expired":u<=r+7*864e5?"expiring":"scheduled",h=((c==null?void 0:c.endpoints)??[]).map(m=>m.host);return{secret:i,profile:c,expiry:u,status:f,service:(c==null?void 0:c.name)??i.type,hosts:h,search:[i.name,i.type,c==null?void 0:c.name,...i.credentialKeys,...i.attachedTo,...h].join(" ").toLowerCase()}})}function eee(e,{query:t,scope:r,service:a,expiry:i,sort:c}){const u=t.trim().toLowerCase();return e.filter(f=>(!u||f.search.includes(u))&&(r==="all"||(r==="attached"?f.secret.attachedTo.length>0:f.secret.attachedTo.length===0))&&(!a||f.secret.type===a)&&(!i||f.status===i)).sort((f,h)=>{const m=v=>({name:v.secret.name,service:v.service,credentials:v.secret.credentialKeys.length,attached:v.secret.attachedTo.length,expiry:v.expiry})[c.key],p=m(f),g=m(h);if(p===null)return g===null?my.compare(f.secret.name,h.secret.name):1;if(g===null)return-1;const b=typeof p=="number"?p-g:my.compare(p,g);return(c.direction==="asc"?b:-b)||my.compare(f.secret.name,h.secret.name)})}const tee=[{id:"agent",label:"Agents"},{id:"inference",label:"Models"},{id:"code",label:"Code"}],qD=[{id:"claude-code",name:"Claude Code",group:"agent",blurb:"Anthropic's coding agent",keyUrl:"https://console.anthropic.com/settings/keys",keyHint:"sk-ant-…"},{id:"codex",name:"Codex",group:"agent",blurb:"Existing Codex OAuth session",helpUrl:"https://developers.openai.com/codex/auth/"},{id:"copilot",name:"Copilot",group:"agent",blurb:"GitHub Copilot CLI"},{id:"openai",name:"OpenAI",group:"inference",blurb:"GPT models API",keyUrl:"https://platform.openai.com/api-keys",keyHint:"sk-…"},{id:"openrouter",name:"OpenRouter",group:"inference",blurb:"One key, many models",keyUrl:"https://openrouter.ai/keys",keyHint:"sk-or-…"},{id:"github",name:"GitHub",group:"code",blurb:"Repos and API",keyUrl:"https://github.com/settings/personal-access-tokens",keyHint:"github_pat_…"}],YD=e=>qD.find(t=>t.id===e)??null,nee=e=>YD(e)?`/logos/${e}.svg`:null;function Lx({type:e,size:t="md",className:r}){const a=nee(e),i=t==="lg"?"size-10 rounded-lg":t==="sm"?"size-6 rounded-md":"size-8 rounded-md",c=t==="lg"?"size-5":t==="sm"?"size-3.5":"size-[18px]";return n.jsx("span",{className:Ve("flex shrink-0 items-center justify-center border border-border/80 bg-linear-to-b from-background to-muted/50 shadow-[0_1px_2px_#00000008]",i,r),children:a?n.jsx("img",{src:a,alt:"","aria-hidden":"true",className:Ve("object-contain",c),draggable:!1}):n.jsx(zu,{strokeWidth:1.4,className:Ve("text-muted-foreground",c),"aria-hidden":"true"})})}function KD(e){return e.id==="aws-bedrock"?"This profile requires an upstream Bedrock bridge. Direct AWS credential authentication is not implemented by this profile; this form cannot configure the bridge.":(e.credentials??[]).some(t=>{var r;return t.refresh===!0||((r=t.refresh)==null?void 0:r.strategy)})?"This profile requires managed credential refresh setup. Configure it with the OpenShell CLI; this form does not yet support its refresh material.":(e.credentials??[]).some(t=>{var r;return!((r=t.envVars)!=null&&r.length)})?"This profile has credentials without environment mappings and cannot be configured in this form.":null}function see(e){return(e.credentials??[]).map(t=>{var r;return{...t,key:(r=t.envVars)==null?void 0:r[0],label:t.description||t.name,placeholder:t.name==="account_id"?"Enter account ID":/token/.test(t.name)?"Paste token":"Paste API key",inputType:t.name==="account_id"?"text":"password"}})}function ree(e,t){const r=KD(e);if(r)throw new Error(r);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Credentials must be an object.");const a=e.credentials??[],i=new Set(a.flatMap(u=>u.envVars??[])),c={};for(const[u,f]of Object.entries(t)){if(!i.has(u))throw new Error(`${u} is not a credential of this profile.`);if(typeof f!="string")throw new Error(`${u} must be text.`);if(f){if(!f.trim()||f!==f.trim()||/[\r\n\x00]/.test(f))throw new Error(`${u} contains whitespace or line breaks. Paste only the credential value.`);if(f.length>8192)throw new Error(`${u} is too long.`);c[u]=f}}for(const u of a){const f=u.envVars.filter(h=>c[h]);if(u.required&&!f.length)throw new Error(`${u.description||u.name} is required.`);if(new Set(f.map(h=>c[h])).size>1)throw new Error(`Aliases for ${u.name} must contain the same value.`)}if(a.length&&!Object.keys(c).length)throw new Error("Enter at least one credential.");return c}function oee({query:e,setQuery:t,have:r,onPick:a,picking:i}){const c=e.trim().toLowerCase(),u=h=>!c||`${h.name} ${h.blurb} ${h.id}`.toLowerCase().includes(c),f=tee.map(h=>({...h,items:qD.filter(m=>m.group===h.id&&u(m))})).filter(h=>h.items.length);return n.jsxs("div",{className:"space-y-3",children:[n.jsx(yo,{value:e,onValueChange:t,placeholder:"Search services","aria-label":"Search services",autoFocus:!0}),n.jsxs("div",{className:"-mx-1 max-h-[60svh] space-y-3 overflow-y-auto px-1 pt-1",children:[f.map(h=>n.jsxs("section",{children:[n.jsx("h3",{className:"mb-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:h.label}),n.jsx("div",{className:"grid grid-cols-3 gap-1.5 sm:grid-cols-4",children:h.items.map(m=>n.jsxs("button",{type:"button",onClick:()=>a(m),disabled:!!i,title:m.blurb,className:"group relative flex items-center gap-2 rounded-lg border border-border/70 bg-card py-1.5 pr-2 pl-1.5 text-left outline-none transition-[border-color,background-color,transform] hover:border-foreground/20 hover:bg-muted/30 focus-visible:ring-2 focus-visible:ring-ring motion-safe:hover:-translate-y-px disabled:opacity-60",children:[i===m.id?n.jsx("span",{className:"flex size-6 items-center justify-center",children:n.jsx(Nt,{className:"size-3.5"})}):n.jsx(Lx,{type:m.id,size:"sm"}),n.jsx("span",{className:"min-w-0 truncate text-[12px] font-medium",children:m.name}),r.has(m.id)&&n.jsx("span",{className:"absolute -top-1 -right-1 flex size-3.5 items-center justify-center rounded-full bg-emerald-500 text-white",title:"You already have a secret for this",children:n.jsx(Yn,{className:"size-2.5",strokeWidth:3})})]},m.id))})]},h.id)),!f.length&&n.jsxs("p",{className:"py-6 text-center text-[11px] text-muted-foreground",children:["No service matches “",e,"”."]})]})]})}function aee({service:e,profile:t,taken:r,sandboxes:a,onBack:i,onDone:c}){const u=Pt(),[f,h]=x.useState(()=>{const R=`my-${e.id}`;if(!r.has(R))return R;for(let T=2;;T++)if(!r.has(`${R}-${T}`))return`${R}-${T}`}),[m,p]=x.useState({}),[g,b]=x.useState([]),[v,w]=x.useState(!1),[C,S]=x.useState(null),N=t.endpoints.map(R=>R.host),E=see(t),k=KD(t),A=t.id==="codex"&&E.some(R=>R.key==="CODEX_AUTH_ACCESS_TOKEN");async function M(R){R.preventDefault(),w(!0),S(null);try{await u.createSecret({name:f,type:t.id,credentials:ree(t,m)}),p({});const T=[];for(const O of g)try{await u.attachSecret(f,O,!0)}catch{T.push(O)}He.success(`Stored ${f}`,{description:g.length?`Attached to ${g.filter(O=>!T.includes(O)).join(", ")||"none"}${T.length?` · failed: ${T.join(", ")}`:""}`:"Credential saved. Vendor connection not tested."}),c()}catch(T){S(T.message)}finally{w(!1)}}return n.jsxs("form",{onSubmit:M,autoComplete:"off",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(le,{type:"button",variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Choose another service",children:n.jsx(W1,{})}),n.jsx(Lx,{type:e.id,size:"lg"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-[14px] font-medium",children:e.name}),n.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:e.blurb})]}),e.keyUrl&&!k&&n.jsxs("a",{href:e.keyUrl,target:"_blank",rel:"noreferrer",className:"flex shrink-0 items-center gap-0.5 rounded-md px-2 py-1 text-[11px] text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["Get a key",n.jsx(Zi,{className:"size-3"})]})]}),A&&n.jsxs("p",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:["This profile stores an existing ChatGPT OAuth session: access token, refresh token, and account ID, with an optional ID token. An OpenAI API key does not belong in these fields. Browser sign-in and API-key setup for Codex are not available in this form. ",n.jsx("a",{className:"underline",href:e.helpUrl,target:"_blank",rel:"noreferrer",children:"Authentication guide"})]}),k&&n.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:k}),n.jsx("div",{className:"space-y-2.5",children:!k&&E.map((R,T)=>{const O=R.key;return n.jsxs("label",{className:"block",children:[n.jsxs("span",{className:"mb-1 flex items-baseline gap-2 text-[11px]",children:[n.jsxs("span",{className:"font-medium",children:[R.label,R.required?n.jsx("span",{className:"text-muted-foreground",children:" · required"}):n.jsx("span",{className:"font-normal text-muted-foreground",children:" · optional"})]}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:O})]}),n.jsxs("span",{className:"relative block",children:[n.jsx(Pk,{className:"absolute top-2.5 left-3 size-3.5 text-muted-foreground","aria-hidden":"true"}),n.jsx(Ot,{"aria-label":R.label,type:R.inputType,value:m[O]??"",onChange:D=>p(B=>({...B,[O]:D.target.value})),className:"h-9 pl-9 font-mono text-xs",placeholder:E.length===1&&e.keyHint?e.keyHint:R.placeholder,required:R.required,maxLength:8192,autoFocus:T===0,spellCheck:!1,autoComplete:"off"})]})]},O)})}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5",children:[n.jsx("p",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Profile destinations"}),n.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:N.map(R=>n.jsx("span",{className:"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:R},R))}),n.jsxs("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:["Allowed program paths: ",t.binaries.join(", ")||"None declared",". These must match the programs installed in your sandbox."]})]}),!k&&n.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[n.jsxs("label",{className:"grid w-44 gap-1",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name"}),n.jsx(Ot,{value:f,onChange:R=>h(R.target.value.toLowerCase()),className:"h-8 font-mono text-xs",required:!0,pattern:"[a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?"})]}),a.length>0&&n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Attach to"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(R=>{const T=g.includes(R.name);return n.jsxs("button",{type:"button","aria-pressed":T,onClick:()=>b(O=>T?O.filter(D=>D!==R.name):[...O,R.name]),className:`flex h-8 items-center gap-1.5 rounded-md border px-2 font-mono text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${T?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[n.jsx("span",{className:`size-1.5 rounded-full ${T?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),R.name]},R.id)})})]})]}),C&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:C}),n.jsxs(le,{type:"submit",disabled:v||!!k,className:"h-9 w-full bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v?n.jsx(Nt,{}):n.jsx(Pk,{}),"Store ",e.name," secret"]})]})}function XD({open:e,onOpenChange:t,profiles:r,providers:a,sandboxes:i,reload:c}){const u=Pt(),f=Zs(),[h,m]=x.useState(""),[p,g]=x.useState(null),[b,v]=x.useState(null),[w,C]=x.useState(r);x.useEffect(()=>C(r),[r]),x.useEffect(()=>{e||(g(null),m(""),v(null))},[e]);const S=new Set(a.map(R=>R.type)),N=new Set(a.map(R=>R.name)),E=p&&w.find(R=>R.id===p.id);async function k(R){if(w.some(T=>T.id===R.id)){g(R);return}v(R.id);try{await u.importProfile(R.id);const T=await c();C((T==null?void 0:T.profiles)??w),g(R)}catch(T){He.error(`Couldn't set up ${R.name}: ${T.message}`)}finally{v(null)}}const A=p&&E?"key":"pick",M=f?{}:{initial:{opacity:0,x:A==="key"?12:-12},animate:{opacity:1,x:0},exit:{opacity:0,x:A==="key"?-12:12},transition:{duration:.16,ease:"easeOut"}};return n.jsx(tn,{open:e,onOpenChange:t,children:n.jsxs(nn,{className:"gap-0 overflow-hidden p-0 sm:max-w-[580px]","aria-describedby":void 0,children:[n.jsxs("div",{className:"border-b border-border px-5 pt-4 pb-3",children:[n.jsx(Qt,{className:"text-[14px]",children:A==="pick"?"Add secret":"Add credentials"}),n.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:A==="pick"?"Pick the service it's for.":"Stored by the gateway. Saving does not verify the vendor connection."})]}),n.jsx("div",{className:"max-h-[75svh] overflow-y-auto p-5",children:n.jsx(lc,{mode:"wait",initial:!1,children:n.jsx(In.div,{...M,children:A==="pick"?n.jsx(oee,{query:h,setQuery:m,have:S,onPick:k,picking:b}):n.jsx(aee,{service:p,profile:E,taken:N,sandboxes:i,onBack:()=>g(null),onDone:()=>{t(!1),c()}})},A)})})]})})}const iee={header:e=>`sent as the ${e.headerName??"custom"} header`,bearer:()=>"sent as Authorization: Bearer",basic:()=>"sent as HTTP basic auth",query:e=>`sent as the ?${e.queryParam??"…"} parameter`,path:()=>"placed in the request path"},lee=e=>(iee[e.authStyle]??(()=>"resolved by the proxy"))(e),cee=e=>e&&Date.parse(e)-Date.now()<7*864e5;function uee({id:e,label:t,hint:r,value:a,onChange:i,required:c}){return n.jsxs("div",{className:"grid gap-1",children:[n.jsxs(zn,{htmlFor:e,className:"font-mono text-[11px]",children:[t,c&&n.jsx("span",{className:"text-red-600",children:" *"})]}),n.jsx(Ot,{id:e,type:"password",value:a,onChange:u=>i(u.target.value),autoComplete:"off",spellCheck:!1,className:"font-mono text-xs",placeholder:"Paste the value",required:c,title:r})]})}function dee({secret:e,onClose:t,onDone:r}){const a=Pt(),[i,c]=x.useState({}),[u,f]=x.useState(!1),[h,m]=x.useState(null);return x.useEffect(()=>{c({}),m(null)},[e]),n.jsx(tn,{open:!!e,onOpenChange:p=>{p||t()},children:n.jsx(nn,{className:"sm:max-w-md","aria-describedby":void 0,children:n.jsxs("form",{autoComplete:"off",className:"grid gap-4",onSubmit:async p=>{p.preventDefault(),f(!0),m(null);try{const g=await a.rotateSecret(e.name,i);c({}),He.success(`Rotated ${e.name}`,{description:g.sandboxesNotified?`${g.sandboxesNotified} sandbox${g.sandboxesNotified===1?"":"es"} updated`:void 0}),t(),r()}catch(g){m(g.message)}finally{f(!1)}},children:[n.jsx(sn,{children:n.jsxs(Qt,{children:["Rotate ",e==null?void 0:e.name]})}),e==null?void 0:e.credentialKeys.map(p=>n.jsx(uee,{id:`rot-${p}`,label:p,value:i[p]??"",onChange:g=>c(b=>({...b,[p]:g}))},p)),h&&n.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:h}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:u||!Object.values(i).some(Boolean),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[u&&n.jsx(Nt,{"aria-hidden":"true"}),"Rotate"]})]})]})})})}function fee({secret:e,keyName:t,onDone:r}){var m;const a=Pt(),i=(m=e.expires)==null?void 0:m[t],[c,u]=x.useState(!1),[f,h]=x.useState("");return c?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{type:"date",value:f,onChange:p=>h(p.target.value),className:"h-7 w-36 text-[11px]","aria-label":`Expiry for ${t}`}),n.jsx(le,{size:"xs",variant:"outline",onClick:async()=>{try{await a.secretExpiry(e.name,t,f?new Date(`${f}T23:59:00`).toISOString():null),He.success(f?"Expiry set":"Expiry cleared"),u(!1),r()}catch(p){He.error(p.message)}},children:"Save"}),i&&n.jsx(le,{size:"xs",variant:"ghost",onClick:async()=>{try{await a.secretExpiry(e.name,t,null),u(!1),r()}catch(p){He.error(p.message)}},children:"Clear"}),n.jsx(le,{size:"icon-xs",variant:"ghost",onClick:()=>u(!1),"aria-label":"Cancel",children:n.jsx(Pn,{})})]}):n.jsxs("button",{onClick:()=>{h(i?i.slice(0,10):""),u(!0)},className:`flex items-center gap-1 text-[11px] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring ${cee(i)?"text-amber-700":"text-muted-foreground"}`,children:[n.jsx(kL,{className:"size-3"}),i?`expires ${jf(i)}`:"no expiry"]})}function hee({secret:e,profile:t,sandboxes:r,onRotate:a,onDelete:i,onDone:c}){var g;const u=Pt(),[f,h]=x.useState(!1),m=r.filter(b=>!e.attachedTo.includes(b.name));async function p(b,v){h(!0);try{await u.attachSecret(e.name,b,v),He.success(v?`Attached to ${b}`:`Detached from ${b}`),c()}catch(w){He.error(w.message)}finally{h(!1)}}return n.jsxs("div",{className:"bg-card",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border/70 px-4 py-3",children:[n.jsx(Lx,{type:e.type}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:((g=YD(e.type))==null?void 0:g.name)??(t==null?void 0:t.name)??e.type})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.credentialKeys.length>0&&n.jsxs(le,{size:"sm",variant:"outline",onClick:a,children:[n.jsx(rl,{}),"Rotate"]}),n.jsx(le,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:i,"aria-label":`Delete ${e.name}`,children:n.jsx(ts,{className:"size-3.5"})})]})]}),n.jsxs("div",{className:"grid gap-4 px-4 py-3 ",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Credentials"}),e.credentialKeys.length===0&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"None. Access only."}),e.credentialKeys.map(b=>{const v=t==null?void 0:t.credentials.find(w=>w.envVars.includes(b));return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-[11px]",title:v?lee(v):void 0,children:[n.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":"true"}),b]}),n.jsx("div",{className:"pl-3",children:n.jsx(fee,{secret:e,keyName:b,onDone:c})})]},b)})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Allowed hosts"}),t?n.jsxs(n.Fragment,{children:[n.jsx("ul",{className:"space-y-0.5 font-mono text-[11px]",children:t.endpoints.map(b=>n.jsxs("li",{children:[b.host,b.port?`:${b.port}`:"",n.jsxs("span",{className:"font-sans text-[10px] text-muted-foreground",children:[" ",b.access??""]})]},`${b.host}:${b.port}`))}),n.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["by ",t.binaries.map(b=>b.split("/").pop()).filter((b,v,w)=>w.indexOf(b)===v).join(", ")||"any program"]})]}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Profile not found."})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-border/70 px-4 py-2.5 text-[11px]",children:[n.jsx(_A,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),n.jsx("span",{className:"text-muted-foreground",children:"Attached to"}),e.attachedTo.map(b=>n.jsxs("span",{className:"flex items-center gap-0.5 rounded bg-muted py-0.5 pr-0.5 pl-1.5 font-mono text-[10px]",children:[b,n.jsx("button",{onClick:()=>p(b,!1),disabled:f,"aria-label":`Detach from ${b}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-2.5"})})]},b)),!e.attachedTo.length&&n.jsx("span",{className:"text-muted-foreground/70",children:"no sandbox"}),m.length>0&&n.jsxs(pn,{value:"",disabled:f,onChange:b=>b.target.value&&p(b.target.value,!0),"aria-label":"Attach to a sandbox",className:"ml-auto h-7 rounded-md border border-input bg-transparent px-1.5 text-[11px] text-muted-foreground",children:[n.jsx("option",{value:"",children:"Attach to…"}),m.map(b=>n.jsx("option",{value:b.name,children:b.name},b.id))]}),f&&n.jsx(Nt,{className:"size-3"})]})]})}const mp=[],pp=[{id:"name",label:"Secret",width:"22%"},{id:"source",label:"Source",width:"10%"},{id:"service",label:"Service",width:"14%"},{id:"credentials",label:"Credentials",width:"12%"},{id:"attached",label:"Sandboxes",width:"14%"},{id:"expiry",label:"Next expiry",width:"12%"},{id:"hosts",label:"Allowed hosts",width:"12%"}],mee={none:"No expiry",expired:"Expired",expiring:"Within 7 days",scheduled:"Scheduled"};function pee(){const e=Uu(["secrets"]);return n.jsx(WD,{model:e})}function gee({combined:e}){const t=gn();return e?n.jsx(pee,{}):n.jsx(WD,{},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function WD({model:e}){const t=Pt(),r=gn(),a=oi(),[i,c]=x.useState(null),u=e?e.loading&&!e.sources.length||e.status.unavailable?null:{providers:mp,profiles:mp,sources:e.sources}:i,[f,h]=x.useState(null),m=e?e.status.unavailable:f&&!u,[p,g]=x.useState(!1),[b,v]=x.useState(!1),[w,C]=x.useState(null),[S,N]=x.useState(null),[E,k]=x.useState(null),[A,M]=x.useState(""),[R,T]=x.useState("all"),[O,D]=x.useState(""),[B,F]=x.useState(""),[K,$]=x.useState({key:"name",direction:"asc"}),[P,U]=x.useState(Date.now),H=x.useRef(null),W=x.useDeferredValue(A),q=x.useCallback(async()=>{g(!0);try{const Q=e?await e.refresh():await t.secrets();return e||c(Q),h(null),Q}catch(Q){return h(Q.message),null}finally{g(!1)}},[t,e==null?void 0:e.refresh]);x.useEffect(()=>{q()},[q]),x.useEffect(()=>{const Q=setInterval(()=>U(Date.now()),6e4),ie=oe=>{var pe;(oe.metaKey||oe.ctrlKey)&&oe.key.toLowerCase()==="k"&&!E&&!b&&!w&&!S&&(oe.preventDefault(),(pe=H.current)==null||pe.focus())};return window.addEventListener("keydown",ie),()=>{clearInterval(Q),window.removeEventListener("keydown",ie)}},[E,b,w,S]);const Z=(u==null?void 0:u.providers)??mp,z=(u==null?void 0:u.profiles)??mp,L=x.useMemo(()=>e?e.sources.flatMap(Q=>{var ie,oe,pe,xe;return NR(((oe=(ie=Q.data)==null?void 0:ie.secrets)==null?void 0:oe.providers)??[],((xe=(pe=Q.data)==null?void 0:pe.secrets)==null?void 0:xe.profiles)??[],P).map(je=>({...je,secret:{...je.secret,location:Q.location}}))}):NR(Z,z,P),[Z,z,P,e==null?void 0:e.sources]),X=x.useMemo(()=>eee(L,{query:W,scope:R,service:O,expiry:B,sort:K}),[L,W,R,O,B,K]),ee=x.useMemo(()=>{const Q=new Map(L.map(ie=>[ie.secret.type,ie.service]));return O&&!Q.has(O)&&Q.set(O,O),[...Q.entries()].sort((ie,oe)=>ie[1].localeCompare(oe[1]))},[L,O]),_=_x({count:X.length,rowHeight:40});x.useEffect(()=>{_.scrollToTop()},[W,R,O,B,K]);const V=L.find(Q=>ht(Q.secret)===E),G=(e?e.inventory.sandboxes:a.sandboxes??[]).filter(Q=>Q.phase!=="deleting"),Y=L.filter(Q=>Q.secret.attachedTo.length>0).length,ne=L.filter(Q=>Q.status==="expiring").length,te=L.filter(Q=>Q.status==="expired").length,ye=A||R!=="all"||O||B,ae=()=>{M(""),T("all"),D(""),F("")},ue=()=>{q(),a.refresh()},se="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground";return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-4 pt-4 pb-3 sm:px-6",role:"group","aria-label":"Secret inventory summary",children:[[["all","Secrets",L.length],["attached","Attached",Y],["unattached","Unattached",L.length-Y]].map(([Q,ie,oe])=>n.jsxs("button",{"aria-pressed":R===Q,onClick:()=>T(Q),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${R===Q?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ie}),n.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:n.jsx(Af,{value:oe})})]},Q)),n.jsx("div",{className:"ml-auto flex gap-1",children:[["expiring","Expiring in 7 days",ne],["expired","Expired",te]].map(([Q,ie,oe])=>n.jsxs("button",{"aria-pressed":B===Q,onClick:()=>F(B===Q?"":Q),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${B===Q?"bg-accent/70":"hover:bg-muted/60"}`,children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ie}),n.jsx("span",{className:`mt-1 block font-mono text-lg leading-none tabular-nums ${oe?Q==="expired"?"text-red-600":"text-amber-700":"text-muted-foreground"}`,children:n.jsx(Af,{value:oe})})]},Q))})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[n.jsx(yo,{ref:H,value:A,onValueChange:M,placeholder:"Search name, sandbox, host…","aria-label":"Search secrets",className:"mr-auto w-full sm:w-72"}),n.jsxs(pn,{"aria-label":"Filter by service",value:O,onChange:Q=>D(Q.target.value),className:"h-8 max-w-44 rounded-md border border-border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"All services"}),ee.map(([Q,ie])=>n.jsx("option",{value:Q,children:ie},Q))]}),n.jsxs(pn,{"aria-label":"Filter by expiry",value:B,onChange:Q=>F(Q.target.value),className:"h-8 rounded-md border border-border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"Any expiry"}),Object.entries(mee).map(([Q,ie])=>n.jsx("option",{value:Q,children:ie},Q))]}),ye&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:ae,children:[n.jsx(Pn,{}),"Clear"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh secrets",disabled:p,onClick:ue,children:n.jsx(rl,{className:p?"animate-spin":""})}),n.jsxs(le,{size:"sm",disabled:!u,onClick:()=>v(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{}),"Add secret"]})]}),f&&n.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-border px-6 py-2 text-xs text-red-600",children:[n.jsxs("span",{children:[u?"Could not refresh. Showing the last reading. ":"",f]}),n.jsx(le,{variant:"outline",size:"sm",onClick:q,children:"Retry"})]}),e&&n.jsx(Mu,{model:e,what:"secrets"}),n.jsx("div",{ref:_.ref,onScroll:_.onScroll,tabIndex:0,role:"region","aria-label":"Secret inventory",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:!u&&!m?n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading secrets…"}):X.length?n.jsxs("table",{"aria-label":"Secrets","aria-rowcount":X.length+1,className:"w-full min-w-[900px] table-fixed border-separate border-spacing-0 text-xs",children:[n.jsx("colgroup",{children:pp.map(Q=>n.jsx("col",{style:{width:Q.width}},Q.id))}),n.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:n.jsx("tr",{"aria-rowindex":1,children:pp.map(Q=>n.jsx("th",{scope:"col","aria-sort":K.key===Q.id?K.direction==="asc"?"ascending":"descending":"none",className:"h-9 border-b border-border px-4 text-left font-medium text-muted-foreground first:pl-6",children:["hosts","source"].includes(Q.id)?Q.label:n.jsxs("button",{className:"flex h-9 w-full items-center gap-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>$({key:Q.id,direction:K.key===Q.id&&K.direction==="asc"?"desc":"asc"}),children:[Q.label,K.key===Q.id&&(K.direction==="asc"?n.jsx(_f,{className:"size-3"}):n.jsx(Pf,{className:"size-3"}))]})},Q.id))})}),n.jsxs("tbody",{children:[_.paddingTop>0&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:pp.length,style:{height:_.paddingTop,padding:0}})}),X.slice(_.start,_.end).map((Q,ie)=>{var oe;return n.jsxs("tr",{"aria-rowindex":_.start+ie+2,onClick:()=>{var pe;((pe=Q.secret.location)==null?void 0:pe.connected)!==!1&&k(ht(Q.secret))},className:"group cursor-pointer bg-card hover:bg-muted/60 focus-within:bg-muted/60",children:[n.jsx("td",{className:`${se} pl-6`,children:n.jsxs("button",{disabled:((oe=Q.secret.location)==null?void 0:oe.connected)===!1,"aria-haspopup":"dialog","aria-label":`Open ${Q.secret.name}`,className:"flex h-9 w-full items-center gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:pe=>{pe.stopPropagation(),k(ht(Q.secret))},children:[n.jsx(Lx,{type:Q.secret.type,size:"sm"}),n.jsx("span",{title:Q.secret.name,className:"truncate font-medium text-foreground",children:Q.secret.name}),n.jsx(Zi,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),n.jsx("td",{className:se,children:n.jsx(Hs,{location:Q.secret.location??r})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate",title:Q.service,children:Q.service})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"font-mono text-[11px]",children:Q.secret.credentialKeys.length||"Access only"})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate",title:Q.secret.attachedTo.slice(0,10).join(", "),children:Q.secret.attachedTo.length===1?Q.secret.attachedTo[0]:Q.secret.attachedTo.length?`${Q.secret.attachedTo.length.toLocaleString()} sandboxes`:"Unattached"})}),n.jsx("td",{className:se,children:n.jsxs("span",{className:Q.status==="expired"?"text-red-600":Q.status==="expiring"?"text-amber-700":"",title:Q.expiry?new Date(Q.expiry).toLocaleString():void 0,children:[Q.status==="expired"?"Expired · ":"",Q.expiry?new Date(Q.expiry).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"No expiry"]})}),n.jsx("td",{className:se,children:n.jsx("span",{className:"block truncate font-mono text-[11px]",title:Q.hosts.join(", "),children:Q.hosts.length===1?Q.hosts[0]:Q.hosts.length?`${Q.hosts.length} hosts`:"-"})})]},ht(Q.secret))}),_.end<X.length&&n.jsx("tr",{"aria-hidden":"true",children:n.jsx("td",{colSpan:pp.length,style:{height:(X.length-_.end)*40,padding:0}})})]})]}):n.jsxs("div",{className:"py-20 text-center",children:[n.jsx(zu,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),n.jsx("p",{className:"text-sm",children:m?"Secrets unavailable":L.length?"No matching secrets":"No secrets yet"}),u&&(L.length>0||!(e!=null&&e.status.any))&&n.jsx(le,{variant:"outline",className:"mt-4",onClick:L.length?ae:()=>v(!0),children:L.length?"Clear filters":"Add secret"})]})}),n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[n.jsx("strong",{className:"font-medium text-foreground",children:X.length.toLocaleString()}),ye?` of ${L.length.toLocaleString()}`:""," secrets"]}),n.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),n.jsx(Lo,{open:!!V,onOpenChange:Q=>{Q||k(null)},children:n.jsxs(la,{className:"w-full gap-0 sm:max-w-lg","aria-describedby":"secret-description",children:[n.jsxs(ca,{className:"border-b border-border px-4 py-4 pr-12",children:[n.jsx(ua,{children:"Secret details"}),n.jsx(da,{id:"secret-description",className:"text-xs",children:"Manage credentials, expiry, and sandbox access."})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:V&&n.jsx(Zn,{location:V.secret.location??r,children:n.jsx(hee,{secret:V.secret,profile:V.profile,sandboxes:G.filter(Q=>{var ie,oe;return!e||((ie=Q.location)==null?void 0:ie.id)===((oe=V.secret.location)==null?void 0:oe.id)}),onRotate:()=>C(V.secret),onDelete:()=>N(V.secret),onDone:ue},ht(V.secret))})})]})}),!e&&n.jsx(XD,{open:b,onOpenChange:v,profiles:z,providers:Z,sandboxes:G,reload:async()=>{const Q=await q();return a.refresh(),Q}}),e&&b&&n.jsx(Dx,{onClose:()=>v(!1),children:(Q,ie)=>n.jsx(xee,{model:e,location:Q,onClose:ie})}),n.jsx(Zn,{location:(w==null?void 0:w.location)??r,children:n.jsx(dee,{secret:w,onClose:()=>C(null),onDone:ue})}),n.jsx(Fr,{open:!!S,onOpenChange:Q=>{Q||N(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:["Delete ",S==null?void 0:S.name,"?"]}),n.jsx(Xr,{children:S!=null&&S.attachedTo.length?`Detach from ${S.attachedTo.join(", ")} first.`:"This cannot be undone."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",disabled:!!(S!=null&&S.attachedTo.length),onClick:async()=>{try{await(e?e.apiFor(S.location):t).deleteSecret(S.name),He.success(`Deleted ${S.name}`),ue()}catch(Q){He.error(Q.message)}finally{N(null)}},children:"Delete"})]})]})})]})}function xee({model:e,location:t,onClose:r}){const a=Pt(),[i,c]=x.useState(null),[u,f]=x.useState(null);return x.useEffect(()=>{let h=!0;return a.secrets().then(m=>{h&&c(m)}).catch(m=>{h&&f(m.message)}),()=>{h=!1}},[a]),i?n.jsx(XD,{open:!0,onOpenChange:h=>{h||r()},profiles:(i==null?void 0:i.profiles)??[],providers:(i==null?void 0:i.providers)??[],sandboxes:e.inventory.sandboxes.filter(h=>h.location.id===t.id),reload:async()=>{const h=await a.secrets();return e.refresh(),h}}):n.jsx(tn,{open:!0,onOpenChange:h=>{h||r()},children:n.jsx(nn,{children:n.jsxs(sn,{children:[n.jsx(Qt,{children:"Add secret"}),n.jsx(Sn,{children:u||"Loading credentials…"})]})})})}async function bee(e,t,r,a={}){var u,f,h;const i=await RD(e,t.setups||[],null,{...a,expectedRevisions:t.setupRevisions});if((u=a.signal)!=null&&u.aborted)throw new DOMException("Preparation cancelled.","AbortError");const c=na({...t,setups:i.setups.map(m=>m.id),setupRevisions:Object.fromEntries(i.setups.map(m=>[m.id,m.revision]))});return(f=a.onPrepared)==null||f.call(a),(h=a.onProgress)==null||h.call(a,"Starting image build…"),e.buildImageTemplate(c,r)}const vee="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",QD=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Ws.find(t=>t.id===e)).filter(Boolean),CR=Ws.filter(e=>!QD.includes(e)),kR={runtimes:"runtimes",repository:"repository",customAgents:"custom",base:"system",packages:"system",setup:"system",environment:"environment"};function nf({label:e,hint:t,htmlFor:r,children:a}){return n.jsxs("div",{className:"grid content-start gap-1.5",children:[n.jsx(zn,{htmlFor:r,className:"text-xs",children:e}),a,t&&n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:t})]})}function TR({type:e="checkbox",name:t,checked:r,onChange:a,disabled:i,children:c}){return n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:e,name:t,checked:r,onChange:a,disabled:i,className:"peer sr-only"}),n.jsx("span",{className:"flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-2 text-xs transition-all hover:-translate-y-px hover:bg-muted/50 hover:shadow-sm motion-reduce:hover:translate-y-0 @3xl:min-h-14 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:c})]})}function yee(e){const t=gn();return n.jsx(wee,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function wee({initial:e,draftKey:t,onClose:r,onStarted:a,onChangeLocation:i,sourceControl:c}){var xe,je,Ie;const u=Pt(),f=gn(),h=Zs(),[m,p]=x.useState(()=>na(e==null?void 0:e.recipe)),g=!!(e!=null&&e.replace),[b]=x.useState(()=>(e==null?void 0:e.baseline)??JSON.stringify(na(e==null?void 0:e.recipe))),[v,w]=x.useState(()=>new Set(Array.isArray(e==null?void 0:e.advanced)?e.advanced:e!=null&&e.advanced?["system","environment"]:na(e==null?void 0:e.recipe).customAgents.length?["custom"]:[])),C=ce=>({open:v.has(ce),onToggle:Te=>{const re=Te.currentTarget.open;w(fe=>re===fe.has(ce)?fe:new Set(re?[...fe,ce]:[...fe].filter(Re=>Re!==ce)))}}),[S,N]=x.useState(()=>!bg.some(ce=>ce.id===na(e==null?void 0:e.recipe).command)),[E,k]=x.useState(""),[A,M]=x.useState(!1),[R,T]=x.useState(!1),[O,D]=x.useState(""),B=x.useRef(null);x.useEffect(()=>()=>{var ce;return(ce=B.current)==null?void 0:ce.abort()},[]);const[F,K]=x.useState(null),[$,P]=x.useState(!1),[U,H]=x.useState(!1),W=m.source==="build",q=ce=>{Ax({...m,...ce})&&N(!1),p(Te=>na({...Te,...ce,...ce.setups?{setupRevisions:Object.fromEntries(Object.entries(Te.setupRevisions||{}).filter(([re])=>ce.setups.includes(re)))}:{}}))},Z=JSON.stringify(m)!==b,z=ZY(m);x.useEffect(()=>{try{sessionStorage.setItem(t,JSON.stringify({recipe:m,replace:g,baseline:b,advanced:[...v]}))}catch{}},[t,m,g,b,v]);const L=zp(f),[X,ee]=x.useState({loading:L,value:null,error:""}),[_,V]=x.useState(0),[G]=x.useState(()=>na(e==null?void 0:e.recipe).setups);x.useEffect(()=>{if(!L)return;let ce=!0;return ee({loading:!0,value:null,error:""}),u.syncLocalCatalog().then(Te=>{ce&&ee({loading:!1,value:Te,error:""})}).catch(Te=>{ce&&ee({loading:!1,value:null,error:Te.message})}),()=>{ce=!1}},[u,L,_]),x.useEffect(()=>{let ce=!0;return u.localImages().then(Te=>{ce&&K(Te)}).catch(Te=>{ce&&K({images:[],error:Te.message})}),()=>{ce=!1}},[u]),x.useEffect(()=>{const ce=Te=>{Z&&(Te.preventDefault(),Te.returnValue="")};return window.addEventListener("beforeunload",ce),()=>window.removeEventListener("beforeunload",ce)},[Z]);function Y(ce){var fe;const Te=m.agents.includes(ce)?m.agents.filter(Re=>Re!==ce):Ws.filter(Re=>Re.id===ce||m.agents.includes(Re.id)).map(Re=>Re.id),re=!S&&(m.command===""?m.agents.length===0:Ws.some(Re=>Re.command===m.command));Te.length>1&&N(!1),q({agents:Te,...re?{command:((fe=Ws.find(Re=>Re.id===Te[0]))==null?void 0:fe.command)??""}:{}})}const ne=ce=>q({runtimes:m.runtimes.includes(ce)?m.runtimes.filter(Te=>Te!==ce):[...m.runtimes,ce]}),te=[S1(m).some(ce=>ce.npm)&&!m.runtimes.includes("node")&&"Node.js 22",S1(m).some(ce=>ce.python)&&!m.runtimes.includes("python")&&"Python 3"].filter(Boolean),ye=bg.filter(ce=>{var Te;return!W||ce.id===""||m.agents.includes((Te=Ws.find(re=>re.command===ce.id))==null?void 0:Te.id)}),ae=[...N1.filter(ce=>m.runtimes.includes(ce.id)).map(ce=>ce.name),...te].join(", "),ue=[(xe=xg.find(ce=>ce.id===m.base))==null?void 0:xe.name,`${m.packages.length} ${m.packages.length===1?"package":"packages"}`,m.setup.trim()&&"setup commands"].filter(Boolean).join(" · "),se=m.environment.length?`${m.environment.length} ${m.environment.length===1?"variable":"variables"}`:"";async function Q(ce){ce.preventDefault();const Te=Object.entries(z)[0]??(S&&!m.command.trim()?["command","Enter a start command, or pick one of the options."]:null);if(Te){kR[Te[0]]&&w(fe=>new Set([...fe,kR[Te[0]]])),k(Te[1]);return}if(A||(f==null?void 0:f.connected)===!1)return;M(!0),T(!0),k(""),D("");const re=new AbortController;B.current=re;try{const fe=await bee(u,m,g,{signal:re.signal,onProgress:D,onPrepared:()=>T(!1)});en.templateStarted(fe,f),a(fe)}catch(fe){fe.name!=="AbortError"&&k(fe.message)}finally{M(!1),T(!1),D(""),B.current=null}}function ie(){const ce=URL.createObjectURL(new Blob([C1(m)],{type:"text/plain"})),Te=document.createElement("a");Te.href=ce,Te.download="Dockerfile",Te.click(),URL.revokeObjectURL(ce)}function oe(){A||(Z?H(!0):r())}const pe=(ce=0)=>({initial:h?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:ce,ease:[.22,1,.36,1]}});return n.jsx(tn,{open:!0,onOpenChange:ce=>{ce||oe()},children:n.jsx(nn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:n.jsxs("form",{onSubmit:Q,className:"@container flex max-h-[90svh] min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-popover ring-1 ring-foreground/10",children:[n.jsxs(nh,{value:m.source,onValueChange:ce=>{q({source:ce}),ce==="build"&&m.agents.length>1&&N(!1),k("")},className:"contents",children:[n.jsxs(sn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[i&&n.jsx("div",{className:"pr-8",children:n.jsx($w,{step:2,subject:"template"})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[n.jsx(Qt,{className:"truncate",children:g?`Edit ${m.name}`:"New template"}),i?n.jsx(j4,{location:f,onChange:i}):n.jsx(ga,{location:f}),n.jsxs(sh,{className:"ml-auto w-fit","aria-label":"Template image source",children:[n.jsx(Pr,{value:"build",className:"px-3 text-xs",children:"Build an image"}),n.jsx(Pr,{value:"image",className:"px-3 text-xs",children:"Existing image"})]})]}),n.jsx(Sn,{className:"text-xs",children:W?"Built on the console’s Docker engine. For an SSH host, the image is built for its architecture and transferred before the template is saved.":"Boots an image you already have, as is."}),n.jsx("fieldset",{disabled:A||JSON.stringify(m)!==JSON.stringify(na(e==null?void 0:e.recipe)),children:c}),(f==null?void 0:f.connected)===!1&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to save a template."})]}),n.jsx("div",{className:"grid min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border @3xl:grid-cols-[minmax(0,1fr)_19rem] @3xl:overflow-hidden",children:n.jsxs("fieldset",{disabled:A||(f==null?void 0:f.connected)===!1,className:"contents",children:[n.jsxs(In.div,{...pe(),className:"grid min-w-0 content-start gap-6 p-5 @3xl:overflow-y-auto @3xl:p-7",children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:"template-name",className:"text-xs",children:"Name"}),n.jsx(Ot,{id:"template-name",value:m.name,disabled:g,maxLength:19,onChange:ce=>q({name:ce.target.value.toLowerCase()}),placeholder:"frontend-app",className:"h-10 font-mono text-sm",autoFocus:!g,"aria-invalid":E&&z.name&&m.name?!0:void 0}),m.name&&z.name&&n.jsx("p",{className:"text-[11px] text-destructive",children:z.name})]}),W?n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),n.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:QD.map(ce=>n.jsxs(TR,{checked:m.agents.includes(ce.id),onChange:()=>Y(ce.id),children:[n.jsx("img",{src:ce.logo,alt:"",className:"size-4 shrink-0 object-contain"}),n.jsx("span",{className:"min-w-0 flex-1",children:ce.name}),m.agents.includes(ce.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},ce.id))}),n.jsxs(Fi,{children:[n.jsxs(Gi,{render:n.jsx(le,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[n.jsx("span",{className:"truncate",children:CR.filter(ce=>m.agents.includes(ce.id)).map(ce=>ce.name).join(", ")||"More agents"}),n.jsx(ha,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),n.jsx(qi,{align:"start",children:CR.map(ce=>n.jsxs(Fw,{checked:m.agents.includes(ce.id),onCheckedChange:()=>Y(ce.id),closeOnClick:!1,className:"text-xs",children:[n.jsx("img",{src:ce.logo,alt:"",className:"size-4 shrink-0 object-contain"}),ce.name]},ce.id))})]})]}):n.jsxs(nf,{label:"Image",htmlFor:"template-image",hint:F!=null&&F.error?F.error:"An image on the selected Docker engine, or a registry reference Docker is signed in to.",children:[n.jsx(Ot,{id:"template-image",value:m.image,onChange:ce=>q({image:ce.target.value.trim()}),placeholder:"ghcr.io/your-team/workspace:latest",className:"font-mono text-xs"}),((je=F==null?void 0:F.images)==null?void 0:je.length)>0&&n.jsxs(pn,{"aria-label":"Choose an available image",value:F.images.some(ce=>ce.reference===m.image)?m.image:"",onChange:ce=>q({image:ce.target.value}),className:"w-full text-xs",children:[n.jsx("option",{value:"",disabled:!0,children:"Choose an available image"}),F.images.map(ce=>n.jsx("option",{value:ce.reference,children:ce.reference},ce.reference))]})]}),n.jsx(jee,{starts:ye,recipe:m,custom:S,setCustom:N,patch:q}),E&&n.jsx("p",{role:"alert",className:"whitespace-pre-wrap rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:E})]}),n.jsxs(In.aside,{...pe(.06),className:"grid min-w-0 content-start gap-6 border-t border-border bg-muted/25 p-5 @3xl:overflow-y-auto @3xl:border-t-0 @3xl:border-l @3xl:p-6",children:[X.loading&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local MCPs & Skills…"}),((Ie=X.value)==null?void 0:Ie.available)&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local MCPs & Skills are available here. Existing remote templates keep their settings."}),X.error&&n.jsxs("div",{className:"grid gap-2",children:[n.jsxs("p",{role:"alert",className:"text-xs text-destructive",children:["Could not load your local MCPs & Skills: ",X.error]}),n.jsx(le,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>V(ce=>ce+1),children:"Retry"})]}),!X.loading&&n.jsx(pD,{localCatalog:X.value,retained:G,autoPrepare:!0,preparationContext:"template",value:m.setups,onChange:ce=>q({setups:ce})}),n.jsxs("div",{className:"grid min-w-0",children:[W&&n.jsxs(Kl,{title:"Runtimes and tools",summary:ae,...C("runtimes"),children:[n.jsx("div",{className:"grid gap-2",children:N1.filter(ce=>!ce.retired||m.runtimes.includes(ce.id)).map(ce=>n.jsxs(TR,{checked:m.runtimes.includes(ce.id),onChange:()=>ne(ce.id),children:[n.jsx("img",{src:ce.logo,alt:"",className:`size-4 shrink-0 object-contain ${ce.id==="vscode"?"dark:invert":""}`}),n.jsx("span",{className:"min-w-0 flex-1",children:ce.name}),m.runtimes.includes(ce.id)&&n.jsx(Yn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},ce.id))}),te.length>0&&n.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:[te.join(" and ")," ",te.length>1?"are":"is"," included for the selected agents."]})]}),W&&n.jsx(Kl,{title:"Repository",summary:m.repository,...C("repository"),children:n.jsx(nf,{htmlFor:"template-repository",label:"Clone at build time",hint:"A public HTTPS repository, cloned into /sandbox/project. Private repositories can be cloned after launch.",children:n.jsx(Ot,{id:"template-repository",value:m.repository,onChange:ce=>q({repository:ce.target.value.trim()}),placeholder:"https://github.com/your-team/project.git",className:"font-mono text-xs"})})}),W&&n.jsx(Kl,{title:"Custom agent",summary:m.customAgents.length?"Install command set":"",...C("custom"),children:n.jsx(Nee,{agents:m.customAgents,onChange:ce=>{ce.length>m.customAgents.length&&N(!1),q({customAgents:ce,...ce.length>m.customAgents.length?{command:""}:{}})},error:E?z.customAgents:void 0})}),W&&n.jsxs(Kl,{title:"System",summary:ue,...C("system"),children:[n.jsx(nf,{label:"Operating system",htmlFor:"template-base",children:n.jsx(pn,{id:"template-base",value:m.base,onChange:ce=>q({base:ce.target.value}),className:"w-full text-xs",children:xg.map(ce=>n.jsx("option",{value:ce.id,children:ce.name},ce.id))})}),n.jsx(See,{packages:m.packages,onChange:ce=>q({packages:ce})}),n.jsx(nf,{label:"Setup commands",htmlFor:"template-setup",hint:`Run with bash in ${m.repository?"/sandbox/project":"/sandbox"} as the sandbox user, at build time. A failing command stops the build.`,children:n.jsx(Hu,{id:"template-setup",value:m.setup,onChange:ce=>q({setup:ce.target.value}),rows:4,placeholder:m.runtimes.includes("python")?"pip install -r requirements.txt":"npm ci",className:"font-mono text-xs",spellCheck:!1})})]}),n.jsxs(Kl,{title:"Environment variables",summary:se,...C("environment"),children:[n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Non-secret values, stored with the template. Attach credentials through Secrets when you launch."}),m.environment.map((ce,Te)=>n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(Ot,{"aria-label":`Variable ${Te+1} name`,className:"min-w-0 flex-1 font-mono text-xs",value:ce.name,onChange:re=>q({environment:m.environment.map((fe,Re)=>Te===Re?{...fe,name:re.target.value}:fe)}),placeholder:"NODE_ENV"}),n.jsx(Ot,{"aria-label":`Variable ${Te+1} value`,className:"min-w-0 flex-1 font-mono text-xs",value:ce.value,onChange:re=>q({environment:m.environment.map((fe,Re)=>Te===Re?{...fe,value:re.target.value}:fe)}),placeholder:"development"}),n.jsx(le,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove variable ${Te+1}`,onClick:()=>q({environment:m.environment.filter((re,fe)=>fe!==Te)}),children:n.jsx(ts,{})})]},Te)),n.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:m.environment.length>=40,onClick:()=>q({environment:[...m.environment,{name:"",value:""}]}),children:[n.jsx(ys,{}),"Add variable"]})]})]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Software only. Network, file and credential access come from the groups and policies you pick at launch, plus the selected agents’ own sign-in and model destinations."})]})]})}),(O||g)&&n.jsx("p",{role:O?"status":void 0,className:"flex shrink-0 items-center gap-1.5 border-t border-border px-5 py-3 text-[11px] text-muted-foreground @3xl:px-7",children:O||n.jsxs(n.Fragment,{children:[n.jsx(Du,{className:"size-3.5 shrink-0","aria-hidden":"true"}),W?"Rebuilding replaces this template.":"Saving replaces this template."," Sandboxes already running from it keep their current image."]})}),n.jsxs(Hr,{className:"mx-0 mb-0 shrink-0 items-center rounded-none border-t border-border bg-popover px-5 py-4 @3xl:px-7",children:[W&&n.jsxs(le,{type:"button",variant:"ghost",className:"sm:mr-auto",onClick:()=>P(!0),children:[n.jsx(IA,{}),"View Dockerfile"]}),n.jsx(le,{type:"button",variant:"ghost",disabled:A&&!R,onClick:()=>{var ce;return R?(ce=B.current)==null?void 0:ce.abort():oe()},children:R?"Cancel preparation":"Cancel"}),n.jsxs(le,{type:"submit",className:vee,disabled:A||(f==null?void 0:f.connected)===!1,children:[A?n.jsx(Nt,{}):n.jsx(t2,{}),R?"Preparing MCPs…":W?g?"Rebuild template":"Build template":"Save template"]})]})]}),n.jsx(tn,{open:$,onOpenChange:P,children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Generated Dockerfile"}),n.jsx(Sn,{children:"Setup commands are added as a separate build-context file."})]}),n.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/30 p-4 font-mono text-[11px] leading-relaxed",children:W?C1(m):""}),n.jsxs(le,{type:"button",variant:"outline",onClick:ie,children:[n.jsx(pu,{}),"Download Dockerfile"]})]})}),n.jsx(tn,{open:U,onOpenChange:H,children:n.jsxs(nn,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{children:"Discard this template?"}),n.jsx(Sn,{children:"Your changes haven’t been built yet."})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",onClick:()=>H(!1),children:"Keep editing"}),n.jsx(le,{type:"button",variant:"destructive",onClick:r,children:"Discard"})]})]})})]})})})}function jee({starts:e,recipe:t,custom:r,setCustom:a,patch:i}){const c=Ax(t),u=[...c?bg.filter(h=>h.id===""):e].sort((h,m)=>(h.id===""?-1:0)-(m.id===""?-1:0)),f=(h,m,p,g,b)=>n.jsxs("label",{className:"relative min-w-0",children:[n.jsx("input",{type:"radio",name:"template-open-in",checked:h,disabled:c,onChange:g,className:"peer sr-only"}),n.jsxs("span",{className:"flex min-h-16 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-3 text-xs transition-colors hover:bg-muted/50 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-80",children:[m,n.jsx("span",{className:"min-w-0 flex-1 font-medium",children:p}),n.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${h?"border-foreground":"border-muted-foreground/40"}`,children:h&&n.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},b);return n.jsxs("fieldset",{className:"min-w-0",children:[n.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:[u.map(h=>{const m=Ws.find(p=>p.command===h.id);return f(c||!r&&t.command===h.id,m?n.jsx("img",{src:m.logo,alt:"",className:"size-5 shrink-0 object-contain"}):n.jsx(r2,{"aria-hidden":"true",className:"size-5 shrink-0"}),h.name,()=>{a(!1),i({command:h.id})},h.id||"shell")}),!c&&f(r,n.jsx(IA,{"aria-hidden":"true",className:"size-5 shrink-0"}),"Custom command",()=>{r||(a(!0),i({command:""}))},"custom")]}),!c&&r&&n.jsx(Ot,{"aria-label":"Start command",value:t.command,onChange:h=>i({command:h.target.value}),placeholder:"npm run dev",className:"mt-2 font-mono text-xs"}),n.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:c?"Multiple agents are installed. Start in Shell to run any of them.":r?"Runs through /bin/bash as the sandbox’s main process.":"Opens as a session you connect to. Exiting it keeps the sandbox running."})]})}function See({packages:e,onChange:t}){const[r,a]=x.useState(""),i=x.useRef(null);function c(){const u=lE(r);u.length&&t([...new Set([...e,...u])]),a("")}return n.jsx(nf,{label:"System packages",htmlFor:"template-packages",hint:"Press Enter to add. Paste several separated by spaces, commas or new lines.",children:n.jsxs("div",{className:"rounded-lg border bg-background p-2",children:[e.length>0&&n.jsx("ul",{"aria-label":"System packages",className:"mb-3 flex flex-wrap gap-1.5",children:e.map(u=>n.jsxs("li",{className:"inline-flex max-w-full items-center gap-1 rounded-md border bg-muted/40 py-1 pl-2 pr-1",children:[n.jsx("span",{className:"min-w-0 break-all font-mono text-[11px]",children:u}),n.jsx("button",{type:"button","aria-label":`Remove package ${u}`,onClick:()=>t(e.filter(f=>f!==u)),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(Pn,{className:"size-3"})})]},u))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ot,{ref:i,id:"template-packages",value:r,onChange:u=>a(u.target.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&!u.nativeEvent.isComposing&&(u.preventDefault(),c())},onPaste:u=>{const f=u.clipboardData.getData("text");if(/[\s,]/.test(f)){u.preventDefault();const h=u.currentTarget,m=r.slice(0,h.selectionStart)+f+r.slice(h.selectionEnd);t([...new Set([...e,...lE(m)])]),a("")}},placeholder:"jq, unzip…",className:"min-w-0 flex-1 font-mono text-xs",autoComplete:"off",spellCheck:!1}),n.jsxs(le,{type:"button",variant:"outline",size:"sm",onClick:()=>{var u;c(),(u=i.current)==null||u.focus()},children:[n.jsx(ys,{}),"Add"]})]})]})})}function Nee({agents:e,onChange:t,error:r}){return n.jsxs("div",{className:"space-y-2",children:[n.jsx(zn,{htmlFor:"custom-agent-install",className:"text-xs",children:"Install command"}),n.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-background px-3 py-1 focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",children:[n.jsx(r2,{"aria-hidden":"true",className:"mt-2 size-3.5 shrink-0 text-muted-foreground"}),n.jsx(Hu,{id:"custom-agent-install",value:e.map(a=>a.install).join(`
|
|
529
|
+
`),onChange:a=>t(a.target.value.trim()?[{name:"Custom agent",install:a.target.value}]:[]),rows:1,maxLength:6e3,spellCheck:!1,autoComplete:"off",placeholder:"Paste an agent install command…",className:"min-h-8 resize-none rounded-none border-0 bg-transparent px-0 py-1.5 font-mono text-xs leading-5 focus-visible:ring-0 md:text-xs","aria-invalid":!!r})]}),r&&n.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:r})]})}const or=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),ER="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",io=e=>e.status==="building",gp=e=>e.status==="ready"||e.exists,Cee=e=>io(e)?e.exists?"Rebuilding":"Building":e.status==="failed"?e.exists?"Rebuild failed":"Build failed":"Ready";function RR({record:e}){var t;return((t=e.location)==null?void 0:t.connected)===!1?n.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/50"}),"Offline"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px]",children:[io(e)?n.jsx(Nt,{className:"size-3 text-amber-600"}):n.jsx("span",{className:`size-1.5 rounded-full ${e.status==="failed"?"bg-amber-500":"bg-emerald-500"}`}),Cee(e)]})}const AR=e=>{var t;return((t=bg.find(r=>r.id===e))==null?void 0:t.name)??e};function kee(){var Ie,ce,Te;const e=Pt(),t=ds(),{templates:r,locations:a,error:i,refresh:c,loading:u}=vo(),[f,h]=x.useState(""),[m,p]=x.useState(""),[g,b]=x.useState(null),[v,w]=x.useState(null),C=v?Jv(or(v.location)):null,[S,N]=x.useState(null),[E,k]=x.useState(!1),[A,M]=x.useState(null),R=x.useRef(!1),[T,O]=x.useState(null),[D,B]=x.useState(null),[F,K]=x.useState(!1),$=x.useRef(!1),[P,U]=x.useState(()=>new Set),[H,W]=x.useState([]);x.useEffect(()=>{let re=!0;return e.contextKey().then(fe=>{re&&b(JSON.stringify([e.target,fe]))}).catch(fe=>He.error(fe.message)),()=>{re=!1}},[e]),x.useEffect(()=>{if(R.current||!g)return;const re=a.find(Re=>or(Re)===g);if(!(re!=null&&re.connected))return;R.current=!0;const fe=cE(Jv(or(re)));fe&&w(Re=>Re??{...fe,location:re})},[g,a]);const q=r.find(re=>ht(re)===S),Z=re=>a.find(fe=>or(fe)===or(re.location))??re.location,z=a.length>1,L=re=>Z(re).connected!==!1,X=re=>{if(!L(re))throw new Error(`${Dn(Z(re))} is disconnected. Reconnect before continuing.`);return lr(t!=null&&t.localViewer?Z(re).target??"local":e.target,e.signal,re.location.context)},ee=mx(r,re=>X({location:re}),c),_=xf("templates",r),V=xf("templates",r.filter(re=>(!z||!m||or(re.location)===m)&&`${re.name} ${re.image||""} ${re.recipe.repository||""}`.toLowerCase().includes(f.toLowerCase()))),G=V.filter(re=>!io(re)&&L(re)),Y=r.filter(re=>P.has(ht(re))&&!io(re)&&L(re)),ne=G.filter(re=>P.has(ht(re))).length,te=G.length>0&&ne===G.length;x.useEffect(()=>{const re=new Set(r.filter(fe=>!io(fe)&&(a.find(Re=>or(Re)===or(fe.location))??fe.location).connected!==!1).map(ht));U(fe=>new Set([...fe].filter(Re=>re.has(Re))))},[r,a]);function ye(re){U(fe=>{const Re=new Set(fe);return Re.has(re)?Re.delete(re):Re.add(re),Re})}function ae(){U(re=>{const fe=new Set(re);for(const Re of G)te?fe.delete(ht(Re)):fe.add(ht(Re));return fe})}async function ue(re){const fe=[];for(const Re of re)try{const Oe=await X(Re).imageTemplateUsage(Re.name);Oe.sandboxes.length&&fe.push({target:Re,message:"This template cannot be deleted while sandboxes use it.",sandboxes:Oe.sandboxes})}catch(Oe){fe.push({target:Re,message:Oe.message})}W(fe)}async function se(re){if(!$.current){$.current=!0,K(!0),W([]),N(null),O(re);try{await ue(re)}finally{$.current=!1,K(!1)}}}async function Q(re,fe){if(!$.current){$.current=!0,K(!0);try{await X(re).lifecycle(fe,"delete"),He.success(`Deleted sandbox ${fe}`),await ue(T),await c()}catch(Re){He.error(Re.message)}finally{$.current=!1,K(!1)}}}async function ie(){if($.current||!(T!=null&&T.length))return;$.current=!0,K(!0),W([]);const re=new Set,fe=[],Re=new Map;try{for(const Oe of T)try{const ke=await X(Oe).deleteImageTemplate(Oe.name);re.add(ht(Oe));const he=ke==null?void 0:ke.imageCleanup,Ae=JSON.stringify([or(Oe.location),he==null?void 0:he.image]);(he==null?void 0:he.status)==="retained"?Re.set(Ae,{image:he.image,reason:he.reason,location:Z(Oe)}):he!=null&&he.image&&Re.delete(Ae)}catch(ke){fe.push({target:Oe,message:ke.message,sandboxes:ke.sandboxes})}for(const{image:Oe,reason:ke,location:he}of Re.values())He.warning(ke,{description:`${Dn(he)} · ${Oe}`,duration:1e4});U(Oe=>new Set([...Oe].filter(ke=>!re.has(ke)))),N(Oe=>re.has(Oe)?null:Oe),W(fe),re.size&&He.success(`Deleted ${re.size} ${re.size===1?"template":"templates"}`),O(fe.length?T.filter(Oe=>!re.has(ht(Oe))):null),await c()}finally{$.current=!1,K(!1)}}function oe(re,fe,Re){L(re)&&(N(null),w({recipe:fe,replace:Re,location:Z(re),record:re.copies?re:_.find(Oe=>Oe.copies.some(ke=>ht(ke)===ht(re)))?{...re,copies:_.find(Oe=>Oe.copies.some(ke=>ht(ke)===ht(re))).copies}:re}))}function pe(re){if(!(re!=null&&re.connected))return;const fe=cE(Jv(or(re)));w({...fe??{},location:re}),k(!1)}x.useEffect(()=>{if(!A)return;const re=a.find(Re=>Re.gateway===A&&Re.connected);if(re){M(null),pe(re);return}const fe=setInterval(c,1500);return()=>clearInterval(fe)},[A,a]);function xe(){try{sessionStorage.removeItem(C)}catch{}w(null)}async function je(re){try{await re(),await c()}catch(fe){He.error(fe.message)}}return n.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[ee.dialog,v&&n.jsx(Zn,{location:Z(v),children:n.jsx(hx,{record:v.record??{...v,name:(Ie=v.recipe)==null?void 0:Ie.name},type:"templates",offer:v.replace?ee.offer:()=>{},children:n.jsx(yee,{sourceControl:v.record&&n.jsx(wf,{record:v.record,onChange:re=>oe(re,re.recipe,!0)}),initial:v,draftKey:C,onClose:xe,onChangeLocation:v.replace?void 0:()=>{w(null),k(!0)},onStarted:re=>{N(ht({...re,location:v.location})),xe(),c()}},JSON.stringify([or(v.location),((ce=v.recipe)==null?void 0:ce.name)||"new"]))})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[n.jsx(yo,{"aria-label":"Search image templates",value:f,onValueChange:h,placeholder:"Search…",className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),z&&n.jsxs(pn,{"aria-label":"Filter template location",value:m,onChange:re=>p(re.target.value),className:"h-8 rounded-md border bg-card px-2 text-xs",children:[n.jsx("option",{value:"",children:"All locations"}),a.map(re=>n.jsxs("option",{value:or(re),children:[Dn(re),or(re)===g?" (default)":"",re.connected===!1?" · disconnected":""]},or(re)))]}),n.jsxs(le,{size:"sm",className:ER,onClick:()=>k(!0),children:[n.jsx(ys,{}),"New template"]})]}),Y.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b bg-accent/30 px-4 py-2 sm:px-6",children:[n.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[Y.length," selected",Y.length>ne&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",Y.length-ne," outside current filters"]})]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:F,onClick:()=>U(new Set),children:"Clear selection"}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:F,onClick:()=>se(Y),children:[n.jsx(ts,{}),"Delete selected"]})]}),i&&n.jsxs("div",{role:"alert",className:"px-4 py-4 text-xs sm:px-6",children:[n.jsx("p",{children:i}),n.jsx(le,{variant:"outline",size:"sm",className:"mt-3",onClick:c,children:"Try again"})]}),u&&!r.length?n.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-10 text-xs text-muted-foreground",children:[n.jsx(Nt,{}),"Loading…"]}):V.length?n.jsx(ho,{duration:.15,offset:0,blur:"0px",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{"aria-label":"Image templates",className:"w-full min-w-[580px] text-left",children:[n.jsx("thead",{className:"border-b text-[11px] text-muted-foreground",children:n.jsxs("tr",{children:[n.jsx("th",{className:"w-10 px-4 py-2 sm:pl-6",children:n.jsx($o,{"aria-label":"Select all matching templates",checked:te,indeterminate:ne>0&&!te,disabled:F||!G.length,onCheckedChange:ae})}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Name"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Source"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Starts in"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Image"}),n.jsx("th",{className:"px-4 py-2 font-normal",children:"Status"}),n.jsx("th",{className:"px-4 py-2",children:n.jsx("span",{className:"sr-only",children:"Actions"})})]})}),n.jsx("tbody",{className:"divide-y",children:V.map(re=>n.jsxs("tr",{className:P.has(ht(re))?"bg-accent/40 hover:bg-muted/40":"hover:bg-muted/40",children:[n.jsx("td",{className:"px-4 py-2 sm:pl-6",children:n.jsx($o,{"aria-label":`Select ${re.name} in ${Dn(Z(re))}`,checked:P.has(ht(re)),disabled:F||io(re)||!L(re),onCheckedChange:()=>ye(ht(re))})}),n.jsx("td",{className:"max-w-72 px-4 py-2",children:n.jsxs("button",{className:"group flex max-w-full items-center gap-2 rounded text-left font-mono text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>N(ht(re)),children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-muted/40 text-muted-foreground",children:n.jsx(PA,{className:"size-4",strokeWidth:1.5})}),n.jsx("span",{className:"truncate group-hover:underline",children:re.name})]})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(fx,{record:re})}),n.jsx("td",{className:"px-4 py-2 text-[11px] text-muted-foreground",children:re.managed===!1?"-":AR(re.recipe.command)}),n.jsx("td",{className:"px-4 py-2",children:n.jsx("span",{className:"block max-w-64 truncate font-mono text-[11px] text-muted-foreground",title:re.image||"",children:re.image||(re.recipe.source==="image"?re.recipe.image:"Not built yet")})}),n.jsx("td",{className:"px-4 py-2",children:n.jsx(RR,{record:re})}),n.jsx("td",{className:"px-4 py-2 text-right sm:pr-6",children:n.jsxs("div",{className:"flex items-center justify-end gap-1",children:[!io(re)&&(re.status==="failed"||re.status==="ready"&&re.managed)&&n.jsxs(le,{variant:"ghost",size:"xs",disabled:!L(re),"aria-label":`Edit ${re.name} in ${Dn(Z(re))}`,onClick:()=>oe(re,re.recipe,re.status==="ready"||!!re.exists),children:[n.jsx(_k,{}),"Edit"]}),n.jsxs(le,{variant:"ghost",size:"xs",disabled:gp(re)&&!L(re),onClick:()=>gp(re)?B(re):N(ht(re)),children:[gp(re)?"Use template":io(re)?"View progress":"Details",n.jsx(mu,{})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${re.name} in ${Dn(Z(re))}`,title:io(re)?"Cancel the build before deleting this template":`Delete ${re.name}`,disabled:F||io(re)||!L(re),onClick:()=>se([re]),children:n.jsx(ts,{})})]})})]},ht(re)))})]})})}):n.jsxs("div",{className:"py-12 text-center text-xs text-muted-foreground",children:[n.jsx("p",{children:r.length?"No matching templates.":"No image templates yet."}),f&&n.jsx(le,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>h(""),children:"Clear search"})]}),n.jsx(tn,{open:!!q,onOpenChange:re=>{re||N(null)},children:n.jsx(nn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:q&&n.jsxs(n.Fragment,{children:[n.jsxs(sn,{children:[n.jsx(Qt,{className:"font-mono",children:q.name}),n.jsx(Sn,{children:q.managed===!1?"Created outside the console. Edit it with the openshell CLI.":"OpenShell sandbox template"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(wf,{record:{...q,copies:(Te=_.find(re=>re.copies.some(fe=>ht(fe)===ht(q))))==null?void 0:Te.copies},onChange:re=>N(ht(re))}),n.jsx(RR,{record:q})]}),!L(q)&&n.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"This location is disconnected. Reconnect to use or change this template."}),n.jsx("dl",{className:"divide-y rounded-lg border px-4 text-xs",children:[["Image",n.jsx("span",{className:"break-all font-mono",children:q.image||(q.recipe.source==="image"?q.recipe.image:"Not built yet")},"i")],...q.managed===!1?[]:[["Starts in",AR(q.recipe.command)]],...q.recipe.source==="build"&&q.managed!==!1?[["Agents",[...q.recipe.agents.map(re=>{var fe;return(fe=Ws.find(Re=>Re.id===re))==null?void 0:fe.name}),...(q.recipe.customAgents??[]).map(re=>re.name)].join(", ")||"None"],["Repository",q.recipe.repository?n.jsx("span",{className:"break-all font-mono",children:q.recipe.repository},"r"):"None"]]:[],["Environment",q.recipe.environment.length?n.jsx("span",{className:"font-mono",children:q.recipe.environment.map(re=>re.name).join(", ")},"e"):"None"],["CLI",n.jsxs("code",{className:"font-mono",children:["openshell sandbox create --template ",q.name]},"c")]].map(([re,fe])=>n.jsxs("div",{className:"flex gap-4 py-2",children:[n.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:re}),n.jsx("dd",{className:"min-w-0",children:fe})]},re))}),q.error&&n.jsx("p",{role:"alert",className:"whitespace-pre-wrap rounded-md border border-amber-200 bg-amber-50/50 p-3 text-xs text-amber-800",children:q.error}),q.logs&&n.jsxs("details",{open:io(q)||q.status==="failed",className:"overflow-hidden rounded-lg border",children:[n.jsx("summary",{className:"cursor-pointer bg-muted/35 px-3 py-2 text-xs",children:"Build log"}),n.jsx("pre",{"aria-label":"Build log",className:"max-h-64 overflow-auto whitespace-pre-wrap break-all bg-card p-4 font-mono text-[10px] leading-relaxed",children:q.logs})]}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 border-t pt-4",children:io(q)?n.jsxs(le,{variant:"outline",disabled:!L(q),onClick:()=>je(()=>X(q).cancelImageBuild(q.name)),children:[n.jsx(Pn,{}),"Cancel build"]}):n.jsxs(n.Fragment,{children:[q.status==="failed"&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!L(q),onClick:()=>oe(q,q.recipe,!!q.exists),children:[n.jsx(BA,{}),"Edit and retry"]}),q.status==="failed"&&q.exists&&n.jsx(le,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>je(()=>X(q).dismissImageBuild(q.name)),children:"Dismiss"}),q.status==="ready"&&q.managed&&n.jsxs(le,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>oe(q,q.recipe,!0),children:[n.jsx(_k,{}),"Edit"]}),q.managed!==!1&&n.jsxs(le,{variant:"ghost",size:"sm",disabled:!L(q),onClick:()=>oe(q,{...q.recipe,name:`${q.name.slice(0,14)}-copy`},!1),children:[n.jsx(Lf,{}),"Duplicate"]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Delete image template",disabled:F||!L(q),onClick:()=>se([q]),children:n.jsx(ts,{})}),gp(q)&&n.jsxs(le,{className:`ml-auto ${ER}`,disabled:!L(q),onClick:()=>{B(q),N(null)},children:["Use template",n.jsx(mu,{})]})]})})]})})}),n.jsx(tn,{open:!!T,onOpenChange:re=>{!re&&!$.current&&O(null)},children:n.jsxs(nn,{className:"max-h-[85svh] overflow-y-auto",children:[n.jsxs(sn,{children:[n.jsxs(Qt,{children:["Delete ",(T==null?void 0:T.length)===1?"this template":`${(T==null?void 0:T.length)??0} templates`,"?"]}),n.jsx(Sn,{children:"The selected templates and their unused Docker images will be deleted in their owning locations. Templates used by existing sandboxes cannot be deleted. Images shared with other templates are kept."})]}),n.jsx("ul",{className:"max-h-40 overflow-y-auto text-xs",children:T==null?void 0:T.map(re=>n.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[n.jsx("span",{className:"font-mono",children:re.name}),n.jsx(ga,{location:Z(re)})]},ht(re)))}),H.length>0&&n.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-xs",children:[n.jsxs("p",{children:["Cannot delete ",(T==null?void 0:T.length)===1?"this template":"these templates","."]}),n.jsx("ul",{className:"mt-2 space-y-3",children:H.map(re=>{var fe;return n.jsxs("li",{children:[n.jsxs("p",{children:[n.jsx("span",{className:"font-mono",children:re.target.name})," ",n.jsx(ga,{location:Z(re.target)}),": ",re.message]}),((fe=re.sandboxes)==null?void 0:fe.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1 text-muted-foreground",children:"Delete the sandboxes below, then retry. Deleting a sandbox permanently removes its files."}),n.jsx("ul",{className:"mt-2 space-y-2",children:re.sandboxes.map(Re=>n.jsxs("li",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"break-all font-mono",children:Re.name}),n.jsxs(le,{variant:"destructive",size:"sm",disabled:F||!L(re.target),"aria-label":`Delete sandbox ${Re.name} in ${Dn(Z(re.target))}`,onClick:()=>Q(re.target,Re.name),children:[n.jsx(ts,{}),"Delete sandbox"]})]},ht({...Re,location:re.target.location})))})]})]},ht(re.target))})})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(le,{variant:"ghost",disabled:F,onClick:()=>O(null),children:"Cancel"}),n.jsxs(le,{variant:"destructive",disabled:F||!(T!=null&&T.some(L)),onClick:ie,children:[F&&n.jsx(Nt,{}),F?"Deleting…":H.length?"Retry deletion":(T==null?void 0:T.length)===1?"Delete template":"Delete templates"]})]})]})}),n.jsx(tn,{open:E,onOpenChange:re=>{k(re),re||M(null)},children:n.jsx(nn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:n.jsx(Ox,{locations:a,allowRemote:!!(t!=null&&t.localViewer),subject:"template",connecting:!!A,onPick:re=>pe(a.find(fe=>or(fe)===re)),onConnected:re=>{M(re.gateway),c()},onCancel:()=>k(!1)})})}),D&&n.jsx(Zn,{location:Z(D),children:n.jsx(MD,{open:!0,initialImageTemplate:D,onOpenChange:re=>{re||B(null)},onStarted:()=>B(null)})})]})}const ZD=x.createContext(void 0);function Tee(){const e=x.useContext(ZD);if(e===void 0)throw new Error(rn(63));return e}const Eee="data-checked",Ree="data-unchecked",JD={...Lg,checked(e){return e?{[Eee]:""}:{[Ree]:""}}},Aee=x.forwardRef(function(t,r){const{checked:a,className:i,defaultChecked:c,"aria-labelledby":u,form:f,id:h,inputRef:m,name:p,nativeButton:g=!1,onCheckedChange:b,readOnly:v=!1,required:w=!1,disabled:C=!1,render:S,uncheckedValue:N,value:E,style:k,...A}=t,{clearErrors:M}=Bg(),{state:R,setTouched:T,setDirty:O,validityData:D,setFilled:B,setFocused:F,validationMode:K,disabled:$,name:P,validation:U}=Pu(),{labelId:H}=Vf(),W=$||C,q=P??p,Z=x.useRef(null),z=mo(Z,m,U.inputRef),L=x.useRef(null),X=ws(),ee=Uf({id:h}),_=g?void 0:ee,[V,G]=po({controlled:a,default:!!c,name:"Switch",state:"checked"});$g(L,X,V,void 0,!W,p),We(()=>{B(V)},[V,B]),Ff(V,()=>{M(q),O(V!==D.initialValue),U.change(V)});const{getButtonProps:Y,buttonRef:ne}=bo({disabled:W,native:g}),te=XA(u,H,Z,!g,_),ye={id:g?ee:X,role:"switch","aria-checked":V,"aria-readonly":v||void 0,"aria-required":w||void 0,"aria-labelledby":te,onFocus(){W||F(!0)},onBlur(){const Q=Z.current;!Q||W||(T(!0),F(!1),K==="onBlur"&&U.commit(Q.checked))},onClick(Q){if(v||W)return;Q.preventDefault();const ie=Z.current;ie&&hu(ie,Q)}},ae={...U.getValidationProps(W),checked:V,disabled:W,form:f,id:_,name:q,required:w,style:q?i2:_g,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:z,onChange(Q){if(Q.nativeEvent.defaultPrevented)return;if(v){Q.preventDefault();return}const ie=Q.currentTarget.checked,oe=yt(Ur,Q.nativeEvent);b==null||b(ie,oe),!oe.isCanceled&&G(ie)},onClick(Q){Q.stopPropagation()},onFocus(){var Q;(Q=L.current)==null||Q.focus()},...E!==void 0?{value:E}:En},ue=x.useMemo(()=>({...R,checked:V,disabled:W,readOnly:v,required:w}),[R,V,W,v,w]),se=Ct("span",t,{state:ue,ref:[r,L,ne],props:[ye,A,Y,Q=>U.getValidationProps(W,Q)],stateAttributesMapping:JD});return n.jsxs(ZD.Provider,{value:ue,children:[se,!V&&q&&N!==void 0&&n.jsx("input",{type:"hidden",form:f,name:q,value:N,disabled:W}),n.jsx("input",{...ae,suppressHydrationWarning:!0})]})}),Mee=x.forwardRef(function(t,r){const{render:a,className:i,style:c,...u}=t,f=Tee();return Ct("span",t,{state:f,ref:r,stateAttributesMapping:JD,props:u})});function Oee({className:e,...t}){return n.jsx(Aee,{"data-slot":"switch",className:Ve("peer relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border border-transparent outline-none transition-colors duration-200 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-[var(--connection)] data-unchecked:bg-foreground/15",e),...t,children:n.jsx(Mee,{"data-slot":"switch-thumb",className:"pointer-events-none block size-3.5 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] data-checked:translate-x-[15px] data-unchecked:translate-x-[1px]"})})}const Dee=({children:e,className:t,shimmerWidth:r=100,...a})=>n.jsx("span",{style:{"--shiny-width":`${r}px`},className:Ve("mx-auto max-w-md text-neutral-600/70 dark:text-neutral-400/70","animate-shiny-text bg-size-[var(--shiny-width)_100%] bg-clip-text bg-position-[0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-linear-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80",t),...a,children:e}),zee=`Create a Linux VM I can connect to OpenRod (a sandbox console) over SSH.
|
|
530
|
+
Use the cloud provider or server I already use: check which CLIs I'm logged into (aws, gcloud, az, doctl, hcloud, …). If it's unclear, ask me before creating anything.
|
|
531
|
+
|
|
532
|
+
Requirements:
|
|
533
|
+
- Ubuntu 22.04/24.04 LTS (or Debian 12), amd64 or arm64. A full VM, not a container.
|
|
534
|
+
- At least 2 vCPU, 4 GB RAM, 30 GB disk.
|
|
535
|
+
- SSH with key-based login only (ed25519). Use my existing key, or generate a new key pair on my machine without a passphrase (or add it to ssh-agent with ssh-add). Password login is not supported.
|
|
536
|
+
- A non-root user with that key in ~/.ssh/authorized_keys.
|
|
537
|
+
- Docker Engine (rootful, the docker.io or docker-ce package), running and enabled. Not Docker Desktop, not rootless.
|
|
538
|
+
- Add that user to the docker group, so \`docker ps\` works without sudo.
|
|
539
|
+
- Python 3 installed.
|
|
540
|
+
- In sshd_config: AllowTcpForwarding yes and AllowStreamLocalForwarding yes, then restart sshd.
|
|
541
|
+
- Open the SSH port (22 or a custom one) to my IP in the firewall/security group.
|
|
542
|
+
|
|
543
|
+
Verify, from my machine: \`ssh <user>@<host> 'docker ps && python3 --version'\` succeeds with no password prompt.
|
|
544
|
+
|
|
545
|
+
When you're done, reply with ONLY this, nothing else:
|
|
546
|
+
|
|
547
|
+
- Display name: <short name for the VM>
|
|
548
|
+
- Hostname: <user>@<public IP or DNS>
|
|
549
|
+
- SSH port: <port, or 22>
|
|
550
|
+
- Authentication: "SSH agent / default keys" if the key is ~/.ssh/id_ed25519 or ~/.ssh/id_rsa, or is loaded in ssh-agent. Otherwise "Key file: <full path to the PRIVATE key on my machine, e.g. ~/.ssh/openrod-vm — not the .pub>"
|
|
551
|
+
- Host key fingerprint (ED25519): <output of \`ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub\` on the VM>
|
|
552
|
+
`;async function Iee(e,t){try{return await navigator.clipboard.writeText(e),!0}catch{}const r=Object.assign(document.createElement("textarea"),{value:e,readOnly:!0});r.style.cssText="position:fixed;opacity:0;pointer-events:none",t.parentElement.append(r),r.select();try{return document.execCommand("copy")}catch{return!1}finally{r.remove(),t.focus()}}const Pee={initial:{opacity:0,scale:.6,filter:"blur(2px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},exit:{opacity:0,scale:.6,filter:"blur(2px)"}};function _ee({className:e}){const[t,r]=x.useState(!1),a=Zs();x.useEffect(()=>{if(!t)return;const u=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(u)},[t]);const i=async u=>{await Iee(zee,u.currentTarget)?r(!0):He.error("Couldn’t copy the prompt",{description:"Your browser blocked clipboard access."})},c=a?{}:{...Pee,transition:{duration:.18,ease:"easeOut"}};return n.jsx(Fu,{delay:300,children:n.jsxs(ba,{children:[n.jsxs(va,{render:n.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:i,"aria-label":t?"Prompt copied":"Copy a VM setup prompt for your AI agent",className:Ve("h-8 gap-1.5 px-3 text-xs",e)}),children:[n.jsx("span",{className:"relative grid size-3.5 place-items-center","aria-hidden":"true",children:n.jsx(lc,{initial:!1,mode:"popLayout",children:n.jsx(In.span,{className:"grid place-items-center",...c,children:t?n.jsx(Yn,{className:"size-3.5 text-emerald-600 dark:text-emerald-400"}):n.jsx(Lf,{className:"size-3.5"})},t?"check":"copy")})}),n.jsx(lc,{initial:!1,mode:"wait",children:n.jsx(In.span,{...a?{}:{initial:{opacity:0,y:3},animate:{opacity:1,y:0},exit:{opacity:0,y:-3},transition:{duration:.15}},children:t?n.jsx("span",{className:"text-foreground",children:"Copied — paste into your agent"}):n.jsx(Dee,{className:"mx-0 text-inherit motion-reduce:animate-none dark:text-inherit",children:"Need a VM? Copy agent prompt"})},t?"copied":"idle")}),n.jsx("span",{role:"status",className:"sr-only",children:t?"VM setup prompt copied to clipboard":""})]}),n.jsx(ya,{side:"top",className:"max-w-64",children:"Copies a prompt your AI agent can use to create a VM on any cloud provider or server, then tells you what to enter here."})]})})}const MR={name:"",hostname:"",port:"",auth:"default",identityFile:""},Lee=[["default","SSH agent / default keys"],["identity","Key file"]];function $ee({open:e,onOpenChange:t,onAdded:r}){const[a,i]=x.useState(MR),[c,u]=x.useState(null),[f,h]=x.useState(!1),[m,p]=x.useState(null),g=x.useId();x.useEffect(()=>{e&&(i(MR),u(null),p(null),h(!1))},[e]);const b=N=>E=>{i(k=>({...k,[N]:E.target.value})),p(null)},v=a.name.trim()&&a.hostname.trim()&&(a.auth==="default"||a.identityFile.trim());async function w(N){h(!0),p(null);try{await N()}catch(E){p(E.message)}finally{h(!1)}}const C=N=>{N.preventDefault(),v&&!f&&w(async()=>u(await cs.scanSshHost(a)))},S=()=>w(async()=>{const N=await cs.addSshHost(c.token);r(N)});return n.jsx(tn,{open:e,onOpenChange:N=>{f||t(N)},children:n.jsxs(nn,{className:"sm:max-w-md","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsx(Qt,{children:c?"Trust this machine?":"Add SSH connection"})}),c?n.jsxs("div",{className:"grid gap-4 text-xs",children:[n.jsxs("p",{className:"text-muted-foreground",children:["OpenRod reached ",n.jsxs("span",{className:"font-mono text-foreground",children:[c.user?`${c.user}@`:"",c.host,c.port?`:${c.port}`:""]})," and it presented these host keys. Confirm they match the server before you trust it; a mismatch could mean someone is intercepting the connection."]}),n.jsx("ul",{className:"grid gap-2",children:c.fingerprints.map(N=>n.jsxs("li",{className:"rounded-lg border border-border bg-muted/20 px-3 py-2",children:[n.jsx("span",{className:"block text-[10px] text-muted-foreground",children:N.type}),n.jsx("span",{className:"block font-mono break-all text-foreground",children:N.fingerprint})]},N.type))}),n.jsxs("p",{className:"text-muted-foreground",children:["On the server, ",n.jsx("code",{className:"rounded bg-muted px-1 font-mono text-foreground",children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"})," prints the matching fingerprint."]}),m&&n.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:m}),n.jsxs(Hr,{children:[n.jsx(le,{type:"button",variant:"ghost",disabled:f,onClick:()=>{u(null),p(null)},children:"Back"}),n.jsxs(le,{type:"button",disabled:f,onClick:S,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f?n.jsx(Nt,{"aria-hidden":"true"}):n.jsx(Iu,{"aria-hidden":"true",className:"size-4"}),"Trust and save"]})]})]}):n.jsxs("form",{autoComplete:"off",className:"grid gap-4 text-xs",onSubmit:C,children:[n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${g}-name`,className:"text-xs",children:"Display name"}),n.jsx(Ot,{id:`${g}-name`,value:a.name,onChange:b("name"),maxLength:60,placeholder:"Build server",autoFocus:!0})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx(zn,{htmlFor:`${g}-host`,className:"text-xs",children:"Hostname"}),n.jsx(Ot,{id:`${g}-host`,value:a.hostname,onChange:b("hostname"),spellCheck:!1,autoCapitalize:"none",placeholder:"host.com or user@host.com",className:"font-mono"})]}),n.jsxs("div",{className:"grid gap-1.5",children:[n.jsxs(zn,{htmlFor:`${g}-port`,className:"text-xs",children:["SSH port ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),n.jsx(Ot,{id:`${g}-port`,value:a.port,onChange:b("port"),inputMode:"numeric",placeholder:"22",className:"font-mono"})]}),n.jsxs("div",{className:"grid gap-2",children:[n.jsx("div",{role:"radiogroup","aria-label":"Authentication",className:"inline-flex w-fit rounded-lg bg-muted p-0.5",children:Lee.map(([N,E])=>n.jsx("button",{type:"button",role:"radio","aria-checked":a.auth===N,onClick:()=>{i(k=>({...k,auth:N})),p(null)},className:`rounded-md px-3 py-1 transition-colors ${a.auth===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:E},N))}),a.auth==="identity"?n.jsx(Ot,{"aria-label":"Private key file",value:a.identityFile,onChange:b("identityFile"),spellCheck:!1,autoCapitalize:"none",placeholder:"~/.ssh/id_ed25519",className:"font-mono"}):n.jsx("p",{className:"text-muted-foreground",children:"Uses your SSH agent and the keys SSH tries by default. Password logins aren’t supported."})]}),m&&n.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:m}),n.jsxs(Hr,{children:[n.jsx(_ee,{className:"sm:mr-auto"}),n.jsx(le,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(le,{type:"submit",disabled:!v||f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&n.jsx(Nt,{"aria-hidden":"true"}),f?"Checking…":"Continue"]})]})]})]})})}const ez={connected:{label:"Connected",dot:"bg-emerald-500"},connecting:{label:"Connecting…",dot:"bg-amber-400"},failed:{label:"Connection failed",dot:"bg-red-500"},off:{label:"Not connected",dot:"bg-stone-400 dark:bg-stone-500"}},OR=e=>ez[e]?e:"off",tz=(e,t,r)=>`${e} ${e===1?t:r}`;function Bee({row:e,count:t}){const r=ez[e.state];return n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{"aria-hidden":"true",className:Ve("size-1.5 shrink-0 rounded-full",r.dot,e.state==="connecting"&&"motion-safe:animate-pulse")}),n.jsx("span",{children:r.label}),e.state==="connected"&&n.jsxs("span",{className:"hidden sm:inline",children:["· ",tz(t,"sandbox","sandboxes")]})]})}function Vee({row:e,count:t,working:r,onToggle:a,onCreate:i,menu:c}){const u=e.state==="connected",f=e.label??e.name,h=e.address;return n.jsxs("li",{className:"px-4 py-2 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-3.5",children:[n.jsx("span",{className:"flex h-[18px] w-8 shrink-0 items-center justify-center",children:r||e.state==="connecting"?n.jsx(Nt,{"aria-label":"Working",className:"size-3.5"}):n.jsx(Oee,{checked:u,"aria-label":`${u?"Disconnect from":"Connect to"} ${f}`,onCheckedChange:m=>a(e,m)})}),n.jsx("span",{"aria-hidden":"true",className:Ve("flex w-6 shrink-0 justify-center transition-opacity duration-300 [&_svg]:block [&_svg]:h-[22px]",!u&&"opacity-50"),children:n.jsx(S4,{live:u})}),n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2.5",children:[n.jsx("span",{className:"truncate text-[13px] font-medium",children:f}),h&&n.jsx("span",{className:"hidden min-w-0 truncate font-mono text-[11px] text-muted-foreground md:block",children:h})]}),n.jsx(Bee,{row:e,count:t}),n.jsxs("span",{className:"flex w-[60px] shrink-0 items-center justify-end gap-0.5",children:[u&&i&&n.jsxs(ba,{children:[n.jsx(va,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`New sandbox on ${f}`,onClick:i,className:"size-7 text-muted-foreground hover:text-foreground"}),children:n.jsx(H8,{className:"size-4"})}),n.jsx(ya,{children:"New sandbox"})]}),c]})]}),e.state==="failed"&&e.error&&n.jsx("p",{className:"mt-1 truncate pl-[46px] font-mono text-[11px] text-destructive",title:e.error,children:e.error})]})}function Uee({onCreateSandbox:e}){var _,V,G;const t=vo(),r=ds(),[a,i]=x.useState(!1),[c,u]=x.useState(""),[f,h]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>()=>{var Y;return(Y=m.current)==null?void 0:Y.abort()},[]);const p=t.locations.find(Y=>Y.cloud||Y.target==="cloud"),g=!!(p!=null&&p.connected);async function b(){const Y=new AbortController;m.current=Y,i(!0),u("");try{await r.prepare({signal:Y.signal}),Y.signal.throwIfAborted(),h(!0),t.refresh()}catch(ne){ne.name!=="AbortError"&&u(ne.message)}finally{i(!1),m.current=null}}const[v,w]=x.useState(null),[C,S]=x.useState(null),[N,E]=x.useState(null),[k,A]=x.useState(null),[M,R]=x.useState(!1),[T,O]=x.useState(null),D=x.useCallback(async Y=>{try{w(await cs.connections(Y)),S(null)}catch(ne){ne.name!=="AbortError"&&S(ne.message)}},[]);x.useEffect(()=>{const Y=new AbortController;return D(Y.signal),()=>Y.abort()},[D]);const B=(v==null?void 0:v.active)??null,F=OR(B==null?void 0:B.status),K=F==="connected",$=x.useMemo(()=>{if(!v)return[];const Y=v.hosts.map(ne=>({...ne,state:(B==null?void 0:B.host)===ne.name?OR(B.status):"off",error:(B==null?void 0:B.host)===ne.name?B.error:null}));return B&&!Y.some(ne=>ne.name===B.host)&&Y.push({name:B.host,state:F,error:B.error}),Y},[v,B,F]),P=$.filter(Y=>Y.managed||Y.name===(B==null?void 0:B.host)).sort((Y,ne)=>(ne.state==="connected")-(Y.state==="connected")||(Y.label??Y.name).localeCompare(ne.label??ne.name)),U=$.filter(Y=>!P.includes(Y)),H=Y=>t.sandboxes.filter(ne=>{var te;return((te=ne.location)==null?void 0:te.remote)&&ne.location.host===Y.name}).length;async function W(Y,ne,te){E(Y);try{await ne(),await D(),t.refresh()}catch(ye){He.error(te,{description:ye.message})}finally{E(null)}}const q=(Y,ne)=>{ne?A({host:Y.name,replacing:K?B.host:void 0}):W(Y.name,async()=>{await cs.disconnectRemote(),He.success(`Disconnected from ${Y.label??Y.name}`)},"Couldn’t disconnect")};function Z(){const{kind:Y,row:ne}=T;O(null);const te=ne.label??ne.name;Y==="forget"?W(ne.name,async()=>{await cs.forgetRemote(),He.success(`Forgot ${te}`)},"Couldn’t forget it"):W(ne.name,async()=>{(B==null?void 0:B.host)===ne.name&&await cs.forgetRemote(),await cs.removeSshHost(ne.name),He.success(`Deleted ${te}`)},"Couldn’t delete it")}function z(Y){const ne=Y.name===(B==null?void 0:B.host);return!Y.managed&&!ne?null:n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":`More actions for ${Y.label??Y.name}`,className:"size-7 text-muted-foreground hover:text-foreground"}),children:n.jsx(Dk,{className:"size-4"})}),n.jsxs(qi,{align:"end",className:"min-w-44",children:[Y.state==="connected"&&n.jsx(Rs,{onClick:()=>q(Y,!1),children:"Disconnect"}),Y.state!=="connected"&&Y.state!=="connecting"&&n.jsx(Rs,{onClick:()=>q(Y,!0),children:Y.state==="failed"?"Try again":"Connect"}),ne&&!Y.managed&&n.jsx(Rs,{onClick:()=>O({kind:"forget",row:Y}),children:"Forget"}),Y.managed&&n.jsxs(n.Fragment,{children:[n.jsx(ju,{}),n.jsxs(Rs,{variant:"destructive",disabled:Y.state==="connected"||Y.state==="connecting",onClick:()=>O({kind:"delete",row:Y}),children:["Delete",Y.state==="connected"?" (disconnect first)":""]})]})]})]})}const L=(Y,ne)=>n.jsx(ho,{delay:.04*ne,offset:4,blur:"3px",className:"contents",children:n.jsx(Vee,{row:Y,count:H(Y),working:N===Y.name,onToggle:q,onCreate:e,menu:z(Y)})},Y.name),X=(T==null?void 0:T.row.label)??(T==null?void 0:T.row.name),ee="divide-y divide-border/60 overflow-hidden rounded-xl border border-border/80 bg-card";return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:n.jsxs("div",{className:"grid gap-8 px-4 py-5 sm:px-6",children:[n.jsxs("section",{"aria-label":"OpenRod Cloud",className:"grid gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-medium",children:"OpenRod Cloud"}),n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Manage your cloud connection."})]}),n.jsx(ho,{duration:.2,offset:4,blur:"3px",children:n.jsxs("div",{className:ee,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3.5 px-4 py-3 sm:px-5",children:[n.jsx("span",{"aria-hidden":"true",className:"flex w-8 shrink-0 justify-center [&_svg]:h-7",children:n.jsx(N4,{})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-[13px] font-medium",children:((_=r==null?void 0:r.user)==null?void 0:_.email)||"OpenRod Cloud"}),n.jsxs("p",{role:"status",className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[g&&n.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-emerald-500"}),r!=null&&r.checking?"Checking connection…":a?r!=null&&r.connecting?"Signing in…":"Starting cloud machine…":g?`Connected · ${tz(t.sandboxes.filter(Y=>{var ne;return(ne=Y.location)==null?void 0:ne.cloud}).length,"sandbox","sandboxes")}`:r!=null&&r.connected?"Signed in · machine not ready":r!=null&&r.available?"Not connected":((V=r==null?void 0:r.status)==null?void 0:V.reason)||"Coming soon"]})]}),n.jsx("div",{className:"flex items-center gap-1.5",children:a?n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>{var Y;(Y=m.current)==null||Y.abort(),r.cancelConnect()},children:[n.jsx(Nt,{}),"Cancel"]}):n.jsxs(n.Fragment,{children:[g&&!f?n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:p}})),children:[n.jsx(gf,{className:"size-3.5"}),"Import data"]}):!g&&n.jsxs(le,{variant:"outline",size:"sm",disabled:!(r!=null&&r.available)||(r==null?void 0:r.checking),onClick:b,children:[n.jsx(Kp,{className:"size-3.5"}),r!=null&&r.connected?"Start cloud machine":"Connect"]}),(r==null?void 0:r.connected)&&n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"OpenRod Cloud actions"}),children:n.jsx(Dk,{className:"size-4"})}),n.jsxs(qi,{align:"end",children:[n.jsx(Rs,{onClick:()=>r.refresh().then(()=>t.refresh()).catch(Y=>u(Y.message)),children:"Refresh connection"}),n.jsx(ju,{}),n.jsx(Rs,{onClick:()=>r.disconnect().catch(Y=>u(Y.message)),children:"Disconnect account"})]})]})]})})]}),f&&g&&n.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t px-4 py-3 sm:px-5",children:[n.jsx("p",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:"Bring your local setup?"}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>h(!1),children:"Not now"}),n.jsxs(le,{size:"sm",onClick:()=>{h(!1),window.dispatchEvent(new CustomEvent("openrod-import",{detail:{destination:p}}))},children:[n.jsx(gf,{className:"size-3.5"}),"Import data"]})]}),(c||(r==null?void 0:r.error))&&n.jsx("p",{role:"alert",className:"border-t px-4 py-2 text-xs text-destructive sm:px-5",children:c||r.error})]})})]}),C&&n.jsxs("div",{role:"alert",className:"flex items-center gap-3 text-xs text-red-600",children:[n.jsx("span",{children:C}),n.jsx(le,{variant:"outline",size:"sm",onClick:()=>D(),children:"Retry"})]}),!v&&!C&&n.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Reading connections…"}),v&&n.jsxs(n.Fragment,{children:[n.jsxs("section",{"aria-label":"SSH connections",className:"grid gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-sm font-medium",children:"SSH connections"}),n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Added in OpenRod. One machine is connected at a time."})]}),n.jsx(le,{variant:"ghost",size:"icon-sm","aria-label":"Refresh connections",onClick:()=>D(),className:"text-muted-foreground",children:n.jsx(rl,{})}),((G=v.forgottenHosts)==null?void 0:G.length)>0&&n.jsxs(Fi,{children:[n.jsx(Gi,{render:n.jsx(le,{variant:"ghost",size:"sm"}),children:"Restore"}),n.jsx(qi,{align:"end",children:v.forgottenHosts.map(Y=>n.jsxs(Rs,{onClick:()=>W(Y,()=>cs.restoreSshHost(Y),"Couldn’t restore it"),children:["Restore ",Y]},Y))})]}),n.jsxs(le,{size:"sm",onClick:()=>R(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[n.jsx(ys,{className:"size-3.5"}),"Add"]})]}),P.length>0?n.jsx("ul",{className:ee,children:P.map(L)}):n.jsxs("div",{className:"rounded-xl border border-border bg-card py-14 text-center",children:[n.jsx($f,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),n.jsx("p",{className:"text-sm",children:"No saved connections"}),n.jsx("p",{className:"mx-auto mt-1 max-w-xs text-xs text-muted-foreground",children:"Add a server to run sandboxes on your own machine over SSH. You confirm its host key before anything is saved."}),n.jsx(le,{variant:"outline",className:"mt-4",onClick:()=>R(!0),children:"Add connection"})]})]}),U.length>0&&n.jsxs("section",{"aria-label":"Hosts in your SSH config",className:"grid gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-medium",children:"From your SSH config"}),n.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Found in ",n.jsx("span",{className:"font-mono",children:"~/.ssh/config"}),". OpenRod reads these and never edits them."]})]}),n.jsx("ul",{className:ee,children:U.map(L)})]})]})]})}),n.jsx(Fr,{open:!!T,onOpenChange:Y=>{Y||O(null)},children:n.jsxs(Gr,{children:[n.jsxs(qr,{children:[n.jsxs(Kr,{children:[(T==null?void 0:T.kind)==="forget"?"Forget":"Delete"," ",X,"?"]}),n.jsx(Xr,{children:(T==null?void 0:T.kind)==="forget"?`${(T==null?void 0:T.row.state)==="connected"?"This disconnects from the machine and removes it from this page. ":"This removes it from this page. "}Sandboxes on the machine keep running, and the host stays in your SSH configuration, so you can connect again later.`:"This removes the saved connection and its trusted host keys from OpenRod. Sandboxes on the machine keep running. You can add it again later."})]}),n.jsxs(Yr,{children:[n.jsx(Qr,{children:"Cancel"}),n.jsx(Wr,{variant:"destructive",onClick:Z,children:(T==null?void 0:T.kind)==="forget"?"Forget":"Delete"})]})]})}),n.jsx($ee,{open:M,onOpenChange:R,onAdded:Y=>{R(!1),He.success(`Added ${Y.name}`),D(),A({host:Y.alias})}}),n.jsx(tn,{open:!!k,onOpenChange:Y=>{Y||A(null)},children:n.jsxs(nn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[n.jsx(sn,{children:n.jsx(Qt,{children:k!=null&&k.replacing?"Switch host":"Connect a remote machine"})}),k&&n.jsx(Lw,{initialHost:k.host,connectedHost:k.replacing??null,onUseConnected:()=>A(null),onConnected:Y=>{A(null),He.success(`Connected to ${Y.host}`),D(),t.refresh()},onBack:()=>A(null)},k.host)]})})]})}const DR=({...e})=>{const{resolvedTheme:t}=YR();return n.jsx(IK,{theme:t??"system",className:"toaster group",icons:{success:n.jsx(DL,{className:"size-4"}),info:n.jsx(Du,{className:"size-4"}),warning:n.jsx(ti,{className:"size-4"}),error:n.jsx(LA,{className:"size-4"}),loading:n.jsx(Ql,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function Hee({children:e,user:t,logout:r}){const[a]=x.useState(()=>window.location.hash.startsWith("#local-connect=")?i7(window.location.hash)??!1:null),[i,c]=x.useState(""),u=x.useRef(null),f=a&&window.opener&&!window.opener.closed;return x.useEffect(()=>{if(!f)return;let h=!0;u.current??(u.current=f7(a));const m=setTimeout(()=>{h&&c("Could not reach local OpenRod. Close this window and try again.")},3e4);return u.current.then(({code:p})=>{h&&window.opener.postMessage({type:"openrod-local-connected",nonce:a.nonce,code:p},a.origin)}).catch(p=>{clearTimeout(m),h&&c(p.message)}),()=>{h=!1,clearTimeout(m)}},[a,f]),a===null?e:n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-sm text-center",children:[f&&!i&&n.jsx(_w,{}),n.jsx("h1",{className:"text-2xl font-semibold",children:i||!f?"Sign-in interrupted":"Finishing sign-in…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:f&&!i?n.jsxs(n.Fragment,{children:["Signed in as ",t.email,".",n.jsx("br",{}),"High demand may slow this down."]}):"Start again from local OpenRod."}),i&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:i}),(i||!f)&&n.jsx("button",{className:"mt-5 block w-full text-xs underline",onClick:r,children:"Sign out"})]})})}function Fee({children:e}){var S,N;const t=ds(),r=((S=t==null?void 0:t.status)==null?void 0:S.origin)||ku,{chooseGroups:a,dialog:i,cancel:c}=Jw(),u=x.useRef(new AbortController),f=x.useMemo(()=>lr("local",u.current.signal),[]),h=x.useRef(0);x.useEffect(()=>{const E=++h.current;return()=>queueMicrotask(()=>{h.current===E&&u.current.abort()})},[]);const m=x.useRef((N=/^#cloud-return=([a-f0-9-]{36})$/.exec(window.location.hash))==null?void 0:N[1]),[p,g]=x.useState(m.current&&window.opener?"waiting":"normal"),[b,v]=x.useState(""),w=x.useRef(!1),C=x.useRef(!1);return x.useEffect(()=>{if(p!=="waiting"||!(t!=null&&t.available)||!r)return;const E=async k=>{var A;if(!(w.current||k.origin!==r||k.source!==window.opener||((A=k.data)==null?void 0:A.type)!=="openrod-local-bundle"||k.data.nonce!==m.current)){w.current=!0,g("importing");try{if(typeof k.data.error=="string")throw Error(k.data.error);const R=(await f.inventory()).locations.find(B=>!B.remote&&B.connected);if(!R)throw Error("Connect a local gateway before importing this workspace.");const T=f.forContext(R.context),O=await a(T,"local OpenRod",u.current.signal);if(C.current)return;const D=await T.importCloud({...k.data.bundle,...O?{destinationGroups:O}:{}});if(window.opener.postMessage({type:"openrod-local-result",nonce:m.current,name:D.name},r),C.current)return;v(k.data.warning??"Workspace copied locally. Reconnect agent credentials to continue."),window.location.href=vg(D.name,"shell",{...R,target:"local"}),g("done")}catch(M){if(C.current||u.current.signal.aborted)return;v(M.message),g("error"),window.opener.postMessage({type:"openrod-local-result",nonce:m.current,error:M.message},r)}}};return window.addEventListener("message",E),window.opener.postMessage({type:"openrod-local-ready",nonce:m.current},r),()=>window.removeEventListener("message",E)},[p,r,t==null?void 0:t.available]),x.useEffect(()=>{if(!["waiting","importing"].includes(p))return;const E=Date.now()+35*6e4,k=setInterval(()=>{var A;((A=window.opener)!=null&&A.closed||Date.now()>E)&&(u.current.abort(),c(),v("The cloud tab closed or the copy timed out. Open the workspace to check whether a copy was created."),g("error"))},1e3);return()=>clearInterval(k)},[p]),p==="normal"||p==="done"?n.jsxs(n.Fragment,{children:[b&&n.jsx(xa,{id:"local-return",tone:p==="done"?"success":"warning",title:p==="done"?"Workspace continued locally":"Workspace copy didn’t finish",onDismiss:()=>v(""),children:b}),e]}):n.jsxs(n.Fragment,{children:[i,n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-md text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold",children:"Continuing your workspace locally…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Keep the cloud tab open while your files are copied and your template is rebuilt for this computer."}),b&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:b}),n.jsx("button",{className:"mt-6 text-sm underline",onClick:()=>{u.current.abort(),c(),C.current=!0,w.current=!0,window.location.hash="",g("normal")},children:"Open local workspace"})]})})]})}function Gee(e){try{if(!e.startsWith("#handoff="))return null;const t=JSON.parse(atob(e.slice(9).replaceAll("-","+").replaceAll("_","/"))),r=new URL(t.origin);return r.origin!==t.origin||r.protocol!=="http:"||!["localhost","127.0.0.1","[::1]"].includes(r.hostname)||!/^\d{1,5}$/.test(r.port)||!/^[a-f0-9-]{36}$/.test(t.nonce)?null:{origin:r.origin,nonce:t.nonce}}catch{return null}}async function py(e,t="GET"){const r=await fetch(`/api/cloud/${e}`,{method:t,headers:t==="POST"?{"x-openshell-console":"1","content-type":"application/json"}:void 0,body:t==="POST"?"{}":void 0}),a=await r.json();if(!r.ok)throw Error(a.error??"Cloud machine unavailable");return a}function qee({children:e,logout:t}){const[r,a]=x.useState(null),[i,c]=x.useState(""),[u,f]=x.useState(null),[h,m]=x.useState(!1),[p,g]=x.useReducer(S=>S+1,0);async function b(){m(!0),c("");try{a(await py("machine","POST")),g()}catch(S){c(S.message)}finally{m(!1)}}const v=x.useRef(Gee(window.location.hash)),w=x.useRef(!1);if(x.useEffect(()=>{let S=!0,N;async function E(){try{const k=await py("machine");S&&(a(k),c(k.error??""),["ready","none","error"].includes(k.status)||(N=setTimeout(E,5e3)))}catch(k){S&&(c(k.message),N=setTimeout(E,1e4))}}return E(),()=>{S=!1,clearTimeout(N)}},[p]),x.useEffect(()=>{const S=v.current;if((r==null?void 0:r.status)!=="ready"||!S||!window.opener||w.current)return;w.current=!0,f({status:"waiting"});const N=A=>{var M;if(v.current&&!(A.source!==window.opener||A.origin!==S.origin||((M=A.data)==null?void 0:M.type)!=="openrod-cloud-result"||A.data.nonce!==S.nonce)){if(A.data.error){f({status:"error",message:A.data.error});return}f({status:"done",message:A.data.warning??"Workspace copied. Reconnect your agent credentials to continue."}),/^[a-z0-9-]{1,63}$/.test(A.data.name??"")&&(window.location.hash=`terminal/${A.data.name}?session=shell`)}};window.addEventListener("message",N),py("handoff","POST").then(({ticket:A})=>window.opener.postMessage({type:"openrod-cloud-ready",nonce:S.nonce,ticket:A},S.origin)).catch(A=>f({status:"error",message:A.message}));const E=Date.now()+35*6e4,k=setInterval(()=>{var A;v.current&&((A=window.opener)!=null&&A.closed||Date.now()>E)&&(f({status:"error",message:"The source tab closed or the copy timed out. Open your workspace to check whether a copy was created."}),clearInterval(k))},1e3);return()=>{window.removeEventListener("message",N),clearInterval(k)}},[r==null?void 0:r.status]),(r==null?void 0:r.status)==="ready"&&(!u||u.status==="done"))return n.jsxs(n.Fragment,{children:[(u==null?void 0:u.message)&&n.jsx(xa,{id:"cloud-transfer",tone:"success",title:"Workspace continued in the cloud",onDismiss:()=>f(null),children:u.message}),e]});const C=!u&&!i&&(h||r&&!["none","ready","error"].includes(r.status));return n.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:n.jsxs("section",{className:"max-w-md text-center",children:[C&&n.jsx(_w,{}),n.jsx("h1",{className:"text-2xl font-semibold",children:u?"Continuing your workspace…":!C&&(r==null?void 0:r.status)==="none"?"Start OpenRod Cloud":"Setting up your cloud machine…"}),n.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:u?"Keep your local OpenRod tab open.":C?"High demand may slow this down.":"The first start takes a few minutes."}),C&&n.jsxs("div",{role:"status",className:"mt-5 flex items-center justify-center gap-2 rounded-lg bg-muted/50 p-4 text-sm",children:[n.jsx(Nt,{"aria-hidden":"true"}),n.jsx("span",{children:"Opens automatically when ready"})]}),(i||(u==null?void 0:u.message))&&n.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:(u==null?void 0:u.message)??i}),!u&&((r==null?void 0:r.status)==="none"||i)&&n.jsxs(le,{disabled:h,className:"mt-5",onClick:b,children:[h&&n.jsx(Nt,{}),i?"Try again":"Start cloud machine"]}),u&&n.jsx("button",{onClick:()=>{v.current=null,f(null),window.location.hash=""},className:"mt-4 text-sm underline",children:"Open cloud workspace"}),n.jsx("button",{onClick:t,className:"mt-6 block w-full text-xs underline",children:"Sign out"})]})})}function Yee({localConnect:e=!1,error:t,busy:r,available:a,onLogin:i}){return n.jsx("main",{className:"grid min-h-svh grid-cols-1 place-items-center bg-background px-4 py-6 sm:px-6 sm:py-10",children:n.jsxs("section",{"aria-labelledby":"cloud-sign-in-title",className:"min-w-0 w-full max-w-sm rounded-xl border border-border bg-card px-5 py-7 text-center shadow-sm sm:px-8 sm:py-9",children:[n.jsx("img",{src:"/openrod.png",alt:"",width:"96",height:"96",className:"mx-auto mb-6 size-24 object-contain"}),n.jsx("h1",{id:"cloud-sign-in-title",className:"text-2xl font-semibold tracking-tight",children:"OpenRod Cloud"}),e&&n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Sign in to connect this computer."}),n.jsx("button",{type:"button",disabled:!a||r,"aria-busy":r||void 0,onClick:i,className:"mt-7 inline-flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:r?"Signing in…":"Continue with Google"}),t&&n.jsx("p",{role:"alert",className:"mt-4 text-xs leading-relaxed text-destructive",children:t})]})})}const Kee={"auth/network-request-failed":"Couldn’t reach Google. Check your connection and try again.","auth/popup-closed-by-user":"Sign-in cancelled.","auth/cancelled-popup-request":"Sign-in cancelled.","auth/popup-blocked":"Allow popups, then try again.","auth/unauthorized-domain":"Sign-in isn’t configured for this address. Contact your administrator.","auth/user-disabled":"This account is disabled. Contact your administrator.","auth/too-many-requests":"Too many attempts. Try again shortly."};function Xee(e){return Kee[e==null?void 0:e.code]||"Couldn’t sign in. Try again."}const zR=()=>Promise.all([by(()=>import("./index.esm-Cj6nXjOx.js"),__vite__mapDeps([0,1])),by(()=>import("./index.esm-Z1y-oluO.js"),__vite__mapDeps([2,1]))]);async function gy(e,t){const r=await fetch(`/api/auth/${e}`,{method:t===void 0?"GET":"POST",headers:t===void 0?void 0:{"content-type":"application/json","x-openshell-console":"1"},body:t===void 0?void 0:JSON.stringify(t)}),a=await r.json();if(a.code===$i&&window.dispatchEvent(new Event($i)),!r.ok)throw Object.assign(new Error(a.error??"Sign-in unavailable"),{code:a.code});return a}function Wee(){var t;const e=ds();return e!=null&&e.localViewer?null:n.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs",children:[n.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:(t=e==null?void 0:e.user)==null?void 0:t.email}),n.jsx("button",{className:"underline underline-offset-4",onClick:e==null?void 0:e.logout,children:"Sign out"})]})}function Qee({children:e}){const[t,r]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(!0),[f,h]=x.useState(""),[m,p]=x.useState(!1),[g,b]=x.useState(!1);x.useEffect(()=>{let C=!0;async function S(){try{const k=await gy("config");if(!["local","cloud"].includes(k.mode))throw Error("Invalid console configuration");if(!C)return;en.configure({mode:k.mode,enabled:k.telemetryEnabled===!0}),r(k);const A=k.mode==="cloud"&&window.location.hash.startsWith("#local-connect=")&&h7(window.location.search);if(A){const M=new URL(window.location.href);M.searchParams.delete(o2),window.history.replaceState(null,"",M)}if(k.mode==="cloud"&&!A){const M=await fetch("/api/auth/me");if(M.ok){const R=await M.json();C&&i(R.user)}else if(M.status!==401){const R=await M.json();throw Error(R.error??"Authentication unavailable")}}}catch(k){C&&h(k.message)}finally{C&&u(!1)}}S();const N=()=>{i(null),h("Your session expired. Sign in again.")},E=()=>{en.stop(),p(!0)};return window.addEventListener("openrod-session-expired",N),window.addEventListener($i,E),()=>{C=!1,window.removeEventListener("openrod-session-expired",N),window.removeEventListener($i,E)}},[]),x.useEffect(()=>{t!=null&&t.firebase&&!a&&zR().catch(()=>{})},[t==null?void 0:t.firebase,a]);async function v(){if(g||!(t!=null&&t.firebase))return;b(!0),h("");let C,S;try{const[{initializeApp:N,getApps:E},k]=await zR();S=k;const A=E().find(O=>O.name==="openrod-cloud")??N(t.firebase,"openrod-cloud");C=S.getAuth(A),await S.setPersistence(C,S.inMemoryPersistence);const M=new S.GoogleAuthProvider;M.setCustomParameters({prompt:"select_account"});const R=await S.signInWithPopup(C,M),T=await gy("session",{idToken:await R.user.getIdToken(!0)});i(T.user)}catch(N){h(Xee(N))}finally{C&&await S.signOut(C).catch(()=>{}),b(!1)}}async function w(){try{await gy("logout",{})}catch(C){h(C.message)}finally{i(null)}}return m?n.jsx("main",{className:"grid min-h-screen place-items-center bg-background px-6",children:n.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-8 text-center shadow-sm",children:[n.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Open the console link"}),n.jsxs("p",{className:"mt-3 text-sm text-muted-foreground",children:["Open the link printed by ",n.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:"openrod"})," in your terminal. It carries a secret that changes every time the console starts, so open the new link after a restart."]})]})}):c?n.jsx("div",{className:"grid min-h-screen place-items-center text-sm text-muted-foreground",children:"Loading OpenRod…"}):(t==null?void 0:t.mode)==="local"?n.jsx(v7,{children:n.jsx(Fee,{children:n.jsx(xZ,{children:e})})}):a?n.jsx(Hee,{user:a,logout:w,children:n.jsx(x7,{user:a,logout:w,children:n.jsx(qee,{logout:w,children:e},a.uid)})}):n.jsx(Yee,{localConnect:window.location.hash.startsWith("#local-connect="),error:f,busy:g,available:!!(t!=null&&t.firebase),onLogin:v})}const IR=e=>e?JSON.stringify([e.target??"local",e.context]):null;function Zee(e,t,r="local"){return e.find(a=>a.target===r&&!a.remote&&a.connected)??e.find(a=>a.target===r&&a.connected)??null}const $x=[{id:"groups",label:"Groups",description:"Definitions and policy relationships"},{id:"network",label:"Network",description:"Egress rules with destination targets"},{id:"setups",label:"MCPs & Skills",description:"Saved setups and skill files"},{id:"templates",label:"Templates",description:"Portable image recipes"},{id:"activity",label:"Activity history",description:"Historical events, in batches of up to 500",optional:!0}],Jee=$x.filter(e=>!e.optional).map(e=>e.id),Ul=e=>["running","cancelling"].includes(e==null?void 0:e.status),ete=e=>e&&!["planned","running","cancelling"].includes(e.status);function tte(e,t){var c;const r=new Map(e.map(u=>[u.key,u])),a=new Set;function i(u){if(a.has(u))return;const f=r.get(u);if(!f)throw new Error(`Missing import dependency: ${u}`);a.add(u);for(const h of f.dependencies??[])i(h)}t.forEach(i);for(let u=-1;u!==a.size;){u=a.size;for(const f of e)(c=f.requiredForGroups)!=null&&c.some(h=>a.has(`groups:${h}`))&&i(f.key)}return[...a]}const Ts=e=>(e==null?void 0:e.id)??JSON.stringify([e==null?void 0:e.target,e==null?void 0:e.context]);function PR({from:e="",to:t="",offset:r=0,snapshot:a}={}){const i={offset:r};for(const[c,u]of Object.entries({from:e,to:t})){if(!u)continue;const f=new Date(u);if(!Number.isFinite(f.getTime()))throw new Error("Choose a valid activity date range.");i[c]=f.toISOString()}if(i.from&&i.to&&i.from>i.to)throw new Error("Activity start must be before its end.");return a!=null&&(i.snapshot=a),i}function _R(e){var r;if(!((r=e==null?void 0:e.items)!=null&&r.length))return 0;const t=e.items.filter(a=>["created","completed","reused","skipped","blocked","failed","cancelled"].includes(a.status)).length;return Math.round(t/e.items.length*100)}function nte(e){const t=[...$x,{id:"policyTemplates",label:"Base policies"}].map(a=>({...a,items:e.filter(i=>i.type===a.id)})),r=e.filter(a=>!t.some(i=>i.id===a.type));return r.length&&t.push({id:"other",label:"Other resources",items:r}),t.filter(a=>a.items.length).map(a=>{if(a.id!=="setups")return a;const i=u=>{var f;return new Set((((f=u.data)==null?void 0:f.items)??[]).map(h=>h.kind))},c=u=>{const f=i(u);return f.has("mcp")&&f.has("skill")?"mixed":f.has("mcp")?"mcps":f.has("skill")?"skills":"saved"};return{...a,groups:[{id:"mcps",label:"MCPs"},{id:"skills",label:"Skills"},{id:"mixed",label:"MCPs & Skills together"},{id:"saved",label:"Saved setups"}].map(u=>({...u,items:a.items.filter(f=>c(f)===u.id)})).filter(u=>u.items.length)}})}const Yd={...Object.fromEntries($x.map(e=>[e.id,e.label])),policyTemplates:"Base policy"},xy=e=>({created:"Imported",completed:"Imported",reused:"Reused",failed:"Failed",blocked:"Dependency failed",pending:"Waiting",running:"Importing",cancelled:"Cancelled",skipped:"Skipped",planned:"Ready to import",partial:"Needs attention",interrupted:"Interrupted"})[e]??e;function ste({request:e,onClose:t}){var xe,je,Ie,ce,Te,re,fe,Re,Oe,ke;const r=ds(),a=Bf(),i=vo(),[c,u]=x.useState(""),[f,h]=x.useState(()=>e!=null&&e.destination?Ts(e.destination):r!=null&&r.localViewer?"cloud":""),[m,p]=x.useState((e==null?void 0:e.destination)??null),[g,b]=x.useState(()=>e!=null&&e.type&&Yd[e.type]?[e.type]:Jee),[v,w]=x.useState({from:"",to:""}),[C,S]=x.useState(null),[N,E]=x.useState({}),[k,A]=x.useState(null),[M,R]=x.useState([]),[T,O]=x.useState(null),[D,B]=x.useState([]),[F,K]=x.useState(""),[$,P]=x.useState(""),[U,H]=x.useState(null),W=i.locations.filter(he=>he.connected),q=m&&(i.locations.find(he=>Ts(he)===Ts(m))??m),Z=q!=null&&q.connected&&!W.some(he=>Ts(he)===Ts(m))?[...W,q]:W,z=Z.find(he=>Ts(he)===c),L=Z.find(he=>Ts(he)===f),X=x.useRef(new AbortController),ee=x.useRef(0);x.useEffect(()=>{const he=++ee.current;return()=>queueMicrotask(()=>{ee.current===he&&X.current.abort()})},[]);const _=x.useRef(((xe=r==null?void 0:r.status)==null?void 0:xe.owner)??null);!_.current&&((je=r==null?void 0:r.status)!=null&&je.owner)&&(_.current=r.status.owner);const V=x.useMemo(()=>a.signal?AbortSignal.any([a.signal,X.current.signal]):X.current.signal,[a.signal]),G=x.useCallback(he=>lr(r!=null&&r.localViewer?he.target:a.target,V,he.context,_.current),[r==null?void 0:r.localViewer,a.target,V]);x.useEffect(()=>{!c&&W.length&&u(Ts(W.find(he=>!he.cloud&&!he.remote)??W[0]))},[c,W.map(Ts).join("|")]),x.useEffect(()=>{if(f!=="cloud")return;const he=Z.find(Ae=>(Ae.cloud||Ae.target==="cloud")&&Ae.connected);he&&h(Ts(he))},[f,Z.map(he=>`${Ts(he)}:${he.connected}`).join("|")]),x.useEffect(()=>{if(B([]),!(L!=null&&L.connected))return;const he=G(L);let Ae=!0;return he.importJobs().then(ge=>{Ae&&B(ge.jobs??[])}).catch(()=>{Ae&&B([])}),()=>{Ae=!1}},[f,L==null?void 0:L.context,L==null?void 0:L.connected,G,T==null?void 0:T.id,T==null?void 0:T.status]),x.useEffect(()=>{if(!T||!Ul(T)||!U)return;let he=!0,Ae;const ge=async()=>{try{const Pe=await U.importJob(T.id);if(!he)return;O(Pe),Ul(Pe)?Ae=setTimeout(ge,1e3):(i.refresh(),window.dispatchEvent(new Event("openrod-resources-changed")))}catch(Pe){he&&(P(Pe.message),Ae=setTimeout(ge,3e3))}};return ge(),()=>{he=!1,clearTimeout(Ae)}},[T==null?void 0:T.id,T==null?void 0:T.status,U]);async function Y(he,Ae){K(he),P("");try{await Ae()}catch(ge){ge.name!=="AbortError"&&P(ge.message)}finally{V.aborted||K("")}}async function ne(){var Fe;if(L!=null&&L.connected)return L;if(f!=="cloud")throw Error("Choose a connected destination.");if(!(r!=null&&r.localViewer))throw Error("Choose the cloud workspace from the list.");V.throwIfAborted(),K(r.connected?"Preparing cloud workspace…":"Connecting to OpenRod Cloud…");const he=await r.prepare({signal:V,onProgress:()=>{V.aborted||K("Preparing cloud workspace…")}});if(_.current&&_.current!==he.owner)throw Error("Your cloud account changed. Start a new import.");_.current=he.owner,V.throwIfAborted();const ge=(Fe=(await Fa("inventory",void 0,{signal:V,owner:he.owner})).locations)==null?void 0:Fe.find(_e=>_e.connected);if(!ge)throw Error("The cloud gateway is still preparing. Try again shortly.");const Pe={...ge,cloud:!0,target:"cloud",label:"OpenRod Cloud",id:JSON.stringify(["cloud",ge.context])};return p(Pe),h(Pe.id),i.refresh(),Pe}async function te(he=v){if(!z)throw Error("Choose a connected source.");const Ae=G(z),ge=g.includes("activity")?PR(he):void 0,Pe=await ne();if(V.throwIfAborted(),K("Reading configuration…"),Ts(z)===Ts(Pe))throw Error("Choose a different destination.");const Fe=G(Pe),_e=await Fe.importCapabilities(),Xe=g.filter(ct=>{var At,rt;return!((rt=(At=_e.types)==null?void 0:At[ct])!=null&&rt.supported)});if(Xe.length)throw Error(`This destination cannot import ${Xe.map(ct=>Yd[ct]).join(", ")}.`);const Je=await Ae.exportResources({types:g,...ge?{activity:ge}:{}});S(_e),E({}),H(Fe),A(Je),R(Je.resources.filter(ct=>g.includes(ct.type)).map(ct=>ct.key))}const ye=x.useMemo(()=>{try{const he=k?tte(k.resources,M):[],Ae=[...new Set((k==null?void 0:k.resources.filter(ge=>{var Pe,Fe;return he.includes(ge.key)&&C&&!((Fe=(Pe=C.types)==null?void 0:Pe[ge.type])!=null&&Fe.supported)}).map(ge=>ge.type))??[])];return{included:he,error:Ae.length?`Required dependencies cannot be imported here: ${Ae.map(ge=>Yd[ge]??ge).join(", ")}.`:""}}catch(he){return{included:M,error:`${he.message}. Deselect the resource that requires it, or fix the source and read it again.`}}},[k,M,C]);async function ae(he,Ae){const ge={...N};Ae==="reuse"?ge[he.key]={action:Ae,targetId:he.sourceId}:delete ge[he.key];const Pe=await U.planImport({bundle:k,selection:M,conflicts:ge});E(ge),O(Pe)}const ue=ye.included,se=T?"result":k?"select":"source",Q=!!F||Ul(T);function ie(){A(null),O(null),R([]),E({}),w(he=>({from:he.from,to:he.to})),P("")}const oe=he=>{var Ae;return n.jsxs("label",{className:"flex items-start gap-3 p-3",children:[n.jsx($o,{"aria-label":`Import ${he.name}`,checked:ue.includes(he.key),disabled:Q||!M.includes(he.key)&&ue.includes(he.key),onCheckedChange:ge=>R(Pe=>ge?[...Pe,he.key]:Pe.filter(Fe=>Fe!==he.key))}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:he.name}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:ue.includes(he.key)&&!M.includes(he.key)?"Required dependency":""}),he.type==="setups"&&["mcp","skill"].map(ge=>{var Fe;const Pe=(((Fe=he.data)==null?void 0:Fe.items)??[]).filter(_e=>_e.kind===ge);return Pe.length>0&&n.jsxs("span",{className:"mt-1 block text-[11px] leading-relaxed text-muted-foreground",children:[n.jsxs("span",{className:"font-medium",children:[ge==="mcp"?"MCPs":"Skills",":"]})," ",Pe.map(_e=>_e.name).join(", ")]},ge)}),(Ae=he.warnings)==null?void 0:Ae.map((ge,Pe)=>n.jsx("span",{className:"mt-1 block text-[11px] text-amber-700 dark:text-amber-400",children:ge},Pe))]})]},he.key)},pe=T?`${((Ie=T.counts)==null?void 0:Ie.completed)??0} of ${T.items.length} resources complete. Your source stays available.`:k?"Choose what to copy. Required dependencies are included in the review.":"Copy saved configuration between your computer, connected hosts, and OpenRod Cloud.";return n.jsx(tn,{open:!0,onOpenChange:he=>{!he&&!F&&t()},children:n.jsxs(nn,{className:"gap-4 sm:max-w-xl",children:[n.jsxs(sn,{className:"pr-6",children:[n.jsx(Qt,{children:T?xy(T.status):"Import data"}),n.jsx(Sn,{className:"text-xs leading-relaxed",children:pe})]}),n.jsx("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground","aria-label":"Import steps",children:["Locations","Selection","Review & import"].map((he,Ae)=>n.jsxs(x.Fragment,{children:[Ae>0&&n.jsx(mu,{className:"size-3"}),n.jsx("span",{className:Ae===(se==="source"?0:se==="select"?1:2)?"font-medium text-foreground":"",children:he})]},he))}),n.jsxs("div",{className:"max-h-[60svh] overflow-y-auto pr-1",children:[se==="source"&&n.jsxs(ho,{duration:.15,offset:3,className:"space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-end gap-3",children:[n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["From",n.jsxs(pn,{"aria-label":"Import source",value:c,onChange:he=>{u(he.target.value),w(Ae=>({from:Ae.from,to:Ae.to}))},disabled:Q,className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose source"}),W.map(he=>n.jsx("option",{value:Ts(he),children:Dn(he)},Ts(he)))]})]}),n.jsx(mu,{className:"mb-2 size-4 text-muted-foreground"}),n.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["To",n.jsxs(pn,{"aria-label":"Import destination",value:f,onChange:he=>{h(he.target.value),B([])},disabled:Q,className:"w-full text-xs",children:[n.jsx("option",{value:"",children:"Choose destination"}),(r==null?void 0:r.localViewer)&&(f==="cloud"||!Z.some(he=>he.cloud||he.target==="cloud"))&&n.jsxs("option",{value:"cloud",disabled:!(r!=null&&r.available),children:["OpenRod Cloud",r!=null&&r.available?"":" · Coming soon"]}),Z.map(he=>n.jsx("option",{value:Ts(he),disabled:Ts(he)===c,children:Dn(he)},Ts(he)))]})]})]}),n.jsxs("fieldset",{className:"space-y-1",children:[n.jsx("legend",{className:"mb-2 text-xs font-medium",children:"Include"}),$x.map(he=>n.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded-md p-2 hover:bg-muted/50",children:[n.jsx($o,{checked:g.includes(he.id),disabled:Q,onCheckedChange:Ae=>b(ge=>Ae?[...ge,he.id]:ge.filter(Pe=>Pe!==he.id))}),n.jsxs("span",{children:[n.jsx("span",{className:"block text-xs font-medium",children:he.label}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:he.description})]})]},he.id))]}),g.includes("activity")&&n.jsxs("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3",children:[n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 500 events per reviewed batch. Leave dates empty for the latest history. Dates use your current timezone."}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("label",{className:"grid gap-1.5 text-[11px]",children:["From",n.jsx(Ot,{type:"datetime-local",value:v.from,disabled:Q,onChange:he=>w(Ae=>({from:he.target.value,to:Ae.to})),className:"text-xs"})]}),n.jsxs("label",{className:"grid gap-1.5 text-[11px]",children:["To",n.jsx(Ot,{type:"datetime-local",value:v.to,disabled:Q,onChange:he=>w(Ae=>({from:Ae.from,to:he.target.value})),className:"text-xs"})]})]})]}),n.jsx("p",{className:"rounded-md border border-border bg-muted/20 p-3 text-[11px] leading-relaxed text-muted-foreground",children:"Credentials must be connected at the destination. Sandbox workspace copying is available from each sandbox. Activity history is copied only when selected; raw payloads and credential values are excluded."}),D.length>0&&n.jsxs("div",{className:"space-y-1 border-t pt-3",children:[n.jsx("p",{className:"mb-2 text-xs font-medium",children:"Recent imports at this destination"}),D.slice(0,5).map(he=>{var Ae,ge,Pe;return n.jsxs("button",{className:"flex w-full items-center justify-between rounded-md p-2 text-left text-xs hover:bg-muted",disabled:Q,onClick:()=>{H(G(L)),O(he)},children:[n.jsxs("span",{children:[((Ae=he.source)==null?void 0:Ae.label)||"Configuration import"," ",n.jsxs("span",{className:"text-muted-foreground",children:["· ",((ge=he.items)==null?void 0:ge.length)??((Pe=he.counts)==null?void 0:Pe.total)??0," resources"]})]}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:xy(he.status)})]},he.id)})]})]}),se==="select"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"flex items-center gap-2 text-xs",children:[n.jsx("span",{children:Dn(z)}),n.jsx(mu,{className:"size-3 text-muted-foreground"}),n.jsx("span",{children:Dn(L)})]}),!k.resources.length&&n.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"No saved resources were found for these categories. For MCPs and skills, use Bring my setup on the source first."}),n.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[n.jsxs("span",{children:[ue.length," selected",ue.length>M.length?` · ${ue.length-M.length} required dependencies`:""]}),n.jsx(le,{variant:"ghost",size:"sm",disabled:Q,onClick:()=>R(M.length?[]:k.resources.filter(he=>g.includes(he.type)).map(he=>he.key)),children:M.length?"Clear selection":"Select all"})]}),n.jsx("div",{className:"space-y-5",children:nte(k.resources).map(he=>n.jsxs("section",{"aria-labelledby":`import-section-${he.id}`,className:"space-y-2",children:[n.jsxs("h3",{id:`import-section-${he.id}`,className:"flex items-center justify-between text-xs font-semibold",children:[n.jsx("span",{children:he.label}),n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground",children:[he.items.filter(Ae=>ue.includes(Ae.key)).length," / ",he.items.length]})]}),he.groups?n.jsx("div",{className:"space-y-3",children:he.groups.map(Ae=>n.jsxs("section",{"aria-labelledby":`import-subsection-${Ae.id}`,className:"space-y-1.5",children:[n.jsx("h4",{id:`import-subsection-${Ae.id}`,className:"text-[11px] font-medium text-muted-foreground",children:Ae.label}),n.jsx("div",{className:"divide-y rounded-lg border",children:Ae.items.map(oe)})]},Ae.id))}):n.jsx("div",{className:"divide-y rounded-lg border",children:he.items.map(oe)})]},he.id))}),ye.error&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:ye.error}),((ce=k.pages)==null?void 0:ce.activity)&&n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[k.pages.activity.exported," of ",k.pages.activity.total," matching activity events in this batch.",k.pages.activity.nextOffset!=null?" After importing, load the next batch to continue with older history.":""]}),((Te=k.excluded)==null?void 0:Te.length)>0&&n.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[n.jsxs("summary",{className:"cursor-pointer",children:[k.excluded.length," excluded or needing attention"]}),n.jsx("ul",{className:"mt-2 space-y-1",children:k.excluded.map((he,Ae)=>n.jsxs("li",{children:[he.name??Yd[he.type]??he.type,": ",he.reason]},Ae))})]})]}),T&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsxs("span",{children:[((re=T.source)==null?void 0:re.label)||"Source"," → ",L?Dn(L):"Destination"]}),n.jsxs("span",{className:"text-muted-foreground",children:[T.items.length," resources"]})]}),T.status!=="planned"&&n.jsx("div",{role:"progressbar","aria-label":"Import progress","aria-valuenow":_R(T),"aria-valuemin":0,"aria-valuemax":100,className:"h-1 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full bg-primary transition-[width] motion-reduce:transition-none",style:{width:`${_R(T)}%`}})}),n.jsx("div",{className:"divide-y rounded-lg border",children:T.items.map(he=>{var Ae;return n.jsxs("div",{className:"flex items-start gap-3 p-3",children:[he.status==="running"?n.jsx(Nt,{className:"mt-0.5 size-3.5"}):["created","completed","reused"].includes(he.status)?n.jsx(Yn,{className:"mt-0.5 size-3.5 text-emerald-600"}):he.status==="failed"?n.jsx(Pn,{className:"mt-0.5 size-3.5 text-destructive"}):n.jsx(gf,{className:"mt-0.5 size-3.5 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:he.name}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:[Yd[he.type]," · ",T.status==="planned"?he.action==="reuse"?"Use existing":"Create a copy":xy(he.status)]}),(Ae=he.warnings)==null?void 0:Ae.map((ge,Pe)=>n.jsx("span",{className:"mt-1 block text-[11px] text-amber-700 dark:text-amber-400",children:ge},Pe)),he.error&&n.jsx("span",{className:"mt-1 block text-[11px] text-destructive",children:typeof he.error=="string"?he.error:he.error.message}),T.status==="planned"&&k&&he.type!=="activity"&&n.jsxs(pn,{"aria-label":`Import action for ${he.name}`,value:he.action,disabled:Q,onChange:ge=>Y("Updating review…",()=>ae(he,ge.target.value)),className:"mt-2 h-7 w-fit min-w-40 text-[11px]",children:[n.jsx("option",{value:"create",children:"Create a copy"}),n.jsx("option",{value:"reuse",children:"Use identical existing"})]})]})]},he.key)})}),T.status==="planned"&&k&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Existing resources can be reused only when their ID and configuration match. Copies receive a new ID when needed."}),(fe=T.warnings)==null?void 0:fe.map((he,Ae)=>n.jsx("p",{className:"text-[11px] text-muted-foreground",children:he},Ae)),Ul(T)&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"You can close this dialog. Reopen Import data at this destination to check progress."})]})]}),$&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:$}),n.jsxs(Hr,{children:[F&&!Ul(T)&&n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>{X.current.abort(),t()},children:"Cancel"}),se!=="source"&&!Ul(T)&&n.jsx(le,{size:"sm",variant:"ghost",disabled:!!F,onClick:ie,children:"Start another import"}),se==="source"&&n.jsxs(le,{size:"sm",disabled:Q||!z||!f||!g.length||c===f||f==="cloud"&&!(r!=null&&r.available),onClick:()=>Y("Reading configuration…",()=>te()),children:[F?n.jsx(Nt,{}):n.jsx(gf,{}),F||"Choose resources"]}),se==="select"&&n.jsxs(le,{size:"sm",disabled:Q||!M.length||!!ye.error,onClick:()=>Y("Preparing review…",async()=>O(await U.planImport({bundle:k,selection:M,conflicts:N}))),children:[F&&n.jsx(Nt,{}),F||`Review ${ue.length} resources`]}),(T==null?void 0:T.status)==="planned"&&n.jsxs(le,{size:"sm",disabled:Q,onClick:()=>Y("Starting import…",async()=>O(await U.executeImport(T.id))),children:[F&&n.jsx(Nt,{}),F||"Import selected data"]}),Ul(T)&&n.jsx(le,{size:"sm",variant:"outline",disabled:!!F||T.cancelRequested||T.status==="cancelling",onClick:()=>Y("Cancelling…",async()=>O(await U.cancelImport(T.id))),children:T.cancelRequested?"Cancelling…":"Cancel import"}),ete(T)&&(((Re=T.counts)==null?void 0:Re.failed)>0||T.items.some(he=>["failed","blocked","cancelled","pending"].includes(he.status)))&&n.jsxs(le,{size:"sm",disabled:!!F,onClick:()=>Y("Retrying…",async()=>O(await U.retryImport(T.id))),children:[n.jsx(BA,{}),"Retry unfinished"]}),(T==null?void 0:T.status)==="completed"&&T.items.some(he=>he.type==="activity")&&((ke=(Oe=k==null?void 0:k.pages)==null?void 0:Oe.activity)==null?void 0:ke.nextOffset)!=null&&n.jsx(le,{size:"sm",variant:"outline",disabled:!!F||!z,onClick:()=>Y("Reading older history…",async()=>{const he={...v,offset:k.pages.activity.nextOffset,snapshot:k.pages.activity.snapshot};w(he),b(["activity"]);const ge=await G(z).exportResources({types:["activity"],activity:PR(he)});A(ge),R(ge.resources.map(Pe=>Pe.key)),E({}),O(null)}),children:"Next history batch"}),T&&T.status!=="planned"&&n.jsx(le,{size:"sm",variant:"outline",onClick:t,children:"Close"})]})]})})}var sj={};(function e(t,r,a,i){var c=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),u=typeof Path2D=="function"&&typeof DOMMatrix=="function",f=(function(){if(!t.OffscreenCanvas)return!1;try{var z=new OffscreenCanvas(1,1),L=z.getContext("2d");L.fillRect(0,0,1,1);var X=z.transferToImageBitmap();L.createPattern(X,"no-repeat")}catch{return!1}return!0})();function h(){}function m(z){var L=r.exports.Promise,X=L!==void 0?L:t.Promise;return typeof X=="function"?new X(z):(z(h,h),null)}var p=(function(z,L){return{transform:function(X){if(z)return X;if(L.has(X))return L.get(X);var ee=new OffscreenCanvas(X.width,X.height),_=ee.getContext("2d");return _.drawImage(X,0,0),L.set(X,ee),ee},clear:function(){L.clear()}}})(f,new Map),g=(function(){var z=Math.floor(16.666666666666668),L,X,ee={},_=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(L=function(V){var G=Math.random();return ee[G]=requestAnimationFrame(function Y(ne){_===ne||_+z-1<ne?(_=ne,delete ee[G],V()):ee[G]=requestAnimationFrame(Y)}),G},X=function(V){ee[V]&&cancelAnimationFrame(ee[V])}):(L=function(V){return setTimeout(V,z)},X=function(V){return clearTimeout(V)}),{frame:L,cancel:X}})(),b=(function(){var z,L,X={};function ee(_){function V(G,Y){_.postMessage({options:G||{},callback:Y})}_.init=function(Y){var ne=Y.transferControlToOffscreen();_.postMessage({canvas:ne},[ne])},_.fire=function(Y,ne,te){if(L)return V(Y,null),L;var ye=Math.random().toString(36).slice(2);return L=m(function(ae){function ue(se){se.data.callback===ye&&(delete X[ye],_.removeEventListener("message",ue),L=null,p.clear(),te(),ae())}_.addEventListener("message",ue),V(Y,ye),X[ye]=ue.bind(null,{data:{callback:ye}})}),L},_.reset=function(){_.postMessage({reset:!0});for(var Y in X)X[Y](),delete X[Y]}}return function(){if(z)return z;if(!a&&c){var _=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
|
|
553
|
+
`);try{z=new Worker(URL.createObjectURL(new Blob([_])))}catch(V){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",V),null}ee(z)}return z}})(),v={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function w(z,L){return L?L(z):z}function C(z){return z!=null}function S(z,L,X){return w(z&&C(z[L])?z[L]:v[L],X)}function N(z){return z<0?0:Math.floor(z)}function E(z,L){return Math.floor(Math.random()*(L-z))+z}function k(z){return parseInt(z,16)}function A(z){return z.map(M)}function M(z){var L=String(z).replace(/[^0-9a-f]/gi,"");return L.length<6&&(L=L[0]+L[0]+L[1]+L[1]+L[2]+L[2]),{r:k(L.substring(0,2)),g:k(L.substring(2,4)),b:k(L.substring(4,6))}}function R(z){var L=S(z,"origin",Object);return L.x=S(L,"x",Number),L.y=S(L,"y",Number),L}function T(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function O(z){var L=z.getBoundingClientRect();z.width=L.width,z.height=L.height}function D(z){var L=document.createElement("canvas");return L.style.position="fixed",L.style.top="0px",L.style.left="0px",L.style.pointerEvents="none",L.style.zIndex=z,L}function B(z,L,X,ee,_,V,G,Y,ne){z.save(),z.translate(L,X),z.rotate(V),z.scale(ee,_),z.arc(0,0,1,G,Y,ne),z.restore()}function F(z){var L=z.angle*(Math.PI/180),X=z.spread*(Math.PI/180);return{x:z.x,y:z.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:z.startVelocity*.5+Math.random()*z.startVelocity,angle2D:-L+(.5*X-Math.random()*X),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:z.color,shape:z.shape,tick:0,totalTicks:z.ticks,decay:z.decay,drift:z.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:z.gravity*3,ovalScalar:.6,scalar:z.scalar,flat:z.flat}}function K(z,L){L.x+=Math.cos(L.angle2D)*L.velocity+L.drift,L.y+=Math.sin(L.angle2D)*L.velocity+L.gravity,L.velocity*=L.decay,L.flat?(L.wobble=0,L.wobbleX=L.x+10*L.scalar,L.wobbleY=L.y+10*L.scalar,L.tiltSin=0,L.tiltCos=0,L.random=1):(L.wobble+=L.wobbleSpeed,L.wobbleX=L.x+10*L.scalar*Math.cos(L.wobble),L.wobbleY=L.y+10*L.scalar*Math.sin(L.wobble),L.tiltAngle+=.1,L.tiltSin=Math.sin(L.tiltAngle),L.tiltCos=Math.cos(L.tiltAngle),L.random=Math.random()+2);var X=L.tick++/L.totalTicks,ee=L.x+L.random*L.tiltCos,_=L.y+L.random*L.tiltSin,V=L.wobbleX+L.random*L.tiltCos,G=L.wobbleY+L.random*L.tiltSin;if(z.fillStyle="rgba("+L.color.r+", "+L.color.g+", "+L.color.b+", "+(1-X)+")",z.beginPath(),u&&L.shape.type==="path"&&typeof L.shape.path=="string"&&Array.isArray(L.shape.matrix))z.fill(W(L.shape.path,L.shape.matrix,L.x,L.y,Math.abs(V-ee)*.1,Math.abs(G-_)*.1,Math.PI/10*L.wobble));else if(L.shape.type==="bitmap"){var Y=Math.PI/10*L.wobble,ne=Math.abs(V-ee)*.1,te=Math.abs(G-_)*.1,ye=L.shape.bitmap.width*L.scalar,ae=L.shape.bitmap.height*L.scalar,ue=new DOMMatrix([Math.cos(Y)*ne,Math.sin(Y)*ne,-Math.sin(Y)*te,Math.cos(Y)*te,L.x,L.y]);ue.multiplySelf(new DOMMatrix(L.shape.matrix));var se=z.createPattern(p.transform(L.shape.bitmap),"no-repeat");se.setTransform(ue),z.globalAlpha=1-X,z.fillStyle=se,z.fillRect(L.x-ye/2,L.y-ae/2,ye,ae),z.globalAlpha=1}else if(L.shape==="circle")z.ellipse?z.ellipse(L.x,L.y,Math.abs(V-ee)*L.ovalScalar,Math.abs(G-_)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI):B(z,L.x,L.y,Math.abs(V-ee)*L.ovalScalar,Math.abs(G-_)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI);else if(L.shape==="star")for(var Q=Math.PI/2*3,ie=4*L.scalar,oe=8*L.scalar,pe=L.x,xe=L.y,je=5,Ie=Math.PI/je;je--;)pe=L.x+Math.cos(Q)*oe,xe=L.y+Math.sin(Q)*oe,z.lineTo(pe,xe),Q+=Ie,pe=L.x+Math.cos(Q)*ie,xe=L.y+Math.sin(Q)*ie,z.lineTo(pe,xe),Q+=Ie;else z.moveTo(Math.floor(L.x),Math.floor(L.y)),z.lineTo(Math.floor(L.wobbleX),Math.floor(_)),z.lineTo(Math.floor(V),Math.floor(G)),z.lineTo(Math.floor(ee),Math.floor(L.wobbleY));return z.closePath(),z.fill(),L.tick<L.totalTicks}function $(z,L,X,ee,_){var V=L.slice(),G=z.getContext("2d"),Y,ne,te=m(function(ye){function ae(){Y=ne=null,G.clearRect(0,0,ee.width,ee.height),p.clear(),_(),ye()}function ue(){a&&!(ee.width===i.width&&ee.height===i.height)&&(ee.width=z.width=i.width,ee.height=z.height=i.height),!ee.width&&!ee.height&&(X(z),ee.width=z.width,ee.height=z.height),G.clearRect(0,0,ee.width,ee.height),V=V.filter(function(se){return K(G,se)}),V.length?Y=g.frame(ue):ae()}Y=g.frame(ue),ne=ae});return{addFettis:function(ye){return V=V.concat(ye),te},canvas:z,promise:te,reset:function(){Y&&g.cancel(Y),ne&&ne()}}}function P(z,L){var X=!z,ee=!!S(L||{},"resize"),_=!1,V=S(L,"disableForReducedMotion",Boolean),G=c&&!!S(L||{},"useWorker"),Y=G?b():null,ne=X?T:O,te=z&&Y?!!z.__confetti_initialized:!1,ye=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ue(Q,ie,oe){for(var pe=S(Q,"particleCount",N),xe=S(Q,"angle",Number),je=S(Q,"spread",Number),Ie=S(Q,"startVelocity",Number),ce=S(Q,"decay",Number),Te=S(Q,"gravity",Number),re=S(Q,"drift",Number),fe=S(Q,"colors",A),Re=S(Q,"ticks",Number),Oe=S(Q,"shapes"),ke=S(Q,"scalar"),he=!!S(Q,"flat"),Ae=R(Q),ge=pe,Pe=[],Fe=z.width*Ae.x,_e=z.height*Ae.y;ge--;)Pe.push(F({x:Fe,y:_e,angle:xe,spread:je,startVelocity:Ie,color:fe[ge%fe.length],shape:Oe[E(0,Oe.length)],ticks:Re,decay:ce,gravity:Te,drift:re,scalar:ke,flat:he}));return ae?ae.addFettis(Pe):(ae=$(z,Pe,ne,ie,oe),ae.promise)}function se(Q){var ie=V||S(Q,"disableForReducedMotion",Boolean),oe=S(Q,"zIndex",Number);if(ie&&ye)return m(function(Ie){Ie()});X&&ae?z=ae.canvas:X&&!z&&(z=D(oe),document.body.appendChild(z)),ee&&!te&&ne(z);var pe={width:z.width,height:z.height};Y&&!te&&Y.init(z),te=!0,Y&&(z.__confetti_initialized=!0);function xe(){if(Y){var Ie={getBoundingClientRect:function(){if(!X)return z.getBoundingClientRect()}};ne(Ie),Y.postMessage({resize:{width:Ie.width,height:Ie.height}});return}pe.width=pe.height=null}function je(){ae=null,ee&&(_=!1,t.removeEventListener("resize",xe)),X&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,te=!1)}return ee&&!_&&(_=!0,t.addEventListener("resize",xe,!1)),Y?Y.fire(Q,pe,je):ue(Q,pe,je)}return se.reset=function(){Y&&Y.reset(),ae&&ae.reset()},se}var U;function H(){return U||(U=P(null,{useWorker:!0,resize:!0})),U}function W(z,L,X,ee,_,V,G){var Y=new Path2D(z),ne=new Path2D;ne.addPath(Y,new DOMMatrix(L));var te=new Path2D;return te.addPath(ne,new DOMMatrix([Math.cos(G)*_,Math.sin(G)*_,-Math.sin(G)*V,Math.cos(G)*V,X,ee])),te}function q(z){if(!u)throw new Error("path confetti are not supported in this browser");var L,X;typeof z=="string"?L=z:(L=z.path,X=z.matrix);var ee=new Path2D(L),_=document.createElement("canvas"),V=_.getContext("2d");if(!X){for(var G=1e3,Y=G,ne=G,te=0,ye=0,ae,ue,se=0;se<G;se+=2)for(var Q=0;Q<G;Q+=2)V.isPointInPath(ee,se,Q,"nonzero")&&(Y=Math.min(Y,se),ne=Math.min(ne,Q),te=Math.max(te,se),ye=Math.max(ye,Q));ae=te-Y,ue=ye-ne;var ie=10,oe=Math.min(ie/ae,ie/ue);X=[oe,0,0,oe,-Math.round(ae/2+Y)*oe,-Math.round(ue/2+ne)*oe]}return{type:"path",path:L,matrix:X}}function Z(z){var L,X=1,ee="#000000",_='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof z=="string"?L=z:(L=z.text,X="scalar"in z?z.scalar:X,_="fontFamily"in z?z.fontFamily:_,ee="color"in z?z.color:ee);var V=10*X,G=""+V+"px "+_,Y=new OffscreenCanvas(V,V),ne=Y.getContext("2d");ne.font=G;var te=ne.measureText(L),ye=Math.ceil(te.actualBoundingBoxRight+te.actualBoundingBoxLeft),ae=Math.ceil(te.actualBoundingBoxAscent+te.actualBoundingBoxDescent),ue=2,se=te.actualBoundingBoxLeft+ue,Q=te.actualBoundingBoxAscent+ue;ye+=ue+ue,ae+=ue+ue,Y=new OffscreenCanvas(ye,ae),ne=Y.getContext("2d"),ne.font=G,ne.fillStyle=ee,ne.fillText(L,se,Q);var ie=1/X;return{type:"bitmap",bitmap:Y.transferToImageBitmap(),matrix:[ie,0,0,ie,-ye*ie/2,-ae*ie/2]}}r.exports=function(){return H().apply(this,arguments)},r.exports.reset=function(){H().reset()},r.exports.create=P,r.exports.shapeFromPath=q,r.exports.shapeFromText=Z})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),sj,!1);const rte=sj.exports;sj.exports.create;const LR="openrod:cloud-announcement:v1:dismissed";let $R,BR=!1;function ote(){return $R??($R=fetch("/api/os/announcements/cloud",{method:"POST",headers:{"content-type":"application/json","x-openshell-console":"1"},body:"{}"}).then(e=>e.ok?e.json():{show:!1}).catch(()=>({show:!1}))),$R}function ate(){const[e,t]=x.useState(!0),r=x.useRef(null);x.useEffect(()=>{let i=!0;return ote().then(({show:c})=>{let u=BR;try{u||(u=localStorage.getItem(LR)==="true")}catch{}i&&t(!c||u)}),()=>{i=!1}},[]),x.useEffect(()=>{if(e||!r.current)return;const i=rte.create(r.current,{resize:!0}),c={particleCount:35,spread:75,startVelocity:16,gravity:.45,ticks:160,scalar:.65,disableForReducedMotion:!0,colors:["#4c88df","#e6b75a","#95bde0","#c0a3e8"]};return i({...c,angle:65,origin:{x:.1,y:1}}),i({...c,angle:115,origin:{x:.9,y:1}}),()=>i.reset()},[e]);function a(){BR=!0,t(!0);try{localStorage.setItem(LR,"true")}catch{}}return e?null:n.jsxs("section",{"aria-label":"OpenRod Cloud announcement",className:"sticky top-0 z-20 flex min-h-12 shrink-0 items-center justify-center overflow-hidden border-b border-blue-900/10 bg-[#e4eeff] py-2 pl-4 pr-12 text-[#234c88] dark:border-blue-200/10 dark:bg-[#1c3050] dark:text-[#d5e5ff]",children:[n.jsx("canvas",{ref:r,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-full"}),n.jsxs("div",{className:"relative flex items-center gap-2.5 text-[13px] leading-5",children:[n.jsx("img",{src:"/openrod.png",alt:"OpenRod",className:"size-7 shrink-0 object-contain"}),n.jsxs("p",{children:[n.jsx("span",{className:"opacity-75",children:"New in OpenRod:"})," ",n.jsx("strong",{className:"font-semibold",children:"Meet OpenRod Cloud!"})]})]}),n.jsx(le,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":"Dismiss OpenRod Cloud announcement",className:"absolute right-2 top-1/2 -translate-y-1/2 text-current hover:bg-blue-950/10 hover:text-current dark:hover:bg-white/10 focus-visible:ring-blue-600",children:n.jsx(Pn,{"aria-hidden":"true",className:"size-3.5"})})]})}const ite=x.lazy(()=>by(()=>import("./terminal-view-DMLkPyDl.js"),__vite__mapDeps([3,4])).then(e=>({default:e.TerminalView}))),L1={sandboxes:"Sandboxes",activity:"Activity",groups:"Groups",egress:"Network",ingress:"Network",secrets:"Secrets",templates:"Templates",setups:"MCPs & Skills",connections:"Connections"};class lte extends x.Component{constructor(){super(...arguments);ln(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidUpdate(r){r.view!==this.props.view&&this.state.error&&this.setState({error:null})}render(){return this.state.error?n.jsxs("div",{role:"alert",className:"mx-auto mt-10 max-w-md rounded-lg border border-border p-5 text-center text-sm",children:[n.jsx("p",{children:"This page hit an error."}),n.jsx("p",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:this.state.error.message}),n.jsx("button",{className:"mt-3 text-xs underline underline-offset-2",onClick:()=>this.setState({error:null}),children:"Try again"})]}):this.props.children}}function VR(){const e=new URLSearchParams(window.location.hash.split("?")[1]??""),t=e.get("gateway"),r=e.get("workspace");if(!t||!r)return null;const a=e.get("remote")==="1",i=e.get("target")??new URLSearchParams(window.location.search).get("target")??void 0;return{id:JSON.stringify([i??"local",JSON.stringify([t,r])]),context:JSON.stringify([t,r]),gateway:t,workspace:r,connected:!0,remote:a,target:i,cloud:i==="cloud",label:e.get("label")||(a?`SSH · ${t}`:"Local")}}function UR(){const e=/^#terminal\/([a-z0-9-]{1,63})(?:\?(.*))?$/.exec(window.location.hash);if(!e)return null;const t=new URLSearchParams(e[2]??""),r=t.get("gateway"),a=t.get("workspace"),i=r&&a?{context:JSON.stringify([r,a]),gateway:r,workspace:a,connected:!0,remote:t.get("remote")==="1",target:new URLSearchParams(window.location.search).get("target")??void 0}:null;return{name:e[1],session:t.get("session")||void 0,setupLogin:t.get("setupLogin")||void 0,mcp:t.get("mcp")||void 0,location:i}}function HR(){const e=window.location.hash.slice(1).split("?")[0];return e==="policies"?(window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}#egress`),"egress"):e==="guardrails"?(window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}#activity`),"activity"):L1[e]?e:"sandboxes"}function cte(){const{connection:e}=oi(),t=Zw();return x.useEffect(()=>{en.observeConsole(e)},[e,t.sharing]),null}function ute(){var E,k;const e=Bf(),t=ds(),r=!(t!=null&&t.localViewer),[a,i]=x.useState(HR),[c,u]=x.useState(UR),[f,h]=x.useState(0),[m,p]=x.useState(VR),g=Zw();x.useEffect(()=>{en.observeView(c?"terminal":a)},[a,!!c,g.sharing]);const[b,v]=x.useState(null),w=vo(),C=x.useMemo(()=>Zee(w.locations,null,e.target??"local"),[w.locations,e.target]),S=x.useCallback((A,M)=>{var O;const R=M??null;if((O=e.signal)!=null&&O.aborted||!L1[A])return;i(A),p(R);const T=R?`?${new URLSearchParams({gateway:R.gateway,workspace:R.workspace,label:R.label,remote:R.remote?"1":"0",...R.target?{target:R.target}:{}})}`:"";window.history.pushState(null,"",A==="sandboxes"&&!R?window.location.pathname:`#${A}${T}`)},[e.signal]),N=r?void 0:()=>{S("sandboxes"),h(A=>A+1)};return x.useEffect(()=>{const A=()=>{i(HR()),u(UR()),p(VR())};window.addEventListener("popstate",A),window.addEventListener("hashchange",A);const M=R=>S(R.detail.view,R.detail.location);return window.addEventListener("openrod-navigate",M),()=>{window.removeEventListener("popstate",A),window.removeEventListener("hashchange",A),window.removeEventListener("openrod-navigate",M)}},[S]),x.useEffect(()=>{const A=M=>{var R,T,O;return v({...M.detail,type:((R=M.detail)==null?void 0:R.type)??((O=(T=M.detail)==null?void 0:T.types)==null?void 0:O[0]),key:Date.now()})};return window.addEventListener("openrod-import",A),()=>window.removeEventListener("openrod-import",A)},[]),c?((E=c.location)==null?void 0:E.target)==="cloud"&&(t!=null&&t.localViewer)&&(t.checking||!t.connected)?n.jsx("main",{className:"grid min-h-svh place-items-center p-6",children:n.jsxs("section",{className:"text-center text-sm",children:[n.jsx("p",{role:"status",children:t.checking?"Checking cloud connection…":"Connect to OpenRod Cloud to open this terminal."}),!t.checking&&n.jsx("a",{href:"#connections",className:"mt-4 inline-block underline underline-offset-4",children:"Open Connections"})]})}):n.jsxs(n.Fragment,{children:[n.jsx(x.Suspense,{fallback:null,children:n.jsx(Zn,{location:c.location,children:n.jsx(ite,{name:c.name,session:c.session,setupLogin:c.setupLogin,mcp:c.mcp},`${t==null?void 0:t.target} ${((k=c.location)==null?void 0:k.context)??""} ${c.name} ${c.session??""}`)})}),n.jsx(DR,{position:"bottom-right"})]}):n.jsx(Zn,{location:C,children:n.jsxs(Rf,{children:[n.jsx(cte,{}),n.jsxs(iZ,{children:[n.jsx(SZ,{view:a,onNavigate:S}),n.jsxs(uZ,{className:"min-w-0 bg-background",children:[n.jsx(ate,{}),n.jsxs("header",{className:"flex h-14 shrink-0 items-center border-b border-border bg-card px-4 sm:px-6",children:[n.jsx(cZ,{className:"mr-2 md:hidden"}),n.jsx("h1",{className:"text-[18px] font-semibold tracking-tight",children:L1[a]}),n.jsx(Wee,{})]}),n.jsx(lQ,{}),n.jsx(wQ,{}),n.jsx(jQ,{}),!r&&n.jsx(kQ,{}),n.jsxs(lte,{view:a,children:[a==="sandboxes"&&n.jsx(bJ,{onNavigate:S,allowRemote:!r,createRequest:f,onCreateRequestHandled:()=>h(0)}),a==="activity"&&n.jsx(IJ,{combined:!0}),a==="groups"&&n.jsx(BJ,{combined:!0,onNavigate:S}),(a==="egress"||a==="ingress")&&n.jsx(JJ,{combined:!0,tab:a,onNavigate:S,requestedLocation:m}),a==="secrets"&&n.jsx(gee,{combined:!0}),a==="templates"&&n.jsx(kee,{}),a==="setups"&&n.jsx(uD,{combined:!0}),a==="connections"&&!r&&n.jsx(Uee,{onCreateSandbox:N})]},`${a}:${IR(C)??"unscoped"}`)]}),n.jsx(DR,{position:"bottom-right"}),b&&n.jsx(ste,{request:b,onClose:()=>v(null)},b.key)]})]},IR(C)??"unscoped")})}ZP.createRoot(document.getElementById("root")).render(n.jsx(nt.StrictMode,{children:n.jsx(VP,{attribute:"class",defaultTheme:"system",enableSystem:!0,storageKey:"openshell-theme",children:n.jsx(Qee,{children:n.jsx(ute,{})})})}));export{le as B,ha as C,Fi as D,ga as L,M8 as R,r2 as T,gn as a,en as b,mf as c,sK as d,Cu as e,hte as f,Gi as g,qi as h,Rs as i,n as j,zp as p,x as r,u4 as s,vg as t,Pt as u};
|