@agent-team-foundation/first-tree-hub 0.12.5 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,406 +0,0 @@
1
- var mS=e=>{throw TypeError(e)};var Zp=(e,t,n)=>t.has(e)||mS("Cannot "+n);var B=(e,t,n)=>(Zp(e,t,"read from private field"),n?n.call(e):t.get(e)),_e=(e,t,n)=>t.has(e)?mS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,a)=>(Zp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),qe=(e,t,n)=>(Zp(e,t,"access private method"),n);var af=(e,t,n,a)=>({set _(s){Se(e,t,s,n)},get _(){return B(e,t,a)}});function R2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function rh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gp={exports:{}},_u={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var pS;function O2(){if(pS)return _u;pS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var c=null;if(o!==void 0&&(c=""+o),s.key!==void 0&&(c=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:o}}return _u.Fragment=t,_u.jsx=n,_u.jsxs=n,_u}var gS;function z2(){return gS||(gS=1,Gp.exports=O2()),Gp.exports}var l=z2(),Vp={exports:{}},Qe={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var yS;function M2(){if(yS)return Qe;yS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,E={};function C(I,P,_){this.props=I,this.context=P,this.refs=E,this.updater=_||S}C.prototype.isReactComponent={},C.prototype.setState=function(I,P){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,P,"setState")},C.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=C.prototype;function O(I,P,_){this.props=I,this.context=P,this.refs=E,this.updater=_||S}var z=O.prototype=new N;z.constructor=O,k(z,C.prototype),z.isPureReactComponent=!0;var L=Array.isArray;function R(){}var $={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function V(I,P,_){var Z=_.ref;return{$$typeof:e,type:I,key:P,ref:Z!==void 0?Z:null,props:_}}function D(I,P){return V(I.type,P,I.props)}function Y(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function ae(I){var P={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(_){return P[_]})}var xe=/\/+/g;function J(I,P){return typeof I=="object"&&I!==null&&I.key!=null?ae(""+I.key):P.toString(36)}function X(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(R,R):(I.status="pending",I.then(function(P){I.status==="pending"&&(I.status="fulfilled",I.value=P)},function(P){I.status==="pending"&&(I.status="rejected",I.reason=P)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function q(I,P,_,Z,Q){var ue=typeof I;(ue==="undefined"||ue==="boolean")&&(I=null);var je=!1;if(I===null)je=!0;else switch(ue){case"bigint":case"string":case"number":je=!0;break;case"object":switch(I.$$typeof){case e:case t:je=!0;break;case p:return je=I._init,q(je(I._payload),P,_,Z,Q)}}if(je)return Q=Q(I),je=Z===""?"."+J(I,0):Z,L(Q)?(_="",je!=null&&(_=je.replace(xe,"$&/")+"/"),q(Q,P,_,"",function(De){return De})):Q!=null&&(Y(Q)&&(Q=D(Q,_+(Q.key==null||I&&I.key===Q.key?"":(""+Q.key).replace(xe,"$&/")+"/")+je)),P.push(Q)),1;je=0;var we=Z===""?".":Z+":";if(L(I))for(var pe=0;pe<I.length;pe++)Z=I[pe],ue=we+J(Z,pe),je+=q(Z,P,_,ue,Q);else if(pe=w(I),typeof pe=="function")for(I=pe.call(I),pe=0;!(Z=I.next()).done;)Z=Z.value,ue=we+J(Z,pe++),je+=q(Z,P,_,ue,Q);else if(ue==="object"){if(typeof I.then=="function")return q(X(I),P,_,Z,Q);throw P=String(I),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return je}function te(I,P,_){if(I==null)return I;var Z=[],Q=0;return q(I,Z,"","",function(ue){return P.call(_,ue,Q++)}),Z}function ke(I){if(I._status===-1){var P=I._result;P=P(),P.then(function(_){(I._status===0||I._status===-1)&&(I._status=1,I._result=_)},function(_){(I._status===0||I._status===-1)&&(I._status=2,I._result=_)}),I._status===-1&&(I._status=0,I._result=P)}if(I._status===1)return I._result.default;throw I._result}var Ae=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},M={map:te,forEach:function(I,P,_){te(I,function(){P.apply(this,arguments)},_)},count:function(I){var P=0;return te(I,function(){P++}),P},toArray:function(I){return te(I,function(P){return P})||[]},only:function(I){if(!Y(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Qe.Activity=g,Qe.Children=M,Qe.Component=C,Qe.Fragment=n,Qe.Profiler=s,Qe.PureComponent=O,Qe.StrictMode=a,Qe.Suspense=m,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(I){return $.H.useMemoCache(I)}},Qe.cache=function(I){return function(){return I.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(I,P,_){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var Z=k({},I.props),Q=I.key;if(P!=null)for(ue in P.key!==void 0&&(Q=""+P.key),P)!U.call(P,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&P.ref===void 0||(Z[ue]=P[ue]);var ue=arguments.length-2;if(ue===1)Z.children=_;else if(1<ue){for(var je=Array(ue),we=0;we<ue;we++)je[we]=arguments[we+2];Z.children=je}return V(I.type,Q,Z)},Qe.createContext=function(I){return I={$$typeof:c,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:o,_context:I},I},Qe.createElement=function(I,P,_){var Z,Q={},ue=null;if(P!=null)for(Z in P.key!==void 0&&(ue=""+P.key),P)U.call(P,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(Q[Z]=P[Z]);var je=arguments.length-2;if(je===1)Q.children=_;else if(1<je){for(var we=Array(je),pe=0;pe<je;pe++)we[pe]=arguments[pe+2];Q.children=we}if(I&&I.defaultProps)for(Z in je=I.defaultProps,je)Q[Z]===void 0&&(Q[Z]=je[Z]);return V(I,ue,Q)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(I){return{$$typeof:f,render:I}},Qe.isValidElement=Y,Qe.lazy=function(I){return{$$typeof:p,_payload:{_status:-1,_result:I},_init:ke}},Qe.memo=function(I,P){return{$$typeof:h,type:I,compare:P===void 0?null:P}},Qe.startTransition=function(I){var P=$.T,_={};$.T=_;try{var Z=I(),Q=$.S;Q!==null&&Q(_,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(R,Ae)}catch(ue){Ae(ue)}finally{P!==null&&_.types!==null&&(P.types=_.types),$.T=P}},Qe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Qe.use=function(I){return $.H.use(I)},Qe.useActionState=function(I,P,_){return $.H.useActionState(I,P,_)},Qe.useCallback=function(I,P){return $.H.useCallback(I,P)},Qe.useContext=function(I){return $.H.useContext(I)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(I,P){return $.H.useDeferredValue(I,P)},Qe.useEffect=function(I,P){return $.H.useEffect(I,P)},Qe.useEffectEvent=function(I){return $.H.useEffectEvent(I)},Qe.useId=function(){return $.H.useId()},Qe.useImperativeHandle=function(I,P,_){return $.H.useImperativeHandle(I,P,_)},Qe.useInsertionEffect=function(I,P){return $.H.useInsertionEffect(I,P)},Qe.useLayoutEffect=function(I,P){return $.H.useLayoutEffect(I,P)},Qe.useMemo=function(I,P){return $.H.useMemo(I,P)},Qe.useOptimistic=function(I,P){return $.H.useOptimistic(I,P)},Qe.useReducer=function(I,P,_){return $.H.useReducer(I,P,_)},Qe.useRef=function(I){return $.H.useRef(I)},Qe.useState=function(I){return $.H.useState(I)},Qe.useSyncExternalStore=function(I,P,_){return $.H.useSyncExternalStore(I,P,_)},Qe.useTransition=function(){return $.H.useTransition()},Qe.version="19.2.4",Qe}var vS;function nv(){return vS||(vS=1,Vp.exports=M2()),Vp.exports}var b=nv();const D2=rh(b),rv=R2({__proto__:null,default:D2},[b]);var Qp={exports:{}},Tu={},Kp={exports:{}},Yp={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var bS;function I2(){return bS||(bS=1,(function(e){function t(q,te){var ke=q.length;q.push(te);e:for(;0<ke;){var Ae=ke-1>>>1,M=q[Ae];if(0<s(M,te))q[Ae]=te,q[ke]=M,ke=Ae;else break e}}function n(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var te=q[0],ke=q.pop();if(ke!==te){q[0]=ke;e:for(var Ae=0,M=q.length,I=M>>>1;Ae<I;){var P=2*(Ae+1)-1,_=q[P],Z=P+1,Q=q[Z];if(0>s(_,ke))Z<M&&0>s(Q,_)?(q[Ae]=Q,q[Z]=ke,Ae=Z):(q[Ae]=_,q[P]=ke,Ae=P);else if(Z<M&&0>s(Q,ke))q[Ae]=Q,q[Z]=ke,Ae=Z;else break e}}return te}function s(q,te){var ke=q.sortIndex-te.sortIndex;return ke!==0?ke:q.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],p=1,g=null,x=3,w=!1,S=!1,k=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function z(q){for(var te=n(h);te!==null;){if(te.callback===null)a(h);else if(te.startTime<=q)a(h),te.sortIndex=te.expirationTime,t(m,te);else break;te=n(h)}}function L(q){if(k=!1,z(q),!S)if(n(m)!==null)S=!0,R||(R=!0,ae());else{var te=n(h);te!==null&&X(L,te.startTime-q)}}var R=!1,$=-1,U=5,V=-1;function D(){return E?!0:!(e.unstable_now()-V<U)}function Y(){if(E=!1,R){var q=e.unstable_now();V=q;var te=!0;try{e:{S=!1,k&&(k=!1,N($),$=-1),w=!0;var ke=x;try{t:{for(z(q),g=n(m);g!==null&&!(g.expirationTime>q&&D());){var Ae=g.callback;if(typeof Ae=="function"){g.callback=null,x=g.priorityLevel;var M=Ae(g.expirationTime<=q);if(q=e.unstable_now(),typeof M=="function"){g.callback=M,z(q),te=!0;break t}g===n(m)&&a(m),z(q)}else a(m);g=n(m)}if(g!==null)te=!0;else{var I=n(h);I!==null&&X(L,I.startTime-q),te=!1}}break e}finally{g=null,x=ke,w=!1}te=void 0}}finally{te?ae():R=!1}}}var ae;if(typeof O=="function")ae=function(){O(Y)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,J=xe.port2;xe.port1.onmessage=Y,ae=function(){J.postMessage(null)}}else ae=function(){C(Y,0)};function X(q,te){$=C(function(){q(e.unstable_now())},te)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(q){switch(x){case 1:case 2:case 3:var te=3;break;default:te=x}var ke=x;x=te;try{return q()}finally{x=ke}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(q,te){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ke=x;x=q;try{return te()}finally{x=ke}},e.unstable_scheduleCallback=function(q,te,ke){var Ae=e.unstable_now();switch(typeof ke=="object"&&ke!==null?(ke=ke.delay,ke=typeof ke=="number"&&0<ke?Ae+ke:Ae):ke=Ae,q){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=ke+M,q={id:p++,callback:te,priorityLevel:q,startTime:ke,expirationTime:M,sortIndex:-1},ke>Ae?(q.sortIndex=ke,t(h,q),n(m)===null&&q===n(h)&&(k?(N($),$=-1):k=!0,X(L,ke-Ae))):(q.sortIndex=M,t(m,q),S||w||(S=!0,R||(R=!0,ae()))),q},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(q){var te=x;return function(){var ke=x;x=te;try{return q.apply(this,arguments)}finally{x=ke}}}})(Yp)),Yp}var xS;function L2(){return xS||(xS=1,Kp.exports=I2()),Kp.exports}var Xp={exports:{}},Vn={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var wS;function P2(){if(wS)return Vn;wS=1;var e=nv();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Vn.createPortal=function(m,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,p)},Vn.flushSync=function(m){var h=c.T,p=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=p,a.d.f()}},Vn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Vn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Vn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Vn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Vn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin);a.d.L(m,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Vn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Vn.requestFormReset=function(m){a.d.r(m)},Vn.unstable_batchedUpdates=function(m,h){return m(h)},Vn.useFormState=function(m,h,p){return c.H.useFormState(m,h,p)},Vn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Vn.version="19.2.4",Vn}var SS;function yj(){if(SS)return Xp.exports;SS=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(),Xp.exports=P2(),Xp.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var kS;function U2(){if(kS)return Tu;kS=1;var e=L2(),t=nv(),n=yj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var u=r,d=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){u=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==d.return)u=y,d=v;else{for(var j=!1,A=y.child;A;){if(A===u){j=!0,u=y,d=v;break}if(A===d){j=!0,d=y,u=v;break}A=A.sibling}if(!j){for(A=v.child;A;){if(A===u){j=!0,u=v,d=y;break}if(A===d){j=!0,d=v,u=y;break}A=A.sibling}if(!j)throw Error(a(189))}}if(u.alternate!==d)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),O=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function ae(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var xe=Symbol.for("react.client.reference");function J(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===xe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case R:return"SuspenseList";case V:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case O:return r.displayName||"Context";case N:return(r._context.displayName||"Context")+".Consumer";case z:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case $:return i=r.displayName||null,i!==null?i:J(r.type)||"Memo";case U:i=r._payload,r=r._init;try{return J(r(i))}catch{}}return null}var X=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke={pending:!1,data:null,method:null,action:null},Ae=[],M=-1;function I(r){return{current:r}}function P(r){0>M||(r.current=Ae[M],Ae[M]=null,M--)}function _(r,i){M++,Ae[M]=r.current,r.current=i}var Z=I(null),Q=I(null),ue=I(null),je=I(null);function we(r,i){switch(_(ue,i),_(Q,r),_(Z,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Lw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Lw(i),r=Pw(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}P(Z),_(Z,r)}function pe(){P(Z),P(Q),P(ue)}function De(r){r.memoizedState!==null&&_(je,r);var i=Z.current,u=Pw(i,r.type);i!==u&&(_(Q,r),_(Z,u))}function Ue(r){Q.current===r&&(P(Z),P(Q)),je.current===r&&(P(je),ju._currentValue=ke)}var dt,ot;function re(r){if(dt===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);dt=i&&i[1]||"",ot=-1<u.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+dt+r+ot}var se=!1;function ge(r,i){if(!r||se)return"";se=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(le){var ne=le}Reflect.construct(r,[],he)}else{try{he.call()}catch(le){ne=le}r.call(he.prototype)}}else{try{throw Error()}catch(le){ne=le}(he=r())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(le){if(le&&ne&&typeof le.stack=="string")return[le.stack,ne.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 v=d.DetermineComponentFrameRoot(),j=v[0],A=v[1];if(j&&A){var H=j.split(`
44
- `),ee=A.split(`
45
- `);for(y=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ee.length&&!ee[y].includes("DetermineComponentFrameRoot");)y++;if(d===H.length||y===ee.length)for(d=H.length-1,y=ee.length-1;1<=d&&0<=y&&H[d]!==ee[y];)y--;for(;1<=d&&0<=y;d--,y--)if(H[d]!==ee[y]){if(d!==1||y!==1)do if(d--,y--,0>y||H[d]!==ee[y]){var ce=`
46
- `+H[d].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=d&&0<=y);break}}}finally{se=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?re(u):""}function Le(r,i){switch(r.tag){case 26:case 27:case 5:return re(r.type);case 16:return re("Lazy");case 13:return r.child!==i&&i!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return ge(r.type,!1);case 11:return ge(r.type.render,!1);case 1:return ge(r.type,!0);case 31:return re("Activity");default:return""}}function zt(r){try{var i="",u=null;do i+=Le(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
47
- Error generating stack: `+d.message+`
48
- `+d.stack}}var Ft=Object.prototype.hasOwnProperty,Ln=e.unstable_scheduleCallback,fr=e.unstable_cancelCallback,hi=e.unstable_shouldYield,mi=e.unstable_requestPaint,on=e.unstable_now,ua=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,$e=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,nt=e.unstable_IdlePriority,un=e.log,tr=e.unstable_setDisableYieldValue,Ht=null,Lt=null;function Tt(r){if(typeof un=="function"&&tr(r),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(Ht,r)}catch{}}var at=Math.clz32?Math.clz32:al,nr=Math.log,Rn=Math.LN2;function al(r){return r>>>=0,r===0?32:31-(nr(r)/Rn|0)|0}var ca=256,da=262144,za=4194304;function Gn(r){var i=r&42;if(i!==0)return i;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Ma(r,i,u){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,j=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Gn(d):(j&=A,j!==0?y=Gn(j):u||(u=A&~r,u!==0&&(y=Gn(u))))):(A=d&~v,A!==0?y=Gn(A):j!==0?y=Gn(j):u||(u=d&~r,u!==0&&(y=Gn(u)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:y}function wa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function qt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Ce(){var r=za;return za<<=1,(za&62914560)===0&&(za=4194304),r}function et(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function gn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function _r(r,i,u,d,y,v){var j=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var A=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(u=j&~u;0<u;){var ce=31-at(u),he=1<<ce;A[ce]=0,H[ce]=-1;var ne=ee[ce];if(ne!==null)for(ee[ce]=null,ce=0;ce<ne.length;ce++){var le=ne[ce];le!==null&&(le.lane&=-536870913)}u&=~he}d!==0&&pi(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(j&~i))}function pi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-at(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|u&261930}function gs(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var d=31-at(u),y=1<<d;y&i|r[d]&i&&(r[d]|=i),u&=~y}}function Hc(r,i){var u=i&-i;return u=(u&42)!==0?1:rr(u),(u&(r.suspendedLanes|i))!==0?0:u}function rr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function fa(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Io(){var r=te.p;return r!==0?r:(r=window.event,r===void 0?32:lS(r.type))}function Lo(r,i){var u=te.p;try{return te.p=r,i()}finally{te.p=u}}var $r=Math.random().toString(36).slice(2),cn="__reactFiber$"+$r,Zt="__reactProps$"+$r,Da="__reactContainer$"+$r,il="__reactEvents$"+$r,Lh="__reactListeners$"+$r,qc="__reactHandles$"+$r,Po="__reactResources$"+$r,gi="__reactMarker$"+$r;function Pe(r){delete r[cn],delete r[Zt],delete r[il],delete r[Lh],delete r[qc]}function F(r){var i=r[cn];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Da]||u[cn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=Zw(r);r!==null;){if(u=r[cn])return u;r=Zw(r)}return i}r=u,u=r.parentNode}return null}function me(r){if(r=r[cn]||r[Da]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ne(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function bt(r){var i=r[Po];return i||(i=r[Po]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ft(r){r[gi]=!0}var Xt=new Set,Pn={};function yn(r,i){On(r,i),On(r+"Capture",i)}function On(r,i){for(Pn[r]=i,r=0;r<i.length;r++)Xt.add(i[r])}var Uo=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]*$"),dn={},Bo={};function Zc(r){return Ft.call(Bo,r)?!0:Ft.call(dn,r)?!1:Uo.test(r)?Bo[r]=!0:(dn[r]=!0,!1)}function Gc(r,i,u){if(Zc(i))if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+u)}}function Vc(r,i,u){if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+u)}}function Ia(r,i,u,d){if(d===null)r.removeAttribute(u);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+d)}}function Fr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Tb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function jT(r,i,u){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(j){u=""+j,v.call(this,j)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return u},setValue:function(j){u=""+j},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Ph(r){if(!r._valueTracker){var i=Tb(r)?"checked":"value";r._valueTracker=jT(r,i,""+r[i])}}function Ab(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=Tb(r)?r.checked?"true":"false":r.value),r=d,r!==u?(i.setValue(r),!0):!1}function Qc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var CT=/[\n"\\]/g;function Hr(r){return r.replace(CT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Uh(r,i,u,d,y,v,j,A){r.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?r.type=j:r.removeAttribute("type"),i!=null?j==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Fr(i)):r.value!==""+Fr(i)&&(r.value=""+Fr(i)):j!=="submit"&&j!=="reset"||r.removeAttribute("value"),i!=null?Bh(r,j,Fr(i)):u!=null?Bh(r,j,Fr(u)):d!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+Fr(A):r.removeAttribute("name")}function Rb(r,i,u,d,y,v,j,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Ph(r);return}u=u!=null?""+Fr(u):"",i=i!=null?""+Fr(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=A?r.checked:!!d,r.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(r.name=j),Ph(r)}function Bh(r,i,u){i==="number"&&Qc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function sl(r,i,u,d){if(r=r.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=i.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&d&&(r[u].defaultSelected=!0)}else{for(u=""+Fr(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Ob(r,i,u){if(i!=null&&(i=""+Fr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+Fr(u):""}function zb(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(X(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=Fr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Ph(r)}function ll(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var ET=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 Mb(r,i,u){var d=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,u):typeof u!="number"||u===0||ET.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Db(r,i,u){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,u!=null){for(var d in u)!u.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in i)d=i[y],i.hasOwnProperty(y)&&u[y]!==d&&Mb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Mb(r,v,i[v])}function $h(r){if(r.indexOf("-")===-1)return!1;switch(r){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 NT=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"],["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"]]),_T=/^[\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 Kc(r){return _T.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function La(){}var Fh=null;function Hh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ol=null,ul=null;function Ib(r){var i=me(r);if(i&&(r=i.stateNode)){var u=r[Zt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Uh(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Hr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[Zt]||null;if(!y)throw Error(a(90));Uh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)d=u[i],d.form===r.form&&Ab(d)}break e;case"textarea":Ob(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&sl(r,!!u.multiple,i,!1)}}}var qh=!1;function Lb(r,i,u){if(qh)return r(i,u);qh=!0;try{var d=r(i);return d}finally{if(qh=!1,(ol!==null||ul!==null)&&(Id(),ol&&(i=ol,r=ul,ul=ol=null,Ib(i),r)))for(i=0;i<r.length;i++)Ib(r[i])}}function $o(r,i){var u=r.stateNode;if(u===null)return null;var d=u[Zt]||null;if(d===null)return null;u=d[i];e:switch(i){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)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var Pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zh=!1;if(Pa)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){Zh=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{Zh=!1}var yi=null,Gh=null,Yc=null;function Pb(){if(Yc)return Yc;var r,i=Gh,u=i.length,d,y="value"in yi?yi.value:yi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var j=u-r;for(d=1;d<=j&&i[u-d]===y[v-d];d++);return Yc=y.slice(r,1<d?1-d:void 0)}function Xc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Wc(){return!0}function Ub(){return!1}function hr(r){function i(u,d,y,v,j){this._reactName=u,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=j,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(u=r[A],this[A]=u?u(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Wc:Ub,this.isPropagationStopped=Ub,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Wc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Wc)},persist:function(){},isPersistent:Wc}),i}var ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jc=hr(ys),Ho=g({},ys,{view:0,detail:0}),TT=hr(Ho),Vh,Qh,qo,ed=g({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==qo&&(qo&&r.type==="mousemove"?(Vh=r.screenX-qo.screenX,Qh=r.screenY-qo.screenY):Qh=Vh=0,qo=r),Vh)},movementY:function(r){return"movementY"in r?r.movementY:Qh}}),Bb=hr(ed),AT=g({},ed,{dataTransfer:0}),RT=hr(AT),OT=g({},Ho,{relatedTarget:0}),Kh=hr(OT),zT=g({},ys,{animationName:0,elapsedTime:0,pseudoElement:0}),MT=hr(zT),DT=g({},ys,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),IT=hr(DT),LT=g({},ys,{data:0}),$b=hr(LT),PT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},UT={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"},BT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $T(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=BT[r])?!!i[r]:!1}function Yh(){return $T}var FT=g({},Ho,{key:function(r){if(r.key){var i=PT[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Xc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?UT[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yh,charCode:function(r){return r.type==="keypress"?Xc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),HT=hr(FT),qT=g({},ed,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fb=hr(qT),ZT=g({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yh}),GT=hr(ZT),VT=g({},ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),QT=hr(VT),KT=g({},ed,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),YT=hr(KT),XT=g({},ys,{newState:0,oldState:0}),WT=hr(XT),JT=[9,13,27,32],Xh=Pa&&"CompositionEvent"in window,Zo=null;Pa&&"documentMode"in document&&(Zo=document.documentMode);var eA=Pa&&"TextEvent"in window&&!Zo,Hb=Pa&&(!Xh||Zo&&8<Zo&&11>=Zo),qb=" ",Zb=!1;function Gb(r,i){switch(r){case"keyup":return JT.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var cl=!1;function tA(r,i){switch(r){case"compositionend":return Vb(i);case"keypress":return i.which!==32?null:(Zb=!0,qb);case"textInput":return r=i.data,r===qb&&Zb?null:r;default:return null}}function nA(r,i){if(cl)return r==="compositionend"||!Xh&&Gb(r,i)?(r=Pb(),Yc=Gh=yi=null,cl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Hb&&i.locale!=="ko"?null:i.data;default:return null}}var rA={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 Qb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!rA[r.type]:i==="textarea"}function Kb(r,i,u,d){ol?ul?ul.push(d):ul=[d]:ol=d,i=Hd(i,"onChange"),0<i.length&&(u=new Jc("onChange","change",null,u,d),r.push({event:u,listeners:i}))}var Go=null,Vo=null;function aA(r){Rw(r,0)}function td(r){var i=Ne(r);if(Ab(i))return r}function Yb(r,i){if(r==="change")return i}var Xb=!1;if(Pa){var Wh;if(Pa){var Jh="oninput"in document;if(!Jh){var Wb=document.createElement("div");Wb.setAttribute("oninput","return;"),Jh=typeof Wb.oninput=="function"}Wh=Jh}else Wh=!1;Xb=Wh&&(!document.documentMode||9<document.documentMode)}function Jb(){Go&&(Go.detachEvent("onpropertychange",ex),Vo=Go=null)}function ex(r){if(r.propertyName==="value"&&td(Vo)){var i=[];Kb(i,Vo,r,Hh(r)),Lb(aA,i)}}function iA(r,i,u){r==="focusin"?(Jb(),Go=i,Vo=u,Go.attachEvent("onpropertychange",ex)):r==="focusout"&&Jb()}function sA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return td(Vo)}function lA(r,i){if(r==="click")return td(i)}function oA(r,i){if(r==="input"||r==="change")return td(i)}function uA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Tr=typeof Object.is=="function"?Object.is:uA;function Qo(r,i){if(Tr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var u=Object.keys(r),d=Object.keys(i);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var y=u[d];if(!Ft.call(i,y)||!Tr(r[y],i[y]))return!1}return!0}function tx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function nx(r,i){var u=tx(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=i&&d>=i)return{node:u,offset:i-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=tx(u)}}function rx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?rx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function ax(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Qc(r.document);i instanceof r.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)r=i.contentWindow;else break;i=Qc(r.document)}return i}function em(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var cA=Pa&&"documentMode"in document&&11>=document.documentMode,dl=null,tm=null,Ko=null,nm=!1;function ix(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;nm||dl==null||dl!==Qc(d)||(d=dl,"selectionStart"in d&&em(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}),Ko&&Qo(Ko,d)||(Ko=d,d=Hd(tm,"onSelect"),0<d.length&&(i=new Jc("onSelect","select",null,i,u),r.push({event:i,listeners:d}),i.target=dl)))}function vs(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var fl={animationend:vs("Animation","AnimationEnd"),animationiteration:vs("Animation","AnimationIteration"),animationstart:vs("Animation","AnimationStart"),transitionrun:vs("Transition","TransitionRun"),transitionstart:vs("Transition","TransitionStart"),transitioncancel:vs("Transition","TransitionCancel"),transitionend:vs("Transition","TransitionEnd")},rm={},sx={};Pa&&(sx=document.createElement("div").style,"AnimationEvent"in window||(delete fl.animationend.animation,delete fl.animationiteration.animation,delete fl.animationstart.animation),"TransitionEvent"in window||delete fl.transitionend.transition);function bs(r){if(rm[r])return rm[r];if(!fl[r])return r;var i=fl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in sx)return rm[r]=i[u];return r}var lx=bs("animationend"),ox=bs("animationiteration"),ux=bs("animationstart"),dA=bs("transitionrun"),fA=bs("transitionstart"),hA=bs("transitioncancel"),cx=bs("transitionend"),dx=new Map,am="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");am.push("scrollEnd");function ha(r,i){dx.set(r,i),yn(i,[r])}var nd=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},qr=[],hl=0,im=0;function rd(){for(var r=hl,i=im=hl=0;i<r;){var u=qr[i];qr[i++]=null;var d=qr[i];qr[i++]=null;var y=qr[i];qr[i++]=null;var v=qr[i];if(qr[i++]=null,d!==null&&y!==null){var j=d.pending;j===null?y.next=y:(y.next=j.next,j.next=y),d.pending=y}v!==0&&fx(u,y,v)}}function ad(r,i,u,d){qr[hl++]=r,qr[hl++]=i,qr[hl++]=u,qr[hl++]=d,im|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function sm(r,i,u,d){return ad(r,i,u,d),id(r)}function xs(r,i){return ad(r,null,null,i),id(r)}function fx(r,i,u){r.lanes|=u;var d=r.alternate;d!==null&&(d.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,d=v.alternate,d!==null&&(d.childLanes|=u),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-at(u),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=u|536870912),v):null}function id(r){if(50<yu)throw yu=0,pp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var ml={};function mA(r,i,u,d){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,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 Ar(r,i,u,d){return new mA(r,i,u,d)}function lm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ua(r,i){var u=r.alternate;return u===null?(u=Ar(r.tag,i,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=i,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,i=r.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function hx(r,i){r.flags&=65011714;var u=r.alternate;return u===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,i=u.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function sd(r,i,u,d,y,v){var j=0;if(d=r,typeof r=="function")lm(r)&&(j=1);else if(typeof r=="string")j=b2(r,u,Z.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case V:return r=Ar(31,u,i,y),r.elementType=V,r.lanes=v,r;case k:return ws(u.children,y,v,i);case E:j=8,y|=24;break;case C:return r=Ar(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case L:return r=Ar(13,u,i,y),r.elementType=L,r.lanes=v,r;case R:return r=Ar(19,u,i,y),r.elementType=R,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:j=10;break e;case N:j=9;break e;case z:j=11;break e;case $:j=14;break e;case U:j=16,d=null;break e}j=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Ar(j,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function ws(r,i,u,d){return r=Ar(7,r,d,i),r.lanes=u,r}function om(r,i,u){return r=Ar(6,r,null,i),r.lanes=u,r}function mx(r){var i=Ar(18,null,null,0);return i.stateNode=r,i}function um(r,i,u){return i=Ar(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var px=new WeakMap;function Zr(r,i){if(typeof r=="object"&&r!==null){var u=px.get(r);return u!==void 0?u:(i={value:r,source:i,stack:zt(i)},px.set(r,i),i)}return{value:r,source:i,stack:zt(i)}}var pl=[],gl=0,ld=null,Yo=0,Gr=[],Vr=0,vi=null,Sa=1,ka="";function Ba(r,i){pl[gl++]=Yo,pl[gl++]=ld,ld=r,Yo=i}function gx(r,i,u){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,vi=r;var d=Sa;r=ka;var y=32-at(d)-1;d&=~(1<<y),u+=1;var v=32-at(i)+y;if(30<v){var j=y-y%5;v=(d&(1<<j)-1).toString(32),d>>=j,y-=j,Sa=1<<32-at(i)+y|u<<y|d,ka=v+r}else Sa=1<<v|u<<y|d,ka=r}function cm(r){r.return!==null&&(Ba(r,1),gx(r,1,0))}function dm(r){for(;r===ld;)ld=pl[--gl],pl[gl]=null,Yo=pl[--gl],pl[gl]=null;for(;r===vi;)vi=Gr[--Vr],Gr[Vr]=null,ka=Gr[--Vr],Gr[Vr]=null,Sa=Gr[--Vr],Gr[Vr]=null}function yx(r,i){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,Sa=i.id,ka=i.overflow,vi=r}var Un=null,Bt=null,ht=!1,bi=null,Qr=!1,fm=Error(a(519));function xi(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xo(Zr(i,r)),fm}function vx(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[cn]=r,i[Zt]=d,u){case"dialog":st("cancel",i),st("close",i);break;case"iframe":case"object":case"embed":st("load",i);break;case"video":case"audio":for(u=0;u<bu.length;u++)st(bu[u],i);break;case"source":st("error",i);break;case"img":case"image":case"link":st("error",i),st("load",i);break;case"details":st("toggle",i);break;case"input":st("invalid",i),Rb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":st("invalid",i);break;case"textarea":st("invalid",i),zb(i,d.value,d.defaultValue,d.children)}u=d.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||d.suppressHydrationWarning===!0||Dw(i.textContent,u)?(d.popover!=null&&(st("beforetoggle",i),st("toggle",i)),d.onScroll!=null&&st("scroll",i),d.onScrollEnd!=null&&st("scrollend",i),d.onClick!=null&&(i.onclick=La),i=!0):i=!1,i||xi(r,!0)}function bx(r){for(Un=r.return;Un;)switch(Un.tag){case 5:case 31:case 13:Qr=!1;return;case 27:case 3:Qr=!0;return;default:Un=Un.return}}function yl(r){if(r!==Un)return!1;if(!ht)return bx(r),ht=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Ap(r.type,r.memoizedProps)),u=!u),u&&Bt&&xi(r),bx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=qw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=qw(r)}else i===27?(i=Bt,Mi(r.type)?(r=Dp,Dp=null,Bt=r):Bt=i):Bt=Un?Yr(r.stateNode.nextSibling):null;return!0}function Ss(){Bt=Un=null,ht=!1}function hm(){var r=bi;return r!==null&&(yr===null?yr=r:yr.push.apply(yr,r),bi=null),r}function Xo(r){bi===null?bi=[r]:bi.push(r)}var mm=I(null),ks=null,$a=null;function wi(r,i,u){_(mm,i._currentValue),i._currentValue=u}function Fa(r){r._currentValue=mm.current,P(mm)}function pm(r,i,u){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===u)break;r=r.return}}function gm(r,i,u,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var j=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var H=0;H<i.length;H++)if(A.context===i[H]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),pm(v.return,u,r),d||(j=null);break e}v=A.next}}else if(y.tag===18){if(j=y.return,j===null)throw Error(a(341));j.lanes|=u,v=j.alternate,v!==null&&(v.lanes|=u),pm(j,u,r),j=null}else j=y.child;if(j!==null)j.return=y;else for(j=y;j!==null;){if(j===r){j=null;break}if(y=j.sibling,y!==null){y.return=j.return,j=y;break}j=j.return}y=j}}function vl(r,i,u,d){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var j=y.alternate;if(j===null)throw Error(a(387));if(j=j.memoizedProps,j!==null){var A=y.type;Tr(y.pendingProps.value,j.value)||(r!==null?r.push(A):r=[A])}}else if(y===je.current){if(j=y.alternate,j===null)throw Error(a(387));j.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(ju):r=[ju])}y=y.return}r!==null&&gm(i,r,u,d),i.flags|=262144}function od(r){for(r=r.firstContext;r!==null;){if(!Tr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function js(r){ks=r,$a=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return xx(ks,r)}function ud(r,i){return ks===null&&js(r),xx(r,i)}function xx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},$a===null){if(r===null)throw Error(a(308));$a=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else $a=$a.next=i;return u}var pA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},gA=e.unstable_scheduleCallback,yA=e.unstable_NormalPriority,vn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ym(){return{controller:new pA,data:new Map,refCount:0}}function Wo(r){r.refCount--,r.refCount===0&&gA(yA,function(){r.controller.abort()})}var Jo=null,vm=0,bl=0,xl=null;function vA(r,i){if(Jo===null){var u=Jo=[];vm=0,bl=wp(),xl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return vm++,i.then(wx,wx),i}function wx(){if(--vm===0&&Jo!==null){xl!==null&&(xl.status="fulfilled");var r=Jo;Jo=null,bl=0,xl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function bA(r,i){var u=[],d={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),d}var Sx=q.S;q.S=function(r,i){iw=on(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&vA(r,i),Sx!==null&&Sx(r,i)};var Cs=I(null);function bm(){var r=Cs.current;return r!==null?r:Mt.pooledCache}function cd(r,i){i===null?_(Cs,Cs.current):_(Cs,i.pool)}function kx(){var r=bm();return r===null?null:{parent:vn._currentValue,pool:r}}var wl=Error(a(460)),xm=Error(a(474)),dd=Error(a(542)),fd={then:function(){}};function jx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Cx(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(La,La),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Nx(r),r;default:if(typeof i.status=="string")i.then(La,La);else{if(r=Mt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Nx(r),r}throw Ns=i,wl}}function Es(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ns=u,wl):u}}var Ns=null;function Ex(){if(Ns===null)throw Error(a(459));var r=Ns;return Ns=null,r}function Nx(r){if(r===wl||r===dd)throw Error(a(483))}var Sl=null,eu=0;function hd(r){var i=eu;return eu+=1,Sl===null&&(Sl=[]),Cx(Sl,r,i)}function tu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function md(r,i){throw i.$$typeof===x?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function _x(r){function i(K,G){if(r){var W=K.deletions;W===null?(K.deletions=[G],K.flags|=16):W.push(G)}}function u(K,G){if(!r)return null;for(;G!==null;)i(K,G),G=G.sibling;return null}function d(K){for(var G=new Map;K!==null;)K.key!==null?G.set(K.key,K):G.set(K.index,K),K=K.sibling;return G}function y(K,G){return K=Ua(K,G),K.index=0,K.sibling=null,K}function v(K,G,W){return K.index=W,r?(W=K.alternate,W!==null?(W=W.index,W<G?(K.flags|=67108866,G):W):(K.flags|=67108866,G)):(K.flags|=1048576,G)}function j(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function A(K,G,W,fe){return G===null||G.tag!==6?(G=om(W,K.mode,fe),G.return=K,G):(G=y(G,W),G.return=K,G)}function H(K,G,W,fe){var Be=W.type;return Be===k?ce(K,G,W.props.children,fe,W.key):G!==null&&(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Es(Be)===G.type)?(G=y(G,W.props),tu(G,W),G.return=K,G):(G=sd(W.type,W.key,W.props,null,K.mode,fe),tu(G,W),G.return=K,G)}function ee(K,G,W,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==W.containerInfo||G.stateNode.implementation!==W.implementation?(G=um(W,K.mode,fe),G.return=K,G):(G=y(G,W.children||[]),G.return=K,G)}function ce(K,G,W,fe,Be){return G===null||G.tag!==7?(G=ws(W,K.mode,fe,Be),G.return=K,G):(G=y(G,W),G.return=K,G)}function he(K,G,W){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=om(""+G,K.mode,W),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return W=sd(G.type,G.key,G.props,null,K.mode,W),tu(W,G),W.return=K,W;case S:return G=um(G,K.mode,W),G.return=K,G;case U:return G=Es(G),he(K,G,W)}if(X(G)||ae(G))return G=ws(G,K.mode,W,null),G.return=K,G;if(typeof G.then=="function")return he(K,hd(G),W);if(G.$$typeof===O)return he(K,ud(K,G),W);md(K,G)}return null}function ne(K,G,W,fe){var Be=G!==null?G.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Be!==null?null:A(K,G,""+W,fe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return W.key===Be?H(K,G,W,fe):null;case S:return W.key===Be?ee(K,G,W,fe):null;case U:return W=Es(W),ne(K,G,W,fe)}if(X(W)||ae(W))return Be!==null?null:ce(K,G,W,fe,null);if(typeof W.then=="function")return ne(K,G,hd(W),fe);if(W.$$typeof===O)return ne(K,G,ud(K,W),fe);md(K,W)}return null}function le(K,G,W,fe,Be){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return K=K.get(W)||null,A(G,K,""+fe,Be);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return K=K.get(fe.key===null?W:fe.key)||null,H(G,K,fe,Be);case S:return K=K.get(fe.key===null?W:fe.key)||null,ee(G,K,fe,Be);case U:return fe=Es(fe),le(K,G,W,fe,Be)}if(X(fe)||ae(fe))return K=K.get(W)||null,ce(G,K,fe,Be,null);if(typeof fe.then=="function")return le(K,G,W,hd(fe),Be);if(fe.$$typeof===O)return le(K,G,W,ud(G,fe),Be);md(G,fe)}return null}function Te(K,G,W,fe){for(var Be=null,St=null,Me=G,Xe=G=0,ct=null;Me!==null&&Xe<W.length;Xe++){Me.index>Xe?(ct=Me,Me=null):ct=Me.sibling;var kt=ne(K,Me,W[Xe],fe);if(kt===null){Me===null&&(Me=ct);break}r&&Me&&kt.alternate===null&&i(K,Me),G=v(kt,G,Xe),St===null?Be=kt:St.sibling=kt,St=kt,Me=ct}if(Xe===W.length)return u(K,Me),ht&&Ba(K,Xe),Be;if(Me===null){for(;Xe<W.length;Xe++)Me=he(K,W[Xe],fe),Me!==null&&(G=v(Me,G,Xe),St===null?Be=Me:St.sibling=Me,St=Me);return ht&&Ba(K,Xe),Be}for(Me=d(Me);Xe<W.length;Xe++)ct=le(Me,K,Xe,W[Xe],fe),ct!==null&&(r&&ct.alternate!==null&&Me.delete(ct.key===null?Xe:ct.key),G=v(ct,G,Xe),St===null?Be=ct:St.sibling=ct,St=ct);return r&&Me.forEach(function(Ui){return i(K,Ui)}),ht&&Ba(K,Xe),Be}function He(K,G,W,fe){if(W==null)throw Error(a(151));for(var Be=null,St=null,Me=G,Xe=G=0,ct=null,kt=W.next();Me!==null&&!kt.done;Xe++,kt=W.next()){Me.index>Xe?(ct=Me,Me=null):ct=Me.sibling;var Ui=ne(K,Me,kt.value,fe);if(Ui===null){Me===null&&(Me=ct);break}r&&Me&&Ui.alternate===null&&i(K,Me),G=v(Ui,G,Xe),St===null?Be=Ui:St.sibling=Ui,St=Ui,Me=ct}if(kt.done)return u(K,Me),ht&&Ba(K,Xe),Be;if(Me===null){for(;!kt.done;Xe++,kt=W.next())kt=he(K,kt.value,fe),kt!==null&&(G=v(kt,G,Xe),St===null?Be=kt:St.sibling=kt,St=kt);return ht&&Ba(K,Xe),Be}for(Me=d(Me);!kt.done;Xe++,kt=W.next())kt=le(Me,K,Xe,kt.value,fe),kt!==null&&(r&&kt.alternate!==null&&Me.delete(kt.key===null?Xe:kt.key),G=v(kt,G,Xe),St===null?Be=kt:St.sibling=kt,St=kt);return r&&Me.forEach(function(A2){return i(K,A2)}),ht&&Ba(K,Xe),Be}function Ot(K,G,W,fe){if(typeof W=="object"&&W!==null&&W.type===k&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case w:e:{for(var Be=W.key;G!==null;){if(G.key===Be){if(Be=W.type,Be===k){if(G.tag===7){u(K,G.sibling),fe=y(G,W.props.children),fe.return=K,K=fe;break e}}else if(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===U&&Es(Be)===G.type){u(K,G.sibling),fe=y(G,W.props),tu(fe,W),fe.return=K,K=fe;break e}u(K,G);break}else i(K,G);G=G.sibling}W.type===k?(fe=ws(W.props.children,K.mode,fe,W.key),fe.return=K,K=fe):(fe=sd(W.type,W.key,W.props,null,K.mode,fe),tu(fe,W),fe.return=K,K=fe)}return j(K);case S:e:{for(Be=W.key;G!==null;){if(G.key===Be)if(G.tag===4&&G.stateNode.containerInfo===W.containerInfo&&G.stateNode.implementation===W.implementation){u(K,G.sibling),fe=y(G,W.children||[]),fe.return=K,K=fe;break e}else{u(K,G);break}else i(K,G);G=G.sibling}fe=um(W,K.mode,fe),fe.return=K,K=fe}return j(K);case U:return W=Es(W),Ot(K,G,W,fe)}if(X(W))return Te(K,G,W,fe);if(ae(W)){if(Be=ae(W),typeof Be!="function")throw Error(a(150));return W=Be.call(W),He(K,G,W,fe)}if(typeof W.then=="function")return Ot(K,G,hd(W),fe);if(W.$$typeof===O)return Ot(K,G,ud(K,W),fe);md(K,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,G!==null&&G.tag===6?(u(K,G.sibling),fe=y(G,W),fe.return=K,K=fe):(u(K,G),fe=om(W,K.mode,fe),fe.return=K,K=fe),j(K)):u(K,G)}return function(K,G,W,fe){try{eu=0;var Be=Ot(K,G,W,fe);return Sl=null,Be}catch(Me){if(Me===wl||Me===dd)throw Me;var St=Ar(29,Me,null,K.mode);return St.lanes=fe,St.return=K,St}finally{}}}var _s=_x(!0),Tx=_x(!1),Si=!1;function wm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sm(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ki(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ji(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(jt&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=id(r),fx(r,null,u),i}return ad(r,d,i,u),id(r)}function nu(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,gs(r,u)}}function km(r,i){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var j={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=j:v=v.next=j,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var jm=!1;function ru(){if(jm){var r=xl;if(r!==null)throw r}}function au(r,i,u,d){jm=!1;var y=r.updateQueue;Si=!1;var v=y.firstBaseUpdate,j=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,ee=H.next;H.next=null,j===null?v=ee:j.next=ee,j=H;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==j&&(A===null?ce.firstBaseUpdate=ee:A.next=ee,ce.lastBaseUpdate=H))}if(v!==null){var he=y.baseState;j=0,ce=ee=H=null,A=v;do{var ne=A.lane&-536870913,le=ne!==A.lane;if(le?(ut&ne)===ne:(d&ne)===ne){ne!==0&&ne===bl&&(jm=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Te=r,He=A;ne=i;var Ot=u;switch(He.tag){case 1:if(Te=He.payload,typeof Te=="function"){he=Te.call(Ot,he,ne);break e}he=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=He.payload,ne=typeof Te=="function"?Te.call(Ot,he,ne):Te,ne==null)break e;he=g({},he,ne);break e;case 2:Si=!0}}ne=A.callback,ne!==null&&(r.flags|=64,le&&(r.flags|=8192),le=y.callbacks,le===null?y.callbacks=[ne]:le.push(ne))}else le={lane:ne,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(ee=ce=le,H=he):ce=ce.next=le,j|=ne;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;le=A,A=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);ce===null&&(H=he),y.baseState=H,y.firstBaseUpdate=ee,y.lastBaseUpdate=ce,v===null&&(y.shared.lanes=0),Ti|=j,r.lanes=j,r.memoizedState=he}}function Ax(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Rx(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Ax(u[r],i)}var kl=I(null),pd=I(0);function Ox(r,i){r=Xa,_(pd,r),_(kl,i),Xa=r|i.baseLanes}function Cm(){_(pd,Xa),_(kl,kl.current)}function Em(){Xa=pd.current,P(kl),P(pd)}var Rr=I(null),Kr=null;function Ci(r){var i=r.alternate;_(fn,fn.current&1),_(Rr,r),Kr===null&&(i===null||kl.current!==null||i.memoizedState!==null)&&(Kr=r)}function Nm(r){_(fn,fn.current),_(Rr,r),Kr===null&&(Kr=r)}function zx(r){r.tag===22?(_(fn,fn.current),_(Rr,r),Kr===null&&(Kr=r)):Ei()}function Ei(){_(fn,fn.current),_(Rr,Rr.current)}function Or(r){P(Rr),Kr===r&&(Kr=null),P(fn)}var fn=I(0);function gd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||zp(u)||Mp(u)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ha=0,Ke=null,At=null,bn=null,yd=!1,jl=!1,Ts=!1,vd=0,iu=0,Cl=null,xA=0;function tn(){throw Error(a(321))}function _m(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!Tr(r[u],i[u]))return!1;return!0}function Tm(r,i,u,d,y,v){return Ha=v,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?g0:qm,Ts=!1,v=u(d,y),Ts=!1,jl&&(v=Dx(i,u,d,y)),Mx(r),v}function Mx(r){q.H=ou;var i=At!==null&&At.next!==null;if(Ha=0,bn=At=Ke=null,yd=!1,iu=0,Cl=null,i)throw Error(a(300));r===null||xn||(r=r.dependencies,r!==null&&od(r)&&(xn=!0))}function Dx(r,i,u,d){Ke=r;var y=0;do{if(jl&&(Cl=null),iu=0,jl=!1,25<=y)throw Error(a(301));if(y+=1,bn=At=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}q.H=y0,v=i(u,d)}while(jl);return v}function wA(){var r=q.H,i=r.useState()[0];return i=typeof i.then=="function"?su(i):i,r=r.useState()[0],(At!==null?At.memoizedState:null)!==r&&(Ke.flags|=1024),i}function Am(){var r=vd!==0;return vd=0,r}function Rm(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function Om(r){if(yd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}yd=!1}Ha=0,bn=At=Ke=null,jl=!1,iu=vd=0,Cl=null}function ar(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?Ke.memoizedState=bn=r:bn=bn.next=r,bn}function hn(){if(At===null){var r=Ke.alternate;r=r!==null?r.memoizedState:null}else r=At.next;var i=bn===null?Ke.memoizedState:bn.next;if(i!==null)bn=i,At=r;else{if(r===null)throw Ke.alternate===null?Error(a(467)):Error(a(310));At=r,r={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},bn===null?Ke.memoizedState=bn=r:bn=bn.next=r}return bn}function bd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function su(r){var i=iu;return iu+=1,Cl===null&&(Cl=[]),r=Cx(Cl,r,i),i=Ke,(bn===null?i.memoizedState:bn.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?g0:qm),r}function xd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return su(r);if(r.$$typeof===O)return Bn(r)}throw Error(a(438,String(r)))}function zm(r){var i=null,u=Ke.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=bd(),Ke.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),d=0;d<r;d++)u[d]=D;return i.index++,u}function qa(r,i){return typeof i=="function"?i(r):i}function wd(r){var i=hn();return Mm(i,At,r)}function Mm(r,i,u){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=u;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var j=y.next;y.next=v.next,v.next=j}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=j=null,H=null,ee=i,ce=!1;do{var he=ee.lane&-536870913;if(he!==ee.lane?(ut&he)===he:(Ha&he)===he){var ne=ee.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),he===bl&&(ce=!0);else if((Ha&ne)===ne){ee=ee.next,ne===bl&&(ce=!0);continue}else he={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=he,j=v):H=H.next=he,Ke.lanes|=ne,Ti|=ne;he=ee.action,Ts&&u(v,he),v=ee.hasEagerState?ee.eagerState:u(v,he)}else ne={lane:he,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=ne,j=v):H=H.next=ne,Ke.lanes|=he,Ti|=he;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?j=v:H.next=A,!Tr(v,r.memoizedState)&&(xn=!0,ce&&(u=xl,u!==null)))throw u;r.memoizedState=v,r.baseState=j,r.baseQueue=H,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Dm(r){var i=hn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var j=y=y.next;do v=r(v,j.action),j=j.next;while(j!==y);Tr(v,i.memoizedState)||(xn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function Ix(r,i,u){var d=Ke,y=hn(),v=ht;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var j=!Tr((At||y).memoizedState,u);if(j&&(y.memoizedState=u,xn=!0),y=y.queue,Pm(Ux.bind(null,d,y,r),[r]),y.getSnapshot!==i||j||bn!==null&&bn.memoizedState.tag&1){if(d.flags|=2048,El(9,{destroy:void 0},Px.bind(null,d,y,u,i),null),Mt===null)throw Error(a(349));v||(Ha&127)!==0||Lx(d,i,u)}return u}function Lx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Ke.updateQueue,i===null?(i=bd(),Ke.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Px(r,i,u,d){i.value=u,i.getSnapshot=d,Bx(i)&&$x(r)}function Ux(r,i,u){return u(function(){Bx(i)&&$x(r)})}function Bx(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!Tr(r,u)}catch{return!0}}function $x(r){var i=xs(r,2);i!==null&&vr(i,r,2)}function Im(r){var i=ar();if(typeof r=="function"){var u=r;if(r=u(),Ts){Tt(!0);try{u()}finally{Tt(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:r},i}function Fx(r,i,u,d){return r.baseState=u,Mm(r,At,typeof d=="function"?d:qa)}function SA(r,i,u,d,y){if(jd(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){v.listeners.push(j)}};q.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,Hx(i,v)):(v.next=u.next,i.pending=u.next=v)}}function Hx(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=q.T,j={};q.T=j;try{var A=u(y,d),H=q.S;H!==null&&H(j,A),qx(r,i,A)}catch(ee){Lm(r,i,ee)}finally{v!==null&&j.types!==null&&(v.types=j.types),q.T=v}}else try{v=u(y,d),qx(r,i,v)}catch(ee){Lm(r,i,ee)}}function qx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){Zx(r,i,d)},function(d){return Lm(r,i,d)}):Zx(r,i,u)}function Zx(r,i,u){i.status="fulfilled",i.value=u,Gx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,Hx(r,u)))}function Lm(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,Gx(i),i=i.next;while(i!==d)}r.action=null}function Gx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Vx(r,i){return i}function Qx(r,i){if(ht){var u=Mt.formState;if(u!==null){e:{var d=Ke;if(ht){if(Bt){t:{for(var y=Bt,v=Qr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Yr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Bt=Yr(y.nextSibling),d=y.data==="F!";break e}}xi(d)}d=!1}d&&(i=u[0])}}return u=ar(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vx,lastRenderedState:i},u.queue=d,u=h0.bind(null,Ke,d),d.dispatch=u,d=Im(!1),v=Hm.bind(null,Ke,!1,d.queue),d=ar(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=SA.bind(null,Ke,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function Kx(r){var i=hn();return Yx(i,At,r)}function Yx(r,i,u){if(i=Mm(r,i,Vx)[0],r=wd(qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=su(i)}catch(j){throw j===wl?dd:j}else d=i;i=hn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Ke.flags|=2048,El(9,{destroy:void 0},kA.bind(null,y,u),null)),[d,v,r]}function kA(r,i){r.action=i}function Xx(r){var i=hn(),u=At;if(u!==null)return Yx(i,u,r);hn(),i=i.memoizedState,u=hn();var d=u.queue.dispatch;return u.memoizedState=r,[i,d,!1]}function El(r,i,u,d){return r={tag:r,create:u,deps:d,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=bd(),Ke.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,i.lastEffect=r),r}function Wx(){return hn().memoizedState}function Sd(r,i,u,d){var y=ar();Ke.flags|=r,y.memoizedState=El(1|i,{destroy:void 0},u,d===void 0?null:d)}function kd(r,i,u,d){var y=hn();d=d===void 0?null:d;var v=y.memoizedState.inst;At!==null&&d!==null&&_m(d,At.memoizedState.deps)?y.memoizedState=El(i,v,u,d):(Ke.flags|=r,y.memoizedState=El(1|i,v,u,d))}function Jx(r,i){Sd(8390656,8,r,i)}function Pm(r,i){kd(2048,8,r,i)}function jA(r){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=bd(),Ke.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function e0(r){var i=hn().memoizedState;return jA({ref:i,nextImpl:r}),function(){if((jt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function t0(r,i){return kd(4,2,r,i)}function n0(r,i){return kd(4,4,r,i)}function r0(r,i){if(typeof i=="function"){r=r();var u=i(r);return function(){typeof u=="function"?u():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function a0(r,i,u){u=u!=null?u.concat([r]):null,kd(4,4,r0.bind(null,i,r),u)}function Um(){}function i0(r,i){var u=hn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&_m(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function s0(r,i){var u=hn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&_m(i,d[1]))return d[0];if(d=r(),Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[d,i],d}function Bm(r,i,u){return u===void 0||(Ha&1073741824)!==0&&(ut&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=lw(),Ke.lanes|=r,Ti|=r,u)}function l0(r,i,u,d){return Tr(u,i)?u:kl.current!==null?(r=Bm(r,u,d),Tr(r,i)||(xn=!0),r):(Ha&42)===0||(Ha&1073741824)!==0&&(ut&261930)===0?(xn=!0,r.memoizedState=u):(r=lw(),Ke.lanes|=r,Ti|=r,i)}function o0(r,i,u,d,y){var v=te.p;te.p=v!==0&&8>v?v:8;var j=q.T,A={};q.T=A,Hm(r,!1,i,u);try{var H=y(),ee=q.S;if(ee!==null&&ee(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=bA(H,d);lu(r,i,ce,Dr(r))}else lu(r,i,d,Dr(r))}catch(he){lu(r,i,{then:function(){},status:"rejected",reason:he},Dr())}finally{te.p=v,j!==null&&A.types!==null&&(j.types=A.types),q.T=j}}function CA(){}function $m(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=u0(r).queue;o0(r,y,i,ke,u===null?CA:function(){return c0(r),u(d)})}function u0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ke,baseState:ke,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:ke},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function c0(r){var i=u0(r);i.next===null&&(i=r.alternate.memoizedState),lu(r,i.next.queue,{},Dr())}function Fm(){return Bn(ju)}function d0(){return hn().memoizedState}function f0(){return hn().memoizedState}function EA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Dr();r=ki(u);var d=ji(i,r,u);d!==null&&(vr(d,i,u),nu(d,i,u)),i={cache:ym()},r.payload=i;return}i=i.return}}function NA(r,i,u){var d=Dr();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},jd(r)?m0(i,u):(u=sm(r,i,u,d),u!==null&&(vr(u,r,d),p0(u,i,d)))}function h0(r,i,u){var d=Dr();lu(r,i,u,d)}function lu(r,i,u,d){var y={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(jd(r))m0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var j=i.lastRenderedState,A=v(j,u);if(y.hasEagerState=!0,y.eagerState=A,Tr(A,j))return ad(r,i,y,0),Mt===null&&rd(),!1}catch{}finally{}if(u=sm(r,i,y,d),u!==null)return vr(u,r,d),p0(u,i,d),!0}return!1}function Hm(r,i,u,d){if(d={lane:2,revertLane:wp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},jd(r)){if(i)throw Error(a(479))}else i=sm(r,u,d,2),i!==null&&vr(i,r,2)}function jd(r){var i=r.alternate;return r===Ke||i!==null&&i===Ke}function m0(r,i){jl=yd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function p0(r,i,u){if((u&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,gs(r,u)}}var ou={readContext:Bn,use:xd,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn};ou.useEffectEvent=tn;var g0={readContext:Bn,use:xd,useCallback:function(r,i){return ar().memoizedState=[r,i===void 0?null:i],r},useContext:Bn,useEffect:Jx,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,Sd(4194308,4,r0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return Sd(4194308,4,r,i)},useInsertionEffect:function(r,i){Sd(4,2,r,i)},useMemo:function(r,i){var u=ar();i=i===void 0?null:i;var d=r();if(Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=ar();if(u!==void 0){var y=u(i);if(Ts){Tt(!0);try{u(i)}finally{Tt(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=NA.bind(null,Ke,r),[d.memoizedState,r]},useRef:function(r){var i=ar();return r={current:r},i.memoizedState=r},useState:function(r){r=Im(r);var i=r.queue,u=h0.bind(null,Ke,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Um,useDeferredValue:function(r,i){var u=ar();return Bm(u,r,i)},useTransition:function(){var r=Im(!1);return r=o0.bind(null,Ke,r.queue,!0,!1),ar().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=Ke,y=ar();if(ht){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Mt===null)throw Error(a(349));(ut&127)!==0||Lx(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,Jx(Ux.bind(null,d,v,r),[r]),d.flags|=2048,El(9,{destroy:void 0},Px.bind(null,d,v,u,i),null),u},useId:function(){var r=ar(),i=Mt.identifierPrefix;if(ht){var u=ka,d=Sa;u=(d&~(1<<32-at(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=vd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=xA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Fm,useFormState:Qx,useActionState:Qx,useOptimistic:function(r){var i=ar();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=Hm.bind(null,Ke,!0,u),u.dispatch=i,[r,i]},useMemoCache:zm,useCacheRefresh:function(){return ar().memoizedState=EA.bind(null,Ke)},useEffectEvent:function(r){var i=ar(),u={impl:r};return i.memoizedState=u,function(){if((jt&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},qm={readContext:Bn,use:xd,useCallback:i0,useContext:Bn,useEffect:Pm,useImperativeHandle:a0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:s0,useReducer:wd,useRef:Wx,useState:function(){return wd(qa)},useDebugValue:Um,useDeferredValue:function(r,i){var u=hn();return l0(u,At.memoizedState,r,i)},useTransition:function(){var r=wd(qa)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Ix,useId:d0,useHostTransitionStatus:Fm,useFormState:Kx,useActionState:Kx,useOptimistic:function(r,i){var u=hn();return Fx(u,At,r,i)},useMemoCache:zm,useCacheRefresh:f0};qm.useEffectEvent=e0;var y0={readContext:Bn,use:xd,useCallback:i0,useContext:Bn,useEffect:Pm,useImperativeHandle:a0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:s0,useReducer:Dm,useRef:Wx,useState:function(){return Dm(qa)},useDebugValue:Um,useDeferredValue:function(r,i){var u=hn();return At===null?Bm(u,r,i):l0(u,At.memoizedState,r,i)},useTransition:function(){var r=Dm(qa)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Ix,useId:d0,useHostTransitionStatus:Fm,useFormState:Xx,useActionState:Xx,useOptimistic:function(r,i){var u=hn();return At!==null?Fx(u,At,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:zm,useCacheRefresh:f0};y0.useEffectEvent=e0;function Zm(r,i,u,d){i=r.memoizedState,u=u(d,i),u=u==null?i:g({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Gm={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Dr(),y=ki(d);y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,d),i!==null&&(vr(i,r,d),nu(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Dr(),y=ki(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,d),i!==null&&(vr(i,r,d),nu(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Dr(),d=ki(u);d.tag=2,i!=null&&(d.callback=i),i=ji(r,d,u),i!==null&&(vr(i,r,u),nu(i,r,u))}};function v0(r,i,u,d,y,v,j){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,j):i.prototype&&i.prototype.isPureReactComponent?!Qo(u,d)||!Qo(y,v):!0}function b0(r,i,u,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,d),i.state!==r&&Gm.enqueueReplaceState(i,i.state,null)}function As(r,i){var u=i;if("ref"in i){u={};for(var d in i)d!=="ref"&&(u[d]=i[d])}if(r=r.defaultProps){u===i&&(u=g({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function x0(r){nd(r)}function w0(r){console.error(r)}function S0(r){nd(r)}function Cd(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function k0(r,i,u){try{var d=r.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Vm(r,i,u){return u=ki(u),u.tag=3,u.payload={element:null},u.callback=function(){Cd(r,i)},u}function j0(r){return r=ki(r),r.tag=3,r}function C0(r,i,u,d){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){k0(i,u,d)}}var j=u.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(r.callback=function(){k0(i,u,d),typeof y!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function _A(r,i,u,d,y){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=u.alternate,i!==null&&vl(i,u,y,!0),u=Rr.current,u!==null){switch(u.tag){case 31:case 13:return Kr===null?Ld():u.alternate===null&&nn===0&&(nn=3),u.flags&=-257,u.flags|=65536,u.lanes=y,d===fd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([d]):i.add(d),vp(r,d,y)),!1;case 22:return u.flags|=65536,d===fd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([d]):u.add(d)),vp(r,d,y)),!1}throw Error(a(435,u.tag))}return vp(r,d,y),Ld(),!1}if(ht)return i=Rr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==fm&&(r=Error(a(422),{cause:d}),Xo(Zr(r,u)))):(d!==fm&&(i=Error(a(423),{cause:d}),Xo(Zr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Zr(d,u),y=Vm(r.stateNode,d,y),km(r,y),nn!==4&&(nn=2)),!1;var v=Error(a(520),{cause:d});if(v=Zr(v,u),gu===null?gu=[v]:gu.push(v),nn!==4&&(nn=2),i===null)return!0;d=Zr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Vm(u.stateNode,d,r),km(u,r),!1;case 1:if(i=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ai===null||!Ai.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=j0(y),C0(y,r,u,d),km(u,y),!1}u=u.return}while(u!==null);return!1}var Qm=Error(a(461)),xn=!1;function $n(r,i,u,d){i.child=r===null?Tx(i,null,u,d):_s(i,r.child,u,d)}function E0(r,i,u,d,y){u=u.render;var v=i.ref;if("ref"in d){var j={};for(var A in d)A!=="ref"&&(j[A]=d[A])}else j=d;return js(i),d=Tm(r,i,u,j,v,y),A=Am(),r!==null&&!xn?(Rm(r,i,y),Za(r,i,y)):(ht&&A&&cm(i),i.flags|=1,$n(r,i,d,y),i.child)}function N0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!lm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,_0(r,i,v,d,y)):(r=sd(u.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!np(r,y)){var j=v.memoizedProps;if(u=u.compare,u=u!==null?u:Qo,u(j,d)&&r.ref===i.ref)return Za(r,i,y)}return i.flags|=1,r=Ua(v,d),r.ref=i.ref,r.return=i,i.child=r}function _0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(Qo(v,d)&&r.ref===i.ref)if(xn=!1,i.pendingProps=d=v,np(r,y))(r.flags&131072)!==0&&(xn=!0);else return i.lanes=r.lanes,Za(r,i,y)}return Km(r,i,u,d,y)}function T0(r,i,u,d){var y=d.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,r!==null){for(d=i.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~v}else d=0,i.child=null;return A0(r,i,v,u,d)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&cd(i,v!==null?v.cachePool:null),v!==null?Ox(i,v):Cm(),zx(i);else return d=i.lanes=536870912,A0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(cd(i,v.cachePool),Ox(i,v),Ei(),i.memoizedState=null):(r!==null&&cd(i,null),Cm(),Ei());return $n(r,i,y,u),i.child}function uu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function A0(r,i,u,d,y){var v=bm();return v=v===null?null:{parent:vn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&cd(i,null),Cm(),zx(i),r!==null&&vl(r,i,d,!0),i.childLanes=y,null}function Ed(r,i){return i=_d({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function R0(r,i,u){return _s(i,r.child,null,u),r=Ed(i,i.pendingProps),r.flags|=2,Or(i),i.memoizedState=null,r}function TA(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ht){if(d.mode==="hidden")return r=Ed(i,d),i.lanes=536870912,uu(null,r);if(Nm(i),(r=Bt)?(r=Hw(r,Qr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},u=mx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return i.lanes=536870912,null}return Ed(i,d)}var v=r.memoizedState;if(v!==null){var j=v.dehydrated;if(Nm(i),y)if(i.flags&256)i.flags&=-257,i=R0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(xn||vl(r,i,u,!1),y=(u&r.childLanes)!==0,xn||y){if(d=Mt,d!==null&&(j=Hc(d,u),j!==0&&j!==v.retryLane))throw v.retryLane=j,xs(r,j),vr(d,r,j),Qm;Ld(),i=R0(r,i,u)}else r=v.treeContext,Bt=Yr(j.nextSibling),Un=i,ht=!0,bi=null,Qr=!1,r!==null&&yx(i,r),i=Ed(i,d),i.flags|=4096;return i}return r=Ua(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Nd(r,i){var u=i.ref;if(u===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(a(284));(r===null||r.ref!==u)&&(i.flags|=4194816)}}function Km(r,i,u,d,y){return js(i),u=Tm(r,i,u,d,void 0,y),d=Am(),r!==null&&!xn?(Rm(r,i,y),Za(r,i,y)):(ht&&d&&cm(i),i.flags|=1,$n(r,i,u,y),i.child)}function O0(r,i,u,d,y,v){return js(i),i.updateQueue=null,u=Dx(i,d,u,y),Mx(r),d=Am(),r!==null&&!xn?(Rm(r,i,v),Za(r,i,v)):(ht&&d&&cm(i),i.flags|=1,$n(r,i,u,v),i.child)}function z0(r,i,u,d,y){if(js(i),i.stateNode===null){var v=ml,j=u.contextType;typeof j=="object"&&j!==null&&(v=Bn(j)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Gm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},wm(i),j=u.contextType,v.context=typeof j=="object"&&j!==null?Bn(j):ml,v.state=i.memoizedState,j=u.getDerivedStateFromProps,typeof j=="function"&&(Zm(i,u,j,d),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(j=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),j!==v.state&&Gm.enqueueReplaceState(v,v.state,null),au(i,d,v,y),ru(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,H=As(u,A);v.props=H;var ee=v.context,ce=u.contextType;j=ml,typeof ce=="object"&&ce!==null&&(j=Bn(ce));var he=u.getDerivedStateFromProps;ce=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||ee!==j)&&b0(i,v,d,j),Si=!1;var ne=i.memoizedState;v.state=ne,au(i,d,v,y),ru(),ee=i.memoizedState,A||ne!==ee||Si?(typeof he=="function"&&(Zm(i,u,he,d),ee=i.memoizedState),(H=Si||v0(i,u,H,d,ne,ee,j))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),v.props=d,v.state=ee,v.context=j,d=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Sm(r,i),j=i.memoizedProps,ce=As(u,j),v.props=ce,he=i.pendingProps,ne=v.context,ee=u.contextType,H=ml,typeof ee=="object"&&ee!==null&&(H=Bn(ee)),A=u.getDerivedStateFromProps,(ee=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(j!==he||ne!==H)&&b0(i,v,d,H),Si=!1,ne=i.memoizedState,v.state=ne,au(i,d,v,y),ru();var le=i.memoizedState;j!==he||ne!==le||Si||r!==null&&r.dependencies!==null&&od(r.dependencies)?(typeof A=="function"&&(Zm(i,u,A,d),le=i.memoizedState),(ce=Si||v0(i,u,ce,d,ne,le,H)||r!==null&&r.dependencies!==null&&od(r.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=H,d=ce):(typeof v.componentDidUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Nd(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=_s(i,r.child,null,y),i.child=_s(i,null,u,y)):$n(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Za(r,i,y),r}function M0(r,i,u,d){return Ss(),i.flags|=256,$n(r,i,u,d),i.child}var Ym={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xm(r){return{baseLanes:r,cachePool:kx()}}function Wm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Mr),r}function D0(r,i,u){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,j;if((j=v)||(j=r!==null&&r.memoizedState===null?!1:(fn.current&2)!==0),j&&(y=!0,i.flags&=-129),j=(i.flags&32)!==0,i.flags&=-33,r===null){if(ht){if(y?Ci(i):Ei(),(r=Bt)?(r=Hw(r,Qr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},u=mx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return Mp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(Ei(),y=i.mode,A=_d({mode:"hidden",children:A},y),d=ws(d,y,u,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=Xm(u),d.childLanes=Wm(r,j,u),i.memoizedState=Ym,uu(null,d)):(Ci(i),Jm(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(Ci(i),i.flags&=-257,i=ep(r,i,u)):i.memoizedState!==null?(Ei(),i.child=r.child,i.flags|=128,i=null):(Ei(),A=d.fallback,y=i.mode,d=_d({mode:"visible",children:d.children},y),A=ws(A,y,u,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,_s(i,r.child,null,u),d=i.child,d.memoizedState=Xm(u),d.childLanes=Wm(r,j,u),i.memoizedState=Ym,i=uu(null,d));else if(Ci(i),Mp(A)){if(j=A.nextSibling&&A.nextSibling.dataset,j)var ee=j.dgst;j=ee,d=Error(a(419)),d.stack="",d.digest=j,Xo({value:d,source:null,stack:null}),i=ep(r,i,u)}else if(xn||vl(r,i,u,!1),j=(u&r.childLanes)!==0,xn||j){if(j=Mt,j!==null&&(d=Hc(j,u),d!==0&&d!==H.retryLane))throw H.retryLane=d,xs(r,d),vr(j,r,d),Qm;zp(A)||Ld(),i=ep(r,i,u)}else zp(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Bt=Yr(A.nextSibling),Un=i,ht=!0,bi=null,Qr=!1,r!==null&&yx(i,r),i=Jm(i,d.children),i.flags|=4096);return i}return y?(Ei(),A=d.fallback,y=i.mode,H=r.child,ee=H.sibling,d=Ua(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=Ua(ee,A):(A=ws(A,y,u,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,uu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=Xm(u):(y=A.cachePool,y!==null?(H=vn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=kx(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=Wm(r,j,u),i.memoizedState=Ym,uu(r.child,d)):(Ci(i),u=r.child,r=u.sibling,u=Ua(u,{mode:"visible",children:d.children}),u.return=i,u.sibling=null,r!==null&&(j=i.deletions,j===null?(i.deletions=[r],i.flags|=16):j.push(r)),i.child=u,i.memoizedState=null,u)}function Jm(r,i){return i=_d({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function _d(r,i){return r=Ar(22,r,null,i),r.lanes=0,r}function ep(r,i,u){return _s(i,r.child,null,u),r=Jm(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function I0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),pm(r.return,i,u)}function tp(r,i,u,d,y,v){var j=r.memoizedState;j===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:y,treeForkCount:v}:(j.isBackwards=i,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=u,j.tailMode=y,j.treeForkCount=v)}function L0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var j=fn.current,A=(j&2)!==0;if(A?(j=j&1|2,i.flags|=128):j&=1,_(fn,j),$n(r,i,d,u),d=ht?Yo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&I0(r,u,i);else if(r.tag===19)I0(r,u,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(u=i.child,y=null;u!==null;)r=u.alternate,r!==null&&gd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),tp(i,!1,y,u,v,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&gd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}tp(i,!0,u,null,v,d);break;case"together":tp(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Za(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Ti|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(vl(r,i,u,!1),(u&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,u=Ua(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ua(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function np(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&od(r)))}function AA(r,i,u){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),wi(i,vn,r.memoizedState.cache),Ss();break;case 27:case 5:De(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:wi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Nm(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ci(i),i.flags|=128,null):(u&i.child.childLanes)!==0?D0(r,i,u):(Ci(i),r=Za(r,i,u),r!==null?r.sibling:null);Ci(i);break;case 19:var y=(r.flags&128)!==0;if(d=(u&i.childLanes)!==0,d||(vl(r,i,u,!1),d=(u&i.childLanes)!==0),y){if(d)return L0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),_(fn,fn.current),d)break;return null;case 22:return i.lanes=0,T0(r,i,u,i.pendingProps);case 24:wi(i,vn,r.memoizedState.cache)}return Za(r,i,u)}function P0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)xn=!0;else{if(!np(r,u)&&(i.flags&128)===0)return xn=!1,AA(r,i,u);xn=(r.flags&131072)!==0}else xn=!1,ht&&(i.flags&1048576)!==0&&gx(i,Yo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Es(i.elementType),i.type=r,typeof r=="function")lm(r)?(d=As(r,d),i.tag=1,i=z0(null,i,r,d,u)):(i.tag=0,i=Km(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===z){i.tag=11,i=E0(null,i,r,d,u);break e}else if(y===$){i.tag=14,i=N0(null,i,r,d,u);break e}}throw i=J(r)||r,Error(a(306,i,""))}}return i;case 0:return Km(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=As(d,i.pendingProps),z0(r,i,d,y,u);case 3:e:{if(we(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,Sm(r,i),au(i,d,null,u);var j=i.memoizedState;if(d=j.cache,wi(i,vn,d),d!==v.cache&&gm(i,[vn],u,!0),ru(),d=j.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:j.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=M0(r,i,d,u);break e}else if(d!==y){y=Zr(Error(a(424)),i),Xo(y),i=M0(r,i,d,u);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=Yr(r.firstChild),Un=i,ht=!0,bi=null,Qr=!0,u=Tx(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Ss(),d===y){i=Za(r,i,u);break e}$n(r,i,d,u)}i=i.child}return i;case 26:return Nd(r,i),r===null?(u=Kw(i.type,null,i.pendingProps,null))?i.memoizedState=u:ht||(u=i.type,r=i.pendingProps,d=qd(ue.current).createElement(u),d[cn]=i,d[Zt]=r,Fn(d,u,r),ft(d),i.stateNode=d):i.memoizedState=Kw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return De(i),r===null&&ht&&(d=i.stateNode=Gw(i.type,i.pendingProps,ue.current),Un=i,Qr=!0,y=Bt,Mi(i.type)?(Dp=y,Bt=Yr(d.firstChild)):Bt=y),$n(r,i,i.pendingProps.children,u),Nd(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ht&&((y=d=Bt)&&(d=s2(d,i.type,i.pendingProps,Qr),d!==null?(i.stateNode=d,Un=i,Bt=Yr(d.firstChild),Qr=!1,y=!0):y=!1),y||xi(i)),De(i),y=i.type,v=i.pendingProps,j=r!==null?r.memoizedProps:null,d=v.children,Ap(y,v)?d=null:j!==null&&Ap(y,j)&&(i.flags|=32),i.memoizedState!==null&&(y=Tm(r,i,wA,null,null,u),ju._currentValue=y),Nd(r,i),$n(r,i,d,u),i.child;case 6:return r===null&&ht&&((r=u=Bt)&&(u=l2(u,i.pendingProps,Qr),u!==null?(i.stateNode=u,Un=i,Bt=null,r=!0):r=!1),r||xi(i)),null;case 13:return D0(r,i,u);case 4:return we(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=_s(i,null,d,u):$n(r,i,d,u),i.child;case 11:return E0(r,i,i.type,i.pendingProps,u);case 7:return $n(r,i,i.pendingProps,u),i.child;case 8:return $n(r,i,i.pendingProps.children,u),i.child;case 12:return $n(r,i,i.pendingProps.children,u),i.child;case 10:return d=i.pendingProps,wi(i,i.type,d.value),$n(r,i,d.children,u),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,js(i),y=Bn(y),d=d(y),i.flags|=1,$n(r,i,d,u),i.child;case 14:return N0(r,i,i.type,i.pendingProps,u);case 15:return _0(r,i,i.type,i.pendingProps,u);case 19:return L0(r,i,u);case 31:return TA(r,i,u);case 22:return T0(r,i,u,i.pendingProps);case 24:return js(i),d=Bn(vn),r===null?(y=bm(),y===null&&(y=Mt,v=ym(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},wm(i),wi(i,vn,y)):((r.lanes&u)!==0&&(Sm(r,i),au(i,null,null,u),ru()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),wi(i,vn,d)):(d=v.cache,wi(i,vn,d),d!==y.cache&&gm(i,[vn],u,!0))),$n(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ga(r){r.flags|=4}function rp(r,i,u,d,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(dw())r.flags|=8192;else throw Ns=fd,xm}else r.flags&=-16777217}function U0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!eS(i))if(dw())r.flags|=8192;else throw Ns=fd,xm}function Td(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Ce():536870912,r.lanes|=i,Al|=i)}function cu(r,i){if(!ht)switch(r.tailMode){case"hidden":i=r.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function $t(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,d=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=u,i}function RA(r,i,u){var d=i.pendingProps;switch(dm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(i),null;case 1:return $t(i),null;case 3:return u=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Fa(vn),pe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(yl(i)?Ga(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,hm())),$t(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ga(i),v!==null?($t(i),U0(i,v)):($t(i),rp(i,y,null,d,u))):v?v!==r.memoizedState?(Ga(i),$t(i),U0(i,v)):($t(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ga(i),$t(i),rp(i,y,r,d,u)),null;case 27:if(Ue(i),u=ue.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return $t(i),null}r=Z.current,yl(i)?vx(i):(r=Gw(y,d,u),i.stateNode=r,Ga(i))}return $t(i),null;case 5:if(Ue(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return $t(i),null}if(v=Z.current,yl(i))vx(i);else{var j=qd(ue.current);switch(v){case 1:v=j.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=j.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=j.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=j.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=j.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?j.createElement(y,{is:d.is}):j.createElement(y)}}v[cn]=i,v[Zt]=d;e:for(j=i.child;j!==null;){if(j.tag===5||j.tag===6)v.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===i)break e;for(;j.sibling===null;){if(j.return===null||j.return===i)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}i.stateNode=v;e:switch(Fn(v,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&&Ga(i)}}return $t(i),rp(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ue.current,yl(i)){if(r=i.stateNode,u=i.memoizedProps,d=null,y=Un,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[cn]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||Dw(r.nodeValue,u)),r||xi(i,!0)}else r=qd(r).createTextNode(d),r[cn]=i,i.stateNode=r}return $t(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(d=yl(i),u!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[cn]=i}else Ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),r=!1}else u=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Or(i),i):(Or(i),null);if((i.flags&128)!==0)throw Error(a(558))}return $t(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=yl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[cn]=i}else Ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),y=!1}else y=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Or(i),i):(Or(i),null)}return Or(i),(i.flags&128)!==0?(i.lanes=u,i):(u=d!==null,r=r!==null&&r.memoizedState!==null,u&&(d=i.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==y&&(d.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),Td(i,i.updateQueue),$t(i),null);case 4:return pe(),r===null&&Cp(i.stateNode.containerInfo),$t(i),null;case 10:return Fa(i.type),$t(i),null;case 19:if(P(fn),d=i.memoizedState,d===null)return $t(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)cu(d,!1);else{if(nn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=gd(r),v!==null){for(i.flags|=128,cu(d,!1),r=v.updateQueue,i.updateQueue=r,Td(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)hx(u,r),u=u.sibling;return _(fn,fn.current&1|2),ht&&Ba(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&on()>Md&&(i.flags|=128,y=!0,cu(d,!1),i.lanes=4194304)}else{if(!y)if(r=gd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,Td(i,r),cu(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ht)return $t(i),null}else 2*on()-d.renderingStartTime>Md&&u!==536870912&&(i.flags|=128,y=!0,cu(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=on(),r.sibling=null,u=fn.current,_(fn,y?u&1|2:u&1),ht&&Ba(i,d.treeForkCount),r):($t(i),null);case 22:case 23:return Or(i),Em(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(u&536870912)!==0&&(i.flags&128)===0&&($t(i),i.subtreeFlags&6&&(i.flags|=8192)):$t(i),u=i.updateQueue,u!==null&&Td(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048),r!==null&&P(Cs),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Fa(vn),$t(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function OA(r,i){switch(dm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Fa(vn),pe(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ue(i),null;case 31:if(i.memoizedState!==null){if(Or(i),i.alternate===null)throw Error(a(340));Ss()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Or(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Ss()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return P(fn),null;case 4:return pe(),null;case 10:return Fa(i.type),null;case 22:case 23:return Or(i),Em(),r!==null&&P(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Fa(vn),null;case 25:return null;default:return null}}function B0(r,i){switch(dm(i),i.tag){case 3:Fa(vn),pe();break;case 26:case 27:case 5:Ue(i);break;case 4:pe();break;case 31:i.memoizedState!==null&&Or(i);break;case 13:Or(i);break;case 19:P(fn);break;case 10:Fa(i.type);break;case 22:case 23:Or(i),Em(),r!==null&&P(Cs);break;case 24:Fa(vn)}}function du(r,i){try{var u=i.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var y=d.next;u=y;do{if((u.tag&r)===r){d=void 0;var v=u.create,j=u.inst;d=v(),j.destroy=d}u=u.next}while(u!==y)}}catch(A){_t(i,i.return,A)}}function Ni(r,i,u){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var j=d.inst,A=j.destroy;if(A!==void 0){j.destroy=void 0,y=i;var H=u,ee=A;try{ee()}catch(ce){_t(y,H,ce)}}}d=d.next}while(d!==v)}}catch(ce){_t(i,i.return,ce)}}function $0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Rx(i,u)}catch(d){_t(r,r.return,d)}}}function F0(r,i,u){u.props=As(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){_t(r,i,d)}}function fu(r,i){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof u=="function"?r.refCleanup=u(d):u.current=d}}catch(y){_t(r,i,y)}}function ja(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){_t(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){_t(r,i,y)}else u.current=null}function H0(r){var i=r.type,u=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&d.focus();break e;case"img":u.src?d.src=u.src:u.srcSet&&(d.srcset=u.srcSet)}}catch(y){_t(r,r.return,y)}}function ap(r,i,u){try{var d=r.stateNode;e2(d,r.type,u,i),d[Zt]=i}catch(y){_t(r,r.return,y)}}function q0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Mi(r.type)||r.tag===4}function ip(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||q0(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Mi(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sp(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(r),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=La));else if(d!==4&&(d===27&&Mi(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(sp(r,i,u),r=r.sibling;r!==null;)sp(r,i,u),r=r.sibling}function Ad(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(d!==4&&(d===27&&Mi(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(Ad(r,i,u),r=r.sibling;r!==null;)Ad(r,i,u),r=r.sibling}function Z0(r){var i=r.stateNode,u=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Fn(i,d,u),i[cn]=r,i[Zt]=u}catch(v){_t(r,r.return,v)}}var Va=!1,wn=!1,lp=!1,G0=typeof WeakSet=="function"?WeakSet:Set,zn=null;function zA(r,i){if(r=r.containerInfo,_p=Xd,r=ax(r),em(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var j=0,A=-1,H=-1,ee=0,ce=0,he=r,ne=null;t:for(;;){for(var le;he!==u||y!==0&&he.nodeType!==3||(A=j+y),he!==v||d!==0&&he.nodeType!==3||(H=j+d),he.nodeType===3&&(j+=he.nodeValue.length),(le=he.firstChild)!==null;)ne=he,he=le;for(;;){if(he===r)break t;if(ne===u&&++ee===y&&(A=j),ne===v&&++ce===d&&(H=j),(le=he.nextSibling)!==null)break;he=ne,ne=he.parentNode}he=le}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(Tp={focusedElem:r,selectionRange:u},Xd=!1,zn=i;zn!==null;)if(i=zn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,zn=r;else for(;zn!==null;){switch(i=zn,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(u=0;u<r.length;u++)y=r[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,u=i,y=v.memoizedProps,v=v.memoizedState,d=u.stateNode;try{var Te=As(u.type,y);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(He){_t(u,u.return,He)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)Op(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Op(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,zn=r;break}zn=i.return}}function V0(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Ka(r,u),d&4&&du(5,u);break;case 1:if(Ka(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(j){_t(u,u.return,j)}else{var y=As(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(j){_t(u,u.return,j)}}d&64&&$0(u),d&512&&fu(u,u.return);break;case 3:if(Ka(r,u),d&64&&(r=u.updateQueue,r!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Rx(r,i)}catch(j){_t(u,u.return,j)}}break;case 27:i===null&&d&4&&Z0(u);case 26:case 5:Ka(r,u),i===null&&d&4&&H0(u),d&512&&fu(u,u.return);break;case 12:Ka(r,u);break;case 31:Ka(r,u),d&4&&Y0(r,u);break;case 13:Ka(r,u),d&4&&X0(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=FA.bind(null,u),o2(r,u))));break;case 22:if(d=u.memoizedState!==null||Va,!d){i=i!==null&&i.memoizedState!==null||wn,y=Va;var v=wn;Va=d,(wn=i)&&!v?Ya(r,u,(u.subtreeFlags&8772)!==0):Ka(r,u),Va=y,wn=v}break;case 30:break;default:Ka(r,u)}}function Q0(r){var i=r.alternate;i!==null&&(r.alternate=null,Q0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Pe(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Gt=null,mr=!1;function Qa(r,i,u){for(u=u.child;u!==null;)K0(r,i,u),u=u.sibling}function K0(r,i,u){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(Ht,u)}catch{}switch(u.tag){case 26:wn||ja(u,i),Qa(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:wn||ja(u,i);var d=Gt,y=mr;Mi(u.type)&&(Gt=u.stateNode,mr=!1),Qa(r,i,u),wu(u.stateNode),Gt=d,mr=y;break;case 5:wn||ja(u,i);case 6:if(d=Gt,y=mr,Gt=null,Qa(r,i,u),Gt=d,mr=y,Gt!==null)if(mr)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(u.stateNode)}catch(v){_t(u,i,v)}else try{Gt.removeChild(u.stateNode)}catch(v){_t(u,i,v)}break;case 18:Gt!==null&&(mr?(r=Gt,$w(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Pl(r)):$w(Gt,u.stateNode));break;case 4:d=Gt,y=mr,Gt=u.stateNode.containerInfo,mr=!0,Qa(r,i,u),Gt=d,mr=y;break;case 0:case 11:case 14:case 15:Ni(2,u,i),wn||Ni(4,u,i),Qa(r,i,u);break;case 1:wn||(ja(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&F0(u,i,d)),Qa(r,i,u);break;case 21:Qa(r,i,u);break;case 22:wn=(d=wn)||u.memoizedState!==null,Qa(r,i,u),wn=d;break;default:Qa(r,i,u)}}function Y0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Pl(r)}catch(u){_t(i,i.return,u)}}}function X0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Pl(r)}catch(u){_t(i,i.return,u)}}function MA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new G0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new G0),i;default:throw Error(a(435,r.tag))}}function Rd(r,i){var u=MA(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=HA.bind(null,r,d);d.then(y,y)}})}function pr(r,i){var u=i.deletions;if(u!==null)for(var d=0;d<u.length;d++){var y=u[d],v=r,j=i,A=j;e:for(;A!==null;){switch(A.tag){case 27:if(Mi(A.type)){Gt=A.stateNode,mr=!1;break e}break;case 5:Gt=A.stateNode,mr=!1;break e;case 3:case 4:Gt=A.stateNode.containerInfo,mr=!0;break e}A=A.return}if(Gt===null)throw Error(a(160));K0(v,j,y),Gt=null,mr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)W0(i,r),i=i.sibling}var ma=null;function W0(r,i){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:pr(i,r),gr(r),d&4&&(Ni(3,r,r.return),du(3,r),Ni(5,r,r.return));break;case 1:pr(i,r),gr(r),d&512&&(wn||u===null||ja(u,u.return)),d&64&&Va&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:var y=ma;if(pr(i,r),gr(r),d&512&&(wn||u===null||ja(u,u.return)),d&4){var v=u!==null?u.memoizedState:null;if(d=r.memoizedState,u===null)if(d===null)if(r.stateNode===null){e:{d=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[gi]||v[cn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Fn(v,d,u),v[cn]=r,ft(v),d=v;break e;case"link":var j=Ww("link","href",y).get(d+(u.href||""));if(j){for(var A=0;A<j.length;A++)if(v=j[A],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){j.splice(A,1);break t}}v=y.createElement(d),Fn(v,d,u),y.head.appendChild(v);break;case"meta":if(j=Ww("meta","content",y).get(d+(u.content||""))){for(A=0;A<j.length;A++)if(v=j[A],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){j.splice(A,1);break t}}v=y.createElement(d),Fn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[cn]=r,ft(v),d=v}r.stateNode=d}else Jw(y,r.type,r.stateNode);else r.stateNode=Xw(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?Jw(y,r.type,r.stateNode):Xw(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ap(r,r.memoizedProps,u.memoizedProps)}break;case 27:pr(i,r),gr(r),d&512&&(wn||u===null||ja(u,u.return)),u!==null&&d&4&&ap(r,r.memoizedProps,u.memoizedProps);break;case 5:if(pr(i,r),gr(r),d&512&&(wn||u===null||ja(u,u.return)),r.flags&32){y=r.stateNode;try{ll(y,"")}catch(Te){_t(r,r.return,Te)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ap(r,y,u!==null?u.memoizedProps:y)),d&1024&&(lp=!0);break;case 6:if(pr(i,r),gr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,u=r.stateNode;try{u.nodeValue=d}catch(Te){_t(r,r.return,Te)}}break;case 3:if(Vd=null,y=ma,ma=Zd(i.containerInfo),pr(i,r),ma=y,gr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{Pl(i.containerInfo)}catch(Te){_t(r,r.return,Te)}lp&&(lp=!1,J0(r));break;case 4:d=ma,ma=Zd(r.stateNode.containerInfo),pr(i,r),gr(r),ma=d;break;case 12:pr(i,r),gr(r);break;case 31:pr(i,r),gr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Rd(r,d)));break;case 13:pr(i,r),gr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(zd=on()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Rd(r,d)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,ee=Va,ce=wn;if(Va=ee||y,wn=ce||H,pr(i,r),wn=ce,Va=ee,gr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Va||wn||Rs(r)),u=null,i=r;;){if(i.tag===5||i.tag===26){if(u===null){H=u=i;try{if(v=H.stateNode,y)j=v.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{A=H.stateNode;var he=H.memoizedProps.style,ne=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Te){_t(H,H.return,Te)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(Te){_t(H,H.return,Te)}}}else if(i.tag===18){if(u===null){H=i;try{var le=H.stateNode;y?Fw(le,!0):Fw(H.stateNode,!1)}catch(Te){_t(H,H.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Rd(r,u))));break;case 19:pr(i,r),gr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Rd(r,d)));break;case 30:break;case 21:break;default:pr(i,r),gr(r)}}function gr(r){var i=r.flags;if(i&2){try{for(var u,d=r.return;d!==null;){if(q0(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=ip(r);Ad(r,v,y);break;case 5:var j=u.stateNode;u.flags&32&&(ll(j,""),u.flags&=-33);var A=ip(r);Ad(r,A,j);break;case 3:case 4:var H=u.stateNode.containerInfo,ee=ip(r);sp(r,ee,H);break;default:throw Error(a(161))}}catch(ce){_t(r,r.return,ce)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function J0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;J0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ka(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)V0(r,i.alternate,i),i=i.sibling}function Rs(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ni(4,i,i.return),Rs(i);break;case 1:ja(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&F0(i,i.return,u),Rs(i);break;case 27:wu(i.stateNode);case 26:case 5:ja(i,i.return),Rs(i);break;case 22:i.memoizedState===null&&Rs(i);break;case 30:Rs(i);break;default:Rs(i)}r=r.sibling}}function Ya(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,j=v.flags;switch(v.tag){case 0:case 11:case 15:Ya(y,v,u),du(4,v);break;case 1:if(Ya(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ee){_t(d,d.return,ee)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Ax(H[y],A)}catch(ee){_t(d,d.return,ee)}}u&&j&64&&$0(v),fu(v,v.return);break;case 27:Z0(v);case 26:case 5:Ya(y,v,u),u&&d===null&&j&4&&H0(v),fu(v,v.return);break;case 12:Ya(y,v,u);break;case 31:Ya(y,v,u),u&&j&4&&Y0(y,v);break;case 13:Ya(y,v,u),u&&j&4&&X0(y,v);break;case 22:v.memoizedState===null&&Ya(y,v,u),fu(v,v.return);break;case 30:break;default:Ya(y,v,u)}i=i.sibling}}function op(r,i){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Wo(u))}function up(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Wo(r))}function pa(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)ew(r,i,u,d),i=i.sibling}function ew(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:pa(r,i,u,d),y&2048&&du(9,i);break;case 1:pa(r,i,u,d);break;case 3:pa(r,i,u,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Wo(r)));break;case 12:if(y&2048){pa(r,i,u,d),r=i.stateNode;try{var v=i.memoizedProps,j=v.id,A=v.onPostCommit;typeof A=="function"&&A(j,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){_t(i,i.return,H)}}else pa(r,i,u,d);break;case 31:pa(r,i,u,d);break;case 13:pa(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,j=i.alternate,i.memoizedState!==null?v._visibility&2?pa(r,i,u,d):hu(r,i):v._visibility&2?pa(r,i,u,d):(v._visibility|=2,Nl(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&op(j,i);break;case 24:pa(r,i,u,d),y&2048&&up(i.alternate,i);break;default:pa(r,i,u,d)}}function Nl(r,i,u,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,j=i,A=u,H=d,ee=j.flags;switch(j.tag){case 0:case 11:case 15:Nl(v,j,A,H,y),du(8,j);break;case 23:break;case 22:var ce=j.stateNode;j.memoizedState!==null?ce._visibility&2?Nl(v,j,A,H,y):hu(v,j):(ce._visibility|=2,Nl(v,j,A,H,y)),y&&ee&2048&&op(j.alternate,j);break;case 24:Nl(v,j,A,H,y),y&&ee&2048&&up(j.alternate,j);break;default:Nl(v,j,A,H,y)}i=i.sibling}}function hu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,d=i,y=d.flags;switch(d.tag){case 22:hu(u,d),y&2048&&op(d.alternate,d);break;case 24:hu(u,d),y&2048&&up(d.alternate,d);break;default:hu(u,d)}i=i.sibling}}var mu=8192;function _l(r,i,u){if(r.subtreeFlags&mu)for(r=r.child;r!==null;)tw(r,i,u),r=r.sibling}function tw(r,i,u){switch(r.tag){case 26:_l(r,i,u),r.flags&mu&&r.memoizedState!==null&&x2(u,ma,r.memoizedState,r.memoizedProps);break;case 5:_l(r,i,u);break;case 3:case 4:var d=ma;ma=Zd(r.stateNode.containerInfo),_l(r,i,u),ma=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=mu,mu=16777216,_l(r,i,u),mu=d):_l(r,i,u));break;default:_l(r,i,u)}}function nw(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function pu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];zn=d,aw(d,r)}nw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)rw(r),r=r.sibling}function rw(r){switch(r.tag){case 0:case 11:case 15:pu(r),r.flags&2048&&Ni(9,r,r.return);break;case 3:pu(r);break;case 12:pu(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Od(r)):pu(r);break;default:pu(r)}}function Od(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];zn=d,aw(d,r)}nw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),Od(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Od(i));break;default:Od(i)}r=r.sibling}}function aw(r,i){for(;zn!==null;){var u=zn;switch(u.tag){case 0:case 11:case 15:Ni(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Wo(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,zn=d;else e:for(u=r;zn!==null;){d=zn;var y=d.sibling,v=d.return;if(Q0(d),d===u){zn=null;break e}if(y!==null){y.return=v,zn=y;break e}zn=v}}}var DA={getCacheForType:function(r){var i=Bn(vn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Bn(vn).controller.signal}},IA=typeof WeakMap=="function"?WeakMap:Map,jt=0,Mt=null,it=null,ut=0,Nt=0,zr=null,_i=!1,Tl=!1,cp=!1,Xa=0,nn=0,Ti=0,Os=0,dp=0,Mr=0,Al=0,gu=null,yr=null,fp=!1,zd=0,iw=0,Md=1/0,Dd=null,Ai=null,En=0,Ri=null,Rl=null,Wa=0,hp=0,mp=null,sw=null,yu=0,pp=null;function Dr(){return(jt&2)!==0&&ut!==0?ut&-ut:q.T!==null?wp():Io()}function lw(){if(Mr===0)if((ut&536870912)===0||ht){var r=da;da<<=1,(da&3932160)===0&&(da=262144),Mr=r}else Mr=536870912;return r=Rr.current,r!==null&&(r.flags|=32),Mr}function vr(r,i,u){(r===Mt&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)&&(Ol(r,0),Oi(r,ut,Mr,!1)),gn(r,u),((jt&2)===0||r!==Mt)&&(r===Mt&&((jt&2)===0&&(Os|=u),nn===4&&Oi(r,ut,Mr,!1)),Ca(r))}function ow(r,i,u){if((jt&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||wa(r,i),y=d?UA(r,i):yp(r,i,!0),v=d;do{if(y===0){Tl&&!d&&Oi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!LA(u)){y=yp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var j=0;else j=r.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){i=j;e:{var A=r;y=gu;var H=A.current.memoizedState.isDehydrated;if(H&&(Ol(A,j).flags|=256),j=yp(A,j,!1),j!==2){if(cp&&!H){A.errorRecoveryDisabledLanes|=v,Os|=v,y=4;break e}v=yr,yr=y,v!==null&&(yr===null?yr=v:yr.push.apply(yr,v))}y=j}if(v=!1,y!==2)continue}}if(y===1){Ol(r,0),Oi(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Oi(d,i,Mr,!_i);break e;case 2:yr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=zd+300-on(),10<y)){if(Oi(d,i,Mr,!_i),Ma(d,0,!0)!==0)break e;Wa=i,d.timeoutHandle=Uw(uw.bind(null,d,u,yr,Dd,fp,i,Mr,Os,Al,_i,v,"Throttled",-0,0),y);break e}uw(d,u,yr,Dd,fp,i,Mr,Os,Al,_i,v,null,-0,0)}}break}while(!0);Ca(r)}function uw(r,i,u,d,y,v,j,A,H,ee,ce,he,ne,le){if(r.timeoutHandle=-1,he=i.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},tw(i,v,he);var Te=(v&62914560)===v?zd-on():(v&4194048)===v?iw-on():0;if(Te=w2(he,Te),Te!==null){Wa=v,r.cancelPendingCommit=Te(yw.bind(null,r,i,v,u,d,y,j,A,H,ce,he,null,ne,le)),Oi(r,v,j,!ee);return}}yw(r,i,v,u,d,y,j,A,H)}function LA(r){for(var i=r;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var y=u[d],v=y.getSnapshot;y=y.value;try{if(!Tr(v(),y))return!1}catch{return!1}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Oi(r,i,u,d){i&=~dp,i&=~Os,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-at(y),j=1<<v;d[v]=-1,y&=~j}u!==0&&pi(r,u,i)}function Id(){return(jt&6)===0?(vu(0),!1):!0}function gp(){if(it!==null){if(Nt===0)var r=it.return;else r=it,$a=ks=null,Om(r),Sl=null,eu=0,r=it;for(;r!==null;)B0(r.alternate,r),r=r.return;it=null}}function Ol(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,r2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),Wa=0,gp(),Mt=r,it=u=Ua(r.current,null),ut=i,Nt=0,zr=null,_i=!1,Tl=wa(r,i),cp=!1,Al=Mr=dp=Os=Ti=nn=0,yr=gu=null,fp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var y=31-at(d),v=1<<y;i|=r[y],d&=~v}return Xa=i,rd(),u}function cw(r,i){Ke=null,q.H=ou,i===wl||i===dd?(i=Ex(),Nt=3):i===xm?(i=Ex(),Nt=4):Nt=i===Qm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,zr=i,it===null&&(nn=1,Cd(r,Zr(i,r.current)))}function dw(){var r=Rr.current;return r===null?!0:(ut&4194048)===ut?Kr===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Kr:!1}function fw(){var r=q.H;return q.H=ou,r===null?ou:r}function hw(){var r=q.A;return q.A=DA,r}function Ld(){nn=4,_i||(ut&4194048)!==ut&&Rr.current!==null||(Tl=!0),(Ti&134217727)===0&&(Os&134217727)===0||Mt===null||Oi(Mt,ut,Mr,!1)}function yp(r,i,u){var d=jt;jt|=2;var y=fw(),v=hw();(Mt!==r||ut!==i)&&(Dd=null,Ol(r,i)),i=!1;var j=nn;e:do try{if(Nt!==0&&it!==null){var A=it,H=zr;switch(Nt){case 8:gp(),j=6;break e;case 3:case 2:case 9:case 6:Rr.current===null&&(i=!0);var ee=Nt;if(Nt=0,zr=null,zl(r,A,H,ee),u&&Tl){j=0;break e}break;default:ee=Nt,Nt=0,zr=null,zl(r,A,H,ee)}}PA(),j=nn;break}catch(ce){cw(r,ce)}while(!0);return i&&r.shellSuspendCounter++,$a=ks=null,jt=d,q.H=y,q.A=v,it===null&&(Mt=null,ut=0,rd()),j}function PA(){for(;it!==null;)mw(it)}function UA(r,i){var u=jt;jt|=2;var d=fw(),y=hw();Mt!==r||ut!==i?(Dd=null,Md=on()+500,Ol(r,i)):Tl=wa(r,i);e:do try{if(Nt!==0&&it!==null){i=it;var v=zr;t:switch(Nt){case 1:Nt=0,zr=null,zl(r,i,v,1);break;case 2:case 9:if(jx(v)){Nt=0,zr=null,pw(i);break}i=function(){Nt!==2&&Nt!==9||Mt!==r||(Nt=7),Ca(r)},v.then(i,i);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:jx(v)?(Nt=0,zr=null,pw(i)):(Nt=0,zr=null,zl(r,i,v,7));break;case 5:var j=null;switch(it.tag){case 26:j=it.memoizedState;case 5:case 27:var A=it;if(j?eS(j):A.stateNode.complete){Nt=0,zr=null;var H=A.sibling;if(H!==null)it=H;else{var ee=A.return;ee!==null?(it=ee,Pd(ee)):it=null}break t}}Nt=0,zr=null,zl(r,i,v,5);break;case 6:Nt=0,zr=null,zl(r,i,v,6);break;case 8:gp(),nn=6;break e;default:throw Error(a(462))}}BA();break}catch(ce){cw(r,ce)}while(!0);return $a=ks=null,q.H=d,q.A=y,jt=u,it!==null?0:(Mt=null,ut=0,rd(),nn)}function BA(){for(;it!==null&&!hi();)mw(it)}function mw(r){var i=P0(r.alternate,r,Xa);r.memoizedProps=r.pendingProps,i===null?Pd(r):it=i}function pw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=O0(u,i,i.pendingProps,i.type,void 0,ut);break;case 11:i=O0(u,i,i.pendingProps,i.type.render,i.ref,ut);break;case 5:Om(i);default:B0(u,i),i=it=hx(i,Xa),i=P0(u,i,Xa)}r.memoizedProps=r.pendingProps,i===null?Pd(r):it=i}function zl(r,i,u,d){$a=ks=null,Om(i),Sl=null,eu=0;var y=i.return;try{if(_A(r,y,i,u,ut)){nn=1,Cd(r,Zr(u,r.current)),it=null;return}}catch(v){if(y!==null)throw it=y,v;nn=1,Cd(r,Zr(u,r.current)),it=null;return}i.flags&32768?(ht||d===1?r=!0:Tl||(ut&536870912)!==0?r=!1:(_i=r=!0,(d===2||d===9||d===3||d===6)&&(d=Rr.current,d!==null&&d.tag===13&&(d.flags|=16384))),gw(i,r)):Pd(i)}function Pd(r){var i=r;do{if((i.flags&32768)!==0){gw(i,_i);return}r=i.return;var u=RA(i.alternate,i,Xa);if(u!==null){it=u;return}if(i=i.sibling,i!==null){it=i;return}it=i=r}while(i!==null);nn===0&&(nn=5)}function gw(r,i){do{var u=OA(r.alternate,r);if(u!==null){u.flags&=32767,it=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){it=r;return}it=r=u}while(r!==null);nn=6,it=null}function yw(r,i,u,d,y,v,j,A,H){r.cancelPendingCommit=null;do Ud();while(En!==0);if((jt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=im,_r(r,u,v,j,A,H),r===Mt&&(it=Mt=null,ut=0),Rl=i,Ri=r,Wa=u,hp=v,mp=y,sw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,qA($e,function(){return Sw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,y=te.p,te.p=2,j=jt,jt|=4;try{zA(r,i,u)}finally{jt=j,te.p=y,q.T=d}}En=1,vw(),bw(),xw()}}function vw(){if(En===1){En=0;var r=Ri,i=Rl,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=q.T,q.T=null;var d=te.p;te.p=2;var y=jt;jt|=4;try{W0(i,r);var v=Tp,j=ax(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(j!==A&&A&&A.ownerDocument&&rx(A.ownerDocument.documentElement,A)){if(H!==null&&em(A)){var ee=H.start,ce=H.end;if(ce===void 0&&(ce=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(ce,A.value.length);else{var he=A.ownerDocument||document,ne=he&&he.defaultView||window;if(ne.getSelection){var le=ne.getSelection(),Te=A.textContent.length,He=Math.min(H.start,Te),Ot=H.end===void 0?He:Math.min(H.end,Te);!le.extend&&He>Ot&&(j=Ot,Ot=He,He=j);var K=nx(A,He),G=nx(A,Ot);if(K&&G&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==G.node||le.focusOffset!==G.offset)){var W=he.createRange();W.setStart(K.node,K.offset),le.removeAllRanges(),He>Ot?(le.addRange(W),le.extend(G.node,G.offset)):(W.setEnd(G.node,G.offset),le.addRange(W))}}}}for(he=[],le=A;le=le.parentNode;)le.nodeType===1&&he.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var fe=he[A];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Xd=!!_p,Tp=_p=null}finally{jt=y,te.p=d,q.T=u}}r.current=i,En=2}}function bw(){if(En===2){En=0;var r=Ri,i=Rl,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=q.T,q.T=null;var d=te.p;te.p=2;var y=jt;jt|=4;try{V0(r,i.alternate,i)}finally{jt=y,te.p=d,q.T=u}}En=3}}function xw(){if(En===4||En===3){En=0,mi();var r=Ri,i=Rl,u=Wa,d=sw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?En=5:(En=0,Rl=Ri=null,ww(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Ai=null),fa(u),i=i.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(Ht,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=q.T,y=te.p,te.p=2,q.T=null;try{for(var v=r.onRecoverableError,j=0;j<d.length;j++){var A=d[j];v(A.value,{componentStack:A.stack})}}finally{q.T=i,te.p=y}}(Wa&3)!==0&&Ud(),Ca(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===pp?yu++:(yu=0,pp=r):yu=0,vu(0)}}function ww(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Wo(i)))}function Ud(){return vw(),bw(),xw(),Sw()}function Sw(){if(En!==5)return!1;var r=Ri,i=hp;hp=0;var u=fa(Wa),d=q.T,y=te.p;try{te.p=32>u?32:u,q.T=null,u=mp,mp=null;var v=Ri,j=Wa;if(En=0,Rl=Ri=null,Wa=0,(jt&6)!==0)throw Error(a(331));var A=jt;if(jt|=4,rw(v.current),ew(v,v.current,j,u),jt=A,vu(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(Ht,v)}catch{}return!0}finally{te.p=y,q.T=d,ww(r,i)}}function kw(r,i,u){i=Zr(u,i),i=Vm(r.stateNode,i,2),r=ji(r,i,2),r!==null&&(gn(r,2),Ca(r))}function _t(r,i,u){if(r.tag===3)kw(r,r,u);else for(;i!==null;){if(i.tag===3){kw(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ai===null||!Ai.has(d))){r=Zr(u,r),u=j0(2),d=ji(i,u,2),d!==null&&(C0(u,d,i,r),gn(d,2),Ca(d));break}}i=i.return}}function vp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new IA;var y=new Set;d.set(i,y)}else y=d.get(i),y===void 0&&(y=new Set,d.set(i,y));y.has(u)||(cp=!0,y.add(u),r=$A.bind(null,r,i,u),i.then(r,r))}function $A(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Mt===r&&(ut&u)===u&&(nn===4||nn===3&&(ut&62914560)===ut&&300>on()-zd?(jt&2)===0&&Ol(r,0):dp|=u,Al===ut&&(Al=0)),Ca(r)}function jw(r,i){i===0&&(i=Ce()),r=xs(r,i),r!==null&&(gn(r,i),Ca(r))}function FA(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),jw(r,u)}function HA(r,i){var u=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),jw(r,u)}function qA(r,i){return Ln(r,i)}var Bd=null,Ml=null,bp=!1,$d=!1,xp=!1,zi=0;function Ca(r){r!==Ml&&r.next===null&&(Ml===null?Bd=Ml=r:Ml=Ml.next=r),$d=!0,bp||(bp=!0,GA())}function vu(r,i){if(!xp&&$d){xp=!0;do for(var u=!1,d=Bd;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var j=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-at(42|r)+1)-1,v&=y&~(j&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,_w(d,v))}else v=ut,v=Ma(d,d===Mt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||wa(d,v)||(u=!0,_w(d,v));d=d.next}while(u);xp=!1}}function ZA(){Cw()}function Cw(){$d=bp=!1;var r=0;zi!==0&&n2()&&(r=zi);for(var i=on(),u=null,d=Bd;d!==null;){var y=d.next,v=Ew(d,i);v===0?(d.next=null,u===null?Bd=y:u.next=y,y===null&&(Ml=u)):(u=d,(r!==0||(v&3)!==0)&&($d=!0)),d=y}En!==0&&En!==5||vu(r),zi!==0&&(zi=0)}function Ew(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var j=31-at(v),A=1<<j,H=y[j];H===-1?((A&u)===0||(A&d)!==0)&&(y[j]=qt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Mt,u=ut,u=Ma(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&fr(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||wa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&fr(d),fa(u)){case 2:case 8:u=ye;break;case 32:u=$e;break;case 268435456:u=nt;break;default:u=$e}return d=Nw.bind(null,r),u=Ln(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&fr(d),r.callbackPriority=2,r.callbackNode=null,2}function Nw(r,i){if(En!==0&&En!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Ud()&&r.callbackNode!==u)return null;var d=ut;return d=Ma(r,r===Mt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(ow(r,d,i),Ew(r,on()),r.callbackNode!=null&&r.callbackNode===u?Nw.bind(null,r):null)}function _w(r,i){if(Ud())return null;ow(r,i,!0)}function GA(){a2(function(){(jt&6)!==0?Ln(oe,ZA):Cw()})}function wp(){if(zi===0){var r=bl;r===0&&(r=ca,ca<<=1,(ca&261888)===0&&(ca=256)),zi=r}return zi}function Tw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Kc(""+r)}function Aw(r,i){var u=i.ownerDocument.createElement("input");return u.name=i.name,u.value=i.value,r.id&&u.setAttribute("form",r.id),i.parentNode.insertBefore(u,i),r=new FormData(r),u.parentNode.removeChild(u),r}function VA(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=Tw((y[Zt]||null).action),j=d.submitter;j&&(i=(i=j[Zt]||null)?Tw(i.formAction):j.getAttribute("formAction"),i!==null&&(v=i,j=null));var A=new Jc("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(zi!==0){var H=j?Aw(y,j):new FormData(y);$m(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=j?Aw(y,j):new FormData(y),$m(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var Sp=0;Sp<am.length;Sp++){var kp=am[Sp],QA=kp.toLowerCase(),KA=kp[0].toUpperCase()+kp.slice(1);ha(QA,"on"+KA)}ha(lx,"onAnimationEnd"),ha(ox,"onAnimationIteration"),ha(ux,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(dA,"onTransitionRun"),ha(fA,"onTransitionStart"),ha(hA,"onTransitionCancel"),ha(cx,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),yn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yn("onBeforeInput",["compositionend","keypress","textInput","paste"]),yn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bu="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(" "),YA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bu));function Rw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var j=d.length-1;0<=j;j--){var A=d[j],H=A.instance,ee=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(ce){nd(ce)}y.currentTarget=null,v=H}else for(j=0;j<d.length;j++){if(A=d[j],H=A.instance,ee=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(ce){nd(ce)}y.currentTarget=null,v=H}}}}function st(r,i){var u=i[il];u===void 0&&(u=i[il]=new Set);var d=r+"__bubble";u.has(d)||(Ow(i,r,2,!1),u.add(d))}function jp(r,i,u){var d=0;i&&(d|=4),Ow(u,r,d,i)}var Fd="_reactListening"+Math.random().toString(36).slice(2);function Cp(r){if(!r[Fd]){r[Fd]=!0,Xt.forEach(function(u){u!=="selectionchange"&&(YA.has(u)||jp(u,!1,r),jp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Fd]||(i[Fd]=!0,jp("selectionchange",!1,i))}}function Ow(r,i,u,d){switch(lS(i)){case 2:var y=j2;break;case 8:y=C2;break;default:y=Bp}u=y.bind(null,i,u,r),y=void 0,!Zh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Ep(r,i,u,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var A=d.stateNode.containerInfo;if(A===y)break;if(j===4)for(j=d.return;j!==null;){var H=j.tag;if((H===3||H===4)&&j.stateNode.containerInfo===y)return;j=j.return}for(;A!==null;){if(j=F(A),j===null)return;if(H=j.tag,H===5||H===6||H===26||H===27){d=v=j;continue e}A=A.parentNode}}d=d.return}Lb(function(){var ee=v,ce=Hh(u),he=[];e:{var ne=dx.get(r);if(ne!==void 0){var le=Jc,Te=r;switch(r){case"keypress":if(Xc(u)===0)break e;case"keydown":case"keyup":le=HT;break;case"focusin":Te="focus",le=Kh;break;case"focusout":Te="blur",le=Kh;break;case"beforeblur":case"afterblur":le=Kh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Bb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=RT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=GT;break;case lx:case ox:case ux:le=MT;break;case cx:le=QT;break;case"scroll":case"scrollend":le=TT;break;case"wheel":le=YT;break;case"copy":case"cut":case"paste":le=IT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Fb;break;case"toggle":case"beforetoggle":le=WT}var He=(i&4)!==0,Ot=!He&&(r==="scroll"||r==="scrollend"),K=He?ne!==null?ne+"Capture":null:ne;He=[];for(var G=ee,W;G!==null;){var fe=G;if(W=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||W===null||K===null||(fe=$o(G,K),fe!=null&&He.push(xu(G,fe,W))),Ot)break;G=G.return}0<He.length&&(ne=new le(ne,Te,null,u,ce),he.push({event:ne,listeners:He}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",le=r==="mouseout"||r==="pointerout",ne&&u!==Fh&&(Te=u.relatedTarget||u.fromElement)&&(F(Te)||Te[Da]))break e;if((le||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,le?(Te=u.relatedTarget||u.toElement,le=ee,Te=Te?F(Te):null,Te!==null&&(Ot=o(Te),He=Te.tag,Te!==Ot||He!==5&&He!==27&&He!==6)&&(Te=null)):(le=null,Te=ee),le!==Te)){if(He=Bb,fe="onMouseLeave",K="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&(He=Fb,fe="onPointerLeave",K="onPointerEnter",G="pointer"),Ot=le==null?ne:Ne(le),W=Te==null?ne:Ne(Te),ne=new He(fe,G+"leave",le,u,ce),ne.target=Ot,ne.relatedTarget=W,fe=null,F(ce)===ee&&(He=new He(K,G+"enter",Te,u,ce),He.target=W,He.relatedTarget=Ot,fe=He),Ot=fe,le&&Te)t:{for(He=XA,K=le,G=Te,W=0,fe=K;fe;fe=He(fe))W++;fe=0;for(var Be=G;Be;Be=He(Be))fe++;for(;0<W-fe;)K=He(K),W--;for(;0<fe-W;)G=He(G),fe--;for(;W--;){if(K===G||G!==null&&K===G.alternate){He=K;break t}K=He(K),G=He(G)}He=null}else He=null;le!==null&&zw(he,ne,le,He,!1),Te!==null&&Ot!==null&&zw(he,Ot,Te,He,!0)}}e:{if(ne=ee?Ne(ee):window,le=ne.nodeName&&ne.nodeName.toLowerCase(),le==="select"||le==="input"&&ne.type==="file")var St=Yb;else if(Qb(ne))if(Xb)St=oA;else{St=sA;var Me=iA}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&$h(ee.elementType)&&(St=Yb):St=lA;if(St&&(St=St(r,ee))){Kb(he,St,u,ce);break e}Me&&Me(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Bh(ne,"number",ne.value)}switch(Me=ee?Ne(ee):window,r){case"focusin":(Qb(Me)||Me.contentEditable==="true")&&(dl=Me,tm=ee,Ko=null);break;case"focusout":Ko=tm=dl=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,ix(he,u,ce);break;case"selectionchange":if(cA)break;case"keydown":case"keyup":ix(he,u,ce)}var Xe;if(Xh)e:{switch(r){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else cl?Gb(r,u)&&(ct="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ct="onCompositionStart");ct&&(Hb&&u.locale!=="ko"&&(cl||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&cl&&(Xe=Pb()):(yi=ce,Gh="value"in yi?yi.value:yi.textContent,cl=!0)),Me=Hd(ee,ct),0<Me.length&&(ct=new $b(ct,r,null,u,ce),he.push({event:ct,listeners:Me}),Xe?ct.data=Xe:(Xe=Vb(u),Xe!==null&&(ct.data=Xe)))),(Xe=eA?tA(r,u):nA(r,u))&&(ct=Hd(ee,"onBeforeInput"),0<ct.length&&(Me=new $b("onBeforeInput","beforeinput",null,u,ce),he.push({event:Me,listeners:ct}),Me.data=Xe)),VA(he,r,ee,u,ce)}Rw(he,i)})}function xu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function Hd(r,i){for(var u=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=$o(r,u),y!=null&&d.unshift(xu(r,y,v)),y=$o(r,i),y!=null&&d.push(xu(r,y,v))),r.tag===3)return d;r=r.return}return[]}function XA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function zw(r,i,u,d,y){for(var v=i._reactName,j=[];u!==null&&u!==d;){var A=u,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===d)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,y?(ee=$o(u,v),ee!=null&&j.unshift(xu(u,ee,H))):y||(ee=$o(u,v),ee!=null&&j.push(xu(u,ee,H)))),u=u.return}j.length!==0&&r.push({event:i,listeners:j})}var WA=/\r\n?/g,JA=/\u0000|\uFFFD/g;function Mw(r){return(typeof r=="string"?r:""+r).replace(WA,`
49
- `).replace(JA,"")}function Dw(r,i){return i=Mw(i),Mw(r)===i}function Rt(r,i,u,d,y,v){switch(u){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ll(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ll(r,""+d);break;case"className":Vc(r,"class",d);break;case"tabIndex":Vc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Vc(r,u,d);break;case"style":Db(r,d,v);break;case"data":if(i!=="object"){Vc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Kc(""+d),r.setAttribute(u,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(u,"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 v=="function"&&(u==="formAction"?(i!=="input"&&Rt(r,i,"name",y.name,y,null),Rt(r,i,"formEncType",y.formEncType,y,null),Rt(r,i,"formMethod",y.formMethod,y,null),Rt(r,i,"formTarget",y.formTarget,y,null)):(Rt(r,i,"encType",y.encType,y,null),Rt(r,i,"method",y.method,y,null),Rt(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Kc(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=La);break;case"onScroll":d!=null&&st("scroll",r);break;case"onScrollEnd":d!=null&&st("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.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"){r.removeAttribute("xlink:href");break}u=Kc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);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"?r.setAttribute(u,""+d):r.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":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"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":d===!0?r.setAttribute(u,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,d):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(u,d):r.removeAttribute(u);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(u):r.setAttribute(u,d);break;case"popover":st("beforetoggle",r),st("toggle",r),Gc(r,"popover",d);break;case"xlinkActuate":Ia(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ia(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ia(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ia(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ia(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ia(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Gc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=NT.get(u)||u,Gc(r,u,d))}}function Np(r,i,u,d,y,v){switch(u){case"style":Db(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof d=="string"?ll(r,d):(typeof d=="number"||typeof d=="bigint")&&ll(r,""+d);break;case"onScroll":d!=null&&st("scroll",r);break;case"onScrollEnd":d!=null&&st("scrollend",r);break;case"onClick":d!=null&&(r.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pn.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),i=u.slice(2,y?u.length-7:void 0),v=r[Zt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,d,y);break e}u in r?r[u]=d:d===!0?r.setAttribute(u,""):Gc(r,u,d)}}}function Fn(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",r),st("load",r);var d=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var j=u[v];if(j!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,v,j,u,null)}}y&&Rt(r,i,"srcSet",u.srcSet,u,null),d&&Rt(r,i,"src",u.src,u,null);return;case"input":st("invalid",r);var A=v=j=y=null,H=null,ee=null;for(d in u)if(u.hasOwnProperty(d)){var ce=u[d];if(ce!=null)switch(d){case"name":y=ce;break;case"type":j=ce;break;case"checked":H=ce;break;case"defaultChecked":ee=ce;break;case"value":v=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,i));break;default:Rt(r,i,d,ce,u,null)}}Rb(r,v,A,H,ee,j,y,!1);return;case"select":st("invalid",r),d=j=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":j=A;break;case"multiple":d=A;default:Rt(r,i,y,A,u,null)}i=v,u=j,r.multiple=!!d,i!=null?sl(r,!!d,i,!1):u!=null&&sl(r,!!d,u,!0);return;case"textarea":st("invalid",r),v=y=d=null;for(j in u)if(u.hasOwnProperty(j)&&(A=u[j],A!=null))switch(j){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Rt(r,i,j,A,u,null)}zb(r,d,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(d=u[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Rt(r,i,H,d,u,null)}return;case"dialog":st("beforetoggle",r),st("toggle",r),st("cancel",r),st("close",r);break;case"iframe":case"object":st("load",r);break;case"video":case"audio":for(d=0;d<bu.length;d++)st(bu[d],r);break;case"image":st("error",r),st("load",r);break;case"details":st("toggle",r);break;case"embed":case"source":case"link":st("error",r),st("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in u)if(u.hasOwnProperty(ee)&&(d=u[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,ee,d,u,null)}return;default:if($h(i)){for(ce in u)u.hasOwnProperty(ce)&&(d=u[ce],d!==void 0&&Np(r,i,ce,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&Rt(r,i,A,d,u,null))}function e2(r,i,u,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,j=null,A=null,H=null,ee=null,ce=null;for(le in u){var he=u[le];if(u.hasOwnProperty(le)&&he!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=he;default:d.hasOwnProperty(le)||Rt(r,i,le,null,d,he)}}for(var ne in d){var le=d[ne];if(he=u[ne],d.hasOwnProperty(ne)&&(le!=null||he!=null))switch(ne){case"type":v=le;break;case"name":y=le;break;case"checked":ee=le;break;case"defaultChecked":ce=le;break;case"value":j=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:le!==he&&Rt(r,i,ne,le,d,he)}}Uh(r,j,A,H,ee,ce,v,y);return;case"select":le=j=A=ne=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":le=H;default:d.hasOwnProperty(v)||Rt(r,i,v,null,d,H)}for(y in d)if(v=d[y],H=u[y],d.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":ne=v;break;case"defaultValue":A=v;break;case"multiple":j=v;default:v!==H&&Rt(r,i,y,v,d,H)}i=A,u=j,d=le,ne!=null?sl(r,!!u,ne,!1):!!d!=!!u&&(i!=null?sl(r,!!u,i,!0):sl(r,!!u,u?[]:"",!1));return;case"textarea":le=ne=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(r,i,A,null,d,y)}for(j in d)if(y=d[j],v=u[j],d.hasOwnProperty(j)&&(y!=null||v!=null))switch(j){case"value":ne=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Rt(r,i,j,y,d,v)}Ob(r,ne,le);return;case"option":for(var Te in u)if(ne=u[Te],u.hasOwnProperty(Te)&&ne!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Rt(r,i,Te,null,d,ne)}for(H in d)if(ne=d[H],le=u[H],d.hasOwnProperty(H)&&ne!==le&&(ne!=null||le!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:Rt(r,i,H,ne,d,le)}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 He in u)ne=u[He],u.hasOwnProperty(He)&&ne!=null&&!d.hasOwnProperty(He)&&Rt(r,i,He,null,d,ne);for(ee in d)if(ne=d[ee],le=u[ee],d.hasOwnProperty(ee)&&ne!==le&&(ne!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:Rt(r,i,ee,ne,d,le)}return;default:if($h(i)){for(var Ot in u)ne=u[Ot],u.hasOwnProperty(Ot)&&ne!==void 0&&!d.hasOwnProperty(Ot)&&Np(r,i,Ot,void 0,d,ne);for(ce in d)ne=d[ce],le=u[ce],!d.hasOwnProperty(ce)||ne===le||ne===void 0&&le===void 0||Np(r,i,ce,ne,d,le);return}}for(var K in u)ne=u[K],u.hasOwnProperty(K)&&ne!=null&&!d.hasOwnProperty(K)&&Rt(r,i,K,null,d,ne);for(he in d)ne=d[he],le=u[he],!d.hasOwnProperty(he)||ne===le||ne==null&&le==null||Rt(r,i,he,ne,d,le)}function Iw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function t2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),d=0;d<u.length;d++){var y=u[d],v=y.transferSize,j=y.initiatorType,A=y.duration;if(v&&A&&Iw(j)){for(j=0,A=y.responseEnd,d+=1;d<u.length;d++){var H=u[d],ee=H.startTime;if(ee>A)break;var ce=H.transferSize,he=H.initiatorType;ce&&Iw(he)&&(H=H.responseEnd,j+=ce*(H<A?1:(A-ee)/(H-ee)))}if(--d,i+=8*(v+j)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var _p=null,Tp=null;function qd(r){return r.nodeType===9?r:r.ownerDocument}function Lw(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Pw(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Ap(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Rp=null;function n2(){var r=window.event;return r&&r.type==="popstate"?r===Rp?!1:(Rp=r,!0):(Rp=null,!1)}var Uw=typeof setTimeout=="function"?setTimeout:void 0,r2=typeof clearTimeout=="function"?clearTimeout:void 0,Bw=typeof Promise=="function"?Promise:void 0,a2=typeof queueMicrotask=="function"?queueMicrotask:typeof Bw<"u"?function(r){return Bw.resolve(null).then(r).catch(i2)}:Uw;function i2(r){setTimeout(function(){throw r})}function Mi(r){return r==="head"}function $w(r,i){var u=i,d=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(d===0){r.removeChild(y),Pl(i);return}d--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")d++;else if(u==="html")wu(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,wu(u);for(var v=u.firstChild;v;){var j=v.nextSibling,A=v.nodeName;v[gi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=j}}else u==="body"&&wu(r.ownerDocument.body);u=y}while(u);Pl(i)}function Fw(r,i){var u=r;r=0;do{var d=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),d&&d.nodeType===8)if(u=d.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=d}while(u)}function Op(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var u=i;switch(i=i.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Op(u),Pe(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function s2(r,i,u,d){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[gi])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Yr(r.nextSibling),r===null)break}return null}function l2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Yr(r.nextSibling),r===null))return null;return r}function Hw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Yr(r.nextSibling),r===null))return null;return r}function zp(r){return r.data==="$?"||r.data==="$~"}function Mp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function o2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var d=function(){i(),u.removeEventListener("DOMContentLoaded",d)};u.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Yr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Dp=null;function qw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return Yr(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function Zw(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(i===0)return r;i--}else u!=="/$"&&u!=="/&"||i++}r=r.previousSibling}return null}function Gw(r,i,u){switch(i=qd(u),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function wu(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Pe(r)}var Xr=new Map,Vw=new Set;function Zd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ja=te.d;te.d={f:u2,r:c2,D:d2,C:f2,L:h2,m:m2,X:g2,S:p2,M:y2};function u2(){var r=Ja.f(),i=Id();return r||i}function c2(r){var i=me(r);i!==null&&i.tag===5&&i.type==="form"?c0(i):Ja.r(r)}var Dl=typeof document>"u"?null:document;function Qw(r,i,u){var d=Dl;if(d&&typeof i=="string"&&i){var y=Hr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Vw.has(y)||(Vw.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Fn(i,"link",r),ft(i),d.head.appendChild(i)))}}function d2(r){Ja.D(r),Qw("dns-prefetch",r,null)}function f2(r,i){Ja.C(r,i),Qw("preconnect",r,i)}function h2(r,i,u){Ja.L(r,i,u);var d=Dl;if(d&&r&&i){var y='link[rel="preload"][as="'+Hr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Hr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Hr(u.imageSizes)+'"]')):y+='[href="'+Hr(r)+'"]';var v=y;switch(i){case"style":v=Il(r);break;case"script":v=Ll(r)}Xr.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),Xr.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(Su(v))||i==="script"&&d.querySelector(ku(v))||(i=d.createElement("link"),Fn(i,"link",r),ft(i),d.head.appendChild(i)))}}function m2(r,i){Ja.m(r,i);var u=Dl;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Hr(d)+'"][href="'+Hr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Ll(r)}if(!Xr.has(v)&&(r=g({rel:"modulepreload",href:r},i),Xr.set(v,r),u.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ku(v)))return}d=u.createElement("link"),Fn(d,"link",r),ft(d),u.head.appendChild(d)}}}function p2(r,i,u){Ja.S(r,i,u);var d=Dl;if(d&&r){var y=bt(d).hoistableStyles,v=Il(r);i=i||"default";var j=y.get(v);if(!j){var A={loading:0,preload:null};if(j=d.querySelector(Su(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=Xr.get(v))&&Ip(r,u);var H=j=d.createElement("link");ft(H),Fn(H,"link",r),H._p=new Promise(function(ee,ce){H.onload=ee,H.onerror=ce}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Gd(j,i,d)}j={type:"stylesheet",instance:j,count:1,state:A},y.set(v,j)}}}function g2(r,i){Ja.X(r,i);var u=Dl;if(u&&r){var d=bt(u).hoistableScripts,y=Ll(r),v=d.get(y);v||(v=u.querySelector(ku(y)),v||(r=g({src:r,async:!0},i),(i=Xr.get(y))&&Lp(r,i),v=u.createElement("script"),ft(v),Fn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function y2(r,i){Ja.M(r,i);var u=Dl;if(u&&r){var d=bt(u).hoistableScripts,y=Ll(r),v=d.get(y);v||(v=u.querySelector(ku(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=Xr.get(y))&&Lp(r,i),v=u.createElement("script"),ft(v),Fn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function Kw(r,i,u,d){var y=(y=ue.current)?Zd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=Il(u.href),u=bt(y).hoistableStyles,d=u.get(i),d||(d={type:"style",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Il(u.href);var v=bt(y).hoistableStyles,j=v.get(r);if(j||(y=y.ownerDocument||y,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,j),(v=y.querySelector(Su(r)))&&!v._p&&(j.instance=v,j.state.loading=5),Xr.has(r)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Xr.set(r,u),v||v2(y,r,u,j.state))),i&&d===null)throw Error(a(528,""));return j}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ll(u),u=bt(y).hoistableScripts,d=u.get(i),d||(d={type:"script",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Il(r){return'href="'+Hr(r)+'"'}function Su(r){return'link[rel="stylesheet"]['+r+"]"}function Yw(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function v2(r,i,u,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Fn(i,"link",u),ft(i),r.head.appendChild(i))}function Ll(r){return'[src="'+Hr(r)+'"]'}function ku(r){return"script[async]"+r}function Xw(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Hr(u.href)+'"]');if(d)return i.instance=d,ft(d),d;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),ft(d),Fn(d,"style",y),Gd(d,u.precedence,r),i.instance=d;case"stylesheet":y=Il(u.href);var v=r.querySelector(Su(y));if(v)return i.state.loading|=4,i.instance=v,ft(v),v;d=Yw(u),(y=Xr.get(y))&&Ip(d,y),v=(r.ownerDocument||r).createElement("link"),ft(v);var j=v;return j._p=new Promise(function(A,H){j.onload=A,j.onerror=H}),Fn(v,"link",d),i.state.loading|=4,Gd(v,u.precedence,r),i.instance=v;case"script":return v=Ll(u.src),(y=r.querySelector(ku(v)))?(i.instance=y,ft(y),y):(d=u,(y=Xr.get(v))&&(d=g({},u),Lp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),ft(y),Fn(y,"link",d),r.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Gd(d,u.precedence,r));return i.instance}function Gd(r,i,u){for(var d=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,j=0;j<d.length;j++){var A=d[j];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Ip(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Lp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Vd=null;function Ww(r,i,u){if(Vd===null){var d=new Map,y=Vd=new Map;y.set(u,d)}else y=Vd,d=y.get(u),d||(d=new Map,y.set(u,d));if(d.has(r))return d;for(d.set(r,null),u=u.getElementsByTagName(r),y=0;y<u.length;y++){var v=u[y];if(!(v[gi]||v[cn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var j=v.getAttribute(i)||"";j=r+j;var A=d.get(j);A?A.push(v):d.set(j,[v])}}return d}function Jw(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function b2(r,i,u){if(u===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function eS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function x2(r,i,u,d){if(u.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Il(d.href),v=i.querySelector(Su(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Qd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,ft(v);return}v=i.ownerDocument||i,d=Yw(d),(y=Xr.get(y))&&Ip(d,y),v=v.createElement("link"),ft(v);var j=v;j._p=new Promise(function(A,H){j.onload=A,j.onerror=H}),Fn(v,"link",d),u.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Qd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Pp=0;function w2(r,i){return r.stylesheets&&r.count===0&&Yd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var d=setTimeout(function(){if(r.stylesheets&&Yd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Pp===0&&(Pp=62500*t2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Yd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Pp?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Qd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Kd=null;function Yd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Kd=new Map,i.forEach(S2,r),Kd=null,Qd.call(r))}function S2(r,i){if(!(i.state.loading&4)){var u=Kd.get(r);if(u)var d=u.get(null);else{u=new Map,Kd.set(r,u);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var j=y[v];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(u.set(j.dataset.precedence,j),d=j)}d&&u.set(null,d)}y=i.instance,j=y.getAttribute("data-precedence"),v=u.get(j)||d,v===d&&u.set(null,y),u.set(j,y),this.count++,d=Qd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var ju={$$typeof:O,Provider:null,Consumer:null,_currentValue:ke,_currentValue2:ke,_threadCount:0};function k2(r,i,u,d,y,v,j,A,H){this.tag=1,this.containerInfo=r,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=et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=et(0),this.hiddenUpdates=et(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function tS(r,i,u,d,y,v,j,A,H,ee,ce,he){return r=new k2(r,i,u,j,H,ee,ce,he,A),i=1,v===!0&&(i|=24),v=Ar(3,null,null,i),r.current=v,v.stateNode=r,i=ym(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},wm(v),r}function nS(r){return r?(r=ml,r):ml}function rS(r,i,u,d,y,v){y=nS(y),d.context===null?d.context=y:d.pendingContext=y,d=ki(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=ji(r,d,i),u!==null&&(vr(u,r,i),nu(u,r,i))}function aS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Up(r,i){aS(r,i),(r=r.alternate)&&aS(r,i)}function iS(r){if(r.tag===13||r.tag===31){var i=xs(r,67108864);i!==null&&vr(i,r,67108864),Up(r,67108864)}}function sS(r){if(r.tag===13||r.tag===31){var i=Dr();i=rr(i);var u=xs(r,i);u!==null&&vr(u,r,i),Up(r,i)}}var Xd=!0;function j2(r,i,u,d){var y=q.T;q.T=null;var v=te.p;try{te.p=2,Bp(r,i,u,d)}finally{te.p=v,q.T=y}}function C2(r,i,u,d){var y=q.T;q.T=null;var v=te.p;try{te.p=8,Bp(r,i,u,d)}finally{te.p=v,q.T=y}}function Bp(r,i,u,d){if(Xd){var y=$p(d);if(y===null)Ep(r,i,d,Wd,u),oS(r,d);else if(N2(y,r,i,u,d))d.stopPropagation();else if(oS(r,d),i&4&&-1<E2.indexOf(r)){for(;y!==null;){var v=me(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var j=Gn(v.pendingLanes);if(j!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;j;){var H=1<<31-at(j);A.entanglements[1]|=H,j&=~H}Ca(v),(jt&6)===0&&(Md=on()+500,vu(0))}}break;case 31:case 13:A=xs(v,2),A!==null&&vr(A,v,2),Id(),Up(v,2)}if(v=$p(d),v===null&&Ep(r,i,d,Wd,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Ep(r,i,d,null,u)}}function $p(r){return r=Hh(r),Fp(r)}var Wd=null;function Fp(r){if(Wd=null,r=F(r),r!==null){var i=o(r);if(i===null)r=null;else{var u=i.tag;if(u===13){if(r=c(i),r!==null)return r;r=null}else if(u===31){if(r=f(i),r!==null)return r;r=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Wd=r,null}function lS(r){switch(r){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"resize":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"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"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ua()){case oe:return 2;case ye:return 8;case $e:case Ve:return 32;case nt:return 268435456;default:return 32}default:return 32}}var Hp=!1,Di=null,Ii=null,Li=null,Cu=new Map,Eu=new Map,Pi=[],E2="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 oS(r,i){switch(r){case"focusin":case"focusout":Di=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":Cu.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eu.delete(i.pointerId)}}function Nu(r,i,u,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=me(i),i!==null&&iS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function N2(r,i,u,d,y){switch(i){case"focusin":return Di=Nu(Di,r,i,u,d,y),!0;case"dragenter":return Ii=Nu(Ii,r,i,u,d,y),!0;case"mouseover":return Li=Nu(Li,r,i,u,d,y),!0;case"pointerover":var v=y.pointerId;return Cu.set(v,Nu(Cu.get(v)||null,r,i,u,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Eu.set(v,Nu(Eu.get(v)||null,r,i,u,d,y)),!0}return!1}function uS(r){var i=F(r.target);if(i!==null){var u=o(i);if(u!==null){if(i=u.tag,i===13){if(i=c(u),i!==null){r.blockedOn=i,Lo(r.priority,function(){sS(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,Lo(r.priority,function(){sS(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Jd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=$p(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);Fh=d,u.target.dispatchEvent(d),Fh=null}else return i=me(u),i!==null&&iS(i),r.blockedOn=u,!1;i.shift()}return!0}function cS(r,i,u){Jd(r)&&u.delete(i)}function _2(){Hp=!1,Di!==null&&Jd(Di)&&(Di=null),Ii!==null&&Jd(Ii)&&(Ii=null),Li!==null&&Jd(Li)&&(Li=null),Cu.forEach(cS),Eu.forEach(cS)}function ef(r,i){r.blockedOn===i&&(r.blockedOn=null,Hp||(Hp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_2)))}var tf=null;function dS(r){tf!==r&&(tf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){tf===r&&(tf=null);for(var i=0;i<r.length;i+=3){var u=r[i],d=r[i+1],y=r[i+2];if(typeof d!="function"){if(Fp(d||u)===null)continue;break}var v=me(u);v!==null&&(r.splice(i,3),i-=3,$m(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function Pl(r){function i(H){return ef(H,r)}Di!==null&&ef(Di,r),Ii!==null&&ef(Ii,r),Li!==null&&ef(Li,r),Cu.forEach(i),Eu.forEach(i);for(var u=0;u<Pi.length;u++){var d=Pi[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Pi.length&&(u=Pi[0],u.blockedOn===null);)uS(u),u.blockedOn===null&&Pi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(d=0;d<u.length;d+=3){var y=u[d],v=u[d+1],j=y[Zt]||null;if(typeof v=="function")j||dS(u);else if(j){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,j=v[Zt]||null)A=j.formAction;else if(Fp(y)!==null)continue}else A=j.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),dS(u)}}}function fS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(j){return y=j})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(u,20)}function u(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function qp(r){this._internalRoot=r}nf.prototype.render=qp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Dr();rS(u,d,r,i,null,null)},nf.prototype.unmount=qp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;rS(r.current,2,null,r,null,null),Id(),i[Da]=null}};function nf(r){this._internalRoot=r}nf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Io();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Pi.length&&i!==0&&i<Pi[u].priority;u++);Pi.splice(u,0,r),u===0&&uS(r)}};var hS=t.version;if(hS!=="19.2.4")throw Error(a(527,hS,"19.2.4"));te.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var T2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rf.isDisabled&&rf.supportsFiber)try{Ht=rf.inject(T2),Lt=rf}catch{}}return Tu.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=x0,v=w0,j=S0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(j=i.onRecoverableError)),i=tS(r,1,!1,null,null,u,d,null,y,v,j,fS),r[Da]=i.current,Cp(r),new qp(i)},Tu.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=x0,j=w0,A=S0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(d=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(j=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=tS(r,1,!0,i,u??null,d,y,H,v,j,A,fS),i.context=nS(null),u=i.current,d=Dr(),d=rr(d),y=ki(d),y.callback=null,ji(u,y,d),u=d,i.current.lanes=u,gn(i,u),Ca(i),r[Da]=i.current,Cp(r),new nf(i)},Tu.version="19.2.4",Tu}var jS;function B2(){if(jS)return Qp.exports;jS=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(),Qp.exports=U2(),Qp.exports}var $2=B2(),Xs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ps,Vi,ro,ij,F2=(ij=class extends Xs{constructor(){super();_e(this,Ps);_e(this,Vi);_e(this,ro);Se(this,ro,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){B(this,Vi)||this.setEventListener(B(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Vi))==null||t.call(this),Se(this,Vi,void 0))}setEventListener(t){var n;Se(this,ro,t),(n=B(this,Vi))==null||n.call(this),Se(this,Vi,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){B(this,Ps)!==t&&(Se(this,Ps,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof B(this,Ps)=="boolean"?B(this,Ps):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ps=new WeakMap,Vi=new WeakMap,ro=new WeakMap,ij),av=new F2,H2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qi,tv,sj,q2=(sj=class{constructor(){_e(this,Qi,H2);_e(this,tv,!1)}setTimeoutProvider(e){Se(this,Qi,e)}setTimeout(e,t){return B(this,Qi).setTimeout(e,t)}clearTimeout(e){B(this,Qi).clearTimeout(e)}setInterval(e,t){return B(this,Qi).setInterval(e,t)}clearInterval(e){B(this,Qi).clearInterval(e)}},Qi=new WeakMap,tv=new WeakMap,sj),Ds=new q2;function Z2(e){setTimeout(e,0)}var G2=typeof window>"u"||"Deno"in globalThis;function Yn(){}function V2(e,t){return typeof e=="function"?e(t):e}function Qg(e){return typeof e=="number"&&e>=0&&e!==1/0}function vj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function rs(e,t){return typeof e=="function"?e(t):e}function ea(e,t){return typeof e=="function"?e(t):e}function CS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==iv(c,t.options))return!1}else if(!rc(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||s&&s!==t.state.fetchStatus||o&&!o(t))}function ES(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Vs(t.options.mutationKey)!==Vs(o))return!1}else if(!rc(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function iv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Vs)(e)}function Vs(e){return JSON.stringify(e,(t,n)=>Kg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function rc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>rc(e[n],t[n])):!1}var Q2=Object.prototype.hasOwnProperty;function sv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=NS(e)&&NS(t);if(!a&&!(Kg(e)&&Kg(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),f=c.length,m=a?new Array(f):{};let h=0;for(let p=0;p<f;p++){const g=a?p:c[p],x=e[g],w=t[g];if(x===w){m[g]=x,(a?p<o:Q2.call(e,g))&&h++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){m[g]=w;continue}const S=sv(x,w,n+1);m[g]=S,S===x&&h++}return o===f&&h===o?e:m}function ac(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function NS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Kg(e){if(!_S(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!_S(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _S(e){return Object.prototype.toString.call(e)==="[object Object]"}function K2(e){return new Promise(t=>{Ds.setTimeout(t,e)})}function Yg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?sv(e,t):t}function Y2(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function X2(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var lv=Symbol();function bj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===lv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ov(e,t){return typeof e=="function"?e(...t):!!e}function W2(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var ic=(()=>{let e=()=>G2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xg(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var J2=Z2;function eR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=J2;const o=f=>{t?e.push(f):s(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var sn=eR(),ao,Ki,io,lj,tR=(lj=class extends Xs{constructor(){super();_e(this,ao,!0);_e(this,Ki);_e(this,io);Se(this,io,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){B(this,Ki)||this.setEventListener(B(this,io))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Ki))==null||t.call(this),Se(this,Ki,void 0))}setEventListener(t){var n;Se(this,io,t),(n=B(this,Ki))==null||n.call(this),Se(this,Ki,t(this.setOnline.bind(this)))}setOnline(t){B(this,ao)!==t&&(Se(this,ao,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return B(this,ao)}},ao=new WeakMap,Ki=new WeakMap,io=new WeakMap,lj),Lf=new tR;function nR(e){return Math.min(1e3*2**e,3e4)}function xj(e){return(e??"online")==="online"?Lf.isOnline():!0}var Wg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wj(e){let t=!1,n=0,a;const s=Xg(),o=()=>s.status!=="pending",c=k=>{var E;if(!o()){const C=new Wg(k);x(C),(E=e.onCancel)==null||E.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>av.isFocused()&&(e.networkMode==="always"||Lf.isOnline())&&e.canRun(),p=()=>xj(e.networkMode)&&e.canRun(),g=k=>{o()||(a==null||a(),s.resolve(k))},x=k=>{o()||(a==null||a(),s.reject(k))},w=()=>new Promise(k=>{var E;a=C=>{(o()||h())&&k(C)},(E=e.onPause)==null||E.call(e)}).then(()=>{var k;a=void 0,o()||(k=e.onContinue)==null||k.call(e)}),S=()=>{if(o())return;let k;const E=n===0?e.initialPromise:void 0;try{k=E??e.fn()}catch(C){k=Promise.reject(C)}Promise.resolve(k).then(g).catch(C=>{var R;if(o())return;const N=e.retry??(ic.isServer()?0:3),O=e.retryDelay??nR,z=typeof O=="function"?O(n,C):O,L=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!L){x(C);return}n++,(R=e.onFail)==null||R.call(e,n,C),K2(z).then(()=>h()?void 0:w()).then(()=>{t?x(C):S()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?S():w().then(S),s)}}var Us,oj,Sj=(oj=class{constructor(){_e(this,Us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qg(this.gcTime)&&Se(this,Us,Ds.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ic.isServer()?1/0:300*1e3))}clearGcTimeout(){B(this,Us)&&(Ds.clearTimeout(B(this,Us)),Se(this,Us,void 0))}},Us=new WeakMap,oj),Bs,so,Wr,$s,Mn,xc,Fs,Pr,kj,ti,uj,rR=(uj=class extends Sj{constructor(t){super();_e(this,Pr);_e(this,Bs);_e(this,so);_e(this,Wr);_e(this,$s);_e(this,Mn);_e(this,xc);_e(this,Fs);Se(this,Fs,!1),Se(this,xc,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,$s,t.client),Se(this,Wr,B(this,$s).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,Bs,AS(this.options)),this.state=t.state??B(this,Bs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=B(this,Mn))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,xc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=AS(this.options);n.data!==void 0&&(this.setState(TS(n.data,n.dataUpdatedAt)),Se(this,Bs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&B(this,Wr).remove(this)}setData(t,n){const a=Yg(this.state.data,t,this.options);return qe(this,Pr,ti).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){qe(this,Pr,ti).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=B(this,Mn))==null?void 0:a.promise;return(s=B(this,Mn))==null||s.cancel(t),n?n.then(Yn).catch(Yn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return B(this,Bs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ea(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>rs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!vj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Mn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Mn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),B(this,Wr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(B(this,Mn)&&(B(this,Fs)||qe(this,Pr,kj).call(this)?B(this,Mn).cancel({revert:!0}):B(this,Mn).cancelRetry()),this.scheduleGc()),B(this,Wr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qe(this,Pr,ti).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,x,w,S,k,E,C,N,O;if(this.state.fetchStatus!=="idle"&&((m=B(this,Mn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(B(this,Mn))return B(this,Mn).continueRetry(),B(this,Mn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const z=this.observers.find(L=>L.options.queryFn);z&&this.setOptions(z.options)}const a=new AbortController,s=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(Se(this,Fs,!0),a.signal)})},o=()=>{const z=bj(this.options,n),R=(()=>{const $={client:B(this,$s),queryKey:this.queryKey,meta:this.meta};return s($),$})();return Se(this,Fs,!1),this.options.persister?this.options.persister(z,R,this):z(R)},f=(()=>{const z={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:B(this,$s),state:this.state,fetchFn:o};return s(z),z})();(h=this.options.behavior)==null||h.onFetch(f,this),Se(this,so,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&qe(this,Pr,ti).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),Se(this,Mn,wj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:z=>{z instanceof Wg&&z.revert&&this.setState({...B(this,so),fetchStatus:"idle"}),a.abort()},onFail:(z,L)=>{qe(this,Pr,ti).call(this,{type:"failed",failureCount:z,error:L})},onPause:()=>{qe(this,Pr,ti).call(this,{type:"pause"})},onContinue:()=>{qe(this,Pr,ti).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const z=await B(this,Mn).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(w=(x=B(this,Wr).config).onSuccess)==null||w.call(x,z,this),(k=(S=B(this,Wr).config).onSettled)==null||k.call(S,z,this.state.error,this),z}catch(z){if(z instanceof Wg){if(z.silent)return B(this,Mn).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw qe(this,Pr,ti).call(this,{type:"error",error:z}),(C=(E=B(this,Wr).config).onError)==null||C.call(E,z,this),(O=(N=B(this,Wr).config).onSettled)==null||O.call(N,this.state.data,z,this),z}finally{this.scheduleGc()}}},Bs=new WeakMap,so=new WeakMap,Wr=new WeakMap,$s=new WeakMap,Mn=new WeakMap,xc=new WeakMap,Fs=new WeakMap,Pr=new WeakSet,kj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ti=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...jj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...TS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,so,t.manual?s:void 0),s;case"error":const o=t.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),sn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),B(this,Wr).notify({query:this,type:"updated",action:t})})},uj);function jj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function TS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function AS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var wr,mt,wc,lr,Hs,lo,ni,Yi,Sc,oo,uo,qs,Zs,Xi,co,Et,Qu,Jg,ey,ty,ny,ry,ay,iy,Cj,cj,uv=(cj=class extends Xs{constructor(t,n){super();_e(this,Et);_e(this,wr);_e(this,mt);_e(this,wc);_e(this,lr);_e(this,Hs);_e(this,lo);_e(this,ni);_e(this,Yi);_e(this,Sc);_e(this,oo);_e(this,uo);_e(this,qs);_e(this,Zs);_e(this,Xi);_e(this,co,new Set);this.options=n,Se(this,wr,t),Se(this,Yi,null),Se(this,ni,Xg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,mt).addObserver(this),RS(B(this,mt),this.options)?qe(this,Et,Qu).call(this):this.updateResult(),qe(this,Et,ny).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sy(B(this,mt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sy(B(this,mt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,qe(this,Et,ry).call(this),qe(this,Et,ay).call(this),B(this,mt).removeObserver(this)}setOptions(t){const n=this.options,a=B(this,mt);if(this.options=B(this,wr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ea(this.options.enabled,B(this,mt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");qe(this,Et,iy).call(this),B(this,mt).setOptions(this.options),n._defaulted&&!ac(this.options,n)&&B(this,wr).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,mt),observer:this});const s=this.hasListeners();s&&OS(B(this,mt),a,this.options,n)&&qe(this,Et,Qu).call(this),this.updateResult(),s&&(B(this,mt)!==a||ea(this.options.enabled,B(this,mt))!==ea(n.enabled,B(this,mt))||rs(this.options.staleTime,B(this,mt))!==rs(n.staleTime,B(this,mt)))&&qe(this,Et,Jg).call(this);const o=qe(this,Et,ey).call(this);s&&(B(this,mt)!==a||ea(this.options.enabled,B(this,mt))!==ea(n.enabled,B(this,mt))||o!==B(this,Xi))&&qe(this,Et,ty).call(this,o)}getOptimisticResult(t){const n=B(this,wr).getQueryCache().build(B(this,wr),t),a=this.createResult(n,t);return iR(this,a)&&(Se(this,lr,a),Se(this,lo,this.options),Se(this,Hs,B(this,mt).state)),a}getCurrentResult(){return B(this,lr)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&B(this,ni).status==="pending"&&B(this,ni).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){B(this,co).add(t)}getCurrentQuery(){return B(this,mt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=B(this,wr).defaultQueryOptions(t),a=B(this,wr).getQueryCache().build(B(this,wr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return qe(this,Et,Qu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,lr)))}createResult(t,n){var V;const a=B(this,mt),s=this.options,o=B(this,lr),c=B(this,Hs),f=B(this,lo),h=t!==a?t.state:B(this,wc),{state:p}=t;let g={...p},x=!1,w;if(n._optimisticResults){const D=this.hasListeners(),Y=!D&&RS(t,n),ae=D&&OS(t,a,n,s);(Y||ae)&&(g={...g,...jj(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:k,status:E}=g;w=g.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&E==="pending"){let D;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(D=o.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((V=B(this,uo))==null?void 0:V.state.data,B(this,uo)):n.placeholderData,D!==void 0&&(E="success",w=Yg(o==null?void 0:o.data,D,n),x=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===B(this,Sc))w=B(this,oo);else try{Se(this,Sc,n.select),w=n.select(w),w=Yg(o==null?void 0:o.data,w,n),Se(this,oo,w),Se(this,Yi,null)}catch(D){Se(this,Yi,D)}B(this,Yi)&&(S=B(this,Yi),w=B(this,oo),k=Date.now(),E="error");const N=g.fetchStatus==="fetching",O=E==="pending",z=E==="error",L=O&&N,R=w!==void 0,U={status:E,fetchStatus:g.fetchStatus,isPending:O,isSuccess:E==="success",isError:z,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:k,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!O,isLoadingError:z&&!R,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:z&&R,isStale:cv(t,n),refetch:this.refetch,promise:B(this,ni),isEnabled:ea(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=U.data!==void 0,Y=U.status==="error"&&!D,ae=X=>{Y?X.reject(U.error):D&&X.resolve(U.data)},xe=()=>{const X=Se(this,ni,U.promise=Xg());ae(X)},J=B(this,ni);switch(J.status){case"pending":t.queryHash===a.queryHash&&ae(J);break;case"fulfilled":(Y||U.data!==J.value)&&xe();break;case"rejected":(!Y||U.error!==J.reason)&&xe();break}}return U}updateResult(){const t=B(this,lr),n=this.createResult(B(this,mt),this.options);if(Se(this,Hs,B(this,mt).state),Se(this,lo,this.options),B(this,Hs).data!==void 0&&Se(this,uo,B(this,mt)),ac(n,t))return;Se(this,lr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!B(this,co).size)return!0;const c=new Set(o??B(this,co));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,lr)).some(f=>{const m=f;return B(this,lr)[m]!==t[m]&&c.has(m)})};qe(this,Et,Cj).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&qe(this,Et,ny).call(this)}},wr=new WeakMap,mt=new WeakMap,wc=new WeakMap,lr=new WeakMap,Hs=new WeakMap,lo=new WeakMap,ni=new WeakMap,Yi=new WeakMap,Sc=new WeakMap,oo=new WeakMap,uo=new WeakMap,qs=new WeakMap,Zs=new WeakMap,Xi=new WeakMap,co=new WeakMap,Et=new WeakSet,Qu=function(t){qe(this,Et,iy).call(this);let n=B(this,mt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Yn)),n},Jg=function(){qe(this,Et,ry).call(this);const t=rs(this.options.staleTime,B(this,mt));if(ic.isServer()||B(this,lr).isStale||!Qg(t))return;const a=vj(B(this,lr).dataUpdatedAt,t)+1;Se(this,qs,Ds.setTimeout(()=>{B(this,lr).isStale||this.updateResult()},a))},ey=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,mt)):this.options.refetchInterval)??!1},ty=function(t){qe(this,Et,ay).call(this),Se(this,Xi,t),!(ic.isServer()||ea(this.options.enabled,B(this,mt))===!1||!Qg(B(this,Xi))||B(this,Xi)===0)&&Se(this,Zs,Ds.setInterval(()=>{(this.options.refetchIntervalInBackground||av.isFocused())&&qe(this,Et,Qu).call(this)},B(this,Xi)))},ny=function(){qe(this,Et,Jg).call(this),qe(this,Et,ty).call(this,qe(this,Et,ey).call(this))},ry=function(){B(this,qs)&&(Ds.clearTimeout(B(this,qs)),Se(this,qs,void 0))},ay=function(){B(this,Zs)&&(Ds.clearInterval(B(this,Zs)),Se(this,Zs,void 0))},iy=function(){const t=B(this,wr).getQueryCache().build(B(this,wr),this.options);if(t===B(this,mt))return;const n=B(this,mt);Se(this,mt,t),Se(this,wc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Cj=function(t){sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(B(this,lr))}),B(this,wr).getQueryCache().notify({query:B(this,mt),type:"observerResultsUpdated"})})},cj);function aR(e,t){return ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function RS(e,t){return aR(e,t)||e.state.data!==void 0&&sy(e,t,t.refetchOnMount)}function sy(e,t,n){if(ea(t.enabled,e)!==!1&&rs(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&cv(e,t)}return!1}function OS(e,t,n,a){return(e!==t||ea(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&cv(e,n)}function cv(e,t){return ea(t.enabled,e)!==!1&&e.isStaleByTime(rs(t.staleTime,e))}function iR(e,t){return!ac(e.getCurrentResult(),t)}function zS(e){return{onFetch:(t,n)=>{var p,g,x,w,S;const a=t.options,s=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let k=!1;const E=O=>{W2(O,()=>t.signal,()=>k=!0)},C=bj(t.options,t.fetchOptions),N=async(O,z,L)=>{if(k)return Promise.reject();if(z==null&&O.pages.length)return Promise.resolve(O);const $=(()=>{const Y={client:t.client,queryKey:t.queryKey,pageParam:z,direction:L?"backward":"forward",meta:t.options.meta};return E(Y),Y})(),U=await C($),{maxPages:V}=t.options,D=L?X2:Y2;return{pages:D(O.pages,U,V),pageParams:D(O.pageParams,z,V)}};if(s&&o.length){const O=s==="backward",z=O?sR:MS,L={pages:o,pageParams:c},R=z(a,L);f=await N(L,R,O)}else{const O=e??o.length;do{const z=m===0?c[0]??a.initialPageParam:MS(a,f);if(m>0&&z==null)break;f=await N(f,z),m++}while(m<O)}return f};t.options.persister?t.fetchFn=()=>{var k,E;return(E=(k=t.options).persister)==null?void 0:E.call(k,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function MS(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function sR(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var kc,Na,Qn,Gs,_a,Hi,dj,lR=(dj=class extends Sj{constructor(t){super();_e(this,_a);_e(this,kc);_e(this,Na);_e(this,Qn);_e(this,Gs);Se(this,kc,t.client),this.mutationId=t.mutationId,Se(this,Qn,t.mutationCache),Se(this,Na,[]),this.state=t.state||Ej(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){B(this,Na).includes(t)||(B(this,Na).push(t),this.clearGcTimeout(),B(this,Qn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Se(this,Na,B(this,Na).filter(n=>n!==t)),this.scheduleGc(),B(this,Qn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){B(this,Na).length||(this.state.status==="pending"?this.scheduleGc():B(this,Qn).remove(this))}continue(){var t;return((t=B(this,Gs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,x,w,S,k,E,C,N,O,z,L,R,$;const n=()=>{qe(this,_a,Hi).call(this,{type:"continue"})},a={client:B(this,kc),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,Gs,wj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(U,V)=>{qe(this,_a,Hi).call(this,{type:"failed",failureCount:U,error:V})},onPause:()=>{qe(this,_a,Hi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>B(this,Qn).canRun(this)}));const s=this.state.status==="pending",o=!B(this,Gs).canStart();try{if(s)n();else{qe(this,_a,Hi).call(this,{type:"pending",variables:t,isPaused:o}),B(this,Qn).config.onMutate&&await B(this,Qn).config.onMutate(t,this,a);const V=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));V!==this.state.context&&qe(this,_a,Hi).call(this,{type:"pending",context:V,variables:t,isPaused:o})}const U=await B(this,Gs).start();return await((h=(m=B(this,Qn).config).onSuccess)==null?void 0:h.call(m,U,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,U,t,this.state.context,a)),await((w=(x=B(this,Qn).config).onSettled)==null?void 0:w.call(x,U,null,this.state.variables,this.state.context,this,a)),await((k=(S=this.options).onSettled)==null?void 0:k.call(S,U,null,t,this.state.context,a)),qe(this,_a,Hi).call(this,{type:"success",data:U}),U}catch(U){try{await((C=(E=B(this,Qn).config).onError)==null?void 0:C.call(E,U,t,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await((O=(N=this.options).onError)==null?void 0:O.call(N,U,t,this.state.context,a))}catch(V){Promise.reject(V)}try{await((L=(z=B(this,Qn).config).onSettled)==null?void 0:L.call(z,void 0,U,this.state.variables,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await(($=(R=this.options).onSettled)==null?void 0:$.call(R,void 0,U,t,this.state.context,a))}catch(V){Promise.reject(V)}throw qe(this,_a,Hi).call(this,{type:"error",error:U}),U}finally{B(this,Qn).runNext(this)}}},kc=new WeakMap,Na=new WeakMap,Qn=new WeakMap,Gs=new WeakMap,_a=new WeakSet,Hi=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sn.batch(()=>{B(this,Na).forEach(a=>{a.onMutationUpdate(t)}),B(this,Qn).notify({mutation:this,type:"updated",action:t})})},dj);function Ej(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ri,ga,jc,fj,oR=(fj=class extends Xs{constructor(t={}){super();_e(this,ri);_e(this,ga);_e(this,jc);this.config=t,Se(this,ri,new Set),Se(this,ga,new Map),Se(this,jc,0)}build(t,n,a){const s=new lR({client:t,mutationCache:this,mutationId:++af(this,jc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){B(this,ri).add(t);const n=sf(t);if(typeof n=="string"){const a=B(this,ga).get(n);a?a.push(t):B(this,ga).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(B(this,ri).delete(t)){const n=sf(t);if(typeof n=="string"){const a=B(this,ga).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&B(this,ga).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=sf(t);if(typeof n=="string"){const a=B(this,ga).get(n),s=a==null?void 0:a.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=sf(t);if(typeof n=="string"){const s=(a=B(this,ga).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sn.batch(()=>{B(this,ri).forEach(t=>{this.notify({type:"removed",mutation:t})}),B(this,ri).clear(),B(this,ga).clear()})}getAll(){return Array.from(B(this,ri))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>ES(n,a))}findAll(t={}){return this.getAll().filter(n=>ES(t,n))}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return sn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Yn))))}},ri=new WeakMap,ga=new WeakMap,jc=new WeakMap,fj);function sf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ai,Wi,Sr,ii,li,_f,ly,hj,uR=(hj=class extends Xs{constructor(n,a){super();_e(this,li);_e(this,ai);_e(this,Wi);_e(this,Sr);_e(this,ii);Se(this,ai,n),this.setOptions(a),this.bindMethods(),qe(this,li,_f).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=B(this,ai).defaultMutationOptions(n),ac(this.options,a)||B(this,ai).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,Sr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Vs(a.mutationKey)!==Vs(this.options.mutationKey)?this.reset():((s=B(this,Sr))==null?void 0:s.state.status)==="pending"&&B(this,Sr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=B(this,Sr))==null||n.removeObserver(this)}onMutationUpdate(n){qe(this,li,_f).call(this),qe(this,li,ly).call(this,n)}getCurrentResult(){return B(this,Wi)}reset(){var n;(n=B(this,Sr))==null||n.removeObserver(this),Se(this,Sr,void 0),qe(this,li,_f).call(this),qe(this,li,ly).call(this)}mutate(n,a){var s;return Se(this,ii,a),(s=B(this,Sr))==null||s.removeObserver(this),Se(this,Sr,B(this,ai).getMutationCache().build(B(this,ai),this.options)),B(this,Sr).addObserver(this),B(this,Sr).execute(n)}},ai=new WeakMap,Wi=new WeakMap,Sr=new WeakMap,ii=new WeakMap,li=new WeakSet,_f=function(){var a;const n=((a=B(this,Sr))==null?void 0:a.state)??Ej();Se(this,Wi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ly=function(n){sn.batch(()=>{var a,s,o,c,f,m,h,p;if(B(this,ii)&&this.hasListeners()){const g=B(this,Wi).variables,x=B(this,Wi).context,w={client:B(this,ai),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=B(this,ii)).onSuccess)==null||s.call(a,n.data,g,x,w)}catch(S){Promise.reject(S)}try{(c=(o=B(this,ii)).onSettled)==null||c.call(o,n.data,null,g,x,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=B(this,ii)).onError)==null||m.call(f,n.error,g,x,w)}catch(S){Promise.reject(S)}try{(p=(h=B(this,ii)).onSettled)==null||p.call(h,void 0,n.error,g,x,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(B(this,Wi))})})},hj);function DS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function cR(e,t,n){const a=e.slice(0);return a[t]=n,a}var fo,Lr,ho,mo,Jr,Ji,Cc,Ec,Nc,_c,qn,oy,uy,cy,dy,fy,mj,dR=(mj=class extends Xs{constructor(t,n,a){super();_e(this,qn);_e(this,fo);_e(this,Lr);_e(this,ho);_e(this,mo);_e(this,Jr);_e(this,Ji);_e(this,Cc);_e(this,Ec);_e(this,Nc);_e(this,_c,[]);Se(this,fo,t),Se(this,mo,a),Se(this,ho,[]),Se(this,Jr,[]),Se(this,Lr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&B(this,Jr).forEach(t=>{t.subscribe(n=>{qe(this,qn,dy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,B(this,Jr).forEach(t=>{t.destroy()})}setQueries(t,n){Se(this,ho,t),Se(this,mo,n),sn.batch(()=>{const a=B(this,Jr),s=qe(this,qn,cy).call(this,B(this,ho));s.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=s.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,x)=>g!==a[x]),h=f||m,p=h?!0:c.some((g,x)=>{const w=B(this,Lr)[x];return!w||!ac(g,w)});!h&&!p||(h&&(Se(this,_c,s),Se(this,Jr,o)),Se(this,Lr,c),this.hasListeners()&&(h&&(DS(a,o).forEach(g=>{g.destroy()}),DS(o,a).forEach(g=>{g.subscribe(x=>{qe(this,qn,dy).call(this,g,x)})})),qe(this,qn,fy).call(this)))})}getCurrentResult(){return B(this,Lr)}getQueries(){return B(this,Jr).map(t=>t.getCurrentQuery())}getObservers(){return B(this,Jr)}getOptimisticResult(t,n){const a=qe(this,qn,cy).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>qe(this,qn,uy).call(this,c??s,n,o),()=>qe(this,qn,oy).call(this,s,a)]}},fo=new WeakMap,Lr=new WeakMap,ho=new WeakMap,mo=new WeakMap,Jr=new WeakMap,Ji=new WeakMap,Cc=new WeakMap,Ec=new WeakMap,Nc=new WeakMap,_c=new WeakMap,qn=new WeakSet,oy=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},uy=function(t,n,a){if(n){const s=B(this,Nc),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!B(this,Ji)||B(this,Lr)!==B(this,Ec)||o||n!==B(this,Cc))&&(Se(this,Cc,n),Se(this,Ec,B(this,Lr)),a!==void 0&&Se(this,Nc,a),Se(this,Ji,sv(B(this,Ji),n(t)))),B(this,Ji)}return t},cy=function(t){const n=new Map;B(this,Jr).forEach(s=>{const o=s.options.queryHash;if(!o)return;const c=n.get(o);c?c.push(s):n.set(o,[s])});const a=[];return t.forEach(s=>{var m;const o=B(this,fo).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new uv(B(this,fo),o);a.push({defaultedQueryOptions:o,observer:f})}),a},dy=function(t,n){const a=B(this,Jr).indexOf(t);a!==-1&&(Se(this,Lr,cR(B(this,Lr),a,n)),qe(this,qn,fy).call(this))},fy=function(){var t;if(this.hasListeners()){const n=B(this,Ji),a=qe(this,qn,oy).call(this,B(this,Lr),B(this,_c)),s=qe(this,qn,uy).call(this,a,(t=B(this,mo))==null?void 0:t.combine);n!==s&&sn.batch(()=>{this.listeners.forEach(o=>{o(B(this,Lr))})})}},mj),Ta,pj,fR=(pj=class extends Xs{constructor(t={}){super();_e(this,Ta);this.config=t,Se(this,Ta,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??iv(s,n);let c=this.get(o);return c||(c=new rR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){B(this,Ta).has(t.queryHash)||(B(this,Ta).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=B(this,Ta).get(t.queryHash);n&&(t.destroy(),n===t&&B(this,Ta).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return B(this,Ta).get(t)}getAll(){return[...B(this,Ta).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>CS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>CS(t,a)):n}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ta=new WeakMap,pj),an,es,ts,po,go,ns,yo,vo,gj,hR=(gj=class{constructor(e={}){_e(this,an);_e(this,es);_e(this,ts);_e(this,po);_e(this,go);_e(this,ns);_e(this,yo);_e(this,vo);Se(this,an,e.queryCache||new fR),Se(this,es,e.mutationCache||new oR),Se(this,ts,e.defaultOptions||{}),Se(this,po,new Map),Se(this,go,new Map),Se(this,ns,0)}mount(){af(this,ns)._++,B(this,ns)===1&&(Se(this,yo,av.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onFocus())})),Se(this,vo,Lf.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onOnline())})))}unmount(){var e,t;af(this,ns)._--,B(this,ns)===0&&((e=B(this,yo))==null||e.call(this),Se(this,yo,void 0),(t=B(this,vo))==null||t.call(this),Se(this,vo,void 0))}isFetching(e){return B(this,an).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return B(this,es).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,an).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=B(this,an).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(rs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return B(this,an).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=B(this,an).get(a.queryHash),o=s==null?void 0:s.state.data,c=V2(t,o);if(c!==void 0)return B(this,an).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return sn.batch(()=>B(this,an).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,an).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=B(this,an);sn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=B(this,an);return sn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=sn.batch(()=>B(this,an).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(Yn).catch(Yn)}invalidateQueries(e,t={}){return sn.batch(()=>(B(this,an).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=sn.batch(()=>B(this,an).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Yn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(Yn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=B(this,an).build(this,t);return n.isStaleByTime(rs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yn).catch(Yn)}fetchInfiniteQuery(e){return e.behavior=zS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yn).catch(Yn)}ensureInfiniteQueryData(e){return e.behavior=zS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Lf.isOnline()?B(this,es).resumePausedMutations():Promise.resolve()}getQueryCache(){return B(this,an)}getMutationCache(){return B(this,es)}getDefaultOptions(){return B(this,ts)}setDefaultOptions(e){Se(this,ts,e)}setQueryDefaults(e,t){B(this,po).set(Vs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...B(this,po).values()],n={};return t.forEach(a=>{rc(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){B(this,go).set(Vs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...B(this,go).values()],n={};return t.forEach(a=>{rc(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...B(this,ts).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=iv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===lv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...B(this,ts).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){B(this,an).clear(),B(this,es).clear()}},an=new WeakMap,es=new WeakMap,ts=new WeakMap,po=new WeakMap,go=new WeakMap,ns=new WeakMap,yo=new WeakMap,vo=new WeakMap,gj),Nj=b.createContext(void 0),mn=e=>{const t=b.useContext(Nj);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},mR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Nj.Provider,{value:e,children:t})),_j=b.createContext(!1),Tj=()=>b.useContext(_j);_j.Provider;function pR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var gR=b.createContext(pR()),Aj=()=>b.useContext(gR),Rj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ov(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Oj=e=>{b.useEffect(()=>{e.clearReset()},[e])},zj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||ov(n,[e.error,a])),Mj=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...s)=>n(a(...s)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yR=(e,t)=>e.isLoading&&e.isFetching&&!t,hy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,my=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vR({queries:e,...t},n){const a=mn(),s=Tj(),o=Aj(),c=b.useMemo(()=>e.map(k=>{const E=a.defaultQueryOptions(k);return E._optimisticResults=s?"isRestoring":"optimistic",E}),[e,a,s]);c.forEach(k=>{Mj(k);const E=a.getQueryCache().get(k.queryHash);Rj(k,o,E)}),Oj(o);const[f]=b.useState(()=>new dR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(k=>g?f.subscribe(sn.batchCalls(k)):Yn,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((k,E)=>hy(c[E],k))?m.flatMap((k,E)=>{const C=c[E];if(C&&hy(C,k)){const N=new uv(a,C);return my(C,N,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const S=m.find((k,E)=>{const C=c[E];return C&&zj({result:k,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(S!=null&&S.error)throw S.error;return h(p())}function bR(e,t,n){var x,w,S,k;const a=Tj(),s=Aj(),o=mn(),c=o.defaultQueryOptions(e);(w=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||w.call(x,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Mj(c),Rj(c,s,f),Oj(s);const m=!o.getQueryCache().get(c.queryHash),[h]=b.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(E=>{const C=g?h.subscribe(sn.batchCalls(E)):Yn;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),hy(c,p))throw my(c,h,s);if(zj({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((k=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||k.call(S,c,p),c.experimental_prefetchInRender&&!ic.isServer()&&yR(p,a)){const E=m?my(c,h,s):f==null?void 0:f.promise;E==null||E.catch(Yn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ye(e,t){return bR(e,uv)}function wt(e,t){const n=mn(),[a]=b.useState(()=>new uR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(sn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(Yn)},[a]);if(s.error&&ov(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}/**
50
- * react-router v7.13.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var IS="popstate";function LS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function xR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=o||a.location;return py("",{pathname:c,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:sc(s)}return SR(t,n,null,e)}function Vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ra(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wR(){return Math.random().toString(36).substring(2,10)}function PS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function py(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Co(t):t,state:n,key:t&&t.key||a||wR(),unstable_mask:s}}function sc({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Co(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function SR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){f="POP";let E=p(),C=E==null?null:E-h;h=E,m&&m({action:f,location:k.location,delta:C})}function x(E,C){f="PUSH";let N=LS(E)?E:py(k.location,E,C);h=p()+1;let O=PS(N,h),z=k.createHref(N.unstable_mask||N);try{c.pushState(O,"",z)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;s.location.assign(z)}o&&m&&m({action:f,location:k.location,delta:1})}function w(E,C){f="REPLACE";let N=LS(E)?E:py(k.location,E,C);h=p();let O=PS(N,h),z=k.createHref(N.unstable_mask||N);c.replaceState(O,"",z),o&&m&&m({action:f,location:k.location,delta:0})}function S(E){return kR(E)}let k={get action(){return f},get location(){return e(s,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(IS,g),m=E,()=>{s.removeEventListener(IS,g),m=null}},createHref(E){return t(s,E)},createURL:S,encodeLocation(E){let C=S(E);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:w,go(E){return c.go(E)}};return k}function kR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Vt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:sc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Dj(e,t,n="/"){return jR(e,t,n,!1)}function jR(e,t,n,a){let s=typeof t=="string"?Co(t):t,o=oi(s.pathname||"/",n);if(o==null)return null;let c=Ij(e);CR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=IR(o);f=MR(c[m],h,a)}return f}function Ij(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Vt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=Ra([a,p.relativePath]),x=n.concat(p);c.children&&c.children.length>0&&(Vt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Ij(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:OR(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of Lj(c.path))o(c,f,!0,h)}),t}function Lj(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return s?[o,""]:[o];let c=Lj(a.join("/")),f=[];return f.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function CR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:zR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var ER=/^:[\w-]+$/,NR=3,_R=2,TR=1,AR=10,RR=-2,US=e=>e==="*";function OR(e,t){let n=e.split("/"),a=n.length;return n.some(US)&&(a+=RR),t&&(a+=_R),n.filter(s=>!US(s)).reduce((s,o)=>s+(ER.test(o)?NR:o===""?TR:AR),a)}function zR(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function MR(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,p=o==="/"?t:t.slice(o.length)||"/",g=Pf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),x=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=Pf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),c.push({params:s,pathname:Ra([o,g.pathname]),pathnameBase:BR(Ra([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Ra([o,g.pathnameBase]))}return c}function Pf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=DR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:p,isOptional:g},x)=>{if(p==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function DR(e,t=!1,n=!0){ra(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,h,p)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=p.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function IR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ra(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function oi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var LR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function PR(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?Co(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=BS(n.substring(1),"/"):o=BS(n,t)):o=t,{pathname:o,search:$R(a),hash:FR(s)}}function BS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Wp(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function UR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function dv(e){let t=UR(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ah(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Vt(!s.pathname||!s.pathname.includes("?"),Wp("?","pathname","search",s)),Vt(!s.pathname||!s.pathname.includes("#"),Wp("#","pathname","hash",s)),Vt(!s.search||!s.search.includes("#"),Wp("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,f;if(c==null)f=n;else{let g=t.length-1;if(!a&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;s.pathname=x.join("/")}f=g>=0?t[g]:"/"}let m=PR(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Ra=e=>e.join("/").replace(/\/\/+/g,"/"),BR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$R=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,FR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HR=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function qR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ZR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Pj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Uj(e,t){let n=e;if(typeof n!="string"||!LR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Pj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=oi(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{ra(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Bj=["POST","PUT","PATCH","DELETE"];new Set(Bj);var GR=["GET",...Bj];new Set(GR);var Eo=b.createContext(null);Eo.displayName="DataRouter";var ih=b.createContext(null);ih.displayName="DataRouterState";var VR=b.createContext(!1),$j=b.createContext({isTransitioning:!1});$j.displayName="ViewTransition";var QR=b.createContext(new Map);QR.displayName="Fetchers";var KR=b.createContext(null);KR.displayName="Await";var Br=b.createContext(null);Br.displayName="Navigation";var Tc=b.createContext(null);Tc.displayName="Location";var ia=b.createContext({outlet:null,matches:[],isDataRoute:!1});ia.displayName="Route";var fv=b.createContext(null);fv.displayName="RouteError";var Fj="REACT_ROUTER_ERROR",YR="REDIRECT",XR="ROUTE_ERROR_RESPONSE";function WR(e){if(e.startsWith(`${Fj}:${YR}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function JR(e){if(e.startsWith(`${Fj}:${XR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HR(t.status,t.statusText,t.data)}catch{}}function eO(e,{relative:t}={}){Vt(No(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Br),{hash:s,pathname:o,search:c}=Ac(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Ra([n,o])),a.createHref({pathname:f,search:c,hash:s})}function No(){return b.useContext(Tc)!=null}function kr(){return Vt(No(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Tc).location}var Hj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qj(e){b.useContext(Br).static||b.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=b.useContext(ia);return e?pO():tO()}function tO(){Vt(No(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Eo),{basename:t,navigator:n}=b.useContext(Br),{matches:a}=b.useContext(ia),{pathname:s}=kr(),o=JSON.stringify(dv(a)),c=b.useRef(!1);return qj(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(ra(c.current,Hj),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=ah(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Ra([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var nO=b.createContext(null);function rO(e){let t=b.useContext(ia).outlet;return b.useMemo(()=>t&&b.createElement(nO.Provider,{value:e},t),[t,e])}function Zj(){let{matches:e}=b.useContext(ia),t=e[e.length-1];return t?t.params:{}}function Ac(e,{relative:t}={}){let{matches:n}=b.useContext(ia),{pathname:a}=kr(),s=JSON.stringify(dv(n));return b.useMemo(()=>ah(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function aO(e,t){return Gj(e,t)}function Gj(e,t,n){var E;Vt(No(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Br),{matches:s}=b.useContext(ia),o=s[s.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";Qj(f,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let p=kr(),g;if(t){let C=typeof t=="string"?Co(t):t;Vt(m==="/"||((E=C.pathname)==null?void 0:E.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",w=x;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=Dj(e,{pathname:w});ra(h||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ra(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let k=uO(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Ra([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Ra([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&k?b.createElement(Tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function iO(){let e=mO(),t=qR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,c)}var sO=b.createElement(iO,null),Vj=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=JR(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(ia.Provider,{value:this.props.routeContext},b.createElement(fv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(lO,{error:e},t):t}};Vj.contextType=VR;var Jp=new WeakMap;function lO({children:e,error:t}){let{basename:n}=b.useContext(Br);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=WR(t.digest);if(a){let s=Jp.get(t);if(s)throw s;let o=Uj(a.location,n);if(Pj&&!Jp.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Jp.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function oO({routeContext:e,match:t,children:n}){let a=b.useContext(Eo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(ia.Provider,{value:e},n)}function uO(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Vt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:x,errors:w}=a,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(p,g)=>{var x,w;m(p,{location:a.location,params:((w=(x=a.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:ZR(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,x)=>{let w,S=!1,k=null,E=null;a&&(w=o&&g.route.id?o[g.route.id]:void 0,k=g.route.errorElement||sO,c&&(f<0&&x===0?(Qj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,E=null):f===x&&(S=!0,E=g.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,x+1)),N=()=>{let O;return w?O=k:S?O=E:g.route.Component?O=b.createElement(g.route.Component,null):g.route.element?O=g.route.element:O=p,b.createElement(oO,{match:g,routeContext:{outlet:p,matches:C,isDataRoute:a!=null},children:O})};return a&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?b.createElement(Vj,{location:a.location,revalidation:a.revalidation,component:k,error:w,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):N()},null)}function hv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cO(e){let t=b.useContext(Eo);return Vt(t,hv(e)),t}function dO(e){let t=b.useContext(ih);return Vt(t,hv(e)),t}function fO(e){let t=b.useContext(ia);return Vt(t,hv(e)),t}function mv(e){let t=fO(e),n=t.matches[t.matches.length-1];return Vt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hO(){return mv("useRouteId")}function mO(){var a;let e=b.useContext(fv),t=dO("useRouteError"),n=mv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function pO(){let{router:e}=cO("useNavigate"),t=mv("useNavigate"),n=b.useRef(!1);return qj(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{ra(n.current,Hj),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var $S={};function Qj(e,t,n){!t&&!$S[e]&&($S[e]=!0,ra(!1,n))}b.memo(gO);function gO({routes:e,future:t,state:n,isStatic:a,onError:s}){return Gj(e,void 0,{state:n,isStatic:a,onError:s})}function or({to:e,replace:t,state:n,relative:a}){Vt(No(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Br);ra(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=b.useContext(ia),{pathname:c}=kr(),f=_n(),m=ah(e,dv(o),c,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Uf(e){return rO(e.context)}function Dt(e){Vt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Vt(!No(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[f,s,o,c]);typeof n=="string"&&(n=Co(n));let{pathname:h="/",search:p="",hash:g="",state:x=null,key:w="default",unstable_mask:S}=n,k=b.useMemo(()=>{let E=oi(h,f);return E==null?null:{location:{pathname:E,search:p,hash:g,state:x,key:w,unstable_mask:S},navigationType:a}},[f,h,p,g,x,w,a,S]);return ra(k!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:b.createElement(Br.Provider,{value:m},b.createElement(Tc.Provider,{children:t,value:k}))}function vO({children:e,location:t}){return aO(gy(e),t)}function gy(e,t=[]){let n=[];return b.Children.forEach(e,(a,s)=>{if(!b.isValidElement(a))return;let o=[...t,s];if(a.type===b.Fragment){n.push.apply(n,gy(a.props.children,o));return}Vt(a.type===Dt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Vt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=gy(a.props.children,o)),n.push(c)}),n}var Tf="get",Af="application/x-www-form-urlencoded";function sh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bO(e){return sh(e)&&e.tagName.toLowerCase()==="button"}function xO(e){return sh(e)&&e.tagName.toLowerCase()==="form"}function wO(e){return sh(e)&&e.tagName.toLowerCase()==="input"}function SO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kO(e,t){return e.button===0&&(!t||t==="_self")&&!SO(e)}function yy(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(s=>[n,s]):[[n,a]])},[]))}function jO(e,t){let n=yy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var lf=null;function CO(){if(lf===null)try{new FormData(document.createElement("form"),0),lf=!1}catch{lf=!0}return lf}var EO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function eg(e){return e!=null&&!EO.has(e)?(ra(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Af}"`),null):e}function NO(e,t){let n,a,s,o,c;if(xO(e)){let f=e.getAttribute("action");a=f?oi(f,t):null,n=e.getAttribute("method")||Tf,s=eg(e.getAttribute("enctype"))||Af,o=new FormData(e)}else if(bO(e)||wO(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?oi(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Tf,s=eg(e.getAttribute("formenctype"))||eg(f.getAttribute("enctype"))||Af,o=new FormData(f,e),!CO()){let{name:h,type:p,value:g}=e;if(p==="image"){let x=h?`${h}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else h&&o.append(h,g)}}else{if(sh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Tf,a=null,s=Af,c=e}return o&&s==="text/plain"&&(c=o,o=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function pv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _O(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&oi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function TO(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function AO(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function RO(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await TO(o,n);return c.links?c.links():[]}return[]}));return DO(a.flat(1).filter(AO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function FS(e,t,n,a,s,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var p;return n[h].pathname!==m.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var g;let p=a.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function OO(e,t,{includeHydrateFallback:n}={}){return zO(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function zO(e){return[...new Set(e)]}function MO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function DO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(MO(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function Kj(){let e=b.useContext(Eo);return pv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function IO(){let e=b.useContext(ih);return pv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var gv=b.createContext(void 0);gv.displayName="FrameworkContext";function Yj(){let e=b.useContext(gv);return pv(e,"You must render this element inside a <HydratedRouter> element"),e}function LO(e,t){let n=b.useContext(gv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,x=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let k=C=>{C.forEach(N=>{c(N.isIntersecting)})},E=new IntersectionObserver(k,{threshold:.5});return x.current&&E.observe(x.current),()=>{E.disconnect()}}},[e]),b.useEffect(()=>{if(a){let k=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(k)}}},[a]);let w=()=>{s(!0)},S=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,x,{}]:[o,x,{onFocus:Au(f,w),onBlur:Au(m,S),onMouseEnter:Au(h,w),onMouseLeave:Au(p,S),onTouchStart:Au(g,w)}]:[!1,x,{}]}function Au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function PO({page:e,...t}){let{router:n}=Kj(),a=b.useMemo(()=>Dj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(BO,{page:e,matches:a,...t}):null}function UO(e){let{manifest:t,routeModules:n}=Yj(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return RO(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function BO({page:e,matches:t,...n}){let a=kr(),{future:s,manifest:o,routeModules:c}=Yj(),{basename:f}=Kj(),{loaderData:m,matches:h}=IO(),p=b.useMemo(()=>FS(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>FS(e,t,h,o,a,"assets"),[e,t,h,o,a]),x=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let k=new Set,E=!1;if(t.forEach(N=>{var z;let O=o.routes[N.route.id];!O||!O.hasLoader||(!p.some(L=>L.route.id===N.route.id)&&N.route.id in m&&((z=c[N.route.id])!=null&&z.shouldRevalidate)||O.hasClientLoader?E=!0:k.add(N.route.id))}),k.size===0)return[];let C=_O(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return E&&k.size>0&&C.searchParams.set("_routes",t.filter(N=>k.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),w=b.useMemo(()=>OO(g,o),[g,o]),S=UO(g);return b.createElement(b.Fragment,null,x.map(k=>b.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...n})),w.map(k=>b.createElement("link",{key:k,rel:"modulepreload",href:k,...n})),S.map(({key:k,link:E})=>b.createElement("link",{key:k,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function $O(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var FO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{FO&&(window.__reactRouterVersion="7.13.1")}catch{}function HO({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=xR({window:a,v5Compat:!0}));let o=s.current,[c,f]=b.useState({action:o.action,location:o.location}),m=b.useCallback(h=>{n===!1?f(h):b.startTransition(()=>f(h))},[n]);return b.useLayoutEffect(()=>o.listen(m),[o,m]),b.createElement(yO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var Xj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...S},k){let{basename:E,navigator:C,unstable_useTransitions:N}=b.useContext(Br),O=typeof p=="string"&&Xj.test(p),z=Uj(p,E);p=z.to;let L=eO(p,{relative:s}),R=kr(),$=null;if(f){let X=ah(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);E!=="/"&&(X.pathname=X.pathname==="/"?E:Ra([E,X.pathname])),$=C.createHref(X)}let[U,V,D]=LO(a,S),Y=GO(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:N});function ae(X){t&&t(X),X.defaultPrevented||Y(X)}let xe=!(z.isExternal||o),J=b.createElement("a",{...S,...D,href:(xe?$:void 0)||z.absoluteURL||L,onClick:xe?ae:t,ref:$O(k,V),target:h,"data-discover":!O&&n==="render"?"true":void 0});return U&&!O?b.createElement(b.Fragment,null,J,b.createElement(PO,{page:L})):J});Rc.displayName="Link";var yv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},p){let g=Ac(c,{relative:h.relative}),x=kr(),w=b.useContext(ih),{navigator:S,basename:k}=b.useContext(Br),E=w!=null&&XO(g)&&f===!0,C=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,N=x.pathname,O=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(N=N.toLowerCase(),O=O?O.toLowerCase():null,C=C.toLowerCase()),O&&k&&(O=oi(O,k)||O);const z=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=N===C||!s&&N.startsWith(C)&&N.charAt(z)==="/",R=O!=null&&(O===C||!s&&O.startsWith(C)&&O.charAt(C.length)==="/"),$={isActive:L,isPending:R,isTransitioning:E},U=L?t:void 0,V;typeof a=="function"?V=a($):V=[a,L?"active":null,R?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o($):o;return b.createElement(Rc,{...h,"aria-current":U,className:V,ref:p,style:D,to:c,viewTransition:f},typeof m=="function"?m($):m)});yv.displayName="NavLink";var qO=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=Tf,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},S)=>{let{unstable_useTransitions:k}=b.useContext(Br),E=KO(),C=YO(f,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&Xj.test(f),z=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let R=L.nativeEvent.submitter,$=(R==null?void 0:R.getAttribute("formmethod"))||c,U=()=>E(R||L.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&n!==!1?b.startTransition(()=>U()):U()};return b.createElement("form",{ref:S,method:N,action:C,onSubmit:a?m:z,...w,"data-discover":!O&&e==="render"?"true":void 0})});qO.displayName="Form";function ZO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wj(e){let t=b.useContext(Eo);return Vt(t,ZO(e)),t}function GO(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=_n(),g=kr(),x=Ac(e,{relative:c});return b.useCallback(w=>{if(kO(w,t)){w.preventDefault();let S=n!==void 0?n:sc(g)===sc(x),k=()=>p(e,{replace:S,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>k()):k()}},[g,p,x,n,a,s,t,e,o,c,f,m,h])}function lh(e){ra(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(yy(e)),n=b.useRef(!1),a=kr(),s=b.useMemo(()=>jO(a.search,n.current?null:t.current),[a.search]),o=_n(),c=b.useCallback((f,m)=>{const h=yy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var VO=0,QO=()=>`__${String(++VO)}__`;function KO(){let{router:e}=Wj("useSubmit"),{basename:t}=b.useContext(Br),n=hO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=NO(o,t);if(c.navigate===!1){let x=c.fetcherKey||QO();await a(x,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function YO(e,{relative:t}={}){let{basename:n}=b.useContext(Br),a=b.useContext(ia);Vt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Ac(e||".",{relative:t})},c=kr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Ra([n,o.pathname])),sc(o)}function XO(e,{relative:t}={}){let n=b.useContext($j);Vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Wj("useViewTransitionState"),s=Ac(e,{relative:t});if(!n.isTransitioning)return!1;let o=oi(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=oi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Pf(s.pathname,c)!=null||Pf(s.pathname,o)!=null}const WO="/api/v1";async function JO(e,t){const n=await fetch(`${WO}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok){const a=await n.text();let s;try{s=JSON.parse(a).error??a}catch{s=a}throw new Error(s)}return await n.json()}const Jj="/api/v1",vv="first-tree-hub:tokens";let vy=null;function Ru(e){vy=e}function Tn(e){if(!vy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(vy)}${e}`}function by(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function oh(){const e=localStorage.getItem(vv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function xy(e){localStorage.setItem(vv,JSON.stringify(e))}function eC(){localStorage.removeItem(vv)}class Oc extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Ou=null;async function ez(){const e=oh();return e!=null&&e.refreshToken?tC(e.refreshToken):null}async function tC(e){return Ou||(Ou=(async()=>{try{const t=await fetch(`${Jj}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(!t.ok)return null;const n=await t.json(),a={accessToken:n.accessToken,refreshToken:n.refreshToken??e};return xy(a),a}catch{return null}finally{Ou=null}})(),Ou)}async function zu(e,t){const{method:n="GET",body:a}=t??{},s=f=>{const m={};return f&&(m.Authorization=`Bearer ${f}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${Jj}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=oh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await tC(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(eC(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const p=JSON.parse(f);m=p.error??f,Array.isArray(p.details)&&(h=p.details.filter(g=>typeof g=="object"&&g!==null&&Array.isArray(g.path)))}catch{m=f}throw new Oc(c.status,m,h)}if(c.status!==204)return await c.json()}const Ee={get:e=>zu(e),post:(e,t)=>zu(e,{method:"POST",body:t}),patch:(e,t)=>zu(e,{method:"PATCH",body:t}),put:(e,t)=>zu(e,{method:"PUT",body:t}),delete:e=>zu(e,{method:"DELETE"})},bv="onboarding:joinPath",tz="onboarding:draft",wy="onboarding:step1Confirmed";function nC(){return typeof window>"u"?!1:window.sessionStorage.getItem(wy)==="1"}function nz(e){typeof window>"u"||(e?window.sessionStorage.setItem(wy,"1"):window.sessionStorage.removeItem(wy))}const Sy="onboarding:agentUuid";function rz(){return typeof window>"u"?null:window.sessionStorage.getItem(Sy)}function az(e){typeof window>"u"||(e?window.sessionStorage.setItem(Sy,e):window.sessionStorage.removeItem(Sy))}function rC(e){typeof window>"u"||window.sessionStorage.setItem(bv,e)}function aC(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(bv);return e==="solo"||e==="invite"?e:null}function iz(){typeof window>"u"||window.sessionStorage.removeItem(bv)}function sz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function xv(e){return`${tz}:${e}`}function lz(e){if(!e||typeof e!="object"||!("displayName"in e)||typeof e.displayName!="string")return null;const t="selectedRuntime"in e?e.selectedRuntime:null;if(t!==null&&typeof t!="string")return null;const n="connectToken"in e?e.connectToken:null;if(n!==null&&typeof n!="string")return null;const a="connectTokenExpiresAt"in e?e.connectTokenExpiresAt:null;return a!==null&&typeof a!="number"?null:{displayName:e.displayName,selectedRuntime:t,connectToken:n,connectTokenExpiresAt:a}}function oz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(xv(e));if(!t)return null;try{return lz(JSON.parse(t))}catch{return null}}function uz(e,t){typeof window>"u"||window.sessionStorage.setItem(xv(e),JSON.stringify(t))}function cz(e){typeof window>"u"||window.sessionStorage.removeItem(xv(e))}function dz(){if(typeof window>"u")return;const e=window.sessionStorage,t=[];for(let n=0;n<e.length;n++){const a=e.key(n);a!=null&&a.startsWith("onboarding:")&&t.push(a)}for(const n of t)e.removeItem(n)}const iC=b.createContext(null),ky="first-tree-hub:selectedOrganizationId";function fz(){try{return localStorage.getItem(ky)}catch{return null}}function tg(e){try{e===null?localStorage.removeItem(ky):localStorage.setItem(ky,e)}catch{}}function hz({children:e}){const t=mn(),[n,a]=b.useState(()=>!!oh()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const V=fz();return Ru(V),V}),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),E=b.useCallback(()=>{eC(),tg(null),Ru(null),t.clear(),dz(),a(!1),o(null),f([]),h(null),g(null),w(null),k(!1)},[t]),C=b.useCallback(async()=>{var V,D;try{const Y=await Ee.get("/me");o(Y.user??null);const ae=Y.memberships??[];f(ae);const xe=((V=Y.onboarding)==null?void 0:V.step)??null;g(xe),w(((D=Y.onboarding)==null?void 0:D.dismissedAt)??null),xe==="completed"&&iz(),h(J=>{var te;const X=J&&ae.some(ke=>ke.organizationId===J)?J:null;if(X)return Ru(X),X;const q=Y.defaultOrganizationId??((te=ae[0])==null?void 0:te.organizationId)??null;return tg(q),Ru(q),q})}catch{}finally{k(!0)}},[]),N=b.useCallback(async(V,D)=>{const Y=await JO(V,D);xy({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await C()},[C]),O=b.useCallback(async V=>{xy(V),a(!0),await C()},[C]),z=b.useCallback(async V=>{tg(V),Ru(V),t.clear(),h(V),await C()},[C,t]),L=b.useRef(null);b.useEffect(()=>{L.current=x},[x]);const R=b.useCallback(async()=>{const V=L.current;w(new Date().toISOString());try{const D=await Ee.patch("/me/onboarding",{dismissed:!0});D!=null&&D.dismissedAt&&w(D.dismissedAt)}catch{w(V)}},[]),$=b.useCallback(async()=>{const V=L.current;w(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{w(V)}},[]);b.useEffect(()=>{n&&!s&&C()},[n,s,C]),b.useEffect(()=>{const V=()=>E();return window.addEventListener("auth:logout",V),()=>window.removeEventListener("auth:logout",V)},[E]);const U=b.useMemo(()=>c.length===0?null:c.find(D=>D.organizationId===m)??c[0]??null,[c,m]);return l.jsx(iC.Provider,{value:{isAuthenticated:n,meLoaded:S,user:s,memberships:c,currentMembership:U,organizationId:(U==null?void 0:U.organizationId)??null,memberId:(U==null?void 0:U.id)??null,role:(U==null?void 0:U.role)??null,agentId:(U==null?void 0:U.agentId)??null,onboardingStep:p,onboardingDismissedAt:x,dismissOnboarding:R,restoreOnboarding:$,login:N,adoptTokens:O,selectOrganization:z,refreshMe:C,logout:E},children:e})}function gt(){const e=b.useContext(iC);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const mz="modulepreload",pz=function(e){return"/"+e},HS={},gz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.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]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=c(n.map(h=>{if(h=pz(h),h in HS)return;HS[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":mz,p||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),p)return new Promise((w,S)=>{x.addEventListener("load",w),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return s.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},yz=b.lazy(()=>gz(()=>import("./index-Dyo6TAWC.js"),[]).then(e=>({default:e.LandingPage}))),qS=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function vz(){const{isAuthenticated:e,meLoaded:t}=gt(),n=kr();return e?t?l.jsx(Uf,{}):l.jsx(qS,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(qS,{}),children:l.jsx(yz,{})}):l.jsx(or,{to:"/login",replace:!0,state:{from:n}})}/**
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 sC=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();/**
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 bz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
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
- */const xz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
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 ZS=e=>{const t=xz(e);return t.charAt(0).toUpperCase()+t.slice(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
- */var wz={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"};/**
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 Sz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
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 kz=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...f},m)=>b.createElement("svg",{ref:m,...wz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:sC("lucide",s),...!o&&!Sz(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,p])=>b.createElement(h,p)),...Array.isArray(o)?o:[o]]));/**
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 rt=(e,t)=>{const n=b.forwardRef(({className:a,...s},o)=>b.createElement(kz,{ref:o,iconNode:t,className:sC(`lucide-${bz(ZS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=ZS(e),n};/**
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 jz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wv=rt("arrow-left",jz);/**
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 Cz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],lC=rt("arrow-right",Cz);/**
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 Ez=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],oC=rt("arrow-up",Ez);/**
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 Nz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],_z=rt("at-sign",Nz);/**
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 Tz=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Az=rt("bell",Tz);/**
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 Rz=[["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"}]],uC=rt("bot",Rz);/**
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 Oz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=rt("check",Oz);/**
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 zz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sv=rt("chevron-down",zz);/**
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 Mz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cC=rt("chevron-right",Mz);/**
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 Dz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Iz=rt("circle-check",Dz);/**
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 Lz=[["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"}]],uh=rt("copy",Lz);/**
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 Pz=[["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"}]],Uz=rt("ellipsis",Pz);/**
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 Bz=[["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"}]],$z=rt("external-link",Bz);/**
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 Fz=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Hz=rt("eye-off",Fz);/**
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 qz=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],dC=rt("eye",qz);/**
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 Zz=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],Gz=rt("folder-tree",Zz);/**
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 Vz=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],fC=rt("github",Vz);/**
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 Qz=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Kz=rt("layout-dashboard",Qz);/**
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 Yz=[["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"}]],jy=rt("link-2",Yz);/**
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 Xz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],hC=rt("loader-circle",Xz);/**
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 Wz=[["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"}]],kv=rt("lock",Wz);/**
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 Jz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],e3=rt("log-out",Jz);/**
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 t3=[["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"}]],jv=rt("message-square",t3);/**
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 n3=[["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"}]],r3=rt("moon",n3);/**
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 a3=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],i3=rt("paperclip",a3);/**
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 s3=[["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"}]],Cv=rt("pencil",s3);/**
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 l3=[["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"}]],mC=rt("play",l3);/**
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 o3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ba=rt("plus",o3);/**
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 u3=[["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"}]],c3=rt("refresh-cw",u3);/**
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 d3=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ch=rt("search",d3);/**
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 f3=[["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"}]],h3=rt("sun",f3);/**
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 m3=[["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"}]],Bf=rt("trash-2",m3);/**
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 p3=[["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"}]],Ws=rt("triangle-alert",p3);/**
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 g3=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],y3=rt("undo-2",g3);/**
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 v3=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],pC=rt("user-plus",v3);/**
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 b3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],x3=rt("user",b3);/**
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 w3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ss=rt("x",w3);/**
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 S3=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],k3=rt("zap",S3);function gC(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gC(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function yC(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gC(e))&&(a&&(a+=" "),a+=t);return a}const j3=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},C3=(e,t)=>({classGroupId:e,validator:t}),vC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$f="-",GS=[],E3="arbitrary..",N3=e=>{const t=T3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return _3(c);const f=c.split($f),m=f[0]===""&&f.length>1?1:0;return bC(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?j3(h,m):m:h||GS}return n[c]||GS}}},bC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=bC(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join($f):e.slice(t).join($f),m=c.length;for(let h=0;h<m;h++){const p=c[h];if(p.validator(f))return p.classGroupId}},_3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?E3+a:void 0})(),T3=e=>{const{theme:t,classGroups:n}=e;return A3(n,t)},A3=(e,t)=>{const n=vC();for(const a in e){const s=e[a];Ev(s,n,a,t)}return n},Ev=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];R3(c,t,n,a)}},R3=(e,t,n,a)=>{if(typeof e=="string"){O3(e,t,n);return}if(typeof e=="function"){z3(e,t,n,a);return}M3(e,t,n,a)},O3=(e,t,n)=>{const a=e===""?t:xC(t,e);a.classGroupId=n},z3=(e,t,n,a)=>{if(D3(e)){Ev(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(C3(n,e))},M3=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];Ev(m,xC(t,f),n,a)}},xC=(e,t)=>{let n=e;const a=t.split($f),s=a.length;for(let o=0;o<s;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=vC(),n.nextPart.set(c,f)),n=f}return n},D3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,I3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return s(o,c),c},set(o,c){o in n?n[o]=c:s(o,c)}}},Cy="!",VS=":",L3=[],QS=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),P3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const p=s.length;for(let k=0;k<p;k++){const E=s[k];if(c===0&&f===0){if(E===VS){o.push(s.slice(m,k)),m=k+1;continue}if(E==="/"){h=k;continue}}E==="["?c++:E==="]"?c--:E==="("?f++:E===")"&&f--}const g=o.length===0?s:s.slice(m);let x=g,w=!1;g.endsWith(Cy)?(x=g.slice(0,-1),w=!0):g.startsWith(Cy)&&(x=g.slice(1),w=!0);const S=h&&h>m?h-m:void 0;return QS(o,w,x,S)};if(t){const s=t+VS,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):QS(L3,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},U3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",m=t.has(c);f||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(c)):s.push(c)}return s.length>0&&(s.sort(),a.push(...s)),a}},B3=e=>({cache:I3(e.cacheSize),parseClassName:P3(e),sortModifiers:U3(e),...N3(e)}),$3=/\s+/,F3=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split($3);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:x,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:k}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let E=!!k,C=a(E?S.substring(0,k):S);if(!C){if(!E){m=p+(m.length>0?" "+m:m);continue}if(C=a(S),!C){m=p+(m.length>0?" "+m:m);continue}E=!1}const N=x.length===0?"":x.length===1?x[0]:o(x).join(":"),O=w?N+Cy:N,z=O+C;if(c.indexOf(z)>-1)continue;c.push(z);const L=s(C,E);for(let R=0;R<L.length;++R){const $=L[R];c.push(O+$)}m=p+(m.length>0?" "+m:m)}return m},H3=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=wC(n))&&(s&&(s+=" "),s+=a);return s},wC=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=wC(e[a]))&&(n&&(n+=" "),n+=t);return n},q3=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=B3(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const p=F3(m,n);return s(m,p),p};return o=c,(...m)=>o(H3(...m))},Z3=[],Nn=e=>{const t=n=>n[e]||Z3;return t.isThemeGetter=!0,t},SC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,V3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q3=/\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$/,K3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Y3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,X3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bi=e=>G3.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),$i=e=>!!e&&Number.isInteger(Number(e)),ng=e=>e.endsWith("%")&&tt(e.slice(0,-1)),ei=e=>V3.test(e),jC=()=>!0,W3=e=>Q3.test(e)&&!K3.test(e),Nv=()=>!1,J3=e=>Y3.test(e),eM=e=>X3.test(e),tM=e=>!Re(e)&&!Oe(e),nM=e=>fs(e,NC,Nv),Re=e=>SC.test(e),zs=e=>fs(e,_C,W3),KS=e=>fs(e,cM,tt),rM=e=>fs(e,AC,jC),aM=e=>fs(e,TC,Nv),YS=e=>fs(e,CC,Nv),iM=e=>fs(e,EC,eM),of=e=>fs(e,RC,J3),Oe=e=>kC.test(e),Mu=e=>Js(e,_C),sM=e=>Js(e,TC),XS=e=>Js(e,CC),lM=e=>Js(e,NC),oM=e=>Js(e,EC),uf=e=>Js(e,RC,!0),uM=e=>Js(e,AC,!0),fs=(e,t,n)=>{const a=SC.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Js=(e,t,n=!1)=>{const a=kC.exec(e);return a?a[1]?t(a[1]):n:!1},CC=e=>e==="position"||e==="percentage",EC=e=>e==="image"||e==="url",NC=e=>e==="length"||e==="size"||e==="bg-size",_C=e=>e==="length",cM=e=>e==="number",TC=e=>e==="family-name",AC=e=>e==="number"||e==="weight",RC=e=>e==="shadow",dM=()=>{const e=Nn("color"),t=Nn("font"),n=Nn("text"),a=Nn("font-weight"),s=Nn("tracking"),o=Nn("leading"),c=Nn("breakpoint"),f=Nn("container"),m=Nn("spacing"),h=Nn("radius"),p=Nn("shadow"),g=Nn("inset-shadow"),x=Nn("text-shadow"),w=Nn("drop-shadow"),S=Nn("blur"),k=Nn("perspective"),E=Nn("aspect"),C=Nn("ease"),N=Nn("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...z(),Oe,Re],R=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],U=()=>[Oe,Re,m],V=()=>[Bi,"full","auto",...U()],D=()=>[$i,"none","subgrid",Oe,Re],Y=()=>["auto",{span:["full",$i,Oe,Re]},$i,Oe,Re],ae=()=>[$i,"auto",Oe,Re],xe=()=>["auto","min","max","fr",Oe,Re],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...U()],te=()=>[Bi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],ke=()=>[Bi,"screen","full","dvw","lvw","svw","min","max","fit",...U()],Ae=()=>[Bi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],M=()=>[e,Oe,Re],I=()=>[...z(),XS,YS,{position:[Oe,Re]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",lM,nM,{size:[Oe,Re]}],Z=()=>[ng,Mu,zs],Q=()=>["","none","full",h,Oe,Re],ue=()=>["",tt,Mu,zs],je=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[tt,ng,XS,YS],De=()=>["","none",S,Oe,Re],Ue=()=>["none",tt,Oe,Re],dt=()=>["none",tt,Oe,Re],ot=()=>[tt,Oe,Re],re=()=>[Bi,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ei],breakpoint:[ei],color:[jC],container:[ei],"drop-shadow":[ei],ease:["in","out","in-out"],font:[tM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ei],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ei],shadow:[ei],spacing:["px",tt],text:[ei],"text-shadow":[ei],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bi,Re,Oe,E]}],container:["container"],columns:[{columns:[tt,Re,Oe,f]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:L()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{"inset-s":V(),start:V()}],end:[{"inset-e":V(),end:V()}],"inset-bs":[{"inset-bs":V()}],"inset-be":[{"inset-be":V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[$i,"auto",Oe,Re]}],basis:[{basis:[Bi,"full","auto",f,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Bi,"auto","initial","none",Re]}],grow:[{grow:["",tt,Oe,Re]}],shrink:[{shrink:["",tt,Oe,Re]}],order:[{order:[$i,"first","last","none",Oe,Re]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":xe()}],"auto-rows":[{"auto-rows":xe()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],"inline-size":[{inline:["auto",...ke()]}],"min-inline-size":[{"min-inline":["auto",...ke()]}],"max-inline-size":[{"max-inline":["none",...ke()]}],"block-size":[{block:["auto",...Ae()]}],"min-block-size":[{"min-block":["auto",...Ae()]}],"max-block-size":[{"max-block":["none",...Ae()]}],w:[{w:[f,"screen",...te()]}],"min-w":[{"min-w":[f,"screen","none",...te()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",n,Mu,zs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,uM,rM]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ng,Re]}],"font-family":[{font:[sM,aM,t]}],"font-features":[{"font-features":[Re]}],"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:[s,Oe,Re]}],"line-clamp":[{"line-clamp":[tt,"none",Oe,KS]}],leading:[{leading:[o,...U()]}],"list-image":[{"list-image":["none",Oe,Re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,Re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...je(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",Oe,zs]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[tt,"auto",Oe,Re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,Re]}],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",Oe,Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$i,Oe,Re],radial:["",Oe,Re],conic:[$i,Oe,Re]},oM,iM]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...je(),"hidden","none"]}],"divide-style":[{divide:[...je(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...je(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Oe,Re]}],"outline-w":[{outline:["",tt,Mu,zs]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,uf,of]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,uf,of]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[tt,zs]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",x,uf,of]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[tt,Oe,Re]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Oe,Re]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":z()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,Re]}],filter:[{filter:["","none",Oe,Re]}],blur:[{blur:De()}],brightness:[{brightness:[tt,Oe,Re]}],contrast:[{contrast:[tt,Oe,Re]}],"drop-shadow":[{"drop-shadow":["","none",w,uf,of]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",tt,Oe,Re]}],"hue-rotate":[{"hue-rotate":[tt,Oe,Re]}],invert:[{invert:["",tt,Oe,Re]}],saturate:[{saturate:[tt,Oe,Re]}],sepia:[{sepia:["",tt,Oe,Re]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,Re]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[tt,Oe,Re]}],"backdrop-contrast":[{"backdrop-contrast":[tt,Oe,Re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,Oe,Re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,Oe,Re]}],"backdrop-invert":[{"backdrop-invert":["",tt,Oe,Re]}],"backdrop-opacity":[{"backdrop-opacity":[tt,Oe,Re]}],"backdrop-saturate":[{"backdrop-saturate":[tt,Oe,Re]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,Oe,Re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,Re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",Oe,Re]}],ease:[{ease:["linear","initial",C,Oe,Re]}],delay:[{delay:[tt,Oe,Re]}],animate:[{animate:["none",N,Oe,Re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Oe,Re]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:ot()}],"skew-x":[{"skew-x":ot()}],"skew-y":[{"skew-y":ot()}],transform:[{transform:[Oe,Re,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Oe,Re]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",Oe,Re]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[tt,Mu,zs,KS]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["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-r","border-w-l"],"border-w-y":["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-r","border-color-l"],"border-color-y":["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-mr","scroll-ml"],"scroll-my":["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-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},fM=q3(dM);function ze(...e){return fM(yC(e))}function lc(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e)):"—"}function OC(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function hM(e){return Ee.delete(`/clients/${encodeURIComponent(e)}`)}function zc(){return Ee.get(Tn("/activity"))}function ls(){return Ee.get("/me/clients")}function dh(e){return Ee.get(`/clients/${e}`)}function mM(e){return Ee.post(`/clients/${e}/disconnect`)}function pM(){return Ee.post("/me/connect-tokens")}const WS=e=>["agent-sessions",e];function gM(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.toolUseId!="string"||typeof t.name!="string"||t.status!=="pending"&&t.status!=="ok"&&t.status!=="error"?null:{toolUseId:t.toolUseId,name:t.name,args:t.args,status:t.status,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0,resultPreview:typeof t.resultPreview=="string"?t.resultPreview:void 0}}function yM(e){if(typeof e!="object"||e===null)return null;const t=e;return t.source!=="sdk"&&t.source!=="runtime"&&t.source!=="tool"||typeof t.message!="string"?null:{source:t.source,message:t.message}}function vM(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function zC(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Ee.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function bM(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Ee.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var JS=1,xM=.9,wM=.8,SM=.17,rg=.1,ag=.999,kM=.9999,jM=.99,CM=/[\\\/_+.#"@\[\(\{&]/,EM=/[\\\/_+.#"@\[\(\{&]/g,NM=/[\s-]/,MC=/[\s-]/g;function Ey(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?JS:jM;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,x,w,S;h>=0;)g=Ey(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=JS:CM.test(e.charAt(h-1))?(g*=wM,w=e.slice(s,h-1).match(EM),w&&s>0&&(g*=Math.pow(ag,w.length))):NM.test(e.charAt(h-1))?(g*=xM,S=e.slice(s,h-1).match(MC),S&&s>0&&(g*=Math.pow(ag,S.length))):(g*=SM,s>0&&(g*=Math.pow(ag,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=kM)),(g<rg&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(x=Ey(e,t,n,a,h+1,o+2,c),x*rg>g&&(g=x*rg)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function e1(e){return e.toLowerCase().replace(MC," ")}function _M(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ey(e,t,e1(e),e1(t),0,0,{})}function as(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function t1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function os(...e){return t=>{let n=!1;const a=e.map(s=>{const o=t1(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<a.length;s++){const o=a[s];typeof o=="function"?o():t1(e[s],null)}}}}function el(...e){return b.useCallback(os(...e),e)}function TM(e,t){const n=b.createContext(t),a=o=>{const{children:c,...f}=o,m=b.useMemo(()=>f,Object.values(f));return l.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=b.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,s]}function AM(e,t=[]){let n=[];function a(o,c){const f=b.createContext(c),m=n.length;n=[...n,c];const h=g=>{var C;const{scope:x,children:w,...S}=g,k=((C=x==null?void 0:x[e])==null?void 0:C[m])||f,E=b.useMemo(()=>S,Object.values(S));return l.jsx(k.Provider,{value:E,children:w})};h.displayName=o+"Provider";function p(g,x){var k;const w=((k=x==null?void 0:x[e])==null?void 0:k[m])||f,S=b.useContext(w);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(c=>b.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,RM(s,...t)]}function RM(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const g=m(o)[`__scope${h}`];return{...f,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var oc=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},OM=rv[" useId ".trim().toString()]||(()=>{}),zM=0;function si(e){const[t,n]=b.useState(OM());return oc(()=>{n(a=>a??String(zM++))},[e]),t?`radix-${t}`:""}var MM=rv[" useInsertionEffect ".trim().toString()]||oc;function DM({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=IM({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const g=p.current;g!==f&&console.warn(`${a} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=f},[f,a])}const h=b.useCallback(p=>{var g;if(f){const x=LM(p)?p(e):p;x!==e&&((g=c.current)==null||g.call(c,x))}else o(p)},[f,e,o,c]);return[m,h]}function IM({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return MM(()=>{o.current=t},[t]),b.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function LM(e){return typeof e=="function"}var _v=yj();const PM=rh(_v);function DC(e){const t=UM(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find($M);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function UM(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=HM(s),f=FM(o,s.props);return s.type!==b.Fragment&&(f.ref=a?os(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BM=Symbol("radix.slottable");function $M(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BM}function FM(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function HM(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ci=qM.reduce((e,t)=>{const n=DC(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function ZM(e,t){e&&_v.flushSync(()=>e.dispatchEvent(t))}function uc(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function GM(e,t=globalThis==null?void 0:globalThis.document){const n=uc(e);b.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var VM="DismissableLayer",Ny="dismissableLayer.update",QM="dismissableLayer.pointerDownOutside",KM="dismissableLayer.focusOutside",n1,IC=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),LC=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(IC),[p,g]=b.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=b.useState({}),S=el(t,$=>g($)),k=Array.from(h.layers),[E]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=k.indexOf(E),N=p?k.indexOf(p):-1,O=h.layersWithOutsidePointerEventsDisabled.size>0,z=N>=C,L=WM($=>{const U=$.target,V=[...h.branches].some(D=>D.contains(U));!z||V||(s==null||s($),c==null||c($),$.defaultPrevented||f==null||f())},x),R=JM($=>{const U=$.target;[...h.branches].some(D=>D.contains(U))||(o==null||o($),c==null||c($),$.defaultPrevented||f==null||f())},x);return GM($=>{N===h.layers.size-1&&(a==null||a($),!$.defaultPrevented&&f&&($.preventDefault(),f()))},x),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(n1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),r1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=n1)}},[p,x,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),r1())},[p,h]),b.useEffect(()=>{const $=()=>w({});return document.addEventListener(Ny,$),()=>document.removeEventListener(Ny,$)},[]),l.jsx(ci.div,{...m,ref:S,style:{pointerEvents:O?z?"auto":"none":void 0,...e.style},onFocusCapture:as(e.onFocusCapture,R.onFocusCapture),onBlurCapture:as(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:as(e.onPointerDownCapture,L.onPointerDownCapture)})});LC.displayName=VM;var YM="DismissableLayerBranch",XM=b.forwardRef((e,t)=>{const n=b.useContext(IC),a=b.useRef(null),s=el(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(ci.div,{...e,ref:s})});XM.displayName=YM;function WM(e,t=globalThis==null?void 0:globalThis.document){const n=uc(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){PC(QM,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function JM(e,t=globalThis==null?void 0:globalThis.document){const n=uc(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&PC(KM,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function r1(){const e=new CustomEvent(Ny);document.dispatchEvent(e)}function PC(e,t,n,{discrete:a}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?ZM(s,o):s.dispatchEvent(o)}var ig="focusScope.autoFocusOnMount",sg="focusScope.autoFocusOnUnmount",a1={bubbles:!1,cancelable:!0},eD="FocusScope",UC=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=b.useState(null),h=uc(s),p=uc(o),g=b.useRef(null),x=el(t,k=>m(k)),w=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let k=function(O){if(w.paused||!f)return;const z=O.target;f.contains(z)?g.current=z:qi(g.current,{select:!0})},E=function(O){if(w.paused||!f)return;const z=O.relatedTarget;z!==null&&(f.contains(z)||qi(g.current,{select:!0}))},C=function(O){if(document.activeElement===document.body)for(const L of O)L.removedNodes.length>0&&qi(f)};document.addEventListener("focusin",k),document.addEventListener("focusout",E);const N=new MutationObserver(C);return f&&N.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",E),N.disconnect()}}},[a,f,w.paused]),b.useEffect(()=>{if(f){s1.add(w);const k=document.activeElement;if(!f.contains(k)){const C=new CustomEvent(ig,a1);f.addEventListener(ig,h),f.dispatchEvent(C),C.defaultPrevented||(tD(sD(BC(f)),{select:!0}),document.activeElement===k&&qi(f))}return()=>{f.removeEventListener(ig,h),setTimeout(()=>{const C=new CustomEvent(sg,a1);f.addEventListener(sg,p),f.dispatchEvent(C),C.defaultPrevented||qi(k??document.body,{select:!0}),f.removeEventListener(sg,p),s1.remove(w)},0)}}},[f,h,p,w]);const S=b.useCallback(k=>{if(!n&&!a||w.paused)return;const E=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,C=document.activeElement;if(E&&C){const N=k.currentTarget,[O,z]=nD(N);O&&z?!k.shiftKey&&C===z?(k.preventDefault(),n&&qi(O,{select:!0})):k.shiftKey&&C===O&&(k.preventDefault(),n&&qi(z,{select:!0})):C===N&&k.preventDefault()}},[n,a,w.paused]);return l.jsx(ci.div,{tabIndex:-1,...c,ref:x,onKeyDown:S})});UC.displayName=eD;function tD(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(qi(a,{select:t}),document.activeElement!==n)return}function nD(e){const t=BC(e),n=i1(t,e),a=i1(t.reverse(),e);return[n,a]}function BC(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const s=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||s?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function i1(e,t){for(const n of e)if(!rD(n,{upTo:t}))return n}function rD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function aD(e){return e instanceof HTMLInputElement&&"select"in e}function qi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&aD(e)&&t&&e.select()}}var s1=iD();function iD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=l1(e,t),e.unshift(t)},remove(t){var n;e=l1(e,t),(n=e[0])==null||n.resume()}}}function l1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function sD(e){return e.filter(t=>t.tagName!=="A")}var lD="Portal",$C=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);oc(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?PM.createPortal(l.jsx(ci.div,{...a,ref:t}),c):null});$C.displayName=lD;function oD(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var fh=e=>{const{present:t,children:n}=e,a=uD(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=el(a.ref,cD(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};fh.displayName="Presence";function uD(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=oD(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=cf(a.current);o.current=f==="mounted"?h:"none"},[f]),oc(()=>{const h=a.current,p=s.current;if(p!==e){const x=o.current,w=cf(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),oc(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=w=>{const k=cf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(m("ANIMATION_END"),!s.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},x=w=>{w.target===t&&(o.current=cf(a.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function cf(e){return(e==null?void 0:e.animationName)||"none"}function cD(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lg=0;function dD(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??o1()),document.body.insertAdjacentElement("beforeend",e[1]??o1()),lg++,()=>{lg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),lg--}},[])}function o1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Aa=function(){return Aa=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Aa.apply(this,arguments)};function FC(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}function fD(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,o;a<s;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var Rf="right-scroll-bar-position",Of="width-before-scroll-bar",hD="with-scroll-bars-hidden",mD="--removed-body-scroll-bar-size";function og(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pD(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var gD=typeof window<"u"?b.useLayoutEffect:b.useEffect,u1=new WeakMap;function yD(e,t){var n=pD(null,function(a){return e.forEach(function(s){return og(s,a)})});return gD(function(){var a=u1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||og(f,null)}),o.forEach(function(f){s.has(f)||og(f,c)})}u1.set(n,e)},[e]),n}function vD(e){return e}function bD(e,t){t===void 0&&(t=vD);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(o),c=n}var m=function(){var p=c;c=[],p.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return s}function xD(e){e===void 0&&(e={});var t=bD(null);return t.options=Aa({async:!0,ssr:!1},e),t}var HC=function(e){var t=e.sideCar,n=FC(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return b.createElement(a,Aa({},n))};HC.isSideCarExport=!0;function wD(e,t){return e.useMedium(t),HC}var qC=xD(),ug=function(){},hh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:ug,onWheelCapture:ug,onTouchMoveCapture:ug}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,x=e.sideCar,w=e.noRelative,S=e.noIsolation,k=e.inert,E=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,O=e.gapMode,z=FC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=x,R=yD([n,t]),$=Aa(Aa({},z),s);return b.createElement(b.Fragment,null,p&&b.createElement(L,{sideCar:qC,removeScrollBar:h,shards:g,noRelative:w,noIsolation:S,inert:k,setCallbacks:o,allowPinchZoom:!!E,lockRef:n,gapMode:O}),c?b.cloneElement(b.Children.only(f),Aa(Aa({},$),{ref:R})):b.createElement(N,Aa({},$,{className:m,ref:R}),f))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Of,zeroRight:Rf};var SD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SD();return t&&e.setAttribute("nonce",t),e}function jD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ED=function(){var e=0,t=null;return{add:function(n){e==0&&(t=kD())&&(jD(t,n),CD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ND=function(){var e=ED();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ZC=function(){var e=ND(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},_D={left:0,top:0,right:0,gap:0},cg=function(e){return parseInt(e||"",10)||0},TD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[cg(n),cg(a),cg(s)]},AD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _D;var t=TD(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},RD=ZC(),eo="data-scroll-locked",OD=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
291
- .`.concat(hD,` {
292
- overflow: hidden `).concat(a,`;
293
- padding-right: `).concat(f,"px ").concat(a,`;
294
- }
295
- body[`).concat(eo,`] {
296
- overflow: hidden `).concat(a,`;
297
- overscroll-behavior: contain;
298
- `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
299
- padding-left: `.concat(s,`px;
300
- padding-top: `).concat(o,`px;
301
- padding-right: `).concat(c,`px;
302
- margin-left:0;
303
- margin-top:0;
304
- margin-right: `).concat(f,"px ").concat(a,`;
305
- `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
306
- }
307
-
308
- .`).concat(Rf,` {
309
- right: `).concat(f,"px ").concat(a,`;
310
- }
311
-
312
- .`).concat(Of,` {
313
- margin-right: `).concat(f,"px ").concat(a,`;
314
- }
315
-
316
- .`).concat(Rf," .").concat(Rf,` {
317
- right: 0 `).concat(a,`;
318
- }
319
-
320
- .`).concat(Of," .").concat(Of,` {
321
- margin-right: 0 `).concat(a,`;
322
- }
323
-
324
- body[`).concat(eo,`] {
325
- `).concat(mD,": ").concat(f,`px;
326
- }
327
- `)},c1=function(){var e=parseInt(document.body.getAttribute(eo)||"0",10);return isFinite(e)?e:0},zD=function(){b.useEffect(function(){return document.body.setAttribute(eo,(c1()+1).toString()),function(){var e=c1()-1;e<=0?document.body.removeAttribute(eo):document.body.setAttribute(eo,e.toString())}},[])},MD=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;zD();var o=b.useMemo(function(){return AD(s)},[s]);return b.createElement(RD,{styles:OD(o,!t,s,n?"":"!important")})},_y=!1;if(typeof window<"u")try{var df=Object.defineProperty({},"passive",{get:function(){return _y=!0,!0}});window.addEventListener("test",df,df),window.removeEventListener("test",df,df)}catch{_y=!1}var Ul=_y?{passive:!1}:!1,DD=function(e){return e.tagName==="TEXTAREA"},GC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!DD(e)&&n[t]==="visible")},ID=function(e){return GC(e,"overflowY")},LD=function(e){return GC(e,"overflowX")},d1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=VC(e,a);if(s){var o=QC(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},PD=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},UD=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},VC=function(e,t){return e==="v"?ID(t):LD(t)},QC=function(e,t){return e==="v"?PD(t):UD(t)},BD=function(e,t){return e==="h"&&t==="rtl"?-1:1},$D=function(e,t,n,a,s){var o=BD(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,p=c>0,g=0,x=0;do{if(!f)break;var w=QC(e,f),S=w[0],k=w[1],E=w[2],C=k-E-o*S;(S||C)&&VC(e,f)&&(g+=C,x+=S);var N=f.parentNode;f=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},ff=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},f1=function(e){return[e.deltaX,e.deltaY]},h1=function(e){return e&&"current"in e?e.current:e},FD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HD=function(e){return`
328
- .block-interactivity-`.concat(e,` {pointer-events: none;}
329
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
330
- `)},qD=0,Bl=[];function ZD(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(qD++)[0],o=b.useState(ZC)[0],c=b.useRef(e);b.useEffect(function(){c.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var k=fD([e.lockRef.current],(e.shards||[]).map(h1),!0).filter(Boolean);return k.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),k.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(k,E){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!c.current.allowPinchZoom;var C=ff(k),N=n.current,O="deltaX"in k?k.deltaX:N[0]-C[0],z="deltaY"in k?k.deltaY:N[1]-C[1],L,R=k.target,$=Math.abs(O)>Math.abs(z)?"h":"v";if("touches"in k&&$==="h"&&R.type==="range")return!1;var U=window.getSelection(),V=U&&U.anchorNode,D=V?V===R||V.contains(R):!1;if(D)return!1;var Y=d1($,R);if(!Y)return!0;if(Y?L=$:(L=$==="v"?"h":"v",Y=d1($,R)),!Y)return!1;if(!a.current&&"changedTouches"in k&&(O||z)&&(a.current=L),!L)return!0;var ae=a.current||L;return $D(ae,E,k,ae==="h"?O:z)},[]),m=b.useCallback(function(k){var E=k;if(!(!Bl.length||Bl[Bl.length-1]!==o)){var C="deltaY"in E?f1(E):ff(E),N=t.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&FD(L.delta,C)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var O=(c.current.shards||[]).map(h1).filter(Boolean).filter(function(L){return L.contains(E.target)}),z=O.length>0?f(E,O[0]):!c.current.noIsolation;z&&E.cancelable&&E.preventDefault()}}},[]),h=b.useCallback(function(k,E,C,N){var O={name:k,delta:E,target:C,should:N,shadowParent:GD(C)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(z){return z!==O})},1)},[]),p=b.useCallback(function(k){n.current=ff(k),a.current=void 0},[]),g=b.useCallback(function(k){h(k.type,f1(k),k.target,f(k,e.lockRef.current))},[]),x=b.useCallback(function(k){h(k.type,ff(k),k.target,f(k,e.lockRef.current))},[]);b.useEffect(function(){return Bl.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Ul),document.addEventListener("touchmove",m,Ul),document.addEventListener("touchstart",p,Ul),function(){Bl=Bl.filter(function(k){return k!==o}),document.removeEventListener("wheel",m,Ul),document.removeEventListener("touchmove",m,Ul),document.removeEventListener("touchstart",p,Ul)}},[]);var w=e.removeScrollBar,S=e.inert;return b.createElement(b.Fragment,null,S?b.createElement(o,{styles:HD(s)}):null,w?b.createElement(MD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const VD=wD(qC,ZD);var KC=b.forwardRef(function(e,t){return b.createElement(hh,Aa({},e,{ref:t,sideCar:VD}))});KC.classNames=hh.classNames;var QD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$l=new WeakMap,hf=new WeakMap,mf={},dg=0,YC=function(e){return e&&(e.host||YC(e.parentNode))},KD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=YC(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},YD=function(e,t,n,a){var s=KD(t,Array.isArray(e)?e:[e]);mf[n]||(mf[n]=new WeakMap);var o=mf[n],c=[],f=new Set,m=new Set(s),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};s.forEach(h);var p=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(x){if(f.has(x))p(x);else try{var w=x.getAttribute(a),S=w!==null&&w!=="false",k=($l.get(x)||0)+1,E=(o.get(x)||0)+1;$l.set(x,k),o.set(x,E),c.push(x),k===1&&S&&hf.set(x,!0),E===1&&x.setAttribute(n,"true"),S||x.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(t),f.clear(),dg++,function(){c.forEach(function(g){var x=$l.get(g)-1,w=o.get(g)-1;$l.set(g,x),o.set(g,w),x||(hf.has(g)||g.removeAttribute(a),hf.delete(g)),w||g.removeAttribute(n)}),dg--,dg||($l=new WeakMap,$l=new WeakMap,hf=new WeakMap,mf={})}},XD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=QD(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),YD(a,s,n,"aria-hidden")):function(){return null}},mh="Dialog",[XC]=AM(mh),[WD,xa]=XC(mh),WC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=DM({prop:a,defaultProp:s??!1,onChange:o,caller:mh});return l.jsx(WD,{scope:t,triggerRef:f,contentRef:m,contentId:si(),titleId:si(),descriptionId:si(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};WC.displayName=mh;var JC="DialogTrigger",JD=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(JC,n),o=el(t,s.triggerRef);return l.jsx(ci.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Rv(s.open),...a,ref:o,onClick:as(e.onClick,s.onOpenToggle)})});JD.displayName=JC;var Tv="DialogPortal",[eI,eE]=XC(Tv,{forceMount:void 0}),tE=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=xa(Tv,t);return l.jsx(eI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(fh,{present:n||o.open,children:l.jsx($C,{asChild:!0,container:s,children:c})}))})};tE.displayName=Tv;var Ff="DialogOverlay",nE=b.forwardRef((e,t)=>{const n=eE(Ff,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=xa(Ff,e.__scopeDialog);return o.modal?l.jsx(fh,{present:a||o.open,children:l.jsx(nI,{...s,ref:t})}):null});nE.displayName=Ff;var tI=DC("DialogOverlay.RemoveScroll"),nI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Ff,n);return l.jsx(KC,{as:tI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(ci.div,{"data-state":Rv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Qs="DialogContent",rE=b.forwardRef((e,t)=>{const n=eE(Qs,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=xa(Qs,e.__scopeDialog);return l.jsx(fh,{present:a||o.open,children:o.modal?l.jsx(rI,{...s,ref:t}):l.jsx(aI,{...s,ref:t})})});rE.displayName=Qs;var rI=b.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=b.useRef(null),s=el(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return XD(o)},[]),l.jsx(aE,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:as(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:as(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:as(e.onFocusOutside,o=>o.preventDefault())})}),aI=b.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(aE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),aE=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=xa(Qs,n),m=b.useRef(null),h=el(t,m);return dD(),l.jsxs(l.Fragment,{children:[l.jsx(UC,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(LC,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Rv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(iI,{titleId:f.titleId}),l.jsx(lI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Av="DialogTitle",iE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Av,n);return l.jsx(ci.h2,{id:s.titleId,...a,ref:t})});iE.displayName=Av;var sE="DialogDescription",lE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(sE,n);return l.jsx(ci.p,{id:s.descriptionId,...a,ref:t})});lE.displayName=sE;var oE="DialogClose",uE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(oE,n);return l.jsx(ci.button,{type:"button",...a,ref:t,onClick:as(e.onClick,()=>s.onOpenChange(!1))})});uE.displayName=oE;function Rv(e){return e?"open":"closed"}var cE="DialogTitleWarning",[mY,dE]=TM(cE,{contentName:Qs,titleName:Av,docsSlug:"dialog"}),iI=({titleId:e})=>{const t=dE(cE),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
331
-
332
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
333
-
334
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},sI="DialogDescriptionWarning",lI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${dE(sI).contentName}}.`;return b.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},fE=WC,hE=tE,mE=nE,pE=rE,oI=iE,uI=lE,cI=uE,dI=Symbol.for("react.lazy"),Hf=rv[" use ".trim().toString()];function fI(e){return typeof e=="object"&&e!==null&&"then"in e}function gE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===dI&&"_payload"in e&&fI(e._payload)}function yE(e){const t=mI(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;gE(o)&&typeof Hf=="function"&&(o=Hf(o._payload));const f=b.Children.toArray(o),m=f.find(gI);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var hI=yE("Slot");function mI(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(gE(s)&&typeof Hf=="function"&&(s=Hf(s._payload)),b.isValidElement(s)){const c=vI(s),f=yI(o,s.props);return s.type!==b.Fragment&&(f.ref=a?os(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pI=Symbol("radix.slottable");function gI(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pI}function yI(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function vI(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],di=bI.reduce((e,t)=>{const n=yE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Du='[cmdk-group=""]',fg='[cmdk-group-items=""]',xI='[cmdk-group-heading=""]',vE='[cmdk-item=""]',m1=`${vE}:not([aria-disabled="true"])`,Ty="cmdk-item-select",Zl="data-value",wI=(e,t,n)=>_M(e,t,n),bE=b.createContext(void 0),Mc=()=>b.useContext(bE),xE=b.createContext(void 0),Ov=()=>b.useContext(xE),wE=b.createContext(void 0),SE=b.forwardRef((e,t)=>{let n=Gl(()=>{var P,_;return{search:"",value:(_=(P=e.value)!=null?P:e.defaultValue)!=null?_:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Gl(()=>new Set),s=Gl(()=>new Map),o=Gl(()=>new Map),c=Gl(()=>new Set),f=kE(e),{label:m,children:h,value:p,onValueChange:g,filter:x,shouldFilter:w,loop:S,disablePointerSelection:k=!1,vimBindings:E=!0,...C}=e,N=si(),O=si(),z=si(),L=b.useRef(null),R=OI();Ks(()=>{if(p!==void 0){let P=p.trim();n.current.value=P,$.emit()}},[p]),Ks(()=>{R(6,xe)},[]);let $=b.useMemo(()=>({subscribe:P=>(c.current.add(P),()=>c.current.delete(P)),snapshot:()=>n.current,setState:(P,_,Z)=>{var Q,ue,je,we;if(!Object.is(n.current[P],_)){if(n.current[P]=_,P==="search")ae(),D(),R(1,Y);else if(P==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let pe=document.getElementById(z);pe?pe.focus():(Q=document.getElementById(N))==null||Q.focus()}if(R(7,()=>{var pe;n.current.selectedItemId=(pe=J())==null?void 0:pe.id,$.emit()}),Z||R(5,xe),((ue=f.current)==null?void 0:ue.value)!==void 0){let pe=_??"";(we=(je=f.current).onValueChange)==null||we.call(je,pe);return}}$.emit()}},emit:()=>{c.current.forEach(P=>P())}}),[]),U=b.useMemo(()=>({value:(P,_,Z)=>{var Q;_!==((Q=o.current.get(P))==null?void 0:Q.value)&&(o.current.set(P,{value:_,keywords:Z}),n.current.filtered.items.set(P,V(_,Z)),R(2,()=>{D(),$.emit()}))},item:(P,_)=>(a.current.add(P),_&&(s.current.has(_)?s.current.get(_).add(P):s.current.set(_,new Set([P]))),R(3,()=>{ae(),D(),n.current.value||Y(),$.emit()}),()=>{o.current.delete(P),a.current.delete(P),n.current.filtered.items.delete(P);let Z=J();R(4,()=>{ae(),(Z==null?void 0:Z.getAttribute("id"))===P&&Y(),$.emit()})}),group:P=>(s.current.has(P)||s.current.set(P,new Set),()=>{o.current.delete(P),s.current.delete(P)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:N,inputId:z,labelId:O,listInnerRef:L}),[]);function V(P,_){var Z,Q;let ue=(Q=(Z=f.current)==null?void 0:Z.filter)!=null?Q:wI;return P?ue(P,n.current.search,_):0}function D(){if(!n.current.search||f.current.shouldFilter===!1)return;let P=n.current.filtered.items,_=[];n.current.filtered.groups.forEach(Q=>{let ue=s.current.get(Q),je=0;ue.forEach(we=>{let pe=P.get(we);je=Math.max(pe,je)}),_.push([Q,je])});let Z=L.current;X().sort((Q,ue)=>{var je,we;let pe=Q.getAttribute("id"),De=ue.getAttribute("id");return((je=P.get(De))!=null?je:0)-((we=P.get(pe))!=null?we:0)}).forEach(Q=>{let ue=Q.closest(fg);ue?ue.appendChild(Q.parentElement===ue?Q:Q.closest(`${fg} > *`)):Z.appendChild(Q.parentElement===Z?Q:Q.closest(`${fg} > *`))}),_.sort((Q,ue)=>ue[1]-Q[1]).forEach(Q=>{var ue;let je=(ue=L.current)==null?void 0:ue.querySelector(`${Du}[${Zl}="${encodeURIComponent(Q[0])}"]`);je==null||je.parentElement.appendChild(je)})}function Y(){let P=X().find(Z=>Z.getAttribute("aria-disabled")!=="true"),_=P==null?void 0:P.getAttribute(Zl);$.setState("value",_||void 0)}function ae(){var P,_,Z,Q;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let je of a.current){let we=(_=(P=o.current.get(je))==null?void 0:P.value)!=null?_:"",pe=(Q=(Z=o.current.get(je))==null?void 0:Z.keywords)!=null?Q:[],De=V(we,pe);n.current.filtered.items.set(je,De),De>0&&ue++}for(let[je,we]of s.current)for(let pe of we)if(n.current.filtered.items.get(pe)>0){n.current.filtered.groups.add(je);break}n.current.filtered.count=ue}function xe(){var P,_,Z;let Q=J();Q&&(((P=Q.parentElement)==null?void 0:P.firstChild)===Q&&((Z=(_=Q.closest(Du))==null?void 0:_.querySelector(xI))==null||Z.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function J(){var P;return(P=L.current)==null?void 0:P.querySelector(`${vE}[aria-selected="true"]`)}function X(){var P;return Array.from(((P=L.current)==null?void 0:P.querySelectorAll(m1))||[])}function q(P){let _=X()[P];_&&$.setState("value",_.getAttribute(Zl))}function te(P){var _;let Z=J(),Q=X(),ue=Q.findIndex(we=>we===Z),je=Q[ue+P];(_=f.current)!=null&&_.loop&&(je=ue+P<0?Q[Q.length-1]:ue+P===Q.length?Q[0]:Q[ue+P]),je&&$.setState("value",je.getAttribute(Zl))}function ke(P){let _=J(),Z=_==null?void 0:_.closest(Du),Q;for(;Z&&!Q;)Z=P>0?AI(Z,Du):RI(Z,Du),Q=Z==null?void 0:Z.querySelector(m1);Q?$.setState("value",Q.getAttribute(Zl)):te(P)}let Ae=()=>q(X().length-1),M=P=>{P.preventDefault(),P.metaKey?Ae():P.altKey?ke(1):te(1)},I=P=>{P.preventDefault(),P.metaKey?q(0):P.altKey?ke(-1):te(-1)};return b.createElement(di.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:P=>{var _;(_=C.onKeyDown)==null||_.call(C,P);let Z=P.nativeEvent.isComposing||P.keyCode===229;if(!(P.defaultPrevented||Z))switch(P.key){case"n":case"j":{E&&P.ctrlKey&&M(P);break}case"ArrowDown":{M(P);break}case"p":case"k":{E&&P.ctrlKey&&I(P);break}case"ArrowUp":{I(P);break}case"Home":{P.preventDefault(),q(0);break}case"End":{P.preventDefault(),Ae();break}case"Enter":{P.preventDefault();let Q=J();if(Q){let ue=new Event(Ty);Q.dispatchEvent(ue)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:MI},m),ph(e,P=>b.createElement(xE.Provider,{value:$},b.createElement(bE.Provider,{value:U},P))))}),SI=b.forwardRef((e,t)=>{var n,a;let s=si(),o=b.useRef(null),c=b.useContext(wE),f=Mc(),m=kE(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ks(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let p=jE(s,o,[e.value,e.children,o],e.keywords),g=Ov(),x=us(R=>R.value&&R.value===p.current),w=us(R=>h||f.filter()===!1?!0:R.search?R.filtered.items.get(s)>0:!0);b.useEffect(()=>{let R=o.current;if(!(!R||e.disabled))return R.addEventListener(Ty,S),()=>R.removeEventListener(Ty,S)},[w,e.onSelect,e.disabled]);function S(){var R,$;k(),($=(R=m.current).onSelect)==null||$.call(R,p.current)}function k(){g.setState("value",p.current,!0)}if(!w)return null;let{disabled:E,value:C,onSelect:N,forceMount:O,keywords:z,...L}=e;return b.createElement(di.div,{ref:os(o,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!x,"data-disabled":!!E,"data-selected":!!x,onPointerMove:E||f.getDisablePointerSelection()?void 0:k,onClick:E?void 0:S},e.children)}),kI=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=si(),f=b.useRef(null),m=b.useRef(null),h=si(),p=Mc(),g=us(w=>s||p.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ks(()=>p.group(c),[]),jE(c,f,[e.value,e.heading,m]);let x=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(di.div,{ref:os(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ph(e,w=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(wE.Provider,{value:x},w))))}),jI=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=us(c=>!c.search);return!n&&!o?null:b.createElement(di.div,{ref:os(s,t),...a,"cmdk-separator":"",role:"separator"})}),CI=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Ov(),c=us(h=>h.search),f=us(h=>h.selectedItemId),m=Mc();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(di.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),EI=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),c=b.useRef(null),f=us(h=>h.selectedItemId),m=Mc();return b.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=h.offsetHeight;p.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(g),x.unobserve(h)}}},[]),b.createElement(di.div,{ref:os(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},ph(e,h=>b.createElement("div",{ref:os(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),NI=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(fE,{open:n,onOpenChange:a},b.createElement(hE,{container:c},b.createElement(mE,{"cmdk-overlay":"",className:s}),b.createElement(pE,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(SE,{ref:t,...f}))))}),_I=b.forwardRef((e,t)=>us(n=>n.filtered.count===0)?b.createElement(di.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),TI=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(di.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ph(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),jr=Object.assign(SE,{List:EI,Item:SI,Input:CI,Group:kI,Separator:jI,Dialog:NI,Empty:_I,Loading:TI});function AI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function RI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function kE(e){let t=b.useRef(e);return Ks(()=>{t.current=e}),t}var Ks=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Gl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function us(e){let t=Ov(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function jE(e,t,n,a=[]){let s=b.useRef(),o=Mc();return Ks(()=>{var c;let f=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(c=t.current)==null||c.setAttribute(Zl,f),s.current=f}),s}var OI=()=>{let[e,t]=b.useState(),n=Gl(()=>new Map);return Ks(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function zI(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ph({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(zI(t),{ref:t.ref},n(t.props.children)):n(t)}var MI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Dn=fE,DI=hE,CE=b.forwardRef(({className:e,...t},n)=>l.jsx(mE,{ref:n,className:ze("fixed inset-0 z-50 bg-overlay-scrim data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));CE.displayName="DialogOverlay";const An=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(DI,{children:[l.jsx(CE,{}),l.jsxs(pE,{ref:a,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,l.jsxs(cI,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(ss,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));An.displayName="DialogContent";function Zn({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Cr({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const In=b.forwardRef(({className:e,...t},n)=>l.jsx(oI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));In.displayName="DialogTitle";const zv=b.forwardRef(({className:e,...t},n)=>l.jsx(uI,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));zv.displayName="DialogDescription";const EE=b.forwardRef(({className:e,...t},n)=>l.jsx(jr,{ref:n,className:ze("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));EE.displayName=jr.displayName;function II({open:e,onOpenChange:t,children:n}){return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsx(An,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(EE,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:n})})})}const NE=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(ch,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(jr.Input,{ref:n,className:ze("flex h-11 w-full rounded-md bg-transparent py-3 text-body outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));NE.displayName=jr.Input.displayName;const _E=b.forwardRef(({className:e,...t},n)=>l.jsx(jr.List,{ref:n,className:ze("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));_E.displayName=jr.List.displayName;const TE=b.forwardRef((e,t)=>l.jsx(jr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));TE.displayName=jr.Empty.displayName;const zf=b.forwardRef(({className:e,...t},n)=>l.jsx(jr.Group,{ref:n,className:ze("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));zf.displayName=jr.Group.displayName;const Ay=b.forwardRef(({className:e,...t},n)=>l.jsx(jr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));Ay.displayName=jr.Separator.displayName;const Mf=b.forwardRef(({className:e,...t},n)=>l.jsx(jr.Item,{ref:n,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-body outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Mf.displayName=jr.Item.displayName;function Dc(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Ee.get(Tn(`/agents${n?`?${n}`:""}`))}function LI(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return Ee.get(Tn(`/agents/all${n?`?${n}`:""}`))}function Mv(){return Ee.get("/me/managed-agents")}function PI(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function UI(e){return Ee.post(Tn("/agents"),e)}function BI(e){return Ee.get(Tn(`/agents/names/${encodeURIComponent(e)}/availability`))}function p1(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function $I(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function AE(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function RE(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function OE(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function FI(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function gh(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Mv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Dv(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Mv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const HI=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function qI({open:e,onOpenChange:t}){const n=_n(),a=gh(),{data:s}=Ye({queryKey:["activity"],queryFn:zc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=Ye({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await zC(p.agentId);for(const x of g)h.push({agentId:p.agentId,session:x})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(II,{open:e,onOpenChange:t,children:[l.jsx(NE,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(_E,{children:[l.jsx(TE,{children:"No results"}),o.length>0&&l.jsx(zf,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(Mf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(uC,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:p}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ay,{}),l.jsx(zf,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(Mf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(jv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:g}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:p.chatId.slice(0,8)})]},`${h}-${p.chatId}`)})})]}),l.jsx(Ay,{}),l.jsx(zf,{heading:"Pages",children:HI.map(h=>l.jsxs(Mf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(Kz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function ZI(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function GI(){var a;const{user:e}=gt(),{data:t}=Ye({queryKey:["clients"],queryFn:ls,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=ZI(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const VI=160;function QI(){const e=_n(),{rows:t,firstHostname:n}=GI();if(t.length===0)return null;const a=t.length>1,s=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return l.jsxs("button",{type:"button",onClick:()=>e("/settings/computers"),title:s,"aria-label":s,className:"inline-flex items-center cursor-pointer text-body font-medium",style:{gap:8,height:26,padding:"0 var(--sp-2_5) 0 var(--sp-2_25)",borderRadius:999,border:0,outline:"var(--hairline) solid color-mix(in oklch, var(--state-error) 38%, transparent)",outlineOffset:-1,background:"color-mix(in oklch, var(--state-error) 14%, transparent)",color:"color-mix(in oklch, var(--state-error) 80%, var(--fg))",minWidth:0},children:[l.jsx(KI,{}),a?l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[l.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):l.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[l.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:VI,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),l.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function KI(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-error)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]})}function Ic(e){return l.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),l.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),l.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),l.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),l.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),l.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function g1(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ee.get(Tn(`/notifications${n?`?${n}`:""}`))}function YI(e){return Ee.post(Tn(`/notifications/${e}/read`))}function XI(){return Ee.post(Tn("/notifications/read-all"))}const WI={agent_error:"Error",session_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale",agent_disconnected:"Disconnected",agent_connected:"Connected",agent_needs_decision:"Decision",session_completed:"Completed"};function JI(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function e4({notification:e,onClick:t,clickable:n}){const a=(WI[e.type]??e.type).toString(),s=JI(e.severity),o=n??!0;return l.jsxs("button",{type:"button",onClick:t,className:ze("w-full text-left transition-colors text-body",o?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${s}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:c=>{o&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[l.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:lc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function t4(){var w;const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=_n(),c=mn(),{data:f}=Ye({queryKey:["notifications","bell"],queryFn:()=>g1({limit:8}),refetchInterval:1e4}),{data:m}=Ye({queryKey:["notifications","unread-count"],queryFn:()=>g1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,p=h>0,g=b.useCallback(async S=>{S.read||(YI(S.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),S.agentId&&S.chatId?o(`/?a=${S.agentId}&c=${S.chatId}`):S.agentId&&o(`/?a=${S.agentId}`)},[o,c]),x=b.useCallback(async()=>{a(null);try{await XI(),await c.invalidateQueries({queryKey:["notifications"]})}catch(S){a(S instanceof Error?S.message:"Failed to mark all as read")}},[c]);return l.jsxs("div",{className:"relative",children:[l.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[l.jsx(Az,{className:"h-4 w-4"}),p&&l.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:x,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),l.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(S=>l.jsx(e4,{notification:S,clickable:!!S.agentId,onClick:()=>g(S)},S.id))})]})]})]})}function n4(){if(typeof window>"u")return"light";const e=window.localStorage.getItem("theme");return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function r4(){const[e,t]=b.useState(n4);return b.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),l.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?l.jsx(h3,{className:"h-4 w-4"}):l.jsx(r3,{className:"h-4 w-4"})})}function a4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function y1({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?l.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{className:a,role:"img","aria-label":t,style:{width:s,height:s,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:l.jsx("span",{className:"text-subtitle font-semibold",children:a4(t)})})}const v1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,b1=yC,i4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return b1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const x=v1(p)||v1(g);return s[h][x]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,x]=p;return x===void 0||(h[g]=x),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:x,...w}=p;return Object.entries(w).every(S=>{let[k,E]=S;return Array.isArray(E)?E.includes({...o,...f}[k]):{...o,...f}[k]===E})?[...h,g,x]:h},[]);return b1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},s4=i4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ve=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?hI:"button";return l.jsx(c,{className:ze(s4({variant:t,size:n,className:e})),ref:o,...s})});ve.displayName="Button";const Ut=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:ze("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));Ut.displayName="Input";function l4({action:e,onClose:t}){const n=e!==null;return l.jsx(Dn,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(An,{children:[l.jsxs(Zn,{children:[l.jsx(In,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(zv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&l.jsx(u4,{onDone:t}),e==="join"&&l.jsx(c4,{onDone:t})]})})}function o4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function u4({onDone:e}){const{adoptTokens:t}=gt(),n=_n(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{p.preventDefault();const g=a.trim();if(g){m(!0),c(null);try{const x=await Ee.post("/me/organizations",{name:o4(g),displayName:g});await t(x.tokens),e(),n("/",{replace:!0})}catch(x){c(x instanceof Error?x.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ut,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function c4({onDone:e}){const{adoptTokens:t}=gt(),n=_n(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),x=/\/invite\/([^/?#]+)/.exec(g),w=(x==null?void 0:x[1])??g,S=await Ee.post("/me/organizations/join",{token:w});await t(S.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ut,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function d4(){var L,R;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=gt(),o=_n(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),x=b.useRef(null);b.useEffect(()=>{(async()=>{try{const $=await Ee.get("/me/organizations");f($)}catch{}})()},[]),b.useEffect(()=>{const $=V=>{m&&x.current&&!x.current.contains(V.target)&&h(!1)},U=V=>{m&&V.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",$),window.addEventListener("keydown",U),()=>{window.removeEventListener("mousedown",$),window.removeEventListener("keydown",U)}},[m]);const w=(n==null?void 0:n.displayName)??"User",S=(n==null?void 0:n.username)??"",k=(n==null?void 0:n.avatarUrl)??null,E=c.find($=>$.id===e)??null,C=(E==null?void 0:E.role)??(t==="admin"||t==="member"?t:null),N=async $=>{if($===e){h(!1);return}try{await a($),h(!1),o("/",{replace:!0})}catch{}},O=()=>{h(!1),g("create")},z=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:x,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${w}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h($=>!$),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:l.jsx(y1,{src:k,name:w,size:28})}),m&&l.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[l.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[l.jsx(y1,{src:k,name:w,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),S&&S!==w&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",S]})]})]}),c.length>0&&l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?l.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(L=c[0])==null?void 0:L.displayName}),l.jsx(x1,{role:((R=c[0])==null?void 0:R.role)??C})]}):l.jsx("div",{children:c.map($=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void N($.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:$.id===e?l.jsx(cr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.displayName}),l.jsx(x1,{role:$.role})]},$.id))})]}),l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:O,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(ba,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Create new team"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:z,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(pC,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Join with invite link"})]})]}),l.jsx("div",{className:"py-1",children:l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),s()},className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(e3,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(l4,{action:p,onClose:()=>g(null)})]})}function x1({role:e}){return e!=="admin"&&e!=="member"?null:l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const f4=[{to:"/",label:"Workspace",end:!0,kbd:"⌘1"},{to:"/context",label:"Context",end:!1,kbd:"⌘2"},{to:"/team",label:"Team",end:!1,kbd:"⌘3"},{to:"/settings",label:"Settings",end:!1,kbd:"⌘4"}];function h4(){const[e,t]=b.useState(!1),n=kr(),a=n.pathname==="/"||n.search.includes("a=");return b.useEffect(()=>{const s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"&&(o.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),l.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[l.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[l.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[l.jsx(Ic,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(QI,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:f4.map(s=>l.jsx(yv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>ze("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>l.jsxs("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:o?"var(--fg)":"var(--fg-3)",background:o?"var(--bg-hover)":"transparent"},children:[s.label,o&&l.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),l.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[l.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-2)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[l.jsx(ch,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"}),l.jsx("span",{className:"kbd",children:"⌘K"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(t4,{}),l.jsx(r4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(d4,{})]})]}),l.jsx(qI,{open:e,onOpenChange:t}),a?l.jsx(Uf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(Uf,{})})})]})}const zE=b.createContext(null),m4=5e3;function p4({children:e}){const[t,n]=b.useState([]),a=b.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),o={addToast:b.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return l.jsxs(zE.Provider,{value:o,children:[e,l.jsx(g4,{toasts:t,onDismiss:a})]})}function Lc(){const e=b.useContext(zE);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function g4({toasts:e,onDismiss:t}){return e.length===0?null:l.jsx("div",{style:{position:"fixed",bottom:"var(--sp-4)",right:"var(--sp-4)",zIndex:100,display:"flex",flexDirection:"column",gap:"var(--sp-2)",pointerEvents:"none",maxWidth:380},"aria-live":"polite","aria-atomic":"false",children:e.map(n=>l.jsx(y4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function y4({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??m4,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),l.jsxs("div",{role:"status",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-3_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",boxShadow:"var(--shadow-md)",animation:"toast-slide-in 180ms ease-out"},children:[l.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[l.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?l.jsx("button",{type:"button",onClick:()=>{var a;(a=e.action)==null||a.onClick(),t()},className:"text-label font-medium hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{alignSelf:"flex-start",marginTop:"var(--sp-1)",padding:0,background:"transparent",border:"none",color:"var(--accent)",cursor:"pointer"},children:e.action.label}):null]}),l.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-1)",background:"transparent",border:"none",borderRadius:"var(--radius-input)",cursor:"pointer",color:"var(--fg-4)",flexShrink:0},children:l.jsx(ss,{className:"h-4 w-4"})})]})}function de(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const x=p[g];x in f||(f[x]=h[x].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class to extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ME extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const DE={};function cs(e){return DE}function IE(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function Ry(e,t){return typeof t=="bigint"?t.toString():t}function yh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Iv(e){return e==null}function Lv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function v4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const w1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==w1)return a===void 0&&(a=w1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function tl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hs(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function S1(e){return JSON.stringify(e)}function b4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const LE="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const x4=yh(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function bo(e){if(cc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(cc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function PE(e){return bo(e)?{...e}:Array.isArray(e)?[...e]:e}const w4=new Set(["string","number","symbol"]);function xo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ms(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function S4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const k4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=hs(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=n.shape[f])}return tl(this,"shape",c),c},checks:[]});return ms(e,o)}function C4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=hs(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return tl(this,"shape",c),c},checks:[]});return ms(e,o)}function E4(e,t){if(!bo(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(o,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=hs(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return tl(this,"shape",o),o}});return ms(e,s)}function N4(e,t){if(!bo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=hs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return tl(this,"shape",a),a}});return ms(e,n)}function _4(e,t){const n=hs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return tl(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ms(e,n)}function T4(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=hs(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return tl(this,"shape",m),m},checks:[]});return ms(t,c)}function A4(e,t,n){const a=hs(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const c in n){if(!(c in o))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(o[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)o[c]=new e({type:"nonoptional",innerType:s[c]});return tl(this,"shape",o),o}});return ms(t,a)}function Yl(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function Xl(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function pf(e){return typeof e=="string"?e:e==null?void 0:e.message}function ds(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=pf((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??pf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??pf((m=n.customError)==null?void 0:m.call(n,e))??pf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=p}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function Pv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function dc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const UE=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ry,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},BE=de("$ZodError",UE),$E=de("$ZodError",UE,{Parent:Error});function R4(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function O4(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>a({issues:c}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let c=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Uv=e=>(t,n,a,s)=>{const o=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new to;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,o,cs())));throw LE(f,s==null?void 0:s.callee),f}return c.value},Bv=e=>async(t,n,a,s)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,o,cs())));throw LE(f,s==null?void 0:s.callee),f}return c.value},vh=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new to;return o.issues.length?{success:!1,error:new(e??BE)(o.issues.map(c=>ds(c,s,cs())))}:{success:!0,data:o.value}},z4=vh($E),bh=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(c=>ds(c,s,cs())))}:{success:!0,data:o.value}},M4=bh($E),D4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Uv(e)(t,n,s)},I4=e=>(t,n,a)=>Uv(e)(t,n,a),L4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Bv(e)(t,n,s)},P4=e=>async(t,n,a)=>Bv(e)(t,n,a),U4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},B4=e=>(t,n,a)=>vh(e)(t,n,a),$4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return bh(e)(t,n,s)},F4=e=>async(t,n,a)=>bh(e)(t,n,a),H4=/^[cC][^\s-]{8,}$/,q4=/^[0-9a-z]+$/,Z4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G4=/^[0-9a-vA-V]{20}$/,V4=/^[A-Za-z0-9]{27}$/,Q4=/^[a-zA-Z0-9_-]{21}$/,K4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Y4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,k1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,X4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,W4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function J4(){return new RegExp(W4,"u")}const e5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,t5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,n5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,r5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,FE=/^[A-Za-z0-9_-]*$/,i5=/^\+[1-9]\d{6,14}$/,HE="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",s5=new RegExp(`^${HE}$`);function qE(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function l5(e){return new RegExp(`^${qE(e)}$`)}function o5(e){const t=qE({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${HE}T(?:${a})$`)}const u5=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},c5=/^-?\d+$/,ZE=/^-?\d+(?:\.\d+)?$/,d5=/^(?:true|false)$/i,f5=/^null$/i,h5=/^[^A-Z]*$/,m5=/^[^a-z]*$/,Er=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),GE={number:"number",bigint:"bigint",object:"date"},VE=de("$ZodCheckLessThan",(e,t)=>{Er.init(e,t);const n=GE[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),QE=de("$ZodCheckGreaterThan",(e,t)=>{Er.init(e,t);const n=GE[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),p5=de("$ZodCheckMultipleOf",(e,t)=>{Er.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):v4(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),g5=de("$ZodCheckNumberFormat",(e,t)=>{var c;Er.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[s,o]=k4[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=c5)}),e._zod.check=f=>{const m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),y5=de("$ZodCheckMaxLength",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Iv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const c=Pv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),v5=de("$ZodCheckMinLength",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Iv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const c=Pv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),b5=de("$ZodCheckLengthEquals",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Iv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,o=s.length;if(o===t.length)return;const c=Pv(s),f=o>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),xh=de("$ZodCheckStringFormat",(e,t)=>{var n,a;Er.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),x5=de("$ZodCheckRegex",(e,t)=>{xh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),w5=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=h5),xh.init(e,t)}),S5=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=m5),xh.init(e,t)}),k5=de("$ZodCheckIncludes",(e,t)=>{Er.init(e,t);const n=xo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),j5=de("$ZodCheckStartsWith",(e,t)=>{Er.init(e,t);const n=new RegExp(`^${xo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),C5=de("$ZodCheckEndsWith",(e,t)=>{Er.init(e,t);const n=new RegExp(`.*${xo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),E5=de("$ZodCheckOverwrite",(e,t)=>{Er.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class N5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
335
- `).filter(c=>c),s=Math.min(...a.map(c=>c.length-c.trimStart().length)),o=a.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of o)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
336
- `))}}const _5={major:4,minor:3,patch:6},Qt=de("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let p=Yl(f),g;for(const x of m){if(x._zod.def.when){if(!x._zod.def.when(f))continue}else if(p)continue;const w=f.issues.length,S=x._zod.check(f);if(S instanceof Promise&&(h==null?void 0:h.async)===!1)throw new to;if(g||S instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await S,f.issues.length!==w&&(p||(p=Yl(f,w)))});else{if(f.issues.length===w)continue;p||(p=Yl(f,w))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(Yl(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new to;return p.then(g=>e._zod.parse(g,h))}return e._zod.parse(p,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const p=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return p instanceof Promise?p.then(g=>c(g,f,m)):c(p,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new to;return h.then(p=>o(p,a,m))}return o(h,a,m)}}Ct(e,"~standard",()=>({validate:o=>{var c;try{const f=z4(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return M4(e,o).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),$v=de("$ZodString",(e,t)=>{var n;Qt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??u5(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Kt=de("$ZodStringFormat",(e,t)=>{xh.init(e,t),$v.init(e,t)}),T5=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Y4),Kt.init(e,t)}),A5=de("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=k1(a))}else t.pattern??(t.pattern=k1());Kt.init(e,t)}),R5=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=X4),Kt.init(e,t)}),O5=de("$ZodURL",(e,t)=>{Kt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),z5=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=J4()),Kt.init(e,t)}),M5=de("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Q4),Kt.init(e,t)}),D5=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=H4),Kt.init(e,t)}),I5=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=q4),Kt.init(e,t)}),L5=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Z4),Kt.init(e,t)}),P5=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G4),Kt.init(e,t)}),U5=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=V4),Kt.init(e,t)}),B5=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=o5(t)),Kt.init(e,t)}),$5=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=s5),Kt.init(e,t)}),F5=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=l5(t)),Kt.init(e,t)}),H5=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=K4),Kt.init(e,t)}),q5=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=e5),Kt.init(e,t),e._zod.bag.format="ipv4"}),Z5=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=t5),Kt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),G5=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=n5),Kt.init(e,t)}),V5=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=r5),Kt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,o]=a;if(!o)throw new Error;const c=Number(o);if(`${c}`!==o)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function KE(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Q5=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=a5),Kt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{KE(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function K5(e){if(!FE.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return KE(n)}const Y5=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=FE),Kt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{K5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),X5=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=i5),Kt.init(e,t)});function W5(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const J5=de("$ZodJWT",(e,t)=>{Kt.init(e,t),e._zod.check=n=>{W5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),YE=de("$ZodNumber",(e,t)=>{Qt.init(e,t),e._zod.pattern=e._zod.bag.pattern??ZE,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),eL=de("$ZodNumberFormat",(e,t)=>{g5.init(e,t),YE.init(e,t)}),tL=de("$ZodBoolean",(e,t)=>{Qt.init(e,t),e._zod.pattern=d5,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),nL=de("$ZodNull",(e,t)=>{Qt.init(e,t),e._zod.pattern=f5,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),rL=de("$ZodUnknown",(e,t)=>{Qt.init(e,t),e._zod.parse=n=>n}),aL=de("$ZodNever",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function j1(e,t,n){e.issues.length&&t.issues.push(...Xl(n,e.issues)),t.value[n]=e.value}const iL=de("$ZodArray",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>j1(h,n,c))):j1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function qf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...Xl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function XE(e){var a,s,o,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(o=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=S4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function WE(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const x=m.run({value:t[g],issues:[]},a);x instanceof Promise?e.push(x.then(w=>qf(w,n,g,t,p))):qf(x,n,g,t,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const sL=de("$ZodObject",(e,t)=>{Qt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=yh(()=>XE(t));Ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const s=cc,o=t.catchall;let c;e._zod.parse=(f,m)=>{c??(c=a.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const p=[],g=c.shape;for(const x of c.keys){const w=g[x],S=w._zod.optout==="optional",k=w._zod.run({value:h[x],issues:[]},m);k instanceof Promise?p.push(k.then(E=>qf(E,f,x,h,S))):qf(k,f,x,h,S)}return o?WE(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),lL=de("$ZodObjectJIT",(e,t)=>{sL.init(e,t);const n=e._zod.parse,a=yh(()=>XE(t)),s=x=>{var O;const w=new N5(["shape","payload","ctx"]),S=a.value,k=z=>{const L=S1(z);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};w.write("const input = payload.value;");const E=Object.create(null);let C=0;for(const z of S.keys)E[z]=`key_${C++}`;w.write("const newResult = {};");for(const z of S.keys){const L=E[z],R=S1(z),$=x[z],U=((O=$==null?void 0:$._zod)==null?void 0:O.optout)==="optional";w.write(`const ${L} = ${k(z)};`),U?w.write(`
337
- if (${L}.issues.length) {
338
- if (${R} in input) {
339
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
340
- ...iss,
341
- path: iss.path ? [${R}, ...iss.path] : [${R}]
342
- })));
343
- }
344
- }
345
-
346
- if (${L}.value === undefined) {
347
- if (${R} in input) {
348
- newResult[${R}] = undefined;
349
- }
350
- } else {
351
- newResult[${R}] = ${L}.value;
352
- }
353
-
354
- `):w.write(`
355
- if (${L}.issues.length) {
356
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
357
- ...iss,
358
- path: iss.path ? [${R}, ...iss.path] : [${R}]
359
- })));
360
- }
361
-
362
- if (${L}.value === undefined) {
363
- if (${R} in input) {
364
- newResult[${R}] = undefined;
365
- }
366
- } else {
367
- newResult[${R}] = ${L}.value;
368
- }
369
-
370
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const N=w.compile();return(z,L)=>N(x,z,L)};let o;const c=cc,f=!DE.jitless,h=f&&x4.value,p=t.catchall;let g;e._zod.parse=(x,w)=>{g??(g=a.value);const S=x.value;return c(S)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),x=o(x,w),p?WE([],S,x,w,g,e):x):n(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),x)}});function C1(e,t,n,a){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!Yl(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(c=>ds(c,a,cs())))}),t)}const JE=de("$ZodUnion",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ct(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ct(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ct(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Lv(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return a(s,o);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(m=>C1(m,s,e,o)):C1(f,s,e,o)}}),oL=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,JE.init(e,t);const n=e._zod.parse;Ct(e._zod,"propValues",()=>{const s={};for(const o of t.options){const c=o._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(c)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=yh(()=>{var c;const s=t.options,o=new Map;for(const f of s){const m=(c=f._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(s,o)=>{const c=s.value;if(!cc(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const f=a.value.get(c==null?void 0:c[t.discriminator]);return f?f._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),uL=de("$ZodIntersection",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([m,h])=>E1(n,m,h)):E1(n,o,c)}});function Oy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(bo(e)&&bo(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of a){const c=Oy(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};s[o]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],o=t[a],c=Oy(s,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function E1(e,t,n){const a=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&s&&e.issues.push({...s,keys:o}),Yl(e))return e;const c=Oy(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const cL=de("$ZodRecord",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!bo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],c=t.keyType._zod.values;if(c){n.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:s[h],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Xl(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...Xl(h,p.issues)),n.value[h]=p.value)}let m;for(const h in s)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&ZE.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>ds(g,a,cs())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:s[f],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Xl(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...Xl(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),dL=de("$ZodEnum",(e,t)=>{Qt.init(e,t);const n=IE(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>w4.has(typeof s)).map(s=>typeof s=="string"?xo(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const c=s.value;return a.has(c)||s.issues.push({code:"invalid_value",values:n,input:c,inst:e}),s}}),fL=de("$ZodLiteral",(e,t)=>{if(Qt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?xo(a):a?xo(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),a}}),hL=de("$ZodTransform",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ME(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new to;return n.value=s,n}});function N1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const eN=de("$ZodOptional",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>N1(o,n.value)):N1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),mL=de("$ZodExactOptional",(e,t)=>{eN.init(e,t),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),pL=de("$ZodNullable",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lv(n.source)}|null)$`):void 0}),Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),gL=de("$ZodDefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>_1(o,t)):_1(s,t)}});function _1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yL=de("$ZodPrefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),vL=de("$ZodNonOptional",(e,t)=>{Qt.init(e,t),Ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>T1(o,e)):T1(s,e)}});function T1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const bL=de("$ZodCatch",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>ds(c,a,cs()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>ds(o,a,cs()))},input:n.value}),n.issues=[]),n)}}),xL=de("$ZodPipe",(e,t)=>{Qt.init(e,t),Ct(e._zod,"values",()=>t.in._zod.values),Ct(e._zod,"optin",()=>t.in._zod.optin),Ct(e._zod,"optout",()=>t.out._zod.optout),Ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const o=t.out._zod.run(n,a);return o instanceof Promise?o.then(c=>gf(c,t.in,a)):gf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>gf(o,t.out,a)):gf(s,t.out,a)}});function gf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const wL=de("$ZodReadonly",(e,t)=>{Qt.init(e,t),Ct(e._zod,"propValues",()=>t.innerType._zod.propValues),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ct(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(A1):A1(s)}});function A1(e){return e.value=Object.freeze(e.value),e}const SL=de("$ZodCustom",(e,t)=>{Er.init(e,t),Qt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(o=>R1(o,n,a,e));R1(s,n,a,e)}});function R1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(dc(s))}}var O1;class kL{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const s={...a,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function jL(){return new kL}(O1=globalThis).__zod_globalRegistry??(O1.__zod_globalRegistry=jL());const Ku=globalThis.__zod_globalRegistry;function CL(e,t){return new e({type:"string",...Ie(t)})}function EL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(t)})}function z1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(t)})}function NL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(t)})}function _L(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(t)})}function TL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(t)})}function AL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(t)})}function RL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(t)})}function OL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(t)})}function zL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(t)})}function ML(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(t)})}function DL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(t)})}function IL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(t)})}function LL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(t)})}function PL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(t)})}function UL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(t)})}function BL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(t)})}function $L(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(t)})}function FL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(t)})}function HL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(t)})}function qL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(t)})}function ZL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(t)})}function GL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(t)})}function VL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(t)})}function QL(e,t){return new e({type:"string",format:"date",check:"string_format",...Ie(t)})}function KL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(t)})}function YL(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ie(t)})}function XL(e,t){return new e({type:"number",checks:[],...Ie(t)})}function WL(e,t){return new e({type:"number",coerce:!0,checks:[],...Ie(t)})}function JL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(t)})}function eP(e,t){return new e({type:"boolean",...Ie(t)})}function tP(e,t){return new e({type:"null",...Ie(t)})}function nP(e){return new e({type:"unknown"})}function rP(e,t){return new e({type:"never",...Ie(t)})}function M1(e,t){return new VE({check:"less_than",...Ie(t),value:e,inclusive:!1})}function hg(e,t){return new VE({check:"less_than",...Ie(t),value:e,inclusive:!0})}function D1(e,t){return new QE({check:"greater_than",...Ie(t),value:e,inclusive:!1})}function mg(e,t){return new QE({check:"greater_than",...Ie(t),value:e,inclusive:!0})}function I1(e,t){return new p5({check:"multiple_of",...Ie(t),value:e})}function tN(e,t){return new y5({check:"max_length",...Ie(t),maximum:e})}function Zf(e,t){return new v5({check:"min_length",...Ie(t),minimum:e})}function nN(e,t){return new b5({check:"length_equals",...Ie(t),length:e})}function aP(e,t){return new x5({check:"string_format",format:"regex",...Ie(t),pattern:e})}function iP(e){return new w5({check:"string_format",format:"lowercase",...Ie(e)})}function sP(e){return new S5({check:"string_format",format:"uppercase",...Ie(e)})}function lP(e,t){return new k5({check:"string_format",format:"includes",...Ie(t),includes:e})}function oP(e,t){return new j5({check:"string_format",format:"starts_with",...Ie(t),prefix:e})}function uP(e,t){return new C5({check:"string_format",format:"ends_with",...Ie(t),suffix:e})}function _o(e){return new E5({check:"overwrite",tx:e})}function cP(e){return _o(t=>t.normalize(e))}function dP(){return _o(e=>e.trim())}function fP(){return _o(e=>e.toLowerCase())}function hP(){return _o(e=>e.toUpperCase())}function mP(){return _o(e=>b4(e))}function pP(e,t,n){return new e({type:"array",element:t,...Ie(n)})}function gP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ie(n)})}function yP(e){const t=vP(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(dc(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(dc(s))}},e(n.value,n)));return t}function vP(e,t){const n=new Er({check:"custom",...Ie(t)});return n._zod.check=e,n}function rN(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Ku,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function kn(e,t,n={path:[],schemaPath:[]}){var p,g;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)c.schema=f;else{const x={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,x);else{const S=c.schema,k=t.processors[s.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);k(e,t,S,x)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),kn(w,t,x),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&ir(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function aN(e,t){var c,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const p of e.seen.entries()){const g=(c=e.metadataRegistry.get(p[0]))==null?void 0:c.id;if(g){const x=a.get(g);if(x&&x!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var k;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(k=e.external.registry.get(p[0]))==null?void 0:k.id,C=e.external.uri??(O=>O);if(E)return{ref:C(E)};const N=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(p[1]===n)return{ref:"#"};const w=`#/${g}/`,S=p[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:w+S}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:x,defId:w}=s(p);g.def={...g.schema},w&&(g.defId=w);const S=g.schema;for(const k in S)delete S[k];S.$ref=x};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
371
-
372
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const g=p[1];if(t===p[0]){o(p);continue}if(e.external){const w=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&w){o(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&e.reused==="ref"){o(p);continue}}}function iN(e,t){var c,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,x={...g},w=p.ref;if(p.ref=null,w){a(w);const k=e.seen.get(w),E=k.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Object.assign(g,E),Object.assign(g,x),h._zod.parent===w)for(const N in g)N==="$ref"||N==="allOf"||N in x||delete g[N];if(E.$ref&&k.def)for(const N in g)N==="$ref"||N==="allOf"||N in k.def&&JSON.stringify(g[N])===JSON.stringify(k.def[N])&&delete g[N]}const S=h._zod.parent;if(S&&S!==w){a(S);const k=e.seen.get(S);if(k!=null&&k.schema.$ref&&(g.$ref=k.schema.$ref,k.def))for(const E in g)E==="$ref"||E==="allOf"||E in k.def&&JSON.stringify(g[E])===JSON.stringify(k.def[E])&&delete g[E]}e.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(o[p.defId]=p.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Gf(t,"input",e.processors),output:Gf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function ir(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return ir(a.element,n);if(a.type==="set")return ir(a.valueType,n);if(a.type==="lazy")return ir(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return ir(a.innerType,n);if(a.type==="intersection")return ir(a.left,n)||ir(a.right,n);if(a.type==="record"||a.type==="map")return ir(a.keyType,n)||ir(a.valueType,n);if(a.type==="pipe")return ir(a.in,n)||ir(a.out,n);if(a.type==="object"){for(const s in a.shape)if(ir(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(ir(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(ir(s,n))return!0;return!!(a.rest&&ir(a.rest,n))}return!1}const bP=(e,t={})=>n=>{const a=rN({...n,processors:t});return kn(e,a),aN(a,e),iN(a,e)},Gf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=rN({...s??{},target:o,io:t,processors:n});return kn(e,c),aN(c,e),iN(c,e)},xP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof c=="number"&&(s.maxLength=c),f&&(s.format=xP[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},SP=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p),typeof o=="number"&&(s.minimum=o,typeof p=="number"&&t.target!=="draft-04"&&(p>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof c=="number"&&(s.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},kP=(e,t,n,a)=>{n.type="boolean"},jP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},CP=(e,t,n,a)=>{n.not={}},EP=(e,t,n,a)=>{},NP=(e,t,n,a)=>{const s=e._zod.def,o=IE(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},_P=(e,t,n,a)=>{const s=e._zod.def,o=[];for(const c of s.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(c))}else o.push(c);if(o.length!==0)if(o.length===1){const c=o[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),o.every(c=>typeof c=="boolean")&&(n.type="boolean"),o.every(c=>c===null)&&(n.type="null"),n.enum=o},TP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},AP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},RP=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=kn(o.element,t,{...a,path:[...a.path,"items"]})},OP=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const p in c)s.properties[p]=kn(c[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(p=>{const g=o.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=kn(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},zP=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>kn(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},MP=(e,t,n,a)=>{const s=e._zod.def,o=kn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=kn(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},DP=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const c=o.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const p=kn(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const g of m)s.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=kn(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=kn(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const p=[...h].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(s.required=p)}},IP=(e,t,n,a)=>{const s=e._zod.def,o=kn(s.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},LP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},PP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},UP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},BP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},$P=(e,t,n,a)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;kn(o,t,a);const c=t.seen.get(e);c.ref=o},FP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},sN=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},HP=de("ZodISODateTime",(e,t)=>{B5.init(e,t),en.init(e,t)});function qP(e){return VL(HP,e)}const ZP=de("ZodISODate",(e,t)=>{$5.init(e,t),en.init(e,t)});function GP(e){return QL(ZP,e)}const VP=de("ZodISOTime",(e,t)=>{F5.init(e,t),en.init(e,t)});function QP(e){return KL(VP,e)}const KP=de("ZodISODuration",(e,t)=>{H5.init(e,t),en.init(e,t)});function YP(e){return YL(KP,e)}const XP=(e,t)=>{BE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>O4(e,n)},flatten:{value:n=>R4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ry,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ry,2)}},isEmpty:{get(){return e.issues.length===0}}})},sa=de("ZodError",XP,{Parent:Error}),WP=Uv(sa),JP=Bv(sa),eU=vh(sa),tU=bh(sa),nU=D4(sa),rU=I4(sa),aU=L4(sa),iU=P4(sa),sU=U4(sa),lU=B4(sa),oU=$4(sa),uU=F4(sa),Yt=de("ZodType",(e,t)=>(Qt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Gf(e,"input"),output:Gf(e,"output")}}),e.toJSONSchema=bP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(hs(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>ms(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>WP(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>eU(e,n,a),e.parseAsync=async(n,a)=>JP(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>tU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>nU(e,n,a),e.decode=(n,a)=>rU(e,n,a),e.encodeAsync=async(n,a)=>aU(e,n,a),e.decodeAsync=async(n,a)=>iU(e,n,a),e.safeEncode=(n,a)=>sU(e,n,a),e.safeDecode=(n,a)=>lU(e,n,a),e.safeEncodeAsync=async(n,a)=>oU(e,n,a),e.safeDecodeAsync=async(n,a)=>uU(e,n,a),e.refine=(n,a)=>e.check(r6(n,a)),e.superRefine=n=>e.check(a6(n)),e.overwrite=n=>e.check(_o(n)),e.optional=()=>U1(e),e.exactOptional=()=>qU(e),e.nullable=()=>B1(e),e.nullish=()=>U1(B1(e)),e.nonoptional=n=>YU(e,n),e.array=()=>vt(e),e.or=n=>wh([e,n]),e.and=n=>UU(e,n),e.transform=n=>My(e,uN(n)),e.default=n=>VU(e,n),e.prefault=n=>KU(e,n),e.catch=n=>WU(e,n),e.pipe=n=>My(e,n),e.readonly=()=>t6(e),e.describe=n=>{const a=e.clone();return Ku.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Ku.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Ku.get(e);const a=e.clone();return Ku.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),lN=de("_ZodString",(e,t)=>{$v.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>wP(e,a,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(aP(...a)),e.includes=(...a)=>e.check(lP(...a)),e.startsWith=(...a)=>e.check(oP(...a)),e.endsWith=(...a)=>e.check(uP(...a)),e.min=(...a)=>e.check(Zf(...a)),e.max=(...a)=>e.check(tN(...a)),e.length=(...a)=>e.check(nN(...a)),e.nonempty=(...a)=>e.check(Zf(1,...a)),e.lowercase=a=>e.check(iP(a)),e.uppercase=a=>e.check(sP(a)),e.trim=()=>e.check(dP()),e.normalize=(...a)=>e.check(cP(...a)),e.toLowerCase=()=>e.check(fP()),e.toUpperCase=()=>e.check(hP()),e.slugify=()=>e.check(mP())}),cU=de("ZodString",(e,t)=>{$v.init(e,t),lN.init(e,t),e.email=n=>e.check(EL(dU,n)),e.url=n=>e.check(RL(fU,n)),e.jwt=n=>e.check(GL(NU,n)),e.emoji=n=>e.check(OL(hU,n)),e.guid=n=>e.check(z1(L1,n)),e.uuid=n=>e.check(NL(yf,n)),e.uuidv4=n=>e.check(_L(yf,n)),e.uuidv6=n=>e.check(TL(yf,n)),e.uuidv7=n=>e.check(AL(yf,n)),e.nanoid=n=>e.check(zL(mU,n)),e.guid=n=>e.check(z1(L1,n)),e.cuid=n=>e.check(ML(pU,n)),e.cuid2=n=>e.check(DL(gU,n)),e.ulid=n=>e.check(IL(yU,n)),e.base64=n=>e.check(HL(jU,n)),e.base64url=n=>e.check(qL(CU,n)),e.xid=n=>e.check(LL(vU,n)),e.ksuid=n=>e.check(PL(bU,n)),e.ipv4=n=>e.check(UL(xU,n)),e.ipv6=n=>e.check(BL(wU,n)),e.cidrv4=n=>e.check($L(SU,n)),e.cidrv6=n=>e.check(FL(kU,n)),e.e164=n=>e.check(ZL(EU,n)),e.datetime=n=>e.check(qP(n)),e.date=n=>e.check(GP(n)),e.time=n=>e.check(QP(n)),e.duration=n=>e.check(YP(n))});function T(e){return CL(cU,e)}const en=de("ZodStringFormat",(e,t)=>{Kt.init(e,t),lN.init(e,t)}),dU=de("ZodEmail",(e,t)=>{R5.init(e,t),en.init(e,t)}),L1=de("ZodGUID",(e,t)=>{T5.init(e,t),en.init(e,t)}),yf=de("ZodUUID",(e,t)=>{A5.init(e,t),en.init(e,t)}),fU=de("ZodURL",(e,t)=>{O5.init(e,t),en.init(e,t)}),hU=de("ZodEmoji",(e,t)=>{z5.init(e,t),en.init(e,t)}),mU=de("ZodNanoID",(e,t)=>{M5.init(e,t),en.init(e,t)}),pU=de("ZodCUID",(e,t)=>{D5.init(e,t),en.init(e,t)}),gU=de("ZodCUID2",(e,t)=>{I5.init(e,t),en.init(e,t)}),yU=de("ZodULID",(e,t)=>{L5.init(e,t),en.init(e,t)}),vU=de("ZodXID",(e,t)=>{P5.init(e,t),en.init(e,t)}),bU=de("ZodKSUID",(e,t)=>{U5.init(e,t),en.init(e,t)}),xU=de("ZodIPv4",(e,t)=>{q5.init(e,t),en.init(e,t)}),wU=de("ZodIPv6",(e,t)=>{Z5.init(e,t),en.init(e,t)}),SU=de("ZodCIDRv4",(e,t)=>{G5.init(e,t),en.init(e,t)}),kU=de("ZodCIDRv6",(e,t)=>{V5.init(e,t),en.init(e,t)}),jU=de("ZodBase64",(e,t)=>{Q5.init(e,t),en.init(e,t)}),CU=de("ZodBase64URL",(e,t)=>{Y5.init(e,t),en.init(e,t)}),EU=de("ZodE164",(e,t)=>{X5.init(e,t),en.init(e,t)}),NU=de("ZodJWT",(e,t)=>{J5.init(e,t),en.init(e,t)}),Fv=de("ZodNumber",(e,t)=>{YE.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>SP(e,a,s),e.gt=(a,s)=>e.check(D1(a,s)),e.gte=(a,s)=>e.check(mg(a,s)),e.min=(a,s)=>e.check(mg(a,s)),e.lt=(a,s)=>e.check(M1(a,s)),e.lte=(a,s)=>e.check(hg(a,s)),e.max=(a,s)=>e.check(hg(a,s)),e.int=a=>e.check(P1(a)),e.safe=a=>e.check(P1(a)),e.positive=a=>e.check(D1(0,a)),e.nonnegative=a=>e.check(mg(0,a)),e.negative=a=>e.check(M1(0,a)),e.nonpositive=a=>e.check(hg(0,a)),e.multipleOf=(a,s)=>e.check(I1(a,s)),e.step=(a,s)=>e.check(I1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ge(e){return XL(Fv,e)}const _U=de("ZodNumberFormat",(e,t)=>{eL.init(e,t),Fv.init(e,t)});function P1(e){return JL(_U,e)}const TU=de("ZodBoolean",(e,t)=>{tL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kP(e,n,a)});function Wn(e){return eP(TU,e)}const AU=de("ZodNull",(e,t)=>{nL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jP(e,n,a)});function RU(e){return tP(AU,e)}const OU=de("ZodUnknown",(e,t)=>{rL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EP()});function Jt(){return nP(OU)}const zU=de("ZodNever",(e,t)=>{aL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CP(e,n,a)});function MU(e){return rP(zU,e)}const DU=de("ZodArray",(e,t)=>{iL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RP(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Zf(n,a)),e.nonempty=n=>e.check(Zf(1,n)),e.max=(n,a)=>e.check(tN(n,a)),e.length=(n,a)=>e.check(nN(n,a)),e.unwrap=()=>e.element});function vt(e,t){return pP(DU,e,t)}const IU=de("ZodObject",(e,t)=>{lL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OP(e,n,a,s),Ct(e,"shape",()=>t.shape),e.keyof=()=>Ze(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Jt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Jt()}),e.strict=()=>e.clone({...e._zod.def,catchall:MU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>E4(e,n),e.safeExtend=n=>N4(e,n),e.merge=n=>_4(e,n),e.pick=n=>j4(e,n),e.omit=n=>C4(e,n),e.partial=(...n)=>T4(cN,e,n[0]),e.required=(...n)=>A4(dN,e,n[0])});function ie(e,t){const n={type:"object",shape:e??{},...Ie(t)};return new IU(n)}const oN=de("ZodUnion",(e,t)=>{JE.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zP(e,n,a,s),e.options=t.options});function wh(e,t){return new oN({type:"union",options:e,...Ie(t)})}const LU=de("ZodDiscriminatedUnion",(e,t)=>{oN.init(e,t),oL.init(e,t)});function Sh(e,t,n){return new LU({type:"union",options:t,discriminator:e,...Ie(n)})}const PU=de("ZodIntersection",(e,t)=>{uL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MP(e,n,a,s)});function UU(e,t){return new PU({type:"intersection",left:e,right:t})}const BU=de("ZodRecord",(e,t)=>{cL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DP(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function pn(e,t,n){return new BU({type:"record",keyType:e,valueType:t,...Ie(n)})}const zy=de("ZodEnum",(e,t)=>{dL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>NP(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const o={};for(const c of a)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new zy({...t,checks:[],...Ie(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new zy({...t,checks:[],...Ie(s),entries:o})}});function Ze(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new zy({type:"enum",entries:n,...Ie(t)})}const $U=de("ZodLiteral",(e,t)=>{fL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_P(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ln(e,t){return new $U({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const FU=de("ZodTransform",(e,t)=>{hL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AP(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ME(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(dc(o,n.value,t));else{const c=o;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(dc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function uN(e){return new FU({type:"transform",transform:e})}const cN=de("ZodOptional",(e,t)=>{eN.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function U1(e){return new cN({type:"optional",innerType:e})}const HU=de("ZodExactOptional",(e,t)=>{mL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function qU(e){return new HU({type:"optional",innerType:e})}const ZU=de("ZodNullable",(e,t)=>{pL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function B1(e){return new ZU({type:"nullable",innerType:e})}const GU=de("ZodDefault",(e,t)=>{gL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function VU(e,t){return new GU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():PE(t)}})}const QU=de("ZodPrefault",(e,t)=>{yL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function KU(e,t){return new QU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():PE(t)}})}const dN=de("ZodNonOptional",(e,t)=>{vL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function YU(e,t){return new dN({type:"nonoptional",innerType:e,...Ie(t)})}const XU=de("ZodCatch",(e,t)=>{bL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function WU(e,t){return new XU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const JU=de("ZodPipe",(e,t)=>{xL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>$P(e,n,a,s),e.in=t.in,e.out=t.out});function My(e,t){return new JU({type:"pipe",in:e,out:t})}const e6=de("ZodReadonly",(e,t)=>{wL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function t6(e){return new e6({type:"readonly",innerType:e})}const n6=de("ZodCustom",(e,t)=>{SL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TP(e,n)});function r6(e,t={}){return gP(n6,e,t)}function a6(e){return yP(e)}function i6(e,t){return My(uN(e),t)}const Is={custom:"custom"};function kh(e){return WL(Fv,e)}const s6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function l6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function fN(e,t){const n=l6(e),a=new Map;for(const o of t)o.name&&a.set(o.name.toLowerCase(),o.agentId);if(a.size===0)return[];const s=new Set;for(const o of n.matchAll(s6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const o6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,$1="/";function hN(e){return!e||typeof e!="string"||e.length>256||!o6.test(e)?"/":e}const u6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},mN=Ze(["feishu","slack","kael"]),pN=Ze(["active","inactive"]);ie({platform:mN,agentId:T().min(1),credentials:pn(T(),Jt()),status:pN.default("active")});ie({agentId:T().min(1).optional(),credentials:pn(T(),Jt()).optional(),status:pN.optional()});ie({id:Ge(),platform:T(),agentId:T(),hasCredentials:Wn(),status:T(),createdAt:T(),updatedAt:T()});const c6=Ze(["code","reverse_token","oauth","manual"]);ie({appId:T().min(1),appSecret:T().min(1)});ie({platform:mN,externalUserId:T().min(1),agentId:T().min(1),boundVia:c6.default("manual"),displayName:T().max(200).optional()});ie({id:Ge(),platform:T(),externalUserId:T(),agentId:T(),boundVia:T().nullable(),displayName:T().nullable(),createdAt:T()});ie({feishuUserId:T().min(1),displayName:T().max(200).optional()});ie({configId:Ge(),platform:T(),agentId:T(),appId:T(),connected:Wn(),lastActiveAt:T().nullable()});const d6=32e3,Hv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,f6=/^[A-Z][A-Z0-9_]*$/,gN=ie({append:T().max(d6).default("")}),h6=ie({name:T().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("stdio"),command:T().min(1),args:vt(T()).optional()}),m6=ie({name:T().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("http"),url:T().url(),headers:pn(T(),T()).optional()}),p6=ie({name:T().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("sse"),url:T().url(),headers:pn(T(),T()).optional()}),yN=Sh("transport",[h6,m6,p6]),vN=ie({key:T().regex(f6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:T(),sensitive:Wn().default(!1)}),qv=ie({url:T().min(1),ref:T().min(1).optional(),localPath:T().min(1).optional()}),bN=ie({prompt:gN.default({append:""}),model:T().default("opus"),mcpServers:vt(yN).default([]),env:vt(vN).default([]),gitRepos:vt(qv).default([])}),g6=bN.extend({kind:ln("claude-code")}),y6=bN.extend({kind:ln("codex")}),v6=Sh("kind",[g6,y6]),b6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:Is.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,c)=>{a.has(o.key)&&t.addIssue({code:Is.custom,path:["env",c,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const s=new Set;e.gitRepos.forEach((o,c)=>{const f=o.localPath??Qf(o.url);f&&(s.has(f)&&t.addIssue({code:Is.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},xN=i6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,v6).superRefine((e,t)=>{b6(e,t)}),x6=ie({agentId:T(),version:Ge().int().positive(),payload:xN,updatedAt:T(),updatedBy:T()}),wN=ie({prompt:gN,model:T(),mcpServers:vt(yN),env:vt(vN),gitRepos:vt(qv)}).partial();ie({expectedVersion:Ge().int().positive(),payload:wN});ie({payload:wN});ie({current:x6,next:xN,diff:vt(ie({path:T(),op:Ze(["add","remove","replace"]),before:Jt().optional(),after:Jt().optional()}))});const Vf="***";function Qf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const SN=Ze(["online","offline"]),kN=Ze(["idle","working","blocked","error"]);Ze(["active","suspended","evicted"]);const w6=Ze(["active","suspended"]);ie({chatId:T().min(1),state:w6});ie({runtimeState:kN});ie({agentId:T().min(1),runtimeType:T().max(50),runtimeVersion:T().max(50).optional()});Ze(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);ie({agentId:T(),status:SN,connectedAt:T().nullable(),lastSeenAt:T(),clientId:T().nullable().optional(),runtimeType:T().nullable().optional(),runtimeVersion:T().nullable().optional(),runtimeState:kN.nullable().optional(),activeSessions:Ge().int().nullable().optional(),totalSessions:Ge().int().nullable().optional(),runtimeUpdatedAt:T().nullable().optional()});ie({total:Ge().int(),running:Ge().int(),byState:ie({idle:Ge().int(),working:Ge().int(),blocked:Ge().int(),error:Ge().int()}),clients:Ge().int()});const Kf={CLAUDE_CODE:"claude-code",CODEX:"codex"},jh=Ze(["claude-code","codex"]),Ch=Ze(["human","personal_assistant","autonomous_agent"]),F1={PRIVATE:"private",ORGANIZATION:"organization"},Zv=Ze(["private","organization"]),S6=Ze(["admin-api","portal"]);Ze(["active","suspended"]);const Dy=/^[a-z0-9][a-z0-9_-]{0,63}$/,Wl=64,k6=["admin","agent","first-tree","hub","me","null","system","undefined"],j6=new Set(k6);function Iy(e){return j6.has(e)}ie({name:T().min(1).max(64).regex(Dy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Iy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Ch,displayName:T().min(1).max(200).optional(),delegateMention:T().max(100).optional(),organizationId:T().min(1).max(100).optional(),source:S6.optional(),visibility:Zv.optional(),metadata:pn(T(),Jt()).optional(),managerId:T().optional(),clientId:T().min(1).max(100).optional(),runtimeProvider:jh.optional(),gitRepos:vt(qv).optional()});ie({type:Ch.optional(),displayName:T().min(1).max(200).optional(),delegateMention:T().max(100).nullable().optional(),visibility:Zv.optional(),metadata:pn(T(),Jt()).optional(),managerId:T().nullable().optional(),clientId:T().min(1).max(100).nullable().optional()});ie({clientId:T().min(1).max(100),runtimeProvider:jh,force:Wn().optional()});ie({uuid:T(),name:T().nullable(),organizationId:T(),type:Ch,displayName:T(),delegateMention:T().nullable(),inboxId:T(),status:T(),source:T().nullable().optional(),visibility:Zv,metadata:pn(T(),Jt()),managerId:T().nullable(),clientId:T().nullable(),runtimeProvider:jh,presenceStatus:SN.optional(),createdAt:T(),updatedAt:T()});ie({repo:T().nullable(),branch:T().nullable()});ie({type:ln("agent:pinned"),agentId:T(),name:T().nullable(),displayName:T(),agentType:Ch,runtimeProvider:jh});ie({username:T().min(1),password:T().min(1)});ie({accessToken:T(),refreshToken:T()});ie({refreshToken:T().min(1)});ie({token:T().min(1)});ie({token:T(),expiresIn:Ge(),command:T()});const C6=["issue","pull_request","discussion","commit"],E6=Ze(C6),N6=ie({source:ln("github"),entityType:E6,entityKey:T().min(1),entityUrl:T().url().optional()}),_6=ie({source:ln("feishu"),externalChannelId:T().min(1)}),T6=Sh("source",[N6,_6]),A6=wh([ie({}).strict(),T6]),R6=Ze(["direct","group","thread"]);ie({type:R6,topic:T().max(500).optional(),participantIds:vt(T()).min(1),metadata:A6.optional()});const jN=ie({agentId:T(),role:T(),mode:T(),joinedAt:T()});jN.extend({name:T().nullable(),displayName:T(),type:T()});const O6=ie({id:T(),organizationId:T(),type:T(),topic:T().nullable(),lifecyclePolicy:T().nullable().optional(),metadata:pn(T(),Jt()),createdAt:T(),updatedAt:T()});O6.extend({participants:vt(jN),title:T(),firstMessagePreview:T().nullable()});ie({topic:T().trim().max(500).nullable()});ie({agentId:T().min(1),mode:Ze(["full","mention_only"]).default("full")});ie({agentId:T().min(1)});const z6=Ze(["connected","disconnected"]),M6=Ze(["ok","expired"]);ie({id:T(),userId:T().nullable(),status:z6,authState:M6,sdkVersion:T().max(50).nullable(),hostname:T().max(100).nullable(),os:T().max(50).nullable(),agentCount:Ge().int().min(0),connectedAt:T().nullable(),lastSeenAt:T(),metadata:pn(T(),Jt()).nullable()});const D6=ie({wsInboxDeliver:Wn().default(!1)}).partial();ie({clientId:T().min(1).max(100),hostname:T().max(100).optional(),os:T().max(50).optional(),sdkVersion:T().max(50).optional(),wireCapabilities:D6.optional()});ie({clientId:T(),previousUserId:T().nullable(),unpinnedAgentCount:Ge().int().nonnegative()});const I6=Ze(["ok","missing","unauthenticated","error"]),L6=Ze(["api_key","oauth","auth_json","none"]),P6=ie({state:I6,available:Wn(),authenticated:Wn(),sdkVersion:T().nullable().optional(),authMethod:L6,error:T().nullable().optional(),detectedAt:T()}),U6=pn(T(),P6);ie({capabilities:U6});ie({limit:kh().int().min(1).max(100).default(20),cursor:T().optional()});const B6=Ze(["active","stale","unavailable"]),$6=Ze(["ok","warning","error"]),F6=ie({label:T(),detail:T().nullable(),severity:$6}),H6=Ze(["root","domain","subdomain","leaf"]),Gv=Ze(["added","edited","removed"]),q6=Ze(["parent","soft_link","markdown_link"]),Z6=Ze(["low","medium","high"]),G6=ie({id:T(),path:T(),sourcePath:T().nullable(),title:T(),kind:H6,owners:vt(T()),parentId:T().nullable(),preview:T().nullable(),relatedNodeIds:vt(T()),affectedContextArea:T(),changeType:Gv.nullable(),changedAtCommit:T().nullable()}),V6=ie({source:T(),target:T(),kind:q6}),Q6=ie({path:T(),nodeId:T().nullable(),type:Gv,commit:T().nullable(),changedAt:T().nullable(),changedBy:T().nullable(),summary:T().nullable()}),K6=ie({id:T(),nodeId:T().nullable(),path:T(),title:T(),changeType:Gv,affectedContextArea:T(),reason:T(),summary:T(),changedBy:T().nullable(),owners:vt(T()),relatedNodeIds:vt(T()),sourceCommit:T().nullable(),riskLevel:Z6}),Y6=ie({addedCount:Ge().int().nonnegative(),editedCount:Ge().int().nonnegative(),removedCount:Ge().int().nonnegative(),changedNodeCount:Ge().int().nonnegative()});ie({repo:T().nullable(),branch:T().nullable(),headCommit:T().nullable(),syncedAt:T().nullable(),snapshotStatus:B6,contextStatus:F6,summary:Y6,updates:vt(K6),nodes:vt(G6),edges:vt(V6),changes:vt(Q6)});const X6=["image/png","image/jpeg","image/gif","image/webp"],Vv=Ze(X6);ie({data:T().min(1),mimeType:Vv,filename:T().min(1),size:Ge().int().nonnegative().optional(),imageId:T().uuid().optional()});ie({imageId:T().uuid(),mimeType:Vv,filename:T().min(1),size:Ge().int().nonnegative().optional()});ie({type:ln("image_payload"),imageId:T().uuid(),chatId:T(),base64:T().min(1),mimeType:Vv,filename:T().min(1),size:Ge().int().nonnegative().optional()});const Qv=Ze(["hub_ui","cli","feishu","github","api"]),CN=Ze(["text","markdown","card","reference","file","question","question_answer"]);ie({format:CN.default("text"),content:Jt(),metadata:pn(T(),Jt()).optional(),inReplyTo:T().optional(),replyToInbox:T().optional(),replyToChat:T().optional(),source:Qv.optional()});ie({format:CN.default("text"),content:Jt(),metadata:pn(T(),Jt()).optional(),replyToInbox:T().optional(),replyToChat:T().optional(),source:Qv.optional()});const W6=ie({id:T(),chatId:T(),senderId:T(),format:T(),content:Jt(),metadata:pn(T(),Jt()),replyToInbox:T().nullable(),replyToChat:T().nullable(),inReplyTo:T().nullable(),source:Qv.nullable(),createdAt:T()}),J6=ie({senderId:T(),chatId:T(),replyToChat:T().nullable()}).nullable(),eB=Ze(["full","mention_only"]),tB=ie({id:T(),senderId:T(),format:T(),content:Jt(),metadata:pn(T(),Jt()).default({}),createdAt:T()}),EN=W6.extend({configVersion:Ge().int().positive(),recipientMode:eB.default("full"),inReplyToSnapshot:J6.default(null),precedingMessages:vt(tB).default([])});Ze(["pending","delivered","acked","failed"]);const nB=ie({id:Ge(),inboxId:T(),messageId:T(),chatId:T().nullable(),status:T(),retryCount:Ge(),createdAt:T(),deliveredAt:T().nullable(),ackedAt:T().nullable()});nB.extend({message:EN});ie({limit:kh().int().min(1).max(50).default(10)});ie({type:ln("inbox:deliver"),entryId:Ge().int().nonnegative(),inboxId:T().min(1),chatId:T().nullable(),message:EN}).passthrough();ie({type:ln("inbox:ack"),entryId:Ge().int().nonnegative()});const rB=7;ie({organizationId:T(),organizationName:T(),organizationDisplayName:T(),role:T(),expiresAt:T().nullable()});ie({id:T(),organizationId:T(),token:T(),inviteUrl:T(),role:T(),createdAt:T(),expiresAt:T().nullable()});ie({token:T().min(1)});ie({}).optional();const aB=["all","unread","watching"],iB=Ze(aB),NN=Ze(["participant","watching"]);ie({cursor:T().optional(),limit:kh().int().min(1).max(200).default(50),filter:iB.default("all")});const sB=ie({agentId:T(),displayName:T(),type:T()}),lB=ie({chatId:T(),type:T(),membershipKind:NN,title:T(),topic:T().nullable(),participants:vt(sB),participantCount:Ge().int(),lastMessageAt:T().nullable(),lastMessagePreview:T().nullable(),unreadMentionCount:Ge().int(),canReply:Wn()});ie({rows:vt(lB),nextCursor:T().nullable()});ie({participantIds:vt(T().min(1)).min(1),topic:T().trim().max(500).optional().nullable()});ie({participantIds:vt(T().min(1)).min(1)});ie({chatId:T(),lastReadAt:T(),unreadMentionCount:Ge().int()});ie({chatId:T(),membershipKind:NN.nullable()});ie({type:ln("chat:message"),chatId:T()});Ze(["connect","create_agent","completed"]);ie({id:T(),name:T(),displayName:T(),role:Ze(["admin","member"])});ie({name:T().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:T().min(1).max(200)});ie({dismissed:Wn().optional()});const oB=Ze(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);ie({event:oB,attrs:pn(T(),wh([T(),Ge(),Wn(),RU()])).optional()});ie({id:T(),organizationId:T(),organizationName:T(),role:Ze(["admin","member"]),agentId:T()});const uB={ADMIN:"admin",MEMBER:"member"},Kv=Ze(["admin","member"]),cB=ie({id:T(),userId:T(),organizationId:T(),agentId:T(),role:Kv,createdAt:T()});ie({username:T().min(1).max(100),displayName:T().min(1).max(200),role:Kv.default("member")});ie({role:Kv.optional(),displayName:T().min(1).max(200).optional()});cB.extend({username:T(),displayName:T(),password:T()});const dB=Ze(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),_N=Ze(["high","medium","low"]);ie({id:T(),organizationId:T(),type:dB,severity:_N,agentId:T().nullable(),chatId:T().nullable(),message:T(),read:Wn(),createdAt:T()});ie({limit:kh().int().min(1).max(100).default(20),cursor:T().optional(),severity:_N.optional(),read:Ze(["true","false"]).transform(e=>e==="true").optional(),agentId:T().optional()});ie({next:T().max(256).optional()});ie({code:T().min(1),state:T().min(1)});ie({githubId:T().min(1),login:T().min(1),email:T().email().optional(),displayName:T().optional(),next:T().max(256).optional()});const fB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function hB(e){return e.includes("://")?!1:fB.test(e)}const Eh=T().min(1).superRefine((e,t)=>{if(hB(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:Is.custom,message:"Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."});return}if(n.protocol!=="https:"&&n.protocol!=="ssh:"){t.addIssue({code:Is.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:Is.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:Is.custom,message:"Repo URL must not include credentials."});return}}),mB=ie({repo:Eh.optional(),branch:T().default("main")}),pB=ie({repo:Eh.nullish(),branch:T().min(1).nullish()}),gB=ie({repo:T().optional(),branch:T().optional()}),yB=ie({webhookSecretCipher:T().optional()}),vB=ie({webhookSecret:T().min(1).nullish()}),bB=ie({webhookSecretConfigured:Wn(),webhookUrl:T()}),xB=ie({repos:vt(ie({url:Eh,defaultBranch:T().optional()})).default([])}),wB=ie({repos:vt(ie({url:Eh,defaultBranch:T().min(1).optional()})).optional()}),SB=ie({repos:vt(ie({url:T(),defaultBranch:T().optional()}))}),kB={context_tree:{storage:mB,input:pB,output:gB,readPolicy:"member"},github_integration:{storage:yB,input:vB,output:bB,readPolicy:"admin"},source_repos:{storage:xB,input:wB,output:SB,readPolicy:"member"}},jB=Object.keys(kB);Ze(jB);const TN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ie({name:T().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!TN.test(e),"Name must not be a UUID format"),displayName:T().min(1).max(200),maxAgents:Ge().int().min(0).default(0),maxMessagesPerMinute:Ge().int().min(0).default(0),features:pn(T(),Jt()).default({})});ie({name:T().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!TN.test(e),"Name must not be a UUID format").optional(),displayName:T().min(1).max(200).optional(),maxAgents:Ge().int().min(0).optional(),maxMessagesPerMinute:Ge().int().min(0).optional(),features:pn(T(),Jt()).optional()});ie({id:T(),name:T(),displayName:T(),maxAgents:Ge(),maxMessagesPerMinute:Ge(),features:pn(T(),Jt()),createdAt:T(),updatedAt:T()});const CB=ie({workingCount:Ge().int().nonnegative(),errorMask:Wn()}),EB=ie({type:ln("pulse:tick"),organizationId:T(),agents:pn(T(),vt(CB).length(32))}),NB=ie({label:T().min(1),description:T(),preview:T().nullable().optional()}),_B=ie({question:T().min(1),header:T().min(1).max(24),options:vt(NB).min(2).max(4),multiSelect:Wn()}),TB=Ze(["html","markdown"]).nullable(),AB=ie({correlationId:T().min(1),questions:vt(_B).min(1).max(4),previewFormat:TB,allowFreeText:Wn()}),RB=ie({correlationId:T().min(1),answers:pn(T().min(1),T())});ie({answers:pn(T().min(1),T())});Ze(["pending","answered","superseded"]);const OB=Ze(["tool_call","error","assistant_text","thinking","turn_end"]),AN=ie({toolUseId:T(),name:T(),args:Jt(),status:Ze(["pending","ok","error"]),durationMs:Ge().int().nonnegative().optional(),resultPreview:T().max(400).optional()}),RN=ie({source:Ze(["sdk","runtime","tool"]),message:T().max(2e3)}),ON=ie({text:T().max(8e3)}),zN=ie({}),MN=ie({status:Ze(["success","error"])}),zB=Sh("kind",[ie({kind:ln("tool_call"),payload:AN}),ie({kind:ln("error"),payload:RN}),ie({kind:ln("assistant_text"),payload:ON}),ie({kind:ln("thinking"),payload:zN}),ie({kind:ln("turn_end"),payload:MN})]);ie({id:T(),agentId:T(),chatId:T(),seq:Ge().int().positive(),kind:OB,payload:wh([AN,RN,ON,zN,MN]),createdAt:T()});ie({agentId:T(),chatId:T(),event:zB});ie({agentId:T(),chatId:T()});ie({type:ln("session:reconcile"),agentId:T().min(1),chatIds:vt(T().min(1)).max(500)});ie({type:ln("session:reconcile:result"),agentId:T().min(1),staleChatIds:vt(T().min(1))});const MB=ie({organizationId:T(),agentCount:Ge(),chatCount:Ge(),messageCount:Ge()});ie({totalAgents:Ge(),totalChats:Ge(),totalMessages:Ge(),byOrganization:vt(MB)});const DB=Ze(["active","suspended"]);ie({id:T(),username:T(),displayName:T(),avatarUrl:T().nullable(),status:DB,createdAt:T(),updatedAt:T()});ie({username:T().min(1).max(100),displayName:T().min(1).max(200),password:T().min(8).max(200)});ie({displayName:T().min(1).max(200).optional(),password:T().min(8).max(200).optional()});ie({type:ln("auth"),token:T().min(1)});const IB=ie({wsInboxDeliver:Wn().default(!1)}).partial();ie({type:ln("server:welcome"),serverCommandVersion:T().min(1),serverTimeMs:Ge().int().nonnegative(),capabilities:IB.optional()}).passthrough();const DN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function LB(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let a=0;a<32&&a<n.length;a++){const s=n[a],o=t[a];!s||!o||(o.workingCount+=s.workingCount,o.errorMask=o.errorMask||s.errorMask)}return t}const PB=2e3,UB=3e4;let Gi=null,fc=!1,Yf=0,Xu=null;const Ly=new Set;let Zi=null,Ls=0;function BB(e){for(const t of Ly)try{t(e)}catch{}if(Zi){if(e.type==="notification")Zi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Zi.invalidateQueries({queryKey:["activity"]}),Zi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Zi.invalidateQueries({queryKey:["me","chats"]}),t&&(Zi.invalidateQueries({queryKey:["chat-messages",t]}),Zi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function Yv(){const e=oh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Gi=s,s.onmessage=o=>{if(s===Gi)try{const c=JSON.parse(o.data);BB(c)}catch{}},s.onopen=()=>{s===Gi&&(Yf=0)},s.onclose=o=>{if(s===Gi&&(Gi=null,!(fc||Ls===0))){if(o.code===4001){ez().then(c=>{fc||Ls===0||(c?(Yf=0,Yv()):H1())});return}H1()}}}function H1(){Yf++;const e=Math.min(PB*2**(Yf-1),UB);Xu=setTimeout(()=>{Xu=null,!fc&&Ls>0&&Yv()},e)}function $B(){fc=!0,Xu&&(clearTimeout(Xu),Xu=null),Gi&&(Gi.close(1e3,"unmount"),Gi=null)}function IN(e){const{onMessage:t,enabled:n=!0}=e??{},a=mn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Zi=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return Ly.add(o),Ls++,Ls===1&&(fc=!1,Yv()),()=>{Ly.delete(o),Ls--,Ls===0&&$B()}},[n])}const FB=b.createContext({aggregated:DN,agents:{},receivedAtMs:null,stale:!0});function HB({children:e}){const[t,n]=b.useState({aggregated:DN,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());IN({onMessage:c=>{const f=EB.safeParse(c);f.success&&n({aggregated:LB(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),b.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=b.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(FB.Provider,{value:o,children:e})}function Nh(e){return Ee.get(`/agents/${e}/config`)}function _h(e,t){return Ee.patch(`/agents/${e}/config`,t)}function qB(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function ZB(e){return Ee.get(`/agents/${e}/client-status`)}function GB({className:e,style:t,...n}){return l.jsx("div",{className:ze("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function VB({onClick:e,children:t}){return l.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function QB(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function KB({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const YB={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function ya({tone:e="neutral",className:t,style:n,...a}){const s=YB[e],o={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return l.jsx("span",{className:ze("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...a})}function Py({children:e,right:t,className:n,style:a,...s}){return l.jsxs("div",{className:ze("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...a},...s,children:[l.jsx("span",{children:e}),t]})}function Xv({className:e,style:t,...n}){return l.jsx("span",{className:ze("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Wu({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?l.jsxs("span",{className:ze("shrink-0",n),style:a,role:"img","aria-label":"working",children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:l.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):l.jsx("span",{className:ze("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function XB(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function hc({state:e,className:t}){const n=e!==null&&XB(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return l.jsxs("span",{className:ze("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[l.jsx(Wu,{state:n,size:7}),n]})}function vf({label:e,value:t,accent:n}){return l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[l.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),l.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function WB({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?l.jsx("div",{className:"sticky z-20 flex items-center justify-between gap-3 backdrop-blur",style:{top:0,padding:"var(--sp-1_75) var(--sp-5)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["Runs on ",l.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),l.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function JB(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),c=t.displayName||t.name||t.uuid;return l.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[l.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[l.jsx(Ws,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),l.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),l.jsxs("div",{children:[t.status==="active"?l.jsx(pg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(ve,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(pg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(ve,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(pg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:l.jsxs(ve,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[l.jsx(Bf,{className:"h-3 w-3"}),"Delete"]})})]}),l.jsx(e9,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(t9,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function pg(e){return l.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),l.jsx("div",{children:e.action})]})}function e9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsxs(In,{children:['Suspend "',n,'"?']})}),l.jsx("div",{className:"space-y-3",children:l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ve,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function t9({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(Dn,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsxs(In,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Ut,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ve,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var n9="Label",LN=b.forwardRef((e,t)=>l.jsx(di.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));LN.displayName=n9;var r9=LN;const xt=b.forwardRef(({className:e,...t},n)=>l.jsx(r9,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));xt.displayName="Label";const jn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));jn.displayName="Panel";const la=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));la.displayName="PanelHeader";const oa=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));oa.displayName="PanelTitle";const Jn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Jn.displayName="PanelBody";const a9={unchanged:{label:"",tone:""},added:{label:"new",tone:"bg-success-soft text-success"},modified:{label:"changed",tone:"bg-warn-soft text-warn"},deleted:{label:"will be removed on save",tone:"bg-error-soft text-error"}};function Wv({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=a9[e],f=e==="deleted";return l.jsxs("div",{className:ze("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&l.jsx("span",{className:ze("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?l.jsxs(ve,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(y3,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(ve,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(Cv,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(ve,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(Bf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function i9(e){const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=f=>s(m=>{const h=new Set(m);return h.has(f)?h.delete(f):h.add(f),h}),c=e.items.filter(f=>f.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(la,{children:[l.jsxs(oa,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(f=>{const m=f.value.sensitive,h=f.value.value===Vf,p=m&&!h&&!!f.value.value,g=a.has(f.key);let x;return m?p&&g?x=f.value.value:x="••••••":x=f.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(Wv,{status:f.status,onEdit:()=>n({mode:"edit",key:f.key,initial:f.value}),onDelete:()=>e.onDelete(f.key),onUndo:()=>e.onUndoDelete(f.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:f.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),m&&l.jsx(kv,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&l.jsx("button",{type:"button",onClick:()=>p&&o(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:p?g?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":g?"Hide value":"Reveal value",disabled:!p,style:{padding:0,opacity:p?1:.4},children:g?l.jsx(Hz,{className:"h-3.5 w-3.5"}):l.jsx(dC,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&l.jsx(s9,{open:!!t,onOpenChange:f=>!f&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:f=>{t.mode==="edit"?e.onUpdate(t.key,f):e.onAdd(f),n(null)}})]})}function s9({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.key)??""),[f,m]=b.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,p]=b.useState((n==null?void 0:n.sensitive)??!1),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),p((n==null?void 0:n.sensitive)??!1),x(null))},[e,n]);function w(S){if(S.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){x(`Another entry already uses key "${o}".`);return}let k=f;if(h&&(n!=null&&n.sensitive)&&!f&&(k=Vf),!h&&!n&&!f){x("Value is required for non-sensitive entries.");return}s({key:o,value:k,sensitive:h})}return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:n?"Edit environment variable":"Add environment variable"})}),l.jsxs("form",{onSubmit:w,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"env-key",children:"Key"}),l.jsx(Ut,{id:"env-key",value:o,onChange:S=>c(S.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&l.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"env-value",children:"Value"}),l.jsx(Ut,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:S=>m(S.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:h,onChange:S=>p(S.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function l9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(la,{children:[l.jsxs(oa,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const o=s.value.localPath??Qf(s.value.url);return l.jsxs(Wv,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&l.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),l.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},s.key)})}),t&&l.jsx(o9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function o9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),x(null))},[e,n]);function w(S){S.preventDefault();const k=o.trim();if(!k){x("URL is required.");return}const E=h.trim()||Qf(k);if(E&&a.has(E)){x(`Another repo already occupies local path "${E}".`);return}const C={url:k,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:n?"Edit Git repository":"Add Git repository"})}),l.jsxs("form",{onSubmit:w,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"git-url",children:"URL"}),l.jsx(Ut,{id:"git-url",value:o,onChange:S=>c(S.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Ut,{id:"git-ref",value:f,onChange:S=>m(S.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Ut,{id:"git-path",value:h,onChange:S=>p(S.target.value),placeholder:Qf(o)||"repo-name",className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function u9({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return l.jsx("span",{className:ze("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:s});const p=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,x=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?l.jsxs("span",{className:ze("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:p??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]}):l.jsxs("span",{className:ze("inline-flex items-baseline gap-1.5",o),style:c,title:p??void 0,children:[h&&l.jsx("span",{style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]})}function PN(){return Ee.get(Tn("/members"))}function c9(e,t){return Ee.patch(Tn(`/members/${encodeURIComponent(e)}`),t)}function d9(e){return Ee.delete(Tn(`/members/${encodeURIComponent(e)}`))}function UN(){const{data:e}=Ye({queryKey:["members","name-map"],queryFn:PN,staleTime:3e4});return b.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function f9({agent:e,onSave:t}){const[n,a]=b.useState(!1),s=Dv(),o=UN(),c=e.metadata,f=c==null?void 0:c.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(x=>typeof x=="string"):[],p=e.managerId?o(e.managerId):null,g=e.delegateMention?s(e.delegateMention):null;return l.jsxs(jn,{children:[l.jsxs(la,{children:[l.jsx(oa,{children:"Profile"}),e.status==="active"&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[l.jsx(Cv,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(Jn,{className:"text-body space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&l.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),g&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-muted-foreground",children:["delegate ",l.jsx(u9,{name:g.name,displayName:g.displayName})]})]})]}),l.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsxs("span",{children:["owner ",l.jsx("span",{className:"text-foreground",children:p??"—"})]}),m&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:m})]}),l.jsxs("span",{children:["type ",l.jsx(ya,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(ya,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(x=>l.jsx(ya,{tone:"outline",children:x},x))})]})]})]}),l.jsx(h9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function h9({agent:e,open:t,onOpenChange:n,onSave:a}){var z;const{memberId:s,role:o}=gt(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[x,w]=b.useState(!1),[S,k]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),k(null))},[t,e]);const E=e.type==="human",C=o==="admin"||e.managerId===s,N=Ye({queryKey:["agents-for-delegate"],queryFn:async()=>(await Dc({limit:100})).items.filter(R=>R.type==="personal_assistant"&&R.status==="active"),enabled:t&&E});async function O(L){L.preventDefault(),k(null);const R=c.trim();if(!R){k("Display name is required.");return}w(!0);try{const $={displayName:R,delegateMention:m||null};p!==e.visibility&&($.visibility=p),await a($),n(!1)}catch($){k($ instanceof Error?$.message:String($))}finally{w(!1)}}return l.jsx(Dn,{open:t,onOpenChange:n,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:O,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Agent name"}),l.jsx(Ut,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Ut,{id:"id-display",value:c,onChange:L=>f(L.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:L=>g(L.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[l.jsx("option",{value:F1.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:F1.ORGANIZATION,children:"Organization — all members"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:C?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),E&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:L=>h(L.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None"}),(z=N.data)==null?void 0:z.map(L=>l.jsx("option",{value:L.uuid,children:L.displayName?`${L.displayName} (@${L.name??L.uuid})`:L.name?`@${L.name}`:L.uuid},L.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),S&&l.jsx("p",{className:"text-body text-destructive",children:S}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:x,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:x,children:x?"Saving…":"Save"})]})]})]})})}function m9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function p9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(la,{children:[l.jsxs(oa,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(s=>{const o=s.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(s.value.name);return l.jsxs(Wv,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),l.jsx("span",{className:"font-medium font-mono",children:s.value.name}),l.jsx(ya,{tone:m9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:g9(s.value)})]},s.key)})}),t&&l.jsx(y9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function g9(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.join(" ")}`:"";return`${e.command}${n}`}return e.url}function y9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,x]=b.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,S]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[k,E]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),x((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),S(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),E(null))},[e,n]);function C(N){if(N.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){E(`Another MCP server is already named "${f}".`);return}let O;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const z=g.trim().split(/\s+/).filter(L=>L.length>0);O={name:f,transport:"stdio",command:h.trim(),...z.length?{args:z}:{}}}else{const z=w.trim();try{new URL(z)}catch{E("URL is not valid.");return}O={name:f,transport:o,url:z}}s(O)}return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:n?"Edit MCP server":"Add MCP server"})}),l.jsxs("form",{onSubmit:C,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:N=>c(N.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),l.jsx("option",{value:"http",children:"http"}),l.jsx("option",{value:"sse",children:"sse"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Ut,{id:"mcp-name",value:f,onChange:N=>m(N.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Ut,{id:"mcp-command",value:h,onChange:N=>p(N.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),l.jsx(Ut,{id:"mcp-args",value:g,onChange:N=>x(N.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Ut,{id:"mcp-url",value:w,onChange:N=>S(N.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const v9=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],b9=[{value:"gpt-5.5",label:"gpt-5.5",hint:"latest"},{value:"gpt-5.4",label:"gpt-5.4"},{value:"gpt-5.4-mini",label:"gpt-5.4-mini",hint:"fastest"},{value:"gpt-5.3-codex",label:"gpt-5.3-codex",hint:"coding-specialized"},{value:"gpt-5.2",label:"gpt-5.2"}],x9={"claude-code":v9,codex:b9},w9={"claude-code":"Choose which Claude model powers this agent. Aliases (opus / sonnet / haiku) follow the CLI's latest-in-family mapping and may shift across releases. Applies to new sessions immediately; active sessions switch on their next message. Unset falls back to the operator's local ~/.claude/settings.json model preference, then the CLI default.",codex:"Pick a Codex model. Slugs come from the Codex CLI bundled with @openai/codex-sdk; ChatGPT-account auth currently only accepts gpt-5.5, while API-key auth accepts the wider set. Applies to new sessions immediately; active sessions switch on their next message. Unset lets the codex CLI choose a model that matches the user's auth mode."},S9={value:"",label:"(unset — inherits local)"};function k9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=x9[o],m=b.useMemo(()=>{const h=[S9,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(jn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(la,{children:[l.jsxs(oa,{children:["Model",c&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),c&&l.jsx(ve,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Jn,{className:"space-y-2",children:[l.jsx(j9,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:w9[o]})]})]})}function j9({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[c,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(x=>x.value===t)??e[0],g=b.useCallback(()=>{const x=m.current;if(!x)return;const w=x.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const x=k=>{var C,N;const E=k.target;(C=m.current)!=null&&C.contains(E)||(N=h.current)!=null&&N.contains(E)||o(!1)},w=k=>{var E;k.key==="Escape"&&(o(!1),(E=m.current)==null||E.focus())},S=()=>g();return document.addEventListener("pointerdown",x),document.addEventListener("keydown",w),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(x=>!x),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(Sv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&_v.createPortal(l.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(x=>{const w=x.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(x.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:x.value===""?"var(--fg-3)":void 0},children:[l.jsx(cr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:x.label}),x.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:x.hint})]},x.value||"__unset")})}),document.body)]})}function C9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const E9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_9={};function q1(e,t){return(_9.jsx?N9:E9).test(e)}const T9=/[ \t\n\f\r]/g;function A9(e){return typeof e=="object"?e.type==="text"?Z1(e.value):!1:Z1(e)}function Z1(e){return e.replace(T9,"")===""}class Pc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Pc.prototype.normal={};Pc.prototype.property={};Pc.prototype.space=void 0;function BN(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Pc(n,a,t)}function Uy(e){return e.toLowerCase()}class Nr{constructor(t,n){this.attribute=n,this.property=t}}Nr.prototype.attribute="";Nr.prototype.booleanish=!1;Nr.prototype.boolean=!1;Nr.prototype.commaOrSpaceSeparated=!1;Nr.prototype.commaSeparated=!1;Nr.prototype.defined=!1;Nr.prototype.mustUseProperty=!1;Nr.prototype.number=!1;Nr.prototype.overloadedBoolean=!1;Nr.prototype.property="";Nr.prototype.spaceSeparated=!1;Nr.prototype.space=void 0;let R9=0;const Je=nl(),Sn=nl(),By=nl(),be=nl(),Pt=nl(),no=nl(),Ir=nl();function nl(){return 2**++R9}const $y=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:Sn,commaOrSpaceSeparated:Ir,commaSeparated:no,number:be,overloadedBoolean:By,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),gg=Object.keys($y);class Jv extends Nr{constructor(t,n,a,s){let o=-1;if(super(t,n),G1(this,"space",s),typeof a=="number")for(;++o<gg.length;){const c=gg[o];G1(this,gg[o],(a&$y[c])===$y[c])}}}Jv.prototype.defined=!0;function G1(e,t,n){n&&(e[t]=n)}function To(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new Jv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Uy(a)]=a,n[Uy(o.attribute)]=a}return new Pc(t,n,e.space)}const $N=To({properties:{ariaActiveDescendant:null,ariaAtomic:Sn,ariaAutoComplete:null,ariaBusy:Sn,ariaChecked:Sn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Pt,ariaCurrent:null,ariaDescribedBy:Pt,ariaDetails:null,ariaDisabled:Sn,ariaDropEffect:Pt,ariaErrorMessage:null,ariaExpanded:Sn,ariaFlowTo:Pt,ariaGrabbed:Sn,ariaHasPopup:null,ariaHidden:Sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pt,ariaLevel:be,ariaLive:null,ariaModal:Sn,ariaMultiLine:Sn,ariaMultiSelectable:Sn,ariaOrientation:null,ariaOwns:Pt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:Sn,ariaReadOnly:Sn,ariaRelevant:null,ariaRequired:Sn,ariaRoleDescription:Pt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:Sn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function FN(e,t){return t in e?e[t]:t}function HN(e,t){return FN(e,t.toLowerCase())}const O9=To({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:no,acceptCharset:Pt,accessKey:Pt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Pt,autoFocus:Je,autoPlay:Je,blocking:Pt,capture:null,charSet:null,checked:Je,cite:null,className:Pt,cols:be,colSpan:null,content:null,contentEditable:Sn,controls:Je,controlsList:Pt,coords:be|no,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:By,draggable:Sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Pt,height:be,hidden:By,high:be,href:null,hrefLang:null,htmlFor:Pt,httpEquiv:Pt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Pt,itemRef:Pt,itemScope:Je,itemType:Pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Je,optimum:be,pattern:null,ping:Pt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Pt,required:Je,reversed:Je,rows:be,rowSpan:be,sandbox:Pt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:Sn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:Sn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:Sn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:HN}),z9=To({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ir,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:no,g2:no,glyphName:no,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:Ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ir,rev:Ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ir,requiredFeatures:Ir,requiredFonts:Ir,requiredFormats:Ir,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:Ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ir,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:FN}),qN=To({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ZN=To({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HN}),GN=To({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),M9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},D9=/[A-Z]/g,V1=/-[a-z]/g,I9=/^data[-\w.:]+$/i;function L9(e,t){const n=Uy(t);let a=t,s=Nr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&I9.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(V1,U9);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!V1.test(o)){let c=o.replace(D9,P9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=Jv}return new s(a,t)}function P9(e){return"-"+e.toLowerCase()}function U9(e){return e.charAt(1).toUpperCase()}const B9=BN([$N,O9,qN,ZN,GN],"html"),eb=BN([$N,z9,qN,ZN,GN],"svg");function $9(e){return e.join(" ").trim()}var Fl={},yg,Q1;function F9(){if(Q1)return yg;Q1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
373
- `,h="/",p="*",g="",x="comment",w="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var N=1,O=1;function z(J){var X=J.match(t);X&&(N+=X.length);var q=J.lastIndexOf(m);O=~q?J.length-q:O+J.length}function L(){var J={line:N,column:O};return function(X){return X.position=new R(J),V(),X}}function R(J){this.start=J,this.end={line:N,column:O},this.source=C.source}R.prototype.content=E;function $(J){var X=new Error(C.source+":"+N+":"+O+": "+J);if(X.reason=J,X.filename=C.source,X.line=N,X.column=O,X.source=E,!C.silent)throw X}function U(J){var X=J.exec(E);if(X){var q=X[0];return z(q),E=E.slice(q.length),X}}function V(){U(n)}function D(J){var X;for(J=J||[];X=Y();)X!==!1&&J.push(X);return J}function Y(){var J=L();if(!(h!=E.charAt(0)||p!=E.charAt(1))){for(var X=2;g!=E.charAt(X)&&(p!=E.charAt(X)||h!=E.charAt(X+1));)++X;if(X+=2,g===E.charAt(X-1))return $("End of comment missing");var q=E.slice(2,X-2);return O+=2,z(q),E=E.slice(X),O+=2,J({type:x,comment:q})}}function ae(){var J=L(),X=U(a);if(X){if(Y(),!U(s))return $("property missing ':'");var q=U(o),te=J({type:w,property:k(X[0].replace(e,g)),value:q?k(q[0].replace(e,g)):g});return U(c),te}}function xe(){var J=[];D(J);for(var X;X=ae();)X!==!1&&(J.push(X),D(J));return J}return V(),xe()}function k(E){return E?E.replace(f,g):g}return yg=S,yg}var K1;function H9(){if(K1)return Fl;K1=1;var e=Fl&&Fl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Fl,"__esModule",{value:!0}),Fl.default=n;const t=e(F9());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),f=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;f?s(h,p,m):p&&(o=o||{},o[h]=p)}),o}return Fl}var Iu={},Y1;function q9(){if(Y1)return Iu;Y1=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return Iu.camelCase=m,Iu}var Lu,X1;function Z9(){if(X1)return Lu;X1=1;var e=Lu&&Lu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(H9()),n=q9();function a(s,o){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(c[(0,n.camelCase)(f,o)]=m)}),c}return a.default=a,Lu=a,Lu}var G9=Z9();const V9=rh(G9),VN=QN("end"),tb=QN("start");function QN(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function Q9(e){const t=tb(e),n=VN(e);if(t&&n)return{start:t,end:n}}function Ju(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?W1(e.position):"start"in e||"end"in e?W1(e):"line"in e||"column"in e?Fy(e):""}function Fy(e){return J1(e&&e.line)+":"+J1(e&&e.column)}function W1(e){return Fy(e&&e.start)+"-"+Fy(e&&e.end)}function J1(e){return e&&typeof e=="number"?e:1}class er extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(c=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=Ju(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}er.prototype.file="";er.prototype.name="";er.prototype.reason="";er.prototype.message="";er.prototype.stack="";er.prototype.column=void 0;er.prototype.line=void 0;er.prototype.ancestors=void 0;er.prototype.cause=void 0;er.prototype.fatal=void 0;er.prototype.place=void 0;er.prototype.ruleId=void 0;er.prototype.source=void 0;const nb={}.hasOwnProperty,K9=new Map,Y9=/[A-Z]/g,X9=new Set(["table","tbody","thead","tfoot","tr"]),W9=new Set(["td","th"]),KN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function J9(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=l$(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=s$(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?eb:B9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=YN(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function YN(e,t,n){if(t.type==="element")return e$(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return t$(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return r$(e,t,n);if(t.type==="mdxjsEsm")return n$(e,t);if(t.type==="root")return a$(e,t,n);if(t.type==="text")return i$(e,t)}function e$(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=eb,e.schema=s),e.ancestors.push(t);const o=WN(e,t.tagName,!1),c=o$(e,t);let f=ab(e,t);return X9.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!A9(m):!0})),XN(e,c,o,t),rb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function t$(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}mc(e,t.position)}function n$(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mc(e,t.position)}function r$(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=eb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:WN(e,t.name,!0),c=u$(e,t),f=ab(e,t);return XN(e,c,o,t),rb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function a$(e,t,n){const a={};return rb(a,ab(e,t)),e.create(t,e.Fragment,a,n)}function i$(e,t){return t.value}function XN(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function rb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function s$(e,t,n){return a;function a(s,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function l$(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=tb(a);return t(s,o,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function o$(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&nb.call(t.properties,s)){const o=c$(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&W9.has(t.tagName)?a=f:n[c]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function u$(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else mc(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else mc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function ab(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:K9;for(;++a<t.children.length;){const o=t.children[a];let c;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const f=YN(e,o,c);f!==void 0&&n.push(f)}return n}function c$(e,t,n){const a=L9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?C9(n):$9(n)),a.property==="style"){let s=typeof n=="object"?n:d$(e,String(n));return e.stylePropertyNameCase==="css"&&(s=f$(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?M9[a.property]||a.property:a.attribute,n]}}function d$(e,t){try{return V9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new er("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=KN+"#cannot-parse-style-attribute",s}}function WN(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,c;for(;++o<s.length;){const f=q1(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=q1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return nb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);mc(e)}function mc(e,t){const n=new er("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=KN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function f$(e){const t={};let n;for(n in e)nb.call(e,n)&&(t[h$(n)]=e[n]);return t}function h$(e){let t=e.replace(Y9,m$);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function m$(e){return"-"+e.toLowerCase()}const vg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},p$={};function ib(e,t){const n=p$,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return JN(e,a,s)}function JN(e,t,n){if(g$(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ek(e.children,t,n)}return Array.isArray(e)?ek(e,t,n):""}function ek(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=JN(e[s],t,n);return a.join("")}function g$(e){return!!(e&&typeof e=="object")}const tk=document.createElement("i");function sb(e){const t="&"+e+";";tk.innerHTML=t;const n=tk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ur(e,t,n,a){const s=e.length;let o=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<a.length;)c=a.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function ta(e,t){return e.length>0?(Ur(e,e.length,0,t),e):t}const nk={}.hasOwnProperty;function e_(e){const t={};let n=-1;for(;++n<e.length;)y$(t,e[n]);return t}function y$(e,t){let n;for(n in t){const s=(nk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){nk.call(s,c)||(s[c]=[]);const f=o[c];v$(s[c],Array.isArray(f)?f:f?[f]:[])}}}function v$(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Ur(e,0,0,a)}function t_(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function va(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ur=ps(/[A-Za-z]/),Xn=ps(/[\dA-Za-z]/),b$=ps(/[#-'*+\--9=?A-Z^-~]/);function Xf(e){return e!==null&&(e<32||e===127)}const Hy=ps(/\d/),x$=ps(/[\dA-Fa-f]/),w$=ps(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const Th=ps(new RegExp("\\p{P}|\\p{S}","u")),Ys=ps(/\s/);function ps(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ao(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Xn(e.charCodeAt(n+1))&&Xn(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),s=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function yt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return lt(m)?(e.enter(n),f(m)):t(m)}function f(m){return lt(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const S$={tokenize:k$};function k$(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),yt(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const j$={tokenize:C$},rk={tokenize:E$};function C$(e){const t=this,n=[];let a=0,s,o,c;return f;function f(O){if(a<n.length){const z=n[a];return t.containerState=z[1],e.attempt(z[0].continuation,m,h)(O)}return h(O)}function m(O){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&N();const z=t.events.length;let L=z,R;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){R=t.events[L][1].end;break}C(a);let $=z;for(;$<t.events.length;)t.events[$][1].end={...R},$++;return Ur(t.events,L+1,0,t.events.slice(z)),t.events.length=$,h(O)}return f(O)}function h(O){if(a===n.length){if(!s)return x(O);if(s.currentConstruct&&s.currentConstruct.concrete)return S(O);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rk,p,g)(O)}function p(O){return s&&N(),C(a),x(O)}function g(O){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,S(O)}function x(O){return t.containerState={},e.attempt(rk,w,S)(O)}function w(O){return a++,n.push([t.currentConstruct,t.containerState]),x(O)}function S(O){if(O===null){s&&N(),C(0),e.consume(O);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),k(O)}function k(O){if(O===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(O);return}return Fe(O)?(e.consume(O),E(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(O),k)}function E(O,z){const L=t.sliceStream(O);if(z&&L.push(null),O.previous=o,o&&(o.next=O),o=O,s.defineSkip(O.start),s.write(L),t.parser.lazy[O.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<c&&(!s.events[R][1].end||s.events[R][1].end.offset>c))return;const $=t.events.length;let U=$,V,D;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(V){D=t.events[U][1].end;break}V=!0}for(C(a),R=$;R<t.events.length;)t.events[R][1].end={...D},R++;Ur(t.events,U+1,0,t.events.slice($)),t.events.length=R}}function C(O){let z=n.length;for(;z-- >O;){const L=n[z];t.containerState=L[1],L[0].exit.call(t,e)}n.length=O}function N(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function E$(e,t,n){return yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wo(e){if(e===null||It(e)||Ys(e))return 1;if(Th(e))return 2}function Ah(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const qy={name:"attention",resolveAll:N$,tokenize:_$};function N$(e,t){let n=-1,a,s,o,c,f,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},x={...e[n][1].start};ak(g,-m),ak(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=ta(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ta(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=ta(h,Ah(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ta(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=ta(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ur(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function _$(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=wo(a);let o;return c;function c(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),p=wo(m),g=!p||p===2&&s||n.includes(m),x=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!x)),h._close=!!(o===42?x:x&&(p||!g)),t(m)}}function ak(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const T$={name:"autolink",tokenize:A$};function A$(e,t,n){let a=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(w){return ur(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Xn(w)?(a=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Xn(w))&&a++<32?(e.consume(w),f):(a=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Xf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),p):b$(w)?(e.consume(w),h):n(w)}function p(w){return Xn(w)?g(w):n(w)}function g(w){return w===46?(e.consume(w),a=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||Xn(w))&&a++<63){const S=w===45?x:g;return e.consume(w),S}return n(w)}}const Uc={partial:!0,tokenize:R$};function R$(e,t,n){return a;function a(o){return lt(o)?yt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Fe(o)?t(o):n(o)}}const n_={continuation:{tokenize:z$},exit:M$,name:"blockQuote",tokenize:O$};function O$(e,t,n){const a=this;return s;function s(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return lt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function z$(e,t,n){const a=this;return s;function s(c){return lt(c)?yt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(n_,t,n)(c)}}function M$(e){e.exit("blockQuote")}const r_={name:"characterEscape",tokenize:D$};function D$(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return w$(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const a_={name:"characterReference",tokenize:I$};function I$(e,t,n){const a=this;let s=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Xn,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=x$,p):(e.enter("characterReferenceValue"),o=7,c=Hy,p(g))}function p(g){if(g===59&&s){const x=e.exit("characterReferenceValue");return c===Xn&&!sb(a.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<o?(e.consume(g),p):n(g)}}const ik={partial:!0,tokenize:P$},sk={concrete:!0,name:"codeFenced",tokenize:L$};function L$(e,t,n){const a=this,s={partial:!0,tokenize:L};let o=0,c=0,f;return m;function m(R){return h(R)}function h(R){const $=a.events[a.events.length-1];return o=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===f?(c++,e.consume(R),p):c<3?n(R):(e.exit("codeFencedFenceSequence"),lt(R)?yt(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Fe(R)?(e.exit("codeFencedFence"),a.interrupt?t(R):e.check(ik,k,z)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===null||Fe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yt(e,w,"whitespace")(R)):R===96&&R===f?n(R):(e.consume(R),x)}function w(R){return R===null||Fe(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(R))}function S(R){return R===null||Fe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?n(R):(e.consume(R),S)}function k(R){return e.attempt(s,z,E)(R)}function E(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),C}function C(R){return o>0&&lt(R)?yt(e,N,"linePrefix",o+1)(R):N(R)}function N(R){return R===null||Fe(R)?e.check(ik,k,z)(R):(e.enter("codeFlowValue"),O(R))}function O(R){return R===null||Fe(R)?(e.exit("codeFlowValue"),N(R)):(e.consume(R),O)}function z(R){return e.exit("codeFenced"),t(R)}function L(R,$,U){let V=0;return D;function D(X){return R.enter("lineEnding"),R.consume(X),R.exit("lineEnding"),Y}function Y(X){return R.enter("codeFencedFence"),lt(X)?yt(R,ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):ae(X)}function ae(X){return X===f?(R.enter("codeFencedFenceSequence"),xe(X)):U(X)}function xe(X){return X===f?(V++,R.consume(X),xe):V>=c?(R.exit("codeFencedFenceSequence"),lt(X)?yt(R,J,"whitespace")(X):J(X)):U(X)}function J(X){return X===null||Fe(X)?(R.exit("codeFencedFence"),$(X)):U(X)}}}function P$(e,t,n){const a=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const bg={name:"codeIndented",tokenize:B$},U$={partial:!0,tokenize:$$};function B$(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),yt(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Fe(h)?e.attempt(U$,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function $$(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):yt(e,o,"linePrefix",5)(c)}function o(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Fe(c)?s(c):n(c)}}const F$={name:"codeText",previous:q$,resolve:H$,tokenize:Z$};function H$(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function q$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Z$(e,t,n){let a=0,s,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):Fe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Fe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class G${constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Pu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Pu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Pu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Pu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Pu(this.left,n.reverse())}}}function Pu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function i_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new G$(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,V$(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=p.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...p.get(s)[1].start},f=p.slice(s,n),f.unshift(a),p.splice(s,n-s+1,f))}}return Ur(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function V$(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let p,g,x=-1,w=n,S=0,k=0;const E=[k];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(p=a.sliceStream(w),w.next||p.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=n;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(k=x+1,E.push(k),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),x=E.length;x--;){const C=f.slice(E[x],E[x+1]),N=o.pop();m.push([N,N+C.length-1]),e.splice(N,2,C)}for(m.reverse(),x=-1;++x<m.length;)h[S+m[x][0]]=S+m[x][1],S+=m[x][1]-m[x][0]-1;return h}const Q$={resolve:Y$,tokenize:X$},K$={partial:!0,tokenize:W$};function Y$(e){return i_(e),e}function X$(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){return f===null?o(f):Fe(f)?e.check(K$,c,o)(f):(e.consume(f),s)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function W$(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),yt(e,o,"linePrefix")}function o(c){if(c===null||Fe(c))return n(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function s_(e,t,n,a,s,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),x):C===null||C===32||C===41||Xf(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(C))}function x(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),x(C)):C===null||C===60||Fe(C)?n(C):(e.consume(C),C===92?S:w)}function S(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function k(C){return!p&&(C===null||C===41||It(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):p<h&&C===40?(e.consume(C),p++,k):C===41?(e.consume(C),p--,k):C===null||C===32||C===40||Xf(C)?n(C):(e.consume(C),C===92?E:k)}function E(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function l_(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(o),p}function p(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(o),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):Fe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Fe(w)||f++>999?(e.exit("chunkString"),p(w)):(e.consume(w),m||(m=!lt(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function o_(e,t,n,a,s,o){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(a),e.enter(s),e.consume(x),e.exit(s),c=x===40?41:x,m):n(x)}function m(x){return x===c?(e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):(e.enter(o),h(x))}function h(x){return x===c?(e.exit(o),m(c)):x===null?n(x):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),yt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===c||x===null||Fe(x)?(e.exit("chunkString"),h(x)):(e.consume(x),x===92?g:p)}function g(x){return x===c||x===92?(e.consume(x),p):p(x)}}function ec(e,t){let n;return a;function a(s){return Fe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):lt(s)?yt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const J$={name:"definition",tokenize:tF},eF={partial:!0,tokenize:nF};function tF(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return l_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return It(w)?ec(e,h)(w):h(w)}function h(w){return s_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(eF,g,g)(w)}function g(w){return lt(w)?yt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||Fe(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function nF(e,t,n){return a;function a(f){return It(f)?ec(e,s)(f):n(f)}function s(f){return o_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return lt(f)?yt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):n(f)}}const rF={name:"hardBreakEscape",tokenize:aF};function aF(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Fe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const iF={name:"headingAtx",resolve:sF,tokenize:lF};function sF(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Ur(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function lF(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||It(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Fe(p)?(e.exit("atxHeading"),t(p)):lt(p)?yt(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||It(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const oF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lk=["pre","script","style","textarea"],uF={concrete:!0,name:"htmlFlow",resolveTo:fF,tokenize:hF},cF={partial:!0,tokenize:pF},dF={partial:!0,tokenize:mF};function fF(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function hF(e,t,n){const a=this;let s,o,c,f,m;return h;function h(_){return p(_)}function p(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),x):_===47?(e.consume(_),o=!0,k):_===63?(e.consume(_),s=3,a.interrupt?t:M):ur(_)?(e.consume(_),c=String.fromCharCode(_),E):n(_)}function x(_){return _===45?(e.consume(_),s=2,w):_===91?(e.consume(_),s=5,f=0,S):ur(_)?(e.consume(_),s=4,a.interrupt?t:M):n(_)}function w(_){return _===45?(e.consume(_),a.interrupt?t:M):n(_)}function S(_){const Z="CDATA[";return _===Z.charCodeAt(f++)?(e.consume(_),f===Z.length?a.interrupt?t:ae:S):n(_)}function k(_){return ur(_)?(e.consume(_),c=String.fromCharCode(_),E):n(_)}function E(_){if(_===null||_===47||_===62||It(_)){const Z=_===47,Q=c.toLowerCase();return!Z&&!o&&lk.includes(Q)?(s=1,a.interrupt?t(_):ae(_)):oF.includes(c.toLowerCase())?(s=6,Z?(e.consume(_),C):a.interrupt?t(_):ae(_)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(_):o?N(_):O(_))}return _===45||Xn(_)?(e.consume(_),c+=String.fromCharCode(_),E):n(_)}function C(_){return _===62?(e.consume(_),a.interrupt?t:ae):n(_)}function N(_){return lt(_)?(e.consume(_),N):D(_)}function O(_){return _===47?(e.consume(_),D):_===58||_===95||ur(_)?(e.consume(_),z):lt(_)?(e.consume(_),O):D(_)}function z(_){return _===45||_===46||_===58||_===95||Xn(_)?(e.consume(_),z):L(_)}function L(_){return _===61?(e.consume(_),R):lt(_)?(e.consume(_),L):O(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),m=_,$):lt(_)?(e.consume(_),R):U(_)}function $(_){return _===m?(e.consume(_),m=null,V):_===null||Fe(_)?n(_):(e.consume(_),$)}function U(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||It(_)?L(_):(e.consume(_),U)}function V(_){return _===47||_===62||lt(_)?O(_):n(_)}function D(_){return _===62?(e.consume(_),Y):n(_)}function Y(_){return _===null||Fe(_)?ae(_):lt(_)?(e.consume(_),Y):n(_)}function ae(_){return _===45&&s===2?(e.consume(_),q):_===60&&s===1?(e.consume(_),te):_===62&&s===4?(e.consume(_),I):_===63&&s===3?(e.consume(_),M):_===93&&s===5?(e.consume(_),Ae):Fe(_)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(cF,P,xe)(_)):_===null||Fe(_)?(e.exit("htmlFlowData"),xe(_)):(e.consume(_),ae)}function xe(_){return e.check(dF,J,P)(_)}function J(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),X}function X(_){return _===null||Fe(_)?xe(_):(e.enter("htmlFlowData"),ae(_))}function q(_){return _===45?(e.consume(_),M):ae(_)}function te(_){return _===47?(e.consume(_),c="",ke):ae(_)}function ke(_){if(_===62){const Z=c.toLowerCase();return lk.includes(Z)?(e.consume(_),I):ae(_)}return ur(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ke):ae(_)}function Ae(_){return _===93?(e.consume(_),M):ae(_)}function M(_){return _===62?(e.consume(_),I):_===45&&s===2?(e.consume(_),M):ae(_)}function I(_){return _===null||Fe(_)?(e.exit("htmlFlowData"),P(_)):(e.consume(_),I)}function P(_){return e.exit("htmlFlow"),t(_)}}function mF(e,t,n){const a=this;return s;function s(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function pF(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Uc,t,n)}}const gF={name:"htmlText",tokenize:yF};function yF(e,t,n){const a=this;let s,o,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),L):M===63?(e.consume(M),O):ur(M)?(e.consume(M),U):n(M)}function h(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),o=0,S):ur(M)?(e.consume(M),N):n(M)}function p(M){return M===45?(e.consume(M),w):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),x):Fe(M)?(c=g,te(M)):(e.consume(M),g)}function x(M){return M===45?(e.consume(M),w):g(M)}function w(M){return M===62?q(M):M===45?x(M):g(M)}function S(M){const I="CDATA[";return M===I.charCodeAt(o++)?(e.consume(M),o===I.length?k:S):n(M)}function k(M){return M===null?n(M):M===93?(e.consume(M),E):Fe(M)?(c=k,te(M)):(e.consume(M),k)}function E(M){return M===93?(e.consume(M),C):k(M)}function C(M){return M===62?q(M):M===93?(e.consume(M),C):k(M)}function N(M){return M===null||M===62?q(M):Fe(M)?(c=N,te(M)):(e.consume(M),N)}function O(M){return M===null?n(M):M===63?(e.consume(M),z):Fe(M)?(c=O,te(M)):(e.consume(M),O)}function z(M){return M===62?q(M):O(M)}function L(M){return ur(M)?(e.consume(M),R):n(M)}function R(M){return M===45||Xn(M)?(e.consume(M),R):$(M)}function $(M){return Fe(M)?(c=$,te(M)):lt(M)?(e.consume(M),$):q(M)}function U(M){return M===45||Xn(M)?(e.consume(M),U):M===47||M===62||It(M)?V(M):n(M)}function V(M){return M===47?(e.consume(M),q):M===58||M===95||ur(M)?(e.consume(M),D):Fe(M)?(c=V,te(M)):lt(M)?(e.consume(M),V):q(M)}function D(M){return M===45||M===46||M===58||M===95||Xn(M)?(e.consume(M),D):Y(M)}function Y(M){return M===61?(e.consume(M),ae):Fe(M)?(c=Y,te(M)):lt(M)?(e.consume(M),Y):V(M)}function ae(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,xe):Fe(M)?(c=ae,te(M)):lt(M)?(e.consume(M),ae):(e.consume(M),J)}function xe(M){return M===s?(e.consume(M),s=void 0,X):M===null?n(M):Fe(M)?(c=xe,te(M)):(e.consume(M),xe)}function J(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||It(M)?V(M):(e.consume(M),J)}function X(M){return M===47||M===62||It(M)?V(M):n(M)}function q(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function te(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ke}function ke(M){return lt(M)?yt(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Ae(M)}function Ae(M){return e.enter("htmlTextData"),c(M)}}const lb={name:"labelEnd",resolveAll:wF,resolveTo:SF,tokenize:kF},vF={tokenize:jF},bF={tokenize:CF},xF={tokenize:EF};function wF(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&Ur(e,0,e.length,n),e}function SF(e,t){let n=e.length,a=0,s,o,c,f;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ta(f,e.slice(o+1,o+a+3)),f=ta(f,[["enter",p,t]]),f=ta(f,Ah(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=ta(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=ta(f,e.slice(c+1)),f=ta(f,[["exit",m,t]]),Ur(e,o,e.length,f),e}function kF(e,t,n){const a=this;let s=a.events.length,o,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return f;function f(x){return o?o._inactive?g(x):(c=a.parser.defined.includes(va(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):n(x)}function m(x){return x===40?e.attempt(vF,p,c?p:g)(x):x===91?e.attempt(bF,p,c?h:g)(x):c?p(x):g(x)}function h(x){return e.attempt(xF,p,g)(x)}function p(x){return t(x)}function g(x){return o._balanced=!0,n(x)}}function jF(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return It(g)?ec(e,o)(g):o(g)}function o(g){return g===41?p(g):s_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return It(g)?ec(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?o_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return It(g)?ec(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function CF(e,t,n){const a=this;return s;function s(f){return l_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function EF(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const NF={name:"labelStartImage",resolveAll:lb.resolveAll,tokenize:_F};function _F(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const TF={name:"labelStartLink",resolveAll:lb.resolveAll,tokenize:AF};function AF(e,t,n){const a=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const xg={name:"lineEnding",tokenize:RF};function RF(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),yt(e,t,"linePrefix")}}const Df={name:"thematicBreak",tokenize:OF};function OF(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),lt(h)?yt(e,f,"whitespace")(h):f(h))}}const br={continuation:{tokenize:IF},exit:PF,name:"list",tokenize:DF},zF={partial:!0,tokenize:UF},MF={partial:!0,tokenize:LF};function DF(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const S=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:Hy(w)){if(a.containerState.type||(a.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Df,n,h)(w):h(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return n(w)}function m(w){return Hy(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check(Uc,a.interrupt?n:p,e.attempt(zF,x,g))}function p(w){return a.containerState.initialBlankLine=!0,o++,x(w)}function g(w){return lt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):n(w)}function x(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function IF(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Uc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,yt(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!lt(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(MF,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,yt(e,e.attempt(br,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function LF(e,t,n){const a=this;return yt(e,s,"listItemIndent",a.containerState.size+1);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function PF(e){e.exit(this.containerState.type)}function UF(e,t,n){const a=this;return yt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const c=a.events[a.events.length-1];return!lt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const ok={name:"setextUnderline",resolveTo:BF,tokenize:$F};function BF(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function $F(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,g;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){g=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),lt(h)?yt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const FF={tokenize:HF};function HF(e){const t=this,n=e.attempt(Uc,a,e.attempt(this.parser.constructs.flowInitial,s,yt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Q$,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const qF={resolveAll:c_()},ZF=u_("string"),GF=u_("text");function u_(e){return{resolveAll:c_(e==="text"?VF:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,c,f);return c;function c(p){return h(p)?o(p):f(p)}function f(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function c_(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function VF(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,c=-1,f=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const QF={42:br,43:br,45:br,48:br,49:br,50:br,51:br,52:br,53:br,54:br,55:br,56:br,57:br,62:n_},KF={91:J$},YF={[-2]:bg,[-1]:bg,32:bg},XF={35:iF,42:Df,45:[ok,Df],60:uF,61:ok,95:Df,96:sk,126:sk},WF={38:a_,92:r_},JF={[-5]:xg,[-4]:xg,[-3]:xg,33:NF,38:a_,42:qy,60:[T$,gF],91:TF,92:[rF,r_],93:lb,95:qy,96:F$},e8={null:[qy,qF]},t8={null:[42,95]},n8={null:[]},r8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:t8,contentInitial:KF,disable:n8,document:QF,flow:XF,flowInitial:YF,insideSpan:e8,string:WF,text:JF},Symbol.toStringTag,{value:"Module"}));function a8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let c=[],f=[];const m={attempt:$(L),check:$(R),consume:N,enter:O,exit:z,interrupt:$(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(Y){return c=ta(c,Y),E(),c[c.length-1]!==null?[]:(U(t,0),h.events=Ah(o,h.events,h),h.events)}function x(Y,ae){return s8(w(Y),ae)}function w(Y){return i8(c,Y)}function S(){const{_bufferIndex:Y,_index:ae,line:xe,column:J,offset:X}=a;return{_bufferIndex:Y,_index:ae,line:xe,column:J,offset:X}}function k(Y){s[Y.line]=Y.column,D()}function E(){let Y;for(;a._index<c.length;){const ae=c[a._index];if(typeof ae=="string")for(Y=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Y&&a._bufferIndex<ae.length;)C(ae.charCodeAt(a._bufferIndex));else C(ae)}}function C(Y){p=p(Y)}function N(Y){Fe(Y)?(a.line++,a.column=1,a.offset+=Y===-3?2:1,D()):Y!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=Y}function O(Y,ae){const xe=ae||{};return xe.type=Y,xe.start=S(),h.events.push(["enter",xe,h]),f.push(xe),xe}function z(Y){const ae=f.pop();return ae.end=S(),h.events.push(["exit",ae,h]),ae}function L(Y,ae){U(Y,ae.from)}function R(Y,ae){ae.restore()}function $(Y,ae){return xe;function xe(J,X,q){let te,ke,Ae,M;return Array.isArray(J)?P(J):"tokenize"in J?P([J]):I(J);function I(ue){return je;function je(we){const pe=we!==null&&ue[we],De=we!==null&&ue.null,Ue=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(De)?De:De?[De]:[]];return P(Ue)(we)}}function P(ue){return te=ue,ke=0,ue.length===0?q:_(ue[ke])}function _(ue){return je;function je(we){return M=V(),Ae=ue,ue.partial||(h.currentConstruct=ue),ue.name&&h.parser.constructs.disable.null.includes(ue.name)?Q():ue.tokenize.call(ae?Object.assign(Object.create(h),ae):h,m,Z,Q)(we)}}function Z(ue){return Y(Ae,M),X}function Q(ue){return M.restore(),++ke<te.length?_(te[ke]):q}}}function U(Y,ae){Y.resolveAll&&!o.includes(Y)&&o.push(Y),Y.resolve&&Ur(h.events,ae,h.events.length-ae,Y.resolve(h.events.slice(ae),h)),Y.resolveTo&&(h.events=Y.resolveTo(h.events,h))}function V(){const Y=S(),ae=h.previous,xe=h.currentConstruct,J=h.events.length,X=Array.from(f);return{from:J,restore:q};function q(){a=Y,h.previous=ae,h.currentConstruct=xe,h.events.length=J,f=X,D()}}function D(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function i8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,o)];else{if(c=e.slice(n,s),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}o>0&&c.push(e[s].slice(0,o))}return c}function s8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
374
- `;break}case-3:{c=`\r
375
- `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(o)}s=o===-2,a.push(c)}return a.join("")}function l8(e){const a={constructs:e_([r8,...(e||{}).extensions||[]]),content:s(S$),defined:[],document:s(j$),flow:s(FF),lazy:{},string:s(ZF),text:s(GF)};return a;function s(o){return c;function c(f){return a8(a,o,f)}}}function o8(e){for(;!i_(e););return e}const uk=/[\0\t\n\r]/g;function u8(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,x,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(uk.lastIndex=g,h=uk.exec(o),x=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(x),!h){t=o.slice(g);break}if(w===10&&g===x&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<x&&(m.push(o.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=x+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const c8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function d8(e){return e.replace(c8,f8)}function f8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return t_(n.slice(o?2:1),o?16:10)}return sb(n)||e}const d_={}.hasOwnProperty;function h8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),m8(n)(o8(l8(n).document().write(u8()(e,t,!0))))}function m8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ft),autolinkProtocol:V,autolinkEmail:V,atxHeading:o(se),blockQuote:o(De),characterEscape:V,characterReference:V,codeFenced:o(Ue),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ue,c),codeText:o(dt,c),codeTextData:V,data:V,codeFlowValue:V,definition:o(ot),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(re),hardBreakEscape:o(ge),hardBreakTrailing:o(ge),htmlFlow:o(Le,c),htmlFlowData:V,htmlText:o(Le,c),htmlTextData:V,image:o(zt),label:c,link:o(Ft),listItem:o(fr),listItemValue:x,listOrdered:o(Ln,g),listUnordered:o(Ln),paragraph:o(hi),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(se),strong:o(mi),thematicBreak:o(ua)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:pe,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ue,characterReference:je,codeFenced:m(E),codeFencedFence:k,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:m(C),codeText:m(X),codeTextData:D,data:D,definition:m(),definitionDestinationString:z,definitionLabelString:N,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(ae),hardBreakTrailing:m(ae),htmlFlow:m(xe),htmlFlowData:D,htmlText:m(J),htmlTextData:D,image:m(te),label:Ae,labelText:ke,lineEnding:Y,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Z,resourceDestinationString:M,resourceTitleString:I,resource:P,setextHeading:m(U),setextHeadingLineSequence:$,setextHeadingText:R,strong:m(),thematicBreak:m()}};f_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(oe){let ye={type:"root",children:[]};const $e={stack:[ye],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Ve=[];let nt=-1;for(;++nt<oe.length;)if(oe[nt][1].type==="listOrdered"||oe[nt][1].type==="listUnordered")if(oe[nt][0]==="enter")Ve.push(nt);else{const un=Ve.pop();nt=s(oe,un,nt)}for(nt=-1;++nt<oe.length;){const un=t[oe[nt][0]];d_.call(un,oe[nt][1].type)&&un[oe[nt][1].type].call(Object.assign({sliceSerialize:oe[nt][2].sliceSerialize},$e),oe[nt][1])}if($e.tokenStack.length>0){const un=$e.tokenStack[$e.tokenStack.length-1];(un[1]||ck).call($e,void 0,un[0])}for(ye.position={start:Fi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Fi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<t.transforms.length;)ye=t.transforms[nt](ye)||ye;return ye}function s(oe,ye,$e){let Ve=ye-1,nt=-1,un=!1,tr,Ht,Lt,Tt;for(;++Ve<=$e;){const at=oe[Ve];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?nt++:nt--,Tt=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(tr&&!Tt&&!nt&&!Lt&&(Lt=Ve),Tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Tt=void 0}if(!nt&&at[0]==="enter"&&at[1].type==="listItemPrefix"||nt===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(tr){let nr=Ve;for(Ht=void 0;nr--;){const Rn=oe[nr];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;Ht&&(oe[Ht][1].type="lineEndingBlank",un=!0),Rn[1].type="lineEnding",Ht=nr}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}Lt&&(!Ht||Lt<Ht)&&(tr._spread=!0),tr.end=Object.assign({},Ht?oe[Ht][1].start:at[1].end),oe.splice(Ht||Ve,0,["exit",tr,at[2]]),Ve++,$e++}if(at[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};tr=nr,oe.splice(Ve,0,["enter",nr,at[2]]),Ve++,$e++,Lt=void 0,Tt=!0}}}return oe[ye][1]._spread=un,$e}function o(oe,ye){return $e;function $e(Ve){f.call(this,oe(Ve),Ve),ye&&ye.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,ye,$e){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ye,$e||void 0]),oe.position={start:Fi(ye.start),end:void 0}}function m(oe){return ye;function ye($e){oe&&oe.call(this,$e),h.call(this,$e)}}function h(oe,ye){const $e=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(ye?ye.call(this,oe,Ve[0]):(Ve[1]||ck).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Ju({start:oe.start,end:oe.end})+"): it’s not open");$e.position.end=Fi(oe.end)}function p(){return ib(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(oe){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=oe}function S(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=oe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe.replace(/(\r?\n|\r)$/g,"")}function N(oe){const ye=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ye,$e.identifier=va(this.sliceSerialize(oe)).toLowerCase()}function O(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.title=oe}function z(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.url=oe}function L(oe){const ye=this.stack[this.stack.length-1];if(!ye.depth){const $e=this.sliceSerialize(oe).length;ye.depth=$e}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function $(oe){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function V(oe){const $e=this.stack[this.stack.length-1].children;let Ve=$e[$e.length-1];(!Ve||Ve.type!=="text")&&(Ve=on(),Ve.position={start:Fi(oe.start),end:void 0},$e.push(Ve)),this.stack.push(Ve)}function D(oe){const ye=this.stack.pop();ye.value+=this.sliceSerialize(oe),ye.position.end=Fi(oe.end)}function Y(oe){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const $e=ye.children[ye.children.length-1];$e.position.end=Fi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(V.call(this,oe),D.call(this,oe))}function ae(){this.data.atHardBreak=!0}function xe(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function J(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function X(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function q(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ye,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function te(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ye,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ke(oe){const ye=this.sliceSerialize(oe),$e=this.stack[this.stack.length-2];$e.label=d8(ye),$e.identifier=va(ye).toLowerCase()}function Ae(){const oe=this.stack[this.stack.length-1],ye=this.resume(),$e=this.stack[this.stack.length-1];if(this.data.inReference=!0,$e.type==="link"){const Ve=oe.children;$e.children=Ve}else $e.alt=ye}function M(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.url=oe}function I(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.title=oe}function P(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function Z(oe){const ye=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ye,$e.identifier=va(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function Q(oe){this.data.characterReferenceType=oe.type}function ue(oe){const ye=this.sliceSerialize(oe),$e=this.data.characterReferenceType;let Ve;$e?(Ve=t_(ye,$e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=sb(ye);const nt=this.stack[this.stack.length-1];nt.value+=Ve}function je(oe){const ye=this.stack.pop();ye.position.end=Fi(oe.end)}function we(oe){D.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(oe)}function pe(oe){D.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(oe)}function De(){return{type:"blockquote",children:[]}}function Ue(){return{type:"code",lang:null,meta:null,value:""}}function dt(){return{type:"inlineCode",value:""}}function ot(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function re(){return{type:"emphasis",children:[]}}function se(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function Le(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function Ft(){return{type:"link",title:null,url:"",children:[]}}function Ln(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function fr(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function hi(){return{type:"paragraph",children:[]}}function mi(){return{type:"strong",children:[]}}function on(){return{type:"text",value:""}}function ua(){return{type:"thematicBreak"}}}function Fi(e){return{line:e.line,column:e.column,offset:e.offset}}function f_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?f_(e,a):p8(e,a)}}function p8(e,t){let n;for(n in t)if(d_.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function ck(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ju({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is still open")}function g8(e){const t=this;t.parser=n;function n(a){return h8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function y8(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function v8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
376
- `}]}function b8(e,t){const n=t.value?t.value+`
377
- `:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function x8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function S8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=Ao(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function k8(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function h_(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const c=s[s.length-1];return c&&c.type==="text"?c.value+=a:s.push({type:"text",value:a}),s}function C8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return h_(e,t);const s={src:Ao(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function E8(e,t){const n={src:Ao(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function N8(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function _8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return h_(e,t);const s={href:Ao(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function T8(e,t){const n={href:Ao(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function A8(e,t,n){const a=e.all(t),s=n?R8(n):m_(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
378
- `}),p.type==="element"&&p.tagName==="p"&&!s?c.push(...p.children):c.push(p)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
379
- `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function R8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=m_(n[a])}return t}function m_(e){const t=e.spread;return t??e.children.length>1}function O8(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const c=a[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function z8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function D8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function I8(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=tb(t.children[1]),m=VN(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),s.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function L8(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),h.push(S)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function P8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const dk=9,fk=32;function U8(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(hk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(hk(t.slice(s),s>0,!1)),o.join("")}function hk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===dk||o===fk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===dk||o===fk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function B8(e,t){const n={type:"text",value:U8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const F8={blockquote:y8,break:v8,code:b8,delete:x8,emphasis:w8,footnoteReference:S8,heading:k8,html:j8,imageReference:C8,image:E8,inlineCode:N8,linkReference:_8,link:T8,listItem:A8,list:O8,paragraph:z8,root:M8,strong:D8,table:I8,tableCell:P8,tableRow:L8,text:B8,thematicBreak:$8,toml:bf,yaml:bf,definition:bf,footnoteDefinition:bf};function bf(){}const p_=-1,Rh=0,tc=1,Wf=2,ob=3,ub=4,cb=5,db=6,g_=7,y_=8,mk=typeof self=="object"?self:globalThis,H8=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),a=s=>{if(e.has(s))return e.get(s);const[o,c]=t[s];switch(o){case Rh:case p_:return n(c,s);case tc:{const f=n([],s);for(const m of c)f.push(a(m));return f}case Wf:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case ob:return n(new Date(c),s);case ub:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case cb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case db:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case g_:{const{name:f,message:m}=c;return n(new mk[f](m),s)}case y_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new mk[o](c),s)};return a},pk=e=>H8(new Map,e)(0),Hl="",{toString:q8}={},{keys:Z8}=Object,Uu=e=>{const t=typeof e;if(t!=="object"||!e)return[Rh,t];const n=q8.call(e).slice(8,-1);switch(n){case"Array":return[tc,Hl];case"Object":return[Wf,Hl];case"Date":return[ob,Hl];case"RegExp":return[ub,Hl];case"Map":return[cb,Hl];case"Set":return[db,Hl];case"DataView":return[tc,n]}return n.includes("Array")?[tc,n]:n.includes("Error")?[g_,n]:[Wf,n]},xf=([e,t])=>e===Rh&&(t==="function"||t==="symbol"),G8=(e,t,n,a)=>{const s=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},o=c=>{if(n.has(c))return n.get(c);let[f,m]=Uu(c);switch(f){case Rh:{let p=c;switch(m){case"bigint":f=y_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([p_],c)}return s([f,p],c)}case tc:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),s([m,[...x]],c)}const p=[],g=s([f,p],c);for(const x of c)p.push(o(x));return g}case Wf:{if(m)switch(m){case"BigInt":return s([m,c.toString()],c);case"Boolean":case"Number":case"String":return s([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],g=s([f,p],c);for(const x of Z8(c))(e||!xf(Uu(c[x])))&&p.push([o(x),o(c[x])]);return g}case ob:return s([f,c.toISOString()],c);case ub:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case cb:{const p=[],g=s([f,p],c);for(const[x,w]of c)(e||!(xf(Uu(x))||xf(Uu(w))))&&p.push([o(x),o(w)]);return g}case db:{const p=[],g=s([f,p],c);for(const x of c)(e||!xf(Uu(x)))&&p.push(o(x));return g}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},gk=(e,{json:t,lossy:n}={})=>{const a=[];return G8(!(t||n),!!t,new Map,a)(e),a},Jf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pk(gk(e,t)):structuredClone(e):(e,t)=>pk(gk(e,t));function V8(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Q8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function K8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||V8,a=e.options.footnoteBackLabel||Q8,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const p=e.all(h),g=String(h.identifier).toUpperCase(),x=Ao(g.toLowerCase());let w=0;const S=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++w<=k;){S.length>0&&S.push({type:"text",value:" "});let N=typeof n=="string"?n:n(m,w);typeof N=="string"&&(N={type:"text",value:N}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const E=p[p.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const N=E.children[E.children.length-1];N&&N.type==="text"?N.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else p.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(p,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Jf(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
380
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
381
- `}]}}const Oh=(function(e){if(e==null)return J8;if(typeof e=="function")return zh(e);if(typeof e=="object")return Array.isArray(e)?Y8(e):X8(e);if(typeof e=="string")return W8(e);throw new Error("Expected function, string, or object as test")});function Y8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Oh(e[n]);return zh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function X8(e){const t=e;return zh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function W8(e){return zh(t);function t(n){return n&&n.type===e}}function zh(e){return t;function t(n,a,s){return!!(eH(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function J8(){return!0}function eH(e){return e!==null&&typeof e=="object"&&"type"in e}const v_=[],tH=!0,Zy=!1,nH="skip";function b_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Oh(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,p){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=v_,S,k,E;if((!t||o(m,h,p[p.length-1]||void 0))&&(w=rH(n(m,p)),w[0]===Zy))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==nH)for(k=(a?C.children.length:-1)+c,E=p.concat(C);k>-1&&k<C.children.length;){const N=C.children[k];if(S=f(N,k,E)(),S[0]===Zy)return S;k=typeof S[1]=="number"?S[1]:k+c}}return w}}}function rH(e){return Array.isArray(e)?e:typeof e=="number"?[tH,e]:e==null?v_:[e]}function fb(e,t,n,a){let s,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,s=n):(o=t,c=n,s=a),b_(e,o,f,s);function f(m,h){const p=h[h.length-1],g=p?p.children.indexOf(m):void 0;return c(m,g,p)}}const Gy={}.hasOwnProperty,aH={};function iH(e,t){const n=t||aH,a=new Map,s=new Map,o=new Map,c={...F8,...n.handlers},f={all:h,applyData:lH,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:sH,wrap:uH};return fb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,x=String(p.identifier).toUpperCase();g.has(x)||g.set(x,p)}}),f;function m(p,g){const x=p.type,w=f.handlers[x];if(Gy.call(f.handlers,x)&&w)return w(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in p){const{children:k,...E}=p,C=Jf(E);return C.children=f.all(p),C}return Jf(p)}return(f.options.unknownHandler||oH)(f,p,g)}function h(p){const g=[];if("children"in p){const x=p.children;let w=-1;for(;++w<x.length;){const S=f.one(x[w],p);if(S){if(w&&x[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=yk(S.value)),!Array.isArray(S)&&S.type==="element")){const k=S.children[0];k&&k.type==="text"&&(k.value=yk(k.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function sH(e,t){e.position&&(t.position=Q9(e))}function lH(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const c="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,Jf(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function oH(e,t){const n=t.data||{},a="value"in t&&!(Gy.call(n,"hProperties")||Gy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function uH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
382
- `});++a<e.length;)a&&n.push({type:"text",value:`
383
- `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
384
- `}),n}function yk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vk(e,t){const n=iH(e,t),a=n.one(e,void 0),s=K8(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
385
- `},s),o}function cH(e,t){return e&&"run"in e?async function(n,a){const s=vk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return vk(n,{file:a,...e||t})}}function bk(e){if(e)throw e}var wg,xk;function dH(){if(xk)return wg;xk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var x;for(x in h);return typeof x>"u"||e.call(h,x)},c=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return wg=function m(){var h,p,g,x,w,S,k=arguments[0],E=1,C=arguments.length,N=!1;for(typeof k=="boolean"&&(N=k,k=arguments[1]||{},E=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});E<C;++E)if(h=arguments[E],h!=null)for(p in h)g=f(k,p),x=f(h,p),k!==x&&(N&&x&&(o(x)||(w=s(x)))?(w?(w=!1,S=g&&s(g)?g:[]):S=g&&o(g)?g:{},c(k,{name:p,newValue:m(N,S,x)})):typeof x<"u"&&c(k,{name:p,newValue:x}));return k},wg}var fH=dH();const Sg=rh(fH);function Vy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function hH(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...s);function f(m,...h){const p=e[++o];let g=-1;if(m){c(m);return}for(;++g<s.length;)(h[g]===null||h[g]===void 0)&&(h[g]=s[g]);s=h,p?mH(p,f)(...h):c(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function mH(e,t){let n;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(s);try{m=e.apply(this,c)}catch(h){const p=h;if(f&&n)throw p;return s(p)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(c,...f){n||(n=!0,t(c,...f))}function o(c){s(null,c)}}const Ea={basename:pH,dirname:gH,extname:yH,join:vH,sep:"/"};function pH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bc(e);let n=0,a=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,f=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else c<0&&(o=!0,c=s+1),f>-1&&(e.codePointAt(s)===t.codePointAt(f--)?f<0&&(a=s):(f=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function gH(e){if(Bc(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function yH(e){Bc(e);let t=e.length,n=-1,a=0,s=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function vH(...e){let t=-1,n;for(;++t<e.length;)Bc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":bH(n)}function bH(e){Bc(e);const t=e.codePointAt(0)===47;let n=xH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xH(e,t){let n="",a=0,s=-1,o=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(s===c-1||o===1))if(s!==c-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=c,o=0;continue}}else if(n.length>0){n="",a=0,s=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),a=c-s-1;s=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function Bc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wH={cwd:SH};function SH(){return"/"}function Qy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kH(e){if(typeof e=="string")e=new URL(e);else if(!Qy(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return jH(e)}function jH(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const kg=["history","path","basename","stem","extname","dirname"];class x_{constructor(t){let n;t?Qy(t)?n={path:t}:typeof t=="string"||CH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<kg.length;){const o=kg[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)kg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ea.basename(this.path):void 0}set basename(t){Cg(t,"basename"),jg(t,"basename"),this.path=Ea.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ea.dirname(this.path):void 0}set dirname(t){wk(this.basename,"dirname"),this.path=Ea.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ea.extname(this.path):void 0}set extname(t){if(jg(t,"extname"),wk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ea.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Qy(t)&&(t=kH(t)),Cg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ea.basename(this.path,this.extname):void 0}set stem(t){Cg(t,"stem"),jg(t,"stem"),this.path=Ea.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new er(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function jg(e,t){if(e&&e.includes(Ea.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ea.sep+"`")}function Cg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function CH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const EH=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),NH={}.hasOwnProperty;class hb extends EH{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=hH()}copy(){const t=new hb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Sg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_g("data",this.frozen),this.namespace[t]=n,this):NH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_g("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=wf(t),a=this.parser||this.Parser;return Eg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Eg("process",this.parser||this.Parser),Ng("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=wf(t),m=a.parse(f);a.run(m,f,function(p,g,x){if(p||!g||!x)return h(p);const w=g,S=a.stringify(w,x);AH(S)?x.value=S:x.result=S,h(p,x)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Eg("processSync",this.parser||this.Parser),Ng("processSync",this.compiler||this.Compiler),this.process(t,s),kk("processSync","process",n),a;function s(o,c){n=!0,bk(o),a=c}}run(t,n,a){Sk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=wf(n);s.run(t,m,h);function h(p,g,x){const w=g||t;p?f(p):c?c(w):a(void 0,w,x)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),kk("runSync","run",a),s;function o(c,f){bk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=wf(n),s=this.compiler||this.Compiler;return Ng("stringify",s),Sk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(_g("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...g]=h;m(p,g)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=Sg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,x=-1;for(;++g<a.length;)if(a[g][0]===h){x=g;break}if(x===-1)a.push([h,...p]);else if(p.length>0){let[w,...S]=p;const k=a[x][1];Vy(k)&&Vy(w)&&(w=Sg(!0,k,w)),a[x]=[h,w,...S]}}}}const _H=new hb().freeze();function Eg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _g(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sk(e){if(!Vy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function wf(e){return TH(e)?e:new x_(e)}function TH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function AH(e){return typeof e=="string"||RH(e)}function RH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jk=[],Ck={allowDangerousHtml:!0},zH=/^(https?|ircs?|mailto|xmpp)$/i,MH=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function DH(e){const t=IH(e),n=LH(e);return PH(t.runSync(t.parse(n),n),e)}function IH(e){const t=e.rehypePlugins||jk,n=e.remarkPlugins||jk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ck}:Ck;return _H().use(g8).use(n).use(cH,a).use(t)}function LH(e){const t=e.children||"",n=new x_;return typeof t=="string"&&(n.value=t),n}function PH(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||UH;for(const p of MH)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+OH+p.id,void 0);return fb(e,h),J9(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,x){if(p.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let w;for(w in vg)if(Object.hasOwn(vg,w)&&Object.hasOwn(p.properties,w)){const S=p.properties[w],k=vg[w];(k===null||k.includes(p.tagName))&&(p.properties[w]=m(String(S||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(p,g,x)),w&&x&&typeof g=="number")return f&&p.children?x.children.splice(g,1,...p.children):x.children.splice(g,1),g}}}function UH(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||zH.test(e.slice(0,t))?e:""}function BH(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function w_(e,t,n){const s=Oh((n||{}).ignore||[]),o=$H(t);let c=-1;for(;++c<o.length;)b_(e,"text",f);function f(h,p){let g=-1,x;for(;++g<p.length;){const w=p[g],S=x?x.children:void 0;if(s(w,S?S.indexOf(w):void 0,x))return;x=w}if(x)return m(h,p)}function m(h,p){const g=p[p.length-1],x=o[c][0],w=o[c][1];let S=0;const E=g.children.indexOf(h);let C=!1,N=[];x.lastIndex=0;let O=x.exec(h.value);for(;O;){const z=O.index,L={index:O.index,input:O.input,stack:[...p,h]};let R=w(...O,L);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?x.lastIndex=z+1:(S!==z&&N.push({type:"text",value:h.value.slice(S,z)}),Array.isArray(R)?N.push(...R):R&&N.push(R),S=z+O[0].length,C=!0),!x.global)break;O=x.exec(h.value)}return C?(S<h.value.length&&N.push({type:"text",value:h.value.slice(S)}),g.children.splice(E,1,...N)):N=[h],E+N.length}}function $H(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([FH(s[0]),HH(s[1])])}return t}function FH(e){return typeof e=="string"?new RegExp(BH(e),"g"):e}function HH(e){return typeof e=="function"?e:function(){return e}}function qH(e){w_(e,[/\r?\n|\r/g,ZH])}function ZH(){return{type:"break"}}function GH(){return function(e){qH(e)}}function Ek(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Tg="phrasing",Ag=["autolink","link","image","label"];function VH(){return{transforms:[eq],enter:{literalAutolink:KH,literalAutolinkEmail:Rg,literalAutolinkHttp:Rg,literalAutolinkWww:Rg},exit:{literalAutolink:JH,literalAutolinkEmail:WH,literalAutolinkHttp:YH,literalAutolinkWww:XH}}}function QH(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Ag},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Ag},{character:":",before:"[ps]",after:"\\/",inConstruct:Tg,notInConstruct:Ag}]}}function KH(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Rg(e){this.config.enter.autolinkProtocol.call(this,e)}function YH(e){this.config.exit.autolinkProtocol.call(this,e)}function XH(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function WH(e){this.config.exit.autolinkEmail.call(this,e)}function JH(e){this.exit(e)}function eq(e){w_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,tq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),nq]],{ignore:["link","linkReference"]})}function tq(e,t,n,a,s){let o="";if(!S_(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!rq(n)))return!1;const c=aq(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function nq(e,t,n,a){return!S_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function rq(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function aq(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=Ek(e,"(");let o=Ek(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function S_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ys(n)||Th(n))&&(!t||n!==47)}k_.peek=hq;function iq(){this.buffer()}function sq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function lq(){this.buffer()}function oq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function uq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cq(e){this.exit(e)}function dq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fq(e){this.exit(e)}function hq(){return"["}function k_(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=s.move("]"),o}function mq(){return{enter:{gfmFootnoteCallString:iq,gfmFootnoteCall:sq,gfmFootnoteDefinitionLabelString:lq,gfmFootnoteDefinition:oq},exit:{gfmFootnoteCallString:uq,gfmFootnoteCall:cq,gfmFootnoteDefinitionLabelString:dq,gfmFootnoteDefinition:fq}}}function pq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:k_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,c){const f=o.createTracker(c);let m=f.move("[^");const h=o.enter("footnoteDefinition"),p=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
386
- `:" ")+o.indentLines(o.containerFlow(a,f.current()),t?j_:gq))),h(),m}}function gq(e,t,n){return t===0?e:j_(e,t,n)}function j_(e,t,n){return(n?"":" ")+e}const yq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];C_.peek=Sq;function vq(){return{canContainEols:["delete"],enter:{strikethrough:xq},exit:{strikethrough:wq}}}function bq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yq}],handlers:{delete:C_}}}function xq(e){this.enter({type:"delete",children:[]},e)}function wq(e){this.exit(e)}function C_(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),o(),c}function Sq(){return"~"}function kq(e){return e.length}function jq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||kq,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const k=[],E=[];let C=-1;for(e[p].length>h&&(h=e[p].length);++C<e[p].length;){const N=Cq(e[p][C]);if(n.alignDelimiters!==!1){const O=s(N);E[C]=O,(m[C]===void 0||O>m[C])&&(m[C]=O)}k.push(N)}c[p]=k,f[p]=E}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Nk(a[g]);else{const k=Nk(a);for(;++g<h;)o[g]=k}g=-1;const x=[],w=[];for(;++g<h;){const k=o[g];let E="",C="";k===99?(E=":",C=":"):k===108?E=":":k===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,m[g]-E.length-C.length);const O=E+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=E.length+N+C.length,N>m[g]&&(m[g]=N),w[g]=N),x[g]=O}c.splice(1,0,x),f.splice(1,0,w),p=-1;const S=[];for(;++p<c.length;){const k=c[p],E=f[p];g=-1;const C=[];for(;++g<h;){const N=k[g]||"";let O="",z="";if(n.alignDelimiters!==!1){const L=m[g]-(E[g]||0),R=o[g];R===114?O=" ".repeat(L):R===99?L%2?(O=" ".repeat(L/2+.5),z=" ".repeat(L/2-.5)):(O=" ".repeat(L/2),z=O):z=" ".repeat(L)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(O),C.push(N),n.alignDelimiters!==!1&&C.push(z),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}S.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
387
- `)}function Cq(e){return e==null?"":String(e)}function Nk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Eq(e,t,n,a){const s=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),Nq);return s(),c}function Nq(e,t,n){return">"+(n?"":" ")+e}function _q(e,t){return _k(e,t.inConstruct,!0)&&!_k(e,t.notInConstruct,!1)}function _k(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Tk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
388
- `&&_q(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
389
- `}function Tq(e,t){const n=String(e);let a=n.indexOf(t),s=a,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++o>c&&(c=o):o=1,s=a+t.length,a=n.indexOf(t,s);return c}function Aq(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Rq(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Oq(e,t,n,a){const s=Rq(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(Aq(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(o,zq);return g(),x}const f=n.createTracker(a),m=s.repeat(Math.max(Tq(o,s)+1,3)),h=n.enter("codeFenced");let p=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${c}`);p+=f.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${c}`);p+=f.move(" "),p+=f.move(n.safe(e.meta,{before:p,after:`
390
- `,encode:["`"],...f.current()})),g()}return p+=f.move(`
391
- `),o&&(p+=f.move(o+`
392
- `)),p+=f.move(m),h(),p}function zq(e,t,n){return(n?"":" ")+e}function mb(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Mq(e,t,n,a){const s=mb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
393
- `,...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),c(),h}function Dq(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function pc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function eh(e,t,n){const a=wo(e),s=wo(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}E_.peek=Iq;function E_(e,t,n,a){const s=Dq(n),o=n.enter("emphasis"),c=n.createTracker(a),f=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=eh(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=pc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=eh(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+pc(g));const w=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function Iq(e,t,n){return n.options.emphasis||"*"}function Lq(e,t){let n=!1;return fb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Zy}),!!((!e.depth||e.depth<3)&&ib(e)&&(t.options.setext||n))}function Pq(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(Lq(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
394
- `,after:`
395
- `});return g(),p(),x+`
396
- `+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
397
- `))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
398
- `,...o.current()});return/^[\t ]/.test(h)&&(h=pc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}N_.peek=Uq;function N_(e){return e.value||""}function Uq(){return"<"}__.peek=Bq;function __(e,t,n,a){const s=mb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),h+=m.move(")"),c(),h}function Bq(){return"!"}T_.peek=$q;function T_(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function $q(){return"!"}A_.peek=Fq;function A_(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function Fq(){return"`"}function R_(e,t){const n=ib(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}O_.peek=Hq;function O_(e,t,n,a){const s=mb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(R_(e,n)){const p=n.stack;n.stack=[],f=n.enter("autolink");let g=c.move("<");return g+=c.move(n.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),n.stack=p,g}f=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),m()),h+=c.move(")"),f(),h}function Hq(e,t,n){return R_(e,n)?"<":"["}z_.peek=qq;function z_(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function qq(){return"["}function pb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Zq(e){const t=pb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Gq(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function M_(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Vq(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?Gq(n):pb(n);const f=e.ordered?c==="."?")":".":Zq(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),M_(n)===c&&p){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=o,s(),h}function Qq(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Kq(e,t,n,a){const s=Qq(n);let o=n.bulletCurrent||pb(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(c-o.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),p);return m(),h;function p(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?o:o+" ".repeat(c-o.length))+g}}function Yq(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const Xq=Oh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Wq(e,t,n,a){return(e.children.some(function(c){return Xq(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function Jq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}D_.peek=e7;function D_(e,t,n,a){const s=Jq(n),o=n.enter("strong"),c=n.createTracker(a),f=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=eh(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=pc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=eh(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+pc(g));const w=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function e7(e,t,n){return n.options.strong||"*"}function t7(e,t,n,a){return n.safe(e.value,a)}function n7(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function r7(e,t,n){const a=(M_(n)+(n.options.ruleSpaces?" ":"")).repeat(n7(n));return n.options.ruleSpaces?a.slice(0,-1):a}const I_={blockquote:Eq,break:Tk,code:Oq,definition:Mq,emphasis:E_,hardBreak:Tk,heading:Pq,html:N_,image:__,imageReference:T_,inlineCode:A_,link:O_,linkReference:z_,list:Vq,listItem:Kq,paragraph:Yq,root:Wq,strong:D_,text:t7,thematicBreak:r7};function a7(){return{enter:{table:i7,tableData:Ak,tableHeader:Ak,tableRow:l7},exit:{codeText:o7,table:s7,tableData:Og,tableHeader:Og,tableRow:Og}}}function i7(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function s7(e){this.exit(e),this.data.inTable=void 0}function l7(e){this.enter({type:"tableRow",children:[]},e)}function Og(e){this.exit(e)}function Ak(e){this.enter({type:"tableCell",children:[]},e)}function o7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,u7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function u7(e,t){return t==="|"?t:e}function c7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
399
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,S,k,E){return h(p(w,k,E),w.align)}function f(w,S,k,E){const C=g(w,k,E),N=h([C]);return N.slice(0,N.indexOf(`
400
- `))}function m(w,S,k,E){const C=k.enter("tableCell"),N=k.enter("phrasing"),O=k.containerPhrasing(w,{...E,before:o,after:o});return N(),C(),O}function h(w,S){return jq(w,{align:S,alignDelimiters:a,padding:n,stringLength:s})}function p(w,S,k){const E=w.children;let C=-1;const N=[],O=S.enter("table");for(;++C<E.length;)N[C]=g(E[C],S,k);return O(),N}function g(w,S,k){const E=w.children;let C=-1;const N=[],O=S.enter("tableRow");for(;++C<E.length;)N[C]=m(E[C],w,S,k);return O(),N}function x(w,S,k){let E=I_.inlineCode(w,S,k);return k.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function d7(){return{exit:{taskListCheckValueChecked:Rk,taskListCheckValueUnchecked:Rk,paragraph:h7}}}function f7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:m7}}}function Rk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function h7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,c;for(;++o<s.length;){const f=s[o];if(f.type==="paragraph"){c=f;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function m7(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(c);let m=I_.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+c}}function p7(){return[VH(),mq(),vq(),a7(),d7()]}function g7(e){return{extensions:[QH(),pq(e),bq(),c7(e),f7()]}}const y7={tokenize:k7,partial:!0},L_={tokenize:j7,partial:!0},P_={tokenize:C7,partial:!0},U_={tokenize:E7,partial:!0},v7={tokenize:N7,partial:!0},B_={name:"wwwAutolink",tokenize:w7,previous:F_},$_={name:"protocolAutolink",tokenize:S7,previous:H_},fi={name:"emailAutolink",tokenize:x7,previous:q_},Oa={};function b7(){return{text:Oa}}let Ms=48;for(;Ms<123;)Oa[Ms]=fi,Ms++,Ms===58?Ms=65:Ms===91&&(Ms=97);Oa[43]=fi;Oa[45]=fi;Oa[46]=fi;Oa[95]=fi;Oa[72]=[fi,$_];Oa[104]=[fi,$_];Oa[87]=[fi,B_];Oa[119]=[fi,B_];function x7(e,t,n){const a=this;let s,o;return c;function c(g){return!Ky(g)||!q_.call(a,a.previous)||gb(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Ky(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(v7,p,h)(g):g===45||g===95||Xn(g)?(o=!0,e.consume(g),m):p(g)}function h(g){return e.consume(g),s=!0,m}function p(g){return o&&s&&ur(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function w7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!F_.call(a,a.previous)||gb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(y7,e.attempt(L_,e.attempt(P_,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function S7(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&H_.call(a,a.previous)&&!gb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(ur(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=s.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||Xf(g)||It(g)||Ys(g)||Th(g)?n(g):e.attempt(L_,e.attempt(P_,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function k7(e,t,n){let a=0;return s;function s(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),s):c===46&&a===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function j7(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(U_,m,f)(h):h===null||It(h)||Ys(h)||h!==45&&Th(h)?m(h):(o=!0,e.consume(h),c)}function f(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),c}function m(h){return s||a||!o?n(h):t(h)}}function C7(e,t){let n=0,a=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&a<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(U_,t,o)(c):c===null||It(c)||Ys(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function E7(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||It(f)||Ys(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||It(f)||Ys(f)?t(f):a(f)}function o(f){return ur(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):ur(f)?(e.consume(f),c):n(f)}}function N7(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Xn(o)?n(o):t(o)}}function F_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||It(e)}function H_(e){return!ur(e)}function q_(e){return!(e===47||Ky(e))}function Ky(e){return e===43||e===45||e===46||e===95||Xn(e)}function gb(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const _7={tokenize:I7,partial:!0};function T7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:z7,continuation:{tokenize:M7},exit:D7}},text:{91:{name:"gfmFootnoteCall",tokenize:O7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:A7,resolveTo:R7}}}}function A7(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return n(m);const h=va(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function R7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function O7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||It(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return s.includes(va(a.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return It(g)||(c=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function z7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(S)}function p(S){if(c>999||S===93&&!f||S===null||S===91||It(S))return n(S);if(S===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=va(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return It(S)||(f=!0),c++,e.consume(S),S===92?g:p}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,p):p(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(o)||s.push(o),yt(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function M7(e,t,n){return e.check(Uc,t,e.attempt(_7,t,n))}function D7(e){e.exit("gfmFootnoteDefinition")}function I7(e,t,n){const a=this;return yt(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function L7(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",p,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&Ur(x,x.length,0,Ah(w,c.slice(h+1,m),f)),Ur(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),Ur(c,h-1,m-h+3,x),m=h+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,p=this.events;let g=0;return x;function x(S){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const k=wo(h);if(S===126)return g>1?m(S):(c.consume(S),g++,w);if(g<2&&!n)return m(S);const E=c.exit("strikethroughSequenceTemporary"),C=wo(S);return E._open=!C||C===2&&!!k,E._close=!k||k===2&&!!C,f(S)}}}class P7{constructor(){this.map=[]}add(t,n,a){U7(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const o of s)t.push(o);s=a.pop()}this.map.length=0}}function U7(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function B7(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function $7(){return{flow:{null:{name:"table",tokenize:F7,resolveAll:H7}}}}function F7(e,t,n){const a=this;let s=0,o=0,c;return f;function f(D){let Y=a.events.length-1;for(;Y>-1;){const J=a.events[Y][1].type;if(J==="lineEnding"||J==="linePrefix")Y--;else break}const ae=Y>-1?a.events[Y][1].type:null,xe=ae==="tableHead"||ae==="tableRow"?R:m;return xe===R&&a.parser.lazy[a.now().line]?n(D):xe(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),h(D)}function h(D){return D===124||(c=!0,o+=1),p(D)}function p(D){return D===null?n(D):Fe(D)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):n(D):lt(D)?yt(e,p,"whitespace")(D):(o+=1,c&&(c=!1,s+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),g(D)))}function g(D){return D===null||D===124||It(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?x:g)}function x(D){return D===92||D===124?(e.consume(D),g):g(D)}function w(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(D):(e.enter("tableDelimiterRow"),c=!1,lt(D)?yt(e,S,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?E(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),k):L(D)}function k(D){return lt(D)?yt(e,E,"whitespace")(D):E(D)}function E(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(o+=1,C(D)):D===null||Fe(D)?z(D):L(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),N(D)):L(D)}function N(D){return D===45?(e.consume(D),N):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(D))}function O(D){return lt(D)?yt(e,z,"whitespace")(D):z(D)}function z(D){return D===124?S(D):D===null||Fe(D)?!c||s!==o?L(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):L(D)}function L(D){return n(D)}function R(D){return e.enter("tableRow"),$(D)}function $(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),$):D===null||Fe(D)?(e.exit("tableRow"),t(D)):lt(D)?yt(e,$,"whitespace")(D):(e.enter("data"),U(D))}function U(D){return D===null||D===124||It(D)?(e.exit("data"),$(D)):(e.consume(D),D===92?V:U)}function V(D){return D===92||D===124?(e.consume(D),U):U(D)}}function H7(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,p,g;const x=new P7;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(Ok(x,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",p,t]])),s=S.type==="tableDelimiterRow"?2:p?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=Sf(x,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=Sf(x,t,o,s,void 0,g)),o=c,c=[o[1],n,0,0])):S.type==="tableHead"?(f=!0,m=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=Sf(x,t,o,s,n,g)):c[1]!==0&&(g=Sf(x,t,c,s,n,g)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Ok(x,t,m,h,p),x.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=B7(t.events,n))}return e}function Sf(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Vl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Vl(t.events,n[1]);if(o={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Vl(t.events,n[2]),p=Vl(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),a!==2){const x=t.events[n[2]],w=t.events[n[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,k=n[3]-n[2]-1;e.add(S,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Vl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Ok(e,t,n,a,s){const o=[],c=Vl(t.events,n);s&&(s.end=Object.assign({},c),o.push(["exit",s,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function Vl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const q7={name:"tasklistCheck",tokenize:G7};function Z7(){return{text:{91:q7}}}function G7(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return It(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return Fe(m)?t(m):lt(m)?e.check({tokenize:V7},t,n)(m):n(m)}}function V7(e,t,n){return yt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function Q7(e){return e_([b7(),T7(),L7(e),$7(),Z7()])}const K7={};function Y7(e){const t=this,n=e||K7,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(Q7(n)),o.push(p7()),c.push(g7(n))}function Mh({children:e,className:t}){return l.jsx("div",{className:ze("prose prose-sm max-w-none leading-[1.55] text-[color:inherit]","prose-headings:text-current prose-p:text-current prose-li:text-current prose-strong:text-current prose-em:text-current prose-blockquote:text-current","prose-p:my-2 prose-headings:mt-3 prose-headings:mb-1.5 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:my-2 prose-blockquote:my-2 prose-hr:my-3","prose-a:text-[color:var(--accent)] prose-a:no-underline hover:prose-a:underline","prose-code:text-current prose-code:bg-[color:var(--bg-sunken)] prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:before:content-none prose-code:after:content-none","prose-pre:bg-[color:var(--bg-sunken)] prose-pre:text-current prose-pre:border prose-pre:border-[color:var(--border)]","prose-hr:border-[color:var(--border)]","prose-blockquote:border-l-[color:var(--border-strong)] prose-blockquote:text-[color:var(--fg-2)]","prose-th:border-[color:var(--border)] prose-td:border-[color:var(--border)]",t),children:l.jsx(DH,{remarkPlugins:[Y7,GH],children:e})})}function X7({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=b.useState(!1),f=b.useRef(null),m=e!==t;return b.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),l.jsxs(jn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(la,{children:[l.jsxs(oa,{children:["System prompt append",m&&l.jsx(W7,{})]}),!o&&!s&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(Cv,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Jn,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(ve,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):l.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?l.jsx(Mh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function W7(){return l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})}const Z_={"claude-code":"Claude Code",codex:"Codex"},J7=[Kf.CLAUDE_CODE,Kf.CODEX];function eZ({open:e,onOpenChange:t,agent:n}){const a=mn(),s=n.clientId,o=n.runtimeProvider,[c,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),w=Ye({queryKey:["clients-rebind"],queryFn:ls,enabled:e}).data??[],S=vR({queries:w.map(U=>({queryKey:["client-capabilities",U.id],queryFn:()=>dh(U.id),enabled:e}))}),k=b.useMemo(()=>{const U=new Map;return S.forEach((V,D)=>{const Y=w[D];if(!Y)return;const ae=V.data;ae!=null&&ae.capabilities&&U.set(Y.id,ae.capabilities)}),U},[S,w]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const E=c?k.get(c)??null:null,C=(E==null?void 0:E[m])??null,N=!C||C.state==="missing"||C.state==="error",O=!!c&&(c!==s||m!==o)&&(!N||p),z=m!==o,L=c!==s,R=wt({mutationFn:()=>{if(!c)throw new Error("clientId required");return $I(n.uuid,{clientId:c,runtimeProvider:m,force:N&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),$=R.error instanceof Oc||R.error instanceof Error?R.error.message:null;return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{className:"max-w-lg",children:[l.jsx(Zn,{children:l.jsx(In,{children:"Re-bind agent"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",l.jsx("span",{className:"mono",children:nZ(s,w,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:U=>f(U.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(U=>l.jsx("option",{value:U.id,children:tZ(U)},U.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:J7.map(U=>{const V=(E==null?void 0:E[U])??null,D=!!V&&V.state!=="missing",Y=m===U;return l.jsxs("label",{className:Y?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":D?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[l.jsx("input",{type:"radio",name:"rebind-runtime",checked:Y,onChange:()=>h(U),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:Z_[U]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:aZ(V,U)})]})]},U)})})]}),(L||z)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),z&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),N&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange:U=>g(U.target.checked),className:"mt-0.5"}),l.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),$&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:$})]}),l.jsxs(Cr,{children:[l.jsx(ve,{variant:"outline",onClick:()=>t(!1),disabled:R.isPending,children:"Cancel"}),l.jsx(ve,{onClick:()=>R.mutate(),disabled:!O||R.isPending,children:R.isPending?"Re-binding…":"Re-bind"})]})]})})}function tZ(e){return`${e.hostname??e.id} · ${e.status}`}function nZ(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${Z_[n]}`}const rZ={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function aZ(e,t){if(!e)return"Not reported on this computer.";switch(e.state){case"ok":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, authenticated.`;case"unauthenticated":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, not authenticated. ${rZ[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const iZ={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function sZ(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return l.jsx("div",{className:"sticky bottom-0 z-30 -mx-6 backdrop-blur",style:{padding:"var(--sp-3) var(--sp-6)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderTop:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(Wu,{state:"blocked",size:8}),l.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),l.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>l.jsx("button",{type:"button",onClick:()=>e.onJumpTo(n),className:"text-caption transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",cursor:"pointer"},children:iZ[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&l.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[l.jsx(cr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),l.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&l.jsx(ve,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),l.jsx(ve,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(ve,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(hC,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function nc(e){return`agent-cfg-${e}`}function Bu({anchorId:e,title:t,caption:n,right:a,children:s,className:o,sectionProps:c}){return l.jsxs("section",{id:e,className:ze("space-y-3",o),...c,children:[l.jsxs("div",{className:"flex items-end justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),l.jsx("div",{className:"space-y-3",children:s})]})}function lZ(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const oZ={"claude-code":{name:"Claude Code",caption:"Anthropic's Claude Code runtime. Re-bind via the agent's settings to switch computer or runtime."},codex:{name:"Codex",caption:"OpenAI's Codex CLI runtime. Re-bind via the agent's settings to switch computer or runtime."}};function uZ(e){const t=oZ[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(cZ,{name:t.name,caption:t.caption,locked:!0}),l.jsx(dZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function cZ({name:e,caption:t,locked:n}){return l.jsxs(jn,{children:[l.jsx(la,{children:l.jsxs(oa,{children:["Where it runs",n&&l.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(kv,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),l.jsxs(Jn,{className:"space-y-1 text-body",children:[l.jsxs("div",{className:"inline-flex items-center gap-2",children:[l.jsx(mC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),l.jsx("span",{className:"font-medium",children:e})]}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function dZ(e){const t=!!e.computerLabel;return l.jsxs(jn,{children:[l.jsxs(la,{children:[l.jsx(oa,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[l.jsx(jy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:e.onRebind,children:[l.jsx(jy,{className:"h-3 w-3"}),"Re-bind"]})]}),l.jsx(Jn,{className:"text-body",children:t?l.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"No computer bound. A computer claims this agent on its first WebSocket connect, or you can pick one manually via the button above."})})]})}function fZ(e){return e.isUnclaimed?"Saving: configuration stored; will apply when a computer claims this agent.":e.isOffline?"Saving: configuration stored; will apply when the computer reconnects.":e.activeSessions>0?`Saving: new chats use this immediately; ${e.activeSessions} active chat${e.activeSessions===1?"":"s"} switch on their next message.`:"Saving: new chats use this immediately."}function hZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function mZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function zg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function zk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:mZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Mg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=hZ(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:zk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:zk(f)}}),remove:a=>t(s=>{const c=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:c}})}}function pZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:zg(e.payload.mcpServers,"mcp"),env:zg(e.payload.env,"env"),git:zg(e.payload.gitRepos,"git")}}function gZ(e){const[t,n]=b.useState(null);b.useEffect(()=>{e&&t===null&&n(pZ(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",o=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,f=a.model!==o,m=b.useMemo(()=>{const O=[],z=U=>U.reduce((V,D)=>D.status==="unchanged"?V:V+1,0),L=z(a.mcp),R=z(a.env),$=z(a.git);return c&&O.push("prompt"),f&&O.push("model"),L>0&&O.push("mcp"),R>0&&O.push("env"),$>0&&O.push("git"),{anyDirty:O.length>0,dirtySections:O,counts:{prompt:c?1:0,model:f?1:0,mcp:L,env:R,git:$}}},[a,c,f]),h=b.useCallback(O=>{n(z=>z&&O(z))},[]),p=b.useCallback(O=>h(z=>({...z,promptAppend:O})),[h]),g=b.useCallback(()=>h(O=>({...O,promptAppend:s})),[h,s]),x=b.useCallback(O=>h(z=>({...z,model:O})),[h]),w=b.useCallback(()=>h(O=>({...O,model:o})),[h,o]),S=b.useMemo(()=>Mg("mcp",h),[h]),k=b.useMemo(()=>Mg("env",h),[h]),E=b.useMemo(()=>Mg("git",h),[h]),C=b.useCallback(()=>{n(null)},[]),N=b.useCallback(()=>{if(!t||!e)return{};const O={};c&&(O.prompt={append:t.promptAppend}),f&&(O.model=t.model);const z=m.counts.mcp>0,L=m.counts.env>0,R=m.counts.git>0;return z&&(O.mcpServers=t.mcp.filter($=>$.status!=="deleted").map($=>$.value)),L&&(O.env=t.env.filter($=>$.status!=="deleted").map($=>{const U=$.value;return U.sensitive&&U.value===Vf?{key:U.key,value:Vf,sensitive:!0}:U})),R&&(O.gitRepos=t.git.filter($=>$.status!=="deleted").map($=>$.value)),O},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:p,revertPrompt:g,setModel:x,revertModel:w,addMcp:S.add,updateMcp:S.update,deleteMcp:S.remove,undoDeleteMcp:S.undo,addEnv:k.add,updateEnv:k.update,deleteEnv:k.remove,undoDeleteEnv:k.undo,addGit:E.add,updateGit:E.update,deleteGit:E.remove,undoDeleteGit:E.undo,resetAll:C,buildPayloadPatch:N}}const Kn={overview:"ad-overview",setup:"ad-setup",prompt:nc("prompt"),tools:nc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function yZ(e){const t=[{key:"overview",label:"Profile",anchor:Kn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Kn.setup},{key:"prompt",label:"Prompt",anchor:Kn.prompt},{key:"tools",label:"Tools",anchor:Kn.tools},{key:"advanced",label:"Advanced",anchor:Kn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Kn.danger,divider:!0,danger:!0}),t}function vZ(){var Tt,at,nr,Rn,al,ca,da,za,Gn,Ma,wa,qt;const t=Zj().uuid??"",n=_n(),a=mn(),s=Ye({queryKey:["agent",t],queryFn:()=>PI(t),enabled:!!t}),o=Ye({queryKey:["agent-config",t],queryFn:()=>Nh(t),enabled:!!t&&((Tt=s.data)==null?void 0:Tt.type)!=="human"}),c=Ye({queryKey:["agent-client-status",t],queryFn:()=>ZB(t),enabled:!!t&&((at=s.data)==null?void 0:at.type)!=="human"}),f=Ye({queryKey:["agent-sessions-active",t],queryFn:()=>zC(t,{state:"active"}),enabled:!!t&&((nr=s.data)==null?void 0:nr.type)!=="human"}),m=Ye({queryKey:["clients"],queryFn:ls,enabled:!!t&&((Rn=s.data)==null?void 0:Rn.type)!=="human",refetchInterval:3e4}),h=gZ(o.data),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),E=wt({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const Ce=h.buildPayloadPatch();return _h(t,{expectedVersion:o.data.version,payload:Ce})},onSuccess:Ce=>{a.setQueryData(["agent-config",t],Ce),g(null),w(null),k(!0)},onError:Ce=>{if(k(!1),Ce instanceof Oc&&Ce.status===409){w("Someone else saved a newer version while you were editing."),g(null);return}g(Ce instanceof Error?Ce.message:String(Ce))}});b.useEffect(()=>{if(!S)return;const Ce=setTimeout(()=>k(!1),2500);return()=>clearTimeout(Ce)},[S]),b.useEffect(()=>{h.summary.anyDirty&&k(!1)},[h.summary.anyDirty]);const C=b.useCallback(()=>{w(null),g(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),N=b.useCallback(Ce=>{const et=document.getElementById(Ce);et&&et.scrollIntoView({behavior:"smooth",block:"start"})},[]),O=wt({mutationFn:Ce=>p1(t,Ce),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),z=wt({mutationFn:()=>RE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),L=wt({mutationFn:()=>OE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),R=wt({mutationFn:()=>AE(t),onSuccess:()=>n("/team")}),$=wt({mutationFn:()=>FI(t)}),[U,V]=b.useState(!1),[D,Y]=b.useState(""),[ae,xe]=b.useState(null),[J,X]=b.useState(!1),q=Ye({queryKey:["clients"],queryFn:ls,enabled:U}),te=wt({mutationFn:Ce=>p1(t,{clientId:Ce}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),V(!1),Y(""),xe(null)},onError:Ce=>xe(Ce instanceof Error?Ce.message:String(Ce))}),[ke,Ae]=b.useState(!1),[M,I]=b.useState(null),P=wt({mutationFn:()=>qB(t,h.buildPayloadPatch()),onSuccess:Ce=>{const et=Ce.diff.length?Ce.diff.map(gn=>`${gn.op} ${gn.path}`).join(`
401
- `):"(no changes)";I(et)},onError:Ce=>I(`Dry run failed: ${Ce instanceof Error?Ce.message:String(Ce)}`)});b.useEffect(()=>{if(!h.summary.anyDirty)return;const Ce=et=>{et.preventDefault(),et.returnValue=""};return window.addEventListener("beforeunload",Ce),()=>window.removeEventListener("beforeunload",Ce)},[h.summary.anyDirty]);const _=((al=s.data)==null?void 0:al.type)==="human",Z=b.useMemo(()=>yZ(_),[_]),Q=b.useRef(null),[ue,je]=b.useState(!1);b.useEffect(()=>{if(_)return;const Ce=Q.current;if(!Ce||typeof IntersectionObserver>"u")return;const et=new IntersectionObserver(gn=>{const _r=gn[0];_r&&je(!_r.isIntersecting&&_r.boundingClientRect.top<0)},{threshold:0});return et.observe(Ce),()=>et.disconnect()},[_]);const[we,pe]=b.useState(Kn.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const Ce=[];for(const et of Z){const gn=document.getElementById(et.anchor);if(!gn)continue;const _r=new IntersectionObserver(pi=>{for(const gs of pi)gs.isIntersecting&&pe(et.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});_r.observe(gn),Ce.push(_r)}return()=>{for(const et of Ce)et.disconnect()}},[Z]);const De=b.useMemo(()=>{const Ce=new Set;for(const et of h.summary.dirtySections)et==="prompt"&&Ce.add(Kn.prompt),et==="model"&&Ce.add(Kn.setup),et==="mcp"&&Ce.add(Kn.tools),(et==="env"||et==="git")&&Ce.add(Kn.advanced);return Ce},[h.summary.dirtySections]);if(s.isLoading)return l.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:l.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",s.error instanceof Error?s.error.message:"Unknown error"]});const Ue=s.data;if(!Ue)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const dt=Ue.type==="human",ot=c.data,re=((ca=f.data)==null?void 0:ca.length)??0,se=!dt&&!(ot!=null&&ot.clientId),ge=!dt&&ot?!ot.online&&!!ot.clientId:!1,Le=Ue,zt=Le.runtimeState??null,Ft=Le.runtimeType??null,Ln=Le.totalSessions??null,fr=Ue.uuid.slice(0,8),hi=fZ({activeSessions:re,isUnclaimed:se,isOffline:ge}),mi=h.draft.mcp.filter(Ce=>Ce.status!=="deleted"),on=h.draft.env.filter(Ce=>Ce.status!=="deleted"),ua=h.draft.git.filter(Ce=>Ce.status!=="deleted"),oe=Ce=>new Set(mi.filter(et=>et.key!==Ce).map(et=>et.value.name.toLowerCase())),ye=Ce=>new Set(on.filter(et=>et.key!==Ce).map(et=>et.value.key)),$e=Ce=>new Set(ua.filter(et=>et.key!==Ce).map(et=>{const{value:gn}=et;return gn.localPath?gn.localPath:((gn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ve={sessions:Ln??"—",active:re,runtime:Ft??(dt?"human":"—"),model:((za=(da=o.data)==null?void 0:da.payload.model)==null?void 0:za.trim())||"—"},nt=(ot==null?void 0:ot.clientId)??null,un=nt?((Gn=m.data)==null?void 0:Gn.find(Ce=>Ce.id===nt))??null:null,tr=nt?(un==null?void 0:un.hostname)??nt:null,Ht=Ue.runtimeProvider??"claude-code",Lt=Ht==="codex"?"Codex":"Claude Code";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[l.jsx(Xv,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),Z.map(Ce=>l.jsxs("div",{children:[Ce.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(bZ,{label:Ce.label,active:we===Ce.anchor,danger:Ce.danger??!1,dirty:De.has(Ce.anchor),onClick:()=>N(Ce.anchor)})]},Ce.key))]}),l.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[l.jsxs(GB,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(VB,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(QB,{}),l.jsx(KB,{mono:!0,children:Ue.name??fr})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"inline-flex items-center justify-center",style:{width:36,height:36,borderRadius:"var(--radius-panel)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:l.jsx(Ic,{width:18,height:20,style:{color:"var(--accent)"}})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-title",title:`agt_${fr}`,children:Ue.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Ue.name??fr]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(ya,{tone:Ue.type==="autonomous_agent"?"accent":"neutral",children:Ue.type}),Ue.visibility&&l.jsx(ya,{tone:Ue.visibility==="organization"?"accent":"outline",children:Ue.visibility}),(ot==null?void 0:ot.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",lc(ot.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(hc,{state:zt}),l.jsxs(ve,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ue.uuid}`),children:[l.jsx(jv,{className:"h-3 w-3"})," Open chat"]}),!dt&&Ue.status==="active"&&l.jsxs(ve,{variant:"outline",size:"xs",onClick:()=>{$.reset(),$.mutate()},disabled:$.isPending,children:[l.jsx(mC,{className:"h-3 w-3"}),$.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(vf,{label:"sessions",value:Ve.sessions}),l.jsx(vf,{label:"active",value:Ve.active,accent:typeof Ve.active=="number"&&Ve.active>0?"var(--accent)":void 0}),l.jsx(vf,{label:"runtime",value:Ve.runtime}),l.jsx(vf,{label:"model",value:Ve.model})]})]}),l.jsx("div",{ref:Q,"aria-hidden":!0,style:{height:0}}),!dt&&l.jsx(WB,{runtimeLabel:Lt,computerLabel:tr,visible:ue}),l.jsxs("div",{className:"mx-auto",style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)",maxWidth:960,display:"flex",flexDirection:"column",gap:20},children:[($.data||$.error)&&l.jsx(CZ,{result:$.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>$.reset()}),l.jsx(Bu,{anchorId:Kn.overview,title:"Profile",right:l.jsxs(ve,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Ue.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(jy,{className:"h-3 w-3"}),"Manage bindings"]}),children:l.jsx(f9,{agent:Ue,onSave:async Ce=>{await O.mutateAsync(Ce)}})}),!dt&&l.jsxs(l.Fragment,{children:[l.jsxs(Bu,{anchorId:Kn.setup,title:"Setup",caption:((Ma=o.data)==null?void 0:Ma.version)!=null?l.jsxs("span",{className:"mono",children:["config v",o.data.version,h.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[o.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),o.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(o.error)]}),o.data&&l.jsx(uZ,{runtimeProvider:Ht,computerLabel:tr,canBindComputer:se&&Ue.status==="active",bindComputerPending:te.isPending,onBindComputer:()=>V(!0),onRebind:Ue.clientId?()=>X(!0):void 0,modelSlot:l.jsx(k9,{value:h.draft.model,baseline:((wa=o.data)==null?void 0:wa.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Ue.status!=="active",provider:Ht})})]}),l.jsx(Bu,{anchorId:Kn.prompt,title:"Prompt",children:o.data?l.jsx(X7,{value:h.draft.promptAppend,baseline:((qt=o.data)==null?void 0:qt.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Ue.status!=="active"}):null}),l.jsx(Bu,{anchorId:Kn.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?l.jsx(p9,{items:h.draft.mcp,otherNames:oe,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Ue.status!=="active"}):null}),l.jsx(Bu,{anchorId:Kn.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:o.data&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{id:nc("env"),children:l.jsx(i9,{items:h.draft.env,otherKeys:ye,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Ue.status!=="active"})}),l.jsx("div",{id:nc("git"),children:l.jsx(l9,{items:h.draft.git,otherPaths:$e,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Ue.status!=="active"})}),M&&l.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:M}),h.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>P.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:P.isPending,children:P.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),l.jsx(lZ,{}),l.jsx(JB,{agent:Ue,suspendPending:z.isPending,reactivatePending:L.isPending,deletePending:R.isPending,onSuspend:()=>z.mutate(),onReactivate:()=>L.mutate(),onDelete:()=>R.mutate()})]}),!dt&&l.jsx(sZ,{summary:h.summary,saveHint:hi,conflictMessage:x,errorMessage:p,saving:E.isPending,justSaved:S,onSave:()=>E.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:Ce=>N(nc(Ce))})]}),l.jsx(xZ,{open:ke,onOpenChange:Ae,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),g(null),w(null),Ae(!1)}}),l.jsx(Dn,{open:U,onOpenChange:Ce=>{V(Ce),Ce||(Y(""),xe(null),te.reset())},children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:"Bind computer"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),q.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):q.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",q.error instanceof Error?q.error.message:"Unknown"]}):l.jsx(wZ,{clients:q.data??[],selected:D,onSelect:Y}),ae&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ae})]}),l.jsxs(Cr,{children:[l.jsx(ve,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),l.jsx(ve,{disabled:!D||te.isPending,onClick:()=>{xe(null),te.mutate(D)},children:te.isPending?"Binding…":"Bind"})]})]})}),l.jsx(eZ,{open:J,onOpenChange:X,agent:Ue})]})}function bZ({label:e,active:t,danger:n,dirty:a,onClick:s}){return l.jsx("button",{type:"button",onClick:s,className:ze("block w-full text-left bg-transparent text-body transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t?"":"hover:bg-accent"),style:{padding:"var(--sp-1_25) var(--sp-4) var(--sp-1_25) var(--sp-3_5)",border:"none",borderLeft:`var(--hairline-bold) solid ${t?"var(--accent)":"transparent"}`,background:t?"var(--bg-active)":"transparent",color:t?"var(--fg)":"var(--fg-3)",fontWeight:t?500:400},children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex-1 truncate",children:e}),a&&l.jsx("span",{role:"img","aria-label":"unsaved changes",style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-blocked)",flexShrink:0}}),n&&!a&&l.jsx("span",{"aria-hidden":!0,style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-error)",flexShrink:0}})]})})}function xZ(e){return l.jsx(Dn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function wZ({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?l.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",l.jsx("code",{className:"mono text-label",children:"first-tree-hub client connect <url>"})," on the computer that should run this agent, then reopen this dialog."]}):l.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const o=s.id===t,c=s.status==="online"||s.status==="active";return l.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>n(s.id),className:ze("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[l.jsx("span",{className:ze("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),l.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const SZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},kZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},jZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function CZ({result:e,onDismiss:t}){const n=kZ[e.status],a=jZ[e.status],s=e.connection;return l.jsx("div",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderLeft:`var(--sp-0_75) solid ${n}`,borderRadius:"var(--radius-panel)",padding:"var(--sp-3) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ya,{tone:a,children:SZ[e.status]}),e.responseTime!=null&&l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[l.jsx("div",{children:s.runtimeState&&l.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?l.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):l.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&l.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&l.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),l.jsx(ve,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function EZ(e){var t=0,n=e.children,a=n&&n.length;if(!a)t=1;else for(;--a>=0;)t+=n[a].value;e.value=t}function NZ(){return this.eachAfter(EZ)}function _Z(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function TZ(e,t){for(var n=this,a=[n],s,o,c=-1;n=a.pop();)if(e.call(t,n,++c,this),s=n.children)for(o=s.length-1;o>=0;--o)a.push(s[o]);return this}function AZ(e,t){for(var n=this,a=[n],s=[],o,c,f,m=-1;n=a.pop();)if(s.push(n),o=n.children)for(c=0,f=o.length;c<f;++c)a.push(o[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function RZ(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function OZ(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,s=a&&a.length;--s>=0;)n+=a[s].value;t.value=n})}function zZ(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function MZ(e){for(var t=this,n=DZ(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var s=a.length;e!==n;)a.splice(s,0,e),e=e.parent;return a}function DZ(e,t){if(e===t)return e;var n=e.ancestors(),a=t.ancestors(),s=null;for(e=n.pop(),t=a.pop();e===t;)s=e,e=n.pop(),t=a.pop();return s}function IZ(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function LZ(){return Array.from(this)}function PZ(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function UZ(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*BZ(){var e=this,t,n=[e],a,s,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,o=a.length;s<o;++s)n.push(a[s]);while(n.length)}function G_(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=HZ)):t===void 0&&(t=FZ);for(var n=new So(e),a,s=[n],o,c,f,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,f=m-1;f>=0;--f)s.push(o=c[f]=new So(c[f])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(V_)}function $Z(){return G_(this).eachBefore(qZ)}function FZ(e){return e.children}function HZ(e){return Array.isArray(e)?e[1]:null}function qZ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function V_(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function So(e){this.data=e,this.depth=this.height=0,this.parent=null}So.prototype=G_.prototype={constructor:So,count:NZ,each:_Z,eachAfter:AZ,eachBefore:TZ,find:RZ,sum:OZ,sort:zZ,path:MZ,ancestors:IZ,descendants:LZ,leaves:PZ,links:UZ,copy:$Z,[Symbol.iterator]:BZ};function Dg(e){return e==null?null:ZZ(e)}function ZZ(e){if(typeof e!="function")throw new Error;return e}var GZ={depth:-1},Mk={},Ig={};function VZ(e){return e.id}function QZ(e){return e.parentId}function KZ(){var e=VZ,t=QZ,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,p,g,x,w,S,k,E=new Map;if(n!=null){const C=o.map((z,L)=>YZ(n(z,L,s))),N=C.map(Dk),O=new Set(C).add("");for(const z of N)O.has(z)||(O.add(z),C.push(z),N.push(Dk(z)),o.push(Ig));c=(z,L)=>C[L],f=(z,L)=>N[L]}for(p=0,m=o.length;p<m;++p)h=o[p],w=o[p]=new So(h),(S=c(h,p,s))!=null&&(S+="")&&(k=w.id=S,E.set(k,E.has(k)?Mk:w)),(S=f(h,p,s))!=null&&(S+="")&&(w.parent=S);for(p=0;p<m;++p)if(w=o[p],S=w.parent){if(x=E.get(S),!x)throw new Error("missing: "+S);if(x===Mk)throw new Error("ambiguous: "+S);x.children?x.children.push(w):x.children=[w],w.parent=x}else{if(g)throw new Error("multiple roots");g=w}if(!g)throw new Error("no root");if(n!=null){for(;g.data===Ig&&g.children.length===1;)g=g.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Ig);--C)w.data=null}if(g.parent=GZ,g.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(V_),g.parent=null,m>0)throw new Error("cycle");return g}return a.id=function(s){return arguments.length?(e=Dg(s),a):e},a.parentId=function(s){return arguments.length?(t=Dg(s),a):t},a.path=function(s){return arguments.length?(n=Dg(s),a):n},a}function YZ(e){e=`${e}`;let t=e.length;return Yy(e,t-1)&&!Yy(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Dk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Yy(e,t););return e.slice(0,t)}function Yy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function XZ(e,t){return e.parent===t.parent?1:2}function Lg(e){var t=e.children;return t?t[0]:e.t}function Pg(e){var t=e.children;return t?t[t.length-1]:e.t}function WZ(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function JZ(e){for(var t=0,n=0,a=e.children,s=a.length,o;--s>=0;)o=a[s],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function eG(e,t,n){return e.a.parent===t.parent?e.a:n}function If(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}If.prototype=Object.create(So.prototype);function tG(e){for(var t=new If(e,0),n,a=[t],s,o,c,f;n=a.pop();)if(o=n._.children)for(n.children=new Array(f=o.length),c=f-1;c>=0;--c)a.push(s=n.children[c]=new If(o[c],c)),s.parent=n;return(t.parent=new If(null,0)).children=[t],t}function nG(){var e=XZ,t=1,n=1,a=null;function s(h){var p=tG(h);if(p.eachAfter(o),p.parent.m=-p.z,p.eachBefore(c),a)h.eachBefore(m);else{var g=h,x=h,w=h;h.eachBefore(function(N){N.x<g.x&&(g=N),N.x>x.x&&(x=N),N.depth>w.depth&&(w=N)});var S=g===x?1:e(g,x)/2,k=S-g.x,E=t/(x.x+S+k),C=n/(w.depth||1);h.eachBefore(function(N){N.x=(N.x+k)*E,N.y=N.depth*C})}return h}function o(h){var p=h.children,g=h.parent.children,x=h.i?g[h.i-1]:null;if(p){JZ(h);var w=(p[0].z+p[p.length-1].z)/2;x?(h.z=x.z+e(h._,x._),h.m=h.z-w):h.z=w}else x&&(h.z=x.z+e(h._,x._));h.parent.A=f(h,x,h.parent.A||g[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,p,g){if(p){for(var x=h,w=h,S=p,k=x.parent.children[0],E=x.m,C=w.m,N=S.m,O=k.m,z;S=Pg(S),x=Lg(x),S&&x;)k=Lg(k),w=Pg(w),w.a=h,z=S.z+N-x.z-E+e(S._,x._),z>0&&(WZ(eG(S,h,g),h,z),E+=z,C+=z),N+=S.m,E+=x.m,O+=k.m,C+=w.m;S&&!Pg(w)&&(w.t=S,w.m+=N-C),x&&!Lg(k)&&(k.t=x,k.m+=E-O,g=h)}return g}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function rG(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(by(e,`/context-tree/snapshot${n}`))}function rl({title:e,subtitle:t,right:n,className:a,style:s,...o}){return l.jsxs("div",{className:ze("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...o,children:[l.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),l.jsx("div",{style:{flex:1}}),n]})}const Q_=[{value:"1d",label:"1 day",summary:"last 1 day"},{value:"7d",label:"7 days",summary:"last 7 days"},{value:"30d",label:"30 days",summary:"last 30 days"}];function aG({previewSnapshot:e}={}){const{organizationId:t}=gt(),[n,a]=b.useState("7d"),[s,o]=b.useState(null),[c,f]=b.useState(null),m=e!==void 0,h=Ye({queryKey:["context-tree-snapshot",t,n,m],queryFn:()=>{if(!t)throw new Error("No organization selected");return rG(t,n)},enabled:!m&&!!t}),p=e??h.data,g=b.useMemo(()=>p?p.updates.find(S=>S.id===s)??p.updates[0]??null:null,[s,p]),x=b.useMemo(()=>p&&g!=null&&g.nodeId?p.nodes.find(S=>S.id===g.nodeId)??null:null,[g,p]),w=c??(g==null?void 0:g.nodeId)??(x==null?void 0:x.id)??null;return b.useEffect(()=>{var S;p&&(s&&p.updates.some(k=>k.id===s)||o(((S=p.updates[0])==null?void 0:S.id)??null))},[s,p]),l.jsxs("div",{className:"-m-6",children:[l.jsx(rl,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),l.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[!m&&h.isLoading?l.jsx(hG,{}):null,!m&&h.error?l.jsx(mG,{message:h.error instanceof Error?h.error.message:"Failed to load"}):null,p&&(m||!h.isLoading)?l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:p.snapshotStatus==="unavailable"?l.jsx(Y_,{snapshot:p}):l.jsxs(l.Fragment,{children:[l.jsx(iG,{snapshot:p,window:n,onWindowChange:a}),l.jsx(sG,{snapshot:p,selectedUpdate:g,selectedUpdateNode:x,selectedOverviewNodeId:w,onSelectUpdate:S=>{o(S.id),f(S.nodeId)},onSelectOverviewNode:f})]})}):null]})]})}function iG({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?l.jsx(Iz,{size:18}):l.jsx(Ws,{size:18}),s=EG(t),o=e.contextStatus.label,c=_G(e);return l.jsx(jn,{children:l.jsx(Jn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)",minWidth:0},children:[l.jsx("span",{style:{color:NG(e.contextStatus.severity),flex:"0 0 auto"},children:a}),l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{className:"flex flex-wrap items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"text-subtitle font-semibold",style:{color:"var(--fg)"},children:o}),c?l.jsx("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:c}):null]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.contextStatus.detail??"Agents have a synced team context snapshot available."})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(kf,{value:e.summary.changedNodeCount,label:`updates in the ${s}`}),l.jsx(kf,{value:e.summary.addedCount,label:"added",tone:"added"}),l.jsx(kf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),l.jsx(kf,{value:e.summary.removedCount,label:"removed",tone:"removed"})]}),l.jsxs("fieldset",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:[l.jsx("legend",{className:"sr-only",children:"Context update window"}),Q_.map(f=>l.jsx(ve,{variant:f.value===t?"default":"outline",size:"xs",onClick:()=>n(f.value),children:f.label},f.value))]})]})]})})})}function sG({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=f=>{o(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-4)",alignItems:"stretch"},children:[l.jsxs(jn,{className:"flex h-full flex-col",children:[l.jsx(la,{children:l.jsxs("div",{className:"flex flex-col",children:[l.jsx(oa,{children:"Context Updates"}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:[e.updates.length," team context changes agents may use"]})]})}),l.jsx(Jn,{className:"flex-1",children:e.updates.length===0?l.jsx(X_,{}):l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)",height:"min(52vh, 30rem)",overflow:"auto",paddingRight:"var(--sp-0_5)"},children:e.updates.map(f=>l.jsx(lG,{update:f,selected:f.id===(t==null?void 0:t.id),onClick:()=>s(f)},f.id))})})]}),l.jsx(oG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(uG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function lG({update:e,selected:t,onClick:n}){return l.jsxs("button",{type:"button",onClick:n,className:"w-full text-left transition-colors",style:{border:"var(--hairline) solid var(--border)",borderColor:t?"var(--accent)":"var(--border)",borderRadius:"var(--radius-panel)",background:t?"var(--bg-sunken)":"var(--bg)",padding:"var(--sp-2_5)"},children:[l.jsx("div",{className:"flex items-start justify-between",style:{gap:"var(--sp-2)"},children:l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(K_,{type:e.changeType}),l.jsx("span",{className:"text-body font-semibold",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:OG(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",J_(e.path)]})]})}),l.jsxs("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-3)",gap:"var(--sp-2)",marginTop:"var(--sp-2)"},children:[l.jsx("span",{children:PG(e.owners)}),e.relatedNodeIds.length>0?l.jsx("span",{children:UG(e.relatedNodeIds.length)}):null]})]})}function oG({update:e,node:t,snapshot:n}){const[a,s]=b.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(g=>n.nodes.find(x=>x.id===g)).filter(g=>!!g),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,f=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?LG(e.owners):"No owner",h=o&&o.length>0?o.map(g=>g.title||g.path||"root"):[],p=e?BG(e.path)||J_(e.path):"root";return l.jsxs(jn,{className:"flex h-full flex-col",children:[l.jsxs(la,{children:[l.jsxs("div",{children:[l.jsx(oa,{children:"Selected Change"}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Summary and source context"})]}),e?l.jsx(K_,{type:e.changeType}):null]}),l.jsx(Jn,{className:"flex-1",children:e?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[zG(e)," · ",AG(e.changeType)," · ",p]}),l.jsx("div",{className:"text-label font-mono",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:l.jsx(dG,{value:MG(e),impact:RG(e)})}),l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:l.jsx(fG,{commit:f,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(g=>!g)}})})]}):l.jsx(X_,{})})]})}function uG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const[a,s]=b.useState(()=>new Set),o=b.useMemo(()=>CG(e.nodes),[e.nodes]),c=b.useMemo(()=>vG(e.nodes,t,o,a),[t,e.nodes,o,a]),f=b.useCallback(k=>{k==null||k.scrollIntoView({block:"nearest",inline:"nearest"})},[]),m=b.useCallback(k=>{s(E=>{const C=new Set(E);return C.has(k)?C.delete(k):C.add(k),C})},[]),h=Math.max(760,...c.map(k=>k.x+280)),p=Math.max(280,...c.map(k=>k.y+48)),g=p+24,x=560,w=g>x,S=SG(e.nodes,t);return l.jsxs(jn,{children:[l.jsx(la,{children:l.jsxs("div",{children:[l.jsxs(oa,{children:[l.jsx(Gz,{size:17}),"Where Context Changed"]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Numbers = updated areas under each branch."})]})}),l.jsx(Jn,{children:c.length===0?l.jsx(Y_,{snapshot:e}):l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-1_5)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1_5)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"Selected"}),l.jsx("span",{children:S??"No update selected"})]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx($u,{color:"var(--accent)",label:"Selected path"}),l.jsx($u,{color:"var(--ok)",label:"Added"}),l.jsx($u,{color:"var(--warn)",label:"Edited"}),l.jsx($u,{color:"var(--danger)",label:"Removed"}),l.jsx($u,{color:"var(--bg-raised)",label:"Quiet"})]})]}),l.jsx("div",{style:{overflow:w?"auto":"hidden",maxHeight:w?`${x}px`:void 0,minHeight:`${Math.min(g,x)}px`},children:l.jsxs("svg",{viewBox:`0 0 ${h} ${p}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${g}px`},children:[c.map(k=>k.parent?l.jsx("line",{x1:k.parent.x,y1:k.parent.y,x2:k.x,y2:k.y,stroke:k.selectedPath&&k.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:k.muted?.34:k.selectedPath?.72:.56,strokeWidth:k.selectedPath&&k.parent.selectedPath?1.6:1},`edge:${k.id}`):null),c.map(k=>{const E=k.isSummary||k.sourceNodeId!==null,C=()=>{k.isSummary&&k.parentId?m(k.parentId):k.sourceNodeId&&n(k.sourceNodeId)};return l.jsx("foreignObject",{x:k.x-10,y:k.y-15,width:h-k.x-8,height:30,children:l.jsxs("button",{ref:k.selected?f:void 0,type:"button",disabled:!E,"aria-expanded":k.isSummary?k.isExpanded:void 0,onClick:C,className:"flex w-full items-center text-left text-label transition-colors",style:{background:"transparent",color:k.muted?"var(--fg-3)":"var(--fg)",cursor:E?"pointer":"default",gap:"var(--sp-2)",opacity:k.muted?.66:1,padding:"0 var(--sp-1)"},onMouseEnter:N=>{E&&(N.currentTarget.style.background="var(--bg-sunken)")},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[k.isSummary?l.jsx(cC,{size:12,style:{color:"var(--fg-4)",flex:"0 0 auto",transform:k.isExpanded?"rotate(90deg)":void 0,transition:"transform 120ms"}}):l.jsx("span",{"aria-hidden":"true",style:{width:k.selected?"var(--sp-4)":"var(--sp-3)",height:k.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:$G(k),border:`${k.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${k.selected?"var(--accent)":FG(k)}`,flex:"0 0 auto"}}),l.jsx("span",{className:k.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.title}),k.updateCount>0&&!k.isSummary?l.jsx("span",{className:"font-semibold",style:{background:"var(--accent-bg)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",flex:"0 0 auto",padding:"0 var(--sp-1)"},children:k.updateCount}):null]})},k.id)})]})})]})})]})}function $u({color:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{"aria-hidden":"true",style:{background:e,border:"var(--hairline) solid var(--border-strong)",borderRadius:"50%",height:"var(--sp-2)",width:"var(--sp-2)"}}),l.jsx("span",{children:t})]})}function kf({value:e,label:t,tone:n}){return l.jsxs("span",{className:"inline-flex items-baseline text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{className:"font-semibold",style:{color:n?Dh(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function cG({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?Dh(t):"var(--fg)",background:t?"var(--accent-bg)":"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",padding:"var(--sp-0_5) var(--sp-1_5)"},children:e})}function K_({type:e}){return l.jsx(cG,{label:TG(e),tone:e})}function dG({value:e,impact:t}){return l.jsxs("div",{style:{color:"var(--fg-2)"},children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Change summary"}),l.jsx("div",{className:"text-body",children:e}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:["Impact: ",t]})]})}function fG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:o,onTogglePreview:c}){const f=[{label:"Owner",value:a},...n.length>0?[{label:"Linked",value:n.join(", ")}]:[],{label:"Source",value:e,mono:!0},{label:"Commit",value:t,mono:!0}];return l.jsxs("div",{children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Reference"}),l.jsx("dl",{className:"grid grid-cols-1 md:grid-cols-2",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-2)"},children:f.map(m=>l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"4rem minmax(0,1fr)",gap:"var(--sp-2)"},children:[l.jsx("dt",{className:"text-label font-semibold",style:{color:"var(--fg-3)"},children:m.label}),l.jsx("dd",{className:`text-label ${m.mono?"font-mono":"font-medium"}`,style:{color:"var(--fg-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.value})]},m.label))}),l.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-3)"},children:[l.jsx(ve,{variant:"outline",size:"xs",onClick:c,children:o?"Hide source":"Preview source"}),l.jsxs(ve,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[l.jsx(uh,{size:14}),"Copy path"]})]}),o?l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",marginTop:"var(--sp-3)",paddingTop:"var(--sp-3)"},children:s?l.jsx(Mh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function hG(){return l.jsx(jn,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(c3,{size:17}),"Loading team context..."]})})})}function mG({message:e}){return l.jsx(jn,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[l.jsx(Ws,{size:17}),e]})})})}function Y_({snapshot:e}){const t=e.repo?"Context Tree sync unavailable":"Connect Context Tree",n=e.repo?"Hub cannot read the team Context Tree yet. Agents and users will see context here after the server can sync the configured repo.":"Connect a Context Tree repo to show the team knowledge agents can use.",a=e.contextStatus.detail,s=e.repo?pG(e.repo):null;return l.jsx(jn,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(Ws,{size:18,style:{color:"var(--warn)"}}),l.jsxs("div",{children:[l.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),l.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[s?`Repo: ${s}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function pG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function X_(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const gG=1,yG=3;function vG(e,t,n,a){const s=bG(e,t,n,a);if(s.length===0)return[];const o=KZ().id(p=>p.id).parentId(p=>p.parentId)(s).sort((p,g)=>p.data.isSummary!==g.data.isSummary?p.data.isSummary?1:-1:p.data.path.localeCompare(g.data.path)),f=nG().nodeSize([30,170])(o).descendants(),m=Math.min(...f.map(p=>p.x));return f.map(p=>({...p.data,x:28+p.y,y:28+p.x-m,parent:null})).map((p,g,x)=>({...p,parent:p.parentId?x.find(w=>w.id===p.parentId)??null:null}))}function bG(e,t,n,a){const s=new Map(e.map(S=>[S.id,S])),o=e.filter(S=>!S.parentId||s.has(S.parentId)).sort((S,k)=>S.path.localeCompare(k.path));if(o.length===0)return[];const c=xG(o),f=wG(t,s),m=new Set,h=new Map;for(const S of o){const k=W_(S,s,h),E=n.get(S.id)??0;(k<=gG||f.has(S.id)||E>0&&k<=yG)&&kG(S.id,s,m)}const p=new Set(m);for(const S of a)if(p.has(S))for(const k of c.get(S)??[])p.add(k.id);const g=f.size>0,x=o.filter(S=>p.has(S.id)).map(S=>{const k=n.get(S.id)??0,E=f.has(S.id);return{id:S.id,parentId:S.parentId&&p.has(S.parentId)?S.parentId:null,sourceNodeId:S.id,title:S.title,path:S.path,changeType:S.changeType,updateCount:k,isSummary:!1,isExpanded:!1,selected:t===S.id,selectedPath:E,muted:g&&!E&&k===0}}),w=[];for(const S of o){if(!p.has(S.id))continue;const k=(c.get(S.id)??[]).filter(N=>!m.has(N.id));if(k.length===0)continue;const E=a.has(S.id),C=k.filter(N=>(n.get(N.id)??0)>0).length;w.push({id:`summary:${S.id}`,parentId:S.id,sourceNodeId:null,title:E?`Hide ${k.length} quiet area${k.length===1?"":"s"}`:jG(k.length,C),path:`${S.path}/~summary`,changeType:null,updateCount:C,isSummary:!0,isExpanded:E,selected:!1,selectedPath:f.has(S.id),muted:g&&!f.has(S.id)})}return[...x,...w]}function xG(e){const t=new Map;for(const n of e){if(!n.parentId)continue;const a=t.get(n.parentId)??[];a.push(n),t.set(n.parentId,a)}for(const n of t.values())n.sort((a,s)=>a.path.localeCompare(s.path));return t}function wG(e,t){const n=new Set;let a=e?t.get(e):void 0;for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0;return n}function SG(e,t){const n=new Map(e.map(o=>[o.id,o])),a=[];let s=t?n.get(t):void 0;for(;s;)a.unshift(s.title),s=s.parentId?n.get(s.parentId):void 0;return a.length>0?a.join(" / "):null}function kG(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function W_(e,t,n){const a=n.get(e.id);if(a!==void 0)return a;const s=e.parentId?t.get(e.parentId):void 0,o=s?W_(s,t,n)+1:0;return n.set(e.id,o),o}function jG(e,t){return t>0?`${e} hidden · ${t} updated`:`${e} hidden quiet area${e===1?"":"s"}`}function CG(e){const t=new Map(e.map(a=>[a.id,a])),n=new Map;for(const a of e){if(!a.changeType)continue;let s=a;for(;s;)n.set(s.id,(n.get(s.id)??0)+1),s=s.parentId?t.get(s.parentId):void 0}return n}function EG(e){var t;return((t=Q_.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function NG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function _G(e){var n;const t=((n=e.headCommit)==null?void 0:n.slice(0,7))??null;return e.branch&&t?`Source: ${e.branch} @ ${t}`:e.branch?`Branch: ${e.branch}`:t?`Commit: ${t}`:null}function TG(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function AG(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function RG(e){return e.changeType==="added"?`Agents can use new team knowledge when working on ${e.affectedContextArea}.`:e.changeType==="removed"?`Agents should stop using the old team knowledge for ${e.affectedContextArea}.`:`Agents can use updated team knowledge when working on ${e.affectedContextArea}.`}function OG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function zG(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function MG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=IG(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function DG(e){return e.summary.replace(/^updated:\s*/i,"")}function IG(e){const t=DG(e);return new Set(["updated this team knowledge","added this team knowledge","removed this team knowledge"]).has(t.toLowerCase())||t.length<12||/[,;:]$/.test(t)?null:t}function LG(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function PG(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function UG(e){return`${e} linked context${e===1?"":"s"}`}function BG(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(eT).join(" / ")}function J_(e){return e.split("/").filter(Boolean).map(eT).join(" / ")||"root"}function eT(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function Dh(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function $G(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType?Dh(e.changeType):e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}function FG(e){return e.changeType?Dh(e.changeType):"var(--border-strong)"}const Ro=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));Ro.displayName="Card";const Oo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex flex-col space-y-1.5 p-6",e),...t}));Oo.displayName="CardHeader";const $c=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-subtitle leading-none",e),...t}));$c.displayName="CardTitle";const tT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));tT.displayName="CardDescription";const zo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("p-6 pt-0",e),...t}));zo.displayName="CardContent";const HG=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));HG.displayName="CardFooter";function qG(){const{token:e}=Zj(),t=_n(),{isAuthenticated:n,adoptTokens:a}=gt(),[s,o]=b.useState(null),[c,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const E=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!E.ok){f("This invitation is no longer valid");return}o(await E.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const E=await Ee.get("/me/organizations"),C=await Ee.get("/me"),N=E.find(O=>O.id===C.member.organizationId);g((N==null?void 0:N.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(Ik,{message:"Bad invitation URL"});if(c)return l.jsx(Ik,{message:"This invitation is no longer valid"});if(!s)return l.jsx(ZG,{});const x=async()=>{h(!0);try{const E=await Ee.post("/me/organizations/join",{token:e});await a(E.tokens),rC("invite"),t("/",{replace:!0})}catch(E){f(E instanceof Error?E.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,S=n&&p&&p!==s.organizationDisplayName,k=GG(s.expiresAt);return l.jsx(yb,{children:l.jsxs(Ro,{className:"w-full max-w-sm",children:[l.jsx(Oo,{className:"text-center",children:l.jsxs($c,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(zo,{className:"space-y-4",children:[S&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[l.jsx(Ws,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsxs("span",{children:["You'll switch from ",l.jsx("span",{className:"font-medium",children:p})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(ve,{className:"w-full",disabled:m,onClick:x,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(ve,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:w,children:[l.jsx(fC,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),k&&l.jsx("p",{className:"text-center text-label",style:{color:k.urgent?"var(--destructive)":"var(--fg-3)"},children:k.text}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function yb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function ZG(){return l.jsx(yb,{children:l.jsxs(Ro,{className:"w-full max-w-sm",children:[l.jsxs(Oo,{className:"text-center",children:[l.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),l.jsxs(zo,{className:"space-y-4",children:[l.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function Ik({message:e}){return l.jsx(yb,{children:l.jsxs(Ro,{className:"w-full max-w-sm",children:[l.jsxs(Oo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(Ws,{className:"h-6 w-6"})}),l.jsx($c,{className:"text-title",children:e})]}),l.jsxs(zo,{className:"space-y-4",children:[l.jsx("p",{className:"text-center text-body text-muted-foreground",children:"It may have expired or been revoked. Ask the team admin for a fresh link."}),l.jsx(ve,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Rc,{to:"/",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function GG(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return null;const a=Math.floor(n/6e4),s=Math.floor(a/60),o=Math.floor(s/24);return o>7?null:o>=1?{text:`Expires in ${o} ${o===1?"day":"days"}`,urgent:!1}:s>=1?{text:`Expires in ${s} ${s===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function VG(e){if(typeof e!="object"||e===null||!("from"in e))return null;const t=e.from;if(typeof t!="object"||t===null||!("pathname"in t)||typeof t.pathname!="string"||t.pathname==="/login")return null;const n="search"in t&&typeof t.search=="string"?t.search:"",a="hash"in t&&typeof t.hash=="string"?t.hash:"",s=`${t.pathname}${n}${a}`,o=hN(s);return o===$1&&s!==$1?null:o}function QG(){const{isAuthenticated:e}=gt(),t=kr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=VG(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?l.jsx(or,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:l.jsxs(Ro,{className:"w-full max-w-sm",children:[l.jsxs(Oo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Ic,{width:28,height:32})}),l.jsxs($c,{className:"text-title",children:["First Tree ",l.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),l.jsxs(zo,{className:"space-y-4",children:[l.jsx(ve,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(fC,{className:"h-4 w-4"}),"Continue with GitHub"]})}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[l.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),l.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),l.jsx(ve,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(k3,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function KG(){const e=_n(),{adoptTokens:t}=gt(),[n,a]=b.useState(null);return b.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),c=o.get("access"),f=o.get("refresh"),m=hN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&rC(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const gc=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:ze("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));gc.displayName="DenseTable";const yc=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));yc.displayName="DenseTableHeader";const vc=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));vc.displayName="DenseTableBody";const na=b.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>l.jsx("tr",{ref:o,className:ze("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));na.displayName="DenseTableRow";const Wt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:ze("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Wt.displayName="DenseTableHead";const pt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("td",{ref:a,className:ze("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));pt.displayName="DenseTableCell";const YG=1500;function XG({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:o,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,p]=b.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),p(!0),setTimeout(()=>p(!1),YG))},x=t!==void 0?Math.max(1,Math.round(t/60)):null,w=l.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?l.jsxs(l.Fragment,{children:[e,x!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",x,"m"]})]}):"Generating token…"}),S=l.jsxs(ve,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(uh,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,S]}):l.jsxs(l.Fragment,{children:[w,S]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[l.jsx(WG,{}),s]}),n==="success"&&o&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-idle) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-idle) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-idle) 45%, var(--fg))"},children:[l.jsx(cr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),l.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&c&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:c})]})}function WG(){return l.jsx("span",{"aria-hidden":"true",style:{width:12,height:12,flexShrink:0,borderRadius:"50%",border:"var(--hairline-bold) solid color-mix(in oklch, var(--state-blocked) 30%, transparent)",borderTopColor:"var(--state-blocked)",animation:"spin 0.85s linear infinite"}})}const JG=3e3,eV=1200;function tV({open:e,onOpenChange:t}){const n=mn(),{user:a}=gt(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),x=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),x.current=new Set;return}let w=!1;const S=(n.getQueryData(["clients"])??[]).map(k=>k.id);return x.current=new Set(S),(async()=>{try{const k=await pM();if(w)return;f(k),o("waiting")}catch(k){if(w)return;h(k instanceof Error?k.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const S=setInterval(async()=>{try{const k=await n.fetchQuery({queryKey:["clients"],queryFn:ls}),E=x.current,C=k.find(N=>!E.has(N.id)&&N.status==="connected"&&N.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},JG);return()=>clearInterval(S)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},eV);return()=>clearTimeout(w)},[s,t,n]),l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsxs(Zn,{children:[l.jsx(In,{children:"Connect computer"}),l.jsx(zv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(XG,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(ve,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function nV({embedded:e=!1}={}){const t=mn(),n=gh(),[a,s]=b.useState(()=>new Set),[o,c]=b.useState(null),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,x]=b.useState(!1),{data:w}=Ye({queryKey:["clients"],queryFn:ls,refetchInterval:1e4}),{data:S}=Ye({queryKey:["activity"],queryFn:zc,refetchInterval:1e4}),k=wt({mutationFn:mM,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),E=wt({mutationFn:hM,onSuccess:()=>{m(null),p(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:R=>{R instanceof Oc?p(R.message):p(R instanceof Error?R.message:String(R))}}),C=b.useMemo(()=>{const R=new Map;for(const $ of(S==null?void 0:S.agents)??[]){if(!$.clientId)continue;const U=R.get($.clientId)??[];U.push($),R.set($.clientId,U)}return R},[S==null?void 0:S.agents]),N=R=>C.get(R)??[],O=(w??[]).filter(R=>R.status==="connected").length,z=(w??[]).reduce((R,$)=>R+$.agentCount,0),L=(w??[]).filter(R=>R.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(rl,{title:"Computers",subtitle:w&&w.length>0?l.jsxs(l.Fragment,{children:[w.length," total · ",O," connected · ",z," agents bound",L>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[L," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(ve,{size:"xs",onClick:()=>x(!0),children:[l.jsx(ba,{className:"h-3 w-3"}),"Connect computer"]})})}),l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[l.jsx(tV,{open:g,onOpenChange:x}),f&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),N(f.id).length>0&&l.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:N(f.id).map(R=>l.jsx("li",{className:"font-medium",children:n(R.agentId)},R.agentId))})]}),h&&l.jsx("div",{className:"mb-3 p-2 rounded text-body",style:{background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:h}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ve,{variant:"outline",size:"sm",onClick:()=>{m(null),p(null)},children:"Cancel"}),l.jsx(ve,{variant:"destructive",size:"sm",onClick:()=>E.mutate(f.id),disabled:E.isPending,children:E.isPending?"Retiring…":"Retire"})]})]})}),o&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:o.hostname??o.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:N(o.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):N(o.id).map(R=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(R.agentId)}),l.jsx(hc,{state:R.runtimeState})]},R.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ve,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),l.jsx(ve,{variant:"destructive",size:"sm",onClick:()=>k.mutate(o.id),disabled:k.isPending,children:k.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?l.jsx(jn,{children:l.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers connected. Use the button above to generate a connect command."})}):l.jsxs(jn,{children:[l.jsxs(Py,{children:["Registered · ",w.length]}),l.jsxs(gc,{children:[l.jsx(yc,{children:l.jsxs(na,{children:[l.jsx(Wt,{style:{width:16}}),l.jsx(Wt,{children:"Hostname"}),l.jsx(Wt,{children:"OS"}),l.jsx(Wt,{children:"SDK"}),l.jsx(Wt,{children:"Agents"}),l.jsx(Wt,{children:"Connected"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{"aria-hidden":!0})]})}),l.jsx(vc,{children:w.map(R=>{const $=!a.has(R.id),U=N(R.id);return l.jsx(uV,{client:R,boundAgents:U,isExpanded:$,agentName:n,onToggle:()=>s(V=>{const D=new Set(V);return D.has(R.id)?D.delete(R.id):D.add(R.id),D}),onDisconnect:()=>c(R),onRetire:()=>{p(null),m(R)},onReconnect:()=>x(!0)},R.id)})})]})]})]})]})}const rV={"claude-code":"Claude Code",codex:"Codex"},aV=[Kf.CLAUDE_CODE,Kf.CODEX],Lk={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},iV={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function sV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ye({queryKey:["client-capabilities",e],queryFn:()=>dh(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(Xv,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):l.jsx("div",{className:"flex flex-col gap-1",children:aV.map(o=>l.jsx(lV,{provider:o,entry:s?s[o]??null:null},o))})]})}function lV({provider:e,entry:t}){const n=rV[e];if(!t)return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",Lk[e]]})]});switch(t.state){case"ok":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",iV[e]]})]});case"missing":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",Lk[e]]})]});case"error":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function oV(){return l.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[l.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}function uV({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f}){const h=e.status!=="connected",p=e.authState!=="ok",g=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(na,{interactive:!0,selected:n,onClick:s,children:[l.jsx(pt,{style:{width:16},children:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?l.jsx(Sv,{className:"h-3.5 w-3.5"}):l.jsx(cC,{className:"h-3.5 w-3.5"})})}),l.jsx(pt,{className:"font-medium",children:e.hostname??"—"}),l.jsx(pt,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(pt,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(pt,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?lc(e.connectedAt):"—"}),l.jsx(pt,{children:p?l.jsx(oV,{}):l.jsx(hc,{state:g})}),l.jsx(pt,{style:{width:1,whiteSpace:"nowrap"},children:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:p?"var(--state-error)":"var(--fg-2)"},onClick:x=>{x.stopPropagation(),f()},children:"Reconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:x=>{x.stopPropagation(),o()},children:"Disconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:x=>{x.stopPropagation(),c()},children:"Retire"})]})})]}),n&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(pt,{}),l.jsxs(pt,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(sV,{clientId:e.id,enabled:n}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(Xv,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),l.jsx("div",{className:"flex flex-col gap-1",children:t.map(x=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(x.agentId)}),l.jsx(hc,{state:x.runtimeState}),x.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[x.activeSessions," / ",x.totalSessions??0," sessions"]})]},x.agentId))})]})]})]})]})}function cV(){return l.jsx(nV,{embedded:!0})}function Mo(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function vb(e){return Ee.get(Mo(e,"context_tree"))}function nT(e,t){return Ee.put(Mo(e,"context_tree"),t)}function dV(e){return Ee.get(Mo(e,"github_integration"))}function fV(e,t){return Ee.put(Mo(e,"github_integration"),t)}function rT(e){return Ee.get(Mo(e,"source_repos"))}function aT(e,t){return Ee.put(Mo(e,"source_repos"),t)}function bc({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:c="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:p}){const g=b.useId(),x=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,w={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:g,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(hV,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:x,style:{...w,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:S=>a==null?void 0:a(S.target.value),type:c,placeholder:f,pattern:p,className:x,style:w}),m]})]})}function hV(){return l.jsxs("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(cr,{className:"h-3 w-3"}),"Saved"]})}function bb({pending:e,disabled:t=!1}){const n=e||t;return l.jsx("button",{type:"submit",disabled:n,"aria-label":"Save",title:"Save",className:"settings-save-button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"var(--sp-8)",background:"transparent",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:0,cursor:n?"default":"pointer",color:"var(--fg-3)",opacity:n?.5:1,transition:"color 0.15s, background 0.15s, border-color 0.15s"},children:e?l.jsx(hC,{className:"h-4 w-4 animate-spin"}):l.jsx(cr,{className:"h-4 w-4"})})}function Fc({title:e,description:t,right:n,children:a,isFirst:s=!1}){return l.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&l.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),l.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function mV({isFirst:e=!1}){var C,N;const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["org-setting",t,"github_integration"],queryFn:()=>t?dV(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(!1),x=((C=a.data)==null?void 0:C.webhookUrl)??"",w=wt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");const O=s.trim();return O.length===0&&!c?Promise.resolve(a.data):fV(t,{webhookSecret:O.length>0?O:null})},onSuccess:O=>{O&&(n.setQueryData(["org-setting",t,"github_integration"],O),o(""),f(!1),h(!0),setTimeout(()=>h(!1),2e3))}}),S=O=>{O.preventDefault(),w.mutate()},k=async()=>{x&&(await navigator.clipboard.writeText(x),g(!0),setTimeout(()=>g(!1),2e3))},E=((N=a.data)==null?void 0:N.webhookSecretConfigured)??!1;return l.jsx(Fc,{title:"GitHub webhook",description:"Routes GitHub issue and comment events to your team's agents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:S,children:[x?l.jsx(bc,{label:"Webhook URL",hint:"Configure this URL in GitHub repo / org Settings → Webhooks. Never changes.",value:x,readOnly:!0,mono:!0,rightSlot:l.jsxs(ve,{type:"button",size:"sm",variant:"outline",onClick:k,children:[l.jsx(uh,{className:"h-3 w-3"}),p?"Copied":"Copy"]})}):l.jsx(pV,{}),E&&!c?l.jsx(gV,{saved:m,onReplace:()=>{f(!0),o("")}}):l.jsx(bc,{label:"Webhook secret",hint:"Paste the value you used when configuring the GitHub webhook. Stored encrypted; never echoed back.",value:s,onChange:o,mono:!0,type:"password",placeholder:c?"Enter new secret":"(none)",saved:m,rightSlot:l.jsx(bb,{pending:w.isPending,disabled:!a.data})}),w.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:w.error.message})]})})}function pV(){return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook URL"}),l.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[l.jsx(Ws,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),l.jsx("span",{children:"The Hub's public URL is not configured. Please contact your site administrator to enable the GitHub webhook."})]})]})}function gV({saved:e,onReplace:t}){return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook secret"}),e&&l.jsx("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:"✓ Saved"})]}),l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:"Configured. Replace to rotate; webhook signature verification will fail until GitHub is also updated."}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"flex-1 mono text-body flex items-center",style:{padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-2)"},children:"••••••••"}),l.jsx(ve,{type:"button",size:"sm",variant:"outline",onClick:t,children:"Replace"})]})]})}function yV(){const{role:e}=gt();return e===null?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?l.jsx(or,{to:"/settings/computers",replace:!0}):l.jsxs(l.Fragment,{children:[l.jsx(rl,{title:"GitHub",subtitle:"Webhook URL + secret for routing GitHub events to your agents"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(mV,{isFirst:!0})})]})}function vV(){return Ee.get(Tn("/adapter-mappings"))}function bV(e){return Ee.post(Tn("/adapter-mappings"),e)}function xV(e){return Ee.delete(`/adapter-mappings/${e}`)}function wV(){return Ee.get(Tn("/adapters/status"))}function SV(){return Ee.get(Tn("/adapters"))}function kV(e){return Ee.post(Tn("/adapters"),e)}function jV(e,t){return Ee.patch(`/adapters/${e}`,t)}function CV(e){return Ee.delete(`/adapters/${e}`)}const EV=Object.values(u6),Pk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function Uk(e){const[t,n]=b.useState(Pk),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...Pk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=NV(t);if(!e.editingId&&!m){s("Credentials are required");return}if(e.editingId)e.onSubmit({kind:"bot-update",status:t.status,...m?{credentials:m}:{}});else{if(!m)return;e.onSubmit({kind:"bot-create",draft:{platform:t.platform,status:t.status,credentials:m}})}}const c=e.kind==="user"?`Bind external user → ${e.agentLabel}`:e.editingId?`Edit bot binding · ${e.agentLabel}`:`Bind bot → ${e.agentLabel}`;return l.jsx(Dn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"binding-platform",children:"Platform"}),l.jsx("select",{id:"binding-platform",value:t.platform,onChange:f=>n({...t,platform:f.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:EV.map(f=>l.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Ut,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Ut,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(xt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(xt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(xt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(xt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(xt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),l.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:f=>n({...t,credentialsJson:f.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"binding-status",children:"Status"}),l.jsxs("select",{id:"binding-status",value:t.status,onChange:f=>n({...t,status:f.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"active",children:"active"}),l.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function NV(e){if(e.platform==="feishu")return!e.feishuAppId&&!e.feishuAppSecret||!e.feishuAppId||!e.feishuAppSecret?null:{app_id:e.feishuAppId,app_secret:e.feishuAppSecret};if(e.platform==="kael")return!e.kaelUserId&&!e.kaelProjectId||!e.kaelUserId||!e.kaelProjectId?null:{kaelUserId:e.kaelUserId,kaelProjectId:e.kaelProjectId};const t=e.credentialsJson.trim();return t?JSON.parse(t):null}function _V(){var _;const e=_n(),t=mn(),[n,a]=lh(),s=n.get("agent"),o=gh(),c=Ye({queryKey:["adapters"],queryFn:SV}),f=Ye({queryKey:["adapter-mappings"],queryFn:vV}),m=Ye({queryKey:["adapter-statuses"],queryFn:wV,refetchInterval:15e3}),p=((_=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}).data)==null?void 0:_.items)??[],g=b.useMemo(()=>{const Z=new Map;for(const Q of m.data??[])Z.set(Q.configId,Q);return Z},[m.data]),x=b.useMemo(()=>{const Z=c.data??[];return s?Z.filter(Q=>Q.agentId===s):Z},[c.data,s]),w=b.useMemo(()=>{const Z=f.data??[];return s?Z.filter(Q=>Q.agentId===s):Z},[f.data,s]),S=x.reduce((Z,Q)=>{var ue;return Z+((ue=g.get(Q.id))!=null&&ue.connected?1:0)},0),k=x.length-S,E=c.isLoading||f.isLoading,[C,N]=b.useState(null),[O,z]=b.useState(""),[L,R]=b.useState(null),[$,U]=b.useState(null),[V,D]=b.useState(null),[Y,ae]=b.useState(null),xe=wt({mutationFn:Z=>kV({platform:Z.platform,agentId:Z.agentId,credentials:Z.credentials,status:Z.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),J=wt({mutationFn:Z=>{const Q={status:Z.status};return Z.credentials&&(Q.credentials=Z.credentials),jV(Z.id,Q)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),X=wt({mutationFn:CV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),q=wt({mutationFn:Z=>bV({platform:Z.platform,externalUserId:Z.externalUserId,agentId:Z.agentId,boundVia:"manual",displayName:Z.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),U(null)}}),te=wt({mutationFn:xV,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ke(Z){if(s){Z==="bot"?R({agentId:s,editingId:null}):U({agentId:s});return}z(""),N({kind:Z})}function Ae(){!C||!O||(C.kind==="bot"?R({agentId:O,editingId:null}):U({agentId:O}),N(null))}function M(Z){if(L){if(Z.kind==="bot-create")xe.mutate({agentId:L.agentId,platform:Z.draft.platform,status:Z.draft.status,credentials:Z.draft.credentials});else if(Z.kind==="bot-update"){if(!L.editingId)return;J.mutate({id:L.editingId,status:Z.status,credentials:Z.credentials})}}}function I(Z){!$||Z.kind!=="user-create"||q.mutate({agentId:$.agentId,platform:Z.draft.platform,externalUserId:Z.draft.externalUserId,displayName:Z.draft.displayName})}const P=s?p.find(Z=>Z.uuid===s):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-3)"},children:"Manage how external platforms (Feishu, Slack, Kael) reach your agents. Bot bindings hold encrypted credentials; user bindings map an external user to a human agent in this organization."}),s&&l.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 mono text-caption",style:{padding:"var(--sp-0_5) var(--sp-2)",borderRadius:"var(--radius-chip)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border)"},children:[(P==null?void 0:P.displayName)??s,l.jsx("button",{type:"button",onClick:()=>{const Z=new URLSearchParams(n);Z.delete("agent"),a(Z,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:l.jsx(ss,{className:"h-3 w-3"})})]})]}),l.jsxs(jn,{className:"mb-3.5",children:[l.jsxs(Py,{right:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[l.jsx(Wu,{state:"idle",size:6})," ",S," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(Wu,{state:"offline",size:6})," ",k," offline"]})]}),l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>ke("bot"),children:[l.jsx(ba,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",x.length]}),E?l.jsx(jf,{children:"Loading…"}):x.length?l.jsxs(gc,{children:[l.jsx(yc,{children:l.jsxs(na,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{children:"Connection"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(vc,{children:x.map(Z=>{var ue;const Q=((ue=g.get(Z.id))==null?void 0:ue.connected)??!1;return l.jsxs(na,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[l.jsx(pt,{children:l.jsx("span",{className:"mono font-medium",children:o(Z.agentId)})}),l.jsx(pt,{children:l.jsx(ya,{children:Z.platform})}),l.jsx(pt,{children:l.jsx(ya,{tone:Z.status==="active"?"accent":"outline",children:Z.status})}),l.jsx(pt,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(Wu,{state:Q?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:Q?"Online":"Offline"})]})}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:lc(Z.createdAt)}),l.jsxs(pt,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:je=>je.stopPropagation(),children:[l.jsx(ve,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>R({agentId:Z.agentId,editingId:Z.id,initialPlatform:TV(Z.platform),initialStatus:AV(Z.status)}),children:"Edit"}),l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(Z.id),disabled:X.isPending,title:"Delete",children:l.jsx(Bf,{className:"h-3.5 w-3.5"})})]})]},Z.id)})})]}):l.jsx(jf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(jn,{children:[l.jsxs(Py,{right:l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>ke("user"),children:[l.jsx(ba,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),E?l.jsx(jf,{children:"Loading…"}):w.length?l.jsxs(gc,{children:[l.jsx(yc,{children:l.jsxs(na,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"External user ID"}),l.jsx(Wt,{children:"Display name"}),l.jsx(Wt,{children:"Bound via"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:32}})]})}),l.jsx(vc,{children:w.map(Z=>l.jsxs(na,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[l.jsx(pt,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(Z.agentId)})}),l.jsx(pt,{children:l.jsx(ya,{children:Z.platform})}),l.jsx(pt,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:Z.externalUserId})}),l.jsx(pt,{style:{color:"var(--fg-2)"},children:Z.displayName??"—"}),l.jsx(pt,{children:l.jsx(ya,{tone:"outline",children:Z.boundVia??"—"})}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:lc(Z.createdAt)}),l.jsx(pt,{onClick:Q=>Q.stopPropagation(),children:l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ae(Z.id),disabled:te.isPending,title:"Delete",children:l.jsx(Bf,{className:"h-3.5 w-3.5"})})})]},Z.id))})]}):l.jsx(jf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(RV,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:p,agentId:O,onAgentChange:z,onCancel:()=>N(null),onConfirm:Ae}),l.jsx(Uk,{open:L!=null,kind:"bot",editingId:(L==null?void 0:L.editingId)??null,initialPlatform:L==null?void 0:L.initialPlatform,initialStatus:L==null?void 0:L.initialStatus,agentLabel:L?o(L.agentId):"",pending:xe.isPending||J.isPending,errorMessage:(xe.error??J.error)instanceof Error?(xe.error??J.error).message:null,onOpenChange:Z=>{Z||(R(null),xe.reset(),J.reset())},onSubmit:M}),l.jsx(Uk,{open:$!=null,kind:"user",editingId:null,agentLabel:$?o($.agentId):"",pending:q.isPending,errorMessage:q.error instanceof Error?q.error.message:null,onOpenChange:Z=>{Z||(U(null),q.reset())},onSubmit:I}),l.jsx(Bk,{open:V!=null,onOpenChange:Z=>!Z&&D(null),title:"Remove this bot binding?",description:"The bot will stop routing to this agent and any platform credentials stored here will be dropped.",confirmLabel:"Remove binding",pending:X.isPending,onConfirm:()=>{V!=null&&(X.mutate(V),D(null))}}),l.jsx(Bk,{open:Y!=null,onOpenChange:Z=>!Z&&ae(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:te.isPending,onConfirm:()=>{Y!=null&&(te.mutate(Y),ae(null))}})]})}function TV(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function AV(e){return e==="inactive"?"inactive":"active"}function jf({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function RV(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return l.jsx(Dn,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),l.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>l.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),l.jsxs(Cr,{children:[l.jsx(ve,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(ve,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Bk(e){return l.jsx(Dn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function OV({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(rl,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),l.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:l.jsx(_V,{})})]})}function zV(){return l.jsx(OV,{embedded:!0})}function MV(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=gt(),s=!!t,o=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(rl,{title:"Onboarding",subtitle:"Guided setup controls"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(Fc,{title:"Onboarding guide",description:s?"The stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The stepper is shown above your workspace. You can hide it any time once your agent is set up.",right:s?null:l.jsx(DV,{}),isFirst:!0,children:s?l.jsx(ve,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):l.jsx(ve,{type:"button",size:"sm",variant:"outline",onClick:()=>void n(),disabled:!o,title:o?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function DV(){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(cr,{className:"h-3 w-3"}),"Active"]})}function IV(){const{role:e}=gt(),t=e==="admin";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[l.jsx(Fu,{to:"/settings/team",label:"Team"}),l.jsx(Fu,{to:"/settings/computers",label:"Computers"}),t&&l.jsx(Fu,{to:"/settings/github",label:"GitHub"}),l.jsx(Fu,{to:"/settings/integrations",label:"Messaging"}),l.jsx(Fu,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(Uf,{})})]})}function Fu({to:e,label:t}){return l.jsx(yv,{to:e,className:({isActive:n})=>ze("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>l.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:l.jsx("span",{className:"flex-1 truncate",children:t})})})}function Xy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Wl)}const Ug=200;function LV(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const s=a.path[0];if(typeof s=="string"&&n.includes(s)){const o=s;t[o]||(t[o]=a.message)}else t._root=a.message}return t}function PV(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Wl)}function iT(e){return e==="claude-code"||e==="codex"?e:null}function UV(e){var t,n;if(((t=e["claude-code"])==null?void 0:t.state)==="ok")return"claude-code";if(((n=e.codex)==null?void 0:n.state)==="ok")return"codex";for(const[a,s]of Object.entries(e))if(s.state==="ok"){const o=iT(a);if(o)return o}return null}function BV(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function $V(e){switch(e){case"taken":return"That agent name is already in use in this organization. Pick a different one.";case"reserved":return"That agent name is reserved — pick a different one.";case"invalid":return"Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_)."}}function FV({open:e,onOpenChange:t,onCreated:n}){const a=mn(),{refreshMe:s,organizationId:o}=gt(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[x,w]=b.useState("organization"),[S,k]=b.useState("claude-code"),[E,C]=b.useState(!1),[N,O]=b.useState([]),[z,L]=b.useState(!1),[R,$]=b.useState(null),[U,V]=b.useState(null),[D,Y]=b.useState(null),[ae,xe]=b.useState(null),[J,X]=b.useState(null),[q,te]=b.useState(null),[ke,Ae]=b.useState(!1),[M,I]=b.useState({}),[P,_]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),w("organization"),k("claude-code"),C(!1),O([]),L(!1),$(null),V(null),Y(null),xe(null),X(null),te(null),Ae(!1),I({}),_({status:"idle"}))},[e]),b.useEffect(()=>{p||h(Xy(c))},[c,p]);const Z=b.useRef(0);b.useEffect(()=>{if(!e||!m){_({status:"idle"});return}if(!Dy.test(m)){_({status:"bad",reason:"invalid"});return}if(Iy(m)){_({status:"bad",reason:"reserved"});return}const se=++Z.current;_({status:"checking"});const ge=window.setTimeout(()=>{BI(m).then(Le=>{se===Z.current&&(Le.available?_({status:"ok"}):_({status:"bad",reason:Le.reason}))}).catch(()=>{se===Z.current&&_({status:"idle"})})},300);return()=>window.clearTimeout(ge)},[m,e]),b.useEffect(()=>{if(!e)return;let se=!1;const ge=async()=>{try{const zt=await ls();if(se)return;const Ft=zt.filter(Ln=>Ln.status==="connected").sort((Ln,fr)=>fr.lastSeenAt.localeCompare(Ln.lastSeenAt));O(Ft),L(!0)}catch{se||L(!0)}};ge();const Le=window.setInterval(ge,3e3);return()=>{se=!0,window.clearInterval(Le)}},[e]),b.useEffect(()=>{if(N.length===0){$(null);return}$(se=>{var ge;return se&&N.some(Le=>Le.id===se)?se:((ge=N[0])==null?void 0:ge.id)??null})},[N]),b.useEffect(()=>{if(!R){V(null),Y(null);return}let se=!1;const ge=async()=>{try{const zt=await dh(R);if(se)return;V(zt.capabilities),Y(R)}catch{}};ge();const Le=window.setInterval(ge,3e3);return()=>{se=!0,window.clearInterval(Le)}},[R]),b.useEffect(()=>{if(!e||N.length>0)return;if(ae&&q&&q>Date.now()){const ge=Math.max(q-Date.now(),0),Le=window.setTimeout(()=>{xe(null),te(null)},ge);return()=>window.clearTimeout(Le)}ae&&(xe(null),X(null),te(null));let se=!1;return(async()=>{try{const ge=await Ee.post("/me/connect-tokens",{});if(se)return;xe(ge.token),X(ge.command),te(Date.now()+ge.expiresIn*1e3)}catch{}})(),()=>{se=!0}},[e,N.length,ae,q]);const Q=R&&D===R?U:null,ue=b.useMemo(()=>{if(!Q)return[];const se=[];for(const[ge,Le]of Object.entries(Q)){if(Le.state!=="ok")continue;const zt=iT(ge);zt&&se.push(zt)}return se},[Q]);b.useEffect(()=>{Q&&k(se=>{var ge;return((ge=Q[se])==null?void 0:ge.state)==="ok"?se:UV(Q)??se})},[Q]);const je=wt({mutationFn:async se=>{const ge=c.trim()||m.trim()||"Untitled assistant";return UI({name:m||void 0,type:"personal_assistant",displayName:ge,clientId:se.clientId,runtimeProvider:S,visibility:x,...o?{organizationId:o}:{}})},onSuccess:se=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(se,S)}}),we=b.useMemo(()=>{const se=je.error;if(!se)return{};if(se instanceof Oc){const ge=LV(se.issues);return Object.keys(ge).length>0?ge:se.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:se.message}}return se instanceof Error?{_root:se.message}:{}},[je.error]),pe=P.status==="bad"?$V(P.reason):void 0,De={...pe?{name:pe}:{},...we,...M};function Ue(){const se={};return m?m.length>Wl?se.name=`Agent name must be at most ${Wl} characters (got ${m.length}).`:Dy.test(m)?Iy(m)&&(se.name="That agent name is reserved — pick a different one."):se.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(se.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Ug&&(se.displayName=`Display name must be at most ${Ug} characters (got ${c.length}).`),se}function dt(se){se.preventDefault();const ge=Ue();I(ge),!(Object.keys(ge).length>0)&&P.status!=="bad"&&R&&(ue.length===0||!ue.includes(S)||je.mutate({clientId:R}))}const ot=P.status==="bad",re=c.trim().length>0&&!ot&&!je.isPending&&!!R&&ue.length>0&&ue.includes(S);return l.jsx(Dn,{open:e,onOpenChange:t,children:l.jsxs(An,{className:"max-w-lg",children:[l.jsx(Zn,{children:l.jsx(In,{children:"New Agent"})}),l.jsxs("form",{onSubmit:dt,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Ut,{id:"new-agent-display-name",value:c,onChange:se=>{f(se.target.value),M.displayName&&I(ge=>({...ge,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Ug,"aria-invalid":De.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),l.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),De.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:De.displayName}),!E&&(c.trim()||m)&&l.jsxs("div",{className:"flex items-baseline gap-2 text-caption text-muted-foreground",children:[m?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"font-mono",children:["@",m]}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("span",{children:"permanent"})]}):l.jsx("span",{className:"italic",children:"No @handle from this display name"}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("button",{type:"button",onClick:()=>C(!0),className:"text-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Edit"})]}),!E&&De.name&&l.jsx("p",{className:"text-caption text-destructive",children:De.name})]}),E&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(xt,{htmlFor:"new-agent-name",children:"Agent name"}),l.jsx("button",{type:"button",onClick:()=>C(!1),className:"text-caption text-muted-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Done"})]}),l.jsxs("div",{className:"flex items-stretch",children:[l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),l.jsx(Ut,{id:"new-agent-name",value:m,autoFocus:!0,onChange:se=>{const ge=PV(se.target.value);h(ge),g(!0),M.name&&I(Le=>({...Le,name:void 0}))},onBlur:se=>{const ge=Xy(se.target.value);ge!==m&&h(ge)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Wl,"aria-invalid":De.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),l.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",Wl," characters. Permanent after creation."]}),m&&!De.name&&P.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:P.status==="ok"?"var(--state-idle)":P.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[P.status==="checking"&&"Checking availability…",P.status==="ok"&&"Available."]}),De.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:De.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:x==="organization"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="organization",onChange:()=>w("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent. (default)"})]})]}),l.jsxs("label",{className:x==="private"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="private",onChange:()=>w("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed."})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(xt,{children:"Where it runs"}),z?N.length===0?l.jsx(HV,{command:J,copied:ke,onCopy:async()=>{J&&(await navigator.clipboard.writeText(J),Ae(!0),window.setTimeout(()=>Ae(!1),1500))}}):N.length===1?l.jsx(qV,{client:N[0]}):l.jsx("div",{className:"space-y-2",children:N.map(se=>{const ge=R===se.id;return l.jsxs("label",{className:ge?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"picked-client",checked:ge,onChange:()=>$(se.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:se.hostname??se.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[se.os??"unknown OS"," · last seen ",new Date(se.lastSeenAt).toLocaleString()]})]})]},se.id)})}):l.jsx("p",{className:"text-caption text-muted-foreground",children:"Detecting connected computers…"}),R&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),Q===null?l.jsx("p",{className:"text-caption text-muted-foreground",children:"Detecting installed runtimes…"}):ue.length===0?l.jsx("p",{className:"text-caption text-destructive",children:"No runtime ready on this computer. Install Claude Code or Codex on it (and sign in), then come back."}):l.jsx("div",{className:"flex flex-wrap gap-2",children:ue.map(se=>{const ge=S===se;return l.jsxs("label",{className:ge?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:ge,onChange:()=>k(se)}),l.jsx("span",{className:"text-body",children:BV(se)})]},se)})})]}),De.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:De.clientId})]}),De._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:De._root}),l.jsx(Cr,{children:l.jsx(ve,{type:"submit",disabled:!re,children:je.isPending?"Creating…":"Create"})})]})]})})}function HV({command:e,copied:t,onCopy:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-2",children:[l.jsx("div",{className:"text-body font-medium",children:"No computer connected yet."}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Run this on the machine where this agent should live. We'll pick it up here automatically."}),l.jsxs("div",{className:"flex items-stretch gap-2 min-w-0",children:[l.jsx("code",{className:"block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption px-2 py-1.5 bg-muted/50 border border-border rounded",title:e??void 0,children:e??"Generating token…"}),l.jsx("button",{type:"button",onClick:n,disabled:!e,className:"shrink-0 px-3 py-1.5 text-caption font-medium border border-border rounded hover:bg-accent/30 disabled:opacity-50",children:t?"Copied":"Copy"})]})]})}function qV({client:e}){return e?l.jsxs("div",{className:"rounded-md border border-primary bg-primary/5 p-3",children:[l.jsx("div",{className:"text-body font-medium truncate",children:e.hostname??e.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[e.os??"unknown OS"," · last seen ",new Date(e.lastSeenAt).toLocaleString()]})]}):null}function sT({active:e,count:t,warn:n,className:a,children:s,style:o,...c}){return l.jsxs("button",{type:"button",className:ze("mono inline-flex items-center gap-1 text-caption leading-[1.6]",a),style:{padding:"var(--sp-0_5) var(--sp-1_75)",borderRadius:3,border:`var(--hairline) solid ${e?"var(--border-strong)":"var(--border)"}`,background:e?"var(--bg-active)":"transparent",color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",...o},...c,children:[s,t!==void 0&&l.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}function ZV(e){const t=new Date(e),n=Date.now(),a=t.getTime()-n;if(a<=0)return`expired ${t.toLocaleDateString()}`;const s=Math.ceil(a/(1440*60*1e3));return`expires ${s===1?"in less than a day":`in ${s} days`} · ${t.toLocaleDateString()}`}function GV(){const{organizationId:e}=gt(),[t,n]=b.useState(null),[a,s]=b.useState(null),[o,c]=b.useState(!1),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(async()=>{try{const p=await Ee.get(by(e,"/invitations"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const p=await Ee.post(by(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(Ro,{children:[l.jsxs(Oo,{children:[l.jsx($c,{children:"Invite link"}),l.jsxs(tT,{children:["Anyone with this link can join your team as a member. Links expire after ",rB," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(zo,{className:"space-y-3",children:[a&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),l.jsx(ve,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(ve,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),l.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${ZV(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const xb=[{key:"name",label:"Name",width:260},{key:"manager",label:"Manager",width:140},{key:"runtime",label:"Runtime · Status",width:170},{key:"created",label:"Created",width:120},{key:"actions",label:"",width:44}];function VV({groups:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){return l.jsxs(gc,{className:"table-fixed",children:[l.jsx(yc,{children:l.jsx(na,{children:xb.map(o=>l.jsx(Wt,{style:{width:o.width},"aria-hidden":o.key==="actions",children:o.label},o.key))})}),e.map(o=>l.jsx(QV,{group:o,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s},o.key))]})}function QV({group:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){const[o,c]=b.useState(!e.collapsible);return l.jsxs(vc,{children:[l.jsx(KV,{group:e,open:o,onToggle:()=>c(f=>!f)}),o&&e.rows.length===0&&e.emptyMessage&&l.jsx(na,{children:l.jsx(pt,{colSpan:xb.length,style:{color:"var(--fg-4)",textAlign:"center",padding:"var(--sp-4)"},children:e.emptyMessage})}),o&&e.rows.map(f=>f.kind==="human"?l.jsx(YV,{row:f,actions:a(f)},`h:${f.id}`):l.jsx(XV,{row:f,runtime:t.get(f.agent.uuid)??null,actions:s(f),onClick:()=>n(f.agent.uuid)},`a:${f.agent.uuid}`))]})}function KV({group:e,open:t,onToggle:n}){return l.jsx(na,{children:l.jsx("td",{colSpan:xb.length,style:{padding:"var(--sp-3) var(--sp-3_5) var(--sp-1_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:e.collapsible?l.jsxs("button",{type:"button",onClick:n,"aria-expanded":t,className:"inline-flex items-baseline gap-2 text-eyebrow uppercase",style:{color:"var(--fg-3)",background:"transparent",border:0,padding:0,cursor:"pointer"},children:[l.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10},children:t?"▾":"▸"}),l.jsx("span",{children:e.title}),l.jsxs("span",{style:{color:"var(--fg-4)"},children:["(",e.count,")"]})]}):l.jsxs("div",{className:"inline-flex items-baseline gap-2 text-eyebrow uppercase",style:{color:"var(--fg-3)"},children:[l.jsx("span",{children:e.title}),l.jsxs("span",{style:{color:"var(--fg-4)"},children:["(",e.count,")"]})]})})})}function YV({row:e,actions:t}){return l.jsxs(na,{children:[l.jsx(pt,{children:l.jsx(lT,{icon:l.jsx(x3,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}}),displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(pt,{className:"text-label",style:{color:"var(--fg-4)"},children:"—"}),l.jsx(pt,{className:"text-label",style:{color:"var(--fg-4)"},children:"—"}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:OC(e.createdAt)}),l.jsx(pt,{style:{padding:0,textAlign:"right"},children:l.jsx(oT,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function XV({row:e,runtime:t,actions:n,onClick:a}){const{agent:s,managerLabel:o,isOwnedBySelf:c}=e,m=s.visibility==="private"?l.jsx(kv,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}}):l.jsx(uC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}});return l.jsxs(na,{interactive:!0,onClick:a,children:[l.jsx(pt,{children:l.jsx(lT,{icon:m,displayName:s.displayName,handle:s.name?`@${s.name}`:null})}),l.jsxs(pt,{className:"text-label",style:{color:"var(--fg-2)"},children:[o??"—",c&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),l.jsx(pt,{children:l.jsx(WV,{runtimeState:(t==null?void 0:t.runtimeState)??null,runtimeProvider:s.runtimeProvider})}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:OC(s.createdAt)}),l.jsx(pt,{style:{padding:0,textAlign:"right"},onClick:h=>h.stopPropagation(),children:l.jsx(oT,{actions:n,ariaLabel:`Actions for ${s.displayName}`})})]})}function lT({icon:e,displayName:t,handle:n,selfTag:a}){return l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("span",{style:{marginTop:2},children:e}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:t,children:[t,a&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),n&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:n,children:n})]})]})}function WV({runtimeState:e,runtimeProvider:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:2},children:[l.jsx(hc,{state:e}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:t})]})}function oT({actions:e,ariaLabel:t}){const[n,a]=b.useState(!1),[s,o]=b.useState("down"),c=b.useRef(null),f=b.useRef(null);return b.useEffect(()=>{if(!n)return;const m=p=>{c.current&&!c.current.contains(p.target)&&a(!1)},h=p=>{p.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[n]),b.useEffect(()=>{if(!n||!f.current)return;const m=32,h=8,p=f.current.getBoundingClientRect(),g=window.innerHeight-p.bottom,x=e.length*m+h;o(g>=x?"down":"up")},[n,e.length]),e.length===0?null:l.jsxs("div",{ref:c,className:"relative inline-flex",children:[l.jsx("button",{ref:f,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":n,onClick:m=>{m.stopPropagation(),a(h=>!h)},className:"inline-flex items-center justify-center",style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(Uz,{className:"h-3.5 w-3.5"})}),n&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",style:{minWidth:180,borderColor:"var(--border)",...s==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(m=>l.jsx("button",{type:"button",role:"menuitem",disabled:m.disabled,onClick:h=>{h.stopPropagation(),a(!1),m.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:m.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:m.disabled?"not-allowed":"pointer"},children:m.label},m.key))})]})}function JV(){var M;const{role:e,memberId:t}=gt(),n=e==="admin",a=_n(),s=mn(),o=UN(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState("all"),[S,k]=b.useState(""),E=Ye({queryKey:["members"],queryFn:PN}),C=Ye({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>n?LI({limit:100}):Dc({limit:100})}),{data:N}=Ye({queryKey:["activity"],queryFn:zc,refetchInterval:1e4}),O=b.useMemo(()=>{const I=new Map;for(const P of(N==null?void 0:N.agents)??[])I.set(P.agentId,P);return I},[N==null?void 0:N.agents]),z=b.useMemo(()=>E.data??[],[E.data]),L=b.useMemo(()=>{var I;return(((I=C.data)==null?void 0:I.items)??[]).filter(P=>P.type!=="human")},[(M=C.data)==null?void 0:M.items]),R=b.useMemo(()=>z.filter(I=>I.role==="admin").length,[z]),$=b.useMemo(()=>L.filter(I=>I.visibility==="organization"),[L]),U=b.useMemo(()=>L.filter(I=>I.visibility==="private"&&I.managerId===t),[L,t]),V=b.useMemo(()=>L.filter(I=>I.visibility==="private"&&I.managerId!==t),[L,t]),D=[`${z.length} ${Bg(z.length,"human")} (${R} ${Bg(R,"admin")})`,`${$.length} shared ${Bg($.length,"agent")}`,`${U.length} of your private`].join(" · "),Y=wt({mutationFn:async I=>c9(I.id,I.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),ae=wt({mutationFn:d9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),xe=wt({mutationFn:AE,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),J=wt({mutationFn:RE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),X=wt({mutationFn:OE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),q=S.trim().toLowerCase(),te=b.useMemo(()=>nQ({filter:x,search:q,isAdmin:n,selfMemberId:t,members:z,sharedAgents:$,yourPrivateAgents:U,otherPrivateAgents:V,resolveMember:o}),[x,q,n,t,z,$,U,V,o]);function ke(I){const P=[];return n&&P.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:I.id,username:I.username,displayName:I.displayName,role:I.role})}),n&&!I.isSelf&&P.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${I.displayName} from the org? The human agent will be deactivated.`)&&ae.mutate(I.id)}}),P}function Ae(I){const{agent:P,isOwnedBySelf:_}=I,Z=n||_,Q=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(P.uuid)}`)}];return Z&&(P.status==="suspended"?Q.push({key:"reactivate",label:"Reactivate",onSelect:()=>X.mutate(P.uuid)}):Q.push({key:"suspend",label:"Suspend",onSelect:()=>J.mutate(P.uuid)}),Q.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${P.displayName}? This cannot be undone.`)&&xe.mutate(P.uuid)}})),Q}return l.jsxs(l.Fragment,{children:[l.jsx(rl,{title:"Team",subtitle:D,right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(ve,{size:"xs",onClick:()=>h(!0),children:[l.jsx(ba,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(ve,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(pC,{className:"h-3 w-3"}),"Invite link"]})]})}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsx(tQ,{filter:x,onFilter:w,query:S,onQuery:k,counts:{humans:z.length,shared:$.length,private:U.length,admins:R}}),C.isLoading||E.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):C.error||E.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",eQ(C.error??E.error)]}):l.jsx(VV,{groups:te,runtimeMap:O,onAgentClick:I=>a(`/agents/${encodeURIComponent(I)}`),getHumanActions:ke,getAgentActions:Ae})]}),l.jsx(Dn,{open:c,onOpenChange:f,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:"Invite link"})}),l.jsx(GV,{})]})}),l.jsx(FV,{open:m,onOpenChange:h,onCreated:(I,P)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(aQ,{target:p,isAdmin:n,isSaving:Y.isPending,onClose:()=>g(null),onSave:async I=>{p&&(await Y.mutateAsync({id:p.id,patch:I}),g(null))}})]})}function Bg(e,t){return e===1?t:`${t}s`}function eQ(e){return e instanceof Error?e.message:String(e)}function tQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"humans",label:"Humans",count:s.humans},{key:"shared",label:"Shared agents",count:s.shared},{key:"private",label:"Your private",count:s.private},{key:"admins",label:"Admins",count:s.admins}];return l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:o.map(c=>l.jsx(sT,{active:e===c.key,count:c.count,onClick:()=>t(c.key),children:c.label},c.key))}),l.jsxs("div",{className:"flex-1 relative",style:{minWidth:180,maxWidth:320},children:[l.jsx(ch,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-2)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx(Ut,{value:n,onChange:c=>a(c.target.value),placeholder:"Search name or @handle",style:{paddingLeft:"var(--sp-7)"},"aria-label":"Search team"})]})]})}function nQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,sharedAgents:c,yourPrivateAgents:f,otherPrivateAgents:m}=e,h=R=>!n||R.displayName.toLowerCase().includes(n)||R.username.toLowerCase().includes(n),p=R=>!n||R.displayName.toLowerCase().includes(n)||(R.name??"").toLowerCase().includes(n),g=t==="admins",x=t==="all"||t==="humans"||t==="admins",w=t==="all"||t==="shared",S=t==="all"||t==="private",k=a&&t==="all",E=o.filter(h).filter(R=>!g||R.role==="admin").map(R=>({kind:"human",id:R.id,username:R.username,displayName:R.displayName,role:R.role,createdAt:R.createdAt,isSelf:s===R.id})),C=R=>({kind:"agent",agent:R,managerLabel:R.managerId?e.resolveMember(R.managerId):null,isOwnedBySelf:R.managerId===s}),N=c.filter(p).map(C),O=f.filter(p).map(C),z=m.filter(p).map(C),L=[];return x&&L.push({key:g?"admins":"humans",title:g?"Admins":"Humans",count:E.length,rows:E,emptyMessage:n?"No humans match this search.":void 0}),w&&L.push({key:"shared",title:"Shared agents",count:N.length,rows:N,emptyMessage:n?"No shared agents match this search.":"No shared agents yet."}),S&&L.push({key:"private",title:"Your private agents",count:O.length,rows:O,emptyMessage:n?"No private agents match this search.":"No private agents — pick Private in the create dialog to keep one to yourself."}),k&&z.length>0&&L.push({key:"other-private",title:"Other members' private agents",count:z.length,rows:z,collapsible:!0}),L}const rQ=Object.values(uB);function aQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(c(e.displayName),m(e.role),p(null))},[e]);async function g(w){if(w.preventDefault(),!e)return;const S={};if(o.trim()&&o!==e.displayName&&(S.displayName=o.trim()),t&&f!==e.role&&(S.role=f),Object.keys(S).length===0){a();return}try{await s(S)}catch(k){p(k instanceof Error?k.message:String(k))}}const x=e!==null;return l.jsx(Dn,{open:x,onOpenChange:w=>w?void 0:a(),children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Username"}),l.jsx(Ut,{value:e.username,disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Ut,{id:"edit-member-display",value:o,onChange:w=>c(w.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:w=>m(w.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:rQ.map(w=>l.jsx("option",{value:w,children:w},w))}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),h&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:h}),l.jsxs(Cr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function iQ({isFirst:e=!1}){const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?vb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1);b.useEffect(()=>{a.data&&(o(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const p=wt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return nT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:x=>{n.setQueryData(["org-setting",t,"context_tree"],x),h(!0),setTimeout(()=>h(!1),2e3)}}),g=x=>{x.preventDefault(),p.mutate()};return l.jsx(Fc,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:g,children:[l.jsx(bc,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:o,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),l.jsx(bc,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(bb,{pending:p.isPending,disabled:!a.data})}),p.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:p.error.message})]})})}function sQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=gt(),a=n==="admin",s=mn(),o=Ye({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?rT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=wt({mutationFn:async p=>{var w;if(!t)throw new Error("organization not loaded");const x=(((w=o.data)==null?void 0:w.repos)??[]).filter(S=>S.url!==p);return aT(t,{repos:x})},onSuccess:p=>{s.setQueryData(["org-setting",t,"source_repos"],p)}}),f=((h=o.data)==null?void 0:h.repos)??[],m=f.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return l.jsxs(Fc,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[o.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):o.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:o.error instanceof Error?o.error.message:"Failed to load setting"}):f.length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(p=>l.jsx(lQ,{url:p.url,defaultBranch:p.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(p.url)},p.url))}),c.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function lQ({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return l.jsxs("li",{className:"group flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)"},children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&l.jsx("button",{type:"button","aria-label":`Remove ${e}`,disabled:a,onClick:s,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:0,borderRadius:"var(--radius-input)",background:"transparent",color:"var(--fg-3)",cursor:a?"not-allowed":"pointer",flexShrink:0},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)",o.currentTarget.style.color="var(--fg)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--fg-3)"},children:l.jsx(ss,{className:"h-3.5 w-3.5"})})]})}function oQ(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function uQ(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function cQ({isFirst:e=!1}){const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["organization",t],queryFn:()=>t?oQ(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(!1);b.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=wt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const p=s.trim();return!p||p===a.data.displayName?Promise.resolve(a.data):uQ(t,{displayName:p})},onSuccess:p=>{n.setQueryData(["organization",t],p),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=p=>{p.preventDefault(),m.mutate()};return l.jsx(Fc,{title:"Identity",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):l.jsxs("form",{onSubmit:h,children:[l.jsx(bc,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(bb,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function dQ(){const{role:e}=gt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(cQ,{isFirst:!0}),t&&l.jsx(iQ,{}),l.jsx(sQ,{isFirst:!t})]})}function fQ(){const{role:e}=gt();if(e===null)return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."});const t=e==="admin"?"Identity, Context Tree, source repos":"Repos your team's agents are bound to";return l.jsxs(l.Fragment,{children:[l.jsx(rl,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(dQ,{})})]})}function th(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter);const n=t.toString();return Ee.get(Tn(`/chats${n?`?${n}`:""}`))}function hQ(e){return Ee.post(Tn("/chats"),e)}function mQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function uT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function pQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const nh="draft";function gQ(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),o=c=>{var f;return((f=s.find(m=>m.type===c))==null?void 0:f.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function yQ(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function vQ({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=b.useState("all"),[o,c]=b.useState(""),[f,m]=b.useState([]),[h,p]=b.useState(!1),[g,x]=b.useState(null),{data:w,isLoading:S}=Ye({queryKey:["me","chats",a],queryFn:()=>th({filter:a}),refetchInterval:15e3}),k=()=>{f.length>0&&m([]),x(null)},E=(w==null?void 0:w.rows)??[],C=b.useMemo(()=>[...E,...f],[E,f]),N=b.useMemo(()=>{const U=o.trim().toLowerCase();return U?C.filter(V=>V.title.toLowerCase().includes(U)||(V.lastMessagePreview??"").toLowerCase().includes(U)?!0:V.participants.map(xe=>xe.displayName.toLowerCase()).join(" ").includes(U)):C},[C,o]),O=async()=>{if(h)return;const U=w==null?void 0:w.nextCursor;if(U){p(!0),x(null);try{const V=await th({filter:a,cursor:U});m(D=>[...D,...V.rows]),L(V.nextCursor)}catch(V){x(V instanceof Error?V.message:"Failed to load more")}finally{p(!1)}}},[z,L]=b.useState(null),R=(w==null?void 0:w.nextCursor)??null;b.useEffect(()=>{L(R)},[R]);const $=b.useMemo(()=>C.reduce((U,V)=>U+(V.unreadMentionCount>0?1:0),0),[C]);return l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===nh?"var(--bg-active)":"transparent",color:e===nh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[l.jsx(ba,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),l.jsxs("div",{className:"flex items-center",style:{gap:8},children:[l.jsx("div",{className:"flex gap-1 shrink-0",children:$>0&&l.jsx(sT,{active:a==="unread",count:$,onClick:()=>{s(a==="unread"?"all":"unread"),k()},children:"unread"})}),l.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[l.jsx(ch,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx("input",{value:o,onChange:U=>c(U.target.value),placeholder:"Search…",className:"w-full outline-none text-caption",style:{padding:"var(--sp-0_5) var(--sp-1) var(--sp-0_5) var(--sp-5)",background:"transparent",border:"none",color:"var(--fg-2)"}})]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[S&&N.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!S&&N.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:o?"No matches":l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:0},children:"No conversations yet."}),l.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),N.map(U=>{const V=e===U.chatId,D=yQ(U),Y=D&&D!==U.title?D:"",ae=U.unreadMentionCount>0;return l.jsx("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>t(U.chatId),className:ze("w-full text-left transition-colors flex flex-col","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",background:V?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${V?"var(--accent)":"transparent"}`},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[ae&&l.jsx("span",{"aria-label":`${U.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),l.jsx("span",{className:"truncate text-subtitle",style:{color:ae?"var(--fg)":"var(--fg-2)",fontWeight:ae?700:500,flex:1,minWidth:0},children:U.title}),U.lastMessageAt&&l.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:gQ(U.lastMessageAt)})]}),l.jsx("div",{className:"truncate text-body",style:{color:ae?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:Y||"—"})]})},U.chatId)}),z&&N.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:O,disabled:h,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:h?"default":"pointer",opacity:h?.6:1},children:h?"Loading…":"Load more"}),g&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:g})]})]})]})}function cT(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function bQ(e,t){return Ee.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function ko(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function xQ(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function wQ(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const s=a.result;if(typeof s!="string"){n(new Error("Unexpected FileReader result"));return}const o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function wb(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function SQ(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Ee.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}function Sb(e){const t=new Map;for(const a of e)a.displayName&&t.set(a.displayName,(t.get(a.displayName)??0)+1);const n=new Set;for(const[a,s]of t)s>1&&n.add(a);return n}function kQ(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function kb({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-medium",children:e.displayName??n}),kQ(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function jQ(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const s=e[n];if(s===void 0)return null;if(s==="@")break;if(!/[A-Za-z0-9_-]/.test(s))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const s=e[n-1];if(s!==void 0&&/[A-Za-z0-9_.@-]/.test(s))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function CQ(e,t){if(!t)return[...e].sort((a,s)=>(a.displayName??a.name??"").localeCompare(s.displayName??s.name??"")).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:o.startsWith(t)?c=1:o.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function EQ(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${s}${c}${m}`,p=s.length+c.length+(f?1:0);return{text:h,cursor:p}}function dT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=b.useState(0),[f,m]=b.useState(null),h=b.useMemo(()=>s?null:jQ(e,t),[e,t,s]),p=b.useMemo(()=>h?CQ(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{c(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const x=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&p.length>0&&!x;function S(){m((h==null?void 0:h.triggerIndex)??null)}function k(C){if(!h)return;const N=EQ(e,h,t,C);N&&a(N)}return{trigger:w?h:null,results:w?p:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(N=>p.length===0?0:(N+1)%p.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(N=>p.length===0?0:(N-1+p.length)%p.length),!0;if(C.key==="Enter"||C.key==="Tab"){const N=p[o]??p[0];return N?(C.preventDefault(),k(N),!0):!1}return C.key==="Escape"?(C.preventDefault(),S(),!0):!1},pick:k,dismiss:S}}function fT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=b.useRef(null);return b.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:l.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:ze("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const f=Sb(t);return t.map((m,h)=>{const p=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":p,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:g=>{g.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:p?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(kb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function NQ({onCreated:e}){const t=mn(),{agentId:n}=gt(),a=Dv(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(!1),E=b.useRef(null),C=b.useRef(!1),N=b.useRef(null),{data:O}=Ye({queryKey:["activity"],queryFn:zc,refetchInterval:15e3}),z=b.useMemo(()=>{const J=(O==null?void 0:O.agents)??[],X=[];for(const q of J){if(n&&q.agentId===n)continue;const te=a(q.agentId);!te||!te.name||X.push({agentId:q.agentId,name:te.name,displayName:te.displayName})}return X},[O,a,n]);b.useEffect(()=>{if(C.current||s.length>0||z.length===0)return;const J=TQ(z,(O==null?void 0:O.agents)??[]);J&&(o([J]),C.current=!0)},[z,O,s.length]);const L=b.useMemo(()=>{const J=z.map(X=>({agentId:X.agentId,name:X.name}));return fN(c,J)},[c,z]),R=dT({value:c,cursor:m,candidates:z,disabled:x,onSelect:J=>{f(J.text),h(J.cursor),requestAnimationFrame(()=>{const X=E.current;X&&(X.focus(),X.setSelectionRange(J.cursor,J.cursor))})}});b.useEffect(()=>{L.length!==0&&o(J=>{const X=new Set(J);let q=!1;for(const te of L)X.has(te)||(X.add(te),q=!0);return q?[...X]:J})},[L]),b.useEffect(()=>{if(!S)return;const J=X=>{N.current&&(N.current.contains(X.target)||k(!1))};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[S]);const $=wt({mutationFn:async({participantIds:J,text:X})=>{const q=await hQ({participantIds:J}),te=X.trim();return te.length>0&&await ko(q.chatId,te),q.chatId},onSuccess:J=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(J)},onError:J=>{g(J instanceof Error?J.message:"Failed to create chat")}}),U=b.useMemo(()=>!(x||$.isPending||s.length===0||c.trim().length===0||s.length>=2&&L.length===0),[x,$.isPending,s.length,c,L.length]),V=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&L.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,L.length]),D=async()=>{if(!U)return;const J=Array.from(new Set([...s,...L]));g(null),w(!0);try{await $.mutateAsync({participantIds:J,text:c})}finally{w(!1)}},Y=J=>{o(X=>X.filter(q=>q!==J))},ae=J=>{o(X=>X.includes(J)?X:[...X,J]),k(!1)},xe=b.useMemo(()=>z.filter(J=>!s.includes(J.agentId)),[z,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(_Q,{chips:s,candidates:z,chipCandidates:xe,pickerOpen:S,setPickerOpen:k,pickerContainerRef:N,onAdd:ae,onRemove:Y}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(fT,{trigger:R.trigger,results:R.results,highlightIndex:R.highlightIndex,anchorRef:E,onPick:R.pick}),l.jsx("textarea",{ref:E,value:c,onChange:J=>{f(J.target.value),h(J.target.selectionStart??J.target.value.length)},onSelect:J=>{h(J.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:J=>{R.handleKey(J)||J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),D())},disabled:x||$.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}}),s.length>=2&&L.length===0&&c.trim().length>0&&l.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void D(),disabled:!U,title:V??"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",!U&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(oC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),p&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:p})]})})})}function _Q({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:f}){return l.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(g=>g.agentId===m),p=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return l.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[l.jsx("span",{children:p}),l.jsx("button",{type:"button",onClick:()=>f(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:l.jsx(ss,{className:"h-3 w-3"})})]},m)}),l.jsxs("div",{ref:o,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>s(!a),title:"Add participant","aria-label":"Add participant",disabled:n.length===0,className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:n.length===0?"var(--fg-4)":"var(--fg-3)",cursor:n.length===0?"not-allowed":"pointer"},children:l.jsx(ba,{className:"h-3 w-3"})}),a&&n.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",left:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const m=Sb(n);return n.map(h=>l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>c(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(kb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function TQ(e,t){var o;const n=new Set(e.map(c=>c.agentId)),a=[...t].filter(c=>n.has(c.agentId)&&c.runtimeUpdatedAt).sort((c,f)=>(f.runtimeUpdatedAt??"").localeCompare(c.runtimeUpdatedAt??""))[0];if(a)return a.agentId;const s=t.find(c=>n.has(c.agentId)&&c.type==="personal_assistant");return s?s.agentId:((o=e[0])==null?void 0:o.agentId)??null}const AQ="first-tree-hub-images",RQ=1,jo="images";let Cf=null;function hT(){return Cf||(Cf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(AQ,RQ);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(jo)||n.createObjectStore(jo,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Cf)}async function OQ(e){const t=await hT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(jo,"readwrite"),o=s.objectStore(jo),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};o.put(c),s.oncomplete=()=>n(),s.onerror=()=>a(s.error??new Error("Image storage write failed")),s.onabort=()=>a(s.error??new Error("Image storage write aborted"))})}async function zQ(e){const t=await hT();return t?new Promise(n=>{const o=t.transaction(jo,"readonly").objectStore(jo).get(e);o.onsuccess=()=>{const c=o.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},o.onerror=()=>n(null)}):null}function MQ(e,t,n){return Ee.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:mT,setPrototypeOf:$k,isFrozen:DQ,getPrototypeOf:IQ,getOwnPropertyDescriptor:LQ}=Object;let{freeze:dr,seal:aa,create:Ql}=Object,{apply:Wy,construct:Jy}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});aa||(aa=function(t){return t});Wy||(Wy=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];return t.apply(n,s)});Jy||(Jy=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const Hu=Cn(Array.prototype.forEach),PQ=Cn(Array.prototype.lastIndexOf),Fk=Cn(Array.prototype.pop),qu=Cn(Array.prototype.push),UQ=Cn(Array.prototype.splice),sr=Array.isArray,Yu=Cn(String.prototype.toLowerCase),$g=Cn(String.prototype.toString),Hk=Cn(String.prototype.match),ql=Cn(String.prototype.replace),qk=Cn(String.prototype.indexOf),BQ=Cn(String.prototype.trim),$Q=Cn(Number.prototype.toString),FQ=Cn(Boolean.prototype.toString),Zk=typeof BigInt>"u"?null:Cn(BigInt.prototype.toString),Gk=typeof Symbol>"u"?null:Cn(Symbol.prototype.toString),rn=Cn(Object.prototype.hasOwnProperty),Zu=Cn(Object.prototype.toString),Hn=Cn(RegExp.prototype.test),Ef=HQ(TypeError);function Cn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return Wy(e,t,a)}}function HQ(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Jy(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yu;if($k&&$k(e,null),!sr(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const o=n(s);o!==s&&(DQ(t)||(t[a]=o),s=o)}e[s]=!0}return e}function qQ(e){for(let t=0;t<e.length;t++)rn(e,t)||(e[t]=null);return e}function xr(e){const t=Ql(null);for(const[n,a]of mT(e))rn(e,n)&&(sr(a)?t[n]=qQ(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=xr(a):t[n]=a);return t}function ZQ(e){switch(typeof e){case"string":return e;case"number":return $Q(e);case"boolean":return FQ(e);case"bigint":return Zk?Zk(e):"0";case"symbol":return Gk?Gk(e):"Symbol()";case"undefined":return Zu(e);case"function":case"object":{if(e===null)return Zu(e);const t=e,n=Kl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Zu(a)}return Zu(e)}default:return Zu(e)}}function Kl(e,t){for(;e!==null;){const a=LQ(e,t);if(a){if(a.get)return Cn(a.get);if(typeof a.value=="function")return Cn(a.value)}e=IQ(e)}function n(){return null}return n}function GQ(e){try{return Hn(e,""),!0}catch{return!1}}const Vk=dr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fg=dr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hg=dr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),VQ=dr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),qg=dr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),QQ=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qk=dr(["#text"]),Kk=dr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Zg=dr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Yk=dr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Nf=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),KQ=aa(/\{\{[\w\W]*|[\w\W]*\}\}/gm),YQ=aa(/<%[\w\W]*|[\w\W]*%>/gm),XQ=aa(/\$\{[\w\W]*/gm),WQ=aa(/^data-[\-\w.\u00B7-\uFFFF]+$/),JQ=aa(/^aria-[\-\w]+$/),pT=aa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),eK=aa(/^(?:\w+script|data):/i),tK=aa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gT=aa(/^html$/i),nK=aa(/^[a-z][.\w]*(-[.\w]+)+$/i);var Xk=Object.freeze({__proto__:null,ARIA_ATTR:JQ,ATTR_WHITESPACE:tK,CUSTOM_ELEMENT:nK,DATA_ATTR:WQ,DOCTYPE_NAME:gT,ERB_EXPR:YQ,IS_ALLOWED_URI:pT,IS_SCRIPT_OR_DATA:eK,MUSTACHE_EXPR:KQ,TMPLIT_EXPR:XQ});const Gu={element:1,text:3,progressingInstruction:7,comment:8,document:9},rK=function(){return typeof window>"u"?null:window},aK=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(a=n.getAttribute(s));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Wk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rK();const t=Pe=>yT(Pe);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Gu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:x,trustedTypes:w}=e,S=m.prototype,k=Kl(S,"cloneNode"),E=Kl(S,"remove"),C=Kl(S,"nextSibling"),N=Kl(S,"childNodes"),O=Kl(S,"parentNode");if(typeof c=="function"){const Pe=n.createElement("template");Pe.content&&Pe.content.ownerDocument&&(n=Pe.content.ownerDocument)}let z,L="";const{implementation:R,createNodeIterator:$,createDocumentFragment:U,getElementsByTagName:V}=n,{importNode:D}=a;let Y=Wk();t.isSupported=typeof mT=="function"&&typeof O=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ae,ERB_EXPR:xe,TMPLIT_EXPR:J,DATA_ATTR:X,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:te,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:Ae}=Xk;let{IS_ALLOWED_URI:M}=Xk,I=null;const P=We({},[...Vk,...Fg,...Hg,...qg,...Qk]);let _=null;const Z=We({},[...Kk,...Zg,...Yk,...Nf]);let Q=Object.seal(Ql(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ue=null,je=null;const we=Object.seal(Ql(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let pe=!0,De=!0,Ue=!1,dt=!0,ot=!1,re=!0,se=!1,ge=!1,Le=!1,zt=!1,Ft=!1,Ln=!1,fr=!0,hi=!1;const mi="user-content-";let on=!0,ua=!1,oe={},ye=null;const $e=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const nt=We({},["audio","video","img","source","image","track"]);let un=null;const tr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ht="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let at=Tt,nr=!1,Rn=null;const al=We({},[Ht,Lt,Tt],$g);let ca=We({},["mi","mo","mn","ms","mtext"]),da=We({},["annotation-xml"]);const za=We({},["title","style","font","a","script"]);let Gn=null;const Ma=["application/xhtml+xml","text/html"],wa="text/html";let qt=null,Ce=null;const et=n.createElement("form"),gn=function(F){return F instanceof RegExp||F instanceof Function},_r=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ce&&Ce===F)return;(!F||typeof F!="object")&&(F={}),F=xr(F),Gn=Ma.indexOf(F.PARSER_MEDIA_TYPE)===-1?wa:F.PARSER_MEDIA_TYPE,qt=Gn==="application/xhtml+xml"?$g:Yu,I=rn(F,"ALLOWED_TAGS")&&sr(F.ALLOWED_TAGS)?We({},F.ALLOWED_TAGS,qt):P,_=rn(F,"ALLOWED_ATTR")&&sr(F.ALLOWED_ATTR)?We({},F.ALLOWED_ATTR,qt):Z,Rn=rn(F,"ALLOWED_NAMESPACES")&&sr(F.ALLOWED_NAMESPACES)?We({},F.ALLOWED_NAMESPACES,$g):al,un=rn(F,"ADD_URI_SAFE_ATTR")&&sr(F.ADD_URI_SAFE_ATTR)?We(xr(tr),F.ADD_URI_SAFE_ATTR,qt):tr,Ve=rn(F,"ADD_DATA_URI_TAGS")&&sr(F.ADD_DATA_URI_TAGS)?We(xr(nt),F.ADD_DATA_URI_TAGS,qt):nt,ye=rn(F,"FORBID_CONTENTS")&&sr(F.FORBID_CONTENTS)?We({},F.FORBID_CONTENTS,qt):$e,ue=rn(F,"FORBID_TAGS")&&sr(F.FORBID_TAGS)?We({},F.FORBID_TAGS,qt):xr({}),je=rn(F,"FORBID_ATTR")&&sr(F.FORBID_ATTR)?We({},F.FORBID_ATTR,qt):xr({}),oe=rn(F,"USE_PROFILES")?F.USE_PROFILES&&typeof F.USE_PROFILES=="object"?xr(F.USE_PROFILES):F.USE_PROFILES:!1,pe=F.ALLOW_ARIA_ATTR!==!1,De=F.ALLOW_DATA_ATTR!==!1,Ue=F.ALLOW_UNKNOWN_PROTOCOLS||!1,dt=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ot=F.SAFE_FOR_TEMPLATES||!1,re=F.SAFE_FOR_XML!==!1,se=F.WHOLE_DOCUMENT||!1,zt=F.RETURN_DOM||!1,Ft=F.RETURN_DOM_FRAGMENT||!1,Ln=F.RETURN_TRUSTED_TYPE||!1,Le=F.FORCE_BODY||!1,fr=F.SANITIZE_DOM!==!1,hi=F.SANITIZE_NAMED_PROPS||!1,on=F.KEEP_CONTENT!==!1,ua=F.IN_PLACE||!1,M=GQ(F.ALLOWED_URI_REGEXP)?F.ALLOWED_URI_REGEXP:pT,at=typeof F.NAMESPACE=="string"?F.NAMESPACE:Tt,ca=rn(F,"MATHML_TEXT_INTEGRATION_POINTS")&&F.MATHML_TEXT_INTEGRATION_POINTS&&typeof F.MATHML_TEXT_INTEGRATION_POINTS=="object"?xr(F.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),da=rn(F,"HTML_INTEGRATION_POINTS")&&F.HTML_INTEGRATION_POINTS&&typeof F.HTML_INTEGRATION_POINTS=="object"?xr(F.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const me=rn(F,"CUSTOM_ELEMENT_HANDLING")&&F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING=="object"?xr(F.CUSTOM_ELEMENT_HANDLING):Ql(null);if(Q=Ql(null),rn(me,"tagNameCheck")&&gn(me.tagNameCheck)&&(Q.tagNameCheck=me.tagNameCheck),rn(me,"attributeNameCheck")&&gn(me.attributeNameCheck)&&(Q.attributeNameCheck=me.attributeNameCheck),rn(me,"allowCustomizedBuiltInElements")&&typeof me.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=me.allowCustomizedBuiltInElements),ot&&(De=!1),Ft&&(zt=!0),oe&&(I=We({},Qk),_=Ql(null),oe.html===!0&&(We(I,Vk),We(_,Kk)),oe.svg===!0&&(We(I,Fg),We(_,Zg),We(_,Nf)),oe.svgFilters===!0&&(We(I,Hg),We(_,Zg),We(_,Nf)),oe.mathMl===!0&&(We(I,qg),We(_,Yk),We(_,Nf))),we.tagCheck=null,we.attributeCheck=null,rn(F,"ADD_TAGS")&&(typeof F.ADD_TAGS=="function"?we.tagCheck=F.ADD_TAGS:sr(F.ADD_TAGS)&&(I===P&&(I=xr(I)),We(I,F.ADD_TAGS,qt))),rn(F,"ADD_ATTR")&&(typeof F.ADD_ATTR=="function"?we.attributeCheck=F.ADD_ATTR:sr(F.ADD_ATTR)&&(_===Z&&(_=xr(_)),We(_,F.ADD_ATTR,qt))),rn(F,"ADD_URI_SAFE_ATTR")&&sr(F.ADD_URI_SAFE_ATTR)&&We(un,F.ADD_URI_SAFE_ATTR,qt),rn(F,"FORBID_CONTENTS")&&sr(F.FORBID_CONTENTS)&&(ye===$e&&(ye=xr(ye)),We(ye,F.FORBID_CONTENTS,qt)),rn(F,"ADD_FORBID_CONTENTS")&&sr(F.ADD_FORBID_CONTENTS)&&(ye===$e&&(ye=xr(ye)),We(ye,F.ADD_FORBID_CONTENTS,qt)),on&&(I["#text"]=!0),se&&We(I,["html","head","body"]),I.table&&(We(I,["tbody"]),delete ue.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=F.TRUSTED_TYPES_POLICY,L=z.createHTML("")}else z===void 0&&(z=aK(w,s)),z!==null&&typeof L=="string"&&(L=z.createHTML(""));dr&&dr(F),Ce=F},pi=We({},[...Fg,...Hg,...VQ]),gs=We({},[...qg,...QQ]),Hc=function(F){let me=O(F);(!me||!me.tagName)&&(me={namespaceURI:at,tagName:"template"});const Ne=Yu(F.tagName),bt=Yu(me.tagName);return Rn[F.namespaceURI]?F.namespaceURI===Lt?me.namespaceURI===Tt?Ne==="svg":me.namespaceURI===Ht?Ne==="svg"&&(bt==="annotation-xml"||ca[bt]):!!pi[Ne]:F.namespaceURI===Ht?me.namespaceURI===Tt?Ne==="math":me.namespaceURI===Lt?Ne==="math"&&da[bt]:!!gs[Ne]:F.namespaceURI===Tt?me.namespaceURI===Lt&&!da[bt]||me.namespaceURI===Ht&&!ca[bt]?!1:!gs[Ne]&&(za[Ne]||!pi[Ne]):!!(Gn==="application/xhtml+xml"&&Rn[F.namespaceURI]):!1},rr=function(F){qu(t.removed,{element:F});try{O(F).removeChild(F)}catch{E(F)}},fa=function(F,me){try{qu(t.removed,{attribute:me.getAttributeNode(F),from:me})}catch{qu(t.removed,{attribute:null,from:me})}if(me.removeAttribute(F),F==="is")if(zt||Ft)try{rr(me)}catch{}else try{me.setAttribute(F,"")}catch{}},Io=function(F){let me=null,Ne=null;if(Le)F="<remove></remove>"+F;else{const Xt=Hk(F,/^[\r\n\t ]+/);Ne=Xt&&Xt[0]}Gn==="application/xhtml+xml"&&at===Tt&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const bt=z?z.createHTML(F):F;if(at===Tt)try{me=new x().parseFromString(bt,Gn)}catch{}if(!me||!me.documentElement){me=R.createDocument(at,"template",null);try{me.documentElement.innerHTML=nr?L:bt}catch{}}const ft=me.body||me.documentElement;return F&&Ne&&ft.insertBefore(n.createTextNode(Ne),ft.childNodes[0]||null),at===Tt?V.call(me,se?"html":"body")[0]:se?me.documentElement:ft},Lo=function(F){return $.call(F.ownerDocument||F,F,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},$r=function(F){return F instanceof g&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof p)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},cn=function(F){return typeof f=="function"&&F instanceof f};function Zt(Pe,F,me){Hu(Pe,Ne=>{Ne.call(t,F,me,Ce)})}const Da=function(F){let me=null;if(Zt(Y.beforeSanitizeElements,F,null),$r(F))return rr(F),!0;const Ne=qt(F.nodeName);if(Zt(Y.uponSanitizeElement,F,{tagName:Ne,allowedTags:I}),re&&F.hasChildNodes()&&!cn(F.firstElementChild)&&Hn(/<[/\w!]/g,F.innerHTML)&&Hn(/<[/\w!]/g,F.textContent)||re&&F.namespaceURI===Tt&&Ne==="style"&&cn(F.firstElementChild)||F.nodeType===Gu.progressingInstruction||re&&F.nodeType===Gu.comment&&Hn(/<[/\w]/g,F.data))return rr(F),!0;if(ue[Ne]||!(we.tagCheck instanceof Function&&we.tagCheck(Ne))&&!I[Ne]){if(!ue[Ne]&&qc(Ne)&&(Q.tagNameCheck instanceof RegExp&&Hn(Q.tagNameCheck,Ne)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(Ne)))return!1;if(on&&!ye[Ne]){const bt=O(F)||F.parentNode,ft=N(F)||F.childNodes;if(ft&&bt){const Xt=ft.length;for(let Pn=Xt-1;Pn>=0;--Pn){const yn=k(ft[Pn],!0);bt.insertBefore(yn,C(F))}}}return rr(F),!0}return F instanceof m&&!Hc(F)||(Ne==="noscript"||Ne==="noembed"||Ne==="noframes")&&Hn(/<\/no(script|embed|frames)/i,F.innerHTML)?(rr(F),!0):(ot&&F.nodeType===Gu.text&&(me=F.textContent,Hu([ae,xe,J],bt=>{me=ql(me,bt," ")}),F.textContent!==me&&(qu(t.removed,{element:F.cloneNode()}),F.textContent=me)),Zt(Y.afterSanitizeElements,F,null),!1)},il=function(F,me,Ne){if(je[me]||fr&&(me==="id"||me==="name")&&(Ne in n||Ne in et))return!1;const bt=_[me]||we.attributeCheck instanceof Function&&we.attributeCheck(me,F);if(!(De&&!je[me]&&Hn(X,me))){if(!(pe&&Hn(q,me))){if(!bt||je[me]){if(!(qc(F)&&(Q.tagNameCheck instanceof RegExp&&Hn(Q.tagNameCheck,F)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(F))&&(Q.attributeNameCheck instanceof RegExp&&Hn(Q.attributeNameCheck,me)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(me,F))||me==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&Hn(Q.tagNameCheck,Ne)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(Ne))))return!1}else if(!un[me]){if(!Hn(M,ql(Ne,ke,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&F!=="script"&&qk(Ne,"data:")===0&&Ve[F])){if(!(Ue&&!Hn(te,ql(Ne,ke,"")))){if(Ne)return!1}}}}}}return!0},Lh=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),qc=function(F){return!Lh[Yu(F)]&&Hn(Ae,F)},Po=function(F){Zt(Y.beforeSanitizeAttributes,F,null);const{attributes:me}=F;if(!me||$r(F))return;const Ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let bt=me.length;for(;bt--;){const ft=me[bt],{name:Xt,namespaceURI:Pn,value:yn}=ft,On=qt(Xt),Uo=yn;let dn=Xt==="value"?Uo:BQ(Uo);if(Ne.attrName=On,Ne.attrValue=dn,Ne.keepAttr=!0,Ne.forceKeepAttr=void 0,Zt(Y.uponSanitizeAttribute,F,Ne),dn=Ne.attrValue,hi&&(On==="id"||On==="name")&&qk(dn,mi)!==0&&(fa(Xt,F),dn=mi+dn),re&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,dn)){fa(Xt,F);continue}if(On==="attributename"&&Hk(dn,"href")){fa(Xt,F);continue}if(Ne.forceKeepAttr)continue;if(!Ne.keepAttr){fa(Xt,F);continue}if(!dt&&Hn(/\/>/i,dn)){fa(Xt,F);continue}ot&&Hu([ae,xe,J],Zc=>{dn=ql(dn,Zc," ")});const Bo=qt(F.nodeName);if(!il(Bo,On,dn)){fa(Xt,F);continue}if(z&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Pn)switch(w.getAttributeType(Bo,On)){case"TrustedHTML":{dn=z.createHTML(dn);break}case"TrustedScriptURL":{dn=z.createScriptURL(dn);break}}if(dn!==Uo)try{Pn?F.setAttributeNS(Pn,Xt,dn):F.setAttribute(Xt,dn),$r(F)?rr(F):Fk(t.removed)}catch{fa(Xt,F)}}Zt(Y.afterSanitizeAttributes,F,null)},gi=function(F){let me=null;const Ne=Lo(F);for(Zt(Y.beforeSanitizeShadowDOM,F,null);me=Ne.nextNode();)Zt(Y.uponSanitizeShadowNode,me,null),Da(me),Po(me),me.content instanceof o&&gi(me.content);Zt(Y.afterSanitizeShadowDOM,F,null)};return t.sanitize=function(Pe){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,Ne=null,bt=null,ft=null;if(nr=!Pe,nr&&(Pe="<!-->"),typeof Pe!="string"&&!cn(Pe)&&(Pe=ZQ(Pe),typeof Pe!="string"))throw Ef("dirty is not a string, aborting");if(!t.isSupported)return Pe;if(ge||_r(F),t.removed=[],typeof Pe=="string"&&(ua=!1),ua){const yn=Pe.nodeName;if(typeof yn=="string"){const On=qt(yn);if(!I[On]||ue[On])throw Ef("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof f)me=Io("<!---->"),Ne=me.ownerDocument.importNode(Pe,!0),Ne.nodeType===Gu.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?me=Ne:me.appendChild(Ne);else{if(!zt&&!ot&&!se&&Pe.indexOf("<")===-1)return z&&Ln?z.createHTML(Pe):Pe;if(me=Io(Pe),!me)return zt?null:Ln?L:""}me&&Le&&rr(me.firstChild);const Xt=Lo(ua?Pe:me);for(;bt=Xt.nextNode();)Da(bt),Po(bt),bt.content instanceof o&&gi(bt.content);if(ua)return Pe;if(zt){if(ot){me.normalize();let yn=me.innerHTML;Hu([ae,xe,J],On=>{yn=ql(yn,On," ")}),me.innerHTML=yn}if(Ft)for(ft=U.call(me.ownerDocument);me.firstChild;)ft.appendChild(me.firstChild);else ft=me;return(_.shadowroot||_.shadowrootmode)&&(ft=D.call(a,ft,!0)),ft}let Pn=se?me.outerHTML:me.innerHTML;return se&&I["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&Hn(gT,me.ownerDocument.doctype.name)&&(Pn="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
402
- `+Pn),ot&&Hu([ae,xe,J],yn=>{Pn=ql(Pn,yn," ")}),z&&Ln?z.createHTML(Pn):Pn},t.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_r(Pe),ge=!0},t.clearConfig=function(){Ce=null,ge=!1},t.isValidAttribute=function(Pe,F,me){Ce||_r({});const Ne=qt(Pe),bt=qt(F);return il(Ne,bt,me)},t.addHook=function(Pe,F){typeof F=="function"&&qu(Y[Pe],F)},t.removeHook=function(Pe,F){if(F!==void 0){const me=PQ(Y[Pe],F);return me===-1?void 0:UQ(Y[Pe],me,1)[0]}return Fk(Y[Pe])},t.removeHooks=function(Pe){Y[Pe]=[]},t.removeAllHooks=function(){Y=Wk()},t}var iK=yT();function sK({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:iK.sanitize(e.preview,{USE_PROFILES:{html:!0}}),[e.preview,t]);return l.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:o,className:ze("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",a?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:n?"var(--accent)":"var(--border)",background:n?"var(--bg-active)":"var(--bg-raised)"},children:[e.preview?t==="html"&&c?l.jsx("div",{dangerouslySetInnerHTML:{__html:c},className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"}}):t==="markdown"?l.jsx("div",{className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"},children:l.jsx(Mh,{children:e.preview})}):null:null,l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const Jl="__free_text__";function Vu(){return{picked:[],freeText:""}}function Jk(e,t){if(t.picked.includes(Jl)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function lK({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const E={};for(const C of n.questions)E[C.question]=Vu();return E});b.useEffect(()=>{if(!a)return;const E={};for(const C of n.questions){const N=a.answers[C.question];if(!N){E[C.question]=Vu();continue}const O=new Set(C.options.map(R=>R.label)),z=C.multiSelect?N.split(/,\s*/u):[N],L=z.filter(R=>O.has(R));L.length===z.length&&L.length>0?E[C.question]={picked:L,freeText:""}:E[C.question]={picked:[Jl],freeText:N}}h(E)},[a,n.questions]);const p=mn(),[g,x]=b.useState(null),w=wt({mutationFn:async E=>MQ(e,n.correlationId,E),onSuccess:()=>{x(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:E=>{x(E instanceof Error?E.message:String(E))}}),S=b.useCallback(()=>{x(null);const E={};for(const C of n.questions){const N=m[C.question]??Vu(),O=Jk(C,N);if(O===null){x(`Please answer "${C.question}" before submitting.`);return}E[C.question]=O}w.mutate(E)},[n.questions,m,w]),k=b.useMemo(()=>n.questions.every(E=>{const C=m[E.question]??Vu();return Jk(E,C)!==null}),[n.questions,m]);return l.jsxs("div",{className:ze("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(E=>l.jsx(oK,{question:E,previewFormat:n.previewFormat,selection:m[E.question]??Vu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:C=>h(N=>({...N,[E.question]:C}))},E.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(ve,{type:"button",disabled:!k||w.isPending,onClick:S,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function oK({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const f=b.useRef(null),m=n.picked.includes(Jl);b.useEffect(()=>{var p;m&&!s&&((p=f.current)==null||p.focus())},[m,s]);const h=b.useCallback(p=>{const g=n.picked.includes(p);let x;e.multiSelect?x=g?n.picked.filter(w=>w!==p):[...n.picked,p]:x=g?[]:[p],c({...n,picked:x})},[e.multiSelect,n,c]);return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(p=>l.jsx(sK,{option:p,previewFormat:t,selected:n.picked.includes(p.label),disabled:s,showCheckmark:o,onToggle:()=>h(p.label)},p.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(p=>p!==Jl):[...n.picked,Jl]:m?[]:[Jl],freeText:n.freeText}),className:ze("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?l.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:p=>c({...n,freeText:p.target.value}),onClick:p=>p.stopPropagation(),onKeyDown:p=>{p.key==="Enter"&&!p.metaKey&&!p.ctrlKey&&p.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function uK(e){return AB.safeParse(e).success}function vT(e){return RB.safeParse(e).success}function cK(e){let t=-1;for(const s of e)s.kind==="turn_end"&&s.seq>t&&(t=s.seq);const n=e.filter(s=>s.kind==="turn_end"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const o=ej(s.payload);if(!o)continue;const c=a.get(o)??-1;s.seq>c&&a.set(o,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const o=ej(s.payload);return o?a.get(o)===s.seq:!0})}function ej(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Do(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var o;return((o=n.find(c=>c.type===s))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function dK(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function tj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function fK({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function hK({event:e}){const t=gM(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",s=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",o=n?"failed":a?"using":"used";return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[a?l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:s,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):l.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),l.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?tj(t.args):void 0,children:[l.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",l.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?l.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",tj(t.args),")"]}):null,t.durationMs!==void 0&&!a?l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",dK(t.durationMs)]}):null]})]})}function mK({event:e,agentNameFn:t,agentId:n}){const a=vM(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[l.jsx(Ih,{name:s,isSelf:!1}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function pK({event:e}){return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0}}),l.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)})]})}function gK({event:e}){const t=yM(e.payload),n=Do(e.createdAt);return l.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[l.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),l.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Ih({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return l.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?n:l.jsx(Ic,{width:9,height:10,style:{color:"var(--accent)"}})})}function yK({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:a,isSelf:s}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(fK,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&vK(e.content)?l.jsx("img",{src:`data:${e.content.mimeType};base64,${e.content.data}`,alt:e.content.filename??"image",style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):e.format==="file"&&bK(e.content)?l.jsx(xK,{content:e.content}):e.format==="text"?l.jsx(Mh,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):l.jsx("pre",{className:"mono text-label",style:{background:"var(--bg-sunken)",padding:8,borderRadius:"var(--radius-input)",overflow:"auto",maxHeight:160},children:JSON.stringify(e.content,null,2)})})]})]})}function vK(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.data=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")}function bK(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.imageId=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")&&typeof t.filename=="string"}function xK({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return zQ(e.imageId).then(s=>{a||n(s?{kind:"hit",src:`data:${s.mimeType};base64,${s.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?l.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function wK({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:o}){const c=o(e.senderId);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:c,isSelf:!1}),l.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)})]}),l.jsx(lK,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function SK({msg:e,agentNameFn:t}){const n=vT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([o,c])=>`${o.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:a,isSelf:!0}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:s})]})]})}function kK({metadata:e}){if(!e||e.source!=="github")return null;const t=typeof e.entityUrl=="string"?e.entityUrl:null;return t?l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:"View on GitHub",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:"0 var(--sp-1)",textDecoration:"none"},children:l.jsx($z,{className:"h-3.5 w-3.5"})}):null}function nj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var ot;const o=mn(),c=gh(),f=Dv(),{agentId:m}=gt(),[h,p]=b.useState(""),[g,x]=b.useState(0),[w,S]=b.useState([]),[k,E]=b.useState(!1),[C,N]=b.useState(null),O=b.useRef(null),z=b.useRef(null),L=b.useRef(null),R=b.useRef(!1),$=b.useRef(new Set);b.useEffect(()=>{R.current=!1},[t]);const{data:U}=Ye({queryKey:["chat-messages",t],queryFn:()=>SQ(t,{limit:50}),refetchInterval:5e3}),{data:V}=Ye({queryKey:["session-events",e,t],queryFn:()=>bM(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:D}=Ye({queryKey:["chat-detail",t],queryFn:()=>cT(t),enabled:!!t}),{data:Y}=Ye({queryKey:["activity"],queryFn:zc,refetchInterval:15e3}),ae=wt({mutationFn:re=>ko(t,re),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:WS(e)})}}),xe=b.useCallback(re=>{const ge=re.filter(Ft=>Ft.type.startsWith("image/"));if(ge.length===0)return;const Le=ge.find(Ft=>Ft.size>5242880);if(Le){N(`Image too large (${(Le.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const zt=ge.map(Ft=>({id:crypto.randomUUID(),file:Ft,previewUrl:URL.createObjectURL(Ft)}));S(Ft=>[...Ft,...zt]),N(null)},[]),J=b.useCallback(re=>{S(se=>{const ge=se.find(Le=>Le.id===re);return ge&&URL.revokeObjectURL(ge.previewUrl),se.filter(Le=>Le.id!==re)})},[]),X=async()=>{const re=h.trim(),se=w;if(!(!re&&se.length===0)&&!k&&!(pe&&De.length===0)){if(Ue.length>0)try{await uT(t,{participantIds:Ue}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(ge){N(ge instanceof Error?ge.message:"Failed to add participants");return}if(se.length>0){E(!0),N(null);try{for(const ge of se){const Le=await wQ(ge.file),zt=crypto.randomUUID();await OQ({imageId:zt,base64:Le,mimeType:ge.file.type}),await xQ(t,{data:Le,mimeType:ge.file.type,filename:ge.file.name,size:ge.file.size,imageId:zt}),URL.revokeObjectURL(ge.previewUrl)}S([]),re&&await ko(t,re),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:WS(e)})}catch(ge){N(ge instanceof Error?ge.message:"Failed to send image")}finally{E(!1)}return}ae.mutate(re)}},[q,te]=b.useState(!1),[ke,Ae]=b.useState(""),M=b.useRef(null);b.useEffect(()=>{var re;q&&((re=M.current)==null||re.focus())},[q]);const I=wt({mutationFn:re=>bQ(t,re),onSuccess:()=>{te(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),P=()=>{const re=ke.trim();I.mutate(re.length>0?re:null)},_=b.useMemo(()=>{const re=(U==null?void 0:U.items)??[],se=cK((V==null?void 0:V.items)??[]),ge=[...re.map(Le=>({kind:"message",at:Le.createdAt,key:`m-${Le.id}`,data:Le})),...se.map(Le=>({kind:"event",at:Le.createdAt,key:`e-${Le.id}`,data:Le}))];return ge.sort((Le,zt)=>Le.at.localeCompare(zt.at)),ge},[U,V]),Z=b.useMemo(()=>{const re=new Map;for(const se of(U==null?void 0:U.items)??[])se.format==="question_answer"&&vT(se.content)&&re.set(se.content.correlationId,se.content);return re},[U]),Q=_.length;b.useEffect(()=>{var re;Q>0&&((re=L.current)==null||re.scrollIntoView({behavior:"smooth"}))},[Q]);const ue=c(e),je=b.useMemo(()=>{var re;return new Set(((re=D==null?void 0:D.participants)==null?void 0:re.map(se=>se.agentId))??[])},[D==null?void 0:D.participants]),we=b.useMemo(()=>{const re=new Set;for(const ge of(D==null?void 0:D.participants)??[])re.add(ge.agentId);for(const ge of(Y==null?void 0:Y.agents)??[])re.add(ge.agentId);re.size===0&&re.add(e);const se=[];for(const ge of re){if(ge===m)continue;const Le=f(ge);!Le||!Le.name||se.push({agentId:ge,name:Le.name,displayName:Le.displayName})}return se},[D==null?void 0:D.participants,Y==null?void 0:Y.agents,e,f,m]),pe=b.useMemo(()=>{if(!D)return!1;if(D.type==="group")return!0;const re=D.participants.some(se=>se.agentId===m);return D.type==="direct"&&!re&&D.participants.length>=2},[D,m]);b.useEffect(()=>{if(n||$.current.has(t)||!U||!V||!D||_.length>0||h.length>0||pe||ue===e)return;const re=`Hi ${ue}! What can you help with?`;p(re),x(re.length),$.current.add(t),requestAnimationFrame(()=>{const se=z.current;se&&(se.focus(),se.setSelectionRange(re.length,re.length))})},[t,e,U,V,D,_.length,h.length,ue,pe,n]);const De=b.useMemo(()=>{const re=we.map(se=>({agentId:se.agentId,name:se.name}));return fN(h,re)},[h,we]),Ue=b.useMemo(()=>je.size===0?[]:De.filter(re=>!je.has(re)),[De,je]),dt=dT({value:h,cursor:g,candidates:we,disabled:ae.isPending||k,onSelect:re=>{p(re.text),x(re.cursor),requestAnimationFrame(()=>{const se=z.current;se&&(se.focus(),se.setSelectionRange(re.cursor,re.cursor))})}});return l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[l.jsxs("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:[n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(D==null?void 0:D.title)??a??"…"}),l.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):q?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:M,value:ke,onChange:re=>Ae(re.target.value),onKeyDown:re=>{re.key==="Enter"?(re.preventDefault(),P()):re.key==="Escape"&&(re.preventDefault(),te(!1))},disabled:I.isPending,maxLength:500,placeholder:(D==null?void 0:D.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),l.jsx("button",{type:"button",onClick:P,disabled:I.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>te(!1),disabled:I.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(ss,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{Ae((D==null?void 0:D.topic)??""),te(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(D==null?void 0:D.title)??"…"}),l.jsx(kK,{metadata:D==null?void 0:D.metadata})]}),l.jsx(jK,{chatId:t,participantIds:((ot=D==null?void 0:D.participants)==null?void 0:ot.map(re=>re.agentId))??[e],candidates:we,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:l.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[Q===0&&l.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[l.jsx(jv,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),l.jsx("div",{className:"flex flex-col",style:{gap:4},children:_.map(re=>{if(re.kind==="event"){const ge=re.data;switch(ge.kind){case"tool_call":return l.jsx(hK,{event:ge},re.key);case"assistant_text":return l.jsx(mK,{event:ge,agentId:e,agentNameFn:c},re.key);case"thinking":return l.jsx(pK,{event:ge},re.key);case"error":return l.jsx(gK,{event:ge},re.key);default:return null}}const se=re.data;if(se.format==="question"&&uK(se.content)){const ge=Z.get(se.content.correlationId)??null,Le=ge?"answered":"pending";return l.jsx(wK,{msg:se,chatId:t,content:se.content,answer:ge,status:Le,agentNameFn:c},re.key)}return se.format==="question_answer"?l.jsx(SK,{msg:se,agentNameFn:c},re.key):l.jsx(yK,{msg:se,myAgentId:m,agentNameFn:c},re.key)})}),l.jsx("div",{ref:L})]})}),l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:l.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[l.jsx(dC,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&l.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&l.jsx(ve,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:re=>re.preventDefault(),onDrop:re=>{re.preventDefault(),xe(Array.from(re.dataTransfer.files))},children:[w.length>0&&l.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:w.map(re=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:re.previewUrl,alt:re.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>J(re.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:l.jsx(ss,{className:"h-2 w-2"})})]},re.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(fT,{trigger:dt.trigger,results:dt.results,highlightIndex:dt.highlightIndex,anchorRef:z,onPick:dt.pick}),l.jsx("textarea",{ref:z,value:h,onChange:re=>{p(re.target.value),x(re.target.selectionStart??re.target.value.length)},onSelect:re=>{x(re.currentTarget.selectionStart??h.length)},onFocus:()=>{pe&&(R.current||h.length>0||we.length===0||(R.current=!0,p("@"),x(1),requestAnimationFrame(()=>{const re=z.current;re&&re.setSelectionRange(1,1)})))},onPaste:re=>{const se=Array.from(re.clipboardData.files);se.length>0&&(re.preventDefault(),xe(se))},placeholder:pe?"Type @ to pick a recipient, then your message":`Message @${ue} · / for commands · @ to mention`,rows:2,onKeyDown:re=>{dt.handleKey(re)||re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),X())},disabled:ae.isPending||k,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}})]}),l.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[l.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[l.jsx("button",{type:"button",onClick:()=>{const re=z.current;if(!re)return;const se=re.selectionStart??h.length,ge=re.selectionEnd??se,Le=`${h.slice(0,se)}@${h.slice(ge)}`;p(Le),x(se+1),requestAnimationFrame(()=>{re.focus(),re.setSelectionRange(se+1,se+1)})},title:"Mention an agent (or type @)",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(_z,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var re;return(re=O.current)==null?void 0:re.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(i3,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:re=>{re.target.files&&(xe(Array.from(re.target.files)),re.target.value="")}})]}),l.jsxs("span",{className:"flex items-center",style:{gap:8},children:[k&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:X,disabled:ae.isPending||k||!h.trim()&&w.length===0||pe&&De.length===0,title:pe&&De.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",(ae.isPending||k||!h.trim()&&w.length===0||pe&&De.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(oC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(ae.isError||C)&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:C??(ae.error instanceof Error?ae.error.message:"Failed to send")})]})})})]})}function jK({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,f]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{if(!c)return;const g=x=>{m.current&&(m.current.contains(x.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);const h=wt({mutationFn:g=>uT(e,{participantIds:[g]}),onSuccess:()=>{f(!1),s()}}),p=b.useMemo(()=>n.filter(g=>!t.includes(g.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(g=>{const x=a(g),w=(x==null?void 0:x.displayName)??(x==null?void 0:x.name)??g.slice(0,8);return l.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},g)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>f(!c),disabled:p.length===0||h.isPending,title:p.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:p.length===0?"var(--fg-4)":"var(--fg-3)",cursor:p.length===0?"not-allowed":"pointer"},children:l.jsx(ba,{className:"h-3 w-3"})}),c&&p.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const g=Sb(p);return p.map(x=>l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:x.name?`@${x.name}`:void 0,onClick:()=>h.mutate(x.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(kb,{candidate:x,ambiguous:g})},x.agentId))})()})]})]})}function rj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function CK(e,t){var s;const n=e.filter(o=>o.agentId!==t),a=n.find(o=>o.type!==void 0&&o.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function EK({chatId:e}){const t=mn(),{agentId:n}=gt(),a=b.useRef(new Map),{data:s}=Ye({queryKey:["chat-detail",e],queryFn:()=>cT(e),enabled:!!e}),{data:o}=Ye({queryKey:["me","chats","all"],queryFn:()=>th({filter:"all"}),refetchInterval:3e4}),{data:c}=Ye({queryKey:["me","chats","watching"],queryFn:()=>th({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>rj(o==null?void 0:o.rows,e)??rj(c==null?void 0:c.rows,e)??null,[o,c,e]),m=b.useMemo(()=>f?f.participants.map(k=>({agentId:k.agentId,type:k.type})):s?s.participants.map(k=>({agentId:k.agentId,type:void 0})):[],[f,s]),h=b.useMemo(()=>CK(m,n),[m,n]),g=wt({mutationFn:()=>mQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,x=(f==null?void 0:f.lastMessageAt)??"";b.useEffect(()=>{!f||a.current.get(e)===x||(a.current.set(e,x),g())},[e,f,x,g]);const w=wt({mutationFn:()=>pQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),S=(f==null?void 0:f.membershipKind)==="watching";return h?S?l.jsx(nj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>w.mutate(),joining:w.isPending,error:w.isError?w.error instanceof Error?w.error.message:"Failed to join":null}}):l.jsx(nj,{agentId:h,chatId:e}):l.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:l.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[l.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),l.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function NK(){return l.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:l.jsxs("div",{className:"text-center max-w-sm",children:[l.jsx(Ic,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),l.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),l.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}async function ui(e,t){try{await Ee.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function _K({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(null),E=b.useRef(null);b.useEffect(()=>{(async()=>{try{const z=await Ee.get("/me/organizations");a(z)}catch(z){k(z instanceof Error?z.message:"Failed to load your team")}finally{w(!0)}})()},[]),b.useEffect(()=>{var L;const z=((L=n.find(R=>R.id===e))==null?void 0:L.displayName)??"";o(z),f(z)},[n,e]),b.useEffect(()=>{const z=E.current;if(!z||!c)return;z.focus();const L=z.value.length;z.setSelectionRange(L,L)},[c]);const C=s.trim(),N=C.length>0&&!m&&x&&!S,O=b.useCallback(async z=>{if(z==null||z.preventDefault(),!(!N||!e)){g(null);try{C!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),ui("team_renamed")),t()}catch(L){g(L instanceof Error?L.message:"Failed to rename team")}finally{h(!1)}}},[N,e,C,c,t]);return l.jsxs("form",{onSubmit:O,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),l.jsx("input",{ref:E,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:z=>o(z.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:z=>{z.currentTarget.style.borderColor="var(--accent)"},onBlur:z=>{z.currentTarget.style.borderColor="var(--border)"}})]}),p||S?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p??`Couldn't load your team — ${S}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(ve,{type:"submit",disabled:!N,children:[l.jsx("span",{children:"Continue"}),l.jsx(lC,{className:"h-4 w-4"})]})})]})}function jb(){return l.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function is({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return l.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[l.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||s?"var(--accent)":"var(--fg-4)",zIndex:1},children:s?l.jsx(cr,{className:"h-3 w-3"}):e}),l.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const TK=3e4,AK=1e3,RK=3e3;function OK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function zK({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var je;const s=_n(),o=sz(e,t),c=oz(o),f=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=f?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,p]=b.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[g,x]=b.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,S]=b.useState(null),[k,E]=b.useState(null),[C,N]=b.useState(null),[O,z]=b.useState(()=>f),[L,R]=b.useState(()=>m),[$,U]=b.useState([]),[V,D]=b.useState("form"),[Y,ae]=b.useState(null),xe=b.useRef(null),J=b.useRef(null),X=b.useRef(null),q=b.useRef(0);b.useEffect(()=>()=>{J.current&&(J.current.cancelled=!0)},[]),b.useEffect(()=>{uz(o,{displayName:h,selectedRuntime:g,connectToken:O,connectTokenExpiresAt:L})},[o,h,g,O,L]),b.useEffect(()=>{(async()=>{try{const we=await Ee.get("/me/organizations");U(we)}catch{}})()},[]),b.useEffect(()=>{if(V!=="form")return;let we=!1;const pe=async()=>{const Ue=++q.current;try{const dt=await ls();if(we||Ue!==q.current)return;const re=dt.filter(se=>se.status==="connected").sort((se,ge)=>ge.lastSeenAt.localeCompare(se.lastSeenAt))[0]??null;if(S(se=>(se==null?void 0:se.id)===(re==null?void 0:re.id)?se:re),re){X.current!==re.id&&(X.current=null,N(null),E(null));try{const se=await dh(re.id);if(we||Ue!==q.current)return;X.current=re.id,N(re.id),E(se.capabilities)}catch{}}else X.current=null,N(null),E(null)}catch{}};pe();const De=setInterval(pe,RK);return()=>{we=!0,clearInterval(De)}},[V]),b.useEffect(()=>{if(w)return;if(O&&L&&L>Date.now()){const pe=Math.max(L-Date.now(),0),De=window.setTimeout(()=>{z(null),R(null)},pe);return()=>window.clearTimeout(De)}O&&(z(null),R(null));let we=!1;return(async()=>{try{const pe=await Ee.post("/me/connect-tokens",{});we||(z(pe.token),R(Date.now()+pe.expiresIn*1e3))}catch(pe){we||ae(pe instanceof Error?pe.message:"Failed to generate connect token")}})(),()=>{we=!0}},[w,O,L]);const te=w&&C===w.id?k:null;b.useEffect(()=>{x(we=>{var De;if(!te)return we;const pe=MK(te);return we&&pe&&Object.keys(te).includes(we)&&((De=te[we])==null?void 0:De.state)==="ok"?we:pe})},[te]);const ke=te?Object.entries(te).filter(([,we])=>we.state==="ok").map(([we])=>we):[],Ae=((je=$.find(we=>we.id===e))==null?void 0:je.displayName)??"",M=h.trim(),I=M||"your agent",P=O?`npm install -g @agent-team-foundation/first-tree-hub
403
- first-tree-hub connect ${O}`:null,_=b.useCallback(async we=>{J.current&&(J.current.cancelled=!0);const pe={cancelled:!1};J.current=pe;const De=Date.now();for(;!pe.cancelled;){let Ue=!1;try{const dt=await Ee.get(`/agents/${encodeURIComponent(we)}/client-status`);if(pe.cancelled)return;Ue=dt.online===!0}catch{if(pe.cancelled)return}if(Ue){cz(o);try{await a()}catch{}if(pe.cancelled)return;s("/",{replace:!0});return}if(Date.now()-De>TK){pe.cancelled||D("timeout");return}await new Promise(dt=>setTimeout(dt,AK))}},[o,a,s]),Z=!!(M&&w&&g&&ke.includes(g)&&V==="form"),Q=b.useCallback(async()=>{if(!w||!g||!M)return;ae(null),D("creating");const we=Xy(M);let pe;try{pe=(await Ee.post(Tn("/agents"),{type:"personal_assistant",displayName:M,...we?{name:we}:{},clientId:w.id,runtimeProvider:g,...e?{organizationId:e}:{}})).uuid,xe.current=pe,az(pe),ui("agent_created",{runtimeProvider:g})}catch(De){ae(De instanceof Error?De.message:"Failed to create agent"),D("form");return}await _(pe)},[M,w,g,_,e]),ue=b.useCallback(async()=>{const we=xe.current;we&&(ae(null),D("creating"),await _(we))},[_]);return V==="creating"?l.jsx($K,{nameOrFallback:I}):V==="timeout"?l.jsx(FK,{nameOrFallback:I,hostname:(w==null?void 0:w.hostname)??null,error:Y,onRetry:ue}):l.jsx(DK,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:p,trimmedName:M,connectedClient:w,cliCommand:P,capabilitiesLoaded:te!==null,okRuntimes:ke,selectedRuntime:g,setSelectedRuntime:x,error:Y,canCreate:Z,onCreate:Q})}function MK(e){const t=a=>{var s;return((s=e[a])==null?void 0:s.state)==="ok"};if(t("claude-code"))return"claude-code";if(t("codex"))return"codex";const n=Object.entries(e).find(([,a])=>a.state==="ok");return n?n[0]:null}function DK({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,error:g,canCreate:x,onCreate:w}){const S=b.useRef(null),k=e==="invite"&&t,E=f&&m.length===0&&!!o,C=s?o?E?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return b.useEffect(()=>{var N;s||(N=S.current)==null||N.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:k?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — it'll run on a computer you connect."]}):l.jsx(l.Fragment,{children:"Set up your first agent — it'll run on a computer you connect."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(jb,{}),l.jsx(is,{number:"01",state:s?"complete":"active",children:l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),l.jsx("input",{ref:S,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:N=>a(N.target.value),placeholder:"e.g. Buddy, Helper",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:N=>{N.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:N=>{N.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(is,{number:"02",state:x?"complete":s?"active":"idle",children:l.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!o&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?l.jsxs(l.Fragment,{children:[l.jsx(UK,{hostname:o.hostname??o.id}),l.jsx(PK,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(IK,{command:c}),l.jsx(LK,{})]})]}):null]})})]}),g&&l.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g}),s&&l.jsxs("div",{style:{marginTop:x?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!x&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),x&&l.jsxs(ve,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:N=>{N.currentTarget.style.transform="scale(1.01)",N.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:N=>{N.currentTarget.style.transform="scale(1)",N.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(lC,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:x?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function IK({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
404
- `):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),l.jsxs(ve,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(uh,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function LK(){return l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",color:"color-mix(in oklch, var(--accent) 24%, var(--fg-3))"},children:[l.jsx(BK,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function PK({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?l.jsx("p",{className:"text-label",style:{marginTop:"var(--sp-3)",color:"var(--fg-3)"},children:a?"No runtime ready on this computer. Install Claude Code or Codex, then check back.":"Detecting installed runtimes…"}):l.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),l.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,o)=>{const c=t===s;return l.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:c?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:c?600:400,animation:`onboarding-rise 220ms ease-out ${o*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",borderRadius:"50%",border:c?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:c?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",boxShadow:c?"0 0 0 var(--sp-0_5) color-mix(in oklch, var(--accent) 10%, transparent)":"none",transition:"border-color 160ms ease, background 160ms ease, box-shadow 160ms ease"},children:c&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),OK(s)]},s)})]})]})}function UK({hostname:e}){return l.jsxs("div",{className:"inline-flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",padding:"var(--sp-1_5) var(--sp-2_5)",borderRadius:999,background:"color-mix(in oklch, var(--accent) 10%, transparent)",color:"color-mix(in oklch, var(--accent) 26%, var(--fg))",animation:"onboarding-pop 260ms cubic-bezier(0.2, 0.9, 0.2, 1.15)"},children:[l.jsx(cr,{className:"h-3.5 w-3.5"}),l.jsxs("span",{children:[l.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function BK(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function $K({nameOrFallback:e}){return l.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),l.jsx(HK,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function FK({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return l.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):l.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[l.jsx("p",{children:"This usually means:"}),l.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[l.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),l.jsxs("li",{children:["The connection to ",s," dropped"]})]}),l.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",l.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),l.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:l.jsx(ve,{onClick:a,children:"Try again"})})]})}function HK(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Gg,{delayMs:0}),l.jsx(Gg,{delayMs:160}),l.jsx(Gg,{delayMs:320})]})}function Gg({delayMs:e}){return l.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",animationDelay:`${e}ms`,display:"inline-block"}})}async function bT(){return(await Ee.get("/me/github/repos")).repos}const xT="https://github.com/agent-team-foundation/first-tree";function wT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Cb(e,t){const n=wT(e),a=e.length===1?"Bind my source repo to an existing context-tree.":"Bind my source repos to an existing context-tree.",s=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source repo and write the binding metadata pointing at the existing tree, then open a PR back to the source with those changes. Walk me through the PR when it's up.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. For every source repo, use the first-tree CLI to install the skill and write the binding metadata pointing at the existing tree, then open a PR back to that source repo. Walk me through each PR as it goes up.";return[a,"",...n,`Existing tree: ${t}`,"",s,"",`Reference: ${xT}`].join(`
405
- `)}function qK(e){const t=wT(e),n=e.length===1?"Create a brand-new context-tree for my source repo.":"Create a brand-new context-tree for my source repos.",a=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source, scaffold a sibling tree directory, and write the binding metadata. Then push that new tree directory up to GitHub as a sibling repo under the same owner as the source, and open a PR back to the source with the skill + binding files.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. Scaffold ONE shared tree directory that all the source repos bind to. For every source repo, install the first-tree skill and write the binding metadata pointing at that shared tree. Push the new tree directory up to GitHub as its own repo — if all the source repos share a single GitHub owner, host the tree under that owner; otherwise ask me which owner to use before pushing. Then open a PR back to each source repo with its skill + binding files.";return[n,"",...t,"",a,"","Once you know the URL of the new tree repo, use the first-tree-hub CLI's `org bind-tree` command to record it on the Hub so future agents in this team can find it.","","When everything is up, walk me through what was created — which directory, which repo, which PRs.","",`Reference: ${xT}`].join(`
406
- `)}function ZK(){const{role:e}=gt();return e==="admin"?l.jsx(WK,{}):l.jsx(GK,{})}function GK(){var f,m;const{organizationId:e}=gt(),[t,n]=b.useState({kind:"loading"}),[a,s]=b.useState(0);if(b.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[p,g]=await Promise.all([vb(e),rT(e)]);if(h)return;n({kind:"loaded",tree:p,repos:g})}catch(p){if(h)return;n({kind:"error",message:p instanceof Error?p.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(QK,{});if(t.kind==="error")return l.jsx(VK,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((f=t.tree)==null?void 0:f.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return o&&c.length>0?l.jsx(KK,{treeUrl:o,teamRepos:c}):o?l.jsx(YK,{treeUrl:o}):l.jsx(XK,{})}function VK({message:e,onRetry:t}){return l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),l.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:l.jsx(ve,{type:"button",onClick:t,children:"Try again"})})]})}function QK(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function KK({treeUrl:e,teamRepos:t}){var k;const n=_n(),{dismissOnboarding:a}=gt(),{addToast:s}=Lc(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(()=>t.map(E=>E.url)),g=h.length>0,x=b.useCallback(E=>{p(C=>C.includes(E)?C.filter(N=>N!==E):[...C,E])},[]),w=b.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const E=await Eb(),C=await Nh(E.uuid);await _h(E.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(z=>({url:z}))}});const N=await wb(E.uuid),O=Cb(h,e);try{await ko(N.id,O)}catch{}ui("tree_chat_started",{agentUuid:E.uuid,chatId:N.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(N.id)}`,{replace:!1})}catch(E){m(E instanceof Error?E.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),S=b.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),a(),s(Nb(n))},[a,s,n]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(ev,{label:"Tree",value:e}),t.length===1?l.jsx(ev,{label:"Source repo",value:((k=t[0])==null?void 0:k.url)??""}):l.jsxs("fieldset",{disabled:o,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(E=>{const C=h.includes(E.url);return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:C?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:o?"not-allowed":"pointer",color:C?"var(--fg)":"var(--fg-2)",fontWeight:C?600:400},children:[l.jsx("input",{type:"checkbox",value:E.url,checked:C,onChange:()=>x(E.url),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:C?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:C?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:E.url})]},E.url)})]}),f?l.jsx(_b,{children:f}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!g||o,onClick:()=>void w(),children:o?"Starting…":"Confirm"}),l.jsx(ve,{type:"button",variant:"outline",onClick:S,disabled:o,children:"I'll do it later"})]})]})]})}function YK({treeUrl:e}){const t=_n(),{dismissOnboarding:n}=gt(),{addToast:a}=Lc(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),[x,w]=b.useState([]),S=x.length>0,k=b.useCallback(N=>{w(O=>O.includes(N)?O.filter(z=>z!==N):[...O,N])},[]);b.useEffect(()=>{let N=!1;return(async()=>{try{const O=await bT();if(N)return;h(O)}catch(O){N||g(O instanceof Error?O.message:"Failed to list GitHub repositories")}})(),()=>{N=!0}},[]);const E=b.useCallback(async()=>{if(x.length!==0){o(!0),f(null);try{const N=await Eb(),O=await Nh(N.uuid);await _h(N.uuid,{expectedVersion:O.version,payload:{gitRepos:x.map(R=>({url:R}))}});const z=await wb(N.uuid),L=Cb(x,e);try{await ko(z.id,L)}catch{}ui("tree_chat_started",{agentUuid:N.uuid,chatId:z.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(z.id)}`,{replace:!1})}catch(N){f(N instanceof Error?N.message:"Failed to start the chat"),o(!1)}}},[x,e,t,n]),C=b.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),n(),a(Nb(t))},[n,a,t]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repos you'll work with."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(jb,{}),l.jsx(is,{number:"01",state:"complete",children:l.jsx(ev,{label:"Tree",value:e})}),l.jsx(is,{number:"02",state:S?"complete":"active",children:l.jsx(ST,{disabled:s,repos:m,error:p,selectedRepoUrls:x,onToggle:k})}),l.jsxs(is,{number:"03",state:S?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:S?"var(--fg)":"var(--fg-4)",fontWeight:S?600:500},children:"Let your agent join the tree"}),S?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?l.jsx(_b,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!S||s,onClick:()=>void E(),children:s?"Starting…":"Continue"}),l.jsx(ve,{type:"button",variant:"outline",onClick:C,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function XK(){const{dismissOnboarding:e}=gt(),{addToast:t}=Lc(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,ui("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),l.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they finish setup, this view will guide your agent to join. For now, your agent can help with anything that doesn't depend on your team's shared knowledge."})]})}function WK(){const e=_n(),{dismissOnboarding:t,organizationId:n}=gt(),{addToast:a}=Lc(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(""),[x,w]=b.useState([]),[S,k]=b.useState(null),[E,C]=b.useState(null),N=b.useCallback(D=>{w(Y=>Y.includes(D)?Y.filter(ae=>ae!==D):[...Y,D])},[]);b.useEffect(()=>{let D=!1;return(async()=>{try{const Y=await bT();if(D)return;k(Y)}catch(Y){D||C(Y instanceof Error?Y.message:"Failed to list GitHub repositories")}})(),()=>{D=!0}},[]),b.useEffect(()=>{if(!n)return;let D=!1;return(async()=>{try{const Y=await vb(n);if(D)return;Y.repo&&(g(Y.repo),h(ae=>ae??"existing"))}catch{}})(),()=>{D=!0}},[n]);const O=p.trim(),z=(()=>{if(m!=="existing")return!0;if(!O)return!1;try{return new URL(O).protocol==="https:"}catch{return!1}})(),L=b.useCallback(()=>{ui("tree_intro_dismissed"),t(),a(Nb(e))},[t,a,e]),R=b.useCallback(async()=>{if(x.length!==0&&m&&!(m==="existing"&&!z)){f(null),o(!0);try{const D=await Eb(),Y=await Nh(D.uuid),ae=x.map(X=>({url:X}));if(await _h(D.uuid,{expectedVersion:Y.version,payload:{gitRepos:ae}}),n)try{await aT(n,{repos:ae})}catch(X){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",X)}if(m==="existing"&&n)try{await nT(n,{repo:O})}catch(X){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",X),a({title:"Tree binding wasn't saved to Hub yet",description:"Your agent will still proceed. You can re-bind from Team Settings later."})}const xe=await wb(D.uuid),J=m==="existing"?Cb(x,O):qK(x);try{await ko(xe.id,J)}catch{}ui("tree_chat_started",{agentUuid:D.uuid,chatId:xe.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(xe.id)}`,{replace:!1})}catch(D){f(D instanceof Error?D.message:"Failed to start the tree-init chat"),o(!1)}}},[x,m,z,O,n,e,t,a]),$=x.length>0,U=$&&m!==null&&!s&&(m==="new"||z),V=!!m&&(m==="new"||z);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(jb,{}),l.jsx(is,{number:"01",state:$?"complete":"active",children:l.jsx(ST,{disabled:s,repos:S,error:E,selectedRepoUrls:x,onToggle:N})}),l.jsxs(is,{number:"02",state:V?"complete":$?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:$?"var(--fg)":"var(--fg-4)",fontWeight:$?600:500},children:"Bind or create the tree"}),$?l.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:s,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[l.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(D=>{const Y=m===D.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Y?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Y?"var(--fg)":"var(--fg-3)",fontWeight:Y?600:400,boxShadow:Y?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:D.value,checked:Y,onChange:()=>h(D.value),className:"sr-only"}),D.label]},D.value)})]}),m==="existing"?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),l.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:p,onChange:D=>g(D.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?l.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:["Your agent will scaffold a new GitHub repo for the tree and bind"," ",x.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),l.jsxs(is,{number:"03",state:V?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:V?"var(--fg)":"var(--fg-4)",fontWeight:V?600:500},children:"Let your agent build it"}),V?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill, set up the tree, and open a PR back to"," ",x.length>1?"each source repo":"your source repo","."]}),c?l.jsx(_b,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!U,onClick:()=>void R(),children:s?"Starting…":"Continue"}),l.jsx(ve,{type:"button",variant:"outline",onClick:L,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function Eb(){const e=rz(),t=await Mv(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,o)=>o.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function Nb(e){return{title:"Setup hidden",description:"Resume any time in Settings → Onboarding. Your agent isn't bound to a source repo yet — add one in Agent settings when ready.",action:{label:"Open settings",onClick:()=>e("/settings/onboarding")}}}function ev({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),l.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function _b({children:e,style:t}){return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)",...t},children:e})}function ST({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const o=l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?l.jsx("div",{children:o}):n?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsx(ve,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),l.jsx(JK,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function JK({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=x=>{o.current&&!o.current.contains(x.target)&&s(!1)},g=x=>{x.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[a]);const c=b.useMemo(()=>{const p=new Map;for(const g of e){const x=g.fullName.split("/")[0]??"",w=p.get(x);w?w.push(g):p.set(x,[g])}return[...p.entries()].sort(([g],[x])=>g.localeCompare(x))},[e]),f=b.useMemo(()=>new Set(t),[t]),m=b.useMemo(()=>e.filter(p=>f.has(p.cloneUrl)),[e,f]),h=m.length===0?"Select repositories…":"Add another repository";return l.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&l.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(p=>l.jsx(eY,{fullName:p.fullName,onRemove:()=>n(p.cloneUrl)},p.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(p=>!p),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),l.jsx(Sv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([p,g],x)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:x>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(w=>{const S=f.has(w.cloneUrl),k=w.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":S,onClick:()=>n(w.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:S?"var(--accent-bg)":"transparent",color:S?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-1)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:S?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:S?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:S?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:k}),w.private&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},w.cloneUrl)})]},p))})]})}function eY({fullName:e,onRemove:t}){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",paddingLeft:"var(--sp-2)",paddingRight:"var(--sp-0_5)",paddingTop:"var(--sp-0_5)",paddingBottom:"var(--sp-0_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",maxWidth:"20rem"},children:[l.jsx("span",{className:"mono truncate",style:{minWidth:0},children:e}),l.jsx("button",{type:"button","aria-label":`Remove ${e}`,onClick:t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--sp-4)",height:"var(--sp-4)",border:0,padding:0,background:"transparent",color:"var(--fg-3)",cursor:"pointer",borderRadius:"var(--radius-chip)",flexShrink:0,transition:"background 120ms ease, color 120ms ease"},onMouseEnter:n=>{n.currentTarget.style.background="var(--surface-2)",n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--fg-3)"},children:l.jsx(ss,{className:"h-3 w-3"})})]})}function tY(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=gt(),[o,c]=lh(),f=o.get("step"),[m]=b.useState(()=>aC()),[h,p]=b.useState(()=>nC()),g=b.useCallback(k=>{nz(k),p(k)},[]),x=s==="admin",w=b.useMemo(()=>f==="team"&&x?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&x?"step1":"step2",[f,e,h,m,x]),S=b.useCallback(()=>{g(!0);const k=new URLSearchParams(o);k.delete("step"),c(k,{replace:!0})},[g,o,c]);return l.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:l.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?l.jsx(_K,{organizationId:n,onContinue:S}):w==="step2"?l.jsx(zK,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(ZK,{})})})}function nY({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=gt();return e===nh?l.jsx(NQ,{onCreated:t}):e?l.jsx(EK,{chatId:e}):n!==null&&!a?l.jsx(tY,{}):l.jsx(NK,{})}const rY={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function aY(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=gt(),{addToast:a}=Lc(),s=_n(),[o,c]=lh(),f=o.get("c"),m=o.get("step"),h=nC(),g=aC()==="invite",x=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const w=e==="completed",S=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},k={1:Vg(1,x,e),2:Vg(2,x,e),3:Vg(3,x,e)},E=C=>{if(C!==3)return;const N=new URLSearchParams(o);N.delete("c"),N.set("step","tree"),c(N,{replace:!1})};return l.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[l.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((C,N)=>{const O=k[C],z=[1,2,3][N+1],L=z?aj(O)&&aj(k[z]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(iY,{index:C,state:O,label:rY[C],onClick:C===3&&O==="active"?()=>E(C):void 0}),z?l.jsx(lY,{solid:L}):null]},C)})}),l.jsx("button",{type:"button",onClick:S,disabled:!w,title:w?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:w?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:w?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:w?1:.5},onMouseEnter:C=>{w&&(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:"✕"})]})}function Vg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function aj(e){return e==="active"||e==="completed"}function iY({index:e,state:t,label:n,onClick:a}){const s=!!a,o=sY(t,e);return l.jsxs("button",{type:"button",onClick:s?a:void 0,disabled:!s,"aria-current":t==="active"?"step":void 0,className:`flex items-center ${s?"cursor-pointer":"cursor-default"}`,style:{gap:"var(--sp-2)",background:"transparent",border:0,padding:0,font:"inherit",color:t==="active"?"var(--fg)":t==="completed"?"var(--fg-2)":"var(--fg-3)",fontWeight:t==="active"?600:500},children:[o,l.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function sY(e,t){return e==="completed"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,lineHeight:1,flexShrink:0},children:"✓"}):e==="active"?l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),l.jsx("span",{className:"mono",style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)",border:"var(--hairline-bold) solid var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,fontWeight:600,lineHeight:1},children:t})]}):e==="error"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--state-error)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:13,lineHeight:1,flexShrink:0},children:"⊗"}):l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"transparent",border:"var(--hairline) solid var(--fg-3)",flexShrink:0,display:"inline-block"}})}function lY({solid:e}){return l.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}function oY(){const[e,t]=lh(),n=e.get("c"),a=e.get("a");IN(),b.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=b.useCallback(c=>{t({c})},[t]),o=b.useCallback(()=>{t({c:nh})},[t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(vQ,{selectedChatId:n,onSelectChat:s,onNewChat:o}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx(aY,{}),l.jsx(nY,{selectedChatId:n,onSelectChat:s})]})]})}const uY=new hR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function cY(){return l.jsx(mR,{client:uY,children:l.jsx(hz,{children:l.jsx(p4,{children:l.jsx(HO,{children:l.jsxs(vO,{children:[l.jsx(Dt,{path:"/login",element:l.jsx(QG,{})}),l.jsx(Dt,{path:"/signup",element:l.jsx(or,{to:"/login",replace:!0})}),l.jsx(Dt,{path:"/auth/github/complete",element:l.jsx(KG,{})}),l.jsx(Dt,{path:"/invite/:token",element:l.jsx(qG,{})}),null,l.jsx(Dt,{element:l.jsx(vz,{}),children:l.jsxs(Dt,{element:l.jsx(HB,{children:l.jsx(h4,{})}),children:[l.jsx(Dt,{index:!0,element:l.jsx(oY,{})}),l.jsx(Dt,{path:"context",element:l.jsx(aG,{})}),l.jsx(Dt,{path:"agents/:uuid",element:l.jsx(vZ,{})}),l.jsx(Dt,{path:"team",element:l.jsx(JV,{})}),l.jsxs(Dt,{path:"settings",element:l.jsx(IV,{}),children:[l.jsx(Dt,{index:!0,element:l.jsx(or,{to:"computers",replace:!0})}),l.jsx(Dt,{path:"team",element:l.jsx(fQ,{})}),l.jsx(Dt,{path:"computers",element:l.jsx(cV,{})}),l.jsx(Dt,{path:"github",element:l.jsx(yV,{})}),l.jsx(Dt,{path:"integrations",element:l.jsx(zV,{})}),l.jsx(Dt,{path:"onboarding",element:l.jsx(MV,{})}),l.jsx(Dt,{path:"setup",element:l.jsx(or,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(Dt,{path:"agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"clients",element:l.jsx(or,{to:"/settings/computers",replace:!0})}),l.jsx(Dt,{path:"integrations",element:l.jsx(or,{to:"/settings/integrations",replace:!0})}),l.jsx(Dt,{path:"team/members",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/invite",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/settings",element:l.jsx(or,{to:"/settings/team",replace:!0})}),l.jsx(Dt,{path:"admin",element:l.jsx(dY,{})})]})})]})})})})})}function dY(){const e=kr();return e.hash==="#bindings"?l.jsx(or,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(or,{to:`/team${e.hash}`,replace:!0})}const kT=document.getElementById("root");if(!kT)throw new Error("Root element not found");$2.createRoot(kT).render(l.jsx(b.StrictMode,{children:l.jsx(cY,{})}));export{lC as A,Ic as F,Rc as L,rt as c,l as j,b as r};