@agent-team-foundation/first-tree-hub 0.12.3 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,401 @@
1
+ var hS=e=>{throw TypeError(e)};var Fp=(e,t,n)=>t.has(e)||hS("Cannot "+n);var B=(e,t,n)=>(Fp(e,t,"read from private field"),n?n.call(e):t.get(e)),_e=(e,t,n)=>t.has(e)?hS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,a)=>(Fp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),qe=(e,t,n)=>(Fp(e,t,"access private method"),n);var rf=(e,t,n,a)=>({set _(s){Se(e,t,s,n)},get _(){return B(e,t,a)}});function A2(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 nh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $p={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 mS;function R2(){if(mS)return _u;mS=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 d in s)d!=="key"&&(o[d]=s[d])}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 pS;function O2(){return pS||(pS=1,$p.exports=R2()),$p.exports}var l=O2(),Hp={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 gS;function z2(){if(gS)return Qe;gS=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"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=b&&I[b]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=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,j(z,C.prototype),z.isPureReactComponent=!0;var L=Array.isArray;function R(){}var F={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 M(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 g: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(Me){return Me})):Q!=null&&(Y(Q)&&(Q=M(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)},D={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=p,Qe.Children=D,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=F,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(I){return F.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=j({},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:d,render:I}},Qe.isValidElement=Y,Qe.lazy=function(I){return{$$typeof:g,_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=F.T,_={};F.T=_;try{var Z=I(),Q=F.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),F.T=P}},Qe.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Qe.use=function(I){return F.H.use(I)},Qe.useActionState=function(I,P,_){return F.H.useActionState(I,P,_)},Qe.useCallback=function(I,P){return F.H.useCallback(I,P)},Qe.useContext=function(I){return F.H.useContext(I)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(I,P){return F.H.useDeferredValue(I,P)},Qe.useEffect=function(I,P){return F.H.useEffect(I,P)},Qe.useEffectEvent=function(I){return F.H.useEffectEvent(I)},Qe.useId=function(){return F.H.useId()},Qe.useImperativeHandle=function(I,P,_){return F.H.useImperativeHandle(I,P,_)},Qe.useInsertionEffect=function(I,P){return F.H.useInsertionEffect(I,P)},Qe.useLayoutEffect=function(I,P){return F.H.useLayoutEffect(I,P)},Qe.useMemo=function(I,P){return F.H.useMemo(I,P)},Qe.useOptimistic=function(I,P){return F.H.useOptimistic(I,P)},Qe.useReducer=function(I,P,_){return F.H.useReducer(I,P,_)},Qe.useRef=function(I){return F.H.useRef(I)},Qe.useState=function(I){return F.H.useState(I)},Qe.useSyncExternalStore=function(I,P,_){return F.H.useSyncExternalStore(I,P,_)},Qe.useTransition=function(){return F.H.useTransition()},Qe.version="19.2.4",Qe}var yS;function Jy(){return yS||(yS=1,Hp.exports=z2()),Hp.exports}var x=Jy();const D2=nh(x),ev=A2({__proto__:null,default:D2},[x]);var qp={exports:{}},Tu={},Zp={exports:{}},Gp={};/**
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 vS;function M2(){return vS||(vS=1,(function(e){function t(q,te){var ke=q.length;q.push(te);e:for(;0<ke;){var Ae=ke-1>>>1,D=q[Ae];if(0<s(D,te))q[Ae]=te,q[ke]=D,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,D=q.length,I=D>>>1;Ae<I;){var P=2*(Ae+1)-1,_=q[P],Z=P+1,Q=q[Z];if(0>s(_,ke))Z<D&&0>s(Q,_)?(q[Ae]=Q,q[Z]=ke,Ae=Z):(q[Ae]=_,q[P]=ke,Ae=P);else if(Z<D&&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,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],h=[],g=1,p=null,b=3,w=!1,S=!1,j=!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(j=!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,F=-1,U=5,V=-1;function M(){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,j&&(j=!1,N(F),F=-1),w=!0;var ke=b;try{t:{for(z(q),p=n(m);p!==null&&!(p.expirationTime>q&&M());){var Ae=p.callback;if(typeof Ae=="function"){p.callback=null,b=p.priorityLevel;var D=Ae(p.expirationTime<=q);if(q=e.unstable_now(),typeof D=="function"){p.callback=D,z(q),te=!0;break t}p===n(m)&&a(m),z(q)}else a(m);p=n(m)}if(p!==null)te=!0;else{var I=n(h);I!==null&&X(L,I.startTime-q),te=!1}}break e}finally{p=null,b=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){F=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 b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var te=3;break;default:te=b}var ke=b;b=te;try{return q()}finally{b=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=b;b=q;try{return te()}finally{b=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 D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ke+D,q={id:g++,callback:te,priorityLevel:q,startTime:ke,expirationTime:D,sortIndex:-1},ke>Ae?(q.sortIndex=ke,t(h,q),n(m)===null&&q===n(h)&&(j?(N(F),F=-1):j=!0,X(L,ke-Ae))):(q.sortIndex=D,t(m,q),S||w||(S=!0,R||(R=!0,ae()))),q},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(q){var te=b;return function(){var ke=b;b=te;try{return q.apply(this,arguments)}finally{b=ke}}}})(Gp)),Gp}var bS;function I2(){return bS||(bS=1,Zp.exports=M2()),Zp.exports}var Vp={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 xS;function L2(){if(xS)return Vn;xS=1;var e=Jy();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}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,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(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 g=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,g)},Vn.flushSync=function(m){var h=c.T,g=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=g,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 g=h.as,p=d(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:w}):g==="script"&&a.d.X(m,{crossOrigin:p,integrity:b,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 g=d(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:g,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 g=h.as,p=d(g,h.crossOrigin);a.d.L(m,g,{crossOrigin:p,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 g=d(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,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,g){return c.H.useFormState(m,h,g)},Vn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Vn.version="19.2.4",Vn}var wS;function gj(){if(wS)return Vp.exports;wS=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(),Vp.exports=L2(),Vp.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 SS;function P2(){if(SS)return Tu;SS=1;var e=I2(),t=Jy(),n=gj();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 d(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,f=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(f=y.return,f!==null){u=f;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===f)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==f.return)u=y,f=v;else{for(var k=!1,A=y.child;A;){if(A===u){k=!0,u=y,f=v;break}if(A===f){k=!0,f=y,u=v;break}A=A.sibling}if(!k){for(A=v.child;A;){if(A===u){k=!0,u=v,f=y;break}if(A===f){k=!0,f=v,u=y;break}A=A.sibling}if(!k)throw Error(a(189))}}if(u.alternate!==f)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=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"),F=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),M=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 j: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 F: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=[],D=-1;function I(r){return{current:r}}function P(r){0>D||(r.current=Ae[D],Ae[D]=null,D--)}function _(r,i){D++,Ae[D]=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)?Iw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Iw(i),r=Lw(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 Me(r){r.memoizedState!==null&&_(je,r);var i=Z.current,u=Lw(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 ie=!1;function ge(r,i){if(!r||ie)return"";ie=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={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]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=f.DetermineComponentFrameRoot(),k=v[0],A=v[1];if(k&&A){var H=k.split(`
44
+ `),ee=A.split(`
45
+ `);for(y=f=0;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;for(;y<ee.length&&!ee[y].includes("DetermineComponentFrameRoot");)y++;if(f===H.length||y===ee.length)for(f=H.length-1,y=ee.length-1;1<=f&&0<=y&&H[f]!==ee[y];)y--;for(;1<=f&&0<=y;f--,y--)if(H[f]!==ee[y]){if(f!==1||y!==1)do if(f--,y--,0>y||H[f]!==ee[y]){var ce=`
46
+ `+H[f].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=f&&0<=y);break}}}finally{ie=!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(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var $t=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,Fe=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 rt=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 Da(r,i,u){var f=r.pendingLanes;if(f===0)return 0;var y=0,v=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var A=f&134217727;return A!==0?(f=A&~v,f!==0?y=Gn(f):(k&=A,k!==0?y=Gn(k):u||(u=A&~r,u!==0&&(y=Gn(u))))):(A=f&~v,A!==0?y=Gn(A):k!==0?y=Gn(k):u||(u=f&~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 pn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function _r(r,i,u,f,y,v){var k=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=k&~u;0<u;){var ce=31-rt(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}f!==0&&pi(r,f,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(k&~i))}function pi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var f=31-rt(i);r.entangledLanes|=i,r.entanglements[f]=r.entanglements[f]|1073741824|u&261930}function gs(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var f=31-rt(u),y=1<<f;y&i|r[f]&i&&(r[f]|=i),u&=~y}}function $c(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:sS(r.type))}function Lo(r,i){var u=te.p;try{return te.p=r,i()}finally{te.p=u}}var Fr=Math.random().toString(36).slice(2),cn="__reactFiber$"+Fr,Zt="__reactProps$"+Fr,Ma="__reactContainer$"+Fr,il="__reactEvents$"+Fr,zh="__reactListeners$"+Fr,Hc="__reactHandles$"+Fr,Po="__reactResources$"+Fr,gi="__reactMarker$"+Fr;function Pe(r){delete r[cn],delete r[Zt],delete r[il],delete r[zh],delete r[Hc]}function $(r){var i=r[cn];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Ma]||u[cn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=qw(r);r!==null;){if(u=r[cn])return u;r=qw(r)}return i}r=u,u=r.parentNode}return null}function me(r){if(r=r[cn]||r[Ma]){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 Wt=new Set,Pn={};function gn(r,i){On(r,i),On(r+"Capture",i)}function On(r,i){for(Pn[r]=i,r=0;r<i.length;r++)Wt.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 qc(r){return $t.call(Bo,r)?!0:$t.call(dn,r)?!1:Uo.test(r)?Bo[r]=!0:(dn[r]=!0,!1)}function Zc(r,i,u){if(qc(i))if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var f=i.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+u)}}function Gc(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,f){if(f===null)r.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+f)}}function $r(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function _b(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function kT(r,i,u){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,v=f.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(k){u=""+k,v.call(this,k)}}),Object.defineProperty(r,i,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(k){u=""+k},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Dh(r){if(!r._valueTracker){var i=_b(r)?"checked":"value";r._valueTracker=kT(r,i,""+r[i])}}function Tb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),f="";return r&&(f=_b(r)?r.checked?"true":"false":r.value),r=f,r!==u?(i.setValue(r),!0):!1}function Vc(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 jT=/[\n"\\]/g;function Hr(r){return r.replace(jT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Mh(r,i,u,f,y,v,k,A){r.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?r.type=k:r.removeAttribute("type"),i!=null?k==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+$r(i)):r.value!==""+$r(i)&&(r.value=""+$r(i)):k!=="submit"&&k!=="reset"||r.removeAttribute("value"),i!=null?Ih(r,k,$r(i)):u!=null?Ih(r,k,$r(u)):f!=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=""+$r(A):r.removeAttribute("name")}function Ab(r,i,u,f,y,v,k,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)){Dh(r);return}u=u!=null?""+$r(u):"",i=i!=null?""+$r(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=A?r.checked:!!f,r.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(r.name=k),Dh(r)}function Ih(r,i,u){i==="number"&&Vc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function sl(r,i,u,f){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&&f&&(r[u].defaultSelected=!0)}else{for(u=""+$r(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,f&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Rb(r,i,u){if(i!=null&&(i=""+$r(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+$r(u):""}function Ob(r,i,u,f){if(i==null){if(f!=null){if(u!=null)throw Error(a(92));if(X(f)){if(1<f.length)throw Error(a(93));f=f[0]}u=f}u==null&&(u=""),i=u}u=$r(i),r.defaultValue=u,f=r.textContent,f===u&&f!==""&&f!==null&&(r.value=f),Dh(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 CT=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 zb(r,i,u){var f=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":f?r.setProperty(i,u):typeof u!="number"||u===0||CT.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 f in u)!u.hasOwnProperty(f)||i!=null&&i.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var y in i)f=i[y],i.hasOwnProperty(y)&&u[y]!==f&&zb(r,y,f)}else for(var v in i)i.hasOwnProperty(v)&&zb(r,v,i[v])}function Lh(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 ET=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"]]),NT=/^[\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 Qc(r){return NT.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function La(){}var Ph=null;function Uh(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 Mb(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(Mh(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 f=u[i];if(f!==r&&f.form===r.form){var y=f[Zt]||null;if(!y)throw Error(a(90));Mh(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)f=u[i],f.form===r.form&&Tb(f)}break e;case"textarea":Rb(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&sl(r,!!u.multiple,i,!1)}}}var Bh=!1;function Ib(r,i,u){if(Bh)return r(i,u);Bh=!0;try{var f=r(i);return f}finally{if(Bh=!1,(ol!==null||ul!==null)&&(Md(),ol&&(i=ol,r=ul,ul=ol=null,Mb(i),r)))for(i=0;i<r.length;i++)Mb(r[i])}}function Fo(r,i){var u=r.stateNode;if(u===null)return null;var f=u[Zt]||null;if(f===null)return null;u=f[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":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;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"),Fh=!1;if(Pa)try{var $o={};Object.defineProperty($o,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",$o,$o),window.removeEventListener("test",$o,$o)}catch{Fh=!1}var yi=null,$h=null,Kc=null;function Lb(){if(Kc)return Kc;var r,i=$h,u=i.length,f,y="value"in yi?yi.value:yi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var k=u-r;for(f=1;f<=k&&i[u-f]===y[v-f];f++);return Kc=y.slice(r,1<f?1-f:void 0)}function Yc(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 Xc(){return!0}function Pb(){return!1}function hr(r){function i(u,f,y,v,k){this._reactName=u,this._targetInst=y,this.type=f,this.nativeEvent=v,this.target=k,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)?Xc:Pb,this.isPropagationStopped=Pb,this}return p(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=Xc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Xc)},persist:function(){},isPersistent:Xc}),i}var ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wc=hr(ys),Ho=p({},ys,{view:0,detail:0}),_T=hr(Ho),Hh,qh,qo,Jc=p({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gh,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"?(Hh=r.screenX-qo.screenX,qh=r.screenY-qo.screenY):qh=Hh=0,qo=r),Hh)},movementY:function(r){return"movementY"in r?r.movementY:qh}}),Ub=hr(Jc),TT=p({},Jc,{dataTransfer:0}),AT=hr(TT),RT=p({},Ho,{relatedTarget:0}),Zh=hr(RT),OT=p({},ys,{animationName:0,elapsedTime:0,pseudoElement:0}),zT=hr(OT),DT=p({},ys,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),MT=hr(DT),IT=p({},ys,{data:0}),Bb=hr(IT),LT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},PT={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"},UT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function BT(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=UT[r])?!!i[r]:!1}function Gh(){return BT}var FT=p({},Ho,{key:function(r){if(r.key){var i=LT[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Yc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?PT[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gh,charCode:function(r){return r.type==="keypress"?Yc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Yc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),$T=hr(FT),HT=p({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fb=hr(HT),qT=p({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gh}),ZT=hr(qT),GT=p({},ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),VT=hr(GT),QT=p({},Jc,{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}),KT=hr(QT),YT=p({},ys,{newState:0,oldState:0}),XT=hr(YT),WT=[9,13,27,32],Vh=Pa&&"CompositionEvent"in window,Zo=null;Pa&&"documentMode"in document&&(Zo=document.documentMode);var JT=Pa&&"TextEvent"in window&&!Zo,$b=Pa&&(!Vh||Zo&&8<Zo&&11>=Zo),Hb=" ",qb=!1;function Zb(r,i){switch(r){case"keyup":return WT.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var cl=!1;function eA(r,i){switch(r){case"compositionend":return Gb(i);case"keypress":return i.which!==32?null:(qb=!0,Hb);case"textInput":return r=i.data,r===Hb&&qb?null:r;default:return null}}function tA(r,i){if(cl)return r==="compositionend"||!Vh&&Zb(r,i)?(r=Lb(),Kc=$h=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 $b&&i.locale!=="ko"?null:i.data;default:return null}}var nA={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 Vb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!nA[r.type]:i==="textarea"}function Qb(r,i,u,f){ol?ul?ul.push(f):ul=[f]:ol=f,i=$d(i,"onChange"),0<i.length&&(u=new Wc("onChange","change",null,u,f),r.push({event:u,listeners:i}))}var Go=null,Vo=null;function rA(r){Aw(r,0)}function ed(r){var i=Ne(r);if(Tb(i))return r}function Kb(r,i){if(r==="change")return i}var Yb=!1;if(Pa){var Qh;if(Pa){var Kh="oninput"in document;if(!Kh){var Xb=document.createElement("div");Xb.setAttribute("oninput","return;"),Kh=typeof Xb.oninput=="function"}Qh=Kh}else Qh=!1;Yb=Qh&&(!document.documentMode||9<document.documentMode)}function Wb(){Go&&(Go.detachEvent("onpropertychange",Jb),Vo=Go=null)}function Jb(r){if(r.propertyName==="value"&&ed(Vo)){var i=[];Qb(i,Vo,r,Uh(r)),Ib(rA,i)}}function aA(r,i,u){r==="focusin"?(Wb(),Go=i,Vo=u,Go.attachEvent("onpropertychange",Jb)):r==="focusout"&&Wb()}function iA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ed(Vo)}function sA(r,i){if(r==="click")return ed(i)}function lA(r,i){if(r==="input"||r==="change")return ed(i)}function oA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Tr=typeof Object.is=="function"?Object.is:oA;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),f=Object.keys(i);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var y=u[f];if(!$t.call(i,y)||!Tr(r[y],i[y]))return!1}return!0}function ex(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function tx(r,i){var u=ex(r);r=0;for(var f;u;){if(u.nodeType===3){if(f=r+u.textContent.length,r<=i&&f>=i)return{node:u,offset:i-r};r=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=ex(u)}}function nx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?nx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function rx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Vc(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=Vc(r.document)}return i}function Yh(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 uA=Pa&&"documentMode"in document&&11>=document.documentMode,dl=null,Xh=null,Ko=null,Wh=!1;function ax(r,i,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Wh||dl==null||dl!==Vc(f)||(f=dl,"selectionStart"in f&&Yh(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ko&&Qo(Ko,f)||(Ko=f,f=$d(Xh,"onSelect"),0<f.length&&(i=new Wc("onSelect","select",null,i,u),r.push({event:i,listeners:f}),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")},Jh={},ix={};Pa&&(ix=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(Jh[r])return Jh[r];if(!fl[r])return r;var i=fl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in ix)return Jh[r]=i[u];return r}var sx=bs("animationend"),lx=bs("animationiteration"),ox=bs("animationstart"),cA=bs("transitionrun"),dA=bs("transitionstart"),fA=bs("transitioncancel"),ux=bs("transitionend"),cx=new Map,em="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(" ");em.push("scrollEnd");function ha(r,i){cx.set(r,i),gn(i,[r])}var td=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,tm=0;function nd(){for(var r=hl,i=tm=hl=0;i<r;){var u=qr[i];qr[i++]=null;var f=qr[i];qr[i++]=null;var y=qr[i];qr[i++]=null;var v=qr[i];if(qr[i++]=null,f!==null&&y!==null){var k=f.pending;k===null?y.next=y:(y.next=k.next,k.next=y),f.pending=y}v!==0&&dx(u,y,v)}}function rd(r,i,u,f){qr[hl++]=r,qr[hl++]=i,qr[hl++]=u,qr[hl++]=f,tm|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function nm(r,i,u,f){return rd(r,i,u,f),ad(r)}function xs(r,i){return rd(r,null,null,i),ad(r)}function dx(r,i,u){r.lanes|=u;var f=r.alternate;f!==null&&(f.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,f=v.alternate,f!==null&&(f.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-rt(u),r=v.hiddenUpdates,f=r[y],f===null?r[y]=[i]:f.push(i),i.lane=u|536870912),v):null}function ad(r){if(50<yu)throw yu=0,dp=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 hA(r,i,u,f){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=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ar(r,i,u,f){return new hA(r,i,u,f)}function rm(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 fx(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 id(r,i,u,f,y,v){var k=0;if(f=r,typeof r=="function")rm(r)&&(k=1);else if(typeof r=="string")k=v2(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 j:return ws(u.children,y,v,i);case E:k=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:k=10;break e;case N:k=9;break e;case z:k=11;break e;case F:k=14;break e;case U:k=16,f=null;break e}k=29,u=Error(a(130,r===null?"null":typeof r,"")),f=null}return i=Ar(k,u,i,y),i.elementType=r,i.type=f,i.lanes=v,i}function ws(r,i,u,f){return r=Ar(7,r,f,i),r.lanes=u,r}function am(r,i,u){return r=Ar(6,r,null,i),r.lanes=u,r}function hx(r){var i=Ar(18,null,null,0);return i.stateNode=r,i}function im(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 mx=new WeakMap;function Zr(r,i){if(typeof r=="object"&&r!==null){var u=mx.get(r);return u!==void 0?u:(i={value:r,source:i,stack:zt(i)},mx.set(r,i),i)}return{value:r,source:i,stack:zt(i)}}var pl=[],gl=0,sd=null,Yo=0,Gr=[],Vr=0,vi=null,Sa=1,ka="";function Ba(r,i){pl[gl++]=Yo,pl[gl++]=sd,sd=r,Yo=i}function px(r,i,u){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,vi=r;var f=Sa;r=ka;var y=32-rt(f)-1;f&=~(1<<y),u+=1;var v=32-rt(i)+y;if(30<v){var k=y-y%5;v=(f&(1<<k)-1).toString(32),f>>=k,y-=k,Sa=1<<32-rt(i)+y|u<<y|f,ka=v+r}else Sa=1<<v|u<<y|f,ka=r}function sm(r){r.return!==null&&(Ba(r,1),px(r,1,0))}function lm(r){for(;r===sd;)sd=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 gx(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,om=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)),om}function yx(r){var i=r.stateNode,u=r.type,f=r.memoizedProps;switch(i[cn]=r,i[Zt]=f,u){case"dialog":it("cancel",i),it("close",i);break;case"iframe":case"object":case"embed":it("load",i);break;case"video":case"audio":for(u=0;u<bu.length;u++)it(bu[u],i);break;case"source":it("error",i);break;case"img":case"image":case"link":it("error",i),it("load",i);break;case"details":it("toggle",i);break;case"input":it("invalid",i),Ab(i,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":it("invalid",i);break;case"textarea":it("invalid",i),Ob(i,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||f.suppressHydrationWarning===!0||Dw(i.textContent,u)?(f.popover!=null&&(it("beforetoggle",i),it("toggle",i)),f.onScroll!=null&&it("scroll",i),f.onScrollEnd!=null&&it("scrollend",i),f.onClick!=null&&(i.onclick=La),i=!0):i=!1,i||xi(r,!0)}function vx(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 vx(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")||Ep(r.type,r.memoizedProps)),u=!u),u&&Bt&&xi(r),vx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Hw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Hw(r)}else i===27?(i=Bt,Di(r.type)?(r=Rp,Rp=null,Bt=r):Bt=i):Bt=Un?Yr(r.stateNode.nextSibling):null;return!0}function Ss(){Bt=Un=null,ht=!1}function um(){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 cm=I(null),ks=null,Fa=null;function wi(r,i,u){_(cm,i._currentValue),i._currentValue=u}function $a(r){r._currentValue=cm.current,P(cm)}function dm(r,i,u){for(;r!==null;){var f=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,f!==null&&(f.childLanes|=i)):f!==null&&(f.childLanes&i)!==i&&(f.childLanes|=i),r===u)break;r=r.return}}function fm(r,i,u,f){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var k=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),dm(v.return,u,r),f||(k=null);break e}v=A.next}}else if(y.tag===18){if(k=y.return,k===null)throw Error(a(341));k.lanes|=u,v=k.alternate,v!==null&&(v.lanes|=u),dm(k,u,r),k=null}else k=y.child;if(k!==null)k.return=y;else for(k=y;k!==null;){if(k===r){k=null;break}if(y=k.sibling,y!==null){y.return=k.return,k=y;break}k=k.return}y=k}}function vl(r,i,u,f){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 k=y.alternate;if(k===null)throw Error(a(387));if(k=k.memoizedProps,k!==null){var A=y.type;Tr(y.pendingProps.value,k.value)||(r!==null?r.push(A):r=[A])}}else if(y===je.current){if(k=y.alternate,k===null)throw Error(a(387));k.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(ju):r=[ju])}y=y.return}r!==null&&fm(i,r,u,f),i.flags|=262144}function ld(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,Fa=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return bx(ks,r)}function od(r,i){return ks===null&&js(r),bx(r,i)}function bx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},Fa===null){if(r===null)throw Error(a(308));Fa=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Fa=Fa.next=i;return u}var mA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,f){r.push(f)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},pA=e.unstable_scheduleCallback,gA=e.unstable_NormalPriority,yn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hm(){return{controller:new mA,data:new Map,refCount:0}}function Wo(r){r.refCount--,r.refCount===0&&pA(gA,function(){r.controller.abort()})}var Jo=null,mm=0,bl=0,xl=null;function yA(r,i){if(Jo===null){var u=Jo=[];mm=0,bl=yp(),xl={status:"pending",value:void 0,then:function(f){u.push(f)}}}return mm++,i.then(xx,xx),i}function xx(){if(--mm===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 vA(r,i){var u=[],f={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){f.status="fulfilled",f.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(f.status="rejected",f.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),f}var wx=q.S;q.S=function(r,i){aw=on(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&yA(r,i),wx!==null&&wx(r,i)};var Cs=I(null);function pm(){var r=Cs.current;return r!==null?r:Dt.pooledCache}function ud(r,i){i===null?_(Cs,Cs.current):_(Cs,i.pool)}function Sx(){var r=pm();return r===null?null:{parent:yn._currentValue,pool:r}}var wl=Error(a(460)),gm=Error(a(474)),cd=Error(a(542)),dd={then:function(){}};function kx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function jx(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,Ex(r),r;default:if(typeof i.status=="string")i.then(La,La);else{if(r=Dt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(f){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=f}},function(f){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=f}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ex(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 Cx(){if(Ns===null)throw Error(a(459));var r=Ns;return Ns=null,r}function Ex(r){if(r===wl||r===cd)throw Error(a(483))}var Sl=null,eu=0;function fd(r){var i=eu;return eu+=1,Sl===null&&(Sl=[]),jx(Sl,r,i)}function tu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function hd(r,i){throw i.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Nx(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 f(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 k(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function A(K,G,W,fe){return G===null||G.tag!==6?(G=am(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===j?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=id(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=im(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=am(""+G,K.mode,W),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return W=id(G.type,G.key,G.props,null,K.mode,W),tu(W,G),W.return=K,W;case S:return G=im(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,fd(G),W);if(G.$$typeof===O)return he(K,od(K,G),W);hd(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,fd(W),fe);if(W.$$typeof===O)return ne(K,G,od(K,W),fe);hd(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,fd(fe),Be);if(fe.$$typeof===O)return le(K,G,W,od(G,fe),Be);hd(G,fe)}return null}function Te(K,G,W,fe){for(var Be=null,St=null,De=G,Xe=G=0,ct=null;De!==null&&Xe<W.length;Xe++){De.index>Xe?(ct=De,De=null):ct=De.sibling;var kt=ne(K,De,W[Xe],fe);if(kt===null){De===null&&(De=ct);break}r&&De&&kt.alternate===null&&i(K,De),G=v(kt,G,Xe),St===null?Be=kt:St.sibling=kt,St=kt,De=ct}if(Xe===W.length)return u(K,De),ht&&Ba(K,Xe),Be;if(De===null){for(;Xe<W.length;Xe++)De=he(K,W[Xe],fe),De!==null&&(G=v(De,G,Xe),St===null?Be=De:St.sibling=De,St=De);return ht&&Ba(K,Xe),Be}for(De=f(De);Xe<W.length;Xe++)ct=le(De,K,Xe,W[Xe],fe),ct!==null&&(r&&ct.alternate!==null&&De.delete(ct.key===null?Xe:ct.key),G=v(ct,G,Xe),St===null?Be=ct:St.sibling=ct,St=ct);return r&&De.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,De=G,Xe=G=0,ct=null,kt=W.next();De!==null&&!kt.done;Xe++,kt=W.next()){De.index>Xe?(ct=De,De=null):ct=De.sibling;var Ui=ne(K,De,kt.value,fe);if(Ui===null){De===null&&(De=ct);break}r&&De&&Ui.alternate===null&&i(K,De),G=v(Ui,G,Xe),St===null?Be=Ui:St.sibling=Ui,St=Ui,De=ct}if(kt.done)return u(K,De),ht&&Ba(K,Xe),Be;if(De===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(De=f(De);!kt.done;Xe++,kt=W.next())kt=le(De,K,Xe,kt.value,fe),kt!==null&&(r&&kt.alternate!==null&&De.delete(kt.key===null?Xe:kt.key),G=v(kt,G,Xe),St===null?Be=kt:St.sibling=kt,St=kt);return r&&De.forEach(function(T2){return i(K,T2)}),ht&&Ba(K,Xe),Be}function Ot(K,G,W,fe){if(typeof W=="object"&&W!==null&&W.type===j&&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===j){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===j?(fe=ws(W.props.children,K.mode,fe,W.key),fe.return=K,K=fe):(fe=id(W.type,W.key,W.props,null,K.mode,fe),tu(fe,W),fe.return=K,K=fe)}return k(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=im(W,K.mode,fe),fe.return=K,K=fe}return k(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,fd(W),fe);if(W.$$typeof===O)return Ot(K,G,od(K,W),fe);hd(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=am(W,K.mode,fe),fe.return=K,K=fe),k(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(De){if(De===wl||De===cd)throw De;var St=Ar(29,De,null,K.mode);return St.lanes=fe,St.return=K,St}finally{}}}var _s=Nx(!0),_x=Nx(!1),Si=!1;function ym(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vm(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 f=r.updateQueue;if(f===null)return null;if(f=f.shared,(jt&2)!==0){var y=f.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),f.pending=i,i=ad(r),dx(r,null,u),i}return rd(r,f,i,u),ad(r)}function nu(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var f=i.lanes;f&=r.pendingLanes,u|=f,i.lanes=u,gs(r,u)}}function bm(r,i){var u=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var k={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=k:v=v.next=k,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var xm=!1;function ru(){if(xm){var r=xl;if(r!==null)throw r}}function au(r,i,u,f){xm=!1;var y=r.updateQueue;Si=!1;var v=y.firstBaseUpdate,k=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,ee=H.next;H.next=null,k===null?v=ee:k.next=ee,k=H;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==k&&(A===null?ce.firstBaseUpdate=ee:A.next=ee,ce.lastBaseUpdate=H))}if(v!==null){var he=y.baseState;k=0,ce=ee=H=null,A=v;do{var ne=A.lane&-536870913,le=ne!==A.lane;if(le?(ut&ne)===ne:(f&ne)===ne){ne!==0&&ne===bl&&(xm=!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=p({},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,k|=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|=k,r.lanes=k,r.memoizedState=he}}function Tx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Ax(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Tx(u[r],i)}var kl=I(null),md=I(0);function Rx(r,i){r=Xa,_(md,r),_(kl,i),Xa=r|i.baseLanes}function wm(){_(md,Xa),_(kl,kl.current)}function Sm(){Xa=md.current,P(kl),P(md)}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 km(r){_(fn,fn.current),_(Rr,r),Kr===null&&(Kr=r)}function Ox(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 pd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Tp(u)||Ap(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,vn=null,gd=!1,jl=!1,Ts=!1,yd=0,iu=0,Cl=null,bA=0;function tn(){throw Error(a(321))}function jm(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 Cm(r,i,u,f,y,v){return Ha=v,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?p0:Bm,Ts=!1,v=u(f,y),Ts=!1,jl&&(v=Dx(i,u,f,y)),zx(r),v}function zx(r){q.H=ou;var i=At!==null&&At.next!==null;if(Ha=0,vn=At=Ke=null,gd=!1,iu=0,Cl=null,i)throw Error(a(300));r===null||bn||(r=r.dependencies,r!==null&&ld(r)&&(bn=!0))}function Dx(r,i,u,f){Ke=r;var y=0;do{if(jl&&(Cl=null),iu=0,jl=!1,25<=y)throw Error(a(301));if(y+=1,vn=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=g0,v=i(u,f)}while(jl);return v}function xA(){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 Em(){var r=yd!==0;return yd=0,r}function Nm(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function _m(r){if(gd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gd=!1}Ha=0,vn=At=Ke=null,jl=!1,iu=yd=0,Cl=null}function ar(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Ke.memoizedState=vn=r:vn=vn.next=r,vn}function hn(){if(At===null){var r=Ke.alternate;r=r!==null?r.memoizedState:null}else r=At.next;var i=vn===null?Ke.memoizedState:vn.next;if(i!==null)vn=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},vn===null?Ke.memoizedState=vn=r:vn=vn.next=r}return vn}function vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function su(r){var i=iu;return iu+=1,Cl===null&&(Cl=[]),r=jx(Cl,r,i),i=Ke,(vn===null?i.memoizedState:vn.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?p0:Bm),r}function bd(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 Tm(r){var i=null,u=Ke.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var f=Ke.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(i={data:f.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=vd(),Ke.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),f=0;f<r;f++)u[f]=M;return i.index++,u}function qa(r,i){return typeof i=="function"?i(r):i}function xd(r){var i=hn();return Am(i,At,r)}function Am(r,i,u){var f=r.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=u;var y=r.baseQueue,v=f.pending;if(v!==null){if(y!==null){var k=y.next;y.next=v.next,v.next=k}i.baseQueue=y=v,f.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=k=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,k=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,k=v):H=H.next=ne,Ke.lanes|=he,Ti|=he;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?k=v:H.next=A,!Tr(v,r.memoizedState)&&(bn=!0,ce&&(u=xl,u!==null)))throw u;r.memoizedState=v,r.baseState=k,r.baseQueue=H,f.lastRenderedState=v}return y===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function Rm(r){var i=hn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var f=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var k=y=y.next;do v=r(v,k.action),k=k.next;while(k!==y);Tr(v,i.memoizedState)||(bn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,f]}function Mx(r,i,u){var f=Ke,y=hn(),v=ht;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var k=!Tr((At||y).memoizedState,u);if(k&&(y.memoizedState=u,bn=!0),y=y.queue,Dm(Px.bind(null,f,y,r),[r]),y.getSnapshot!==i||k||vn!==null&&vn.memoizedState.tag&1){if(f.flags|=2048,El(9,{destroy:void 0},Lx.bind(null,f,y,u,i),null),Dt===null)throw Error(a(349));v||(Ha&127)!==0||Ix(f,i,u)}return u}function Ix(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Ke.updateQueue,i===null?(i=vd(),Ke.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Lx(r,i,u,f){i.value=u,i.getSnapshot=f,Ux(i)&&Bx(r)}function Px(r,i,u){return u(function(){Ux(i)&&Bx(r)})}function Ux(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!Tr(r,u)}catch{return!0}}function Bx(r){var i=xs(r,2);i!==null&&vr(i,r,2)}function Om(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,f){return r.baseState=u,Am(r,At,typeof f=="function"?f:qa)}function wA(r,i,u,f,y){if(kd(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(k){v.listeners.push(k)}};q.T!==null?u(!0):v.isTransition=!1,f(v),u=i.pending,u===null?(v.next=i.pending=v,$x(i,v)):(v.next=u.next,i.pending=u.next=v)}}function $x(r,i){var u=i.action,f=i.payload,y=r.state;if(i.isTransition){var v=q.T,k={};q.T=k;try{var A=u(y,f),H=q.S;H!==null&&H(k,A),Hx(r,i,A)}catch(ee){zm(r,i,ee)}finally{v!==null&&k.types!==null&&(v.types=k.types),q.T=v}}else try{v=u(y,f),Hx(r,i,v)}catch(ee){zm(r,i,ee)}}function Hx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){qx(r,i,f)},function(f){return zm(r,i,f)}):qx(r,i,u)}function qx(r,i,u){i.status="fulfilled",i.value=u,Zx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,$x(r,u)))}function zm(r,i,u){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do i.status="rejected",i.reason=u,Zx(i),i=i.next;while(i!==f)}r.action=null}function Zx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Gx(r,i){return i}function Vx(r,i){if(ht){var u=Dt.formState;if(u!==null){e:{var f=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),f=y.data==="F!";break e}}xi(f)}f=!1}f&&(i=u[0])}}return u=ar(),u.memoizedState=u.baseState=i,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gx,lastRenderedState:i},u.queue=f,u=f0.bind(null,Ke,f),f.dispatch=u,f=Om(!1),v=Um.bind(null,Ke,!1,f.queue),f=ar(),y={state:i,dispatch:null,action:r,pending:null},f.queue=y,u=wA.bind(null,Ke,y,v,u),y.dispatch=u,f.memoizedState=r,[i,u,!1]}function Qx(r){var i=hn();return Kx(i,At,r)}function Kx(r,i,u){if(i=Am(r,i,Gx)[0],r=xd(qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var f=su(i)}catch(k){throw k===wl?cd:k}else f=i;i=hn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Ke.flags|=2048,El(9,{destroy:void 0},SA.bind(null,y,u),null)),[f,v,r]}function SA(r,i){r.action=i}function Yx(r){var i=hn(),u=At;if(u!==null)return Kx(i,u,r);hn(),i=i.memoizedState,u=hn();var f=u.queue.dispatch;return u.memoizedState=r,[i,f,!1]}function El(r,i,u,f){return r={tag:r,create:u,deps:f,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=vd(),Ke.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(f=u.next,u.next=r,r.next=f,i.lastEffect=r),r}function Xx(){return hn().memoizedState}function wd(r,i,u,f){var y=ar();Ke.flags|=r,y.memoizedState=El(1|i,{destroy:void 0},u,f===void 0?null:f)}function Sd(r,i,u,f){var y=hn();f=f===void 0?null:f;var v=y.memoizedState.inst;At!==null&&f!==null&&jm(f,At.memoizedState.deps)?y.memoizedState=El(i,v,u,f):(Ke.flags|=r,y.memoizedState=El(1|i,v,u,f))}function Wx(r,i){wd(8390656,8,r,i)}function Dm(r,i){Sd(2048,8,r,i)}function kA(r){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=vd(),Ke.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function Jx(r){var i=hn().memoizedState;return kA({ref:i,nextImpl:r}),function(){if((jt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function e0(r,i){return Sd(4,2,r,i)}function t0(r,i){return Sd(4,4,r,i)}function n0(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 r0(r,i,u){u=u!=null?u.concat([r]):null,Sd(4,4,n0.bind(null,i,r),u)}function Mm(){}function a0(r,i){var u=hn();i=i===void 0?null:i;var f=u.memoizedState;return i!==null&&jm(i,f[1])?f[0]:(u.memoizedState=[r,i],r)}function i0(r,i){var u=hn();i=i===void 0?null:i;var f=u.memoizedState;if(i!==null&&jm(i,f[1]))return f[0];if(f=r(),Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[f,i],f}function Im(r,i,u){return u===void 0||(Ha&1073741824)!==0&&(ut&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=sw(),Ke.lanes|=r,Ti|=r,u)}function s0(r,i,u,f){return Tr(u,i)?u:kl.current!==null?(r=Im(r,u,f),Tr(r,i)||(bn=!0),r):(Ha&42)===0||(Ha&1073741824)!==0&&(ut&261930)===0?(bn=!0,r.memoizedState=u):(r=sw(),Ke.lanes|=r,Ti|=r,i)}function l0(r,i,u,f,y){var v=te.p;te.p=v!==0&&8>v?v:8;var k=q.T,A={};q.T=A,Um(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=vA(H,f);lu(r,i,ce,Mr(r))}else lu(r,i,f,Mr(r))}catch(he){lu(r,i,{then:function(){},status:"rejected",reason:he},Mr())}finally{te.p=v,k!==null&&A.types!==null&&(k.types=A.types),q.T=k}}function jA(){}function Lm(r,i,u,f){if(r.tag!==5)throw Error(a(476));var y=o0(r).queue;l0(r,y,i,ke,u===null?jA:function(){return u0(r),u(f)})}function o0(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 u0(r){var i=o0(r);i.next===null&&(i=r.alternate.memoizedState),lu(r,i.next.queue,{},Mr())}function Pm(){return Bn(ju)}function c0(){return hn().memoizedState}function d0(){return hn().memoizedState}function CA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Mr();r=ki(u);var f=ji(i,r,u);f!==null&&(vr(f,i,u),nu(f,i,u)),i={cache:hm()},r.payload=i;return}i=i.return}}function EA(r,i,u){var f=Mr();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},kd(r)?h0(i,u):(u=nm(r,i,u,f),u!==null&&(vr(u,r,f),m0(u,i,f)))}function f0(r,i,u){var f=Mr();lu(r,i,u,f)}function lu(r,i,u,f){var y={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(kd(r))h0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var k=i.lastRenderedState,A=v(k,u);if(y.hasEagerState=!0,y.eagerState=A,Tr(A,k))return rd(r,i,y,0),Dt===null&&nd(),!1}catch{}finally{}if(u=nm(r,i,y,f),u!==null)return vr(u,r,f),m0(u,i,f),!0}return!1}function Um(r,i,u,f){if(f={lane:2,revertLane:yp(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},kd(r)){if(i)throw Error(a(479))}else i=nm(r,u,f,2),i!==null&&vr(i,r,2)}function kd(r){var i=r.alternate;return r===Ke||i!==null&&i===Ke}function h0(r,i){jl=gd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function m0(r,i,u){if((u&4194048)!==0){var f=i.lanes;f&=r.pendingLanes,u|=f,i.lanes=u,gs(r,u)}}var ou={readContext:Bn,use:bd,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 p0={readContext:Bn,use:bd,useCallback:function(r,i){return ar().memoizedState=[r,i===void 0?null:i],r},useContext:Bn,useEffect:Wx,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,wd(4194308,4,n0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return wd(4194308,4,r,i)},useInsertionEffect:function(r,i){wd(4,2,r,i)},useMemo:function(r,i){var u=ar();i=i===void 0?null:i;var f=r();if(Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[f,i],f},useReducer:function(r,i,u){var f=ar();if(u!==void 0){var y=u(i);if(Ts){Tt(!0);try{u(i)}finally{Tt(!1)}}}else y=i;return f.memoizedState=f.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},f.queue=r,r=r.dispatch=EA.bind(null,Ke,r),[f.memoizedState,r]},useRef:function(r){var i=ar();return r={current:r},i.memoizedState=r},useState:function(r){r=Om(r);var i=r.queue,u=f0.bind(null,Ke,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Mm,useDeferredValue:function(r,i){var u=ar();return Im(u,r,i)},useTransition:function(){var r=Om(!1);return r=l0.bind(null,Ke,r.queue,!0,!1),ar().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var f=Ke,y=ar();if(ht){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Dt===null)throw Error(a(349));(ut&127)!==0||Ix(f,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,Wx(Px.bind(null,f,v,r),[r]),f.flags|=2048,El(9,{destroy:void 0},Lx.bind(null,f,v,u,i),null),u},useId:function(){var r=ar(),i=Dt.identifierPrefix;if(ht){var u=ka,f=Sa;u=(f&~(1<<32-rt(f)-1)).toString(32)+u,i="_"+i+"R_"+u,u=yd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=bA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Pm,useFormState:Vx,useActionState:Vx,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=Um.bind(null,Ke,!0,u),u.dispatch=i,[r,i]},useMemoCache:Tm,useCacheRefresh:function(){return ar().memoizedState=CA.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)}}},Bm={readContext:Bn,use:bd,useCallback:a0,useContext:Bn,useEffect:Dm,useImperativeHandle:r0,useInsertionEffect:e0,useLayoutEffect:t0,useMemo:i0,useReducer:xd,useRef:Xx,useState:function(){return xd(qa)},useDebugValue:Mm,useDeferredValue:function(r,i){var u=hn();return s0(u,At.memoizedState,r,i)},useTransition:function(){var r=xd(qa)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Mx,useId:c0,useHostTransitionStatus:Pm,useFormState:Qx,useActionState:Qx,useOptimistic:function(r,i){var u=hn();return Fx(u,At,r,i)},useMemoCache:Tm,useCacheRefresh:d0};Bm.useEffectEvent=Jx;var g0={readContext:Bn,use:bd,useCallback:a0,useContext:Bn,useEffect:Dm,useImperativeHandle:r0,useInsertionEffect:e0,useLayoutEffect:t0,useMemo:i0,useReducer:Rm,useRef:Xx,useState:function(){return Rm(qa)},useDebugValue:Mm,useDeferredValue:function(r,i){var u=hn();return At===null?Im(u,r,i):s0(u,At.memoizedState,r,i)},useTransition:function(){var r=Rm(qa)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Mx,useId:c0,useHostTransitionStatus:Pm,useFormState:Yx,useActionState:Yx,useOptimistic:function(r,i){var u=hn();return At!==null?Fx(u,At,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Tm,useCacheRefresh:d0};g0.useEffectEvent=Jx;function Fm(r,i,u,f){i=r.memoizedState,u=u(f,i),u=u==null?i:p({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var $m={enqueueSetState:function(r,i,u){r=r._reactInternals;var f=Mr(),y=ki(f);y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,f),i!==null&&(vr(i,r,f),nu(i,r,f))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var f=Mr(),y=ki(f);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,f),i!==null&&(vr(i,r,f),nu(i,r,f))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Mr(),f=ki(u);f.tag=2,i!=null&&(f.callback=i),i=ji(r,f,u),i!==null&&(vr(i,r,u),nu(i,r,u))}};function y0(r,i,u,f,y,v,k){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,v,k):i.prototype&&i.prototype.isPureReactComponent?!Qo(u,f)||!Qo(y,v):!0}function v0(r,i,u,f){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,f),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,f),i.state!==r&&$m.enqueueReplaceState(i,i.state,null)}function As(r,i){var u=i;if("ref"in i){u={};for(var f in i)f!=="ref"&&(u[f]=i[f])}if(r=r.defaultProps){u===i&&(u=p({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function b0(r){td(r)}function x0(r){console.error(r)}function w0(r){td(r)}function jd(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(f){setTimeout(function(){throw f})}}function S0(r,i,u){try{var f=r.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Hm(r,i,u){return u=ki(u),u.tag=3,u.payload={element:null},u.callback=function(){jd(r,i)},u}function k0(r){return r=ki(r),r.tag=3,r}function j0(r,i,u,f){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=f.value;r.payload=function(){return y(v)},r.callback=function(){S0(i,u,f)}}var k=u.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(r.callback=function(){S0(i,u,f),typeof y!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function NA(r,i,u,f,y){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.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?Id():u.alternate===null&&nn===0&&(nn=3),u.flags&=-257,u.flags|=65536,u.lanes=y,f===dd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([f]):i.add(f),mp(r,f,y)),!1;case 22:return u.flags|=65536,f===dd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([f]):u.add(f)),mp(r,f,y)),!1}throw Error(a(435,u.tag))}return mp(r,f,y),Id(),!1}if(ht)return i=Rr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,f!==om&&(r=Error(a(422),{cause:f}),Xo(Zr(r,u)))):(f!==om&&(i=Error(a(423),{cause:f}),Xo(Zr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,f=Zr(f,u),y=Hm(r.stateNode,f,y),bm(r,y),nn!==4&&(nn=2)),!1;var v=Error(a(520),{cause:f});if(v=Zr(v,u),gu===null?gu=[v]:gu.push(v),nn!==4&&(nn=2),i===null)return!0;f=Zr(f,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Hm(u.stateNode,f,r),bm(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=k0(y),j0(y,r,u,f),bm(u,y),!1}u=u.return}while(u!==null);return!1}var qm=Error(a(461)),bn=!1;function Fn(r,i,u,f){i.child=r===null?_x(i,null,u,f):_s(i,r.child,u,f)}function C0(r,i,u,f,y){u=u.render;var v=i.ref;if("ref"in f){var k={};for(var A in f)A!=="ref"&&(k[A]=f[A])}else k=f;return js(i),f=Cm(r,i,u,k,v,y),A=Em(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(ht&&A&&sm(i),i.flags|=1,Fn(r,i,f,y),i.child)}function E0(r,i,u,f,y){if(r===null){var v=u.type;return typeof v=="function"&&!rm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,N0(r,i,v,f,y)):(r=id(u.type,null,f,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!Wm(r,y)){var k=v.memoizedProps;if(u=u.compare,u=u!==null?u:Qo,u(k,f)&&r.ref===i.ref)return Za(r,i,y)}return i.flags|=1,r=Ua(v,f),r.ref=i.ref,r.return=i,i.child=r}function N0(r,i,u,f,y){if(r!==null){var v=r.memoizedProps;if(Qo(v,f)&&r.ref===i.ref)if(bn=!1,i.pendingProps=f=v,Wm(r,y))(r.flags&131072)!==0&&(bn=!0);else return i.lanes=r.lanes,Za(r,i,y)}return Zm(r,i,u,f,y)}function _0(r,i,u,f){var y=f.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,r!==null){for(f=i.child=r.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~v}else f=0,i.child=null;return T0(r,i,v,u,f)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&ud(i,v!==null?v.cachePool:null),v!==null?Rx(i,v):wm(),Ox(i);else return f=i.lanes=536870912,T0(r,i,v!==null?v.baseLanes|u:u,u,f)}else v!==null?(ud(i,v.cachePool),Rx(i,v),Ei(),i.memoizedState=null):(r!==null&&ud(i,null),wm(),Ei());return Fn(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 T0(r,i,u,f,y){var v=pm();return v=v===null?null:{parent:yn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&ud(i,null),wm(),Ox(i),r!==null&&vl(r,i,f,!0),i.childLanes=y,null}function Cd(r,i){return i=Nd({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function A0(r,i,u){return _s(i,r.child,null,u),r=Cd(i,i.pendingProps),r.flags|=2,Or(i),i.memoizedState=null,r}function _A(r,i,u){var f=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ht){if(f.mode==="hidden")return r=Cd(i,f),i.lanes=536870912,uu(null,r);if(km(i),(r=Bt)?(r=$w(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=hx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return i.lanes=536870912,null}return Cd(i,f)}var v=r.memoizedState;if(v!==null){var k=v.dehydrated;if(km(i),y)if(i.flags&256)i.flags&=-257,i=A0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(bn||vl(r,i,u,!1),y=(u&r.childLanes)!==0,bn||y){if(f=Dt,f!==null&&(k=$c(f,u),k!==0&&k!==v.retryLane))throw v.retryLane=k,xs(r,k),vr(f,r,k),qm;Id(),i=A0(r,i,u)}else r=v.treeContext,Bt=Yr(k.nextSibling),Un=i,ht=!0,bi=null,Qr=!1,r!==null&&gx(i,r),i=Cd(i,f),i.flags|=4096;return i}return r=Ua(r.child,{mode:f.mode,children:f.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Ed(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 Zm(r,i,u,f,y){return js(i),u=Cm(r,i,u,f,void 0,y),f=Em(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(ht&&f&&sm(i),i.flags|=1,Fn(r,i,u,y),i.child)}function R0(r,i,u,f,y,v){return js(i),i.updateQueue=null,u=Dx(i,f,u,y),zx(r),f=Em(),r!==null&&!bn?(Nm(r,i,v),Za(r,i,v)):(ht&&f&&sm(i),i.flags|=1,Fn(r,i,u,v),i.child)}function O0(r,i,u,f,y){if(js(i),i.stateNode===null){var v=ml,k=u.contextType;typeof k=="object"&&k!==null&&(v=Bn(k)),v=new u(f,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=$m,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=f,v.state=i.memoizedState,v.refs={},ym(i),k=u.contextType,v.context=typeof k=="object"&&k!==null?Bn(k):ml,v.state=i.memoizedState,k=u.getDerivedStateFromProps,typeof k=="function"&&(Fm(i,u,k,f),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(k=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),k!==v.state&&$m.enqueueReplaceState(v,v.state,null),au(i,f,v,y),ru(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!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;k=ml,typeof ce=="object"&&ce!==null&&(k=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!==k)&&v0(i,v,f,k),Si=!1;var ne=i.memoizedState;v.state=ne,au(i,f,v,y),ru(),ee=i.memoizedState,A||ne!==ee||Si?(typeof he=="function"&&(Fm(i,u,he,f),ee=i.memoizedState),(H=Si||y0(i,u,H,f,ne,ee,k))?(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=f,i.memoizedState=ee),v.props=f,v.state=ee,v.context=k,f=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!1)}else{v=i.stateNode,vm(r,i),k=i.memoizedProps,ce=As(u,k),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"||(k!==he||ne!==H)&&v0(i,v,f,H),Si=!1,ne=i.memoizedState,v.state=ne,au(i,f,v,y),ru();var le=i.memoizedState;k!==he||ne!==le||Si||r!==null&&r.dependencies!==null&&ld(r.dependencies)?(typeof A=="function"&&(Fm(i,u,A,f),le=i.memoizedState),(ce=Si||y0(i,u,ce,f,ne,le,H)||r!==null&&r.dependencies!==null&&ld(r.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,le,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,le,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||k===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=f,i.memoizedState=le),v.props=f,v.state=le,v.context=H,f=ce):(typeof v.componentDidUpdate!="function"||k===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),f=!1)}return v=f,Ed(r,i),f=(i.flags&128)!==0,v||f?(v=i.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&f?(i.child=_s(i,r.child,null,y),i.child=_s(i,null,u,y)):Fn(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Za(r,i,y),r}function z0(r,i,u,f){return Ss(),i.flags|=256,Fn(r,i,u,f),i.child}var Gm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vm(r){return{baseLanes:r,cachePool:Sx()}}function Qm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Dr),r}function D0(r,i,u){var f=i.pendingProps,y=!1,v=(i.flags&128)!==0,k;if((k=v)||(k=r!==null&&r.memoizedState===null?!1:(fn.current&2)!==0),k&&(y=!0,i.flags&=-129),k=(i.flags&32)!==0,i.flags&=-33,r===null){if(ht){if(y?Ci(i):Ei(),(r=Bt)?(r=$w(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=hx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return Ap(r)?i.lanes=32:i.lanes=536870912,null}var A=f.children;return f=f.fallback,y?(Ei(),y=i.mode,A=Nd({mode:"hidden",children:A},y),f=ws(f,y,u,null),A.return=i,f.return=i,A.sibling=f,i.child=A,f=i.child,f.memoizedState=Vm(u),f.childLanes=Qm(r,k,u),i.memoizedState=Gm,uu(null,f)):(Ci(i),Km(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=Ym(r,i,u)):i.memoizedState!==null?(Ei(),i.child=r.child,i.flags|=128,i=null):(Ei(),A=f.fallback,y=i.mode,f=Nd({mode:"visible",children:f.children},y),A=ws(A,y,u,null),A.flags|=2,f.return=i,A.return=i,f.sibling=A,i.child=f,_s(i,r.child,null,u),f=i.child,f.memoizedState=Vm(u),f.childLanes=Qm(r,k,u),i.memoizedState=Gm,i=uu(null,f));else if(Ci(i),Ap(A)){if(k=A.nextSibling&&A.nextSibling.dataset,k)var ee=k.dgst;k=ee,f=Error(a(419)),f.stack="",f.digest=k,Xo({value:f,source:null,stack:null}),i=Ym(r,i,u)}else if(bn||vl(r,i,u,!1),k=(u&r.childLanes)!==0,bn||k){if(k=Dt,k!==null&&(f=$c(k,u),f!==0&&f!==H.retryLane))throw H.retryLane=f,xs(r,f),vr(k,r,f),qm;Tp(A)||Id(),i=Ym(r,i,u)}else Tp(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&&gx(i,r),i=Km(i,f.children),i.flags|=4096);return i}return y?(Ei(),A=f.fallback,y=i.mode,H=r.child,ee=H.sibling,f=Ua(H,{mode:"hidden",children:f.children}),f.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=Ua(ee,A):(A=ws(A,y,u,null),A.flags|=2),A.return=i,f.return=i,f.sibling=A,i.child=f,uu(null,f),f=i.child,A=r.child.memoizedState,A===null?A=Vm(u):(y=A.cachePool,y!==null?(H=yn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=Sx(),A={baseLanes:A.baseLanes|u,cachePool:y}),f.memoizedState=A,f.childLanes=Qm(r,k,u),i.memoizedState=Gm,uu(r.child,f)):(Ci(i),u=r.child,r=u.sibling,u=Ua(u,{mode:"visible",children:f.children}),u.return=i,u.sibling=null,r!==null&&(k=i.deletions,k===null?(i.deletions=[r],i.flags|=16):k.push(r)),i.child=u,i.memoizedState=null,u)}function Km(r,i){return i=Nd({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Nd(r,i){return r=Ar(22,r,null,i),r.lanes=0,r}function Ym(r,i,u){return _s(i,r.child,null,u),r=Km(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function M0(r,i,u){r.lanes|=i;var f=r.alternate;f!==null&&(f.lanes|=i),dm(r.return,i,u)}function Xm(r,i,u,f,y,v){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:y,treeForkCount:v}:(k.isBackwards=i,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=u,k.tailMode=y,k.treeForkCount=v)}function I0(r,i,u){var f=i.pendingProps,y=f.revealOrder,v=f.tail;f=f.children;var k=fn.current,A=(k&2)!==0;if(A?(k=k&1|2,i.flags|=128):k&=1,_(fn,k),Fn(r,i,f,u),f=ht?Yo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&M0(r,u,i);else if(r.tag===19)M0(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&&pd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),Xm(i,!1,y,u,v,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&pd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}Xm(i,!0,u,null,v,f);break;case"together":Xm(i,!1,null,null,void 0,f);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 Wm(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&ld(r)))}function TA(r,i,u){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),wi(i,yn,r.memoizedState.cache),Ss();break;case 27:case 5:Me(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,km(i),null;break;case 13:var f=i.memoizedState;if(f!==null)return f.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(f=(u&i.childLanes)!==0,f||(vl(r,i,u,!1),f=(u&i.childLanes)!==0),y){if(f)return I0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),_(fn,fn.current),f)break;return null;case 22:return i.lanes=0,_0(r,i,u,i.pendingProps);case 24:wi(i,yn,r.memoizedState.cache)}return Za(r,i,u)}function L0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)bn=!0;else{if(!Wm(r,u)&&(i.flags&128)===0)return bn=!1,TA(r,i,u);bn=(r.flags&131072)!==0}else bn=!1,ht&&(i.flags&1048576)!==0&&px(i,Yo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var f=i.pendingProps;if(r=Es(i.elementType),i.type=r,typeof r=="function")rm(r)?(f=As(r,f),i.tag=1,i=O0(null,i,r,f,u)):(i.tag=0,i=Zm(null,i,r,f,u));else{if(r!=null){var y=r.$$typeof;if(y===z){i.tag=11,i=C0(null,i,r,f,u);break e}else if(y===F){i.tag=14,i=E0(null,i,r,f,u);break e}}throw i=J(r)||r,Error(a(306,i,""))}}return i;case 0:return Zm(r,i,i.type,i.pendingProps,u);case 1:return f=i.type,y=As(f,i.pendingProps),O0(r,i,f,y,u);case 3:e:{if(we(i,i.stateNode.containerInfo),r===null)throw Error(a(387));f=i.pendingProps;var v=i.memoizedState;y=v.element,vm(r,i),au(i,f,null,u);var k=i.memoizedState;if(f=k.cache,wi(i,yn,f),f!==v.cache&&fm(i,[yn],u,!0),ru(),f=k.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:k.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=z0(r,i,f,u);break e}else if(f!==y){y=Zr(Error(a(424)),i),Xo(y),i=z0(r,i,f,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=_x(i,null,f,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Ss(),f===y){i=Za(r,i,u);break e}Fn(r,i,f,u)}i=i.child}return i;case 26:return Ed(r,i),r===null?(u=Qw(i.type,null,i.pendingProps,null))?i.memoizedState=u:ht||(u=i.type,r=i.pendingProps,f=Hd(ue.current).createElement(u),f[cn]=i,f[Zt]=r,$n(f,u,r),ft(f),i.stateNode=f):i.memoizedState=Qw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Me(i),r===null&&ht&&(f=i.stateNode=Zw(i.type,i.pendingProps,ue.current),Un=i,Qr=!0,y=Bt,Di(i.type)?(Rp=y,Bt=Yr(f.firstChild)):Bt=y),Fn(r,i,i.pendingProps.children,u),Ed(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ht&&((y=f=Bt)&&(f=i2(f,i.type,i.pendingProps,Qr),f!==null?(i.stateNode=f,Un=i,Bt=Yr(f.firstChild),Qr=!1,y=!0):y=!1),y||xi(i)),Me(i),y=i.type,v=i.pendingProps,k=r!==null?r.memoizedProps:null,f=v.children,Ep(y,v)?f=null:k!==null&&Ep(y,k)&&(i.flags|=32),i.memoizedState!==null&&(y=Cm(r,i,xA,null,null,u),ju._currentValue=y),Ed(r,i),Fn(r,i,f,u),i.child;case 6:return r===null&&ht&&((r=u=Bt)&&(u=s2(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),f=i.pendingProps,r===null?i.child=_s(i,null,f,u):Fn(r,i,f,u),i.child;case 11:return C0(r,i,i.type,i.pendingProps,u);case 7:return Fn(r,i,i.pendingProps,u),i.child;case 8:return Fn(r,i,i.pendingProps.children,u),i.child;case 12:return Fn(r,i,i.pendingProps.children,u),i.child;case 10:return f=i.pendingProps,wi(i,i.type,f.value),Fn(r,i,f.children,u),i.child;case 9:return y=i.type._context,f=i.pendingProps.children,js(i),y=Bn(y),f=f(y),i.flags|=1,Fn(r,i,f,u),i.child;case 14:return E0(r,i,i.type,i.pendingProps,u);case 15:return N0(r,i,i.type,i.pendingProps,u);case 19:return I0(r,i,u);case 31:return _A(r,i,u);case 22:return _0(r,i,u,i.pendingProps);case 24:return js(i),f=Bn(yn),r===null?(y=pm(),y===null&&(y=Dt,v=hm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:f,cache:y},ym(i),wi(i,yn,y)):((r.lanes&u)!==0&&(vm(r,i),au(i,null,null,u),ru()),y=r.memoizedState,v=i.memoizedState,y.parent!==f?(y={parent:f,cache:f},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),wi(i,yn,f)):(f=v.cache,wi(i,yn,f),f!==y.cache&&fm(i,[yn],u,!0))),Fn(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 Jm(r,i,u,f,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(cw())r.flags|=8192;else throw Ns=dd,gm}else r.flags&=-16777217}function P0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!Jw(i))if(cw())r.flags|=8192;else throw Ns=dd,gm}function _d(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 f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function Ft(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,f=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=f,r.childLanes=u,i}function AA(r,i,u){var f=i.pendingProps;switch(lm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(i),null;case 1:return Ft(i),null;case 3:return u=i.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),i.memoizedState.cache!==f&&(i.flags|=2048),$a(yn),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,um())),Ft(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ga(i),v!==null?(Ft(i),P0(i,v)):(Ft(i),Jm(i,y,null,f,u))):v?v!==r.memoizedState?(Ga(i),Ft(i),P0(i,v)):(Ft(i),i.flags&=-16777217):(r=r.memoizedProps,r!==f&&Ga(i),Ft(i),Jm(i,y,r,f,u)),null;case 27:if(Ue(i),u=ue.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}r=Z.current,yl(i)?yx(i):(r=Zw(y,f,u),i.stateNode=r,Ga(i))}return Ft(i),null;case 5:if(Ue(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}if(v=Z.current,yl(i))yx(i);else{var k=Hd(ue.current);switch(v){case 1:v=k.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=k.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=k.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?k.createElement("select",{is:f.is}):k.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?k.createElement(y,{is:f.is}):k.createElement(y)}}v[cn]=i,v[Zt]=f;e:for(k=i.child;k!==null;){if(k.tag===5||k.tag===6)v.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===i)break e;for(;k.sibling===null;){if(k.return===null||k.return===i)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}i.stateNode=v;e:switch($n(v,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ga(i)}}return Ft(i),Jm(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(a(166));if(r=ue.current,yl(i)){if(r=i.stateNode,u=i.memoizedProps,f=null,y=Un,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}r[cn]=i,r=!!(r.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||Dw(r.nodeValue,u)),r||xi(i,!0)}else r=Hd(r).createTextNode(f),r[cn]=i,i.stateNode=r}return Ft(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(f=yl(i),u!==null){if(r===null){if(!f)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;Ft(i),r=!1}else u=um(),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 Ft(i),null;case 13:if(f=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=yl(i),f!==null&&f.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;Ft(i),y=!1}else y=um(),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=f!==null,r=r!==null&&r.memoizedState!==null,u&&(f=i.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==y&&(f.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),_d(i,i.updateQueue),Ft(i),null);case 4:return pe(),r===null&&wp(i.stateNode.containerInfo),Ft(i),null;case 10:return $a(i.type),Ft(i),null;case 19:if(P(fn),f=i.memoizedState,f===null)return Ft(i),null;if(y=(i.flags&128)!==0,v=f.rendering,v===null)if(y)cu(f,!1);else{if(nn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=pd(r),v!==null){for(i.flags|=128,cu(f,!1),r=v.updateQueue,i.updateQueue=r,_d(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)fx(u,r),u=u.sibling;return _(fn,fn.current&1|2),ht&&Ba(i,f.treeForkCount),i.child}r=r.sibling}f.tail!==null&&on()>zd&&(i.flags|=128,y=!0,cu(f,!1),i.lanes=4194304)}else{if(!y)if(r=pd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,_d(i,r),cu(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!ht)return Ft(i),null}else 2*on()-f.renderingStartTime>zd&&u!==536870912&&(i.flags|=128,y=!0,cu(f,!1),i.lanes=4194304);f.isBackwards?(v.sibling=i.child,i.child=v):(r=f.last,r!==null?r.sibling=v:i.child=v,f.last=v)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=on(),r.sibling=null,u=fn.current,_(fn,y?u&1|2:u&1),ht&&Ba(i,f.treeForkCount),r):(Ft(i),null);case 22:case 23:return Or(i),Sm(),f=i.memoizedState!==null,r!==null?r.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(u&536870912)!==0&&(i.flags&128)===0&&(Ft(i),i.subtreeFlags&6&&(i.flags|=8192)):Ft(i),u=i.updateQueue,u!==null&&_d(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==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),$a(yn),Ft(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function RA(r,i){switch(lm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return $a(yn),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 $a(i.type),null;case 22:case 23:return Or(i),Sm(),r!==null&&P(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return $a(yn),null;case 25:return null;default:return null}}function U0(r,i){switch(lm(i),i.tag){case 3:$a(yn),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:$a(i.type);break;case 22:case 23:Or(i),Sm(),r!==null&&P(Cs);break;case 24:$a(yn)}}function du(r,i){try{var u=i.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var y=f.next;u=y;do{if((u.tag&r)===r){f=void 0;var v=u.create,k=u.inst;f=v(),k.destroy=f}u=u.next}while(u!==y)}}catch(A){_t(i,i.return,A)}}function Ni(r,i,u){try{var f=i.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var v=y.next;f=v;do{if((f.tag&r)===r){var k=f.inst,A=k.destroy;if(A!==void 0){k.destroy=void 0,y=i;var H=u,ee=A;try{ee()}catch(ce){_t(y,H,ce)}}}f=f.next}while(f!==v)}}catch(ce){_t(i,i.return,ce)}}function B0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Ax(i,u)}catch(f){_t(r,r.return,f)}}}function F0(r,i,u){u.props=As(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(f){_t(r,i,f)}}function fu(r,i){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof u=="function"?r.refCleanup=u(f):u.current=f}}catch(y){_t(r,i,y)}}function ja(r,i){var u=r.ref,f=r.refCleanup;if(u!==null)if(typeof f=="function")try{f()}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 $0(r){var i=r.type,u=r.memoizedProps,f=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(y){_t(r,r.return,y)}}function ep(r,i,u){try{var f=r.stateNode;JA(f,r.type,u,i),f[Zt]=i}catch(y){_t(r,r.return,y)}}function H0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Di(r.type)||r.tag===4}function tp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||H0(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&&Di(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 np(r,i,u){var f=r.tag;if(f===5||f===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(f!==4&&(f===27&&Di(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(np(r,i,u),r=r.sibling;r!==null;)np(r,i,u),r=r.sibling}function Td(r,i,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(f!==4&&(f===27&&Di(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(Td(r,i,u),r=r.sibling;r!==null;)Td(r,i,u),r=r.sibling}function q0(r){var i=r.stateNode,u=r.memoizedProps;try{for(var f=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);$n(i,f,u),i[cn]=r,i[Zt]=u}catch(v){_t(r,r.return,v)}}var Va=!1,xn=!1,rp=!1,Z0=typeof WeakSet=="function"?WeakSet:Set,zn=null;function OA(r,i){if(r=r.containerInfo,jp=Yd,r=rx(r),Yh(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var y=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var k=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=k+y),he!==v||f!==0&&he.nodeType!==3||(H=k+f),he.nodeType===3&&(k+=he.nodeValue.length),(le=he.firstChild)!==null;)ne=he,he=le;for(;;){if(he===r)break t;if(ne===u&&++ee===y&&(A=k),ne===v&&++ce===f&&(H=k),(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(Cp={focusedElem:r,selectionRange:u},Yd=!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,f=u.stateNode;try{var Te=As(u.type,y);r=f.getSnapshotBeforeUpdate(Te,v),f.__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)_p(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":_p(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 G0(r,i,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Ka(r,u),f&4&&du(5,u);break;case 1:if(Ka(r,u),f&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(k){_t(u,u.return,k)}else{var y=As(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(k){_t(u,u.return,k)}}f&64&&B0(u),f&512&&fu(u,u.return);break;case 3:if(Ka(r,u),f&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{Ax(r,i)}catch(k){_t(u,u.return,k)}}break;case 27:i===null&&f&4&&q0(u);case 26:case 5:Ka(r,u),i===null&&f&4&&$0(u),f&512&&fu(u,u.return);break;case 12:Ka(r,u);break;case 31:Ka(r,u),f&4&&K0(r,u);break;case 13:Ka(r,u),f&4&&Y0(r,u),f&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=FA.bind(null,u),l2(r,u))));break;case 22:if(f=u.memoizedState!==null||Va,!f){i=i!==null&&i.memoizedState!==null||xn,y=Va;var v=xn;Va=f,(xn=i)&&!v?Ya(r,u,(u.subtreeFlags&8772)!==0):Ka(r,u),Va=y,xn=v}break;case 30:break;default:Ka(r,u)}}function V0(r){var i=r.alternate;i!==null&&(r.alternate=null,V0(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;)Q0(r,i,u),u=u.sibling}function Q0(r,i,u){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(Ht,u)}catch{}switch(u.tag){case 26:xn||ja(u,i),Qa(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:xn||ja(u,i);var f=Gt,y=mr;Di(u.type)&&(Gt=u.stateNode,mr=!1),Qa(r,i,u),wu(u.stateNode),Gt=f,mr=y;break;case 5:xn||ja(u,i);case 6:if(f=Gt,y=mr,Gt=null,Qa(r,i,u),Gt=f,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,Bw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Pl(r)):Bw(Gt,u.stateNode));break;case 4:f=Gt,y=mr,Gt=u.stateNode.containerInfo,mr=!0,Qa(r,i,u),Gt=f,mr=y;break;case 0:case 11:case 14:case 15:Ni(2,u,i),xn||Ni(4,u,i),Qa(r,i,u);break;case 1:xn||(ja(u,i),f=u.stateNode,typeof f.componentWillUnmount=="function"&&F0(u,i,f)),Qa(r,i,u);break;case 21:Qa(r,i,u);break;case 22:xn=(f=xn)||u.memoizedState!==null,Qa(r,i,u),xn=f;break;default:Qa(r,i,u)}}function K0(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 Y0(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 zA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Z0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Z0),i;default:throw Error(a(435,r.tag))}}function Ad(r,i){var u=zA(r);i.forEach(function(f){if(!u.has(f)){u.add(f);var y=$A.bind(null,r,f);f.then(y,y)}})}function pr(r,i){var u=i.deletions;if(u!==null)for(var f=0;f<u.length;f++){var y=u[f],v=r,k=i,A=k;e:for(;A!==null;){switch(A.tag){case 27:if(Di(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));Q0(v,k,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;)X0(i,r),i=i.sibling}var ma=null;function X0(r,i){var u=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:pr(i,r),gr(r),f&4&&(Ni(3,r,r.return),du(3,r),Ni(5,r,r.return));break;case 1:pr(i,r),gr(r),f&512&&(xn||u===null||ja(u,u.return)),f&64&&Va&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var y=ma;if(pr(i,r),gr(r),f&512&&(xn||u===null||ja(u,u.return)),f&4){var v=u!==null?u.memoizedState:null;if(f=r.memoizedState,u===null)if(f===null)if(r.stateNode===null){e:{f=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(f){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(f),y.head.insertBefore(v,y.querySelector("head > title"))),$n(v,f,u),v[cn]=r,ft(v),f=v;break e;case"link":var k=Xw("link","href",y).get(f+(u.href||""));if(k){for(var A=0;A<k.length;A++)if(v=k[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)){k.splice(A,1);break t}}v=y.createElement(f),$n(v,f,u),y.head.appendChild(v);break;case"meta":if(k=Xw("meta","content",y).get(f+(u.content||""))){for(A=0;A<k.length;A++)if(v=k[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)){k.splice(A,1);break t}}v=y.createElement(f),$n(v,f,u),y.head.appendChild(v);break;default:throw Error(a(468,f))}v[cn]=r,ft(v),f=v}r.stateNode=f}else Ww(y,r.type,r.stateNode);else r.stateNode=Yw(y,f,r.memoizedProps);else v!==f?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,f===null?Ww(y,r.type,r.stateNode):Yw(y,f,r.memoizedProps)):f===null&&r.stateNode!==null&&ep(r,r.memoizedProps,u.memoizedProps)}break;case 27:pr(i,r),gr(r),f&512&&(xn||u===null||ja(u,u.return)),u!==null&&f&4&&ep(r,r.memoizedProps,u.memoizedProps);break;case 5:if(pr(i,r),gr(r),f&512&&(xn||u===null||ja(u,u.return)),r.flags&32){y=r.stateNode;try{ll(y,"")}catch(Te){_t(r,r.return,Te)}}f&4&&r.stateNode!=null&&(y=r.memoizedProps,ep(r,y,u!==null?u.memoizedProps:y)),f&1024&&(rp=!0);break;case 6:if(pr(i,r),gr(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,u=r.stateNode;try{u.nodeValue=f}catch(Te){_t(r,r.return,Te)}}break;case 3:if(Gd=null,y=ma,ma=qd(i.containerInfo),pr(i,r),ma=y,gr(r),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Pl(i.containerInfo)}catch(Te){_t(r,r.return,Te)}rp&&(rp=!1,W0(r));break;case 4:f=ma,ma=qd(r.stateNode.containerInfo),pr(i,r),gr(r),ma=f;break;case 12:pr(i,r),gr(r);break;case 31:pr(i,r),gr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ad(r,f)));break;case 13:pr(i,r),gr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Od=on()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ad(r,f)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,ee=Va,ce=xn;if(Va=ee||y,xn=ce||H,pr(i,r),xn=ce,Va=ee,gr(r),f&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Va||xn||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)k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.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}f&4&&(f=r.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,Ad(r,u))));break;case 19:pr(i,r),gr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Ad(r,f)));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,f=r.return;f!==null;){if(H0(f)){u=f;break}f=f.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=tp(r);Td(r,v,y);break;case 5:var k=u.stateNode;u.flags&32&&(ll(k,""),u.flags&=-33);var A=tp(r);Td(r,A,k);break;case 3:case 4:var H=u.stateNode.containerInfo,ee=tp(r);np(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 W0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;W0(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;)G0(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 f=i.alternate,y=r,v=i,k=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),f=v,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ee){_t(f,f.return,ee)}if(f=v,y=f.updateQueue,y!==null){var A=f.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Tx(H[y],A)}catch(ee){_t(f,f.return,ee)}}u&&k&64&&B0(v),fu(v,v.return);break;case 27:q0(v);case 26:case 5:Ya(y,v,u),u&&f===null&&k&4&&$0(v),fu(v,v.return);break;case 12:Ya(y,v,u);break;case 31:Ya(y,v,u),u&&k&4&&K0(y,v);break;case 13:Ya(y,v,u),u&&k&4&&Y0(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 ap(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 ip(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,f){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)J0(r,i,u,f),i=i.sibling}function J0(r,i,u,f){var y=i.flags;switch(i.tag){case 0:case 11:case 15:pa(r,i,u,f),y&2048&&du(9,i);break;case 1:pa(r,i,u,f);break;case 3:pa(r,i,u,f),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,f),r=i.stateNode;try{var v=i.memoizedProps,k=v.id,A=v.onPostCommit;typeof A=="function"&&A(k,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){_t(i,i.return,H)}}else pa(r,i,u,f);break;case 31:pa(r,i,u,f);break;case 13:pa(r,i,u,f);break;case 23:break;case 22:v=i.stateNode,k=i.alternate,i.memoizedState!==null?v._visibility&2?pa(r,i,u,f):hu(r,i):v._visibility&2?pa(r,i,u,f):(v._visibility|=2,Nl(r,i,u,f,(i.subtreeFlags&10256)!==0||!1)),y&2048&&ap(k,i);break;case 24:pa(r,i,u,f),y&2048&&ip(i.alternate,i);break;default:pa(r,i,u,f)}}function Nl(r,i,u,f,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,k=i,A=u,H=f,ee=k.flags;switch(k.tag){case 0:case 11:case 15:Nl(v,k,A,H,y),du(8,k);break;case 23:break;case 22:var ce=k.stateNode;k.memoizedState!==null?ce._visibility&2?Nl(v,k,A,H,y):hu(v,k):(ce._visibility|=2,Nl(v,k,A,H,y)),y&&ee&2048&&ap(k.alternate,k);break;case 24:Nl(v,k,A,H,y),y&&ee&2048&&ip(k.alternate,k);break;default:Nl(v,k,A,H,y)}i=i.sibling}}function hu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,f=i,y=f.flags;switch(f.tag){case 22:hu(u,f),y&2048&&ap(f.alternate,f);break;case 24:hu(u,f),y&2048&&ip(f.alternate,f);break;default:hu(u,f)}i=i.sibling}}var mu=8192;function _l(r,i,u){if(r.subtreeFlags&mu)for(r=r.child;r!==null;)ew(r,i,u),r=r.sibling}function ew(r,i,u){switch(r.tag){case 26:_l(r,i,u),r.flags&mu&&r.memoizedState!==null&&b2(u,ma,r.memoizedState,r.memoizedProps);break;case 5:_l(r,i,u);break;case 3:case 4:var f=ma;ma=qd(r.stateNode.containerInfo),_l(r,i,u),ma=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=mu,mu=16777216,_l(r,i,u),mu=f):_l(r,i,u));break;default:_l(r,i,u)}}function tw(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 f=i[u];zn=f,rw(f,r)}tw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)nw(r),r=r.sibling}function nw(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,Rd(r)):pu(r);break;default:pu(r)}}function Rd(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var f=i[u];zn=f,rw(f,r)}tw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),Rd(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Rd(i));break;default:Rd(i)}r=r.sibling}}function rw(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 f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Wo(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,zn=f;else e:for(u=r;zn!==null;){f=zn;var y=f.sibling,v=f.return;if(V0(f),f===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(yn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Bn(yn).controller.signal}},MA=typeof WeakMap=="function"?WeakMap:Map,jt=0,Dt=null,at=null,ut=0,Nt=0,zr=null,_i=!1,Tl=!1,sp=!1,Xa=0,nn=0,Ti=0,Os=0,lp=0,Dr=0,Al=0,gu=null,yr=null,op=!1,Od=0,aw=0,zd=1/0,Dd=null,Ai=null,En=0,Ri=null,Rl=null,Wa=0,up=0,cp=null,iw=null,yu=0,dp=null;function Mr(){return(jt&2)!==0&&ut!==0?ut&-ut:q.T!==null?yp():Io()}function sw(){if(Dr===0)if((ut&536870912)===0||ht){var r=da;da<<=1,(da&3932160)===0&&(da=262144),Dr=r}else Dr=536870912;return r=Rr.current,r!==null&&(r.flags|=32),Dr}function vr(r,i,u){(r===Dt&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)&&(Ol(r,0),Oi(r,ut,Dr,!1)),pn(r,u),((jt&2)===0||r!==Dt)&&(r===Dt&&((jt&2)===0&&(Os|=u),nn===4&&Oi(r,ut,Dr,!1)),Ca(r))}function lw(r,i,u){if((jt&6)!==0)throw Error(a(327));var f=!u&&(i&127)===0&&(i&r.expiredLanes)===0||wa(r,i),y=f?PA(r,i):hp(r,i,!0),v=f;do{if(y===0){Tl&&!f&&Oi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!IA(u)){y=hp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var k=0;else k=r.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){i=k;e:{var A=r;y=gu;var H=A.current.memoizedState.isDehydrated;if(H&&(Ol(A,k).flags|=256),k=hp(A,k,!1),k!==2){if(sp&&!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=k}if(v=!1,y!==2)continue}}if(y===1){Ol(r,0),Oi(r,i,0,!0);break}e:{switch(f=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Oi(f,i,Dr,!_i);break e;case 2:yr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Od+300-on(),10<y)){if(Oi(f,i,Dr,!_i),Da(f,0,!0)!==0)break e;Wa=i,f.timeoutHandle=Pw(ow.bind(null,f,u,yr,Dd,op,i,Dr,Os,Al,_i,v,"Throttled",-0,0),y);break e}ow(f,u,yr,Dd,op,i,Dr,Os,Al,_i,v,null,-0,0)}}break}while(!0);Ca(r)}function ow(r,i,u,f,y,v,k,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},ew(i,v,he);var Te=(v&62914560)===v?Od-on():(v&4194048)===v?aw-on():0;if(Te=x2(he,Te),Te!==null){Wa=v,r.cancelPendingCommit=Te(gw.bind(null,r,i,v,u,f,y,k,A,H,ce,he,null,ne,le)),Oi(r,v,k,!ee);return}}gw(r,i,v,u,f,y,k,A,H)}function IA(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 f=0;f<u.length;f++){var y=u[f],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,f){i&=~lp,i&=~Os,r.suspendedLanes|=i,r.pingedLanes&=~i,f&&(r.warmLanes|=i),f=r.expirationTimes;for(var y=i;0<y;){var v=31-rt(y),k=1<<v;f[v]=-1,y&=~k}u!==0&&pi(r,u,i)}function Md(){return(jt&6)===0?(vu(0),!1):!0}function fp(){if(at!==null){if(Nt===0)var r=at.return;else r=at,Fa=ks=null,_m(r),Sl=null,eu=0,r=at;for(;r!==null;)U0(r.alternate,r),r=r.return;at=null}}function Ol(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,n2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),Wa=0,fp(),Dt=r,at=u=Ua(r.current,null),ut=i,Nt=0,zr=null,_i=!1,Tl=wa(r,i),sp=!1,Al=Dr=lp=Os=Ti=nn=0,yr=gu=null,op=!1,(i&8)!==0&&(i|=i&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=i;0<f;){var y=31-rt(f),v=1<<y;i|=r[y],f&=~v}return Xa=i,nd(),u}function uw(r,i){Ke=null,q.H=ou,i===wl||i===cd?(i=Cx(),Nt=3):i===gm?(i=Cx(),Nt=4):Nt=i===qm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,zr=i,at===null&&(nn=1,jd(r,Zr(i,r.current)))}function cw(){var r=Rr.current;return r===null?!0:(ut&4194048)===ut?Kr===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Kr:!1}function dw(){var r=q.H;return q.H=ou,r===null?ou:r}function fw(){var r=q.A;return q.A=DA,r}function Id(){nn=4,_i||(ut&4194048)!==ut&&Rr.current!==null||(Tl=!0),(Ti&134217727)===0&&(Os&134217727)===0||Dt===null||Oi(Dt,ut,Dr,!1)}function hp(r,i,u){var f=jt;jt|=2;var y=dw(),v=fw();(Dt!==r||ut!==i)&&(Dd=null,Ol(r,i)),i=!1;var k=nn;e:do try{if(Nt!==0&&at!==null){var A=at,H=zr;switch(Nt){case 8:fp(),k=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){k=0;break e}break;default:ee=Nt,Nt=0,zr=null,zl(r,A,H,ee)}}LA(),k=nn;break}catch(ce){uw(r,ce)}while(!0);return i&&r.shellSuspendCounter++,Fa=ks=null,jt=f,q.H=y,q.A=v,at===null&&(Dt=null,ut=0,nd()),k}function LA(){for(;at!==null;)hw(at)}function PA(r,i){var u=jt;jt|=2;var f=dw(),y=fw();Dt!==r||ut!==i?(Dd=null,zd=on()+500,Ol(r,i)):Tl=wa(r,i);e:do try{if(Nt!==0&&at!==null){i=at;var v=zr;t:switch(Nt){case 1:Nt=0,zr=null,zl(r,i,v,1);break;case 2:case 9:if(kx(v)){Nt=0,zr=null,mw(i);break}i=function(){Nt!==2&&Nt!==9||Dt!==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:kx(v)?(Nt=0,zr=null,mw(i)):(Nt=0,zr=null,zl(r,i,v,7));break;case 5:var k=null;switch(at.tag){case 26:k=at.memoizedState;case 5:case 27:var A=at;if(k?Jw(k):A.stateNode.complete){Nt=0,zr=null;var H=A.sibling;if(H!==null)at=H;else{var ee=A.return;ee!==null?(at=ee,Ld(ee)):at=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:fp(),nn=6;break e;default:throw Error(a(462))}}UA();break}catch(ce){uw(r,ce)}while(!0);return Fa=ks=null,q.H=f,q.A=y,jt=u,at!==null?0:(Dt=null,ut=0,nd(),nn)}function UA(){for(;at!==null&&!hi();)hw(at)}function hw(r){var i=L0(r.alternate,r,Xa);r.memoizedProps=r.pendingProps,i===null?Ld(r):at=i}function mw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=R0(u,i,i.pendingProps,i.type,void 0,ut);break;case 11:i=R0(u,i,i.pendingProps,i.type.render,i.ref,ut);break;case 5:_m(i);default:U0(u,i),i=at=fx(i,Xa),i=L0(u,i,Xa)}r.memoizedProps=r.pendingProps,i===null?Ld(r):at=i}function zl(r,i,u,f){Fa=ks=null,_m(i),Sl=null,eu=0;var y=i.return;try{if(NA(r,y,i,u,ut)){nn=1,jd(r,Zr(u,r.current)),at=null;return}}catch(v){if(y!==null)throw at=y,v;nn=1,jd(r,Zr(u,r.current)),at=null;return}i.flags&32768?(ht||f===1?r=!0:Tl||(ut&536870912)!==0?r=!1:(_i=r=!0,(f===2||f===9||f===3||f===6)&&(f=Rr.current,f!==null&&f.tag===13&&(f.flags|=16384))),pw(i,r)):Ld(i)}function Ld(r){var i=r;do{if((i.flags&32768)!==0){pw(i,_i);return}r=i.return;var u=AA(i.alternate,i,Xa);if(u!==null){at=u;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);nn===0&&(nn=5)}function pw(r,i){do{var u=RA(r.alternate,r);if(u!==null){u.flags&=32767,at=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=u}while(r!==null);nn=6,at=null}function gw(r,i,u,f,y,v,k,A,H){r.cancelPendingCommit=null;do Pd();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|=tm,_r(r,u,v,k,A,H),r===Dt&&(at=Dt=null,ut=0),Rl=i,Ri=r,Wa=u,up=v,cp=y,iw=f,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,HA(Fe,function(){return ww(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,y=te.p,te.p=2,k=jt,jt|=4;try{OA(r,i,u)}finally{jt=k,te.p=y,q.T=f}}En=1,yw(),vw(),bw()}}function yw(){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 f=te.p;te.p=2;var y=jt;jt|=4;try{X0(i,r);var v=Cp,k=rx(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(k!==A&&A&&A.ownerDocument&&nx(A.ownerDocument.documentElement,A)){if(H!==null&&Yh(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&&(k=Ot,Ot=He,He=k);var K=tx(A,He),G=tx(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}}Yd=!!jp,Cp=jp=null}finally{jt=y,te.p=f,q.T=u}}r.current=i,En=2}}function vw(){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 f=te.p;te.p=2;var y=jt;jt|=4;try{G0(r,i.alternate,i)}finally{jt=y,te.p=f,q.T=u}}En=3}}function bw(){if(En===4||En===3){En=0,mi();var r=Ri,i=Rl,u=Wa,f=iw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?En=5:(En=0,Rl=Ri=null,xw(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(f!==null){i=q.T,y=te.p,te.p=2,q.T=null;try{for(var v=r.onRecoverableError,k=0;k<f.length;k++){var A=f[k];v(A.value,{componentStack:A.stack})}}finally{q.T=i,te.p=y}}(Wa&3)!==0&&Pd(),Ca(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===dp?yu++:(yu=0,dp=r):yu=0,vu(0)}}function xw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Wo(i)))}function Pd(){return yw(),vw(),bw(),ww()}function ww(){if(En!==5)return!1;var r=Ri,i=up;up=0;var u=fa(Wa),f=q.T,y=te.p;try{te.p=32>u?32:u,q.T=null,u=cp,cp=null;var v=Ri,k=Wa;if(En=0,Rl=Ri=null,Wa=0,(jt&6)!==0)throw Error(a(331));var A=jt;if(jt|=4,nw(v.current),J0(v,v.current,k,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=f,xw(r,i)}}function Sw(r,i,u){i=Zr(u,i),i=Hm(r.stateNode,i,2),r=ji(r,i,2),r!==null&&(pn(r,2),Ca(r))}function _t(r,i,u){if(r.tag===3)Sw(r,r,u);else for(;i!==null;){if(i.tag===3){Sw(i,r,u);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ai===null||!Ai.has(f))){r=Zr(u,r),u=k0(2),f=ji(i,u,2),f!==null&&(j0(u,f,i,r),pn(f,2),Ca(f));break}}i=i.return}}function mp(r,i,u){var f=r.pingCache;if(f===null){f=r.pingCache=new MA;var y=new Set;f.set(i,y)}else y=f.get(i),y===void 0&&(y=new Set,f.set(i,y));y.has(u)||(sp=!0,y.add(u),r=BA.bind(null,r,i,u),i.then(r,r))}function BA(r,i,u){var f=r.pingCache;f!==null&&f.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Dt===r&&(ut&u)===u&&(nn===4||nn===3&&(ut&62914560)===ut&&300>on()-Od?(jt&2)===0&&Ol(r,0):lp|=u,Al===ut&&(Al=0)),Ca(r)}function kw(r,i){i===0&&(i=Ce()),r=xs(r,i),r!==null&&(pn(r,i),Ca(r))}function FA(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),kw(r,u)}function $A(r,i){var u=0;switch(r.tag){case 31:case 13:var f=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(a(314))}f!==null&&f.delete(i),kw(r,u)}function HA(r,i){return Ln(r,i)}var Ud=null,Dl=null,pp=!1,Bd=!1,gp=!1,zi=0;function Ca(r){r!==Dl&&r.next===null&&(Dl===null?Ud=Dl=r:Dl=Dl.next=r),Bd=!0,pp||(pp=!0,ZA())}function vu(r,i){if(!gp&&Bd){gp=!0;do for(var u=!1,f=Ud;f!==null;){if(r!==0){var y=f.pendingLanes;if(y===0)var v=0;else{var k=f.suspendedLanes,A=f.pingedLanes;v=(1<<31-rt(42|r)+1)-1,v&=y&~(k&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,Nw(f,v))}else v=ut,v=Da(f,f===Dt?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||wa(f,v)||(u=!0,Nw(f,v));f=f.next}while(u);gp=!1}}function qA(){jw()}function jw(){Bd=pp=!1;var r=0;zi!==0&&t2()&&(r=zi);for(var i=on(),u=null,f=Ud;f!==null;){var y=f.next,v=Cw(f,i);v===0?(f.next=null,u===null?Ud=y:u.next=y,y===null&&(Dl=u)):(u=f,(r!==0||(v&3)!==0)&&(Bd=!0)),f=y}En!==0&&En!==5||vu(r),zi!==0&&(zi=0)}function Cw(r,i){for(var u=r.suspendedLanes,f=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var k=31-rt(v),A=1<<k,H=y[k];H===-1?((A&u)===0||(A&f)!==0)&&(y[k]=qt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Dt,u=ut,u=Da(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,u===0||r===i&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&fr(f),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||wa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(f!==null&&fr(f),fa(u)){case 2:case 8:u=ye;break;case 32:u=Fe;break;case 268435456:u=nt;break;default:u=Fe}return f=Ew.bind(null,r),u=Ln(u,f),r.callbackPriority=i,r.callbackNode=u,i}return f!==null&&f!==null&&fr(f),r.callbackPriority=2,r.callbackNode=null,2}function Ew(r,i){if(En!==0&&En!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Pd()&&r.callbackNode!==u)return null;var f=ut;return f=Da(r,r===Dt?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(lw(r,f,i),Cw(r,on()),r.callbackNode!=null&&r.callbackNode===u?Ew.bind(null,r):null)}function Nw(r,i){if(Pd())return null;lw(r,i,!0)}function ZA(){r2(function(){(jt&6)!==0?Ln(oe,qA):jw()})}function yp(){if(zi===0){var r=bl;r===0&&(r=ca,ca<<=1,(ca&261888)===0&&(ca=256)),zi=r}return zi}function _w(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Qc(""+r)}function Tw(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 GA(r,i,u,f,y){if(i==="submit"&&u&&u.stateNode===y){var v=_w((y[Zt]||null).action),k=f.submitter;k&&(i=(i=k[Zt]||null)?_w(i.formAction):k.getAttribute("formAction"),i!==null&&(v=i,k=null));var A=new Wc("action","action",null,f,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(zi!==0){var H=k?Tw(y,k):new FormData(y);Lm(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=k?Tw(y,k):new FormData(y),Lm(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var vp=0;vp<em.length;vp++){var bp=em[vp],VA=bp.toLowerCase(),QA=bp[0].toUpperCase()+bp.slice(1);ha(VA,"on"+QA)}ha(sx,"onAnimationEnd"),ha(lx,"onAnimationIteration"),ha(ox,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(cA,"onTransitionRun"),ha(dA,"onTransitionStart"),ha(fA,"onTransitionCancel"),ha(ux,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),gn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gn("onBeforeInput",["compositionend","keypress","textInput","paste"]),gn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gn("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(" "),KA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bu));function Aw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var f=r[u],y=f.event;f=f.listeners;e:{var v=void 0;if(i)for(var k=f.length-1;0<=k;k--){var A=f[k],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){td(ce)}y.currentTarget=null,v=H}else for(k=0;k<f.length;k++){if(A=f[k],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){td(ce)}y.currentTarget=null,v=H}}}}function it(r,i){var u=i[il];u===void 0&&(u=i[il]=new Set);var f=r+"__bubble";u.has(f)||(Rw(i,r,2,!1),u.add(f))}function xp(r,i,u){var f=0;i&&(f|=4),Rw(u,r,f,i)}var Fd="_reactListening"+Math.random().toString(36).slice(2);function wp(r){if(!r[Fd]){r[Fd]=!0,Wt.forEach(function(u){u!=="selectionchange"&&(KA.has(u)||xp(u,!1,r),xp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Fd]||(i[Fd]=!0,xp("selectionchange",!1,i))}}function Rw(r,i,u,f){switch(sS(i)){case 2:var y=k2;break;case 8:y=j2;break;default:y=Ip}u=y.bind(null,i,u,r),y=void 0,!Fh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),f?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 Sp(r,i,u,f,y){var v=f;if((i&1)===0&&(i&2)===0&&f!==null)e:for(;;){if(f===null)return;var k=f.tag;if(k===3||k===4){var A=f.stateNode.containerInfo;if(A===y)break;if(k===4)for(k=f.return;k!==null;){var H=k.tag;if((H===3||H===4)&&k.stateNode.containerInfo===y)return;k=k.return}for(;A!==null;){if(k=$(A),k===null)return;if(H=k.tag,H===5||H===6||H===26||H===27){f=v=k;continue e}A=A.parentNode}}f=f.return}Ib(function(){var ee=v,ce=Uh(u),he=[];e:{var ne=cx.get(r);if(ne!==void 0){var le=Wc,Te=r;switch(r){case"keypress":if(Yc(u)===0)break e;case"keydown":case"keyup":le=$T;break;case"focusin":Te="focus",le=Zh;break;case"focusout":Te="blur",le=Zh;break;case"beforeblur":case"afterblur":le=Zh;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=Ub;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=AT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=ZT;break;case sx:case lx:case ox:le=zT;break;case ux:le=VT;break;case"scroll":case"scrollend":le=_T;break;case"wheel":le=KT;break;case"copy":case"cut":case"paste":le=MT;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=XT}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=Fo(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!==Ph&&(Te=u.relatedTarget||u.fromElement)&&($(Te)||Te[Ma]))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?$(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=Ub,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,$(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=YA,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&&Ow(he,ne,le,He,!1),Te!==null&&Ot!==null&&Ow(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=Kb;else if(Vb(ne))if(Yb)St=lA;else{St=iA;var De=aA}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Lh(ee.elementType)&&(St=Kb):St=sA;if(St&&(St=St(r,ee))){Qb(he,St,u,ce);break e}De&&De(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Ih(ne,"number",ne.value)}switch(De=ee?Ne(ee):window,r){case"focusin":(Vb(De)||De.contentEditable==="true")&&(dl=De,Xh=ee,Ko=null);break;case"focusout":Ko=Xh=dl=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,ax(he,u,ce);break;case"selectionchange":if(uA)break;case"keydown":case"keyup":ax(he,u,ce)}var Xe;if(Vh)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?Zb(r,u)&&(ct="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ct="onCompositionStart");ct&&($b&&u.locale!=="ko"&&(cl||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&cl&&(Xe=Lb()):(yi=ce,$h="value"in yi?yi.value:yi.textContent,cl=!0)),De=$d(ee,ct),0<De.length&&(ct=new Bb(ct,r,null,u,ce),he.push({event:ct,listeners:De}),Xe?ct.data=Xe:(Xe=Gb(u),Xe!==null&&(ct.data=Xe)))),(Xe=JT?eA(r,u):tA(r,u))&&(ct=$d(ee,"onBeforeInput"),0<ct.length&&(De=new Bb("onBeforeInput","beforeinput",null,u,ce),he.push({event:De,listeners:ct}),De.data=Xe)),GA(he,r,ee,u,ce)}Aw(he,i)})}function xu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function $d(r,i){for(var u=i+"Capture",f=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=Fo(r,u),y!=null&&f.unshift(xu(r,y,v)),y=Fo(r,i),y!=null&&f.push(xu(r,y,v))),r.tag===3)return f;r=r.return}return[]}function YA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Ow(r,i,u,f,y){for(var v=i._reactName,k=[];u!==null&&u!==f;){var A=u,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===f)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,y?(ee=Fo(u,v),ee!=null&&k.unshift(xu(u,ee,H))):y||(ee=Fo(u,v),ee!=null&&k.push(xu(u,ee,H)))),u=u.return}k.length!==0&&r.push({event:i,listeners:k})}var XA=/\r\n?/g,WA=/\u0000|\uFFFD/g;function zw(r){return(typeof r=="string"?r:""+r).replace(XA,`
49
+ `).replace(WA,"")}function Dw(r,i){return i=zw(i),zw(r)===i}function Rt(r,i,u,f,y,v){switch(u){case"children":typeof f=="string"?i==="body"||i==="textarea"&&f===""||ll(r,f):(typeof f=="number"||typeof f=="bigint")&&i!=="body"&&ll(r,""+f);break;case"className":Gc(r,"class",f);break;case"tabIndex":Gc(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Gc(r,u,f);break;case"style":Db(r,f,v);break;case"data":if(i!=="object"){Gc(r,"data",f);break}case"src":case"href":if(f===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(u);break}f=Qc(""+f),r.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="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(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(u);break}f=Qc(""+f),r.setAttribute(u,f);break;case"onClick":f!=null&&(r.onclick=La);break;case"onScroll":f!=null&&it("scroll",r);break;case"onScrollEnd":f!=null&&it("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){r.removeAttribute("xlink:href");break}u=Qc(""+f),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":f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,""+f):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":f&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":f===!0?r.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,f):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(u,f):r.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(u):r.setAttribute(u,f);break;case"popover":it("beforetoggle",r),it("toggle",r),Zc(r,"popover",f);break;case"xlinkActuate":Ia(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ia(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ia(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ia(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ia(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ia(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Zc(r,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=ET.get(u)||u,Zc(r,u,f))}}function kp(r,i,u,f,y,v){switch(u){case"style":Db(r,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof f=="string"?ll(r,f):(typeof f=="number"||typeof f=="bigint")&&ll(r,""+f);break;case"onScroll":f!=null&&it("scroll",r);break;case"onScrollEnd":f!=null&&it("scrollend",r);break;case"onClick":f!=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 f=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,f,y);break e}u in r?r[u]=f:f===!0?r.setAttribute(u,""):Zc(r,u,f)}}}function $n(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",r),it("load",r);var f=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var k=u[v];if(k!=null)switch(v){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,v,k,u,null)}}y&&Rt(r,i,"srcSet",u.srcSet,u,null),f&&Rt(r,i,"src",u.src,u,null);return;case"input":it("invalid",r);var A=v=k=y=null,H=null,ee=null;for(f in u)if(u.hasOwnProperty(f)){var ce=u[f];if(ce!=null)switch(f){case"name":y=ce;break;case"type":k=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,f,ce,u,null)}}Ab(r,v,A,H,ee,k,y,!1);return;case"select":it("invalid",r),f=k=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":k=A;break;case"multiple":f=A;default:Rt(r,i,y,A,u,null)}i=v,u=k,r.multiple=!!f,i!=null?sl(r,!!f,i,!1):u!=null&&sl(r,!!f,u,!0);return;case"textarea":it("invalid",r),v=y=f=null;for(k in u)if(u.hasOwnProperty(k)&&(A=u[k],A!=null))switch(k){case"value":f=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,k,A,u,null)}Ob(r,f,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(f=u[H],f!=null))switch(H){case"selected":r.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Rt(r,i,H,f,u,null)}return;case"dialog":it("beforetoggle",r),it("toggle",r),it("cancel",r),it("close",r);break;case"iframe":case"object":it("load",r);break;case"video":case"audio":for(f=0;f<bu.length;f++)it(bu[f],r);break;case"image":it("error",r),it("load",r);break;case"details":it("toggle",r);break;case"embed":case"source":case"link":it("error",r),it("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)&&(f=u[ee],f!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,ee,f,u,null)}return;default:if(Lh(i)){for(ce in u)u.hasOwnProperty(ce)&&(f=u[ce],f!==void 0&&kp(r,i,ce,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Rt(r,i,A,f,u,null))}function JA(r,i,u,f){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,k=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:f.hasOwnProperty(le)||Rt(r,i,le,null,f,he)}}for(var ne in f){var le=f[ne];if(he=u[ne],f.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":k=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,f,he)}}Mh(r,k,A,H,ee,ce,v,y);return;case"select":le=k=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:f.hasOwnProperty(v)||Rt(r,i,v,null,f,H)}for(y in f)if(v=f[y],H=u[y],f.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":ne=v;break;case"defaultValue":A=v;break;case"multiple":k=v;default:v!==H&&Rt(r,i,y,v,f,H)}i=A,u=k,f=le,ne!=null?sl(r,!!u,ne,!1):!!f!=!!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&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(r,i,A,null,f,y)}for(k in f)if(y=f[k],v=u[k],f.hasOwnProperty(k)&&(y!=null||v!=null))switch(k){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,k,y,f,v)}Rb(r,ne,le);return;case"option":for(var Te in u)if(ne=u[Te],u.hasOwnProperty(Te)&&ne!=null&&!f.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Rt(r,i,Te,null,f,ne)}for(H in f)if(ne=f[H],le=u[H],f.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,f,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&&!f.hasOwnProperty(He)&&Rt(r,i,He,null,f,ne);for(ee in f)if(ne=f[ee],le=u[ee],f.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,f,le)}return;default:if(Lh(i)){for(var Ot in u)ne=u[Ot],u.hasOwnProperty(Ot)&&ne!==void 0&&!f.hasOwnProperty(Ot)&&kp(r,i,Ot,void 0,f,ne);for(ce in f)ne=f[ce],le=u[ce],!f.hasOwnProperty(ce)||ne===le||ne===void 0&&le===void 0||kp(r,i,ce,ne,f,le);return}}for(var K in u)ne=u[K],u.hasOwnProperty(K)&&ne!=null&&!f.hasOwnProperty(K)&&Rt(r,i,K,null,f,ne);for(he in f)ne=f[he],le=u[he],!f.hasOwnProperty(he)||ne===le||ne==null&&le==null||Rt(r,i,he,ne,f,le)}function Mw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function e2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var y=u[f],v=y.transferSize,k=y.initiatorType,A=y.duration;if(v&&A&&Mw(k)){for(k=0,A=y.responseEnd,f+=1;f<u.length;f++){var H=u[f],ee=H.startTime;if(ee>A)break;var ce=H.transferSize,he=H.initiatorType;ce&&Mw(he)&&(H=H.responseEnd,k+=ce*(H<A?1:(A-ee)/(H-ee)))}if(--f,i+=8*(v+k)/(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 jp=null,Cp=null;function Hd(r){return r.nodeType===9?r:r.ownerDocument}function Iw(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 Lw(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 Ep(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 Np=null;function t2(){var r=window.event;return r&&r.type==="popstate"?r===Np?!1:(Np=r,!0):(Np=null,!1)}var Pw=typeof setTimeout=="function"?setTimeout:void 0,n2=typeof clearTimeout=="function"?clearTimeout:void 0,Uw=typeof Promise=="function"?Promise:void 0,r2=typeof queueMicrotask=="function"?queueMicrotask:typeof Uw<"u"?function(r){return Uw.resolve(null).then(r).catch(a2)}:Pw;function a2(r){setTimeout(function(){throw r})}function Di(r){return r==="head"}function Bw(r,i){var u=i,f=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(f===0){r.removeChild(y),Pl(i);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;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 k=v.nextSibling,A=v.nodeName;v[gi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=k}}else u==="body"&&wu(r.ownerDocument.body);u=y}while(u);Pl(i)}function Fw(r,i){var u=r;r=0;do{var f=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||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=f}while(u)}function _p(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":_p(u),Pe(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function i2(r,i,u,f){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){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 s2(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 $w(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 Tp(r){return r.data==="$?"||r.data==="$~"}function Ap(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function l2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var f=function(){i(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}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 Rp=null;function Hw(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 qw(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 Zw(r,i,u){switch(i=Hd(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,Gw=new Set;function qd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ja=te.d;te.d={f:o2,r:u2,D:c2,C:d2,L:f2,m:h2,X:p2,S:m2,M:g2};function o2(){var r=Ja.f(),i=Md();return r||i}function u2(r){var i=me(r);i!==null&&i.tag===5&&i.type==="form"?u0(i):Ja.r(r)}var Ml=typeof document>"u"?null:document;function Vw(r,i,u){var f=Ml;if(f&&typeof i=="string"&&i){var y=Hr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Gw.has(y)||(Gw.add(y),r={rel:r,crossOrigin:u,href:i},f.querySelector(y)===null&&(i=f.createElement("link"),$n(i,"link",r),ft(i),f.head.appendChild(i)))}}function c2(r){Ja.D(r),Vw("dns-prefetch",r,null)}function d2(r,i){Ja.C(r,i),Vw("preconnect",r,i)}function f2(r,i,u){Ja.L(r,i,u);var f=Ml;if(f&&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=p({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),Xr.set(v,r),f.querySelector(y)!==null||i==="style"&&f.querySelector(Su(v))||i==="script"&&f.querySelector(ku(v))||(i=f.createElement("link"),$n(i,"link",r),ft(i),f.head.appendChild(i)))}}function h2(r,i){Ja.m(r,i);var u=Ml;if(u&&r){var f=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Hr(f)+'"][href="'+Hr(r)+'"]',v=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Ll(r)}if(!Xr.has(v)&&(r=p({rel:"modulepreload",href:r},i),Xr.set(v,r),u.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ku(v)))return}f=u.createElement("link"),$n(f,"link",r),ft(f),u.head.appendChild(f)}}}function m2(r,i,u){Ja.S(r,i,u);var f=Ml;if(f&&r){var y=bt(f).hoistableStyles,v=Il(r);i=i||"default";var k=y.get(v);if(!k){var A={loading:0,preload:null};if(k=f.querySelector(Su(v)))A.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":i},u),(u=Xr.get(v))&&Op(r,u);var H=k=f.createElement("link");ft(H),$n(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,Zd(k,i,f)}k={type:"stylesheet",instance:k,count:1,state:A},y.set(v,k)}}}function p2(r,i){Ja.X(r,i);var u=Ml;if(u&&r){var f=bt(u).hoistableScripts,y=Ll(r),v=f.get(y);v||(v=u.querySelector(ku(y)),v||(r=p({src:r,async:!0},i),(i=Xr.get(y))&&zp(r,i),v=u.createElement("script"),ft(v),$n(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(y,v))}}function g2(r,i){Ja.M(r,i);var u=Ml;if(u&&r){var f=bt(u).hoistableScripts,y=Ll(r),v=f.get(y);v||(v=u.querySelector(ku(y)),v||(r=p({src:r,async:!0,type:"module"},i),(i=Xr.get(y))&&zp(r,i),v=u.createElement("script"),ft(v),$n(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(y,v))}}function Qw(r,i,u,f){var y=(y=ue.current)?qd(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,f=u.get(i),f||(f={type:"style",instance:null,count:0,state:null},u.set(i,f)),f):{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,k=v.get(r);if(k||(y=y.ownerDocument||y,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,k),(v=y.querySelector(Su(r)))&&!v._p&&(k.instance=v,k.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||y2(y,r,u,k.state))),i&&f===null)throw Error(a(528,""));return k}if(i&&f!==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,f=u.get(i),f||(f={type:"script",instance:null,count:0,state:null},u.set(i,f)),f):{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 Kw(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function y2(r,i,u,f){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=r.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),$n(i,"link",u),ft(i),r.head.appendChild(i))}function Ll(r){return'[src="'+Hr(r)+'"]'}function ku(r){return"script[async]"+r}function Yw(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var f=r.querySelector('style[data-href~="'+Hr(u.href)+'"]');if(f)return i.instance=f,ft(f),f;var y=p({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(r.ownerDocument||r).createElement("style"),ft(f),$n(f,"style",y),Zd(f,u.precedence,r),i.instance=f;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;f=Kw(u),(y=Xr.get(y))&&Op(f,y),v=(r.ownerDocument||r).createElement("link"),ft(v);var k=v;return k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),$n(v,"link",f),i.state.loading|=4,Zd(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):(f=u,(y=Xr.get(v))&&(f=p({},u),zp(f,y)),r=r.ownerDocument||r,y=r.createElement("script"),ft(y),$n(y,"link",f),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&&(f=i.instance,i.state.loading|=4,Zd(f,u.precedence,r));return i.instance}function Zd(r,i,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,v=y,k=0;k<f.length;k++){var A=f[k];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 Op(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function zp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Gd=null;function Xw(r,i,u){if(Gd===null){var f=new Map,y=Gd=new Map;y.set(u,f)}else y=Gd,f=y.get(u),f||(f=new Map,y.set(u,f));if(f.has(r))return f;for(f.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 k=v.getAttribute(i)||"";k=r+k;var A=f.get(k);A?A.push(v):f.set(k,[v])}}return f}function Ww(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function v2(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 Jw(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function b2(r,i,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Il(f.href),v=i.querySelector(Su(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Vd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,ft(v);return}v=i.ownerDocument||i,f=Kw(f),(y=Xr.get(y))&&Op(f,y),v=v.createElement("link"),ft(v);var k=v;k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),$n(v,"link",f),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=Vd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Dp=0;function x2(r,i){return r.stylesheets&&r.count===0&&Kd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var f=setTimeout(function(){if(r.stylesheets&&Kd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Dp===0&&(Dp=62500*e2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Kd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Dp?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function Vd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Qd=null;function Kd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Qd=new Map,i.forEach(w2,r),Qd=null,Vd.call(r))}function w2(r,i){if(!(i.state.loading&4)){var u=Qd.get(r);if(u)var f=u.get(null);else{u=new Map,Qd.set(r,u);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var k=y[v];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(u.set(k.dataset.precedence,k),f=k)}f&&u.set(null,f)}y=i.instance,k=y.getAttribute("data-precedence"),v=u.get(k)||f,v===f&&u.set(null,y),u.set(k,y),this.count++,f=Vd.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),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 S2(r,i,u,f,y,v,k,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=f,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function eS(r,i,u,f,y,v,k,A,H,ee,ce,he){return r=new S2(r,i,u,k,H,ee,ce,he,A),i=1,v===!0&&(i|=24),v=Ar(3,null,null,i),r.current=v,v.stateNode=r,i=hm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:f,isDehydrated:u,cache:i},ym(v),r}function tS(r){return r?(r=ml,r):ml}function nS(r,i,u,f,y,v){y=tS(y),f.context===null?f.context=y:f.pendingContext=y,f=ki(i),f.payload={element:u},v=v===void 0?null:v,v!==null&&(f.callback=v),u=ji(r,f,i),u!==null&&(vr(u,r,i),nu(u,r,i))}function rS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Mp(r,i){rS(r,i),(r=r.alternate)&&rS(r,i)}function aS(r){if(r.tag===13||r.tag===31){var i=xs(r,67108864);i!==null&&vr(i,r,67108864),Mp(r,67108864)}}function iS(r){if(r.tag===13||r.tag===31){var i=Mr();i=rr(i);var u=xs(r,i);u!==null&&vr(u,r,i),Mp(r,i)}}var Yd=!0;function k2(r,i,u,f){var y=q.T;q.T=null;var v=te.p;try{te.p=2,Ip(r,i,u,f)}finally{te.p=v,q.T=y}}function j2(r,i,u,f){var y=q.T;q.T=null;var v=te.p;try{te.p=8,Ip(r,i,u,f)}finally{te.p=v,q.T=y}}function Ip(r,i,u,f){if(Yd){var y=Lp(f);if(y===null)Sp(r,i,f,Xd,u),lS(r,f);else if(E2(y,r,i,u,f))f.stopPropagation();else if(lS(r,f),i&4&&-1<C2.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 k=Gn(v.pendingLanes);if(k!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;k;){var H=1<<31-rt(k);A.entanglements[1]|=H,k&=~H}Ca(v),(jt&6)===0&&(zd=on()+500,vu(0))}}break;case 31:case 13:A=xs(v,2),A!==null&&vr(A,v,2),Md(),Mp(v,2)}if(v=Lp(f),v===null&&Sp(r,i,f,Xd,u),v===y)break;y=v}y!==null&&f.stopPropagation()}else Sp(r,i,f,null,u)}}function Lp(r){return r=Uh(r),Pp(r)}var Xd=null;function Pp(r){if(Xd=null,r=$(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=d(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 Xd=r,null}function sS(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 Fe:case Ve:return 32;case nt:return 268435456;default:return 32}default:return 32}}var Up=!1,Mi=null,Ii=null,Li=null,Cu=new Map,Eu=new Map,Pi=[],C2="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 lS(r,i){switch(r){case"focusin":case"focusout":Mi=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,f,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:f,nativeEvent:v,targetContainers:[y]},i!==null&&(i=me(i),i!==null&&aS(i)),r):(r.eventSystemFlags|=f,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function E2(r,i,u,f,y){switch(i){case"focusin":return Mi=Nu(Mi,r,i,u,f,y),!0;case"dragenter":return Ii=Nu(Ii,r,i,u,f,y),!0;case"mouseover":return Li=Nu(Li,r,i,u,f,y),!0;case"pointerover":var v=y.pointerId;return Cu.set(v,Nu(Cu.get(v)||null,r,i,u,f,y)),!0;case"gotpointercapture":return v=y.pointerId,Eu.set(v,Nu(Eu.get(v)||null,r,i,u,f,y)),!0}return!1}function oS(r){var i=$(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(){iS(u)});return}}else if(i===31){if(i=d(u),i!==null){r.blockedOn=i,Lo(r.priority,function(){iS(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 Wd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=Lp(r.nativeEvent);if(u===null){u=r.nativeEvent;var f=new u.constructor(u.type,u);Ph=f,u.target.dispatchEvent(f),Ph=null}else return i=me(u),i!==null&&aS(i),r.blockedOn=u,!1;i.shift()}return!0}function uS(r,i,u){Wd(r)&&u.delete(i)}function N2(){Up=!1,Mi!==null&&Wd(Mi)&&(Mi=null),Ii!==null&&Wd(Ii)&&(Ii=null),Li!==null&&Wd(Li)&&(Li=null),Cu.forEach(uS),Eu.forEach(uS)}function Jd(r,i){r.blockedOn===i&&(r.blockedOn=null,Up||(Up=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,N2)))}var ef=null;function cS(r){ef!==r&&(ef=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ef===r&&(ef=null);for(var i=0;i<r.length;i+=3){var u=r[i],f=r[i+1],y=r[i+2];if(typeof f!="function"){if(Pp(f||u)===null)continue;break}var v=me(u);v!==null&&(r.splice(i,3),i-=3,Lm(v,{pending:!0,data:y,method:u.method,action:f},f,y))}}))}function Pl(r){function i(H){return Jd(H,r)}Mi!==null&&Jd(Mi,r),Ii!==null&&Jd(Ii,r),Li!==null&&Jd(Li,r),Cu.forEach(i),Eu.forEach(i);for(var u=0;u<Pi.length;u++){var f=Pi[u];f.blockedOn===r&&(f.blockedOn=null)}for(;0<Pi.length&&(u=Pi[0],u.blockedOn===null);)oS(u),u.blockedOn===null&&Pi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var y=u[f],v=u[f+1],k=y[Zt]||null;if(typeof v=="function")k||cS(u);else if(k){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,k=v[Zt]||null)A=k.formAction;else if(Pp(y)!==null)continue}else A=k.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),cS(u)}}}function dS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(k){return y=k})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),f||setTimeout(u,20)}function u(){if(!f&&!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 f=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Bp(r){this._internalRoot=r}tf.prototype.render=Bp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,f=Mr();nS(u,f,r,i,null,null)},tf.prototype.unmount=Bp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;nS(r.current,2,null,r,null,null),Md(),i[Ma]=null}};function tf(r){this._internalRoot=r}tf.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&&oS(r)}};var fS=t.version;if(fS!=="19.2.4")throw Error(a(527,fS,"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?g(r):null,r=r===null?null:r.stateNode,r};var _2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nf.isDisabled&&nf.supportsFiber)try{Ht=nf.inject(_2),Lt=nf}catch{}}return Tu.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,f="",y=b0,v=x0,k=w0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(k=i.onRecoverableError)),i=eS(r,1,!1,null,null,u,f,null,y,v,k,dS),r[Ma]=i.current,wp(r),new Bp(i)},Tu.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var f=!1,y="",v=b0,k=x0,A=w0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(k=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=eS(r,1,!0,i,u??null,f,y,H,v,k,A,dS),i.context=tS(null),u=i.current,f=Mr(),f=rr(f),y=ki(f),y.callback=null,ji(u,y,f),u=f,i.current.lanes=u,pn(i,u),Ca(i),r[Ma]=i.current,wp(r),new tf(i)},Tu.version="19.2.4",Tu}var kS;function U2(){if(kS)return qp.exports;kS=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=P2(),qp.exports}var B2=U2(),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,aj,F2=(aj=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,aj),tv=new F2,$2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qi,Wy,ij,H2=(ij=class{constructor(){_e(this,Qi,$2);_e(this,Wy,!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,Wy=new WeakMap,ij),Ms=new H2;function q2(e){setTimeout(e,0)}var Z2=typeof window>"u"||"Deno"in globalThis;function Yn(){}function G2(e,t){return typeof e=="function"?e(t):e}function Zg(e){return typeof e=="number"&&e>=0&&e!==1/0}function yj(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 jS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:d}=e;if(c){if(a){if(t.queryHash!==nv(c,t.options))return!1}else if(!nc(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||s&&s!==t.state.fetchStatus||o&&!o(t))}function CS(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(!nc(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function nv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Vs)(e)}function Vs(e){return JSON.stringify(e,(t,n)=>Gg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function nc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>nc(e[n],t[n])):!1}var V2=Object.prototype.hasOwnProperty;function rv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=ES(e)&&ES(t);if(!a&&!(Gg(e)&&Gg(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),d=c.length,m=a?new Array(d):{};let h=0;for(let g=0;g<d;g++){const p=a?g:c[g],b=e[p],w=t[p];if(b===w){m[p]=b,(a?g<o:V2.call(e,p))&&h++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){m[p]=w;continue}const S=rv(b,w,n+1);m[p]=S,S===b&&h++}return o===d&&h===o?e:m}function rc(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 ES(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gg(e){if(!NS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!NS(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function NS(e){return Object.prototype.toString.call(e)==="[object Object]"}function Q2(e){return new Promise(t=>{Ms.setTimeout(t,e)})}function Vg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?rv(e,t):t}function K2(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function Y2(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var av=Symbol();function vj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===av?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iv(e,t){return typeof e=="function"?e(...t):!!e}function X2(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 ac=(()=>{let e=()=>Z2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Qg(){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 W2=q2;function J2(){let e=[],t=0,n=d=>{d()},a=d=>{d()},s=W2;const o=d=>{t?e.push(d):s(()=>{n(d)})},c=()=>{const d=e;e=[],d.length&&s(()=>{a(()=>{d.forEach(m=>{n(m)})})})};return{batch:d=>{let m;t++;try{m=d()}finally{t--,t||c()}return m},batchCalls:d=>(...m)=>{o(()=>{d(...m)})},schedule:o,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{a=d},setScheduler:d=>{s=d}}}var sn=J2(),ao,Ki,io,sj,eR=(sj=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,sj),If=new eR;function tR(e){return Math.min(1e3*2**e,3e4)}function bj(e){return(e??"online")==="online"?If.isOnline():!0}var Kg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function xj(e){let t=!1,n=0,a;const s=Qg(),o=()=>s.status!=="pending",c=j=>{var E;if(!o()){const C=new Kg(j);b(C),(E=e.onCancel)==null||E.call(e,C)}},d=()=>{t=!0},m=()=>{t=!1},h=()=>tv.isFocused()&&(e.networkMode==="always"||If.isOnline())&&e.canRun(),g=()=>bj(e.networkMode)&&e.canRun(),p=j=>{o()||(a==null||a(),s.resolve(j))},b=j=>{o()||(a==null||a(),s.reject(j))},w=()=>new Promise(j=>{var E;a=C=>{(o()||h())&&j(C)},(E=e.onPause)==null||E.call(e)}).then(()=>{var j;a=void 0,o()||(j=e.onContinue)==null||j.call(e)}),S=()=>{if(o())return;let j;const E=n===0?e.initialPromise:void 0;try{j=E??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(p).catch(C=>{var R;if(o())return;const N=e.retry??(ac.isServer()?0:3),O=e.retryDelay??tR,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){b(C);return}n++,(R=e.onFail)==null||R.call(e,n,C),Q2(z).then(()=>h()?void 0:w()).then(()=>{t?b(C):S()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:d,continueRetry:m,canStart:g,start:()=>(g()?S():w().then(S),s)}}var Us,lj,wj=(lj=class{constructor(){_e(this,Us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zg(this.gcTime)&&Se(this,Us,Ms.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ac.isServer()?1/0:300*1e3))}clearGcTimeout(){B(this,Us)&&(Ms.clearTimeout(B(this,Us)),Se(this,Us,void 0))}},Us=new WeakMap,lj),Bs,so,Wr,Fs,Dn,bc,$s,Pr,Sj,ti,oj,nR=(oj=class extends wj{constructor(t){super();_e(this,Pr);_e(this,Bs);_e(this,so);_e(this,Wr);_e(this,Fs);_e(this,Dn);_e(this,bc);_e(this,$s);Se(this,$s,!1),Se(this,bc,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,Fs,t.client),Se(this,Wr,B(this,Fs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,Bs,TS(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,Dn))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,bc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=TS(this.options);n.data!==void 0&&(this.setState(_S(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=Vg(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,Dn))==null?void 0:a.promise;return(s=B(this,Dn))==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===av||!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:!yj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Dn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Dn))==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,Dn)&&(B(this,$s)||qe(this,Pr,Sj).call(this)?B(this,Dn).cancel({revert:!0}):B(this,Dn).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,g,p,b,w,S,j,E,C,N,O;if(this.state.fetchStatus!=="idle"&&((m=B(this,Dn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(B(this,Dn))return B(this,Dn).continueRetry(),B(this,Dn).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,$s,!0),a.signal)})},o=()=>{const z=vj(this.options,n),R=(()=>{const F={client:B(this,Fs),queryKey:this.queryKey,meta:this.meta};return s(F),F})();return Se(this,$s,!1),this.options.persister?this.options.persister(z,R,this):z(R)},d=(()=>{const z={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:B(this,Fs),state:this.state,fetchFn:o};return s(z),z})();(h=this.options.behavior)==null||h.onFetch(d,this),Se(this,so,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&qe(this,Pr,ti).call(this,{type:"fetch",meta:(p=d.fetchOptions)==null?void 0:p.meta}),Se(this,Dn,xj({initialPromise:n==null?void 0:n.initialPromise,fn:d.fetchFn,onCancel:z=>{z instanceof Kg&&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:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const z=await B(this,Dn).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(w=(b=B(this,Wr).config).onSuccess)==null||w.call(b,z,this),(j=(S=B(this,Wr).config).onSettled)==null||j.call(S,z,this.state.error,this),z}catch(z){if(z instanceof Kg){if(z.silent)return B(this,Dn).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,Fs=new WeakMap,Dn=new WeakMap,bc=new WeakMap,$s=new WeakMap,Pr=new WeakSet,Sj=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,...kj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,..._S(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})})},oj);function kj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _S(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function TS(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,xc,lr,Hs,lo,ni,Yi,wc,oo,uo,qs,Zs,Xi,co,Et,Vu,Yg,Xg,Wg,Jg,ey,ty,ny,jj,uj,sv=(uj=class extends Xs{constructor(t,n){super();_e(this,Et);_e(this,wr);_e(this,mt);_e(this,xc);_e(this,lr);_e(this,Hs);_e(this,lo);_e(this,ni);_e(this,Yi);_e(this,wc);_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,Qg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,mt).addObserver(this),AS(B(this,mt),this.options)?qe(this,Et,Vu).call(this):this.updateResult(),qe(this,Et,Jg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ry(B(this,mt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ry(B(this,mt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,qe(this,Et,ey).call(this),qe(this,Et,ty).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,ny).call(this),B(this,mt).setOptions(this.options),n._defaulted&&!rc(this.options,n)&&B(this,wr).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,mt),observer:this});const s=this.hasListeners();s&&RS(B(this,mt),a,this.options,n)&&qe(this,Et,Vu).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,Yg).call(this);const o=qe(this,Et,Xg).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,Wg).call(this,o)}getOptimisticResult(t){const n=B(this,wr).getQueryCache().build(B(this,wr),t),a=this.createResult(n,t);return aR(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,Vu).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),d=B(this,lo),h=t!==a?t.state:B(this,xc),{state:g}=t;let p={...g},b=!1,w;if(n._optimisticResults){const M=this.hasListeners(),Y=!M&&AS(t,n),ae=M&&RS(t,a,n,s);(Y||ae)&&(p={...p,...kj(g.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:S,errorUpdatedAt:j,status:E}=p;w=p.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&E==="pending"){let M;o!=null&&o.isPlaceholderData&&n.placeholderData===(d==null?void 0:d.placeholderData)?(M=o.data,C=!0):M=typeof n.placeholderData=="function"?n.placeholderData((V=B(this,uo))==null?void 0:V.state.data,B(this,uo)):n.placeholderData,M!==void 0&&(E="success",w=Vg(o==null?void 0:o.data,M,n),b=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===B(this,wc))w=B(this,oo);else try{Se(this,wc,n.select),w=n.select(w),w=Vg(o==null?void 0:o.data,w,n),Se(this,oo,w),Se(this,Yi,null)}catch(M){Se(this,Yi,M)}B(this,Yi)&&(S=B(this,Yi),w=B(this,oo),j=Date.now(),E="error");const N=p.fetchStatus==="fetching",O=E==="pending",z=E==="error",L=O&&N,R=w!==void 0,U={status:E,fetchStatus:p.fetchStatus,isPending:O,isSuccess:E==="success",isError:z,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:S,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!O,isLoadingError:z&&!R,isPaused:p.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:z&&R,isStale:lv(t,n),refetch:this.refetch,promise:B(this,ni),isEnabled:ea(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=U.data!==void 0,Y=U.status==="error"&&!M,ae=X=>{Y?X.reject(U.error):M&&X.resolve(U.data)},xe=()=>{const X=Se(this,ni,U.promise=Qg());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)),rc(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(d=>{const m=d;return B(this,lr)[m]!==t[m]&&c.has(m)})};qe(this,Et,jj).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&qe(this,Et,Jg).call(this)}},wr=new WeakMap,mt=new WeakMap,xc=new WeakMap,lr=new WeakMap,Hs=new WeakMap,lo=new WeakMap,ni=new WeakMap,Yi=new WeakMap,wc=new WeakMap,oo=new WeakMap,uo=new WeakMap,qs=new WeakMap,Zs=new WeakMap,Xi=new WeakMap,co=new WeakMap,Et=new WeakSet,Vu=function(t){qe(this,Et,ny).call(this);let n=B(this,mt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Yn)),n},Yg=function(){qe(this,Et,ey).call(this);const t=rs(this.options.staleTime,B(this,mt));if(ac.isServer()||B(this,lr).isStale||!Zg(t))return;const a=yj(B(this,lr).dataUpdatedAt,t)+1;Se(this,qs,Ms.setTimeout(()=>{B(this,lr).isStale||this.updateResult()},a))},Xg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,mt)):this.options.refetchInterval)??!1},Wg=function(t){qe(this,Et,ty).call(this),Se(this,Xi,t),!(ac.isServer()||ea(this.options.enabled,B(this,mt))===!1||!Zg(B(this,Xi))||B(this,Xi)===0)&&Se(this,Zs,Ms.setInterval(()=>{(this.options.refetchIntervalInBackground||tv.isFocused())&&qe(this,Et,Vu).call(this)},B(this,Xi)))},Jg=function(){qe(this,Et,Yg).call(this),qe(this,Et,Wg).call(this,qe(this,Et,Xg).call(this))},ey=function(){B(this,qs)&&(Ms.clearTimeout(B(this,qs)),Se(this,qs,void 0))},ty=function(){B(this,Zs)&&(Ms.clearInterval(B(this,Zs)),Se(this,Zs,void 0))},ny=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,xc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},jj=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"})})},uj);function rR(e,t){return ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function AS(e,t){return rR(e,t)||e.state.data!==void 0&&ry(e,t,t.refetchOnMount)}function ry(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&&lv(e,t)}return!1}function RS(e,t,n,a){return(e!==t||ea(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lv(e,n)}function lv(e,t){return ea(t.enabled,e)!==!1&&e.isStaleByTime(rs(t.staleTime,e))}function aR(e,t){return!rc(e.getCurrentResult(),t)}function OS(e){return{onFetch:(t,n)=>{var g,p,b,w,S;const a=t.options,s=(b=(p=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:p.fetchMore)==null?void 0:b.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let d={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const E=O=>{X2(O,()=>t.signal,()=>j=!0)},C=vj(t.options,t.fetchOptions),N=async(O,z,L)=>{if(j)return Promise.reject();if(z==null&&O.pages.length)return Promise.resolve(O);const F=(()=>{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(F),{maxPages:V}=t.options,M=L?Y2:K2;return{pages:M(O.pages,U,V),pageParams:M(O.pageParams,z,V)}};if(s&&o.length){const O=s==="backward",z=O?iR:zS,L={pages:o,pageParams:c},R=z(a,L);d=await N(L,R,O)}else{const O=e??o.length;do{const z=m===0?c[0]??a.initialPageParam:zS(a,d);if(m>0&&z==null)break;d=await N(d,z),m++}while(m<O)}return d};t.options.persister?t.fetchFn=()=>{var j,E;return(E=(j=t.options).persister)==null?void 0:E.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function zS(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 iR(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 Sc,Na,Qn,Gs,_a,Hi,cj,sR=(cj=class extends wj{constructor(t){super();_e(this,_a);_e(this,Sc);_e(this,Na);_e(this,Qn);_e(this,Gs);Se(this,Sc,t.client),this.mutationId=t.mutationId,Se(this,Qn,t.mutationCache),Se(this,Na,[]),this.state=t.state||Cj(),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,d,m,h,g,p,b,w,S,j,E,C,N,O,z,L,R,F;const n=()=>{qe(this,_a,Hi).call(this,{type:"continue"})},a={client:B(this,Sc),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,Gs,xj({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((d=(c=this.options).onMutate)==null?void 0:d.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((p=(g=this.options).onSuccess)==null?void 0:p.call(g,U,t,this.state.context,a)),await((w=(b=B(this,Qn).config).onSettled)==null?void 0:w.call(b,U,null,this.state.variables,this.state.context,this,a)),await((j=(S=this.options).onSettled)==null?void 0:j.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((F=(R=this.options).onSettled)==null?void 0:F.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)}}},Sc=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})})},cj);function Cj(){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,kc,dj,lR=(dj=class extends Xs{constructor(t={}){super();_e(this,ri);_e(this,ga);_e(this,kc);this.config=t,Se(this,ri,new Set),Se(this,ga,new Map),Se(this,kc,0)}build(t,n,a){const s=new sR({client:t,mutationCache:this,mutationId:++rf(this,kc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){B(this,ri).add(t);const n=af(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=af(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=af(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=af(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=>CS(n,a))}findAll(t={}){return this.getAll().filter(n=>CS(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,kc=new WeakMap,dj);function af(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ai,Wi,Sr,ii,li,Nf,ay,fj,oR=(fj=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,Nf).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),rc(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,Nf).call(this),qe(this,li,ay).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,Nf).call(this),qe(this,li,ay).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,Nf=function(){var a;const n=((a=B(this,Sr))==null?void 0:a.state)??Cj();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})},ay=function(n){sn.batch(()=>{var a,s,o,c,d,m,h,g;if(B(this,ii)&&this.hasListeners()){const p=B(this,Wi).variables,b=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,p,b,w)}catch(S){Promise.reject(S)}try{(c=(o=B(this,ii)).onSettled)==null||c.call(o,n.data,null,p,b,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(m=(d=B(this,ii)).onError)==null||m.call(d,n.error,p,b,w)}catch(S){Promise.reject(S)}try{(g=(h=B(this,ii)).onSettled)==null||g.call(h,void 0,n.error,p,b,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(p=>{p(B(this,Wi))})})},fj);function DS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function uR(e,t,n){const a=e.slice(0);return a[t]=n,a}var fo,Lr,ho,mo,Jr,Ji,jc,Cc,Ec,Nc,qn,iy,sy,ly,oy,uy,hj,cR=(hj=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,jc);_e(this,Cc);_e(this,Ec);_e(this,Nc,[]);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,oy).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,ly).call(this,B(this,ho));s.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const o=s.map(p=>p.observer),c=o.map(p=>p.getCurrentResult()),d=a.length!==o.length,m=o.some((p,b)=>p!==a[b]),h=d||m,g=h?!0:c.some((p,b)=>{const w=B(this,Lr)[b];return!w||!rc(p,w)});!h&&!g||(h&&(Se(this,Nc,s),Se(this,Jr,o)),Se(this,Lr,c),this.hasListeners()&&(h&&(DS(a,o).forEach(p=>{p.destroy()}),DS(o,a).forEach(p=>{p.subscribe(b=>{qe(this,qn,oy).call(this,p,b)})})),qe(this,qn,uy).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,ly).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,sy).call(this,c??s,n,o),()=>qe(this,qn,iy).call(this,s,a)]}},fo=new WeakMap,Lr=new WeakMap,ho=new WeakMap,mo=new WeakMap,Jr=new WeakMap,Ji=new WeakMap,jc=new WeakMap,Cc=new WeakMap,Ec=new WeakMap,Nc=new WeakMap,qn=new WeakSet,iy=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(d=>{d.observer.trackProp(c)})})})},sy=function(t,n,a){if(n){const s=B(this,Ec),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,d)=>c!==s[d]));return(!B(this,Ji)||B(this,Lr)!==B(this,Cc)||o||n!==B(this,jc))&&(Se(this,jc,n),Se(this,Cc,B(this,Lr)),a!==void 0&&Se(this,Ec,a),Se(this,Ji,rv(B(this,Ji),n(t)))),B(this,Ji)}return t},ly=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),d=((m=n.get(o.queryHash))==null?void 0:m.shift())??new sv(B(this,fo),o);a.push({defaultedQueryOptions:o,observer:d})}),a},oy=function(t,n){const a=B(this,Jr).indexOf(t);a!==-1&&(Se(this,Lr,uR(B(this,Lr),a,n)),qe(this,qn,uy).call(this))},uy=function(){var t;if(this.hasListeners()){const n=B(this,Ji),a=qe(this,qn,iy).call(this,B(this,Lr),B(this,Nc)),s=qe(this,qn,sy).call(this,a,(t=B(this,mo))==null?void 0:t.combine);n!==s&&sn.batch(()=>{this.listeners.forEach(o=>{o(B(this,Lr))})})}},hj),Ta,mj,dR=(mj=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??nv(s,n);let c=this.get(o);return c||(c=new nR({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=>jS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>jS(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,mj),an,es,ts,po,go,ns,yo,vo,pj,fR=(pj=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 dR),Se(this,es,e.mutationCache||new lR),Se(this,ts,e.defaultOptions||{}),Se(this,po,new Map),Se(this,go,new Map),Se(this,ns,0)}mount(){rf(this,ns)._++,B(this,ns)===1&&(Se(this,yo,tv.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onFocus())})),Se(this,vo,If.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onOnline())})))}unmount(){var e,t;rf(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=G2(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=OS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yn).catch(Yn)}ensureInfiniteQueryData(e){return e.behavior=OS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return If.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=>{nc(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=>{nc(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=nv(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===av&&(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,pj),Ej=x.createContext(void 0),mn=e=>{const t=x.useContext(Ej);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hR=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Ej.Provider,{value:e,children:t})),Nj=x.createContext(!1),_j=()=>x.useContext(Nj);Nj.Provider;function mR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pR=x.createContext(mR()),Tj=()=>x.useContext(pR),Aj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?iv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Rj=e=>{x.useEffect(()=>{e.clearReset()},[e])},Oj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||iv(n,[e.error,a])),zj=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))}},gR=(e,t)=>e.isLoading&&e.isFetching&&!t,cy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,dy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function yR({queries:e,...t},n){const a=mn(),s=_j(),o=Tj(),c=x.useMemo(()=>e.map(j=>{const E=a.defaultQueryOptions(j);return E._optimisticResults=s?"isRestoring":"optimistic",E}),[e,a,s]);c.forEach(j=>{zj(j);const E=a.getQueryCache().get(j.queryHash);Aj(j,o,E)}),Rj(o);const[d]=x.useState(()=>new cR(a,c,t)),[m,h,g]=d.getOptimisticResult(c,t.combine),p=!s&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>p?d.subscribe(sn.batchCalls(j)):Yn,[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),x.useEffect(()=>{d.setQueries(c,t)},[c,t,d]);const w=m.some((j,E)=>cy(c[E],j))?m.flatMap((j,E)=>{const C=c[E];if(C&&cy(C,j)){const N=new sv(a,C);return dy(C,N,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const S=m.find((j,E)=>{const C=c[E];return C&&Oj({result:j,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(S!=null&&S.error)throw S.error;return h(g())}function vR(e,t,n){var b,w,S,j;const a=_j(),s=Tj(),o=mn(),c=o.defaultQueryOptions(e);(w=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,c);const d=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",zj(c),Aj(c,s,d),Rj(s);const m=!o.getQueryCache().get(c.queryHash),[h]=x.useState(()=>new t(o,c)),g=h.getOptimisticResult(c),p=!a&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(E=>{const C=p?h.subscribe(sn.batchCalls(E)):Yn;return h.updateResult(),C},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setOptions(c)},[c,h]),cy(c,g))throw dy(c,h,s);if(Oj({result:g,errorResetBoundary:s,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw g.error;if((j=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||j.call(S,c,g),c.experimental_prefetchInRender&&!ac.isServer()&&gR(g,a)){const E=m?dy(c,h,s):d==null?void 0:d.promise;E==null||E.catch(Yn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?g:h.trackResult(g)}function Ye(e,t){return vR(e,sv)}function wt(e,t){const n=mn(),[a]=x.useState(()=>new oR(n,e));x.useEffect(()=>{a.setOptions(e)},[a,e]);const s=x.useSyncExternalStore(x.useCallback(c=>a.subscribe(sn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=x.useCallback((c,d)=>{a.mutate(c,d).catch(Yn)},[a]);if(s.error&&iv(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 MS="popstate";function IS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function bR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:c,search:d,hash:m}=o||a.location;return fy("",{pathname:c,search:d,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:ic(s)}return wR(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 xR(){return Math.random().toString(36).substring(2,10)}function LS(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 fy(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||xR(),unstable_mask:s}}function ic({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 wR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,d="POP",m=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function p(){d="POP";let E=g(),C=E==null?null:E-h;h=E,m&&m({action:d,location:j.location,delta:C})}function b(E,C){d="PUSH";let N=IS(E)?E:fy(j.location,E,C);h=g()+1;let O=LS(N,h),z=j.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:d,location:j.location,delta:1})}function w(E,C){d="REPLACE";let N=IS(E)?E:fy(j.location,E,C);h=g();let O=LS(N,h),z=j.createHref(N.unstable_mask||N);c.replaceState(O,"",z),o&&m&&m({action:d,location:j.location,delta:0})}function S(E){return SR(E)}let j={get action(){return d},get location(){return e(s,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(MS,p),m=E,()=>{s.removeEventListener(MS,p),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:b,replace:w,go(E){return c.go(E)}};return j}function SR(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:ic(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Dj(e,t,n="/"){return kR(e,t,n,!1)}function kR(e,t,n,a){let s=typeof t=="string"?Co(t):t,o=oi(s.pathname||"/",n);if(o==null)return null;let c=Mj(e);jR(c);let d=null;for(let m=0;d==null&&m<c.length;++m){let h=MR(o);d=zR(c[m],h,a)}return d}function Mj(e,t=[],n=[],a="",s=!1){let o=(c,d,m=s,h)=>{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&m)return;Vt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let p=Ra([a,g.relativePath]),b=n.concat(g);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 "${p}".`),Mj(c.children,t,b,p,m)),!(c.path==null&&!c.index)&&t.push({path:p,score:RR(p,c.index),routesMeta:b})};return e.forEach((c,d)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,d);else for(let h of Ij(c.path))o(c,d,!0,h)}),t}function Ij(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=Ij(a.join("/")),d=[];return d.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function jR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:OR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var CR=/^:[\w-]+$/,ER=3,NR=2,_R=1,TR=10,AR=-2,PS=e=>e==="*";function RR(e,t){let n=e.split("/"),a=n.length;return n.some(PS)&&(a+=AR),t&&(a+=NR),n.filter(s=>!PS(s)).reduce((s,o)=>s+(CR.test(o)?ER:o===""?_R:TR),a)}function OR(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 zR(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",c=[];for(let d=0;d<a.length;++d){let m=a[d],h=d===a.length-1,g=o==="/"?t:t.slice(o.length)||"/",p=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},g),b=m.route;if(!p&&h&&n&&!a[a.length-1].route.index&&(p=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!p)return null;Object.assign(s,p.params),c.push({params:s,pathname:Ra([o,p.pathname]),pathnameBase:UR(Ra([o,p.pathnameBase])),route:b}),p.pathnameBase!=="/"&&(o=Ra([o,p.pathnameBase]))}return c}function Lf(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"),d=s.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:p},b)=>{if(g==="*"){let S=d[b]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=d[b];return p&&!w?h[g]=void 0:h[g]=(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,d,m,h,g)=>{if(a.push({paramName:d,isOptional:m!=null}),m){let p=g.charAt(h+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 MR(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 IR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LR(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=US(n.substring(1),"/"):o=US(n,t)):o=t,{pathname:o,search:BR(a),hash:FR(s)}}function US(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 Qp(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 PR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ov(e){let t=PR(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function rh(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Vt(!s.pathname||!s.pathname.includes("?"),Qp("?","pathname","search",s)),Vt(!s.pathname||!s.pathname.includes("#"),Qp("#","pathname","hash",s)),Vt(!s.search||!s.search.includes("#"),Qp("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,d;if(c==null)d=n;else{let p=t.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),p-=1;s.pathname=b.join("/")}d=p>=0?t[p]:"/"}let m=LR(s,d),h=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Ra=e=>e.join("/").replace(/\/\/+/g,"/"),UR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),BR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,FR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,$R=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 HR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Lj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Pj(e,t){let n=e;if(typeof n!="string"||!IR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Lj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=oi(c.pathname,t);c.origin===o.origin&&d!=null?n=d+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 Uj=["POST","PUT","PATCH","DELETE"];new Set(Uj);var ZR=["GET",...Uj];new Set(ZR);var Eo=x.createContext(null);Eo.displayName="DataRouter";var ah=x.createContext(null);ah.displayName="DataRouterState";var GR=x.createContext(!1),Bj=x.createContext({isTransitioning:!1});Bj.displayName="ViewTransition";var VR=x.createContext(new Map);VR.displayName="Fetchers";var QR=x.createContext(null);QR.displayName="Await";var Br=x.createContext(null);Br.displayName="Navigation";var _c=x.createContext(null);_c.displayName="Location";var ia=x.createContext({outlet:null,matches:[],isDataRoute:!1});ia.displayName="Route";var uv=x.createContext(null);uv.displayName="RouteError";var Fj="REACT_ROUTER_ERROR",KR="REDIRECT",YR="ROUTE_ERROR_RESPONSE";function XR(e){if(e.startsWith(`${Fj}:${KR}:{`))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 WR(e){if(e.startsWith(`${Fj}:${YR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new $R(t.status,t.statusText,t.data)}catch{}}function JR(e,{relative:t}={}){Vt(No(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=x.useContext(Br),{hash:s,pathname:o,search:c}=Tc(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Ra([n,o])),a.createHref({pathname:d,search:c,hash:s})}function No(){return x.useContext(_c)!=null}function kr(){return Vt(No(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(_c).location}var $j="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Hj(e){x.useContext(Br).static||x.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=x.useContext(ia);return e?mO():eO()}function eO(){Vt(No(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Eo),{basename:t,navigator:n}=x.useContext(Br),{matches:a}=x.useContext(ia),{pathname:s}=kr(),o=JSON.stringify(ov(a)),c=x.useRef(!1);return Hj(()=>{c.current=!0}),x.useCallback((m,h={})=>{if(ra(c.current,$j),!c.current)return;if(typeof m=="number"){n.go(m);return}let g=rh(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ra([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,o,s,e])}var tO=x.createContext(null);function nO(e){let t=x.useContext(ia).outlet;return x.useMemo(()=>t&&x.createElement(tO.Provider,{value:e},t),[t,e])}function qj(){let{matches:e}=x.useContext(ia),t=e[e.length-1];return t?t.params:{}}function Tc(e,{relative:t}={}){let{matches:n}=x.useContext(ia),{pathname:a}=kr(),s=JSON.stringify(ov(n));return x.useMemo(()=>rh(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function rO(e,t){return Zj(e,t)}function Zj(e,t,n){var E;Vt(No(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(Br),{matches:s}=x.useContext(ia),o=s[s.length-1],c=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";Vj(d,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (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 g=kr(),p;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.`),p=C}else p=g;let b=p.pathname||"/",w=b;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=Dj(e,{pathname:w});ra(h||S!=null,`No routes matched location "${p.pathname}${p.search}${p.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 "${p.pathname}${p.search}${p.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 j=oO(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&&j?x.createElement(_c.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},j):j}function aO(){let e=hO(),t=HR(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=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:o},"ErrorBoundary")," or"," ",x.createElement("code",{style:o},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,c)}var iO=x.createElement(aO,null),Gj=class extends x.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=WR(e.digest);n&&(e=n)}let t=e!==void 0?x.createElement(ia.Provider,{value:this.props.routeContext},x.createElement(uv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(sO,{error:e},t):t}};Gj.contextType=GR;var Kp=new WeakMap;function sO({children:e,error:t}){let{basename:n}=x.useContext(Br);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=XR(t.digest);if(a){let s=Kp.get(t);if(s)throw s;let o=Pj(a.location,n);if(Lj&&!Kp.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 Kp.set(t,c),c}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function lO({routeContext:e,match:t,children:n}){let a=x.useContext(Eo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(ia.Provider,{value:e},n)}function oO(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 g=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);Vt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let c=!1,d=-1;if(n&&a){c=a.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=g),p.route.id){let{loaderData:b,errors:w}=a,S=p.route.loader&&!b.hasOwnProperty(p.route.id)&&(!w||w[p.route.id]===void 0);if(p.route.lazy||S){n.isStatic&&(c=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(g,p)=>{var b,w;m(g,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:qR(a.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,b)=>{let w,S=!1,j=null,E=null;a&&(w=o&&p.route.id?o[p.route.id]:void 0,j=p.route.errorElement||iO,c&&(d<0&&b===0?(Vj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,E=null):d===b&&(S=!0,E=p.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,b+1)),N=()=>{let O;return w?O=j:S?O=E:p.route.Component?O=x.createElement(p.route.Component,null):p.route.element?O=p.route.element:O=g,x.createElement(lO,{match:p,routeContext:{outlet:g,matches:C,isDataRoute:a!=null},children:O})};return a&&(p.route.ErrorBoundary||p.route.errorElement||b===0)?x.createElement(Gj,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):N()},null)}function cv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uO(e){let t=x.useContext(Eo);return Vt(t,cv(e)),t}function cO(e){let t=x.useContext(ah);return Vt(t,cv(e)),t}function dO(e){let t=x.useContext(ia);return Vt(t,cv(e)),t}function dv(e){let t=dO(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 fO(){return dv("useRouteId")}function hO(){var a;let e=x.useContext(uv),t=cO("useRouteError"),n=dv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function mO(){let{router:e}=uO("useNavigate"),t=dv("useNavigate"),n=x.useRef(!1);return Hj(()=>{n.current=!0}),x.useCallback(async(s,o={})=>{ra(n.current,$j),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var BS={};function Vj(e,t,n){!t&&!BS[e]&&(BS[e]=!0,ra(!1,n))}x.memo(pO);function pO({routes:e,future:t,state:n,isStatic:a,onError:s}){return Zj(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}=x.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}=x.useContext(ia),{pathname:c}=kr(),d=_n(),m=rh(e,ov(o),c,a==="path"),h=JSON.stringify(m);return x.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:a})},[d,h,a,t,n]),null}function Pf(e){return nO(e.context)}function Mt(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 gO({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 d=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:d,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[d,s,o,c]);typeof n=="string"&&(n=Co(n));let{pathname:h="/",search:g="",hash:p="",state:b=null,key:w="default",unstable_mask:S}=n,j=x.useMemo(()=>{let E=oi(h,d);return E==null?null:{location:{pathname:E,search:g,hash:p,state:b,key:w,unstable_mask:S},navigationType:a}},[d,h,g,p,b,w,a,S]);return ra(j!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Br.Provider,{value:m},x.createElement(_c.Provider,{children:t,value:j}))}function yO({children:e,location:t}){return rO(hy(e),t)}function hy(e,t=[]){let n=[];return x.Children.forEach(e,(a,s)=>{if(!x.isValidElement(a))return;let o=[...t,s];if(a.type===x.Fragment){n.push.apply(n,hy(a.props.children,o));return}Vt(a.type===Mt,`[${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=hy(a.props.children,o)),n.push(c)}),n}var _f="get",Tf="application/x-www-form-urlencoded";function ih(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function vO(e){return ih(e)&&e.tagName.toLowerCase()==="button"}function bO(e){return ih(e)&&e.tagName.toLowerCase()==="form"}function xO(e){return ih(e)&&e.tagName.toLowerCase()==="input"}function wO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function SO(e,t){return e.button===0&&(!t||t==="_self")&&!wO(e)}function my(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 kO(e,t){let n=my(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var sf=null;function jO(){if(sf===null)try{new FormData(document.createElement("form"),0),sf=!1}catch{sf=!0}return sf}var CO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yp(e){return e!=null&&!CO.has(e)?(ra(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tf}"`),null):e}function EO(e,t){let n,a,s,o,c;if(bO(e)){let d=e.getAttribute("action");a=d?oi(d,t):null,n=e.getAttribute("method")||_f,s=Yp(e.getAttribute("enctype"))||Tf,o=new FormData(e)}else if(vO(e)||xO(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(a=m?oi(m,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||_f,s=Yp(e.getAttribute("formenctype"))||Yp(d.getAttribute("enctype"))||Tf,o=new FormData(d,e),!jO()){let{name:h,type:g,value:p}=e;if(g==="image"){let b=h?`${h}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else h&&o.append(h,p)}}else{if(ih(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_f,a=null,s=Tf,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 fv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function NO(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 _O(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 TO(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 AO(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await _O(o,n);return c.links?c.links():[]}return[]}));return DO(a.flat(1).filter(TO).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,d=(m,h)=>{var g;return n[h].pathname!==m.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||d(m,h)):o==="data"?t.filter((m,h)=>{var p;let g=a.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(c(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function RO(e,t,{includeHydrateFallback:n}={}){return OO(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 OO(e){return[...new Set(e)]}function zO(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(zO(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function Qj(){let e=x.useContext(Eo);return fv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function MO(){let e=x.useContext(ah);return fv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hv=x.createContext(void 0);hv.displayName="FrameworkContext";function Kj(){let e=x.useContext(hv);return fv(e,"You must render this element inside a <HydratedRouter> element"),e}function IO(e,t){let n=x.useContext(hv),[a,s]=x.useState(!1),[o,c]=x.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:p}=t,b=x.useRef(null);x.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=C=>{C.forEach(N=>{c(N.isIntersecting)})},E=new IntersectionObserver(j,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),x.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{s(!0)},S=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:Au(d,w),onBlur:Au(m,S),onMouseEnter:Au(h,w),onMouseLeave:Au(g,S),onTouchStart:Au(p,w)}]:[!1,b,{}]}function Au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LO({page:e,...t}){let{router:n}=Qj(),a=x.useMemo(()=>Dj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?x.createElement(UO,{page:e,matches:a,...t}):null}function PO(e){let{manifest:t,routeModules:n}=Kj(),[a,s]=x.useState([]);return x.useEffect(()=>{let o=!1;return AO(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function UO({page:e,matches:t,...n}){let a=kr(),{future:s,manifest:o,routeModules:c}=Kj(),{basename:d}=Qj(),{loaderData:m,matches:h}=MO(),g=x.useMemo(()=>FS(e,t,h,o,a,"data"),[e,t,h,o,a]),p=x.useMemo(()=>FS(e,t,h,o,a,"assets"),[e,t,h,o,a]),b=x.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,E=!1;if(t.forEach(N=>{var z;let O=o.routes[N.route.id];!O||!O.hasLoader||(!g.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:j.add(N.route.id))}),j.size===0)return[];let C=NO(e,d,s.unstable_trailingSlashAwareDataRequests,"data");return E&&j.size>0&&C.searchParams.set("_routes",t.filter(N=>j.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[d,s.unstable_trailingSlashAwareDataRequests,m,a,o,g,t,e,c]),w=x.useMemo(()=>RO(p,o),[p,o]),S=PO(p);return x.createElement(x.Fragment,null,b.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),w.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),S.map(({key:j,link:E})=>x.createElement("link",{key:j,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function BO(...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 $O({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=x.useRef();s.current==null&&(s.current=bR({window:a,v5Compat:!0}));let o=s.current,[c,d]=x.useState({action:o.action,location:o.location}),m=x.useCallback(h=>{n===!1?d(h):x.startTransition(()=>d(h))},[n]);return x.useLayoutEffect(()=>o.listen(m),[o,m]),x.createElement(gO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var Yj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ac=x.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:d,state:m,target:h,to:g,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:w,...S},j){let{basename:E,navigator:C,unstable_useTransitions:N}=x.useContext(Br),O=typeof g=="string"&&Yj.test(g),z=Pj(g,E);g=z.to;let L=JR(g,{relative:s}),R=kr(),F=null;if(d){let X=rh(d,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);E!=="/"&&(X.pathname=X.pathname==="/"?E:Ra([E,X.pathname])),F=C.createHref(X)}let[U,V,M]=IO(a,S),Y=ZO(g,{replace:c,unstable_mask:d,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:N});function ae(X){t&&t(X),X.defaultPrevented||Y(X)}let xe=!(z.isExternal||o),J=x.createElement("a",{...S,...M,href:(xe?F:void 0)||z.absoluteURL||L,onClick:xe?ae:t,ref:BO(j,V),target:h,"data-discover":!O&&n==="render"?"true":void 0});return U&&!O?x.createElement(x.Fragment,null,J,x.createElement(LO,{page:L})):J});Ac.displayName="Link";var mv=x.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:d,children:m,...h},g){let p=Tc(c,{relative:h.relative}),b=kr(),w=x.useContext(ah),{navigator:S,basename:j}=x.useContext(Br),E=w!=null&&YO(p)&&d===!0,C=S.encodeLocation?S.encodeLocation(p).pathname:p.pathname,N=b.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&&j&&(O=oi(O,j)||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)==="/"),F={isActive:L,isPending:R,isTransitioning:E},U=L?t:void 0,V;typeof a=="function"?V=a(F):V=[a,L?"active":null,R?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let M=typeof o=="function"?o(F):o;return x.createElement(Ac,{...h,"aria-current":U,className:V,ref:g,style:M,to:c,viewTransition:d},typeof m=="function"?m(F):m)});mv.displayName="NavLink";var HO=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=_f,action:d,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b,...w},S)=>{let{unstable_useTransitions:j}=x.useContext(Br),E=QO(),C=KO(d,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",O=typeof d=="string"&&Yj.test(d),z=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let R=L.nativeEvent.submitter,F=(R==null?void 0:R.getAttribute("formmethod"))||c,U=()=>E(R||L.currentTarget,{fetcherKey:t,method:F,navigate:n,replace:s,state:o,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b});j&&n!==!1?x.startTransition(()=>U()):U()};return x.createElement("form",{ref:S,method:N,action:C,onSubmit:a?m:z,...w,"data-discover":!O&&e==="render"?"true":void 0})});HO.displayName="Form";function qO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xj(e){let t=x.useContext(Eo);return Vt(t,qO(e)),t}function ZO(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let g=_n(),p=kr(),b=Tc(e,{relative:c});return x.useCallback(w=>{if(SO(w,t)){w.preventDefault();let S=n!==void 0?n:ic(p)===ic(b),j=()=>g(e,{replace:S,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:m});h?x.startTransition(()=>j()):j()}},[p,g,b,n,a,s,t,e,o,c,d,m,h])}function sh(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=x.useRef(my(e)),n=x.useRef(!1),a=kr(),s=x.useMemo(()=>kO(a.search,n.current?null:t.current),[a.search]),o=_n(),c=x.useCallback((d,m)=>{const h=my(typeof d=="function"?d(new URLSearchParams(s)):d);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var GO=0,VO=()=>`__${String(++GO)}__`;function QO(){let{router:e}=Xj("useSubmit"),{basename:t}=x.useContext(Br),n=fO(),a=e.fetch,s=e.navigate;return x.useCallback(async(o,c={})=>{let{action:d,method:m,encType:h,formData:g,body:p}=EO(o,t);if(c.navigate===!1){let b=c.fetcherKey||VO();await a(b,n,c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,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 KO(e,{relative:t}={}){let{basename:n}=x.useContext(Br),a=x.useContext(ia);Vt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Tc(e||".",{relative:t})},c=kr();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),m=d.getAll("index");if(m.some(g=>g==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let g=d.toString();o.search=g?`?${g}`:""}}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])),ic(o)}function YO(e,{relative:t}={}){let n=x.useContext(Bj);Vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Xj("useViewTransitionState"),s=Tc(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 Lf(s.pathname,c)!=null||Lf(s.pathname,o)!=null}const XO="/api/v1";async function WO(e,t){const n=await fetch(`${XO}/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 Wj="/api/v1",pv="first-tree-hub:tokens";let py=null;function Ru(e){py=e}function Tn(e){if(!py)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(py)}${e}`}function gy(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function lh(){const e=localStorage.getItem(pv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function yy(e){localStorage.setItem(pv,JSON.stringify(e))}function Jj(){localStorage.removeItem(pv)}class Rc extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Ou=null;async function JO(){const e=lh();return e!=null&&e.refreshToken?eC(e.refreshToken):null}async function eC(e){return Ou||(Ou=(async()=>{try{const t=await fetch(`${Wj}/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 yy(a),a}catch{return null}finally{Ou=null}})(),Ou)}async function zu(e,t){const{method:n="GET",body:a}=t??{},s=d=>{const m={};return d&&(m.Authorization=`Bearer ${d}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${Wj}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=lh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const d=await eC(o.refreshToken);d&&(c=await s(d.accessToken))}if(!c.ok){c.status===401&&(Jj(),window.dispatchEvent(new CustomEvent("auth:logout")));const d=await c.text();let m,h;try{const g=JSON.parse(d);m=g.error??d,Array.isArray(g.details)&&(h=g.details.filter(p=>typeof p=="object"&&p!==null&&Array.isArray(p.path)))}catch{m=d}throw new Rc(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"})},gv="onboarding:joinPath",ez="onboarding:draft",vy="onboarding:step1Confirmed";function tC(){return typeof window>"u"?!1:window.sessionStorage.getItem(vy)==="1"}function tz(e){typeof window>"u"||(e?window.sessionStorage.setItem(vy,"1"):window.sessionStorage.removeItem(vy))}const by="onboarding:agentUuid";function nz(){return typeof window>"u"?null:window.sessionStorage.getItem(by)}function rz(e){typeof window>"u"||(e?window.sessionStorage.setItem(by,e):window.sessionStorage.removeItem(by))}function nC(e){typeof window>"u"||window.sessionStorage.setItem(gv,e)}function rC(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(gv);return e==="solo"||e==="invite"?e:null}function az(){typeof window>"u"||window.sessionStorage.removeItem(gv)}function iz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function yv(e){return`${ez}:${e}`}function sz(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 lz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(yv(e));if(!t)return null;try{return sz(JSON.parse(t))}catch{return null}}function oz(e,t){typeof window>"u"||window.sessionStorage.setItem(yv(e),JSON.stringify(t))}function uz(e){typeof window>"u"||window.sessionStorage.removeItem(yv(e))}function cz(){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 aC=x.createContext(null),xy="first-tree-hub:selectedOrganizationId";function dz(){try{return localStorage.getItem(xy)}catch{return null}}function Xp(e){try{e===null?localStorage.removeItem(xy):localStorage.setItem(xy,e)}catch{}}function fz({children:e}){const t=mn(),[n,a]=x.useState(()=>!!lh()),[s,o]=x.useState(null),[c,d]=x.useState([]),[m,h]=x.useState(()=>{const V=dz();return Ru(V),V}),[g,p]=x.useState(null),[b,w]=x.useState(null),[S,j]=x.useState(!1),E=x.useCallback(()=>{Jj(),Xp(null),Ru(null),t.clear(),cz(),a(!1),o(null),d([]),h(null),p(null),w(null),j(!1)},[t]),C=x.useCallback(async()=>{var V,M;try{const Y=await Ee.get("/me");o(Y.user??null);const ae=Y.memberships??[];d(ae);const xe=((V=Y.onboarding)==null?void 0:V.step)??null;p(xe),w(((M=Y.onboarding)==null?void 0:M.dismissedAt)??null),xe==="completed"&&az(),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 Xp(q),Ru(q),q})}catch{}finally{j(!0)}},[]),N=x.useCallback(async(V,M)=>{const Y=await WO(V,M);yy({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await C()},[C]),O=x.useCallback(async V=>{yy(V),a(!0),await C()},[C]),z=x.useCallback(async V=>{Xp(V),Ru(V),t.clear(),h(V),await C()},[C,t]),L=x.useRef(null);x.useEffect(()=>{L.current=b},[b]);const R=x.useCallback(async()=>{const V=L.current;w(new Date().toISOString());try{const M=await Ee.patch("/me/onboarding",{dismissed:!0});M!=null&&M.dismissedAt&&w(M.dismissedAt)}catch{w(V)}},[]),F=x.useCallback(async()=>{const V=L.current;w(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{w(V)}},[]);x.useEffect(()=>{n&&!s&&C()},[n,s,C]),x.useEffect(()=>{const V=()=>E();return window.addEventListener("auth:logout",V),()=>window.removeEventListener("auth:logout",V)},[E]);const U=x.useMemo(()=>c.length===0?null:c.find(M=>M.organizationId===m)??c[0]??null,[c,m]);return l.jsx(aC.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:g,onboardingDismissedAt:b,dismissOnboarding:R,restoreOnboarding:F,login:N,adoptTokens:O,selectOrganization:z,refreshMe:C,logout:E},children:e})}function gt(){const e=x.useContext(aC);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const hz="modulepreload",mz=function(e){return"/"+e},$S={},pz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=c(n.map(h=>{if(h=mz(h),h in $S)return;$S[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":hz,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((w,S)=>{b.addEventListener("load",w),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return s.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},gz=x.lazy(()=>pz(()=>import("./index-RNegidl2.js"),[]).then(e=>({default:e.LandingPage}))),HS=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function yz(){const{isAuthenticated:e,meLoaded:t}=gt(),n=kr();return e?t?l.jsx(Pf,{}):l.jsx(HS,{}):n.pathname==="/"?l.jsx(x.Suspense,{fallback:l.jsx(HS,{}),children:l.jsx(gz,{})}):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 iC=(...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 vz=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 bz=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 qS=e=>{const t=bz(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 xz={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 wz=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 Sz=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...d},m)=>x.createElement("svg",{ref:m,...xz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:iC("lucide",s),...!o&&!wz(d)&&{"aria-hidden":"true"},...d},[...c.map(([h,g])=>x.createElement(h,g)),...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 lt=(e,t)=>{const n=x.forwardRef(({className:a,...s},o)=>x.createElement(Sz,{ref:o,iconNode:t,className:iC(`lucide-${vz(qS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=qS(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 kz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],vv=lt("arrow-left",kz);/**
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 jz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],sC=lt("arrow-right",jz);/**
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 Cz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],lC=lt("arrow-up",Cz);/**
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 Ez=[["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"}]],Nz=lt("at-sign",Ez);/**
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 _z=[["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"}]],Tz=lt("bell",_z);/**
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 Az=[["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"}]],oC=lt("bot",Az);/**
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 Rz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=lt("check",Rz);/**
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 Oz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bv=lt("chevron-down",Oz);/**
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 zz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dz=lt("chevron-right",zz);/**
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 Mz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Iz=lt("circle-check",Mz);/**
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"}]],oh=lt("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=lt("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:"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"}]],Fz=lt("eye-off",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 $z=[["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"}]],uC=lt("eye",$z);/**
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 Hz=[["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"}]],qz=lt("folder-tree",Hz);/**
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:"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"}]],cC=lt("github",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 Gz=[["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"}]],Vz=lt("layout-dashboard",Gz);/**
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=[["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"}]],wy=lt("link-2",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 Kz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],dC=lt("loader-circle",Kz);/**
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 Yz=[["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"}]],xv=lt("lock",Yz);/**
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 Xz=[["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"}]],Wz=lt("log-out",Xz);/**
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:"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"}]],wv=lt("message-square",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 e3=[["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"}]],t3=lt("moon",e3);/**
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:"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"}]],r3=lt("paperclip",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:"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"}]],Sv=lt("pencil",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 i3=[["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"}]],fC=lt("play",i3);/**
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 s3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ba=lt("plus",s3);/**
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 l3=[["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"}]],o3=lt("refresh-cw",l3);/**
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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],uh=lt("search",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 c3=[["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"}]],d3=lt("sun",c3);/**
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=[["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"}]],Uf=lt("trash-2",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 h3=[["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=lt("triangle-alert",h3);/**
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 m3=[["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"}]],p3=lt("undo-2",m3);/**
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:"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"}]],hC=lt("user-plus",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 y3=[["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"}]],v3=lt("user",y3);/**
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:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ss=lt("x",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 x3=[["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"}]],w3=lt("zap",x3);function mC(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=mC(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function pC(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=mC(e))&&(a&&(a+=" "),a+=t);return a}const S3=(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},k3=(e,t)=>({classGroupId:e,validator:t}),gC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bf="-",ZS=[],j3="arbitrary..",C3=e=>{const t=N3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return E3(c);const d=c.split(Bf),m=d[0]===""&&d.length>1?1:0;return yC(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=a[c],h=n[c];return m?h?S3(h,m):m:h||ZS}return n[c]||ZS}}},yC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=yC(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const d=t===0?e.join(Bf):e.slice(t).join(Bf),m=c.length;for(let h=0;h<m;h++){const g=c[h];if(g.validator(d))return g.classGroupId}},E3=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?j3+a:void 0})(),N3=e=>{const{theme:t,classGroups:n}=e;return _3(n,t)},_3=(e,t)=>{const n=gC();for(const a in e){const s=e[a];kv(s,n,a,t)}return n},kv=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];T3(c,t,n,a)}},T3=(e,t,n,a)=>{if(typeof e=="string"){A3(e,t,n);return}if(typeof e=="function"){R3(e,t,n,a);return}O3(e,t,n,a)},A3=(e,t,n)=>{const a=e===""?t:vC(t,e);a.classGroupId=n},R3=(e,t,n,a)=>{if(z3(e)){kv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(k3(n,e))},O3=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[d,m]=s[c];kv(m,vC(t,d),n,a)}},vC=(e,t)=>{let n=e;const a=t.split(Bf),s=a.length;for(let o=0;o<s;o++){const c=a[o];let d=n.nextPart.get(c);d||(d=gC(),n.nextPart.set(c,d)),n=d}return n},z3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,D3=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)}}},Sy="!",GS=":",M3=[],VS=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),I3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,d=0,m=0,h;const g=s.length;for(let j=0;j<g;j++){const E=s[j];if(c===0&&d===0){if(E===GS){o.push(s.slice(m,j)),m=j+1;continue}if(E==="/"){h=j;continue}}E==="["?c++:E==="]"?c--:E==="("?d++:E===")"&&d--}const p=o.length===0?s:s.slice(m);let b=p,w=!1;p.endsWith(Sy)?(b=p.slice(0,-1),w=!0):p.startsWith(Sy)&&(b=p.slice(1),w=!0);const S=h&&h>m?h-m:void 0;return VS(o,w,b,S)};if(t){const s=t+GS,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):VS(M3,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},L3=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],d=c[0]==="[",m=t.has(c);d||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}},P3=e=>({cache:D3(e.cacheSize),parseClassName:I3(e),sortModifiers:L3(e),...C3(e)}),U3=/\s+/,B3=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],d=e.trim().split(U3);let m="";for(let h=d.length-1;h>=0;h-=1){const g=d[h],{isExternal:p,modifiers:b,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:j}=n(g);if(p){m=g+(m.length>0?" "+m:m);continue}let E=!!j,C=a(E?S.substring(0,j):S);if(!C){if(!E){m=g+(m.length>0?" "+m:m);continue}if(C=a(S),!C){m=g+(m.length>0?" "+m:m);continue}E=!1}const N=b.length===0?"":b.length===1?b[0]:o(b).join(":"),O=w?N+Sy: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 F=L[R];c.push(O+F)}m=g+(m.length>0?" "+m:m)}return m},F3=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=bC(n))&&(s&&(s+=" "),s+=a);return s},bC=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=bC(e[a]))&&(n&&(n+=" "),n+=t);return n},$3=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((g,p)=>p(g),e());return n=P3(h),a=n.cache.get,s=n.cache.set,o=d,d(m)},d=m=>{const h=a(m);if(h)return h;const g=B3(m,n);return s(m,g),g};return o=c,(...m)=>o(F3(...m))},H3=[],Nn=e=>{const t=n=>n[e]||H3;return t.isThemeGetter=!0,t},xC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Z3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,G3=/\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$/,V3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Q3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,K3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bi=e=>q3.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),Fi=e=>!!e&&Number.isInteger(Number(e)),Wp=e=>e.endsWith("%")&&tt(e.slice(0,-1)),ei=e=>Z3.test(e),SC=()=>!0,Y3=e=>G3.test(e)&&!V3.test(e),jv=()=>!1,X3=e=>Q3.test(e),W3=e=>K3.test(e),J3=e=>!Re(e)&&!Oe(e),eD=e=>fs(e,CC,jv),Re=e=>xC.test(e),zs=e=>fs(e,EC,Y3),QS=e=>fs(e,oD,tt),tD=e=>fs(e,_C,SC),nD=e=>fs(e,NC,jv),KS=e=>fs(e,kC,jv),rD=e=>fs(e,jC,W3),lf=e=>fs(e,TC,X3),Oe=e=>wC.test(e),Du=e=>Js(e,EC),aD=e=>Js(e,NC),YS=e=>Js(e,kC),iD=e=>Js(e,CC),sD=e=>Js(e,jC),of=e=>Js(e,TC,!0),lD=e=>Js(e,_C,!0),fs=(e,t,n)=>{const a=xC.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Js=(e,t,n=!1)=>{const a=wC.exec(e);return a?a[1]?t(a[1]):n:!1},kC=e=>e==="position"||e==="percentage",jC=e=>e==="image"||e==="url",CC=e=>e==="length"||e==="size"||e==="bg-size",EC=e=>e==="length",oD=e=>e==="number",NC=e=>e==="family-name",_C=e=>e==="number"||e==="weight",TC=e=>e==="shadow",uD=()=>{const e=Nn("color"),t=Nn("font"),n=Nn("text"),a=Nn("font-weight"),s=Nn("tracking"),o=Nn("leading"),c=Nn("breakpoint"),d=Nn("container"),m=Nn("spacing"),h=Nn("radius"),g=Nn("shadow"),p=Nn("inset-shadow"),b=Nn("text-shadow"),w=Nn("drop-shadow"),S=Nn("blur"),j=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"],F=()=>["auto","contain","none"],U=()=>[Oe,Re,m],V=()=>[Bi,"full","auto",...U()],M=()=>[Fi,"none","subgrid",Oe,Re],Y=()=>["auto",{span:["full",Fi,Oe,Re]},Fi,Oe,Re],ae=()=>[Fi,"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()],D=()=>[e,Oe,Re],I=()=>[...z(),YS,KS,{position:[Oe,Re]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",iD,eD,{size:[Oe,Re]}],Z=()=>[Wp,Du,zs],Q=()=>["","none","full",h,Oe,Re],ue=()=>["",tt,Du,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,Wp,YS,KS],Me=()=>["","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:[SC],container:[ei],"drop-shadow":[ei],ease:["in","out","in-out"],font:[J3],"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,d]}],"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:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],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:[Fi,"auto",Oe,Re]}],basis:[{basis:[Bi,"full","auto",d,...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:[Fi,"first","last","none",Oe,Re]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":M()}],"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:[d,"screen",...te()]}],"min-w":[{"min-w":[d,"screen","none",...te()]}],"max-w":[{"max-w":[d,"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,Du,zs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,lD,tD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wp,Re]}],"font-family":[{font:[aD,nD,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,QS]}],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:D()}],"text-color":[{text:D()}],"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:D()}],"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"]},Fi,Oe,Re],radial:["",Oe,Re],conic:[Fi,Oe,Re]},sD,rD]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],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:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...je(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Oe,Re]}],"outline-w":[{outline:["",tt,Du,zs]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",g,of,lf]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",p,of,lf]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[tt,zs]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",b,of,lf]}],"text-shadow-color":[{"text-shadow":D()}],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":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"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":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"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":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"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":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"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":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"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":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"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":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"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":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"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:Me()}],brightness:[{brightness:[tt,Oe,Re]}],contrast:[{contrast:[tt,Oe,Re]}],"drop-shadow":[{"drop-shadow":["","none",w,of,lf]}],"drop-shadow-color":[{"drop-shadow":D()}],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":Me()}],"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:[j,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:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",...D()]}],"stroke-w":[{stroke:[tt,Du,zs,QS]}],stroke:[{stroke:["none",...D()]}],"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"]}},cD=$3(uD);function ze(...e){return cD(pC(e))}function sc(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 AC(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function dD(e){return Ee.delete(`/clients/${encodeURIComponent(e)}`)}function Oc(){return Ee.get(Tn("/activity"))}function ls(){return Ee.get("/me/clients")}function ch(e){return Ee.get(`/clients/${e}`)}function fD(e){return Ee.post(`/clients/${e}/disconnect`)}function hD(){return Ee.post("/me/connect-tokens")}const XS=e=>["agent-sessions",e];function mD(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 pD(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 gD(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function RC(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 yD(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 WS=1,vD=.9,bD=.8,xD=.17,Jp=.1,eg=.999,wD=.9999,SD=.99,kD=/[\\\/_+.#"@\[\(\{&]/,jD=/[\\\/_+.#"@\[\(\{&]/g,CD=/[\s-]/,OC=/[\s-]/g;function ky(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?WS:SD;var d=`${s},${o}`;if(c[d]!==void 0)return c[d];for(var m=a.charAt(o),h=n.indexOf(m,s),g=0,p,b,w,S;h>=0;)p=ky(e,t,n,a,h+1,o+1,c),p>g&&(h===s?p*=WS:kD.test(e.charAt(h-1))?(p*=bD,w=e.slice(s,h-1).match(jD),w&&s>0&&(p*=Math.pow(eg,w.length))):CD.test(e.charAt(h-1))?(p*=vD,S=e.slice(s,h-1).match(OC),S&&s>0&&(p*=Math.pow(eg,S.length))):(p*=xD,s>0&&(p*=Math.pow(eg,h-s))),e.charAt(h)!==t.charAt(o)&&(p*=wD)),(p<Jp&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(b=ky(e,t,n,a,h+1,o+2,c),b*Jp>p&&(p=b*Jp)),p>g&&(g=p),h=n.indexOf(m,h+1);return c[d]=g,g}function JS(e){return e.toLowerCase().replace(OC," ")}function ED(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ky(e,t,JS(e),JS(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 e1(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=e1(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():e1(e[s],null)}}}}function el(...e){return x.useCallback(os(...e),e)}function ND(e,t){const n=x.createContext(t),a=o=>{const{children:c,...d}=o,m=x.useMemo(()=>d,Object.values(d));return l.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=x.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 _D(e,t=[]){let n=[];function a(o,c){const d=x.createContext(c),m=n.length;n=[...n,c];const h=p=>{var C;const{scope:b,children:w,...S}=p,j=((C=b==null?void 0:b[e])==null?void 0:C[m])||d,E=x.useMemo(()=>S,Object.values(S));return l.jsx(j.Provider,{value:E,children:w})};h.displayName=o+"Provider";function g(p,b){var j;const w=((j=b==null?void 0:b[e])==null?void 0:j[m])||d,S=x.useContext(w);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[h,g]}const s=()=>{const o=n.map(c=>x.createContext(c));return function(d){const m=(d==null?void 0:d[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[a,TD(s,...t)]}function TD(...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((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var lc=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},AD=ev[" useId ".trim().toString()]||(()=>{}),RD=0;function si(e){const[t,n]=x.useState(AD());return lc(()=>{n(a=>a??String(RD++))},[e]),t?`radix-${t}`:""}var OD=ev[" useInsertionEffect ".trim().toString()]||lc;function zD({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=DD({defaultProp:t,onChange:n}),d=e!==void 0,m=d?e:s;{const g=x.useRef(e!==void 0);x.useEffect(()=>{const p=g.current;p!==d&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${d?"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.`),g.current=d},[d,a])}const h=x.useCallback(g=>{var p;if(d){const b=MD(g)?g(e):g;b!==e&&((p=c.current)==null||p.call(c,b))}else o(g)},[d,e,o,c]);return[m,h]}function DD({defaultProp:e,onChange:t}){const[n,a]=x.useState(e),s=x.useRef(n),o=x.useRef(t);return OD(()=>{o.current=t},[t]),x.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function MD(e){return typeof e=="function"}var Cv=gj();const ID=nh(Cv);function zC(e){const t=LD(e),n=x.forwardRef((a,s)=>{const{children:o,...c}=a,d=x.Children.toArray(o),m=d.find(UD);if(m){const h=m.props.children,g=d.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return l.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function LD(e){const t=x.forwardRef((n,a)=>{const{children:s,...o}=n;if(x.isValidElement(s)){const c=FD(s),d=BD(o,s.props);return s.type!==x.Fragment&&(d.ref=a?os(a,c):c),x.cloneElement(s,d)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var PD=Symbol("radix.slottable");function UD(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===PD}function BD(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]=(...d)=>{const m=o(...d);return s(...d),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function FD(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 $D=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ci=$D.reduce((e,t)=>{const n=zC(`Primitive.${t}`),a=x.forwardRef((s,o)=>{const{asChild:c,...d}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function HD(e,t){e&&Cv.flushSync(()=>e.dispatchEvent(t))}function oc(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function qD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e);x.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 ZD="DismissableLayer",jy="dismissableLayer.update",GD="dismissableLayer.pointerDownOutside",VD="dismissableLayer.focusOutside",t1,DC=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),MC=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:d,...m}=e,h=x.useContext(DC),[g,p]=x.useState(null),b=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=x.useState({}),S=el(t,F=>p(F)),j=Array.from(h.layers),[E]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(E),N=g?j.indexOf(g):-1,O=h.layersWithOutsidePointerEventsDisabled.size>0,z=N>=C,L=YD(F=>{const U=F.target,V=[...h.branches].some(M=>M.contains(U));!z||V||(s==null||s(F),c==null||c(F),F.defaultPrevented||d==null||d())},b),R=XD(F=>{const U=F.target;[...h.branches].some(M=>M.contains(U))||(o==null||o(F),c==null||c(F),F.defaultPrevented||d==null||d())},b);return qD(F=>{N===h.layers.size-1&&(a==null||a(F),!F.defaultPrevented&&d&&(F.preventDefault(),d()))},b),x.useEffect(()=>{if(g)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(t1=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(g)),h.layers.add(g),n1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=t1)}},[g,b,n,h]),x.useEffect(()=>()=>{g&&(h.layers.delete(g),h.layersWithOutsidePointerEventsDisabled.delete(g),n1())},[g,h]),x.useEffect(()=>{const F=()=>w({});return document.addEventListener(jy,F),()=>document.removeEventListener(jy,F)},[]),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)})});MC.displayName=ZD;var QD="DismissableLayerBranch",KD=x.forwardRef((e,t)=>{const n=x.useContext(DC),a=x.useRef(null),s=el(t,a);return x.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})});KD.displayName=QD;function YD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),a=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const o=d=>{if(d.target&&!a.current){let m=function(){IC(GD,n,h,{discrete:!0})};const h={originalEvent:d};d.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 XD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),a=x.useRef(!1);return x.useEffect(()=>{const s=o=>{o.target&&!a.current&&IC(VD,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 n1(){const e=new CustomEvent(jy);document.dispatchEvent(e)}function IC(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?HD(s,o):s.dispatchEvent(o)}var tg="focusScope.autoFocusOnMount",ng="focusScope.autoFocusOnUnmount",r1={bubbles:!1,cancelable:!0},WD="FocusScope",LC=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[d,m]=x.useState(null),h=oc(s),g=oc(o),p=x.useRef(null),b=el(t,j=>m(j)),w=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let j=function(O){if(w.paused||!d)return;const z=O.target;d.contains(z)?p.current=z:qi(p.current,{select:!0})},E=function(O){if(w.paused||!d)return;const z=O.relatedTarget;z!==null&&(d.contains(z)||qi(p.current,{select:!0}))},C=function(O){if(document.activeElement===document.body)for(const L of O)L.removedNodes.length>0&&qi(d)};document.addEventListener("focusin",j),document.addEventListener("focusout",E);const N=new MutationObserver(C);return d&&N.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",E),N.disconnect()}}},[a,d,w.paused]),x.useEffect(()=>{if(d){i1.add(w);const j=document.activeElement;if(!d.contains(j)){const C=new CustomEvent(tg,r1);d.addEventListener(tg,h),d.dispatchEvent(C),C.defaultPrevented||(JD(aM(PC(d)),{select:!0}),document.activeElement===j&&qi(d))}return()=>{d.removeEventListener(tg,h),setTimeout(()=>{const C=new CustomEvent(ng,r1);d.addEventListener(ng,g),d.dispatchEvent(C),C.defaultPrevented||qi(j??document.body,{select:!0}),d.removeEventListener(ng,g),i1.remove(w)},0)}}},[d,h,g,w]);const S=x.useCallback(j=>{if(!n&&!a||w.paused)return;const E=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(E&&C){const N=j.currentTarget,[O,z]=eM(N);O&&z?!j.shiftKey&&C===z?(j.preventDefault(),n&&qi(O,{select:!0})):j.shiftKey&&C===O&&(j.preventDefault(),n&&qi(z,{select:!0})):C===N&&j.preventDefault()}},[n,a,w.paused]);return l.jsx(ci.div,{tabIndex:-1,...c,ref:b,onKeyDown:S})});LC.displayName=WD;function JD(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(qi(a,{select:t}),document.activeElement!==n)return}function eM(e){const t=PC(e),n=a1(t,e),a=a1(t.reverse(),e);return[n,a]}function PC(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 a1(e,t){for(const n of e)if(!tM(n,{upTo:t}))return n}function tM(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 nM(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&&nM(e)&&t&&e.select()}}var i1=rM();function rM(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=s1(e,t),e.unshift(t)},remove(t){var n;e=s1(e,t),(n=e[0])==null||n.resume()}}}function s1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function aM(e){return e.filter(t=>t.tagName!=="A")}var iM="Portal",UC=x.forwardRef((e,t)=>{var d;const{container:n,...a}=e,[s,o]=x.useState(!1);lc(()=>o(!0),[]);const c=n||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?ID.createPortal(l.jsx(ci.div,{...a,ref:t}),c):null});UC.displayName=iM;function sM(e,t){return x.useReducer((n,a)=>t[n][a]??n,e)}var dh=e=>{const{present:t,children:n}=e,a=lM(t),s=typeof n=="function"?n({present:a.isPresent}):x.Children.only(n),o=el(a.ref,oM(s));return typeof n=="function"||a.isPresent?x.cloneElement(s,{ref:o}):null};dh.displayName="Presence";function lM(e){const[t,n]=x.useState(),a=x.useRef(null),s=x.useRef(e),o=x.useRef("none"),c=e?"mounted":"unmounted",[d,m]=sM(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const h=uf(a.current);o.current=d==="mounted"?h:"none"},[d]),lc(()=>{const h=a.current,g=s.current;if(g!==e){const b=o.current,w=uf(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(g&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),lc(()=>{if(t){let h;const g=t.ownerDocument.defaultView??window,p=w=>{const j=uf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!s.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",h=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},b=w=>{w.target===t&&(o.current=uf(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(h),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:x.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function uf(e){return(e==null?void 0:e.animationName)||"none"}function oM(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 rg=0;function uM(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??l1()),document.body.insertAdjacentElement("beforeend",e[1]??l1()),rg++,()=>{rg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),rg--}},[])}function l1(){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 BC(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 cM(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 Af="right-scroll-bar-position",Rf="width-before-scroll-bar",dM="with-scroll-bars-hidden",fM="--removed-body-scroll-bar-size";function ag(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hM(e,t){var n=x.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 mM=typeof window<"u"?x.useLayoutEffect:x.useEffect,o1=new WeakMap;function pM(e,t){var n=hM(null,function(a){return e.forEach(function(s){return ag(s,a)})});return mM(function(){var a=o1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(d){o.has(d)||ag(d,null)}),o.forEach(function(d){s.has(d)||ag(d,c)})}o1.set(n,e)},[e]),n}function gM(e){return e}function yM(e,t){t===void 0&&(t=gM);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(d){return d!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(d){return o(d)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var d=n;n=[],d.forEach(o),c=n}var m=function(){var g=c;c=[],g.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(g){c.push(g),h()},filter:function(g){return c=c.filter(g),n}}}};return s}function vM(e){e===void 0&&(e={});var t=yM(null);return t.options=Aa({async:!0,ssr:!1},e),t}var FC=function(e){var t=e.sideCar,n=BC(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 x.createElement(a,Aa({},n))};FC.isSideCarExport=!0;function bM(e,t){return e.useMedium(t),FC}var $C=vM(),ig=function(){},fh=x.forwardRef(function(e,t){var n=x.useRef(null),a=x.useState({onScrollCapture:ig,onWheelCapture:ig,onTouchMoveCapture:ig}),s=a[0],o=a[1],c=e.forwardProps,d=e.children,m=e.className,h=e.removeScrollBar,g=e.enabled,p=e.shards,b=e.sideCar,w=e.noRelative,S=e.noIsolation,j=e.inert,E=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,O=e.gapMode,z=BC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=b,R=pM([n,t]),F=Aa(Aa({},z),s);return x.createElement(x.Fragment,null,g&&x.createElement(L,{sideCar:$C,removeScrollBar:h,shards:p,noRelative:w,noIsolation:S,inert:j,setCallbacks:o,allowPinchZoom:!!E,lockRef:n,gapMode:O}),c?x.cloneElement(x.Children.only(d),Aa(Aa({},F),{ref:R})):x.createElement(N,Aa({},F,{className:m,ref:R}),d))});fh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fh.classNames={fullWidth:Rf,zeroRight:Af};var xM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function wM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xM();return t&&e.setAttribute("nonce",t),e}function SM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function kM(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var jM=function(){var e=0,t=null;return{add:function(n){e==0&&(t=wM())&&(SM(t,n),kM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},CM=function(){var e=jM();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},HC=function(){var e=CM(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},EM={left:0,top:0,right:0,gap:0},sg=function(e){return parseInt(e||"",10)||0},NM=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[sg(n),sg(a),sg(s)]},_M=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return EM;var t=NM(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])}},TM=HC(),eo="data-scroll-locked",AM=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,d=e.gap;return n===void 0&&(n="margin"),`
286
+ .`.concat(dM,` {
287
+ overflow: hidden `).concat(a,`;
288
+ padding-right: `).concat(d,"px ").concat(a,`;
289
+ }
290
+ body[`).concat(eo,`] {
291
+ overflow: hidden `).concat(a,`;
292
+ overscroll-behavior: contain;
293
+ `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
294
+ padding-left: `.concat(s,`px;
295
+ padding-top: `).concat(o,`px;
296
+ padding-right: `).concat(c,`px;
297
+ margin-left:0;
298
+ margin-top:0;
299
+ margin-right: `).concat(d,"px ").concat(a,`;
300
+ `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(a,";")].filter(Boolean).join(""),`
301
+ }
302
+
303
+ .`).concat(Af,` {
304
+ right: `).concat(d,"px ").concat(a,`;
305
+ }
306
+
307
+ .`).concat(Rf,` {
308
+ margin-right: `).concat(d,"px ").concat(a,`;
309
+ }
310
+
311
+ .`).concat(Af," .").concat(Af,` {
312
+ right: 0 `).concat(a,`;
313
+ }
314
+
315
+ .`).concat(Rf," .").concat(Rf,` {
316
+ margin-right: 0 `).concat(a,`;
317
+ }
318
+
319
+ body[`).concat(eo,`] {
320
+ `).concat(fM,": ").concat(d,`px;
321
+ }
322
+ `)},u1=function(){var e=parseInt(document.body.getAttribute(eo)||"0",10);return isFinite(e)?e:0},RM=function(){x.useEffect(function(){return document.body.setAttribute(eo,(u1()+1).toString()),function(){var e=u1()-1;e<=0?document.body.removeAttribute(eo):document.body.setAttribute(eo,e.toString())}},[])},OM=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;RM();var o=x.useMemo(function(){return _M(s)},[s]);return x.createElement(TM,{styles:AM(o,!t,s,n?"":"!important")})},Cy=!1;if(typeof window<"u")try{var cf=Object.defineProperty({},"passive",{get:function(){return Cy=!0,!0}});window.addEventListener("test",cf,cf),window.removeEventListener("test",cf,cf)}catch{Cy=!1}var Ul=Cy?{passive:!1}:!1,zM=function(e){return e.tagName==="TEXTAREA"},qC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!zM(e)&&n[t]==="visible")},DM=function(e){return qC(e,"overflowY")},MM=function(e){return qC(e,"overflowX")},c1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=ZC(e,a);if(s){var o=GC(e,a),c=o[1],d=o[2];if(c>d)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},IM=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},LM=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},ZC=function(e,t){return e==="v"?DM(t):MM(t)},GC=function(e,t){return e==="v"?IM(t):LM(t)},PM=function(e,t){return e==="h"&&t==="rtl"?-1:1},UM=function(e,t,n,a,s){var o=PM(e,window.getComputedStyle(t).direction),c=o*a,d=n.target,m=t.contains(d),h=!1,g=c>0,p=0,b=0;do{if(!d)break;var w=GC(e,d),S=w[0],j=w[1],E=w[2],C=j-E-o*S;(S||C)&&ZC(e,d)&&(p+=C,b+=S);var N=d.parentNode;d=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(g&&Math.abs(p)<1||!g&&Math.abs(b)<1)&&(h=!0),h},df=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},d1=function(e){return[e.deltaX,e.deltaY]},f1=function(e){return e&&"current"in e?e.current:e},BM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},FM=function(e){return`
323
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
324
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
325
+ `)},$M=0,Bl=[];function HM(e){var t=x.useRef([]),n=x.useRef([0,0]),a=x.useRef(),s=x.useState($M++)[0],o=x.useState(HC)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=cM([e.lockRef.current],(e.shards||[]).map(f1),!0).filter(Boolean);return j.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=x.useCallback(function(j,E){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var C=df(j),N=n.current,O="deltaX"in j?j.deltaX:N[0]-C[0],z="deltaY"in j?j.deltaY:N[1]-C[1],L,R=j.target,F=Math.abs(O)>Math.abs(z)?"h":"v";if("touches"in j&&F==="h"&&R.type==="range")return!1;var U=window.getSelection(),V=U&&U.anchorNode,M=V?V===R||V.contains(R):!1;if(M)return!1;var Y=c1(F,R);if(!Y)return!0;if(Y?L=F:(L=F==="v"?"h":"v",Y=c1(F,R)),!Y)return!1;if(!a.current&&"changedTouches"in j&&(O||z)&&(a.current=L),!L)return!0;var ae=a.current||L;return UM(ae,E,j,ae==="h"?O:z)},[]),m=x.useCallback(function(j){var E=j;if(!(!Bl.length||Bl[Bl.length-1]!==o)){var C="deltaY"in E?d1(E):df(E),N=t.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&BM(L.delta,C)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var O=(c.current.shards||[]).map(f1).filter(Boolean).filter(function(L){return L.contains(E.target)}),z=O.length>0?d(E,O[0]):!c.current.noIsolation;z&&E.cancelable&&E.preventDefault()}}},[]),h=x.useCallback(function(j,E,C,N){var O={name:j,delta:E,target:C,should:N,shadowParent:qM(C)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(z){return z!==O})},1)},[]),g=x.useCallback(function(j){n.current=df(j),a.current=void 0},[]),p=x.useCallback(function(j){h(j.type,d1(j),j.target,d(j,e.lockRef.current))},[]),b=x.useCallback(function(j){h(j.type,df(j),j.target,d(j,e.lockRef.current))},[]);x.useEffect(function(){return Bl.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Ul),document.addEventListener("touchmove",m,Ul),document.addEventListener("touchstart",g,Ul),function(){Bl=Bl.filter(function(j){return j!==o}),document.removeEventListener("wheel",m,Ul),document.removeEventListener("touchmove",m,Ul),document.removeEventListener("touchstart",g,Ul)}},[]);var w=e.removeScrollBar,S=e.inert;return x.createElement(x.Fragment,null,S?x.createElement(o,{styles:FM(s)}):null,w?x.createElement(OM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZM=bM($C,HM);var VC=x.forwardRef(function(e,t){return x.createElement(fh,Aa({},e,{ref:t,sideCar:ZM}))});VC.classNames=fh.classNames;var GM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fl=new WeakMap,ff=new WeakMap,hf={},lg=0,QC=function(e){return e&&(e.host||QC(e.parentNode))},VM=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=QC(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})},QM=function(e,t,n,a){var s=VM(t,Array.isArray(e)?e:[e]);hf[n]||(hf[n]=new WeakMap);var o=hf[n],c=[],d=new Set,m=new Set(s),h=function(p){!p||d.has(p)||(d.add(p),h(p.parentNode))};s.forEach(h);var g=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(b){if(d.has(b))g(b);else try{var w=b.getAttribute(a),S=w!==null&&w!=="false",j=(Fl.get(b)||0)+1,E=(o.get(b)||0)+1;Fl.set(b,j),o.set(b,E),c.push(b),j===1&&S&&ff.set(b,!0),E===1&&b.setAttribute(n,"true"),S||b.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return g(t),d.clear(),lg++,function(){c.forEach(function(p){var b=Fl.get(p)-1,w=o.get(p)-1;Fl.set(p,b),o.set(p,w),b||(ff.has(p)||p.removeAttribute(a),ff.delete(p)),w||p.removeAttribute(n)}),lg--,lg||(Fl=new WeakMap,Fl=new WeakMap,ff=new WeakMap,hf={})}},KM=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=GM(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),QM(a,s,n,"aria-hidden")):function(){return null}},hh="Dialog",[KC]=_D(hh),[YM,xa]=KC(hh),YC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,d=x.useRef(null),m=x.useRef(null),[h,g]=zD({prop:a,defaultProp:s??!1,onChange:o,caller:hh});return l.jsx(YM,{scope:t,triggerRef:d,contentRef:m,contentId:si(),titleId:si(),descriptionId:si(),open:h,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(p=>!p),[g]),modal:c,children:n})};YC.displayName=hh;var XC="DialogTrigger",XM=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(XC,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":_v(s.open),...a,ref:o,onClick:as(e.onClick,s.onOpenToggle)})});XM.displayName=XC;var Ev="DialogPortal",[WM,WC]=KC(Ev,{forceMount:void 0}),JC=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=xa(Ev,t);return l.jsx(WM,{scope:t,forceMount:n,children:x.Children.map(a,c=>l.jsx(dh,{present:n||o.open,children:l.jsx(UC,{asChild:!0,container:s,children:c})}))})};JC.displayName=Ev;var Ff="DialogOverlay",eE=x.forwardRef((e,t)=>{const n=WC(Ff,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=xa(Ff,e.__scopeDialog);return o.modal?l.jsx(dh,{present:a||o.open,children:l.jsx(eI,{...s,ref:t})}):null});eE.displayName=Ff;var JM=zC("DialogOverlay.RemoveScroll"),eI=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Ff,n);return l.jsx(VC,{as:JM,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(ci.div,{"data-state":_v(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Qs="DialogContent",tE=x.forwardRef((e,t)=>{const n=WC(Qs,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=xa(Qs,e.__scopeDialog);return l.jsx(dh,{present:a||o.open,children:o.modal?l.jsx(tI,{...s,ref:t}):l.jsx(nI,{...s,ref:t})})});tE.displayName=Qs;var tI=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(null),s=el(t,n.contentRef,a);return x.useEffect(()=>{const o=a.current;if(o)return KM(o)},[]),l.jsx(nE,{...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,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&o.preventDefault()}),onFocusOutside:as(e.onFocusOutside,o=>o.preventDefault())})}),nI=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(!1),s=x.useRef(!1);return l.jsx(nE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(d=n.triggerRef.current)==null||d.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()}})}),nE=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,d=xa(Qs,n),m=x.useRef(null),h=el(t,m);return uM(),l.jsxs(l.Fragment,{children:[l.jsx(LC,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(MC,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":_v(d.open),...c,ref:h,onDismiss:()=>d.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(rI,{titleId:d.titleId}),l.jsx(iI,{contentRef:m,descriptionId:d.descriptionId})]})]})}),Nv="DialogTitle",rE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Nv,n);return l.jsx(ci.h2,{id:s.titleId,...a,ref:t})});rE.displayName=Nv;var aE="DialogDescription",iE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(aE,n);return l.jsx(ci.p,{id:s.descriptionId,...a,ref:t})});iE.displayName=aE;var sE="DialogClose",lE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(sE,n);return l.jsx(ci.button,{type:"button",...a,ref:t,onClick:as(e.onClick,()=>s.onOpenChange(!1))})});lE.displayName=sE;function _v(e){return e?"open":"closed"}var oE="DialogTitleWarning",[aY,uE]=ND(oE,{contentName:Qs,titleName:Nv,docsSlug:"dialog"}),rI=({titleId:e})=>{const t=uE(oE),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
326
+
327
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
328
+
329
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},aI="DialogDescriptionWarning",iI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${uE(aI).contentName}}.`;return x.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},cE=YC,dE=JC,fE=eE,hE=tE,sI=rE,lI=iE,oI=lE,uI=Symbol.for("react.lazy"),$f=ev[" use ".trim().toString()];function cI(e){return typeof e=="object"&&e!==null&&"then"in e}function mE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===uI&&"_payload"in e&&cI(e._payload)}function pE(e){const t=fI(e),n=x.forwardRef((a,s)=>{let{children:o,...c}=a;mE(o)&&typeof $f=="function"&&(o=$f(o._payload));const d=x.Children.toArray(o),m=d.find(mI);if(m){const h=m.props.children,g=d.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return l.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var dI=pE("Slot");function fI(e){const t=x.forwardRef((n,a)=>{let{children:s,...o}=n;if(mE(s)&&typeof $f=="function"&&(s=$f(s._payload)),x.isValidElement(s)){const c=gI(s),d=pI(o,s.props);return s.type!==x.Fragment&&(d.ref=a?os(a,c):c),x.cloneElement(s,d)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hI=Symbol("radix.slottable");function mI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hI}function pI(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]=(...d)=>{const m=o(...d);return s(...d),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function gI(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 yI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],di=yI.reduce((e,t)=>{const n=pE(`Primitive.${t}`),a=x.forwardRef((s,o)=>{const{asChild:c,...d}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Mu='[cmdk-group=""]',og='[cmdk-group-items=""]',vI='[cmdk-group-heading=""]',gE='[cmdk-item=""]',h1=`${gE}:not([aria-disabled="true"])`,Ey="cmdk-item-select",Zl="data-value",bI=(e,t,n)=>ED(e,t,n),yE=x.createContext(void 0),zc=()=>x.useContext(yE),vE=x.createContext(void 0),Tv=()=>x.useContext(vE),bE=x.createContext(void 0),xE=x.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),d=wE(e),{label:m,children:h,value:g,onValueChange:p,filter:b,shouldFilter:w,loop:S,disablePointerSelection:j=!1,vimBindings:E=!0,...C}=e,N=si(),O=si(),z=si(),L=x.useRef(null),R=AI();Ks(()=>{if(g!==void 0){let P=g.trim();n.current.value=P,F.emit()}},[g]),Ks(()=>{R(6,xe)},[]);let F=x.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(),M(),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,F.emit()}),Z||R(5,xe),((ue=d.current)==null?void 0:ue.value)!==void 0){let pe=_??"";(we=(je=d.current).onValueChange)==null||we.call(je,pe);return}}F.emit()}},emit:()=>{c.current.forEach(P=>P())}}),[]),U=x.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,()=>{M(),F.emit()}))},item:(P,_)=>(a.current.add(P),_&&(s.current.has(_)?s.current.get(_).add(P):s.current.set(_,new Set([P]))),R(3,()=>{ae(),M(),n.current.value||Y(),F.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(),F.emit()})}),group:P=>(s.current.has(P)||s.current.set(P,new Set),()=>{o.current.delete(P),s.current.delete(P)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:N,inputId:z,labelId:O,listInnerRef:L}),[]);function V(P,_){var Z,Q;let ue=(Q=(Z=d.current)==null?void 0:Z.filter)!=null?Q:bI;return P?ue(P,n.current.search,_):0}function M(){if(!n.current.search||d.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"),Me=ue.getAttribute("id");return((je=P.get(Me))!=null?je:0)-((we=P.get(pe))!=null?we:0)}).forEach(Q=>{let ue=Q.closest(og);ue?ue.appendChild(Q.parentElement===ue?Q:Q.closest(`${og} > *`)):Z.appendChild(Q.parentElement===Z?Q:Q.closest(`${og} > *`))}),_.sort((Q,ue)=>ue[1]-Q[1]).forEach(Q=>{var ue;let je=(ue=L.current)==null?void 0:ue.querySelector(`${Mu}[${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);F.setState("value",_||void 0)}function ae(){var P,_,Z,Q;if(!n.current.search||d.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:[],Me=V(we,pe);n.current.filtered.items.set(je,Me),Me>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(Mu))==null?void 0:_.querySelector(vI))==null||Z.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function J(){var P;return(P=L.current)==null?void 0:P.querySelector(`${gE}[aria-selected="true"]`)}function X(){var P;return Array.from(((P=L.current)==null?void 0:P.querySelectorAll(h1))||[])}function q(P){let _=X()[P];_&&F.setState("value",_.getAttribute(Zl))}function te(P){var _;let Z=J(),Q=X(),ue=Q.findIndex(we=>we===Z),je=Q[ue+P];(_=d.current)!=null&&_.loop&&(je=ue+P<0?Q[Q.length-1]:ue+P===Q.length?Q[0]:Q[ue+P]),je&&F.setState("value",je.getAttribute(Zl))}function ke(P){let _=J(),Z=_==null?void 0:_.closest(Mu),Q;for(;Z&&!Q;)Z=P>0?_I(Z,Mu):TI(Z,Mu),Q=Z==null?void 0:Z.querySelector(h1);Q?F.setState("value",Q.getAttribute(Zl)):te(P)}let Ae=()=>q(X().length-1),D=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 x.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&&D(P);break}case"ArrowDown":{D(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(Ey);Q.dispatchEvent(ue)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:OI},m),mh(e,P=>x.createElement(vE.Provider,{value:F},x.createElement(yE.Provider,{value:U},P))))}),xI=x.forwardRef((e,t)=>{var n,a;let s=si(),o=x.useRef(null),c=x.useContext(bE),d=zc(),m=wE(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ks(()=>{if(!h)return d.item(s,c==null?void 0:c.id)},[h]);let g=SE(s,o,[e.value,e.children,o],e.keywords),p=Tv(),b=us(R=>R.value&&R.value===g.current),w=us(R=>h||d.filter()===!1?!0:R.search?R.filtered.items.get(s)>0:!0);x.useEffect(()=>{let R=o.current;if(!(!R||e.disabled))return R.addEventListener(Ey,S),()=>R.removeEventListener(Ey,S)},[w,e.onSelect,e.disabled]);function S(){var R,F;j(),(F=(R=m.current).onSelect)==null||F.call(R,g.current)}function j(){p.setState("value",g.current,!0)}if(!w)return null;let{disabled:E,value:C,onSelect:N,forceMount:O,keywords:z,...L}=e;return x.createElement(di.div,{ref:os(o,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:j,onClick:E?void 0:S},e.children)}),wI=x.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=si(),d=x.useRef(null),m=x.useRef(null),h=si(),g=zc(),p=us(w=>s||g.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ks(()=>g.group(c),[]),SE(c,d,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:c,forceMount:s}),[s]);return x.createElement(di.div,{ref:os(d,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),mh(e,w=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},x.createElement(bE.Provider,{value:b},w))))}),SI=x.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=x.useRef(null),o=us(c=>!c.search);return!n&&!o?null:x.createElement(di.div,{ref:os(s,t),...a,"cmdk-separator":"",role:"separator"})}),kI=x.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Tv(),c=us(h=>h.search),d=us(h=>h.selectedItemId),m=zc();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.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":d,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)}})}),jI=x.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=x.useRef(null),c=x.useRef(null),d=us(h=>h.selectedItemId),m=zc();return x.useEffect(()=>{if(c.current&&o.current){let h=c.current,g=o.current,p,b=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let w=h.offsetHeight;g.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(p),b.unobserve(h)}}},[]),x.createElement(di.div,{ref:os(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},mh(e,h=>x.createElement("div",{ref:os(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),CI=x.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...d}=e;return x.createElement(cE,{open:n,onOpenChange:a},x.createElement(dE,{container:c},x.createElement(fE,{"cmdk-overlay":"",className:s}),x.createElement(hE,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(xE,{ref:t,...d}))))}),EI=x.forwardRef((e,t)=>us(n=>n.filtered.count===0)?x.createElement(di.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),NI=x.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return x.createElement(di.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},mh(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),jr=Object.assign(xE,{List:jI,Item:xI,Input:kI,Group:wI,Separator:SI,Dialog:CI,Empty:EI,Loading:NI});function _I(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function TI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function wE(e){let t=x.useRef(e);return Ks(()=>{t.current=e}),t}var Ks=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Gl(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function us(e){let t=Tv(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function SE(e,t,n,a=[]){let s=x.useRef(),o=zc();return Ks(()=>{var c;let d=(()=>{var h;for(let g of n){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(h=g.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,d,m),(c=t.current)==null||c.setAttribute(Zl,d),s.current=d}),s}var AI=()=>{let[e,t]=x.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 RI(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function mh({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(RI(t),{ref:t.ref},n(t.props.children)):n(t)}var OI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Mn=cE,zI=dE,kE=x.forwardRef(({className:e,...t},n)=>l.jsx(fE,{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}));kE.displayName="DialogOverlay";const An=x.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(zI,{children:[l.jsx(kE,{}),l.jsxs(hE,{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(oI,{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=x.forwardRef(({className:e,...t},n)=>l.jsx(sI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));In.displayName="DialogTitle";const Av=x.forwardRef(({className:e,...t},n)=>l.jsx(lI,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));Av.displayName="DialogDescription";const jE=x.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}));jE.displayName=jr.displayName;function DI({open:e,onOpenChange:t,children:n}){return l.jsx(Mn,{open:e,onOpenChange:t,children:l.jsx(An,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(jE,{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 CE=x.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(uh,{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})]}));CE.displayName=jr.Input.displayName;const EE=x.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}));EE.displayName=jr.List.displayName;const NE=x.forwardRef((e,t)=>l.jsx(jr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));NE.displayName=jr.Empty.displayName;const Of=x.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}));Of.displayName=jr.Group.displayName;const Ny=x.forwardRef(({className:e,...t},n)=>l.jsx(jr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));Ny.displayName=jr.Separator.displayName;const zf=x.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}));zf.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 MI(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 Rv(){return Ee.get("/me/managed-agents")}function II(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function LI(e){return Ee.post(Tn("/agents"),e)}function PI(e){return Ee.get(Tn(`/agents/names/${encodeURIComponent(e)}/availability`))}function m1(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function UI(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function _E(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function TE(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function AE(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function BI(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function ph(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Rv,staleTime:3e4});return x.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 Ov(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Rv,staleTime:3e4});return x.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 FI=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function $I({open:e,onOpenChange:t}){const n=_n(),a=ph(),{data:s}=Ye({queryKey:["activity"],queryFn:Oc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],d=Ye({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const g of o)try{const p=await RC(g.agentId);for(const b of p)h.push({agentId:g.agentId,session:b})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(DI,{open:e,onOpenChange:t,children:[l.jsx(CE,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(EE,{children:[l.jsx(NE,{children:"No results"}),o.length>0&&l.jsx(Of,{heading:"Agents",children:o.map(h=>{const g=a(h.agentId);return l.jsxs(zf,{value:`agent ${g} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(oC,{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:h.agentId.slice(0,8)})]},h.agentId)})}),d.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ny,{}),l.jsx(Of,{heading:"Chats",children:d.map(({agentId:h,session:g})=>{const p=a(h);return l.jsxs(zf,{value:`chat ${p} ${g.chatId}`,onSelect:()=>m(`/?a=${h}&c=${g.chatId}`),children:[l.jsx(wv,{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:g.chatId.slice(0,8)})]},`${h}-${g.chatId}`)})})]}),l.jsx(Ny,{}),l.jsx(Of,{heading:"Pages",children:FI.map(h=>l.jsxs(zf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(Vz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function HI(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function qI(){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=HI(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const ZI=160;function GI(){const e=_n(),{rows:t,firstHostname:n}=qI();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(VI,{}),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:ZI,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 VI(){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 Mc(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 p1(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 QI(e){return Ee.post(Tn(`/notifications/${e}/read`))}function KI(){return Ee.post(Tn("/notifications/read-all"))}const YI={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 XI(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function WI({notification:e,onClick:t,clickable:n}){const a=(YI[e.type]??e.type).toString(),s=XI(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:sc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function JI(){var w;const[e,t]=x.useState(!1),[n,a]=x.useState(null),s=x.useRef(null),o=_n(),c=mn(),{data:d}=Ye({queryKey:["notifications","bell"],queryFn:()=>p1({limit:8}),refetchInterval:1e4}),{data:m}=Ye({queryKey:["notifications","unread-count"],queryFn:()=>p1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,g=h>0,p=x.useCallback(async S=>{S.read||(QI(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]),b=x.useCallback(async()=>{a(null);try{await KI(),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(Tz,{className:"h-4 w-4"}),g&&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"}),g&&l.jsx("button",{type:"button",onClick:b,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:!(d!=null&&d.items)||d.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"}):d.items.map(S=>l.jsx(WI,{notification:S,clickable:!!S.agentId,onClick:()=>p(S)},S.id))})]})]})]})}function e4(){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 t4(){const[e,t]=x.useState(e4);return x.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(d3,{className:"h-4 w-4"}):l.jsx(t3,{className:"h-4 w-4"})})}function n4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function g1({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:n4(t)})})}const y1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,v1=pC,r4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return v1(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 g=n==null?void 0:n[h],p=o==null?void 0:o[h];if(g===null)return null;const b=y1(g)||y1(p);return s[h][b]}),d=n&&Object.entries(n).reduce((h,g)=>{let[p,b]=g;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:b,...w}=g;return Object.entries(w).every(S=>{let[j,E]=S;return Array.isArray(E)?E.includes({...o,...d}[j]):{...o,...d}[j]===E})?[...h,p,b]:h},[]);return v1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},a4=r4("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=x.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?dI:"button";return l.jsx(c,{className:ze(a4({variant:t,size:n,className:e})),ref:o,...s})});ve.displayName="Button";const Ut=x.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 i4({action:e,onClose:t}){const n=e!==null;return l.jsx(Mn,{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(Av,{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(l4,{onDone:t}),e==="join"&&l.jsx(o4,{onDone:t})]})})}function s4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function l4({onDone:e}){const{adoptTokens:t}=gt(),n=_n(),[a,s]=x.useState(""),[o,c]=x.useState(null),[d,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{g.preventDefault();const p=a.trim();if(p){m(!0),c(null);try{const b=await Ee.post("/me/organizations",{name:s4(p),displayName:p});await t(b.tokens),e(),n("/",{replace:!0})}catch(b){c(b instanceof Error?b.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:g=>s(g.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:d||!a.trim(),children:d?"Creating…":"Create team"})]})}function o4({onDone:e}){const{adoptTokens:t}=gt(),n=_n(),[a,s]=x.useState(""),[o,c]=x.useState(null),[d,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{if(g.preventDefault(),!!a.trim()){m(!0),c(null);try{const p=a.trim(),b=/\/invite\/([^/?#]+)/.exec(p),w=(b==null?void 0:b[1])??p,S=await Ee.post("/me/organizations/join",{token:w});await t(S.tokens),e(),n("/",{replace:!0})}catch(p){c(p instanceof Error?p.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:g=>s(g.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:d||!a.trim(),children:d?"Joining…":"Join team"})]})}function u4(){var L,R;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=gt(),o=_n(),[c,d]=x.useState([]),[m,h]=x.useState(!1),[g,p]=x.useState(null),b=x.useRef(null);x.useEffect(()=>{(async()=>{try{const F=await Ee.get("/me/organizations");d(F)}catch{}})()},[]),x.useEffect(()=>{const F=V=>{m&&b.current&&!b.current.contains(V.target)&&h(!1)},U=V=>{m&&V.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",F),window.addEventListener("keydown",U),()=>{window.removeEventListener("mousedown",F),window.removeEventListener("keydown",U)}},[m]);const w=(n==null?void 0:n.displayName)??"User",S=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,E=c.find(F=>F.id===e)??null,C=(E==null?void 0:E.role)??(t==="admin"||t==="member"?t:null),N=async F=>{if(F===e){h(!1);return}try{await a(F),h(!1),o("/",{replace:!0})}catch{}},O=()=>{h(!1),p("create")},z=()=>{h(!1),p("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:b,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(F=>!F),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(g1,{src:j,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(g1,{src:j,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(b1,{role:((R=c[0])==null?void 0:R.role)??C})]}):l.jsx("div",{children:c.map(F=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void N(F.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:F.id===e?l.jsx(cr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.displayName}),l.jsx(b1,{role:F.role})]},F.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(hC,{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(Wz,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(i4,{action:g,onClose:()=>p(null)})]})}function b1({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 c4=[{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 d4(){const[e,t]=x.useState(!1),n=kr(),a=n.pathname==="/"||n.search.includes("a=");return x.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(Mc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(GI,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:c4.map(s=>l.jsx(mv,{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(uh,{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(JI,{}),l.jsx(t4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(u4,{})]})]}),l.jsx($I,{open:e,onOpenChange:t}),a?l.jsx(Pf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(Pf,{})})})]})}const RE=x.createContext(null),f4=5e3;function h4({children:e}){const[t,n]=x.useState([]),a=x.useCallback(c=>{n(d=>d.filter(m=>m.id!==c))},[]),o={addToast:x.useCallback(c=>{const d=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:d}])},[])};return l.jsxs(RE.Provider,{value:o,children:[e,l.jsx(m4,{toasts:t,onDismiss:a})]})}function Ic(){const e=x.useContext(RE);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function m4({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(p4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function p4({toast:e,onDismiss:t}){const n=x.useRef(t);return n.current=t,x.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??f4,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(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,m);const h=c.prototype,g=Object.keys(h);for(let p=0;p<g.length;p++){const b=g[p];b in d||(d[b]=h[b].bind(d))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(d){var m;const h=n!=null&&n.Parent?new o:this;a(h,d),(m=h._zod).deferred??(m.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:d=>{var m,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(m=d==null?void 0:d._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 OE extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const zE={};function cs(e){return zE}function DE(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 _y(e,t){return typeof t=="bigint"?t.toString():t}function gh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function zv(e){return e==null}function Dv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function g4(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(".","")),d=Number.parseInt(t.toFixed(o).replace(".",""));return c%d/10**o}const x1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==x1)return a===void 0&&(a=x1,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 w1(e){return JSON.stringify(e)}function y4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ME="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function uc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const v4=gh(()=>{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(uc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(uc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function IE(e){return bo(e)?{...e}:Array.isArray(e)?[...e]:e}const b4=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 x4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const w4={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 S4(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 d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(c[d]=n.shape[d])}return tl(this,"shape",c),c},checks:[]});return ms(e,o)}function k4(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 d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete c[d]}return tl(this,"shape",c),c},checks:[]});return ms(e,o)}function j4(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 C4(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 E4(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 N4(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 d=t._zod.def.shape,m={...d};if(n)for(const h in n){if(!(h in d))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:d[h]}):d[h])}else for(const h in d)m[h]=e?new e({type:"optional",innerType:d[h]}):d[h];return tl(this,"shape",m),m},checks:[]});return ms(t,c)}function _4(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 mf(e){return typeof e=="string"?e:e==null?void 0:e.message}function ds(e,t,n){var s,o,c,d,m,h;const a={...e,path:e.path??[]};if(!e.message){const g=mf((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??mf((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??mf((m=n.customError)==null?void 0:m.call(n,e))??mf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=g}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function Mv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function cc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const LE=(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,_y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},PE=de("$ZodError",LE),UE=de("$ZodError",LE,{Parent:Error});function T4(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 A4(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,d=0;for(;d<o.path.length;){const m=o.path[d];d===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],d++}}};return a(e),n}const Iv=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 d=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,o,cs())));throw ME(d,s==null?void 0:s.callee),d}return c.value},Lv=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 d=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,o,cs())));throw ME(d,s==null?void 0:s.callee),d}return c.value},yh=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??PE)(o.issues.map(c=>ds(c,s,cs())))}:{success:!0,data:o.value}},R4=yh(UE),vh=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}},O4=vh(UE),z4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Iv(e)(t,n,s)},D4=e=>(t,n,a)=>Iv(e)(t,n,a),M4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Lv(e)(t,n,s)},I4=e=>async(t,n,a)=>Lv(e)(t,n,a),L4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return yh(e)(t,n,s)},P4=e=>(t,n,a)=>yh(e)(t,n,a),U4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},B4=e=>async(t,n,a)=>vh(e)(t,n,a),F4=/^[cC][^\s-]{8,}$/,$4=/^[0-9a-z]+$/,H4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q4=/^[0-9a-vA-V]{20}$/,Z4=/^[A-Za-z0-9]{27}$/,G4=/^[a-zA-Z0-9_-]{21}$/,V4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Q4=/^([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})$/,S1=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)$/,K4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Y4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function X4(){return new RegExp(Y4,"u")}const W4=/^(?:(?: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])$/,J4=/^(([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}|:))$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,t5=/^(([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])$/,n5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,BE=/^[A-Za-z0-9_-]*$/,r5=/^\+[1-9]\d{6,14}$/,FE="(?:(?:\\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])))",a5=new RegExp(`^${FE}$`);function $E(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 i5(e){return new RegExp(`^${$E(e)}$`)}function s5(e){const t=$E({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(`^${FE}T(?:${a})$`)}const l5=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}$`)},o5=/^-?\d+$/,HE=/^-?\d+(?:\.\d+)?$/,u5=/^(?:true|false)$/i,c5=/^null$/i,d5=/^[^A-Z]*$/,f5=/^[^a-z]*$/,Er=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qE={number:"number",bigint:"bigint",object:"date"},ZE=de("$ZodCheckLessThan",(e,t)=>{Er.init(e,t);const n=qE[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})}}),GE=de("$ZodCheckGreaterThan",(e,t)=>{Er.init(e,t);const n=qE[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})}}),h5=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):g4(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})}}),m5=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]=w4[t.format];e._zod.onattach.push(d=>{const m=d._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=o5)}),e._zod.check=d=>{const m=d.value;if(n){if(!Number.isInteger(m)){d.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?d.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}):d.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&&d.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),p5=de("$ZodCheckMaxLength",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!zv(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=Mv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),g5=de("$ZodCheckMinLength",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!zv(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=Mv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),y5=de("$ZodCheckLengthEquals",(e,t)=>{var n;Er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!zv(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=Mv(s),d=o>t.length;a.issues.push({origin:c,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),bh=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=()=>{})}),v5=de("$ZodCheckRegex",(e,t)=>{bh.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})}}),b5=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=d5),bh.init(e,t)}),x5=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=f5),bh.init(e,t)}),w5=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})}}),S5=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})}}),k5=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})}}),j5=de("$ZodCheckOverwrite",(e,t)=>{Er.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class C5{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(`
330
+ `).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(`
331
+ `))}}const E5={major:4,minor:3,patch:6},Kt=de("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=E5;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=(d,m,h)=>{let g=Yl(d),p;for(const b of m){if(b._zod.def.when){if(!b._zod.def.when(d))continue}else if(g)continue;const w=d.issues.length,S=b._zod.check(d);if(S instanceof Promise&&(h==null?void 0:h.async)===!1)throw new to;if(p||S instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await S,d.issues.length!==w&&(g||(g=Yl(d,w)))});else{if(d.issues.length===w)continue;g||(g=Yl(d,w))}}return p?p.then(()=>d):d},c=(d,m,h)=>{if(Yl(d))return d.aborted=!0,d;const g=o(m,a,h);if(g instanceof Promise){if(h.async===!1)throw new to;return g.then(p=>e._zod.parse(p,h))}return e._zod.parse(g,h)};e._zod.run=(d,m)=>{if(m.skipChecks)return e._zod.parse(d,m);if(m.direction==="backward"){const g=e._zod.parse({value:d.value,issues:[]},{...m,skipChecks:!0});return g instanceof Promise?g.then(p=>c(p,d,m)):c(g,d,m)}const h=e._zod.parse(d,m);if(h instanceof Promise){if(m.async===!1)throw new to;return h.then(g=>o(g,a,m))}return o(h,a,m)}}Ct(e,"~standard",()=>({validate:o=>{var c;try{const d=R4(e,o);return d.success?{value:d.data}:{issues:(c=d.error)==null?void 0:c.issues}}catch{return O4(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}))}),Pv=de("$ZodString",(e,t)=>{var n;Kt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??l5(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}}),Yt=de("$ZodStringFormat",(e,t)=>{bh.init(e,t),Pv.init(e,t)}),N5=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Q4),Yt.init(e,t)}),_5=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=S1(a))}else t.pattern??(t.pattern=S1());Yt.init(e,t)}),T5=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=K4),Yt.init(e,t)}),A5=de("$ZodURL",(e,t)=>{Yt.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})}}}),R5=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=X4()),Yt.init(e,t)}),O5=de("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=G4),Yt.init(e,t)}),z5=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=F4),Yt.init(e,t)}),D5=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$4),Yt.init(e,t)}),M5=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=H4),Yt.init(e,t)}),I5=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=q4),Yt.init(e,t)}),L5=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Z4),Yt.init(e,t)}),P5=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=s5(t)),Yt.init(e,t)}),U5=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=a5),Yt.init(e,t)}),B5=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=i5(t)),Yt.init(e,t)}),F5=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=V4),Yt.init(e,t)}),$5=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=W4),Yt.init(e,t),e._zod.bag.format="ipv4"}),H5=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=J4),Yt.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})}}}),q5=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=e5),Yt.init(e,t)}),Z5=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=t5),Yt.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 VE(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const G5=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=n5),Yt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{VE(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function V5(e){if(!BE.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return VE(n)}const Q5=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=BE),Yt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{V5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),K5=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=r5),Yt.init(e,t)});function Y5(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 X5=de("$ZodJWT",(e,t)=>{Yt.init(e,t),e._zod.check=n=>{Y5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),QE=de("$ZodNumber",(e,t)=>{Kt.init(e,t),e._zod.pattern=e._zod.bag.pattern??HE,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}}),W5=de("$ZodNumberFormat",(e,t)=>{m5.init(e,t),QE.init(e,t)}),J5=de("$ZodBoolean",(e,t)=>{Kt.init(e,t),e._zod.pattern=u5,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}}),eL=de("$ZodNull",(e,t)=>{Kt.init(e,t),e._zod.pattern=c5,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}}),tL=de("$ZodUnknown",(e,t)=>{Kt.init(e,t),e._zod.parse=n=>n}),nL=de("$ZodNever",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function k1(e,t,n){e.issues.length&&t.issues.push(...Xl(n,e.issues)),t.value[n]=e.value}const rL=de("$ZodArray",(e,t)=>{Kt.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 d=s[c],m=t.element._zod.run({value:d,issues:[]},a);m instanceof Promise?o.push(m.then(h=>k1(h,n,c))):k1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function Hf(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 KE(e){var a,s,o,c;const t=Object.keys(e.shape);for(const d of t)if(!((c=(o=(s=(a=e.shape)==null?void 0:a[d])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=x4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function YE(e,t,n,a,s,o){const c=[],d=s.keySet,m=s.catchall._zod,h=m.def.type,g=m.optout==="optional";for(const p in t){if(d.has(p))continue;if(h==="never"){c.push(p);continue}const b=m.run({value:t[p],issues:[]},a);b instanceof Promise?e.push(b.then(w=>Hf(w,n,p,t,g))):Hf(b,n,p,t,g)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const aL=de("$ZodObject",(e,t)=>{Kt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...d};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=gh(()=>KE(t));Ct(e._zod,"propValues",()=>{const d=t.shape,m={};for(const h in d){const g=d[h]._zod;if(g.values){m[h]??(m[h]=new Set);for(const p of g.values)m[h].add(p)}}return m});const s=uc,o=t.catchall;let c;e._zod.parse=(d,m)=>{c??(c=a.value);const h=d.value;if(!s(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;d.value={};const g=[],p=c.shape;for(const b of c.keys){const w=p[b],S=w._zod.optout==="optional",j=w._zod.run({value:h[b],issues:[]},m);j instanceof Promise?g.push(j.then(E=>Hf(E,d,b,h,S))):Hf(j,d,b,h,S)}return o?YE(g,h,d,m,a.value,e):g.length?Promise.all(g).then(()=>d):d}}),iL=de("$ZodObjectJIT",(e,t)=>{aL.init(e,t);const n=e._zod.parse,a=gh(()=>KE(t)),s=b=>{var O;const w=new C5(["shape","payload","ctx"]),S=a.value,j=z=>{const L=w1(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=w1(z),F=b[z],U=((O=F==null?void 0:F._zod)==null?void 0:O.optout)==="optional";w.write(`const ${L} = ${j(z)};`),U?w.write(`
332
+ if (${L}.issues.length) {
333
+ if (${R} in input) {
334
+ payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
335
+ ...iss,
336
+ path: iss.path ? [${R}, ...iss.path] : [${R}]
337
+ })));
338
+ }
339
+ }
340
+
341
+ if (${L}.value === undefined) {
342
+ if (${R} in input) {
343
+ newResult[${R}] = undefined;
344
+ }
345
+ } else {
346
+ newResult[${R}] = ${L}.value;
347
+ }
348
+
349
+ `):w.write(`
350
+ if (${L}.issues.length) {
351
+ payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
352
+ ...iss,
353
+ path: iss.path ? [${R}, ...iss.path] : [${R}]
354
+ })));
355
+ }
356
+
357
+ if (${L}.value === undefined) {
358
+ if (${R} in input) {
359
+ newResult[${R}] = undefined;
360
+ }
361
+ } else {
362
+ newResult[${R}] = ${L}.value;
363
+ }
364
+
365
+ `)}w.write("payload.value = newResult;"),w.write("return payload;");const N=w.compile();return(z,L)=>N(b,z,L)};let o;const c=uc,d=!zE.jitless,h=d&&v4.value,g=t.catchall;let p;e._zod.parse=(b,w)=>{p??(p=a.value);const S=b.value;return c(S)?d&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),b=o(b,w),g?YE([],S,b,w,p,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function j1(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 XE=de("$ZodUnion",(e,t)=>{Kt.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=>Dv(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 d=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)d.push(h),c=!0;else{if(h.issues.length===0)return h;d.push(h)}}return c?Promise.all(d).then(m=>j1(m,s,e,o)):j1(d,s,e,o)}}),sL=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,XE.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[d,m]of Object.entries(c)){s[d]||(s[d]=new Set);for(const h of m)s[d].add(h)}}return s});const a=gh(()=>{var c;const s=t.options,o=new Map;for(const d of s){const m=(c=d._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(d)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,d)}}return o});e._zod.parse=(s,o)=>{const c=s.value;if(!uc(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const d=a.value.get(c==null?void 0:c[t.discriminator]);return d?d._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)}}),lL=de("$ZodIntersection",(e,t)=>{Kt.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])=>C1(n,m,h)):C1(n,o,c)}});function Ty(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=Ty(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=Ty(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 C1(e,t,n){const a=new Map;let s;for(const d of t.issues)if(d.code==="unrecognized_keys"){s??(s=d);for(const m of d.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const m of d.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(d);const o=[...a].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(o.length&&s&&e.issues.push({...s,keys:o}),Yl(e))return e;const c=Ty(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 oL=de("$ZodRecord",(e,t)=>{Kt.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 d=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){d.add(typeof h=="number"?h.toString():h);const g=t.valueType._zod.run({value:s[h],issues:[]},a);g instanceof Promise?o.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(h,p.issues)),n.value[h]=p.value})):(g.issues.length&&n.issues.push(...Xl(h,g.issues)),n.value[h]=g.value)}let m;for(const h in s)d.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 d of Reflect.ownKeys(s)){if(d==="__proto__")continue;let m=t.keyType._zod.run({value:d,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&HE.test(d)&&m.issues.length){const p=t.keyType._zod.run({value:Number(d),issues:[]},a);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(m=p)}if(m.issues.length){t.mode==="loose"?n.value[d]=s[d]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(p=>ds(p,a,cs())),input:d,path:[d],inst:e});continue}const g=t.valueType._zod.run({value:s[d],issues:[]},a);g instanceof Promise?o.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(d,p.issues)),n.value[m.value]=p.value})):(g.issues.length&&n.issues.push(...Xl(d,g.issues)),n.value[m.value]=g.value)}}return o.length?Promise.all(o).then(()=>n):n}}),uL=de("$ZodEnum",(e,t)=>{Kt.init(e,t);const n=DE(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>b4.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}}),cL=de("$ZodLiteral",(e,t)=>{if(Kt.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}}),dL=de("$ZodTransform",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new OE(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 E1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const WE=de("$ZodOptional",(e,t)=>{Kt.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(`^(${Dv(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=>E1(o,n.value)):E1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),fL=de("$ZodExactOptional",(e,t)=>{WE.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)}),hL=de("$ZodNullable",(e,t)=>{Kt.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(`^(${Dv(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)}),mL=de("$ZodDefault",(e,t)=>{Kt.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=>N1(o,t)):N1(s,t)}});function N1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const pL=de("$ZodPrefault",(e,t)=>{Kt.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))}),gL=de("$ZodNonOptional",(e,t)=>{Kt.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=>_1(o,e)):_1(s,e)}});function _1(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 yL=de("$ZodCatch",(e,t)=>{Kt.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)}}),vL=de("$ZodPipe",(e,t)=>{Kt.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=>pf(c,t.in,a)):pf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>pf(o,t.out,a)):pf(s,t.out,a)}});function pf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const bL=de("$ZodReadonly",(e,t)=>{Kt.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(T1):T1(s)}});function T1(e){return e.value=Object.freeze(e.value),e}const xL=de("$ZodCustom",(e,t)=>{Er.init(e,t),Kt.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=>A1(o,n,a,e));A1(s,n,a,e)}});function A1(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(cc(s))}}var R1;class wL{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 SL(){return new wL}(R1=globalThis).__zod_globalRegistry??(R1.__zod_globalRegistry=SL());const Qu=globalThis.__zod_globalRegistry;function kL(e,t){return new e({type:"string",...Ie(t)})}function jL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(t)})}function O1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(t)})}function CL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(t)})}function EL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(t)})}function NL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(t)})}function _L(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(t)})}function TL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(t)})}function AL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(t)})}function RL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(t)})}function OL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(t)})}function zL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(t)})}function DL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(t)})}function ML(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(t)})}function IL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(t)})}function LL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(t)})}function PL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(t)})}function UL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(t)})}function BL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(t)})}function FL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(t)})}function $L(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(t)})}function HL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(t)})}function qL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(t)})}function ZL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(t)})}function GL(e,t){return new e({type:"string",format:"date",check:"string_format",...Ie(t)})}function VL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(t)})}function QL(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ie(t)})}function KL(e,t){return new e({type:"number",checks:[],...Ie(t)})}function YL(e,t){return new e({type:"number",coerce:!0,checks:[],...Ie(t)})}function XL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(t)})}function WL(e,t){return new e({type:"boolean",...Ie(t)})}function JL(e,t){return new e({type:"null",...Ie(t)})}function eP(e){return new e({type:"unknown"})}function tP(e,t){return new e({type:"never",...Ie(t)})}function z1(e,t){return new ZE({check:"less_than",...Ie(t),value:e,inclusive:!1})}function ug(e,t){return new ZE({check:"less_than",...Ie(t),value:e,inclusive:!0})}function D1(e,t){return new GE({check:"greater_than",...Ie(t),value:e,inclusive:!1})}function cg(e,t){return new GE({check:"greater_than",...Ie(t),value:e,inclusive:!0})}function M1(e,t){return new h5({check:"multiple_of",...Ie(t),value:e})}function JE(e,t){return new p5({check:"max_length",...Ie(t),maximum:e})}function qf(e,t){return new g5({check:"min_length",...Ie(t),minimum:e})}function eN(e,t){return new y5({check:"length_equals",...Ie(t),length:e})}function nP(e,t){return new v5({check:"string_format",format:"regex",...Ie(t),pattern:e})}function rP(e){return new b5({check:"string_format",format:"lowercase",...Ie(e)})}function aP(e){return new x5({check:"string_format",format:"uppercase",...Ie(e)})}function iP(e,t){return new w5({check:"string_format",format:"includes",...Ie(t),includes:e})}function sP(e,t){return new S5({check:"string_format",format:"starts_with",...Ie(t),prefix:e})}function lP(e,t){return new k5({check:"string_format",format:"ends_with",...Ie(t),suffix:e})}function _o(e){return new j5({check:"overwrite",tx:e})}function oP(e){return _o(t=>t.normalize(e))}function uP(){return _o(e=>e.trim())}function cP(){return _o(e=>e.toLowerCase())}function dP(){return _o(e=>e.toUpperCase())}function fP(){return _o(e=>y4(e))}function hP(e,t,n){return new e({type:"array",element:t,...Ie(n)})}function mP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ie(n)})}function pP(e){const t=gP(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(cc(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(cc(s))}},e(n.value,n)));return t}function gP(e,t){const n=new Er({check:"custom",...Ie(t)});return n._zod.check=e,n}function tN(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)??Qu,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 g,p;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 d=(p=(g=e._zod).toJSONSchema)==null?void 0:p.call(g);if(d)c.schema=d;else{const b={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,b);else{const S=c.schema,j=t.processors[s.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);j(e,t,S,b)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),kn(w,t,b),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 nN(e,t){var c,d,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 g of e.seen.entries()){const p=(c=e.metadataRegistry.get(g[0]))==null?void 0:c.id;if(p){const b=a.get(p);if(b&&b!==g[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(p,g[0])}}const s=g=>{var j;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(j=e.external.registry.get(g[0]))==null?void 0:j.id,C=e.external.uri??(O=>O);if(E)return{ref:C(E)};const N=g[1].defId??g[1].schema.id??`schema${e.counter++}`;return g[1].defId=N,{defId:N,ref:`${C("__shared")}#/${p}/${N}`}}if(g[1]===n)return{ref:"#"};const w=`#/${p}/`,S=g[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:w+S}},o=g=>{if(g[1].schema.$ref)return;const p=g[1],{ref:b,defId:w}=s(g);p.def={...p.schema},w&&(p.defId=w);const S=p.schema;for(const j in S)delete S[j];S.$ref=b};if(e.cycles==="throw")for(const g of e.seen.entries()){const p=g[1];if(p.cycle)throw new Error(`Cycle detected: #/${(d=p.cycle)==null?void 0:d.join("/")}/<root>
366
+
367
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of e.seen.entries()){const p=g[1];if(t===g[0]){o(g);continue}if(e.external){const w=(m=e.external.registry.get(g[0]))==null?void 0:m.id;if(t!==g[0]&&w){o(g);continue}}if((h=e.metadataRegistry.get(g[0]))==null?void 0:h.id){o(g);continue}if(p.cycle){o(g);continue}if(p.count>1&&e.reused==="ref"){o(g);continue}}}function rN(e,t){var c,d,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const g=e.seen.get(h);if(g.ref===null)return;const p=g.def??g.schema,b={...p},w=g.ref;if(g.ref=null,w){a(w);const j=e.seen.get(w),E=j.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(E)):Object.assign(p,E),Object.assign(p,b),h._zod.parent===w)for(const N in p)N==="$ref"||N==="allOf"||N in b||delete p[N];if(E.$ref&&j.def)for(const N in p)N==="$ref"||N==="allOf"||N in j.def&&JSON.stringify(p[N])===JSON.stringify(j.def[N])&&delete p[N]}const S=h._zod.parent;if(S&&S!==w){a(S);const j=e.seen.get(S);if(j!=null&&j.schema.$ref&&(p.$ref=j.schema.$ref,j.def))for(const E in p)E==="$ref"||E==="allOf"||E in j.def&&JSON.stringify(p[E])===JSON.stringify(j.def[E])&&delete p[E]}e.override({zodSchema:h,jsonSchema:p,path:g.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=(d=e.external.registry.get(t))==null?void 0:d.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 g=h[1];g.def&&g.defId&&(o[g.defId]=g.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:Zf(t,"input",e.processors),output:Zf(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 yP=(e,t={})=>n=>{const a=tN({...n,processors:t});return kn(e,a),nN(a,e),rN(a,e)},Zf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=tN({...s??{},target:o,io:t,processors:n});return kn(e,c),nN(c,e),rN(c,e)},vP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:c,format:d,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof c=="number"&&(s.maxLength=c),d&&(s.format=vP[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},xP=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:d,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:g}=e._zod.bag;typeof d=="string"&&d.includes("int")?s.type="integer":s.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=g,s.exclusiveMinimum=!0):s.exclusiveMinimum=g),typeof o=="number"&&(s.minimum=o,typeof g=="number"&&t.target!=="draft-04"&&(g>=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)},wP=(e,t,n,a)=>{n.type="boolean"},SP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},kP=(e,t,n,a)=>{n.not={}},jP=(e,t,n,a)=>{},CP=(e,t,n,a)=>{const s=e._zod.def,o=DE(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},EP=(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},NP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_P=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},TP=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=kn(o.element,t,{...a,path:[...a.path,"items"]})},AP=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const g in c)s.properties[g]=kn(c[g],t,{...a,path:[...a.path,"properties",g]});const d=new Set(Object.keys(c)),m=new Set([...d].filter(g=>{const p=o.shape[g]._zod;return t.io==="input"?p.optin===void 0:p.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)},RP=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((d,m)=>kn(d,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},OP=(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]}),d=h=>"allOf"in h&&Object.keys(h).length===1,m=[...d(o)?o.allOf:[o],...d(c)?c.allOf:[c]];n.allOf=m},zP=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const c=o.keyType,d=c._zod.bag,m=d==null?void 0:d.patterns;if(o.mode==="loose"&&m&&m.size>0){const g=kn(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const p of m)s.patternProperties[p.source]=g}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 g=[...h].filter(p=>typeof p=="string"||typeof p=="number");g.length>0&&(s.required=g)}},DP=(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"}]},MP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},IP=(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))},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,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},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;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},UP=(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},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,n.readOnly=!0},aN=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},FP=de("ZodISODateTime",(e,t)=>{P5.init(e,t),en.init(e,t)});function $P(e){return ZL(FP,e)}const HP=de("ZodISODate",(e,t)=>{U5.init(e,t),en.init(e,t)});function qP(e){return GL(HP,e)}const ZP=de("ZodISOTime",(e,t)=>{B5.init(e,t),en.init(e,t)});function GP(e){return VL(ZP,e)}const VP=de("ZodISODuration",(e,t)=>{F5.init(e,t),en.init(e,t)});function QP(e){return QL(VP,e)}const KP=(e,t)=>{PE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>A4(e,n)},flatten:{value:n=>T4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,_y,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,_y,2)}},isEmpty:{get(){return e.issues.length===0}}})},sa=de("ZodError",KP,{Parent:Error}),YP=Iv(sa),XP=Lv(sa),WP=yh(sa),JP=vh(sa),eU=z4(sa),tU=D4(sa),nU=M4(sa),rU=I4(sa),aU=L4(sa),iU=P4(sa),sU=U4(sa),lU=B4(sa),Xt=de("ZodType",(e,t)=>(Kt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zf(e,"input"),output:Zf(e,"output")}}),e.toJSONSchema=yP(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)=>YP(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>WP(e,n,a),e.parseAsync=async(n,a)=>XP(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>JP(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>eU(e,n,a),e.decode=(n,a)=>tU(e,n,a),e.encodeAsync=async(n,a)=>nU(e,n,a),e.decodeAsync=async(n,a)=>rU(e,n,a),e.safeEncode=(n,a)=>aU(e,n,a),e.safeDecode=(n,a)=>iU(e,n,a),e.safeEncodeAsync=async(n,a)=>sU(e,n,a),e.safeDecodeAsync=async(n,a)=>lU(e,n,a),e.refine=(n,a)=>e.check(t6(n,a)),e.superRefine=n=>e.check(n6(n)),e.overwrite=n=>e.check(_o(n)),e.optional=()=>P1(e),e.exactOptional=()=>$U(e),e.nullable=()=>U1(e),e.nullish=()=>P1(U1(e)),e.nonoptional=n=>QU(e,n),e.array=()=>vt(e),e.or=n=>Bv([e,n]),e.and=n=>LU(e,n),e.transform=n=>Ry(e,lN(n)),e.default=n=>ZU(e,n),e.prefault=n=>VU(e,n),e.catch=n=>YU(e,n),e.pipe=n=>Ry(e,n),e.readonly=()=>JU(e),e.describe=n=>{const a=e.clone();return Qu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Qu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qu.get(e);const a=e.clone();return Qu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),iN=de("_ZodString",(e,t)=>{Pv.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>bP(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(nP(...a)),e.includes=(...a)=>e.check(iP(...a)),e.startsWith=(...a)=>e.check(sP(...a)),e.endsWith=(...a)=>e.check(lP(...a)),e.min=(...a)=>e.check(qf(...a)),e.max=(...a)=>e.check(JE(...a)),e.length=(...a)=>e.check(eN(...a)),e.nonempty=(...a)=>e.check(qf(1,...a)),e.lowercase=a=>e.check(rP(a)),e.uppercase=a=>e.check(aP(a)),e.trim=()=>e.check(uP()),e.normalize=(...a)=>e.check(oP(...a)),e.toLowerCase=()=>e.check(cP()),e.toUpperCase=()=>e.check(dP()),e.slugify=()=>e.check(fP())}),oU=de("ZodString",(e,t)=>{Pv.init(e,t),iN.init(e,t),e.email=n=>e.check(jL(uU,n)),e.url=n=>e.check(TL(cU,n)),e.jwt=n=>e.check(qL(CU,n)),e.emoji=n=>e.check(AL(dU,n)),e.guid=n=>e.check(O1(I1,n)),e.uuid=n=>e.check(CL(gf,n)),e.uuidv4=n=>e.check(EL(gf,n)),e.uuidv6=n=>e.check(NL(gf,n)),e.uuidv7=n=>e.check(_L(gf,n)),e.nanoid=n=>e.check(RL(fU,n)),e.guid=n=>e.check(O1(I1,n)),e.cuid=n=>e.check(OL(hU,n)),e.cuid2=n=>e.check(zL(mU,n)),e.ulid=n=>e.check(DL(pU,n)),e.base64=n=>e.check(FL(SU,n)),e.base64url=n=>e.check($L(kU,n)),e.xid=n=>e.check(ML(gU,n)),e.ksuid=n=>e.check(IL(yU,n)),e.ipv4=n=>e.check(LL(vU,n)),e.ipv6=n=>e.check(PL(bU,n)),e.cidrv4=n=>e.check(UL(xU,n)),e.cidrv6=n=>e.check(BL(wU,n)),e.e164=n=>e.check(HL(jU,n)),e.datetime=n=>e.check($P(n)),e.date=n=>e.check(qP(n)),e.time=n=>e.check(GP(n)),e.duration=n=>e.check(QP(n))});function T(e){return kL(oU,e)}const en=de("ZodStringFormat",(e,t)=>{Yt.init(e,t),iN.init(e,t)}),uU=de("ZodEmail",(e,t)=>{T5.init(e,t),en.init(e,t)}),I1=de("ZodGUID",(e,t)=>{N5.init(e,t),en.init(e,t)}),gf=de("ZodUUID",(e,t)=>{_5.init(e,t),en.init(e,t)}),cU=de("ZodURL",(e,t)=>{A5.init(e,t),en.init(e,t)}),dU=de("ZodEmoji",(e,t)=>{R5.init(e,t),en.init(e,t)}),fU=de("ZodNanoID",(e,t)=>{O5.init(e,t),en.init(e,t)}),hU=de("ZodCUID",(e,t)=>{z5.init(e,t),en.init(e,t)}),mU=de("ZodCUID2",(e,t)=>{D5.init(e,t),en.init(e,t)}),pU=de("ZodULID",(e,t)=>{M5.init(e,t),en.init(e,t)}),gU=de("ZodXID",(e,t)=>{I5.init(e,t),en.init(e,t)}),yU=de("ZodKSUID",(e,t)=>{L5.init(e,t),en.init(e,t)}),vU=de("ZodIPv4",(e,t)=>{$5.init(e,t),en.init(e,t)}),bU=de("ZodIPv6",(e,t)=>{H5.init(e,t),en.init(e,t)}),xU=de("ZodCIDRv4",(e,t)=>{q5.init(e,t),en.init(e,t)}),wU=de("ZodCIDRv6",(e,t)=>{Z5.init(e,t),en.init(e,t)}),SU=de("ZodBase64",(e,t)=>{G5.init(e,t),en.init(e,t)}),kU=de("ZodBase64URL",(e,t)=>{Q5.init(e,t),en.init(e,t)}),jU=de("ZodE164",(e,t)=>{K5.init(e,t),en.init(e,t)}),CU=de("ZodJWT",(e,t)=>{X5.init(e,t),en.init(e,t)}),Uv=de("ZodNumber",(e,t)=>{QE.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>xP(e,a,s),e.gt=(a,s)=>e.check(D1(a,s)),e.gte=(a,s)=>e.check(cg(a,s)),e.min=(a,s)=>e.check(cg(a,s)),e.lt=(a,s)=>e.check(z1(a,s)),e.lte=(a,s)=>e.check(ug(a,s)),e.max=(a,s)=>e.check(ug(a,s)),e.int=a=>e.check(L1(a)),e.safe=a=>e.check(L1(a)),e.positive=a=>e.check(D1(0,a)),e.nonnegative=a=>e.check(cg(0,a)),e.negative=a=>e.check(z1(0,a)),e.nonpositive=a=>e.check(ug(0,a)),e.multipleOf=(a,s)=>e.check(M1(a,s)),e.step=(a,s)=>e.check(M1(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 KL(Uv,e)}const EU=de("ZodNumberFormat",(e,t)=>{W5.init(e,t),Uv.init(e,t)});function L1(e){return XL(EU,e)}const NU=de("ZodBoolean",(e,t)=>{J5.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>wP(e,n,a)});function Wn(e){return WL(NU,e)}const _U=de("ZodNull",(e,t)=>{eL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SP(e,n,a)});function TU(e){return JL(_U,e)}const AU=de("ZodUnknown",(e,t)=>{tL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jP()});function Qt(){return eP(AU)}const RU=de("ZodNever",(e,t)=>{nL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kP(e,n,a)});function OU(e){return tP(RU,e)}const zU=de("ZodArray",(e,t)=>{rL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TP(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(qf(n,a)),e.nonempty=n=>e.check(qf(1,n)),e.max=(n,a)=>e.check(JE(n,a)),e.length=(n,a)=>e.check(eN(n,a)),e.unwrap=()=>e.element});function vt(e,t){return hP(zU,e,t)}const DU=de("ZodObject",(e,t)=>{iL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AP(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:Qt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qt()}),e.strict=()=>e.clone({...e._zod.def,catchall:OU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>j4(e,n),e.safeExtend=n=>C4(e,n),e.merge=n=>E4(e,n),e.pick=n=>S4(e,n),e.omit=n=>k4(e,n),e.partial=(...n)=>N4(oN,e,n[0]),e.required=(...n)=>_4(uN,e,n[0])});function se(e,t){const n={type:"object",shape:e??{},...Ie(t)};return new DU(n)}const sN=de("ZodUnion",(e,t)=>{XE.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RP(e,n,a,s),e.options=t.options});function Bv(e,t){return new sN({type:"union",options:e,...Ie(t)})}const MU=de("ZodDiscriminatedUnion",(e,t)=>{sN.init(e,t),sL.init(e,t)});function Fv(e,t,n){return new MU({type:"union",options:t,discriminator:e,...Ie(n)})}const IU=de("ZodIntersection",(e,t)=>{lL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OP(e,n,a,s)});function LU(e,t){return new IU({type:"intersection",left:e,right:t})}const PU=de("ZodRecord",(e,t)=>{oL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zP(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function ln(e,t,n){return new PU({type:"record",keyType:e,valueType:t,...Ie(n)})}const Ay=de("ZodEnum",(e,t)=>{uL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>CP(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 Ay({...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 Ay({...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 Ay({type:"enum",entries:n,...Ie(t)})}const UU=de("ZodLiteral",(e,t)=>{cL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EP(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 Sn(e,t){return new UU({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const BU=de("ZodTransform",(e,t)=>{dL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_P(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new OE(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(cc(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(cc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function lN(e){return new BU({type:"transform",transform:e})}const oN=de("ZodOptional",(e,t)=>{WE.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>aN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function P1(e){return new oN({type:"optional",innerType:e})}const FU=de("ZodExactOptional",(e,t)=>{fL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>aN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function $U(e){return new FU({type:"optional",innerType:e})}const HU=de("ZodNullable",(e,t)=>{hL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function U1(e){return new HU({type:"nullable",innerType:e})}const qU=de("ZodDefault",(e,t)=>{mL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ZU(e,t){return new qU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():IE(t)}})}const GU=de("ZodPrefault",(e,t)=>{pL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function VU(e,t){return new GU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():IE(t)}})}const uN=de("ZodNonOptional",(e,t)=>{gL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function QU(e,t){return new uN({type:"nonoptional",innerType:e,...Ie(t)})}const KU=de("ZodCatch",(e,t)=>{yL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function YU(e,t){return new KU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const XU=de("ZodPipe",(e,t)=>{vL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UP(e,n,a,s),e.in=t.in,e.out=t.out});function Ry(e,t){return new XU({type:"pipe",in:e,out:t})}const WU=de("ZodReadonly",(e,t)=>{bL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function JU(e){return new WU({type:"readonly",innerType:e})}const e6=de("ZodCustom",(e,t)=>{xL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NP(e,n)});function t6(e,t={}){return mP(e6,e,t)}function n6(e){return pP(e)}function r6(e,t){return Ry(lN(e),t)}const Is={custom:"custom"};function xh(e){return YL(Uv,e)}const a6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function i6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function cN(e,t){const n=i6(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(a6)){const c=o[1];if(!c)continue;const d=a.get(c.toLowerCase());d&&s.add(d)}return[...s]}const s6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,B1="/";function dN(e){return!e||typeof e!="string"||e.length>256||!s6.test(e)?"/":e}const l6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},fN=Ze(["feishu","slack","kael"]),hN=Ze(["active","inactive"]);se({platform:fN,agentId:T().min(1),credentials:ln(T(),Qt()),status:hN.default("active")});se({agentId:T().min(1).optional(),credentials:ln(T(),Qt()).optional(),status:hN.optional()});se({id:Ge(),platform:T(),agentId:T(),hasCredentials:Wn(),status:T(),createdAt:T(),updatedAt:T()});const o6=Ze(["code","reverse_token","oauth","manual"]);se({appId:T().min(1),appSecret:T().min(1)});se({platform:fN,externalUserId:T().min(1),agentId:T().min(1),boundVia:o6.default("manual"),displayName:T().max(200).optional()});se({id:Ge(),platform:T(),externalUserId:T(),agentId:T(),boundVia:T().nullable(),displayName:T().nullable(),createdAt:T()});se({feishuUserId:T().min(1),displayName:T().max(200).optional()});se({configId:Ge(),platform:T(),agentId:T(),appId:T(),connected:Wn(),lastActiveAt:T().nullable()});const u6=32e3,$v=/^[a-z0-9][a-z0-9_-]{0,63}$/i,c6=/^[A-Z][A-Z0-9_]*$/,mN=se({append:T().max(u6).default("")}),d6=se({name:T().regex($v,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("stdio"),command:T().min(1),args:vt(T()).optional()}),f6=se({name:T().regex($v,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("http"),url:T().url(),headers:ln(T(),T()).optional()}),h6=se({name:T().regex($v,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("sse"),url:T().url(),headers:ln(T(),T()).optional()}),pN=Fv("transport",[d6,f6,h6]),gN=se({key:T().regex(c6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:T(),sensitive:Wn().default(!1)}),Hv=se({url:T().min(1),ref:T().min(1).optional(),localPath:T().min(1).optional()}),yN=se({prompt:mN.default({append:""}),model:T().default("opus"),mcpServers:vt(pN).default([]),env:vt(gN).default([]),gitRepos:vt(Hv).default([])}),m6=yN.extend({kind:Sn("claude-code")}),p6=yN.extend({kind:Sn("codex")}),g6=Fv("kind",[m6,p6]),y6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const d=o.name.toLowerCase();n.has(d)&&t.addIssue({code:Is.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(d)});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 d=o.localPath??Vf(o.url);d&&(s.has(d)&&t.addIssue({code:Is.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${d}"`}),s.add(d))})},vN=r6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,g6).superRefine((e,t)=>{y6(e,t)}),v6=se({agentId:T(),version:Ge().int().positive(),payload:vN,updatedAt:T(),updatedBy:T()}),bN=se({prompt:mN,model:T(),mcpServers:vt(pN),env:vt(gN),gitRepos:vt(Hv)}).partial();se({expectedVersion:Ge().int().positive(),payload:bN});se({payload:bN});se({current:v6,next:vN,diff:vt(se({path:T(),op:Ze(["add","remove","replace"]),before:Qt().optional(),after:Qt().optional()}))});const Gf="***";function Vf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const xN=Ze(["online","offline"]),wN=Ze(["idle","working","blocked","error"]);Ze(["active","suspended","evicted"]);const b6=Ze(["active","suspended"]);se({chatId:T().min(1),state:b6});se({runtimeState:wN});se({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"]);se({agentId:T(),status:xN,connectedAt:T().nullable(),lastSeenAt:T(),clientId:T().nullable().optional(),runtimeType:T().nullable().optional(),runtimeVersion:T().nullable().optional(),runtimeState:wN.nullable().optional(),activeSessions:Ge().int().nullable().optional(),totalSessions:Ge().int().nullable().optional(),runtimeUpdatedAt:T().nullable().optional()});se({total:Ge().int(),running:Ge().int(),byState:se({idle:Ge().int(),working:Ge().int(),blocked:Ge().int(),error:Ge().int()}),clients:Ge().int()});const Qf={CLAUDE_CODE:"claude-code",CODEX:"codex"},wh=Ze(["claude-code","codex"]),Sh=Ze(["human","personal_assistant","autonomous_agent"]),F1={PRIVATE:"private",ORGANIZATION:"organization"},qv=Ze(["private","organization"]),x6=Ze(["admin-api","portal"]);Ze(["active","suspended"]);const Oy=/^[a-z0-9][a-z0-9_-]{0,63}$/,Wl=64,w6=["admin","agent","first-tree","hub","me","null","system","undefined"],S6=new Set(w6);function zy(e){return S6.has(e)}se({name:T().min(1).max(64).regex(Oy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!zy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Sh,displayName:T().min(1).max(200).optional(),delegateMention:T().max(100).optional(),organizationId:T().min(1).max(100).optional(),source:x6.optional(),visibility:qv.optional(),metadata:ln(T(),Qt()).optional(),managerId:T().optional(),clientId:T().min(1).max(100).optional(),runtimeProvider:wh.optional(),gitRepos:vt(Hv).optional()});se({type:Sh.optional(),displayName:T().min(1).max(200).optional(),delegateMention:T().max(100).nullable().optional(),visibility:qv.optional(),metadata:ln(T(),Qt()).optional(),managerId:T().nullable().optional(),clientId:T().min(1).max(100).nullable().optional()});se({clientId:T().min(1).max(100),runtimeProvider:wh,force:Wn().optional()});se({uuid:T(),name:T().nullable(),organizationId:T(),type:Sh,displayName:T(),delegateMention:T().nullable(),inboxId:T(),status:T(),source:T().nullable().optional(),visibility:qv,metadata:ln(T(),Qt()),managerId:T().nullable(),clientId:T().nullable(),runtimeProvider:wh,presenceStatus:xN.optional(),createdAt:T(),updatedAt:T()});se({repo:T().nullable(),branch:T().nullable()});se({type:Sn("agent:pinned"),agentId:T(),name:T().nullable(),displayName:T(),agentType:Sh,runtimeProvider:wh});se({username:T().min(1),password:T().min(1)});se({accessToken:T(),refreshToken:T()});se({refreshToken:T().min(1)});se({token:T().min(1)});se({token:T(),expiresIn:Ge(),command:T()});const k6=Ze(["direct","group","thread"]);se({type:k6,topic:T().max(500).optional(),participantIds:vt(T()).min(1),metadata:ln(T(),Qt()).optional()});const SN=se({agentId:T(),role:T(),mode:T(),joinedAt:T()});SN.extend({name:T().nullable(),displayName:T(),type:T()});const j6=se({id:T(),organizationId:T(),type:T(),topic:T().nullable(),lifecyclePolicy:T().nullable().optional(),metadata:ln(T(),Qt()),createdAt:T(),updatedAt:T()});j6.extend({participants:vt(SN),title:T(),firstMessagePreview:T().nullable()});se({topic:T().trim().max(500).nullable()});se({agentId:T().min(1),mode:Ze(["full","mention_only"]).default("full")});se({agentId:T().min(1)});const C6=Ze(["connected","disconnected"]),E6=Ze(["ok","expired"]);se({id:T(),userId:T().nullable(),status:C6,authState:E6,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:ln(T(),Qt()).nullable()});const N6=se({wsInboxDeliver:Wn().default(!1)}).partial();se({clientId:T().min(1).max(100),hostname:T().max(100).optional(),os:T().max(50).optional(),sdkVersion:T().max(50).optional(),wireCapabilities:N6.optional()});se({clientId:T(),previousUserId:T().nullable(),unpinnedAgentCount:Ge().int().nonnegative()});const _6=Ze(["ok","missing","unauthenticated","error"]),T6=Ze(["api_key","oauth","auth_json","none"]),A6=se({state:_6,available:Wn(),authenticated:Wn(),sdkVersion:T().nullable().optional(),authMethod:T6,error:T().nullable().optional(),detectedAt:T()}),R6=ln(T(),A6);se({capabilities:R6});se({limit:xh().int().min(1).max(100).default(20),cursor:T().optional()});const O6=Ze(["active","stale","unavailable"]),z6=Ze(["ok","warning","error"]),D6=se({label:T(),detail:T().nullable(),severity:z6}),M6=Ze(["root","domain","subdomain","leaf"]),Zv=Ze(["added","edited","removed"]),I6=Ze(["parent","soft_link","markdown_link"]),L6=Ze(["low","medium","high"]),P6=se({id:T(),path:T(),sourcePath:T().nullable(),title:T(),kind:M6,owners:vt(T()),parentId:T().nullable(),preview:T().nullable(),relatedNodeIds:vt(T()),affectedContextArea:T(),changeType:Zv.nullable(),changedAtCommit:T().nullable()}),U6=se({source:T(),target:T(),kind:I6}),B6=se({path:T(),nodeId:T().nullable(),type:Zv,commit:T().nullable(),changedAt:T().nullable(),changedBy:T().nullable(),summary:T().nullable()}),F6=se({id:T(),nodeId:T().nullable(),path:T(),title:T(),changeType:Zv,affectedContextArea:T(),reason:T(),summary:T(),changedBy:T().nullable(),owners:vt(T()),relatedNodeIds:vt(T()),sourceCommit:T().nullable(),riskLevel:L6}),$6=se({addedCount:Ge().int().nonnegative(),editedCount:Ge().int().nonnegative(),removedCount:Ge().int().nonnegative(),changedNodeCount:Ge().int().nonnegative()});se({repo:T().nullable(),branch:T().nullable(),headCommit:T().nullable(),syncedAt:T().nullable(),snapshotStatus:O6,contextStatus:D6,summary:$6,updates:vt(F6),nodes:vt(P6),edges:vt(U6),changes:vt(B6)});const H6=["image/png","image/jpeg","image/gif","image/webp"],Gv=Ze(H6);se({data:T().min(1),mimeType:Gv,filename:T().min(1),size:Ge().int().nonnegative().optional(),imageId:T().uuid().optional()});se({imageId:T().uuid(),mimeType:Gv,filename:T().min(1),size:Ge().int().nonnegative().optional()});se({type:Sn("image_payload"),imageId:T().uuid(),chatId:T(),base64:T().min(1),mimeType:Gv,filename:T().min(1),size:Ge().int().nonnegative().optional()});const Vv=Ze(["hub_ui","cli","feishu","github","api"]),kN=Ze(["text","markdown","card","reference","file","question","question_answer"]);se({format:kN.default("text"),content:Qt(),metadata:ln(T(),Qt()).optional(),inReplyTo:T().optional(),replyToInbox:T().optional(),replyToChat:T().optional(),source:Vv.optional()});se({format:kN.default("text"),content:Qt(),metadata:ln(T(),Qt()).optional(),replyToInbox:T().optional(),replyToChat:T().optional(),source:Vv.optional()});const q6=se({id:T(),chatId:T(),senderId:T(),format:T(),content:Qt(),metadata:ln(T(),Qt()),replyToInbox:T().nullable(),replyToChat:T().nullable(),inReplyTo:T().nullable(),source:Vv.nullable(),createdAt:T()}),Z6=se({senderId:T(),chatId:T(),replyToChat:T().nullable()}).nullable(),G6=Ze(["full","mention_only"]),V6=se({id:T(),senderId:T(),format:T(),content:Qt(),metadata:ln(T(),Qt()).default({}),createdAt:T()}),jN=q6.extend({configVersion:Ge().int().positive(),recipientMode:G6.default("full"),inReplyToSnapshot:Z6.default(null),precedingMessages:vt(V6).default([])});Ze(["pending","delivered","acked","failed"]);const Q6=se({id:Ge(),inboxId:T(),messageId:T(),chatId:T().nullable(),status:T(),retryCount:Ge(),createdAt:T(),deliveredAt:T().nullable(),ackedAt:T().nullable()});Q6.extend({message:jN});se({limit:xh().int().min(1).max(50).default(10)});se({type:Sn("inbox:deliver"),entryId:Ge().int().nonnegative(),inboxId:T().min(1),chatId:T().nullable(),message:jN}).passthrough();se({type:Sn("inbox:ack"),entryId:Ge().int().nonnegative()});const K6=7;se({organizationId:T(),organizationName:T(),organizationDisplayName:T(),role:T(),expiresAt:T().nullable()});se({id:T(),organizationId:T(),token:T(),inviteUrl:T(),role:T(),createdAt:T(),expiresAt:T().nullable()});se({token:T().min(1)});se({}).optional();const Y6=["all","unread","watching"],X6=Ze(Y6),CN=Ze(["participant","watching"]);se({cursor:T().optional(),limit:xh().int().min(1).max(200).default(50),filter:X6.default("all")});const W6=se({agentId:T(),displayName:T(),type:T()}),J6=se({chatId:T(),type:T(),membershipKind:CN,title:T(),topic:T().nullable(),participants:vt(W6),participantCount:Ge().int(),lastMessageAt:T().nullable(),lastMessagePreview:T().nullable(),unreadMentionCount:Ge().int(),canReply:Wn()});se({rows:vt(J6),nextCursor:T().nullable()});se({participantIds:vt(T().min(1)).min(1),topic:T().trim().max(500).optional().nullable()});se({participantIds:vt(T().min(1)).min(1)});se({chatId:T(),lastReadAt:T(),unreadMentionCount:Ge().int()});se({chatId:T(),membershipKind:CN.nullable()});se({type:Sn("chat:message"),chatId:T()});Ze(["connect","create_agent","completed"]);se({id:T(),name:T(),displayName:T(),role:Ze(["admin","member"])});se({name:T().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:T().min(1).max(200)});se({dismissed:Wn().optional()});const eB=Ze(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);se({event:eB,attrs:ln(T(),Bv([T(),Ge(),Wn(),TU()])).optional()});se({id:T(),organizationId:T(),organizationName:T(),role:Ze(["admin","member"]),agentId:T()});const tB={ADMIN:"admin",MEMBER:"member"},Qv=Ze(["admin","member"]),nB=se({id:T(),userId:T(),organizationId:T(),agentId:T(),role:Qv,createdAt:T()});se({username:T().min(1).max(100),displayName:T().min(1).max(200),role:Qv.default("member")});se({role:Qv.optional(),displayName:T().min(1).max(200).optional()});nB.extend({username:T(),displayName:T(),password:T()});const rB=Ze(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),EN=Ze(["high","medium","low"]);se({id:T(),organizationId:T(),type:rB,severity:EN,agentId:T().nullable(),chatId:T().nullable(),message:T(),read:Wn(),createdAt:T()});se({limit:xh().int().min(1).max(100).default(20),cursor:T().optional(),severity:EN.optional(),read:Ze(["true","false"]).transform(e=>e==="true").optional(),agentId:T().optional()});se({next:T().max(256).optional()});se({code:T().min(1),state:T().min(1)});se({githubId:T().min(1),login:T().min(1),email:T().email().optional(),displayName:T().optional(),next:T().max(256).optional()});const aB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function iB(e){return e.includes("://")?!1:aB.test(e)}const kh=T().min(1).superRefine((e,t)=>{if(iB(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}}),sB=se({repo:kh.optional(),branch:T().default("main")}),lB=se({repo:kh.nullish(),branch:T().min(1).nullish()}),oB=se({repo:T().optional(),branch:T().optional()}),uB=se({webhookSecretCipher:T().optional()}),cB=se({webhookSecret:T().min(1).nullish()}),dB=se({webhookSecretConfigured:Wn(),webhookUrl:T()}),fB=se({repos:vt(se({url:kh,defaultBranch:T().optional()})).default([])}),hB=se({repos:vt(se({url:kh,defaultBranch:T().min(1).optional()})).optional()}),mB=se({repos:vt(se({url:T(),defaultBranch:T().optional()}))}),pB={context_tree:{storage:sB,input:lB,output:oB,readPolicy:"member"},github_integration:{storage:uB,input:cB,output:dB,readPolicy:"admin"},source_repos:{storage:fB,input:hB,output:mB,readPolicy:"member"}},gB=Object.keys(pB);Ze(gB);const NN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;se({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=>!NN.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:ln(T(),Qt()).default({})});se({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=>!NN.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:ln(T(),Qt()).optional()});se({id:T(),name:T(),displayName:T(),maxAgents:Ge(),maxMessagesPerMinute:Ge(),features:ln(T(),Qt()),createdAt:T(),updatedAt:T()});const yB=se({workingCount:Ge().int().nonnegative(),errorMask:Wn()}),vB=se({type:Sn("pulse:tick"),organizationId:T(),agents:ln(T(),vt(yB).length(32))}),bB=se({label:T().min(1),description:T(),preview:T().nullable().optional()}),xB=se({question:T().min(1),header:T().min(1).max(24),options:vt(bB).min(2).max(4),multiSelect:Wn()}),wB=Ze(["html","markdown"]).nullable(),SB=se({correlationId:T().min(1),questions:vt(xB).min(1).max(4),previewFormat:wB,allowFreeText:Wn()}),kB=se({correlationId:T().min(1),answers:ln(T().min(1),T())});se({answers:ln(T().min(1),T())});Ze(["pending","answered","superseded"]);const jB=Ze(["tool_call","error","assistant_text","thinking","turn_end"]),_N=se({toolUseId:T(),name:T(),args:Qt(),status:Ze(["pending","ok","error"]),durationMs:Ge().int().nonnegative().optional(),resultPreview:T().max(400).optional()}),TN=se({source:Ze(["sdk","runtime","tool"]),message:T().max(2e3)}),AN=se({text:T().max(8e3)}),RN=se({}),ON=se({status:Ze(["success","error"])}),CB=Fv("kind",[se({kind:Sn("tool_call"),payload:_N}),se({kind:Sn("error"),payload:TN}),se({kind:Sn("assistant_text"),payload:AN}),se({kind:Sn("thinking"),payload:RN}),se({kind:Sn("turn_end"),payload:ON})]);se({id:T(),agentId:T(),chatId:T(),seq:Ge().int().positive(),kind:jB,payload:Bv([_N,TN,AN,RN,ON]),createdAt:T()});se({agentId:T(),chatId:T(),event:CB});se({agentId:T(),chatId:T()});se({type:Sn("session:reconcile"),agentId:T().min(1),chatIds:vt(T().min(1)).max(500)});se({type:Sn("session:reconcile:result"),agentId:T().min(1),staleChatIds:vt(T().min(1))});const EB=se({organizationId:T(),agentCount:Ge(),chatCount:Ge(),messageCount:Ge()});se({totalAgents:Ge(),totalChats:Ge(),totalMessages:Ge(),byOrganization:vt(EB)});const NB=Ze(["active","suspended"]);se({id:T(),username:T(),displayName:T(),avatarUrl:T().nullable(),status:NB,createdAt:T(),updatedAt:T()});se({username:T().min(1).max(100),displayName:T().min(1).max(200),password:T().min(8).max(200)});se({displayName:T().min(1).max(200).optional(),password:T().min(8).max(200).optional()});se({type:Sn("auth"),token:T().min(1)});const _B=se({wsInboxDeliver:Wn().default(!1)}).partial();se({type:Sn("server:welcome"),serverCommandVersion:T().min(1),serverTimeMs:Ge().int().nonnegative(),capabilities:_B.optional()}).passthrough();const zN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function TB(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 AB=2e3,RB=3e4;let Gi=null,dc=!1,Kf=0,Yu=null;const Dy=new Set;let Zi=null,Ls=0;function OB(e){for(const t of Dy)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 Kv(){const e=lh();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);OB(c)}catch{}},s.onopen=()=>{s===Gi&&(Kf=0)},s.onclose=o=>{if(s===Gi&&(Gi=null,!(dc||Ls===0))){if(o.code===4001){JO().then(c=>{dc||Ls===0||(c?(Kf=0,Kv()):$1())});return}$1()}}}function $1(){Kf++;const e=Math.min(AB*2**(Kf-1),RB);Yu=setTimeout(()=>{Yu=null,!dc&&Ls>0&&Kv()},e)}function zB(){dc=!0,Yu&&(clearTimeout(Yu),Yu=null),Gi&&(Gi.close(1e3,"unmount"),Gi=null)}function DN(e){const{onMessage:t,enabled:n=!0}=e??{},a=mn(),s=x.useRef(t);s.current=t,x.useEffect(()=>{Zi=a},[a]),x.useEffect(()=>{if(!n)return;const o=c=>{var d;return(d=s.current)==null?void 0:d.call(s,c)};return Dy.add(o),Ls++,Ls===1&&(dc=!1,Kv()),()=>{Dy.delete(o),Ls--,Ls===0&&zB()}},[n])}const DB=x.createContext({aggregated:zN,agents:{},receivedAtMs:null,stale:!0});function MB({children:e}){const[t,n]=x.useState({aggregated:zN,agents:{},receivedAtMs:null}),[a,s]=x.useState(()=>Date.now());DN({onMessage:c=>{const d=vB.safeParse(c);d.success&&n({aggregated:TB(d.data.agents),agents:d.data.agents,receivedAtMs:Date.now()})}}),x.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=x.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(DB.Provider,{value:o,children:e})}function jh(e){return Ee.get(`/agents/${e}/config`)}function Ch(e,t){return Ee.patch(`/agents/${e}/config`,t)}function IB(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function LB(e){return Ee.get(`/agents/${e}/client-status`)}function PB({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 UB({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 BB(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function FB({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const $B={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=$B[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 My({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 Yv({className:e,style:t,...n}){return l.jsx("span",{className:ze("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Xu({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 HB(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function fc({state:e,className:t}){const n=e!==null&&HB(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(Xu,{state:n,size:7}),n]})}function yf({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 qB({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 ZB(e){const{agent:t}=e,[n,a]=x.useState(!1),[s,o]=x.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(dg,{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(dg,{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(dg,{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(Uf,{className:"h-3 w-3"}),"Delete"]})})]}),l.jsx(GB,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(VB,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function dg(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 GB({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(Mn,{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 VB({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=x.useState("");function d(m){m.preventDefault(),o===n&&a()}return l.jsx(Mn,{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:d,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 QB="Label",MN=x.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())}}));MN.displayName=QB;var KB=MN;const xt=x.forwardRef(({className:e,...t},n)=>l.jsx(KB,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));xt.displayName="Label";const jn=x.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=x.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=x.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=x.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 YB={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 Xv({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=YB[e],d=e==="deleted";return l.jsxs("div",{className:ze("flex items-center gap-2 rounded border px-3 py-2 text-body",d?"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&&(d?l.jsxs(ve,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(p3,{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(Sv,{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(Uf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function XB(e){const[t,n]=x.useState(null),[a,s]=x.useState(()=>new Set),o=d=>s(m=>{const h=new Set(m);return h.has(d)?h.delete(d):h.add(d),h}),c=e.items.filter(d=>d.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(d=>{const m=d.value.sensitive,h=d.value.value===Gf,g=m&&!h&&!!d.value.value,p=a.has(d.key);let b;return m?g&&p?b=d.value.value:b="••••••":b=d.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(Xv,{status:d.status,onEdit:()=>n({mode:"edit",key:d.key,initial:d.value}),onDelete:()=>e.onDelete(d.key),onUndo:()=>e.onUndoDelete(d.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:d.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:b}),m&&l.jsx(xv,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&l.jsx("button",{type:"button",onClick:()=>g&&o(d.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?p?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":p?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:p?l.jsx(Fz,{className:"h-3.5 w-3.5"}):l.jsx(uC,{className:"h-3.5 w-3.5"})})]},d.key)})}),t&&l.jsx(WB,{open:!!t,onOpenChange:d=>!d&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:d=>{t.mode==="edit"?e.onUpdate(t.key,d):e.onAdd(d),n(null)}})]})}function WB({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.key)??""),[d,m]=x.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,g]=x.useState((n==null?void 0:n.sensitive)??!1),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),g((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function w(S){if(S.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){b(`Another entry already uses key "${o}".`);return}let j=d;if(h&&(n!=null&&n.sensitive)&&!d&&(j=Gf),!h&&!n&&!d){b("Value is required for non-sensitive entries.");return}s({key:o,value:j,sensitive:h})}return l.jsx(Mn,{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:d,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=>g(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."}),p&&l.jsx("p",{className:"text-body text-destructive",children:p}),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 JB(e){const[t,n]=x.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??Vf(s.value.url);return l.jsxs(Xv,{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(e9,{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 e9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.url)??""),[d,m]=x.useState((n==null?void 0:n.ref)??""),[h,g]=x.useState((n==null?void 0:n.localPath)??""),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),g((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function w(S){S.preventDefault();const j=o.trim();if(!j){b("URL is required.");return}const E=h.trim()||Vf(j);if(E&&a.has(E)){b(`Another repo already occupies local path "${E}".`);return}const C={url:j,...d.trim()?{ref:d.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(Mn,{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:d,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=>g(S.target.value),placeholder:Vf(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."})]}),p&&l.jsx("p",{className:"text-body text-destructive",children:p}),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 t9({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:c,title:d}){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:d,children:s});const g=d??(m&&h?`${t} (@${e})`:h?t:`@${e}`),p=a==="accent"?"var(--accent-dim)":void 0,b=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:g??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:p},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]}):l.jsxs("span",{className:ze("inline-flex items-baseline gap-1.5",o),style:c,title:g??void 0,children:[h&&l.jsx("span",{style:{color:p},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]})}function IN(){return Ee.get(Tn("/members"))}function n9(e,t){return Ee.patch(Tn(`/members/${encodeURIComponent(e)}`),t)}function r9(e){return Ee.delete(Tn(`/members/${encodeURIComponent(e)}`))}function LN(){const{data:e}=Ye({queryKey:["members","name-map"],queryFn:IN,staleTime:3e4});return x.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 a9({agent:e,onSave:t}){const[n,a]=x.useState(!1),s=Ov(),o=LN(),c=e.metadata,d=c==null?void 0:c.tree,m=typeof(d==null?void 0:d.role)=="string"?d.role:null,h=Array.isArray(d==null?void 0:d.domains)?(d==null?void 0:d.domains).filter(b=>typeof b=="string"):[],g=e.managerId?o(e.managerId):null,p=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(Sv,{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]}),p&&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(t9,{name:p.name,displayName:p.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:g??"—"})]}),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(b=>l.jsx(ya,{tone:"outline",children:b},b))})]})]})]}),l.jsx(i9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function i9({agent:e,open:t,onOpenChange:n,onSave:a}){var z;const{memberId:s,role:o}=gt(),[c,d]=x.useState(e.displayName),[m,h]=x.useState(e.delegateMention??""),[g,p]=x.useState(e.visibility),[b,w]=x.useState(!1),[S,j]=x.useState(null);x.useEffect(()=>{t&&(d(e.displayName),h(e.delegateMention??""),p(e.visibility),j(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(),j(null);const R=c.trim();if(!R){j("Display name is required.");return}w(!0);try{const F={displayName:R,delegateMention:m||null};g!==e.visibility&&(F.visibility=g),await a(F),n(!1)}catch(F){j(F instanceof Error?F.message:String(F))}finally{w(!1)}}return l.jsx(Mn,{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=>d(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:g,onChange:L=>p(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:b,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function s9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function l9(e){const[t,n]=x.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(Xv,{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:s9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:o9(s.value)})]},s.key)})}),t&&l.jsx(u9,{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 o9(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 u9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.transport)??"stdio"),[d,m]=x.useState((n==null?void 0:n.name)??""),[h,g]=x.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[p,b]=x.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,S]=x.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,E]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),g((n==null?void 0:n.transport)==="stdio"?n.command:""),b((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(),!d.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(d.toLowerCase())){E(`Another MCP server is already named "${d}".`);return}let O;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const z=p.trim().split(/\s+/).filter(L=>L.length>0);O={name:d,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:d,transport:o,url:z}}s(O)}return l.jsx(Mn,{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:d,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=>g(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:p,onChange:N=>b(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"})]}),j&&l.jsx("p",{className:"text-body text-destructive",children:j}),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 c9=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],d9=[{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"}],f9={"claude-code":c9,codex:d9},h9={"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."},m9={value:"",label:"(unset — inherits local)"};function p9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,d=f9[o],m=x.useMemo(()=>{const h=[m9,...d];return e!==""&&!d.some(g=>g.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[d,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(g9,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:h9[o]})]})]})}function g9({items:e,value:t,onChange:n,disabled:a}){const[s,o]=x.useState(!1),[c,d]=x.useState(null),m=x.useRef(null),h=x.useRef(null),g=e.find(b=>b.value===t)??e[0],p=x.useCallback(()=>{const b=m.current;if(!b)return;const w=b.getBoundingClientRect();d({top:w.bottom+4,left:w.left,width:w.width})},[]);return x.useLayoutEffect(()=>{s&&p()},[s,p]),x.useEffect(()=>{if(!s)return;const b=j=>{var C,N;const E=j.target;(C=m.current)!=null&&C.contains(E)||(N=h.current)!=null&&N.contains(E)||o(!1)},w=j=>{var E;j.key==="Escape"&&(o(!1),(E=m.current)==null||E.focus())},S=()=>p();return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,p]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(b=>!b),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:(g==null?void 0:g.value)===""?"var(--fg-3)":void 0},children:(g==null?void 0:g.label)??t}),l.jsx(bv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Cv.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(b=>{const w=b.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(b.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:b.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:b.label}),b.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:b.hint})]},b.value||"__unset")})}),document.body)]})}function y9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const v9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,x9={};function H1(e,t){return(x9.jsx?b9:v9).test(e)}const w9=/[ \t\n\f\r]/g;function S9(e){return typeof e=="object"?e.type==="text"?q1(e.value):!1:q1(e)}function q1(e){return e.replace(w9,"")===""}class Lc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Lc.prototype.normal={};Lc.prototype.property={};Lc.prototype.space=void 0;function PN(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Lc(n,a,t)}function Iy(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 k9=0;const Je=nl(),wn=nl(),Ly=nl(),be=nl(),Pt=nl(),no=nl(),Ir=nl();function nl(){return 2**++k9}const Py=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:wn,commaOrSpaceSeparated:Ir,commaSeparated:no,number:be,overloadedBoolean:Ly,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),fg=Object.keys(Py);class Wv extends Nr{constructor(t,n,a,s){let o=-1;if(super(t,n),Z1(this,"space",s),typeof a=="number")for(;++o<fg.length;){const c=fg[o];Z1(this,fg[o],(a&Py[c])===Py[c])}}}Wv.prototype.defined=!0;function Z1(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 Wv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Iy(a)]=a,n[Iy(o.attribute)]=a}return new Lc(t,n,e.space)}const UN=To({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Pt,ariaCurrent:null,ariaDescribedBy:Pt,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Pt,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Pt,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pt,ariaLevel:be,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Pt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Pt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:wn,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 BN(e,t){return t in e?e[t]:t}function FN(e,t){return BN(e,t.toLowerCase())}const j9=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:wn,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:Ly,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Pt,height:be,hidden:Ly,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:wn,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:wn,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:wn,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:FN}),C9=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:BN}),$N=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()}}),HN=To({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:FN}),qN=To({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),E9={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"},N9=/[A-Z]/g,G1=/-[a-z]/g,_9=/^data[-\w.:]+$/i;function T9(e,t){const n=Iy(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"&&_9.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(G1,R9);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!G1.test(o)){let c=o.replace(N9,A9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=Wv}return new s(a,t)}function A9(e){return"-"+e.toLowerCase()}function R9(e){return e.charAt(1).toUpperCase()}const O9=PN([UN,j9,$N,HN,qN],"html"),Jv=PN([UN,C9,$N,HN,qN],"svg");function z9(e){return e.join(" ").trim()}var $l={},hg,V1;function D9(){if(V1)return hg;V1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
368
+ `,h="/",g="*",p="",b="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 F(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 M(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)||g!=E.charAt(1))){for(var X=2;p!=E.charAt(X)&&(g!=E.charAt(X)||h!=E.charAt(X+1));)++X;if(X+=2,p===E.charAt(X-1))return F("End of comment missing");var q=E.slice(2,X-2);return O+=2,z(q),E=E.slice(X),O+=2,J({type:b,comment:q})}}function ae(){var J=L(),X=U(a);if(X){if(Y(),!U(s))return F("property missing ':'");var q=U(o),te=J({type:w,property:j(X[0].replace(e,p)),value:q?j(q[0].replace(e,p)):p});return U(c),te}}function xe(){var J=[];M(J);for(var X;X=ae();)X!==!1&&(J.push(X),M(J));return J}return V(),xe()}function j(E){return E?E.replace(d,p):p}return hg=S,hg}var Q1;function M9(){if(Q1)return $l;Q1=1;var e=$l&&$l.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty($l,"__esModule",{value:!0}),$l.default=n;const t=e(D9());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),d=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;d?s(h,g,m):g&&(o=o||{},o[h]=g)}),o}return $l}var Iu={},K1;function I9(){if(K1)return Iu;K1=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,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(a,d),h.replace(t,c))};return Iu.camelCase=m,Iu}var Lu,Y1;function L9(){if(Y1)return Lu;Y1=1;var e=Lu&&Lu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(M9()),n=I9();function a(s,o){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(d,m){d&&m&&(c[(0,n.camelCase)(d,o)]=m)}),c}return a.default=a,Lu=a,Lu}var P9=L9();const U9=nh(P9),ZN=GN("end"),eb=GN("start");function GN(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 B9(e){const t=eb(e),n=ZN(e);if(t&&n)return{start:t,end:n}}function Wu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X1(e.position):"start"in e||"end"in e?X1(e):"line"in e||"column"in e?Uy(e):""}function Uy(e){return W1(e&&e.line)+":"+W1(e&&e.column)}function X1(e){return Uy(e&&e.start)+"-"+Uy(e&&e.end)}function W1(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 d=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=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Wu(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 tb={}.hasOwnProperty,F9=new Map,$9=/[A-Z]/g,H9=new Set(["table","tbody","thead","tfoot","tr"]),q9=new Set(["td","th"]),VN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z9(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=J9(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=W9(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"?Jv:O9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=QN(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function QN(e,t,n){if(t.type==="element")return G9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return V9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return K9(e,t,n);if(t.type==="mdxjsEsm")return Q9(e,t);if(t.type==="root")return Y9(e,t,n);if(t.type==="text")return X9(e,t)}function G9(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=Jv,e.schema=s),e.ancestors.push(t);const o=YN(e,t.tagName,!1),c=eF(e,t);let d=rb(e,t);return H9.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!S9(m):!0})),KN(e,c,o,t),nb(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function V9(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)}hc(e,t.position)}function Q9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);hc(e,t.position)}function K9(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=Jv,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:YN(e,t.name,!0),c=tF(e,t),d=rb(e,t);return KN(e,c,o,t),nb(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function Y9(e,t,n){const a={};return nb(a,rb(e,t)),e.create(t,e.Fragment,a,n)}function X9(e,t){return t.value}function KN(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function nb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function W9(e,t,n){return a;function a(s,o,c,d){const h=Array.isArray(c.children)?n:t;return d?h(o,c,d):h(o,c)}}function J9(e,t){return n;function n(a,s,o,c){const d=Array.isArray(o.children),m=eb(a);return t(s,o,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function eF(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&tb.call(t.properties,s)){const o=nF(e,s,t.properties[s]);if(o){const[c,d]=o;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&q9.has(t.tagName)?a=d:n[c]=d}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function tF(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 d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else hc(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 d=a.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else hc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function rb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:F9;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 d=QN(e,o,c);d!==void 0&&n.push(d)}return n}function nF(e,t,n){const a=T9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?y9(n):z9(n)),a.property==="style"){let s=typeof n=="object"?n:rF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=aF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?E9[a.property]||a.property:a.attribute,n]}}function rF(e,t){try{return U9(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=VN+"#cannot-parse-style-attribute",s}}function YN(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 d=H1(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(o&&d.type==="Literal"),optional:!1}:d}a=c}else a=H1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return tb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);hc(e)}function hc(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=VN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function aF(e){const t={};let n;for(n in e)tb.call(e,n)&&(t[iF(n)]=e[n]);return t}function iF(e){let t=e.replace($9,sF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function sF(e){return"-"+e.toLowerCase()}const mg={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"]},lF={};function ab(e,t){const n=lF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return XN(e,a,s)}function XN(e,t,n){if(oF(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 J1(e.children,t,n)}return Array.isArray(e)?J1(e,t,n):""}function J1(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=XN(e[s],t,n);return a.join("")}function oF(e){return!!(e&&typeof e=="object")}const ek=document.createElement("i");function ib(e){const t="&"+e+";";ek.innerHTML=t;const n=ek.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 tk={}.hasOwnProperty;function WN(e){const t={};let n=-1;for(;++n<e.length;)uF(t,e[n]);return t}function uF(e,t){let n;for(n in t){const s=(tk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){tk.call(s,c)||(s[c]=[]);const d=o[c];cF(s[c],Array.isArray(d)?d:d?[d]:[])}}}function cF(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 JN(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]/),dF=ps(/[#-'*+\--9=?A-Z^-~]/);function Yf(e){return e!==null&&(e<32||e===127)}const By=ps(/\d/),fF=ps(/[\dA-Fa-f]/),hF=ps(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function st(e){return e===-2||e===-1||e===32}const Eh=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 d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(c=String.fromCharCode(o,d),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 st(m)?(e.enter(n),d(m)):t(m)}function d(m){return st(m)&&o++<s?(e.consume(m),d):(e.exit(n),t(m))}}const mF={tokenize:pF};function pF(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),yt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),o(d)}function o(d){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return $e(d)?(e.consume(d),e.exit("chunkText"),o):(e.consume(d),c)}}const gF={tokenize:yF},nk={tokenize:vF};function yF(e){const t=this,n=[];let a=0,s,o,c;return d;function d(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 F=z;for(;F<t.events.length;)t.events[F][1].end={...R},F++;return Ur(t.events,L+1,0,t.events.slice(z)),t.events.length=F,h(O)}return d(O)}function h(O){if(a===n.length){if(!s)return b(O);if(s.currentConstruct&&s.currentConstruct.concrete)return S(O);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nk,g,p)(O)}function g(O){return s&&N(),C(a),b(O)}function p(O){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,S(O)}function b(O){return t.containerState={},e.attempt(nk,w,S)(O)}function w(O){return a++,n.push([t.currentConstruct,t.containerState]),b(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}),j(O)}function j(O){if(O===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(O);return}return $e(O)?(e.consume(O),E(e.exit("chunkFlow")),a=0,t.interrupt=void 0,d):(e.consume(O),j)}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 F=t.events.length;let U=F,V,M;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(V){M=t.events[U][1].end;break}V=!0}for(C(a),R=F;R<t.events.length;)t.events[R][1].end={...M},R++;Ur(t.events,U+1,0,t.events.slice(F)),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 vF(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(Eh(e))return 2}function Nh(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 Fy={name:"attention",resolveAll:bF,tokenize:xF};function bF(e,t){let n=-1,a,s,o,c,d,m,h,g;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 p={...e[a][1].end},b={...e[n][1].start};rk(p,-m),rk(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:p,end:{...e[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},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:{...d.end}},e[a][1].end={...c.start},e[n][1].start={...d.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,Nh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ta(h,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=ta(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Ur(e,a-1,n-a+3,h),n=a+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function xF(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"),d(m)}function d(m){if(m===o)return e.consume(m),d;const h=e.exit("attentionSequence"),g=wo(m),p=!g||g===2&&s||n.includes(m),b=!s||s===2&&g||n.includes(a);return h._open=!!(o===42?p:p&&(s||!b)),h._close=!!(o===42?b:b&&(g||!p)),t(m)}}function rk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const wF={name:"autolink",tokenize:SF};function SF(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,d(w)):h(w)}function d(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Xn(w))&&a++<32?(e.consume(w),d):(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||Yf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):dF(w)?(e.consume(w),h):n(w)}function g(w){return Xn(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),a=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):b(w)}function b(w){if((w===45||Xn(w))&&a++<63){const S=w===45?b:p;return e.consume(w),S}return n(w)}}const Pc={partial:!0,tokenize:kF};function kF(e,t,n){return a;function a(o){return st(o)?yt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||$e(o)?t(o):n(o)}}const e_={continuation:{tokenize:CF},exit:EF,name:"blockQuote",tokenize:jF};function jF(e,t,n){const a=this;return s;function s(c){if(c===62){const d=a.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return st(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function CF(e,t,n){const a=this;return s;function s(c){return st(c)?yt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(e_,t,n)(c)}}function EF(e){e.exit("blockQuote")}const t_={name:"characterEscape",tokenize:NF};function NF(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 hF(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const n_={name:"characterReference",tokenize:_F};function _F(e,t,n){const a=this;let s=0,o,c;return d;function d(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),m}function m(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Xn,g(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=fF,g):(e.enter("characterReferenceValue"),o=7,c=By,g(p))}function g(p){if(p===59&&s){const b=e.exit("characterReferenceValue");return c===Xn&&!ib(a.sliceSerialize(b))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(p)&&s++<o?(e.consume(p),g):n(p)}}const ak={partial:!0,tokenize:AF},ik={concrete:!0,name:"codeFenced",tokenize:TF};function TF(e,t,n){const a=this,s={partial:!0,tokenize:L};let o=0,c=0,d;return m;function m(R){return h(R)}function h(R){const F=a.events[a.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,d=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(R)}function g(R){return R===d?(c++,e.consume(R),g):c<3?n(R):(e.exit("codeFencedFenceSequence"),st(R)?yt(e,p,"whitespace")(R):p(R))}function p(R){return R===null||$e(R)?(e.exit("codeFencedFence"),a.interrupt?t(R):e.check(ak,j,z)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===null||$e(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(R)):st(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yt(e,w,"whitespace")(R)):R===96&&R===d?n(R):(e.consume(R),b)}function w(R){return R===null||$e(R)?p(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(R))}function S(R){return R===null||$e(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(R)):R===96&&R===d?n(R):(e.consume(R),S)}function j(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&&st(R)?yt(e,N,"linePrefix",o+1)(R):N(R)}function N(R){return R===null||$e(R)?e.check(ak,j,z)(R):(e.enter("codeFlowValue"),O(R))}function O(R){return R===null||$e(R)?(e.exit("codeFlowValue"),N(R)):(e.consume(R),O)}function z(R){return e.exit("codeFenced"),t(R)}function L(R,F,U){let V=0;return M;function M(X){return R.enter("lineEnding"),R.consume(X),R.exit("lineEnding"),Y}function Y(X){return R.enter("codeFencedFence"),st(X)?yt(R,ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):ae(X)}function ae(X){return X===d?(R.enter("codeFencedFenceSequence"),xe(X)):U(X)}function xe(X){return X===d?(V++,R.consume(X),xe):V>=c?(R.exit("codeFencedFenceSequence"),st(X)?yt(R,J,"whitespace")(X):J(X)):U(X)}function J(X){return X===null||$e(X)?(R.exit("codeFencedFence"),F(X)):U(X)}}}function AF(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 pg={name:"codeIndented",tokenize:OF},RF={partial:!0,tokenize:zF};function OF(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 g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):$e(h)?e.attempt(RF,c,m)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||$e(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),d)}function m(h){return e.exit("codeIndented"),t(h)}}function zF(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):$e(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):yt(e,o,"linePrefix",5)(c)}function o(c){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):$e(c)?s(c):n(c)}}const DF={name:"codeText",previous:IF,resolve:MF,tokenize:LF};function MF(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 IF(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function LF(e,t,n){let a=0,s,o;return c;function c(p){return e.enter("codeText"),e.enter("codeTextSequence"),d(p)}function d(p){return p===96?(e.consume(p),a++,d):(e.exit("codeTextSequence"),m(p))}function m(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),m):p===96?(o=e.enter("codeTextSequence"),s=0,g(p)):$e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||$e(p)?(e.exit("codeTextData"),m(p)):(e.consume(p),h)}function g(p){return p===96?(e.consume(p),s++,g):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",h(p))}}class PF{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 r_(e){const t={};let n=-1,a,s,o,c,d,m,h;const g=new PF(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(a=g.get(n),n&&a[1].type==="chunkFlow"&&g.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,UF(g,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(g.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={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(a),g.splice(s,n-s+1,d))}}return Ur(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function UF(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 d=c.events,m=[],h={};let g,p,b=-1,w=n,S=0,j=0;const E=[j];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(g=a.sliceStream(w),w.next||g.push(null),p&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++b<d.length;)d[b][0]==="exit"&&d[b-1][0]==="enter"&&d[b][1].type===d[b-1][1].type&&d[b][1].start.line!==d[b][1].end.line&&(j=b+1,E.push(j),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(),b=E.length;b--;){const C=d.slice(E[b],E[b+1]),N=o.pop();m.push([N,N+C.length-1]),e.splice(N,2,C)}for(m.reverse(),b=-1;++b<m.length;)h[S+m[b][0]]=S+m[b][1],S+=m[b][1]-m[b][0]-1;return h}const BF={resolve:$F,tokenize:HF},FF={partial:!0,tokenize:qF};function $F(e){return r_(e),e}function HF(e,t){let n;return a;function a(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?o(d):$e(d)?e.check(FF,c,o)(d):(e.consume(d),s)}function o(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function qF(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||$e(c))return n(c);const d=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function a_(e,t,n,a,s,o,c,d,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return p;function p(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),b):C===null||C===32||C===41||Yf(C)?n(C):(e.enter(a),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(d),b(C)):C===null||C===60||$e(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 j(C){return!g&&(C===null||C===41||It(C))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(a),t(C)):g<h&&C===40?(e.consume(C),g++,j):C===41?(e.consume(C),g--,j):C===null||C===32||C===40||Yf(C)?n(C):(e.consume(C),C===92?E:j)}function E(C){return C===40||C===41||C===92?(e.consume(C),j):j(C)}}function i_(e,t,n,a,s,o){const c=this;let d=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(o),g}function g(w){return d>999||w===null||w===91||w===93&&!m||w===94&&!d&&"_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):$e(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||$e(w)||d++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!st(w)),w===92?b:p)}function b(w){return w===91||w===92||w===93?(e.consume(w),d++,p):p(w)}}function s_(e,t,n,a,s,o){let c;return d;function d(b){return b===34||b===39||b===40?(e.enter(a),e.enter(s),e.consume(b),e.exit(s),c=b===40?41:b,m):n(b)}function m(b){return b===c?(e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),m(c)):b===null?n(b):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),yt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||$e(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?p:g)}function p(b){return b===c||b===92?(e.consume(b),g):g(b)}}function Ju(e,t){let n;return a;function a(s){return $e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):st(s)?yt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const ZF={name:"definition",tokenize:VF},GF={partial:!0,tokenize:QF};function VF(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return i_.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function d(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)?Ju(e,h)(w):h(w)}function h(w){return a_(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(GF,p,p)(w)}function p(w){return st(w)?yt(e,b,"whitespace")(w):b(w)}function b(w){return w===null||$e(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function QF(e,t,n){return a;function a(d){return It(d)?Ju(e,s)(d):n(d)}function s(d){return s_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return st(d)?yt(e,c,"whitespace")(d):c(d)}function c(d){return d===null||$e(d)?t(d):n(d)}}const KF={name:"hardBreakEscape",tokenize:YF};function YF(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return $e(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const XF={name:"headingAtx",resolve:WF,tokenize:JF};function WF(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 JF(e,t,n){let a=0;return s;function s(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&a++<6?(e.consume(g),c):g===null||It(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||$e(g)?(e.exit("atxHeading"),t(g)):st(g)?yt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||It(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const e$=["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"],sk=["pre","script","style","textarea"],t$={concrete:!0,name:"htmlFlow",resolveTo:a$,tokenize:i$},n$={partial:!0,tokenize:l$},r$={partial:!0,tokenize:s$};function a$(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 i$(e,t,n){const a=this;let s,o,c,d,m;return h;function h(_){return g(_)}function g(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),p}function p(_){return _===33?(e.consume(_),b):_===47?(e.consume(_),o=!0,j):_===63?(e.consume(_),s=3,a.interrupt?t:D):ur(_)?(e.consume(_),c=String.fromCharCode(_),E):n(_)}function b(_){return _===45?(e.consume(_),s=2,w):_===91?(e.consume(_),s=5,d=0,S):ur(_)?(e.consume(_),s=4,a.interrupt?t:D):n(_)}function w(_){return _===45?(e.consume(_),a.interrupt?t:D):n(_)}function S(_){const Z="CDATA[";return _===Z.charCodeAt(d++)?(e.consume(_),d===Z.length?a.interrupt?t:ae:S):n(_)}function j(_){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&&sk.includes(Q)?(s=1,a.interrupt?t(_):ae(_)):e$.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 st(_)?(e.consume(_),N):M(_)}function O(_){return _===47?(e.consume(_),M):_===58||_===95||ur(_)?(e.consume(_),z):st(_)?(e.consume(_),O):M(_)}function z(_){return _===45||_===46||_===58||_===95||Xn(_)?(e.consume(_),z):L(_)}function L(_){return _===61?(e.consume(_),R):st(_)?(e.consume(_),L):O(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),m=_,F):st(_)?(e.consume(_),R):U(_)}function F(_){return _===m?(e.consume(_),m=null,V):_===null||$e(_)?n(_):(e.consume(_),F)}function U(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||It(_)?L(_):(e.consume(_),U)}function V(_){return _===47||_===62||st(_)?O(_):n(_)}function M(_){return _===62?(e.consume(_),Y):n(_)}function Y(_){return _===null||$e(_)?ae(_):st(_)?(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(_),D):_===93&&s===5?(e.consume(_),Ae):$e(_)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(n$,P,xe)(_)):_===null||$e(_)?(e.exit("htmlFlowData"),xe(_)):(e.consume(_),ae)}function xe(_){return e.check(r$,J,P)(_)}function J(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),X}function X(_){return _===null||$e(_)?xe(_):(e.enter("htmlFlowData"),ae(_))}function q(_){return _===45?(e.consume(_),D):ae(_)}function te(_){return _===47?(e.consume(_),c="",ke):ae(_)}function ke(_){if(_===62){const Z=c.toLowerCase();return sk.includes(Z)?(e.consume(_),I):ae(_)}return ur(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ke):ae(_)}function Ae(_){return _===93?(e.consume(_),D):ae(_)}function D(_){return _===62?(e.consume(_),I):_===45&&s===2?(e.consume(_),D):ae(_)}function I(_){return _===null||$e(_)?(e.exit("htmlFlowData"),P(_)):(e.consume(_),I)}function P(_){return e.exit("htmlFlow"),t(_)}}function s$(e,t,n){const a=this;return s;function s(c){return $e(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 l$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Pc,t,n)}}const o$={name:"htmlText",tokenize:u$};function u$(e,t,n){const a=this;let s,o,c;return d;function d(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),m}function m(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),L):D===63?(e.consume(D),O):ur(D)?(e.consume(D),U):n(D)}function h(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),o=0,S):ur(D)?(e.consume(D),N):n(D)}function g(D){return D===45?(e.consume(D),w):n(D)}function p(D){return D===null?n(D):D===45?(e.consume(D),b):$e(D)?(c=p,te(D)):(e.consume(D),p)}function b(D){return D===45?(e.consume(D),w):p(D)}function w(D){return D===62?q(D):D===45?b(D):p(D)}function S(D){const I="CDATA[";return D===I.charCodeAt(o++)?(e.consume(D),o===I.length?j:S):n(D)}function j(D){return D===null?n(D):D===93?(e.consume(D),E):$e(D)?(c=j,te(D)):(e.consume(D),j)}function E(D){return D===93?(e.consume(D),C):j(D)}function C(D){return D===62?q(D):D===93?(e.consume(D),C):j(D)}function N(D){return D===null||D===62?q(D):$e(D)?(c=N,te(D)):(e.consume(D),N)}function O(D){return D===null?n(D):D===63?(e.consume(D),z):$e(D)?(c=O,te(D)):(e.consume(D),O)}function z(D){return D===62?q(D):O(D)}function L(D){return ur(D)?(e.consume(D),R):n(D)}function R(D){return D===45||Xn(D)?(e.consume(D),R):F(D)}function F(D){return $e(D)?(c=F,te(D)):st(D)?(e.consume(D),F):q(D)}function U(D){return D===45||Xn(D)?(e.consume(D),U):D===47||D===62||It(D)?V(D):n(D)}function V(D){return D===47?(e.consume(D),q):D===58||D===95||ur(D)?(e.consume(D),M):$e(D)?(c=V,te(D)):st(D)?(e.consume(D),V):q(D)}function M(D){return D===45||D===46||D===58||D===95||Xn(D)?(e.consume(D),M):Y(D)}function Y(D){return D===61?(e.consume(D),ae):$e(D)?(c=Y,te(D)):st(D)?(e.consume(D),Y):V(D)}function ae(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),s=D,xe):$e(D)?(c=ae,te(D)):st(D)?(e.consume(D),ae):(e.consume(D),J)}function xe(D){return D===s?(e.consume(D),s=void 0,X):D===null?n(D):$e(D)?(c=xe,te(D)):(e.consume(D),xe)}function J(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||It(D)?V(D):(e.consume(D),J)}function X(D){return D===47||D===62||It(D)?V(D):n(D)}function q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function te(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ke}function ke(D){return st(D)?yt(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Ae(D)}function Ae(D){return e.enter("htmlTextData"),c(D)}}const sb={name:"labelEnd",resolveAll:h$,resolveTo:m$,tokenize:p$},c$={tokenize:g$},d$={tokenize:y$},f$={tokenize:v$};function h$(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 m$(e,t){let n=e.length,a=0,s,o,c,d;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}},g={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",m,t],["enter",h,t]],d=ta(d,e.slice(o+1,o+a+3)),d=ta(d,[["enter",g,t]]),d=ta(d,Nh(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),d=ta(d,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),d=ta(d,e.slice(c+1)),d=ta(d,[["exit",m,t]]),Ur(e,o,e.length,d),e}function p$(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 d;function d(b){return o?o._inactive?p(b):(c=a.parser.defined.includes(va(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):n(b)}function m(b){return b===40?e.attempt(c$,g,c?g:p)(b):b===91?e.attempt(d$,g,c?h:p)(b):c?g(b):p(b)}function h(b){return e.attempt(f$,g,p)(b)}function g(b){return t(b)}function p(b){return o._balanced=!0,n(b)}}function g$(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return It(p)?Ju(e,o)(p):o(p)}function o(p){return p===41?g(p):a_(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function c(p){return It(p)?Ju(e,m)(p):g(p)}function d(p){return n(p)}function m(p){return p===34||p===39||p===40?s_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function h(p){return It(p)?Ju(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function y$(e,t,n){const a=this;return s;function s(d){return i_.call(a,e,o,c,"reference","referenceMarker","referenceString")(d)}function o(d){return a.parser.defined.includes(va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function c(d){return n(d)}}function v$(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 b$={name:"labelStartImage",resolveAll:sb.resolveAll,tokenize:x$};function x$(e,t,n){const a=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),o}function o(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):n(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):t(d)}}const w$={name:"labelStartLink",resolveAll:sb.resolveAll,tokenize:S$};function S$(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 gg={name:"lineEnding",tokenize:k$};function k$(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:j$};function j$(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||$e(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),st(h)?yt(e,d,"whitespace")(h):d(h))}}const br={continuation:{tokenize:_$},exit:A$,name:"list",tokenize:N$},C$={partial:!0,tokenize:R$},E$={partial:!0,tokenize:T$};function N$(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 d;function d(w){const S=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:By(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 By(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(Pc,a.interrupt?n:g,e.attempt(C$,b,p))}function g(w){return a.containerState.initialBlankLine=!0,o++,b(w)}function p(w){return st(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):n(w)}function b(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function _$(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Pc,s,o);function s(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,yt(e,t,"listItemIndent",a.containerState.size+1)(d)}function o(d){return a.containerState.furtherBlankLines||!st(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(E$,t,c)(d))}function c(d){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)(d)}}function T$(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 A$(e){e.exit(this.containerState.type)}function R$(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!st(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const lk={name:"setextUnderline",resolveTo:O$,tokenize:z$};function O$(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 z$(e,t,n){const a=this;let s;return o;function o(h){let g=a.events.length,p;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){p=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),st(h)?yt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||$e(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const D$={tokenize:M$};function M$(e){const t=this,n=e.attempt(Pc,a,e.attempt(this.parser.constructs.flowInitial,s,yt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(BF,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 I$={resolveAll:o_()},L$=l_("string"),P$=l_("text");function l_(e){return{resolveAll:o_(e==="text"?U$:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,c,d);return c;function c(g){return h(g)?o(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),m}function m(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),m)}function h(g){if(g===null)return!0;const p=s[g];let b=-1;if(p)for(;++b<p.length;){const w=p[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function o_(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 U$(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,d=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(h===-2)m=!0,d++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},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 B$={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:e_},F$={91:ZF},$$={[-2]:pg,[-1]:pg,32:pg},H$={35:XF,42:Df,45:[lk,Df],60:t$,61:lk,95:Df,96:ik,126:ik},q$={38:n_,92:t_},Z$={[-5]:gg,[-4]:gg,[-3]:gg,33:b$,38:n_,42:Fy,60:[wF,o$],91:w$,92:[KF,t_],93:sb,95:Fy,96:DF},G$={null:[Fy,I$]},V$={null:[42,95]},Q$={null:[]},K$=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:V$,contentInitial:F$,disable:Q$,document:B$,flow:H$,flowInitial:$$,insideSpan:G$,string:q$,text:Z$},Symbol.toStringTag,{value:"Module"}));function Y$(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=[],d=[];const m={attempt:F(L),check:F(R),consume:N,enter:O,exit:z,interrupt:F(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:p};let g=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function p(Y){return c=ta(c,Y),E(),c[c.length-1]!==null?[]:(U(t,0),h.events=Nh(o,h.events,h),h.events)}function b(Y,ae){return W$(w(Y),ae)}function w(Y){return X$(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 j(Y){s[Y.line]=Y.column,M()}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){g=g(Y)}function N(Y){$e(Y)?(a.line++,a.column=1,a.offset+=Y===-3?2:1,M()):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]),d.push(xe),xe}function z(Y){const ae=d.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 F(Y,ae){return xe;function xe(J,X,q){let te,ke,Ae,D;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],Me=we!==null&&ue.null,Ue=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];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 D=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,D),X}function Q(ue){return D.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(d);return{from:J,restore:q};function q(){a=Y,h.previous=ae,h.currentConstruct=xe,h.events.length=J,d=X,M()}}function M(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function X$(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 d=c[0];typeof d=="string"?c[0]=d.slice(a):c.shift()}o>0&&c.push(e[s].slice(0,o))}return c}function W$(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=`
369
+ `;break}case-3:{c=`\r
370
+ `;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 J$(e){const a={constructs:WN([K$,...(e||{}).extensions||[]]),content:s(mF),defined:[],document:s(gF),flow:s(D$),lazy:{},string:s(L$),text:s(P$)};return a;function s(o){return c;function c(d){return Y$(a,o,d)}}}function e8(e){for(;!r_(e););return e}const ok=/[\0\t\n\r]/g;function t8(){let e=1,t="",n=!0,a;return s;function s(o,c,d){const m=[];let h,g,p,b,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(ok.lastIndex=p,h=ok.exec(o),b=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(b),!h){t=o.slice(p);break}if(w===10&&p===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),p<b&&(m.push(o.slice(p,b)),e+=b-p),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}p=b+1}return d&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const n8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function r8(e){return e.replace(n8,a8)}function a8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return JN(n.slice(o?2:1),o?16:10)}return ib(n)||e}const u_={}.hasOwnProperty;function i8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),s8(n)(e8(J$(n).document().write(t8()(e,t,!0))))}function s8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o($t),autolinkProtocol:V,autolinkEmail:V,atxHeading:o(ie),blockQuote:o(Me),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($t),listItem:o(fr),listItemValue:b,listOrdered:o(Ln,p),listUnordered:o(Ln),paragraph:o(hi),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(ie),strong:o(mi),thematicBreak:o(ua)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:pe,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ue,characterReference:je,codeFenced:m(E),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:M,codeIndented:m(C),codeText:m(X),codeTextData:M,data:M,definition:m(),definitionDestinationString:z,definitionLabelString:N,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(ae),hardBreakTrailing:m(ae),htmlFlow:m(xe),htmlFlowData:M,htmlText:m(J),htmlTextData:M,image:m(te),label:Ae,labelText:ke,lineEnding:Y,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Z,resourceDestinationString:D,resourceTitleString:I,resource:P,setextHeading:m(U),setextHeadingLineSequence:F,setextHeadingText:R,strong:m(),thematicBreak:m()}};c_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(oe){let ye={type:"root",children:[]};const Fe={stack:[ye],tokenStack:[],config:t,enter:d,exit:h,buffer:c,resume:g,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]];u_.call(un,oe[nt][1].type)&&un[oe[nt][1].type].call(Object.assign({sliceSerialize:oe[nt][2].sliceSerialize},Fe),oe[nt][1])}if(Fe.tokenStack.length>0){const un=Fe.tokenStack[Fe.tokenStack.length-1];(un[1]||uk).call(Fe,void 0,un[0])}for(ye.position={start:$i(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:$i(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,Fe){let Ve=ye-1,nt=-1,un=!1,tr,Ht,Lt,Tt;for(;++Ve<=Fe;){const rt=oe[Ve];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?nt++:nt--,Tt=void 0;break}case"lineEndingBlank":{rt[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&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||nt===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[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:rt[1].end),oe.splice(Ht||Ve,0,["exit",tr,rt[2]]),Ve++,Fe++}if(rt[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};tr=nr,oe.splice(Ve,0,["enter",nr,rt[2]]),Ve++,Fe++,Lt=void 0,Tt=!0}}}return oe[ye][1]._spread=un,Fe}function o(oe,ye){return Fe;function Fe(Ve){d.call(this,oe(Ve),Ve),ye&&ye.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(oe,ye,Fe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ye,Fe||void 0]),oe.position={start:$i(ye.start),end:void 0}}function m(oe){return ye;function ye(Fe){oe&&oe.call(this,Fe),h.call(this,Fe)}}function h(oe,ye){const Fe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(ye?ye.call(this,oe,Ve[0]):(Ve[1]||uk).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Wu({start:oe.start,end:oe.end})+"): it’s not open");Fe.position.end=$i(oe.end)}function g(){return ab(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function b(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 j(){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(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.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 Fe=this.sliceSerialize(oe).length;ye.depth=Fe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function F(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 Fe=this.stack[this.stack.length-1].children;let Ve=Fe[Fe.length-1];(!Ve||Ve.type!=="text")&&(Ve=on(),Ve.position={start:$i(oe.start),end:void 0},Fe.push(Ve)),this.stack.push(Ve)}function M(oe){const ye=this.stack.pop();ye.value+=this.sliceSerialize(oe),ye.position.end=$i(oe.end)}function Y(oe){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=ye.children[ye.children.length-1];Fe.position.end=$i(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(V.call(this,oe),M.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),Fe=this.stack[this.stack.length-2];Fe.label=r8(ye),Fe.identifier=va(ye).toLowerCase()}function Ae(){const oe=this.stack[this.stack.length-1],ye=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Ve=oe.children;Fe.children=Ve}else Fe.alt=ye}function D(){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(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.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),Fe=this.data.characterReferenceType;let Ve;Fe?(Ve=JN(ye,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=ib(ye);const nt=this.stack[this.stack.length-1];nt.value+=Ve}function je(oe){const ye=this.stack.pop();ye.position.end=$i(oe.end)}function we(oe){M.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(oe)}function pe(oe){M.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(oe)}function Me(){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 ie(){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 $t(){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 $i(e){return{line:e.line,column:e.column,offset:e.offset}}function c_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?c_(e,a):l8(e,a)}}function l8(e,t){let n;for(n in t)if(u_.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 uk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is still open")}function o8(e){const t=this;t.parser=n;function n(a){return i8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function u8(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 c8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
371
+ `}]}function d8(e,t){const n=t.value?t.value+`
372
+ `:"",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 f8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function m8(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,d=e.footnoteCounts.get(a);d===void 0?(d=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,d+=1,e.footnoteCounts.set(a,d);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),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 p8(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 g8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function d_(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 y8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return d_(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 v8(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 b8(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 x8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return d_(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 w8(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 S8(e,t,n){const a=e.all(t),s=n?k8(n):f_(t),o={},c=[];if(typeof t.checked=="boolean"){const g=a[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d<a.length;){const g=a[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
373
+ `}),g.type==="element"&&g.tagName==="p"&&!s?c.push(...g.children):c.push(g)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
374
+ `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function k8(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=f_(n[a])}return t}function f_(e){const t=e.spread;return t??e.children.length>1}function j8(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 C8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function N8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _8(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)},d=eb(t.children[1]),m=ZN(t.children[t.children.length-1]);d&&m&&(c.position={start:d,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 T8(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,d=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<d;){const p=t.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let S={type:"element",tagName:o,properties:b,children:[]};p&&(S.children=e.all(p),e.patch(p,S),S=e.applyData(p,S)),h.push(S)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function A8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ck=9,dk=32;function R8(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(fk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(fk(t.slice(s),s>0,!1)),o.join("")}function fk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===ck||o===dk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===ck||o===dk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function O8(e,t){const n={type:"text",value:R8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function z8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const D8={blockquote:u8,break:c8,code:d8,delete:f8,emphasis:h8,footnoteReference:m8,heading:p8,html:g8,imageReference:y8,image:v8,inlineCode:b8,linkReference:x8,link:w8,listItem:S8,list:j8,paragraph:C8,root:E8,strong:N8,table:_8,tableCell:A8,tableRow:T8,text:O8,thematicBreak:z8,toml:vf,yaml:vf,definition:vf,footnoteDefinition:vf};function vf(){}const h_=-1,_h=0,ec=1,Xf=2,lb=3,ob=4,ub=5,cb=6,m_=7,p_=8,hk=typeof self=="object"?self:globalThis,M8=(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 _h:case h_:return n(c,s);case ec:{const d=n([],s);for(const m of c)d.push(a(m));return d}case Xf:{const d=n({},s);for(const[m,h]of c)d[a(m)]=a(h);return d}case lb:return n(new Date(c),s);case ob:{const{source:d,flags:m}=c;return n(new RegExp(d,m),s)}case ub:{const d=n(new Map,s);for(const[m,h]of c)d.set(a(m),a(h));return d}case cb:{const d=n(new Set,s);for(const m of c)d.add(a(m));return d}case m_:{const{name:d,message:m}=c;return n(new hk[d](m),s)}case p_: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:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new hk[o](c),s)};return a},mk=e=>M8(new Map,e)(0),Hl="",{toString:I8}={},{keys:L8}=Object,Uu=e=>{const t=typeof e;if(t!=="object"||!e)return[_h,t];const n=I8.call(e).slice(8,-1);switch(n){case"Array":return[ec,Hl];case"Object":return[Xf,Hl];case"Date":return[lb,Hl];case"RegExp":return[ob,Hl];case"Map":return[ub,Hl];case"Set":return[cb,Hl];case"DataView":return[ec,n]}return n.includes("Array")?[ec,n]:n.includes("Error")?[m_,n]:[Xf,n]},bf=([e,t])=>e===_h&&(t==="function"||t==="symbol"),P8=(e,t,n,a)=>{const s=(c,d)=>{const m=a.push(c)-1;return n.set(d,m),m},o=c=>{if(n.has(c))return n.get(c);let[d,m]=Uu(c);switch(d){case _h:{let g=c;switch(m){case"bigint":d=p_,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return s([h_],c)}return s([d,g],c)}case ec:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),s([m,[...b]],c)}const g=[],p=s([d,g],c);for(const b of c)g.push(o(b));return p}case Xf:{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 g=[],p=s([d,g],c);for(const b of L8(c))(e||!bf(Uu(c[b])))&&g.push([o(b),o(c[b])]);return p}case lb:return s([d,c.toISOString()],c);case ob:{const{source:g,flags:p}=c;return s([d,{source:g,flags:p}],c)}case ub:{const g=[],p=s([d,g],c);for(const[b,w]of c)(e||!(bf(Uu(b))||bf(Uu(w))))&&g.push([o(b),o(w)]);return p}case cb:{const g=[],p=s([d,g],c);for(const b of c)(e||!bf(Uu(b)))&&g.push(o(b));return p}}const{message:h}=c;return s([d,{name:m,message:h}],c)};return o},pk=(e,{json:t,lossy:n}={})=>{const a=[];return P8(!(t||n),!!t,new Map,a)(e),a},Wf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mk(pk(e,t)):structuredClone(e):(e,t)=>mk(pk(e,t));function U8(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 B8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function F8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||U8,a=e.options.footnoteBackLabel||B8,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const g=e.all(h),p=String(h.identifier).toUpperCase(),b=Ao(p.toLowerCase());let w=0;const S=[],j=e.footnoteCounts.get(p);for(;j!==void 0&&++w<=j;){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-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const E=g[g.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 g.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,C),d.push(C)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Wf(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
375
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
376
+ `}]}}const Th=(function(e){if(e==null)return Z8;if(typeof e=="function")return Ah(e);if(typeof e=="object")return Array.isArray(e)?$8(e):H8(e);if(typeof e=="string")return q8(e);throw new Error("Expected function, string, or object as test")});function $8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Th(e[n]);return Ah(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function H8(e){const t=e;return Ah(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function q8(e){return Ah(t);function t(n){return n&&n.type===e}}function Ah(e){return t;function t(n,a,s){return!!(G8(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function Z8(){return!0}function G8(e){return e!==null&&typeof e=="object"&&"type"in e}const g_=[],V8=!0,$y=!1,Q8="skip";function y_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Th(s),c=a?-1:1;d(e,void 0,[])();function d(m,h,g){const p=m&&typeof m=="object"?m:{};if(typeof p.type=="string"){const w=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=g_,S,j,E;if((!t||o(m,h,g[g.length-1]||void 0))&&(w=K8(n(m,g)),w[0]===$y))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==Q8)for(j=(a?C.children.length:-1)+c,E=g.concat(C);j>-1&&j<C.children.length;){const N=C.children[j];if(S=d(N,j,E)(),S[0]===$y)return S;j=typeof S[1]=="number"?S[1]:j+c}}return w}}}function K8(e){return Array.isArray(e)?e:typeof e=="number"?[V8,e]:e==null?g_:[e]}function db(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),y_(e,o,d,s);function d(m,h){const g=h[h.length-1],p=g?g.children.indexOf(m):void 0;return c(m,p,g)}}const Hy={}.hasOwnProperty,Y8={};function X8(e,t){const n=t||Y8,a=new Map,s=new Map,o=new Map,c={...D8,...n.handlers},d={all:h,applyData:J8,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:W8,wrap:tH};return db(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?a:s,b=String(g.identifier).toUpperCase();p.has(b)||p.set(b,g)}}),d;function m(g,p){const b=g.type,w=d.handlers[b];if(Hy.call(d.handlers,b)&&w)return w(d,g,p);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in g){const{children:j,...E}=g,C=Wf(E);return C.children=d.all(g),C}return Wf(g)}return(d.options.unknownHandler||eH)(d,g,p)}function h(g){const p=[];if("children"in g){const b=g.children;let w=-1;for(;++w<b.length;){const S=d.one(b[w],g);if(S){if(w&&b[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=gk(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=gk(j.value))}Array.isArray(S)?p.push(...S):p.push(S)}}}return p}}function W8(e,t){e.position&&(t.position=B9(e))}function J8(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,Wf(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function eH(e,t){const n=t.data||{},a="value"in t&&!(Hy.call(n,"hProperties")||Hy.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 tH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
377
+ `});++a<e.length;)a&&n.push({type:"text",value:`
378
+ `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
379
+ `}),n}function gk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function yk(e,t){const n=X8(e,t),a=n.one(e,void 0),s=F8(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
380
+ `},s),o}function nH(e,t){return e&&"run"in e?async function(n,a){const s=yk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return yk(n,{file:a,...e||t})}}function vk(e){if(e)throw e}var yg,bk;function rH(){if(bk)return yg;bk=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 g=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!p)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(a)return a(h,g).value}else return;return h[g]};return yg=function m(){var h,g,p,b,w,S,j=arguments[0],E=1,C=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<C;++E)if(h=arguments[E],h!=null)for(g in h)p=d(j,g),b=d(h,g),j!==b&&(N&&b&&(o(b)||(w=s(b)))?(w?(w=!1,S=p&&s(p)?p:[]):S=p&&o(p)?p:{},c(j,{name:g,newValue:m(N,S,b)})):typeof b<"u"&&c(j,{name:g,newValue:b}));return j},yg}var aH=rH();const vg=nh(aH);function qy(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 iH(){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);d(null,...s);function d(m,...h){const g=e[++o];let p=-1;if(m){c(m);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,g?sH(g,d)(...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 sH(e,t){let n;return a;function a(...c){const d=e.length>c.length;let m;d&&c.push(s);try{m=e.apply(this,c)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(c,...d){n||(n=!0,t(c,...d))}function o(c){s(null,c)}}const Ea={basename:lH,dirname:oH,extname:uH,join:cH,sep:"/"};function lH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Uc(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,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else c<0&&(o=!0,c=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(a=s):(d=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function oH(e){if(Uc(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 uH(e){Uc(e);let t=e.length,n=-1,a=0,s=-1,o=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),d===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 cH(...e){let t=-1,n;for(;++t<e.length;)Uc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":dH(n)}function dH(e){Uc(e);const t=e.codePointAt(0)===47;let n=fH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function fH(e,t){let n="",a=0,s=-1,o=0,c=-1,d,m;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===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 d===46&&o>-1?o++:o=-1}return n}function Uc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hH={cwd:mH};function mH(){return"/"}function Zy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pH(e){if(typeof e=="string")e=new URL(e);else if(!Zy(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 gH(e)}function gH(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 bg=["history","path","basename","stem","extname","dirname"];class v_{constructor(t){let n;t?Zy(t)?n={path:t}:typeof t=="string"||yH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":hH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<bg.length;){const o=bg[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)bg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ea.basename(this.path):void 0}set basename(t){wg(t,"basename"),xg(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){xk(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(xg(t,"extname"),xk(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){Zy(t)&&(t=pH(t)),wg(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){wg(t,"stem"),xg(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 xg(e,t){if(e&&e.includes(Ea.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ea.sep+"`")}function wg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function yH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vH=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),bH={}.hasOwnProperty;class fb extends vH{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=iH()}copy(){const t=new fb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(vg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jg("data",this.frozen),this.namespace[t]=n,this):bH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jg("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=xf(t),a=this.parser||this.Parser;return Sg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Sg("process",this.parser||this.Parser),kg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const d=xf(t),m=a.parse(d);a.run(m,d,function(g,p,b){if(g||!p||!b)return h(g);const w=p,S=a.stringify(w,b);SH(S)?b.value=S:b.result=S,h(g,b)});function h(g,p){g||!p?c(g):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),Sg("processSync",this.parser||this.Parser),kg("processSync",this.compiler||this.Compiler),this.process(t,s),Sk("processSync","process",n),a;function s(o,c){n=!0,vk(o),a=c}}run(t,n,a){wk(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,d){const m=xf(n);s.run(t,m,h);function h(g,p,b){const w=p||t;g?d(g):c?c(w):a(void 0,w,b)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),Sk("runSync","run",a),s;function o(c,d){vk(c),s=d,a=!0}}stringify(t,n){this.freeze();const a=xf(n),s=this.compiler||this.Compiler;return kg("stringify",s),wk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(jg("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?d(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[g,...p]=h;m(g,p)}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");d(h.plugins),h.settings&&(s.settings=vg(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const p=h[g];o(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let p=-1,b=-1;for(;++p<a.length;)if(a[p][0]===h){b=p;break}if(b===-1)a.push([h,...g]);else if(g.length>0){let[w,...S]=g;const j=a[b][1];qy(j)&&qy(w)&&(w=vg(!0,j,w)),a[b]=[h,w,...S]}}}}const xH=new fb().freeze();function Sg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jg(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 wk(e){if(!qy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Sk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xf(e){return wH(e)?e:new v_(e)}function wH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function SH(e){return typeof e=="string"||kH(e)}function kH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kk=[],jk={allowDangerousHtml:!0},CH=/^(https?|ircs?|mailto|xmpp)$/i,EH=[{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 NH(e){const t=_H(e),n=TH(e);return AH(t.runSync(t.parse(n),n),e)}function _H(e){const t=e.rehypePlugins||kk,n=e.remarkPlugins||kk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jk}:jk;return xH().use(o8).use(n).use(nH,a).use(t)}function TH(e){const t=e.children||"",n=new v_;return typeof t=="string"&&(n.value=t),n}function AH(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||RH;for(const g of EH)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+jH+g.id,void 0);return db(e,h),Z9(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(g,p,b){if(g.type==="raw"&&b&&typeof p=="number")return c?b.children.splice(p,1):b.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let w;for(w in mg)if(Object.hasOwn(mg,w)&&Object.hasOwn(g.properties,w)){const S=g.properties[w],j=mg[w];(j===null||j.includes(g.tagName))&&(g.properties[w]=m(String(S||""),w,g))}}if(g.type==="element"){let w=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!w&&a&&typeof p=="number"&&(w=!a(g,p,b)),w&&b&&typeof p=="number")return d&&g.children?b.children.splice(p,1,...g.children):b.children.splice(p,1),p}}}function RH(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||CH.test(e.slice(0,t))?e:""}function OH(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function b_(e,t,n){const s=Th((n||{}).ignore||[]),o=zH(t);let c=-1;for(;++c<o.length;)y_(e,"text",d);function d(h,g){let p=-1,b;for(;++p<g.length;){const w=g[p],S=b?b.children:void 0;if(s(w,S?S.indexOf(w):void 0,b))return;b=w}if(b)return m(h,g)}function m(h,g){const p=g[g.length-1],b=o[c][0],w=o[c][1];let S=0;const E=p.children.indexOf(h);let C=!1,N=[];b.lastIndex=0;let O=b.exec(h.value);for(;O;){const z=O.index,L={index:O.index,input:O.input,stack:[...g,h]};let R=w(...O,L);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?b.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),!b.global)break;O=b.exec(h.value)}return C?(S<h.value.length&&N.push({type:"text",value:h.value.slice(S)}),p.children.splice(E,1,...N)):N=[h],E+N.length}}function zH(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([DH(s[0]),MH(s[1])])}return t}function DH(e){return typeof e=="string"?new RegExp(OH(e),"g"):e}function MH(e){return typeof e=="function"?e:function(){return e}}function IH(e){b_(e,[/\r?\n|\r/g,LH])}function LH(){return{type:"break"}}function PH(){return function(e){IH(e)}}function Ck(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 Cg="phrasing",Eg=["autolink","link","image","label"];function UH(){return{transforms:[GH],enter:{literalAutolink:FH,literalAutolinkEmail:Ng,literalAutolinkHttp:Ng,literalAutolinkWww:Ng},exit:{literalAutolink:ZH,literalAutolinkEmail:qH,literalAutolinkHttp:$H,literalAutolinkWww:HH}}}function BH(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Cg,notInConstruct:Eg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Cg,notInConstruct:Eg},{character:":",before:"[ps]",after:"\\/",inConstruct:Cg,notInConstruct:Eg}]}}function FH(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ng(e){this.config.enter.autolinkProtocol.call(this,e)}function $H(e){this.config.exit.autolinkProtocol.call(this,e)}function HH(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 qH(e){this.config.exit.autolinkEmail.call(this,e)}function ZH(e){this.exit(e)}function GH(e){b_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,VH],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),QH]],{ignore:["link","linkReference"]})}function VH(e,t,n,a,s){let o="";if(!x_(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!KH(n)))return!1;const c=YH(n+a);if(!c[0])return!1;const d={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function QH(e,t,n,a){return!x_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function KH(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 YH(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=Ck(e,"(");let o=Ck(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 x_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ys(n)||Eh(n))&&(!t||n!==47)}w_.peek=iq;function XH(){this.buffer()}function WH(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function JH(){this.buffer()}function eq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tq(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 nq(e){this.exit(e)}function rq(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 aq(e){this.exit(e)}function iq(){return"["}function w_(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),c(),o+=s.move("]"),o}function sq(){return{enter:{gfmFootnoteCallString:XH,gfmFootnoteCall:WH,gfmFootnoteDefinitionLabelString:JH,gfmFootnoteDefinition:eq},exit:{gfmFootnoteCallString:tq,gfmFootnoteCall:nq,gfmFootnoteDefinitionLabelString:rq,gfmFootnoteDefinition:aq}}}function lq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:w_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,c){const d=o.createTracker(c);let m=d.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return m+=d.move(o.safe(o.associationId(a),{before:m,after:"]"})),g(),m+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),m+=d.move((t?`
381
+ `:" ")+o.indentLines(o.containerFlow(a,d.current()),t?S_:oq))),h(),m}}function oq(e,t,n){return t===0?e:S_(e,t,n)}function S_(e,t,n){return(n?"":" ")+e}const uq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];k_.peek=mq;function cq(){return{canContainEols:["delete"],enter:{strikethrough:fq},exit:{strikethrough:hq}}}function dq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:uq}],handlers:{delete:k_}}}function fq(e){this.enter({type:"delete",children:[]},e)}function hq(e){this.exit(e)}function k_(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 mq(){return"~"}function pq(e){return e.length}function gq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||pq,o=[],c=[],d=[],m=[];let h=0,g=-1;for(;++g<e.length;){const j=[],E=[];let C=-1;for(e[g].length>h&&(h=e[g].length);++C<e[g].length;){const N=yq(e[g][C]);if(n.alignDelimiters!==!1){const O=s(N);E[C]=O,(m[C]===void 0||O>m[C])&&(m[C]=O)}j.push(N)}c[g]=j,d[g]=E}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<h;)o[p]=Ek(a[p]);else{const j=Ek(a);for(;++p<h;)o[p]=j}p=-1;const b=[],w=[];for(;++p<h;){const j=o[p];let E="",C="";j===99?(E=":",C=":"):j===108?E=":":j===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,m[p]-E.length-C.length);const O=E+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=E.length+N+C.length,N>m[p]&&(m[p]=N),w[p]=N),b[p]=O}c.splice(1,0,b),d.splice(1,0,w),g=-1;const S=[];for(;++g<c.length;){const j=c[g],E=d[g];p=-1;const C=[];for(;++p<h;){const N=j[p]||"";let O="",z="";if(n.alignDelimiters!==!1){const L=m[p]-(E[p]||0),R=o[p];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&&!p&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||p)&&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||p!==h-1)&&C.push("|")}S.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
382
+ `)}function yq(e){return e==null?"":String(e)}function Ek(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 vq(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()),bq);return s(),c}function bq(e,t,n){return">"+(n?"":" ")+e}function xq(e,t){return Nk(e,t.inConstruct,!0)&&!Nk(e,t.notInConstruct,!1)}function Nk(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 _k(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
383
+ `&&xq(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
384
+ `}function wq(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 Sq(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 kq(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 jq(e,t,n,a){const s=kq(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(Sq(e,n)){const p=n.enter("codeIndented"),b=n.indentLines(o,Cq);return p(),b}const d=n.createTracker(a),m=s.repeat(Math.max(wq(o,s)+1,3)),h=n.enter("codeFenced");let g=d.move(m);if(e.lang){const p=n.enter(`codeFencedLang${c}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${c}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
385
+ `,encode:["`"],...d.current()})),p()}return g+=d.move(`
386
+ `),o&&(g+=d.move(o+`
387
+ `)),g+=d.move(m),h(),g}function Cq(e,t,n){return(n?"":" ")+e}function hb(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 Eq(e,t,n,a){const s=hb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=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("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
388
+ `,...m.current()}))),d(),e.title&&(d=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),d()),c(),h}function Nq(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 mc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Jf(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}}j_.peek=_q;function j_(e,t,n,a){const s=Nq(n),o=n.enter("emphasis"),c=n.createTracker(a),d=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=m.charCodeAt(0),g=Jf(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=mc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=Jf(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+mc(p));const w=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},d+m+w}function _q(e,t,n){return n.options.emphasis||"*"}function Tq(e,t){let n=!1;return db(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,$y}),!!((!e.depth||e.depth<3)&&ab(e)&&(t.options.setext||n))}function Aq(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(Tq(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
389
+ `,after:`
390
+ `});return p(),g(),b+`
391
+ `+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
392
+ `))+1))}const c="#".repeat(s),d=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
393
+ `,...o.current()});return/^[\t ]/.test(h)&&(h=mc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),d(),h}C_.peek=Rq;function C_(e){return e.value||""}function Rq(){return"<"}E_.peek=Oq;function E_(e,t,n,a){const s=hb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=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("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=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),d()),h+=m.move(")"),c(),h}function Oq(){return"!"}N_.peek=zq;function N_(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("![");const h=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=g,o(),s==="full"||!h||h!==p?m+=d.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function zq(){return"!"}__.peek=Dq;function __(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],d=n.compilePattern(c);let m;if(c.atBreak)for(;m=d.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 Dq(){return"`"}function T_(e,t){const n=ab(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))}A_.peek=Mq;function A_(e,t,n,a){const s=hb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let d,m;if(T_(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let p=c.move("<");return p+=c.move(n.containerPhrasing(e,{before:p,after:">",...c.current()})),p+=c.move(">"),d(),n.stack=g,p}d=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(")"),d(),h}function Mq(e,t,n){return T_(e,n)?"<":"["}R_.peek=Iq;function R_(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=g,o(),s==="full"||!h||h!==p?m+=d.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function Iq(){return"["}function mb(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 Lq(e){const t=mb(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 Pq(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 O_(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 Uq(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?Pq(n):mb(n);const d=e.ordered?c==="."?")":".":Lq(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.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),O_(n)===c&&g){let p=-1;for(;++p<e.children.length;){const b=e.children[p];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=d),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=o,s(),h}function Bq(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 Fq(e,t,n,a){const s=Bq(n);let o=n.bulletCurrent||mb(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 d=n.createTracker(a);d.move(o+" ".repeat(c-o.length)),d.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return m(),h;function g(p,b,w){return b?(w?"":" ".repeat(c))+p:(w?o:o+" ".repeat(c-o.length))+p}}function $q(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const Hq=Th(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function qq(e,t,n,a){return(e.children.some(function(c){return Hq(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function Zq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}z_.peek=Gq;function z_(e,t,n,a){const s=Zq(n),o=n.enter("strong"),c=n.createTracker(a),d=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=m.charCodeAt(0),g=Jf(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=mc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=Jf(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+mc(p));const w=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},d+m+w}function Gq(e,t,n){return n.options.strong||"*"}function Vq(e,t,n,a){return n.safe(e.value,a)}function Qq(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 Kq(e,t,n){const a=(O_(n)+(n.options.ruleSpaces?" ":"")).repeat(Qq(n));return n.options.ruleSpaces?a.slice(0,-1):a}const D_={blockquote:vq,break:_k,code:jq,definition:Eq,emphasis:j_,hardBreak:_k,heading:Aq,html:C_,image:E_,imageReference:N_,inlineCode:__,link:A_,linkReference:R_,list:Uq,listItem:Fq,paragraph:$q,root:qq,strong:z_,text:Vq,thematicBreak:Kq};function Yq(){return{enter:{table:Xq,tableData:Tk,tableHeader:Tk,tableRow:Jq},exit:{codeText:e7,table:Wq,tableData:_g,tableHeader:_g,tableRow:_g}}}function Xq(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 Wq(e){this.exit(e),this.data.inTable=void 0}function Jq(e){this.enter({type:"tableRow",children:[]},e)}function _g(e){this.exit(e)}function Tk(e){this.enter({type:"tableCell",children:[]},e)}function e7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,t7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function t7(e,t){return t==="|"?t:e}function n7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
394
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:d}};function c(w,S,j,E){return h(g(w,j,E),w.align)}function d(w,S,j,E){const C=p(w,j,E),N=h([C]);return N.slice(0,N.indexOf(`
395
+ `))}function m(w,S,j,E){const C=j.enter("tableCell"),N=j.enter("phrasing"),O=j.containerPhrasing(w,{...E,before:o,after:o});return N(),C(),O}function h(w,S){return gq(w,{align:S,alignDelimiters:a,padding:n,stringLength:s})}function g(w,S,j){const E=w.children;let C=-1;const N=[],O=S.enter("table");for(;++C<E.length;)N[C]=p(E[C],S,j);return O(),N}function p(w,S,j){const E=w.children;let C=-1;const N=[],O=S.enter("tableRow");for(;++C<E.length;)N[C]=m(E[C],w,S,j);return O(),N}function b(w,S,j){let E=D_.inlineCode(w,S,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function r7(){return{exit:{taskListCheckValueChecked:Ak,taskListCheckValueUnchecked:Ak,paragraph:i7}}}function a7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:s7}}}function Ak(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function i7(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 d=s[o];if(d.type==="paragraph"){c=d;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 s7(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=n.createTracker(a);o&&d.move(c);let m=D_.listItem(e,t,n,{...a,...d.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+c}}function l7(){return[UH(),sq(),cq(),Yq(),r7()]}function o7(e){return{extensions:[BH(),lq(e),dq(),n7(e),a7()]}}const u7={tokenize:p7,partial:!0},M_={tokenize:g7,partial:!0},I_={tokenize:y7,partial:!0},L_={tokenize:v7,partial:!0},c7={tokenize:b7,partial:!0},P_={name:"wwwAutolink",tokenize:h7,previous:B_},U_={name:"protocolAutolink",tokenize:m7,previous:F_},fi={name:"emailAutolink",tokenize:f7,previous:$_},Oa={};function d7(){return{text:Oa}}let Ds=48;for(;Ds<123;)Oa[Ds]=fi,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);Oa[43]=fi;Oa[45]=fi;Oa[46]=fi;Oa[95]=fi;Oa[72]=[fi,U_];Oa[104]=[fi,U_];Oa[87]=[fi,P_];Oa[119]=[fi,P_];function f7(e,t,n){const a=this;let s,o;return c;function c(p){return!Gy(p)||!$_.call(a,a.previous)||pb(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(p))}function d(p){return Gy(p)?(e.consume(p),d):p===64?(e.consume(p),m):n(p)}function m(p){return p===46?e.check(c7,g,h)(p):p===45||p===95||Xn(p)?(o=!0,e.consume(p),m):g(p)}function h(p){return e.consume(p),s=!0,m}function g(p){return o&&s&&ur(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function h7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!B_.call(a,a.previous)||pb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(u7,e.attempt(M_,e.attempt(I_,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function m7(e,t,n){const a=this;let s="",o=!1;return c;function c(p){return(p===72||p===104)&&F_.call(a,a.previous)&&!pb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),d):n(p)}function d(p){if(ur(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),d;if(p===58){const b=s.toLowerCase();if(b==="http"||b==="https")return e.consume(p),m}return n(p)}function m(p){return p===47?(e.consume(p),o?h:(o=!0,m)):n(p)}function h(p){return p===null||Yf(p)||It(p)||Ys(p)||Eh(p)?n(p):e.attempt(M_,e.attempt(I_,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function p7(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 g7(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(L_,m,d)(h):h===null||It(h)||Ys(h)||h!==45&&Eh(h)?m(h):(o=!0,e.consume(h),c)}function d(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 y7(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(L_,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 v7(e,t,n){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),a):d===38?(e.consume(d),o):d===93?(e.consume(d),s):d===60||d===null||It(d)||Ys(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||It(d)||Ys(d)?t(d):a(d)}function o(d){return ur(d)?c(d):n(d)}function c(d){return d===59?(e.consume(d),a):ur(d)?(e.consume(d),c):n(d)}}function b7(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Xn(o)?n(o):t(o)}}function B_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||It(e)}function F_(e){return!ur(e)}function $_(e){return!(e===47||Gy(e))}function Gy(e){return e===43||e===45||e===46||e===95||Xn(e)}function pb(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 x7={tokenize:_7,partial:!0};function w7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:C7,continuation:{tokenize:E7},exit:N7}},text:{91:{name:"gfmFootnoteCall",tokenize:j7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S7,resolveTo:k7}}}}function S7(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 d;function d(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 k7(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)},d=[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,...d),e}function j7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return d;function d(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(o>999||p===93&&!c||p===null||p===91||It(p))return n(p);if(p===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return s.includes(va(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return It(p)||(c=!0),o++,e.consume(p),p===92?g:h}function g(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function C7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,d;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",g):n(S)}function g(S){if(c>999||S===93&&!d||S===null||S===91||It(S))return n(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=va(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return It(S)||(d=!0),c++,e.consume(S),S===92?p:g}function p(S){return S===91||S===92||S===93?(e.consume(S),c++,g):g(S)}function b(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 E7(e,t,n){return e.check(Pc,t,e.attempt(x7,t,n))}function N7(e){e.exit("gfmFootnoteDefinition")}function _7(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 T7(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,d){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 g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},p={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",g,d],["enter",c[h][1],d],["exit",c[h][1],d],["enter",p,d]],w=d.parser.constructs.insideSpan.null;w&&Ur(b,b.length,0,Nh(w,c.slice(h+1,m),d)),Ur(b,b.length,0,[["exit",p,d],["enter",c[m][1],d],["exit",c[m][1],d],["exit",g,d]]),Ur(c,h-1,m-h+3,b),m=h+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,d,m){const h=this.previous,g=this.events;let p=0;return b;function b(S){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const j=wo(h);if(S===126)return p>1?m(S):(c.consume(S),p++,w);if(p<2&&!n)return m(S);const E=c.exit("strikethroughSequenceTemporary"),C=wo(S);return E._open=!C||C===2&&!!j,E._close=!j||j===2&&!!C,d(S)}}}class A7{constructor(){this.map=[]}add(t,n,a){R7(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 R7(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 O7(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 z7(){return{flow:{null:{name:"table",tokenize:D7,resolveAll:M7}}}}function D7(e,t,n){const a=this;let s=0,o=0,c;return d;function d(M){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(M):xe(M)}function m(M){return e.enter("tableHead"),e.enter("tableRow"),h(M)}function h(M){return M===124||(c=!0,o+=1),g(M)}function g(M){return M===null?n(M):$e(M)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),w):n(M):st(M)?yt(e,g,"whitespace")(M):(o+=1,c&&(c=!1,s+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),p(M)))}function p(M){return M===null||M===124||It(M)?(e.exit("data"),g(M)):(e.consume(M),M===92?b:p)}function b(M){return M===92||M===124?(e.consume(M),p):p(M)}function w(M){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(M):(e.enter("tableDelimiterRow"),c=!1,st(M)?yt(e,S,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):S(M))}function S(M){return M===45||M===58?E(M):M===124?(c=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),j):L(M)}function j(M){return st(M)?yt(e,E,"whitespace")(M):E(M)}function E(M){return M===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),C):M===45?(o+=1,C(M)):M===null||$e(M)?z(M):L(M)}function C(M){return M===45?(e.enter("tableDelimiterFiller"),N(M)):L(M)}function N(M){return M===45?(e.consume(M),N):M===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(M))}function O(M){return st(M)?yt(e,z,"whitespace")(M):z(M)}function z(M){return M===124?S(M):M===null||$e(M)?!c||s!==o?L(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):L(M)}function L(M){return n(M)}function R(M){return e.enter("tableRow"),F(M)}function F(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),F):M===null||$e(M)?(e.exit("tableRow"),t(M)):st(M)?yt(e,F,"whitespace")(M):(e.enter("data"),U(M))}function U(M){return M===null||M===124||It(M)?(e.exit("data"),F(M)):(e.consume(M),M===92?V:U)}function V(M){return M===92||M===124?(e.consume(M),U):U(M)}}function M7(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,h,g,p;const b=new A7;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(d=!1,m!==0&&(Rk(b,t,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(a=!0,p=void 0,o=[0,0,0,0],c=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",g,t]])),s=S.type==="tableDelimiterRow"?2:g?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],p=wf(b,t,o,s,void 0,p),o=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],p=wf(b,t,o,s,void 0,p)),o=c,c=[o[1],n,0,0])):S.type==="tableHead"?(d=!0,m=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],p=wf(b,t,o,s,n,p)):c[1]!==0&&(p=wf(b,t,c,s,n,p)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Rk(b,t,m,h,g),b.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=O7(t.events,n))}return e}function wf(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="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]),g=Vl(t.events,n[3]),p={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const b=t.events[n[2]],w=t.events[n[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,j=n[3]-n[2]-1;e.add(S,j,[])}}e.add(n[3]+1,0,[["exit",p,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 Rk(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 I7={name:"tasklistCheck",tokenize:P7};function L7(){return{text:{91:I7}}}function P7(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"),d):n(m)}function d(m){return $e(m)?t(m):st(m)?e.check({tokenize:U7},t,n)(m):n(m)}}function U7(e,t,n){return yt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function B7(e){return WN([d7(),w7(),T7(e),z7(),L7()])}const F7={};function $7(e){const t=this,n=e||F7,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(B7(n)),o.push(l7()),c.push(o7(n))}function Rh({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(NH,{remarkPlugins:[$7,PH],children:e})})}function H7({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=x.useState(!1),d=x.useRef(null),m=e!==t;return x.useEffect(()=>{var h;o&&((h=d.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(q7,{})]}),!o&&!s&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(Sv,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Jn,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:d,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(Rh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function q7(){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 H_={"claude-code":"Claude Code",codex:"Codex"},Z7=[Qf.CLAUDE_CODE,Qf.CODEX];function G7({open:e,onOpenChange:t,agent:n}){const a=mn(),s=n.clientId,o=n.runtimeProvider,[c,d]=x.useState(s),[m,h]=x.useState(o),[g,p]=x.useState(!1),w=Ye({queryKey:["clients-rebind"],queryFn:ls,enabled:e}).data??[],S=yR({queries:w.map(U=>({queryKey:["client-capabilities",U.id],queryFn:()=>ch(U.id),enabled:e}))}),j=x.useMemo(()=>{const U=new Map;return S.forEach((V,M)=>{const Y=w[M];if(!Y)return;const ae=V.data;ae!=null&&ae.capabilities&&U.set(Y.id,ae.capabilities)}),U},[S,w]);x.useEffect(()=>{e||(d(s),h(o),p(!1))},[e,s,o]);const E=c?j.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||g),z=m!==o,L=c!==s,R=wt({mutationFn:()=>{if(!c)throw new Error("clientId required");return UI(n.uuid,{clientId:c,runtimeProvider:m,force:N&&g?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),F=R.error instanceof Rc||R.error instanceof Error?R.error.message:null;return l.jsx(Mn,{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:Q7(s,w,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:U=>d(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:V7(U)},U.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(xt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:Z7.map(U=>{const V=(E==null?void 0:E[U])??null,M=!!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":M?"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:H_[U]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:Y7(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:g,onChange:U=>p(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."})]}),F&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:F})]}),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 V7(e){return`${e.hostname??e.id} · ${e.status}`}function Q7(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${H_[n]}`}const K7={"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 Y7(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. ${K7[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const X7={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function W7(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(Xu,{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:X7[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(dC,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function tc(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 J7(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const eZ={"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 tZ(e){const t=eZ[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(nZ,{name:t.name,caption:t.caption,locked:!0}),l.jsx(rZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function nZ({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(xv,{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(fC,{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 rZ(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(wy,{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(wy,{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 aZ(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 iZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function sZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Tg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Ok(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:sZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Ag(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),d=iZ(n,c),m=[...o,{key:d,value:a,baseline:null,status:"added"}];return{...s,[e]:Ok(m)}}),update:(a,s)=>t(o=>{const d=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Ok(d)}}),remove:a=>t(s=>{const c=s[e].map(d=>d.key!==a?d:d.baseline==null?null:{...d,status:"deleted"}).filter(d=>d!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(d=>d.key!==a||d.baseline==null?d:{...d,value:d.baseline,status:"unchanged"});return{...s,[e]:c}})}}function lZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Tg(e.payload.mcpServers,"mcp"),env:Tg(e.payload.env,"env"),git:Tg(e.payload.gitRepos,"git")}}function oZ(e){const[t,n]=x.useState(null);x.useEffect(()=>{e&&t===null&&n(lZ(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,d=a.model!==o,m=x.useMemo(()=>{const O=[],z=U=>U.reduce((V,M)=>M.status==="unchanged"?V:V+1,0),L=z(a.mcp),R=z(a.env),F=z(a.git);return c&&O.push("prompt"),d&&O.push("model"),L>0&&O.push("mcp"),R>0&&O.push("env"),F>0&&O.push("git"),{anyDirty:O.length>0,dirtySections:O,counts:{prompt:c?1:0,model:d?1:0,mcp:L,env:R,git:F}}},[a,c,d]),h=x.useCallback(O=>{n(z=>z&&O(z))},[]),g=x.useCallback(O=>h(z=>({...z,promptAppend:O})),[h]),p=x.useCallback(()=>h(O=>({...O,promptAppend:s})),[h,s]),b=x.useCallback(O=>h(z=>({...z,model:O})),[h]),w=x.useCallback(()=>h(O=>({...O,model:o})),[h,o]),S=x.useMemo(()=>Ag("mcp",h),[h]),j=x.useMemo(()=>Ag("env",h),[h]),E=x.useMemo(()=>Ag("git",h),[h]),C=x.useCallback(()=>{n(null)},[]),N=x.useCallback(()=>{if(!t||!e)return{};const O={};c&&(O.prompt={append:t.promptAppend}),d&&(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(F=>F.status!=="deleted").map(F=>F.value)),L&&(O.env=t.env.filter(F=>F.status!=="deleted").map(F=>{const U=F.value;return U.sensitive&&U.value===Gf?{key:U.key,value:Gf,sensitive:!0}:U})),R&&(O.gitRepos=t.git.filter(F=>F.status!=="deleted").map(F=>F.value)),O},[t,e,c,d,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:d,setPromptAppend:g,revertPrompt:p,setModel:b,revertModel:w,addMcp:S.add,updateMcp:S.update,deleteMcp:S.remove,undoDeleteMcp:S.undo,addEnv:j.add,updateEnv:j.update,deleteEnv:j.remove,undoDeleteEnv:j.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:tc("prompt"),tools:tc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function uZ(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 cZ(){var Tt,rt,nr,Rn,al,ca,da,za,Gn,Da,wa,qt;const t=qj().uuid??"",n=_n(),a=mn(),s=Ye({queryKey:["agent",t],queryFn:()=>II(t),enabled:!!t}),o=Ye({queryKey:["agent-config",t],queryFn:()=>jh(t),enabled:!!t&&((Tt=s.data)==null?void 0:Tt.type)!=="human"}),c=Ye({queryKey:["agent-client-status",t],queryFn:()=>LB(t),enabled:!!t&&((rt=s.data)==null?void 0:rt.type)!=="human"}),d=Ye({queryKey:["agent-sessions-active",t],queryFn:()=>RC(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=oZ(o.data),[g,p]=x.useState(null),[b,w]=x.useState(null),[S,j]=x.useState(!1),E=wt({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const Ce=h.buildPayloadPatch();return Ch(t,{expectedVersion:o.data.version,payload:Ce})},onSuccess:Ce=>{a.setQueryData(["agent-config",t],Ce),p(null),w(null),j(!0)},onError:Ce=>{if(j(!1),Ce instanceof Rc&&Ce.status===409){w("Someone else saved a newer version while you were editing."),p(null);return}p(Ce instanceof Error?Ce.message:String(Ce))}});x.useEffect(()=>{if(!S)return;const Ce=setTimeout(()=>j(!1),2500);return()=>clearTimeout(Ce)},[S]),x.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const C=x.useCallback(()=>{w(null),p(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),N=x.useCallback(Ce=>{const et=document.getElementById(Ce);et&&et.scrollIntoView({behavior:"smooth",block:"start"})},[]),O=wt({mutationFn:Ce=>m1(t,Ce),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),z=wt({mutationFn:()=>TE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),L=wt({mutationFn:()=>AE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),R=wt({mutationFn:()=>_E(t),onSuccess:()=>n("/team")}),F=wt({mutationFn:()=>BI(t)}),[U,V]=x.useState(!1),[M,Y]=x.useState(""),[ae,xe]=x.useState(null),[J,X]=x.useState(!1),q=Ye({queryKey:["clients"],queryFn:ls,enabled:U}),te=wt({mutationFn:Ce=>m1(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]=x.useState(!1),[D,I]=x.useState(null),P=wt({mutationFn:()=>IB(t,h.buildPayloadPatch()),onSuccess:Ce=>{const et=Ce.diff.length?Ce.diff.map(pn=>`${pn.op} ${pn.path}`).join(`
396
+ `):"(no changes)";I(et)},onError:Ce=>I(`Dry run failed: ${Ce instanceof Error?Ce.message:String(Ce)}`)});x.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=x.useMemo(()=>uZ(_),[_]),Q=x.useRef(null),[ue,je]=x.useState(!1);x.useEffect(()=>{if(_)return;const Ce=Q.current;if(!Ce||typeof IntersectionObserver>"u")return;const et=new IntersectionObserver(pn=>{const _r=pn[0];_r&&je(!_r.isIntersecting&&_r.boundingClientRect.top<0)},{threshold:0});return et.observe(Ce),()=>et.disconnect()},[_]);const[we,pe]=x.useState(Kn.overview);x.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const Ce=[];for(const et of Z){const pn=document.getElementById(et.anchor);if(!pn)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(pn),Ce.push(_r)}return()=>{for(const et of Ce)et.disconnect()}},[Z]);const Me=x.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=d.data)==null?void 0:ca.length)??0,ie=!dt&&!(ot!=null&&ot.clientId),ge=!dt&&ot?!ot.online&&!!ot.clientId:!1,Le=Ue,zt=Le.runtimeState??null,$t=Le.runtimeType??null,Ln=Le.totalSessions??null,fr=Ue.uuid.slice(0,8),hi=aZ({activeSessions:re,isUnclaimed:ie,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)),Fe=Ce=>new Set(ua.filter(et=>et.key!==Ce).map(et=>{const{value:pn}=et;return pn.localPath?pn.localPath:((pn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ve={sessions:Ln??"—",active:re,runtime:$t??(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(Yv,{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(dZ,{label:Ce.label,active:we===Ce.anchor,danger:Ce.danger??!1,dirty:Me.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(PB,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(UB,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(BB,{}),l.jsx(FB,{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(Mc,{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 ",sc(ot.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(fc,{state:zt}),l.jsxs(ve,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ue.uuid}`),children:[l.jsx(wv,{className:"h-3 w-3"})," Open chat"]}),!dt&&Ue.status==="active"&&l.jsxs(ve,{variant:"outline",size:"xs",onClick:()=>{F.reset(),F.mutate()},disabled:F.isPending,children:[l.jsx(fC,{className:"h-3 w-3"}),F.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(yf,{label:"sessions",value:Ve.sessions}),l.jsx(yf,{label:"active",value:Ve.active,accent:typeof Ve.active=="number"&&Ve.active>0?"var(--accent)":void 0}),l.jsx(yf,{label:"runtime",value:Ve.runtime}),l.jsx(yf,{label:"model",value:Ve.model})]})]}),l.jsx("div",{ref:Q,"aria-hidden":!0,style:{height:0}}),!dt&&l.jsx(qB,{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:[(F.data||F.error)&&l.jsx(yZ,{result:F.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>F.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(wy,{className:"h-3 w-3"}),"Manage bindings"]}),children:l.jsx(a9,{agent:Ue,onSave:async Ce=>{await O.mutateAsync(Ce)}})}),!dt&&l.jsxs(l.Fragment,{children:[l.jsxs(Bu,{anchorId:Kn.setup,title:"Setup",caption:((Da=o.data)==null?void 0:Da.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(tZ,{runtimeProvider:Ht,computerLabel:tr,canBindComputer:ie&&Ue.status==="active",bindComputerPending:te.isPending,onBindComputer:()=>V(!0),onRebind:Ue.clientId?()=>X(!0):void 0,modelSlot:l.jsx(p9,{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(H7,{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(l9,{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:tc("env"),children:l.jsx(XB,{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:tc("git"),children:l.jsx(JB,{items:h.draft.git,otherPaths:Fe,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Ue.status!=="active"})}),D&&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:D}),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(J7,{}),l.jsx(ZB,{agent:Ue,suspendPending:z.isPending,reactivatePending:L.isPending,deletePending:R.isPending,onSuspend:()=>z.mutate(),onReactivate:()=>L.mutate(),onDelete:()=>R.mutate()})]}),!dt&&l.jsx(W7,{summary:h.summary,saveHint:hi,conflictMessage:b,errorMessage:g,saving:E.isPending,justSaved:S,onSave:()=>E.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:Ce=>N(tc(Ce))})]}),l.jsx(fZ,{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(),p(null),w(null),Ae(!1)}}),l.jsx(Mn,{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(hZ,{clients:q.data??[],selected:M,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:!M||te.isPending,onClick:()=>{xe(null),te.mutate(M)},children:te.isPending?"Binding…":"Bind"})]})]})}),l.jsx(G7,{open:J,onOpenChange:X,agent:Ue})]})}function dZ({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 fZ(e){return l.jsx(Mn,{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 hZ({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 mZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},pZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},gZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function yZ({result:e,onDismiss:t}){const n=pZ[e.status],a=gZ[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:mZ[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 vZ(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 bZ(){return this.eachAfter(vZ)}function xZ(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function wZ(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 SZ(e,t){for(var n=this,a=[n],s=[],o,c,d,m=-1;n=a.pop();)if(s.push(n),o=n.children)for(c=0,d=o.length;c<d;++c)a.push(o[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function kZ(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function jZ(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 CZ(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function EZ(e){for(var t=this,n=NZ(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 NZ(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 _Z(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function TZ(){return Array.from(this)}function AZ(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function RZ(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*OZ(){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 q_(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=MZ)):t===void 0&&(t=DZ);for(var n=new So(e),a,s=[n],o,c,d,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,d=m-1;d>=0;--d)s.push(o=c[d]=new So(c[d])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(Z_)}function zZ(){return q_(this).eachBefore(IZ)}function DZ(e){return e.children}function MZ(e){return Array.isArray(e)?e[1]:null}function IZ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Z_(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=q_.prototype={constructor:So,count:bZ,each:xZ,eachAfter:SZ,eachBefore:wZ,find:kZ,sum:jZ,sort:CZ,path:EZ,ancestors:_Z,descendants:TZ,leaves:AZ,links:RZ,copy:zZ,[Symbol.iterator]:OZ};function Rg(e){return e==null?null:LZ(e)}function LZ(e){if(typeof e!="function")throw new Error;return e}var PZ={depth:-1},zk={},Og={};function UZ(e){return e.id}function BZ(e){return e.parentId}function FZ(){var e=UZ,t=BZ,n;function a(s){var o=Array.from(s),c=e,d=t,m,h,g,p,b,w,S,j,E=new Map;if(n!=null){const C=o.map((z,L)=>$Z(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(Og));c=(z,L)=>C[L],d=(z,L)=>N[L]}for(g=0,m=o.length;g<m;++g)h=o[g],w=o[g]=new So(h),(S=c(h,g,s))!=null&&(S+="")&&(j=w.id=S,E.set(j,E.has(j)?zk:w)),(S=d(h,g,s))!=null&&(S+="")&&(w.parent=S);for(g=0;g<m;++g)if(w=o[g],S=w.parent){if(b=E.get(S),!b)throw new Error("missing: "+S);if(b===zk)throw new Error("ambiguous: "+S);b.children?b.children.push(w):b.children=[w],w.parent=b}else{if(p)throw new Error("multiple roots");p=w}if(!p)throw new Error("no root");if(n!=null){for(;p.data===Og&&p.children.length===1;)p=p.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Og);--C)w.data=null}if(p.parent=PZ,p.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(Z_),p.parent=null,m>0)throw new Error("cycle");return p}return a.id=function(s){return arguments.length?(e=Rg(s),a):e},a.parentId=function(s){return arguments.length?(t=Rg(s),a):t},a.path=function(s){return arguments.length?(n=Rg(s),a):n},a}function $Z(e){e=`${e}`;let t=e.length;return Vy(e,t-1)&&!Vy(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&&!Vy(e,t););return e.slice(0,t)}function Vy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function HZ(e,t){return e.parent===t.parent?1:2}function zg(e){var t=e.children;return t?t[0]:e.t}function Dg(e){var t=e.children;return t?t[t.length-1]:e.t}function qZ(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 ZZ(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 GZ(e,t,n){return e.a.parent===t.parent?e.a:n}function Mf(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}Mf.prototype=Object.create(So.prototype);function VZ(e){for(var t=new Mf(e,0),n,a=[t],s,o,c,d;n=a.pop();)if(o=n._.children)for(n.children=new Array(d=o.length),c=d-1;c>=0;--c)a.push(s=n.children[c]=new Mf(o[c],c)),s.parent=n;return(t.parent=new Mf(null,0)).children=[t],t}function QZ(){var e=HZ,t=1,n=1,a=null;function s(h){var g=VZ(h);if(g.eachAfter(o),g.parent.m=-g.z,g.eachBefore(c),a)h.eachBefore(m);else{var p=h,b=h,w=h;h.eachBefore(function(N){N.x<p.x&&(p=N),N.x>b.x&&(b=N),N.depth>w.depth&&(w=N)});var S=p===b?1:e(p,b)/2,j=S-p.x,E=t/(b.x+S+j),C=n/(w.depth||1);h.eachBefore(function(N){N.x=(N.x+j)*E,N.y=N.depth*C})}return h}function o(h){var g=h.children,p=h.parent.children,b=h.i?p[h.i-1]:null;if(g){ZZ(h);var w=(g[0].z+g[g.length-1].z)/2;b?(h.z=b.z+e(h._,b._),h.m=h.z-w):h.z=w}else b&&(h.z=b.z+e(h._,b._));h.parent.A=d(h,b,h.parent.A||p[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function d(h,g,p){if(g){for(var b=h,w=h,S=g,j=b.parent.children[0],E=b.m,C=w.m,N=S.m,O=j.m,z;S=Dg(S),b=zg(b),S&&b;)j=zg(j),w=Dg(w),w.a=h,z=S.z+N-b.z-E+e(S._,b._),z>0&&(qZ(GZ(S,h,p),h,z),E+=z,C+=z),N+=S.m,E+=b.m,O+=j.m,C+=w.m;S&&!Dg(w)&&(w.t=S,w.m+=N-C),b&&!zg(j)&&(j.t=b,j.m+=E-O,p=h)}return p}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 KZ(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(gy(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 G_=[{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 YZ(){const{organizationId:e}=gt(),[t,n]=x.useState("7d"),[a,s]=x.useState(null),[o,c]=x.useState(null),d=Ye({queryKey:["context-tree-snapshot",e,t],queryFn:()=>{if(!e)throw new Error("No organization selected");return KZ(e,t)},enabled:!!e}),m=d.data,h=x.useMemo(()=>m?m.updates.find(b=>b.id===a)??m.updates[0]??null:null,[a,m]),g=x.useMemo(()=>m&&h!=null&&h.nodeId?m.nodes.find(b=>b.id===h.nodeId)??null:null,[h,m]),p=o??(h==null?void 0:h.nodeId)??(g==null?void 0:g.id)??null;return x.useEffect(()=>{var b;m&&(a&&m.updates.some(w=>w.id===a)||s(((b=m.updates[0])==null?void 0:b.id)??null))},[a,m]),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:[d.isLoading?l.jsx(iG,{}):null,d.error?l.jsx(sG,{message:d.error instanceof Error?d.error.message:"Failed to load"}):null,m&&!d.isLoading?l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:m.snapshotStatus==="unavailable"?l.jsx(Q_,{snapshot:m}):l.jsxs(l.Fragment,{children:[l.jsx(XZ,{snapshot:m,window:t,onWindowChange:n}),l.jsx(WZ,{snapshot:m,selectedUpdate:h,selectedUpdateNode:g,selectedOverviewNodeId:p,onSelectUpdate:b=>{s(b.id),c(b.nodeId)},onSelectOverviewNode:c})]})}):null]})]})}function XZ({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?l.jsx(Iz,{size:18}):l.jsx(Ws,{size:18}),s=vG(t),o=e.contextStatus.label,c=xG(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:bG(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(Sf,{value:e.summary.changedNodeCount,label:`updates in the ${s}`}),l.jsx(Sf,{value:e.summary.addedCount,label:"added",tone:"added"}),l.jsx(Sf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),l.jsx(Sf,{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"}),G_.map(d=>l.jsx(ve,{variant:d.value===t?"default":"outline",size:"xs",onClick:()=>n(d.value),children:d.label},d.value))]})]})]})})})}function WZ({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=d=>{o(d);const m=e.updates.find(h=>h.nodeId===d);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(K_,{}):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(d=>l.jsx(JZ,{update:d,selected:d.id===(t==null?void 0:t.id),onClick:()=>s(d)},d.id))})})]}),l.jsx(eG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(tG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function JZ({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(V_,{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:jG(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",X_(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:AG(e.owners)}),e.relatedNodeIds.length>0?l.jsx("span",{children:RG(e.relatedNodeIds.length)}):null]})]})}function eG({update:e,node:t,snapshot:n}){const[a,s]=x.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(p=>n.nodes.find(b=>b.id===p)).filter(p=>!!p),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,d=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?TG(e.owners):"No owner",h=o&&o.length>0?o.map(p=>p.title||p.path||"root"):[],g=e?OG(e.path)||X_(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(V_,{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:[CG(e)," · ",SG(e.changeType)," · ",g]}),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(rG,{value:EG(e),impact:kG(e)})}),l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:l.jsx(aG,{commit:d,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(p=>!p)}})})]}):l.jsx(K_,{})})]})}function tG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=x.useMemo(()=>yG(e.nodes),[e.nodes]),s=x.useMemo(()=>cG(e.nodes,t,a),[t,e.nodes,a]),o=Math.max(760,...s.map(p=>p.x+280)),c=Math.max(280,...s.map(p=>p.y+48)),d=Math.max(220,c+24),m=360,h=d>m,g=mG(e.nodes,t);return l.jsxs(jn,{children:[l.jsx(la,{children:l.jsxs("div",{children:[l.jsxs(oa,{children:[l.jsx(qz,{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:s.length===0?l.jsx(Q_,{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:g??"No update selected"})]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(Mg,{color:"var(--accent)",label:"Selected path"}),l.jsx(Mg,{color:"var(--accent-bg)",label:"Updated"}),l.jsx(Mg,{color:"var(--bg-raised)",label:"Quiet / hidden"})]})]}),l.jsx("div",{style:{overflow:h?"auto":"hidden",maxHeight:h?`${m}px`:void 0},children:l.jsxs("svg",{viewBox:`0 0 ${o} ${c}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${d}px`},children:[s.map(p=>p.parent?l.jsx("line",{x1:p.parent.x,y1:p.parent.y,x2:p.x,y2:p.y,stroke:p.selectedPath&&p.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:p.muted?.34:p.selectedPath?.72:.56,strokeWidth:p.selectedPath&&p.parent.selectedPath?1.6:1},`edge:${p.id}`):null),s.map(p=>l.jsx("foreignObject",{x:p.x-10,y:p.y-15,width:o-p.x-8,height:30,children:l.jsxs("button",{type:"button",disabled:p.sourceNodeId===null,onClick:()=>{p.sourceNodeId&&n(p.sourceNodeId)},className:"flex w-full items-center text-left text-label",style:{color:p.muted?"var(--fg-3)":"var(--fg)",cursor:p.sourceNodeId?"pointer":"default",gap:"var(--sp-2)",opacity:p.muted?.66:1},children:[l.jsx("span",{"aria-hidden":"true",style:{width:p.selected?"var(--sp-4)":"var(--sp-3)",height:p.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:zG(p),border:`${p.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${p.selected?"var(--accent)":"var(--border-strong)"}`,flex:"0 0 auto"}}),l.jsx("span",{className:p.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.title}),p.updateCount>0&&!p.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:p.updateCount}):null]})},p.id))]})})]})})]})}function Mg({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 Sf({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?J_(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function nG({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?J_(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 V_({type:e}){return l.jsx(nG,{label:wG(e),tone:e})}function rG({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 aG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:o,onTogglePreview:c}){const d=[{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:d.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(oh,{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(Rh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function iG(){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(o3,{size:17}),"Loading team context..."]})})})}function sG({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 Q_({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?lG(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 lG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function K_(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const oG=2,uG=3;function cG(e,t,n){const a=dG(e,t,n);if(a.length===0)return[];const s=FZ().id(h=>h.id).parentId(h=>h.parentId)(a).sort((h,g)=>h.data.isSummary!==g.data.isSummary?h.data.isSummary?1:-1:h.data.path.localeCompare(g.data.path)),c=QZ().nodeSize([42,190])(s).descendants(),d=Math.min(...c.map(h=>h.x));return c.map(h=>({...h.data,x:28+h.y,y:28+h.x-d,parent:null})).map((h,g,p)=>({...h,parent:h.parentId?p.find(b=>b.id===h.parentId)??null:null}))}function dG(e,t,n){const a=new Map(e.map(b=>[b.id,b])),s=e.filter(b=>!b.parentId||a.has(b.parentId)).sort((b,w)=>b.path.localeCompare(w.path));if(s.length===0)return[];const o=fG(s),c=hG(t,a),d=new Set,m=new Map;for(const b of s){const w=Y_(b,a,m),S=n.get(b.id)??0;(w<=oG||c.has(b.id)||S>0&&w<=uG&&b.kind!=="leaf")&&pG(b.id,a,d)}const h=c.size>0,g=s.filter(b=>d.has(b.id)).map(b=>{const w=n.get(b.id)??0,S=c.has(b.id);return{id:b.id,parentId:b.parentId&&d.has(b.parentId)?b.parentId:null,sourceNodeId:b.id,title:b.title,path:b.path,changeType:b.changeType,updateCount:w,isSummary:!1,selected:t===b.id,selectedPath:S,muted:h&&!S&&w===0}}),p=[];for(const b of s){if(!d.has(b.id))continue;const w=(o.get(b.id)??[]).filter(j=>!d.has(j.id));if(w.length===0)continue;const S=w.filter(j=>(n.get(j.id)??0)>0).length;p.push({id:`summary:${b.id}`,parentId:b.id,sourceNodeId:null,title:gG(w.length,S),path:`${b.path}/~summary`,changeType:null,updateCount:S,isSummary:!0,selected:!1,selectedPath:c.has(b.id),muted:h&&!c.has(b.id)})}return[...g,...p]}function fG(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 hG(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 mG(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 pG(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function Y_(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?Y_(s,t,n)+1:0;return n.set(e.id,o),o}function gG(e,t){return t>0?`${e} hidden · ${t} updated`:`${e} hidden quiet area${e===1?"":"s"}`}function yG(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 vG(e){var t;return((t=G_.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function bG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function xG(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 wG(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function SG(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function kG(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 jG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function CG(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function EG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=_G(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function NG(e){return e.summary.replace(/^updated:\s*/i,"")}function _G(e){const t=NG(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 TG(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function AG(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function RG(e){return`${e} linked context${e===1?"":"s"}`}function OG(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(W_).join(" / ")}function X_(e){return e.split("/").filter(Boolean).map(W_).join(" / ")||"root"}function W_(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function J_(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function zG(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType||e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}const Ro=x.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=x.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 Bc=x.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-subtitle leading-none",e),...t}));Bc.displayName="CardTitle";const eT=x.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));eT.displayName="CardDescription";const zo=x.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("p-6 pt-0",e),...t}));zo.displayName="CardContent";const DG=x.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));DG.displayName="CardFooter";function MG(){const{token:e}=qj(),t=_n(),{isAuthenticated:n,adoptTokens:a}=gt(),[s,o]=x.useState(null),[c,d]=x.useState(null),[m,h]=x.useState(!1),[g,p]=x.useState(null);if(x.useEffect(()=>{e&&(async()=>{try{const E=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!E.ok){d("This invitation is no longer valid");return}o(await E.json())}catch{d("Network error while loading invitation")}})()},[e]),x.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);p((N==null?void 0:N.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(Mk,{message:"Bad invitation URL"});if(c)return l.jsx(Mk,{message:"This invitation is no longer valid"});if(!s)return l.jsx(IG,{});const b=async()=>{h(!0);try{const E=await Ee.post("/me/organizations/join",{token:e});await a(E.tokens),nC("invite"),t("/",{replace:!0})}catch(E){d(E instanceof Error?E.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,S=n&&g&&g!==s.organizationDisplayName,j=LG(s.expiresAt);return l.jsx(gb,{children:l.jsxs(Ro,{className:"w-full max-w-sm",children:[l.jsx(Oo,{className:"text-center",children:l.jsxs(Bc,{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:g})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(ve,{className:"w-full",disabled:m,onClick:b,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(ve,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:w,children:[l.jsx(cC,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&l.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.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 gb({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(Ac,{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(vv,{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 IG(){return l.jsx(gb,{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 Mk({message:e}){return l.jsx(gb,{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(Bc,{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(Ac,{to:"/",children:[l.jsx(vv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function LG(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 PG(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=dN(s);return o===B1&&s!==B1?null:o}function UG(){const{isAuthenticated:e}=gt(),t=kr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=PG(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(Ac,{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(vv,{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(Mc,{width:28,height:32})}),l.jsxs(Bc,{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(cC,{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(w3,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function BG(){const e=_n(),{adoptTokens:t}=gt(),[n,a]=x.useState(null);return x.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),c=o.get("access"),d=o.get("refresh"),m=dN(o.get("next")),h=o.get("joinPath");if(!c||!d){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&nC(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:d}),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 pc=x.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:ze("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));pc.displayName="DenseTable";const gc=x.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));gc.displayName="DenseTableHeader";const yc=x.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));yc.displayName="DenseTableBody";const na=x.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 Jt=x.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}));Jt.displayName="DenseTableHead";const pt=x.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 FG=1500;function $G({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:d="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,g]=x.useState(!1),p=async()=>{e&&(await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),FG))},b=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,b!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",b,"m"]})]}):"Generating token…"}),S=l.jsxs(ve,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(oh,{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]}),d&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:d}),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(HG,{}),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 HG(){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 qG=3e3,ZG=1200;function GG({open:e,onOpenChange:t}){const n=mn(),{user:a}=gt(),[s,o]=x.useState("loading"),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),b=x.useRef(new Set);return x.useEffect(()=>{if(!e){o("loading"),d(null),h(null),p(null),b.current=new Set;return}let w=!1;const S=(n.getQueryData(["clients"])??[]).map(j=>j.id);return b.current=new Set(S),(async()=>{try{const j=await hD();if(w)return;d(j),o("waiting")}catch(j){if(w)return;h(j instanceof Error?j.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),x.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const S=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:ls}),E=b.current,C=j.find(N=>!E.has(N.id)&&N.status==="connected"&&N.userId===a.id);C&&(p(C.hostname??null),o("success"))}catch{}},qG);return()=>clearInterval(S)},[e,s,n,a]),x.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},ZG);return()=>clearTimeout(w)},[s,t,n]),l.jsx(Mn,{open:e,onOpenChange:t,children:l.jsxs(An,{children:[l.jsxs(Zn,{children:[l.jsx(In,{children:"Connect computer"}),l.jsx(Av,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx($G,{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:g??"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 VG({embedded:e=!1}={}){const t=mn(),n=ph(),[a,s]=x.useState(()=>new Set),[o,c]=x.useState(null),[d,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(!1),{data:w}=Ye({queryKey:["clients"],queryFn:ls,refetchInterval:1e4}),{data:S}=Ye({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),j=wt({mutationFn:fD,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),E=wt({mutationFn:dD,onSuccess:()=>{m(null),g(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:R=>{R instanceof Rc?g(R.message):g(R instanceof Error?R.message:String(R))}}),C=x.useMemo(()=>{const R=new Map;for(const F of(S==null?void 0:S.agents)??[]){if(!F.clientId)continue;const U=R.get(F.clientId)??[];U.push(F),R.set(F.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,F)=>R+F.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:()=>b(!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(GG,{open:p,onOpenChange:b}),d&&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:d.hostname??d.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(d.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(d.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),g(null)},children:"Cancel"}),l.jsx(ve,{variant:"destructive",size:"sm",onClick:()=>E.mutate(d.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(fc,{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:()=>j.mutate(o.id),disabled:j.isPending,children:j.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(My,{children:["Registered · ",w.length]}),l.jsxs(pc,{children:[l.jsx(gc,{children:l.jsxs(na,{children:[l.jsx(Jt,{style:{width:16}}),l.jsx(Jt,{children:"Hostname"}),l.jsx(Jt,{children:"OS"}),l.jsx(Jt,{children:"SDK"}),l.jsx(Jt,{children:"Agents"}),l.jsx(Jt,{children:"Connected"}),l.jsx(Jt,{children:"Status"}),l.jsx(Jt,{"aria-hidden":!0})]})}),l.jsx(yc,{children:w.map(R=>{const F=!a.has(R.id),U=N(R.id);return l.jsx(eV,{client:R,boundAgents:U,isExpanded:F,agentName:n,onToggle:()=>s(V=>{const M=new Set(V);return M.has(R.id)?M.delete(R.id):M.add(R.id),M}),onDisconnect:()=>c(R),onRetire:()=>{g(null),m(R)},onReconnect:()=>b(!0)},R.id)})})]})]})]})]})}const QG={"claude-code":"Claude Code",codex:"Codex"},KG=[Qf.CLAUDE_CODE,Qf.CODEX],Ik={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},YG={"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 XG({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ye({queryKey:["client-capabilities",e],queryFn:()=>ch(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(Yv,{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:KG.map(o=>l.jsx(WG,{provider:o,entry:s?s[o]??null:null},o))})]})}function WG({provider:e,entry:t}){const n=QG[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 · ",Ik[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 ·"," ",YG[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 · ",Ik[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 JG(){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 eV({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:d}){const h=e.status!=="connected",g=e.authState!=="ok",p=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(bv,{className:"h-3.5 w-3.5"}):l.jsx(Dz,{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?sc(e.connectedAt):"—"}),l.jsx(pt,{children:g?l.jsx(JG,{}):l.jsx(fc,{state:p})}),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:g?"var(--state-error)":"var(--fg-2)"},onClick:b=>{b.stopPropagation(),d()},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:b=>{b.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:b=>{b.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(XG,{clientId:e.id,enabled:n}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(Yv,{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(b=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(b.agentId)}),l.jsx(fc,{state:b.runtimeState}),b.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[b.activeSessions," / ",b.totalSessions??0," sessions"]})]},b.agentId))})]})]})]})]})}function tV(){return l.jsx(VG,{embedded:!0})}function Do(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function yb(e){return Ee.get(Do(e,"context_tree"))}function tT(e,t){return Ee.put(Do(e,"context_tree"),t)}function nV(e){return Ee.get(Do(e,"github_integration"))}function rV(e,t){return Ee.put(Do(e,"github_integration"),t)}function nT(e){return Ee.get(Do(e,"source_repos"))}function rT(e,t){return Ee.put(Do(e,"source_repos"),t)}function vc({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:c="text",placeholder:d,rightSlot:m,readOnly:h=!1,pattern:g}){const p=x.useId(),b=`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:p,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(aV,{})]}),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:p,value:n,readOnly:!0,className:b,style:{...w,color:"var(--fg-2)"}}):l.jsx("input",{id:p,value:n,onChange:S=>a==null?void 0:a(S.target.value),type:c,placeholder:d,pattern:g,className:b,style:w}),m]})]})}function aV(){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 vb({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(dC,{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 iV({isFirst:e=!1}){var C,N;const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["org-setting",t,"github_integration"],queryFn:()=>t?nV(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=x.useState(""),[c,d]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(!1),b=((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):rV(t,{webhookSecret:O.length>0?O:null})},onSuccess:O=>{O&&(n.setQueryData(["org-setting",t,"github_integration"],O),o(""),d(!1),h(!0),setTimeout(()=>h(!1),2e3))}}),S=O=>{O.preventDefault(),w.mutate()},j=async()=>{b&&(await navigator.clipboard.writeText(b),p(!0),setTimeout(()=>p(!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:[b?l.jsx(vc,{label:"Webhook URL",hint:"Configure this URL in GitHub repo / org Settings → Webhooks. Never changes.",value:b,readOnly:!0,mono:!0,rightSlot:l.jsxs(ve,{type:"button",size:"sm",variant:"outline",onClick:j,children:[l.jsx(oh,{className:"h-3 w-3"}),g?"Copied":"Copy"]})}):l.jsx(sV,{}),E&&!c?l.jsx(lV,{saved:m,onReplace:()=>{d(!0),o("")}}):l.jsx(vc,{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(vb,{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 sV(){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 lV({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 oV(){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(iV,{isFirst:!0})})]})}function uV(){return Ee.get(Tn("/adapter-mappings"))}function cV(e){return Ee.post(Tn("/adapter-mappings"),e)}function dV(e){return Ee.delete(`/adapter-mappings/${e}`)}function fV(){return Ee.get(Tn("/adapters/status"))}function hV(){return Ee.get(Tn("/adapters"))}function mV(e){return Ee.post(Tn("/adapters"),e)}function pV(e,t){return Ee.patch(`/adapters/${e}`,t)}function gV(e){return Ee.delete(`/adapters/${e}`)}const yV=Object.values(l6),Lk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function Pk(e){const[t,n]=x.useState(Lk),[a,s]=x.useState("");x.useEffect(()=>{e.open&&(n({...Lk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(d){if(d.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=vV(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(Mn,{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:d=>n({...t,platform:d.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:yV.map(d=>l.jsx("option",{value:d,children:d},d))})]}),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:d=>n({...t,externalUserId:d.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:d=>n({...t,displayName:d.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:d=>n({...t,feishuAppId:d.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:d=>n({...t,feishuAppSecret:d.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:d=>n({...t,kaelUserId:d.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:d=>n({...t,kaelProjectId:d.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:d=>n({...t,credentialsJson:d.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:d=>n({...t,status:d.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 vV(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 bV(){var _;const e=_n(),t=mn(),[n,a]=sh(),s=n.get("agent"),o=ph(),c=Ye({queryKey:["adapters"],queryFn:hV}),d=Ye({queryKey:["adapter-mappings"],queryFn:uV}),m=Ye({queryKey:["adapter-statuses"],queryFn:fV,refetchInterval:15e3}),g=((_=Ye({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}).data)==null?void 0:_.items)??[],p=x.useMemo(()=>{const Z=new Map;for(const Q of m.data??[])Z.set(Q.configId,Q);return Z},[m.data]),b=x.useMemo(()=>{const Z=c.data??[];return s?Z.filter(Q=>Q.agentId===s):Z},[c.data,s]),w=x.useMemo(()=>{const Z=d.data??[];return s?Z.filter(Q=>Q.agentId===s):Z},[d.data,s]),S=b.reduce((Z,Q)=>{var ue;return Z+((ue=p.get(Q.id))!=null&&ue.connected?1:0)},0),j=b.length-S,E=c.isLoading||d.isLoading,[C,N]=x.useState(null),[O,z]=x.useState(""),[L,R]=x.useState(null),[F,U]=x.useState(null),[V,M]=x.useState(null),[Y,ae]=x.useState(null),xe=wt({mutationFn:Z=>mV({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),pV(Z.id,Q)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),X=wt({mutationFn:gV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),q=wt({mutationFn:Z=>cV({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:dV,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 D(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){!F||Z.kind!=="user-create"||q.mutate({agentId:F.agentId,platform:Z.draft.platform,externalUserId:Z.draft.externalUserId,displayName:Z.draft.displayName})}const P=s?g.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(My,{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(Xu,{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(Xu,{state:"offline",size:6})," ",j," 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 · ",b.length]}),E?l.jsx(kf,{children:"Loading…"}):b.length?l.jsxs(pc,{children:[l.jsx(gc,{children:l.jsxs(na,{children:[l.jsx(Jt,{children:"Agent"}),l.jsx(Jt,{children:"Platform"}),l.jsx(Jt,{children:"Status"}),l.jsx(Jt,{children:"Connection"}),l.jsx(Jt,{children:"Created"}),l.jsx(Jt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(yc,{children:b.map(Z=>{var ue;const Q=((ue=p.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(Xu,{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:sc(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:xV(Z.platform),initialStatus:wV(Z.status)}),children:"Edit"}),l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>M(Z.id),disabled:X.isPending,title:"Delete",children:l.jsx(Uf,{className:"h-3.5 w-3.5"})})]})]},Z.id)})})]}):l.jsx(kf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(jn,{children:[l.jsxs(My,{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(kf,{children:"Loading…"}):w.length?l.jsxs(pc,{children:[l.jsx(gc,{children:l.jsxs(na,{children:[l.jsx(Jt,{children:"Agent"}),l.jsx(Jt,{children:"Platform"}),l.jsx(Jt,{children:"External user ID"}),l.jsx(Jt,{children:"Display name"}),l.jsx(Jt,{children:"Bound via"}),l.jsx(Jt,{children:"Created"}),l.jsx(Jt,{style:{width:32}})]})}),l.jsx(yc,{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:sc(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(Uf,{className:"h-3.5 w-3.5"})})})]},Z.id))})]}):l.jsx(kf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(SV,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:g,agentId:O,onAgentChange:z,onCancel:()=>N(null),onConfirm:Ae}),l.jsx(Pk,{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:D}),l.jsx(Pk,{open:F!=null,kind:"user",editingId:null,agentLabel:F?o(F.agentId):"",pending:q.isPending,errorMessage:q.error instanceof Error?q.error.message:null,onOpenChange:Z=>{Z||(U(null),q.reset())},onSubmit:I}),l.jsx(Uk,{open:V!=null,onOpenChange:Z=>!Z&&M(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),M(null))}}),l.jsx(Uk,{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 xV(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function wV(e){return e==="inactive"?"inactive":"active"}function kf({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function SV(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(Mn,{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 Uk(e){return l.jsx(Mn,{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 kV({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(bV,{})})]})}function jV(){return l.jsx(kV,{embedded:!0})}function CV(){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(EV,{}),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 EV(){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 NV(){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(Pf,{})})]})}function Fu({to:e,label:t}){return l.jsx(mv,{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 Qy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Wl)}const Ig=200;function _V(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 TV(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Wl)}function aT(e){return e==="claude-code"||e==="codex"?e:null}function AV(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=aT(a);if(o)return o}return null}function RV(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function OV(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 zV({open:e,onOpenChange:t,onCreated:n}){const a=mn(),{refreshMe:s,organizationId:o}=gt(),[c,d]=x.useState(""),[m,h]=x.useState(""),[g,p]=x.useState(!1),[b,w]=x.useState("organization"),[S,j]=x.useState("claude-code"),[E,C]=x.useState(!1),[N,O]=x.useState([]),[z,L]=x.useState(!1),[R,F]=x.useState(null),[U,V]=x.useState(null),[M,Y]=x.useState(null),[ae,xe]=x.useState(null),[J,X]=x.useState(null),[q,te]=x.useState(null),[ke,Ae]=x.useState(!1),[D,I]=x.useState({}),[P,_]=x.useState({status:"idle"});x.useEffect(()=>{e&&(d(""),h(""),p(!1),w("organization"),j("claude-code"),C(!1),O([]),L(!1),F(null),V(null),Y(null),xe(null),X(null),te(null),Ae(!1),I({}),_({status:"idle"}))},[e]),x.useEffect(()=>{g||h(Qy(c))},[c,g]);const Z=x.useRef(0);x.useEffect(()=>{if(!e||!m){_({status:"idle"});return}if(!Oy.test(m)){_({status:"bad",reason:"invalid"});return}if(zy(m)){_({status:"bad",reason:"reserved"});return}const ie=++Z.current;_({status:"checking"});const ge=window.setTimeout(()=>{PI(m).then(Le=>{ie===Z.current&&(Le.available?_({status:"ok"}):_({status:"bad",reason:Le.reason}))}).catch(()=>{ie===Z.current&&_({status:"idle"})})},300);return()=>window.clearTimeout(ge)},[m,e]),x.useEffect(()=>{if(!e)return;let ie=!1;const ge=async()=>{try{const zt=await ls();if(ie)return;const $t=zt.filter(Ln=>Ln.status==="connected").sort((Ln,fr)=>fr.lastSeenAt.localeCompare(Ln.lastSeenAt));O($t),L(!0)}catch{ie||L(!0)}};ge();const Le=window.setInterval(ge,3e3);return()=>{ie=!0,window.clearInterval(Le)}},[e]),x.useEffect(()=>{if(N.length===0){F(null);return}F(ie=>{var ge;return ie&&N.some(Le=>Le.id===ie)?ie:((ge=N[0])==null?void 0:ge.id)??null})},[N]),x.useEffect(()=>{if(!R){V(null),Y(null);return}let ie=!1;const ge=async()=>{try{const zt=await ch(R);if(ie)return;V(zt.capabilities),Y(R)}catch{}};ge();const Le=window.setInterval(ge,3e3);return()=>{ie=!0,window.clearInterval(Le)}},[R]),x.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 ie=!1;return(async()=>{try{const ge=await Ee.post("/me/connect-tokens",{});if(ie)return;xe(ge.token),X(ge.command),te(Date.now()+ge.expiresIn*1e3)}catch{}})(),()=>{ie=!0}},[e,N.length,ae,q]);const Q=R&&M===R?U:null,ue=x.useMemo(()=>{if(!Q)return[];const ie=[];for(const[ge,Le]of Object.entries(Q)){if(Le.state!=="ok")continue;const zt=aT(ge);zt&&ie.push(zt)}return ie},[Q]);x.useEffect(()=>{Q&&j(ie=>{var ge;return((ge=Q[ie])==null?void 0:ge.state)==="ok"?ie:AV(Q)??ie})},[Q]);const je=wt({mutationFn:async ie=>{const ge=c.trim()||m.trim()||"Untitled assistant";return LI({name:m||void 0,type:"personal_assistant",displayName:ge,clientId:ie.clientId,runtimeProvider:S,visibility:b,...o?{organizationId:o}:{}})},onSuccess:ie=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(ie,S)}}),we=x.useMemo(()=>{const ie=je.error;if(!ie)return{};if(ie instanceof Rc){const ge=_V(ie.issues);return Object.keys(ge).length>0?ge:ie.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:ie.message}}return ie instanceof Error?{_root:ie.message}:{}},[je.error]),pe=P.status==="bad"?OV(P.reason):void 0,Me={...pe?{name:pe}:{},...we,...D};function Ue(){const ie={};return m?m.length>Wl?ie.name=`Agent name must be at most ${Wl} characters (got ${m.length}).`:Oy.test(m)?zy(m)&&(ie.name="That agent name is reserved — pick a different one."):ie.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(ie.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Ig&&(ie.displayName=`Display name must be at most ${Ig} characters (got ${c.length}).`),ie}function dt(ie){ie.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(Mn,{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:ie=>{d(ie.target.value),D.displayName&&I(ge=>({...ge,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Ig,"aria-invalid":Me.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."}),Me.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:Me.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&&Me.name&&l.jsx("p",{className:"text-caption text-destructive",children:Me.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:ie=>{const ge=TV(ie.target.value);h(ge),p(!0),D.name&&I(Le=>({...Le,name:void 0}))},onBlur:ie=>{const ge=Qy(ie.target.value);ge!==m&&h(ge)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Wl,"aria-invalid":Me.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&&!Me.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."]}),Me.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:Me.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:b==="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:b==="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:b==="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:b==="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(DV,{command:J,copied:ke,onCopy:async()=>{J&&(await navigator.clipboard.writeText(J),Ae(!0),window.setTimeout(()=>Ae(!1),1500))}}):N.length===1?l.jsx(MV,{client:N[0]}):l.jsx("div",{className:"space-y-2",children:N.map(ie=>{const ge=R===ie.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:()=>F(ie.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:ie.hostname??ie.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[ie.os??"unknown OS"," · last seen ",new Date(ie.lastSeenAt).toLocaleString()]})]})]},ie.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(ie=>{const ge=S===ie;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:()=>j(ie)}),l.jsx("span",{className:"text-body",children:RV(ie)})]},ie)})})]}),Me.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:Me.clientId})]}),Me._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Me._root}),l.jsx(Cr,{children:l.jsx(ve,{type:"submit",disabled:!re,children:je.isPending?"Creating…":"Create"})})]})]})})}function DV({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 MV({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 iT({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 IV(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 LV(){const{organizationId:e}=gt(),[t,n]=x.useState(null),[a,s]=x.useState(null),[o,c]=x.useState(!1),[d,m]=x.useState(!1);x.useEffect(()=>{e&&(async()=>{try{const g=await Ee.get(gy(e,"/invitations"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const g=await Ee.post(gy(e,"/invitations/rotate"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(Ro,{children:[l.jsxs(Oo,{children:[l.jsx(Bc,{children:"Invite link"}),l.jsxs(eT,{children:["Anyone with this link can join your team as a member. Links expire after ",K6," 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:d?"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?` · ${IV(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const bb=[{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 PV({groups:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){return l.jsxs(pc,{className:"table-fixed",children:[l.jsx(gc,{children:l.jsx(na,{children:bb.map(o=>l.jsx(Jt,{style:{width:o.width},"aria-hidden":o.key==="actions",children:o.label},o.key))})}),e.map(o=>l.jsx(UV,{group:o,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s},o.key))]})}function UV({group:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){const[o,c]=x.useState(!e.collapsible);return l.jsxs(yc,{children:[l.jsx(BV,{group:e,open:o,onToggle:()=>c(d=>!d)}),o&&e.rows.length===0&&e.emptyMessage&&l.jsx(na,{children:l.jsx(pt,{colSpan:bb.length,style:{color:"var(--fg-4)",textAlign:"center",padding:"var(--sp-4)"},children:e.emptyMessage})}),o&&e.rows.map(d=>d.kind==="human"?l.jsx(FV,{row:d,actions:a(d)},`h:${d.id}`):l.jsx($V,{row:d,runtime:t.get(d.agent.uuid)??null,actions:s(d),onClick:()=>n(d.agent.uuid)},`a:${d.agent.uuid}`))]})}function BV({group:e,open:t,onToggle:n}){return l.jsx(na,{children:l.jsx("td",{colSpan:bb.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 FV({row:e,actions:t}){return l.jsxs(na,{children:[l.jsx(pt,{children:l.jsx(sT,{icon:l.jsx(v3,{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:AC(e.createdAt)}),l.jsx(pt,{style:{padding:0,textAlign:"right"},children:l.jsx(lT,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function $V({row:e,runtime:t,actions:n,onClick:a}){const{agent:s,managerLabel:o,isOwnedBySelf:c}=e,m=s.visibility==="private"?l.jsx(xv,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}}):l.jsx(oC,{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(sT,{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(HV,{runtimeState:(t==null?void 0:t.runtimeState)??null,runtimeProvider:s.runtimeProvider})}),l.jsx(pt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:AC(s.createdAt)}),l.jsx(pt,{style:{padding:0,textAlign:"right"},onClick:h=>h.stopPropagation(),children:l.jsx(lT,{actions:n,ariaLabel:`Actions for ${s.displayName}`})})]})}function sT({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 HV({runtimeState:e,runtimeProvider:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:2},children:[l.jsx(fc,{state:e}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:t})]})}function lT({actions:e,ariaLabel:t}){const[n,a]=x.useState(!1),[s,o]=x.useState("down"),c=x.useRef(null),d=x.useRef(null);return x.useEffect(()=>{if(!n)return;const m=g=>{c.current&&!c.current.contains(g.target)&&a(!1)},h=g=>{g.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[n]),x.useEffect(()=>{if(!n||!d.current)return;const m=32,h=8,g=d.current.getBoundingClientRect(),p=window.innerHeight-g.bottom,b=e.length*m+h;o(p>=b?"down":"up")},[n,e.length]),e.length===0?null:l.jsxs("div",{ref:c,className:"relative inline-flex",children:[l.jsx("button",{ref:d,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 qV(){var D;const{role:e,memberId:t}=gt(),n=e==="admin",a=_n(),s=mn(),o=LN(),[c,d]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,w]=x.useState("all"),[S,j]=x.useState(""),E=Ye({queryKey:["members"],queryFn:IN}),C=Ye({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>n?MI({limit:100}):Dc({limit:100})}),{data:N}=Ye({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),O=x.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=x.useMemo(()=>E.data??[],[E.data]),L=x.useMemo(()=>{var I;return(((I=C.data)==null?void 0:I.items)??[]).filter(P=>P.type!=="human")},[(D=C.data)==null?void 0:D.items]),R=x.useMemo(()=>z.filter(I=>I.role==="admin").length,[z]),F=x.useMemo(()=>L.filter(I=>I.visibility==="organization"),[L]),U=x.useMemo(()=>L.filter(I=>I.visibility==="private"&&I.managerId===t),[L,t]),V=x.useMemo(()=>L.filter(I=>I.visibility==="private"&&I.managerId!==t),[L,t]),M=[`${z.length} ${Lg(z.length,"human")} (${R} ${Lg(R,"admin")})`,`${F.length} shared ${Lg(F.length,"agent")}`,`${U.length} of your private`].join(" · "),Y=wt({mutationFn:async I=>n9(I.id,I.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),ae=wt({mutationFn:r9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),xe=wt({mutationFn:_E,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),J=wt({mutationFn:TE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),X=wt({mutationFn:AE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),q=S.trim().toLowerCase(),te=x.useMemo(()=>VV({filter:b,search:q,isAdmin:n,selfMemberId:t,members:z,sharedAgents:F,yourPrivateAgents:U,otherPrivateAgents:V,resolveMember:o}),[b,q,n,t,z,F,U,V,o]);function ke(I){const P=[];return n&&P.push({key:"edit",label:"Edit profile",onSelect:()=>p({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:M,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:()=>d(!0),children:[l.jsx(hC,{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(GV,{filter:b,onFilter:w,query:S,onQuery:j,counts:{humans:z.length,shared:F.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: ",ZV(C.error??E.error)]}):l.jsx(PV,{groups:te,runtimeMap:O,onAgentClick:I=>a(`/agents/${encodeURIComponent(I)}`),getHumanActions:ke,getAgentActions:Ae})]}),l.jsx(Mn,{open:c,onOpenChange:d,children:l.jsxs(An,{children:[l.jsx(Zn,{children:l.jsx(In,{children:"Invite link"})}),l.jsx(LV,{})]})}),l.jsx(zV,{open:m,onOpenChange:h,onCreated:(I,P)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(KV,{target:g,isAdmin:n,isSaving:Y.isPending,onClose:()=>p(null),onSave:async I=>{g&&(await Y.mutateAsync({id:g.id,patch:I}),p(null))}})]})}function Lg(e,t){return e===1?t:`${t}s`}function ZV(e){return e instanceof Error?e.message:String(e)}function GV({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(iT,{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(uh,{"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 VV(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,sharedAgents:c,yourPrivateAgents:d,otherPrivateAgents:m}=e,h=R=>!n||R.displayName.toLowerCase().includes(n)||R.username.toLowerCase().includes(n),g=R=>!n||R.displayName.toLowerCase().includes(n)||(R.name??"").toLowerCase().includes(n),p=t==="admins",b=t==="all"||t==="humans"||t==="admins",w=t==="all"||t==="shared",S=t==="all"||t==="private",j=a&&t==="all",E=o.filter(h).filter(R=>!p||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(g).map(C),O=d.filter(g).map(C),z=m.filter(g).map(C),L=[];return b&&L.push({key:p?"admins":"humans",title:p?"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."}),j&&z.length>0&&L.push({key:"other-private",title:"Other members' private agents",count:z.length,rows:z,collapsible:!0}),L}const QV=Object.values(tB);function KV({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=x.useState(""),[d,m]=x.useState("member"),[h,g]=x.useState(null);x.useEffect(()=>{e&&(c(e.displayName),m(e.role),g(null))},[e]);async function p(w){if(w.preventDefault(),!e)return;const S={};if(o.trim()&&o!==e.displayName&&(S.displayName=o.trim()),t&&d!==e.role&&(S.role=d),Object.keys(S).length===0){a();return}try{await s(S)}catch(j){g(j instanceof Error?j.message:String(j))}}const b=e!==null;return l.jsx(Mn,{open:b,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:p,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:d,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:QV.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 YV({isFirst:e=!1}){const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?yb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=x.useState(""),[c,d]=x.useState(""),[m,h]=x.useState(!1);x.useEffect(()=>{a.data&&(o(a.data.repo??""),d(a.data.branch??"main"))},[a.data]);const g=wt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return tT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:b=>{n.setQueryData(["org-setting",t,"context_tree"],b),h(!0),setTimeout(()=>h(!1),2e3)}}),p=b=>{b.preventDefault(),g.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:p,children:[l.jsx(vc,{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(vc,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:d,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(vb,{pending:g.isPending,disabled:!a.data})}),g.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:g.error.message})]})})}function XV({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?nT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=wt({mutationFn:async g=>{var w;if(!t)throw new Error("organization not loaded");const b=(((w=o.data)==null?void 0:w.repos)??[]).filter(S=>S.url!==g);return rT(t,{repos:b})},onSuccess:g=>{s.setQueryData(["org-setting",t,"source_repos"],g)}}),d=((h=o.data)==null?void 0:h.repos)??[],m=d.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:d.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"}):d.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:d.map(g=>l.jsx(WV,{url:g.url,defaultBranch:g.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(g.url)},g.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 WV({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 JV(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function eQ(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function tQ({isFirst:e=!1}){const{organizationId:t}=gt(),n=mn(),a=Ye({queryKey:["organization",t],queryFn:()=>t?JV(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=x.useState(""),[c,d]=x.useState(!1);x.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=wt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const g=s.trim();return!g||g===a.data.displayName?Promise.resolve(a.data):eQ(t,{displayName:g})},onSuccess:g=>{n.setQueryData(["organization",t],g),n.invalidateQueries({queryKey:["me-organizations"]}),d(!0),setTimeout(()=>d(!1),2e3)}}),h=g=>{g.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(vc,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(vb,{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 nQ(){const{role:e}=gt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(tQ,{isFirst:!0}),t&&l.jsx(YV,{}),l.jsx(XV,{isFirst:!t})]})}function rQ(){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(nQ,{})})]})}function eh(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 aQ(e){return Ee.post(Tn("/chats"),e)}function iQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function oT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function sQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const th="draft";function lQ(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 d;return((d=s.find(m=>m.type===c))==null?void 0:d.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function oQ(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function uQ({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=x.useState("all"),[o,c]=x.useState(""),[d,m]=x.useState([]),[h,g]=x.useState(!1),[p,b]=x.useState(null),{data:w,isLoading:S}=Ye({queryKey:["me","chats",a],queryFn:()=>eh({filter:a}),refetchInterval:15e3}),j=()=>{d.length>0&&m([]),b(null)},E=(w==null?void 0:w.rows)??[],C=x.useMemo(()=>[...E,...d],[E,d]),N=x.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){g(!0),b(null);try{const V=await eh({filter:a,cursor:U});m(M=>[...M,...V.rows]),L(V.nextCursor)}catch(V){b(V instanceof Error?V.message:"Failed to load more")}finally{g(!1)}}},[z,L]=x.useState(null),R=(w==null?void 0:w.nextCursor)??null;x.useEffect(()=>{L(R)},[R]);const F=x.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===th?"var(--bg-active)":"transparent",color:e===th?"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:F>0&&l.jsx(iT,{active:a==="unread",count:F,onClick:()=>{s(a==="unread"?"all":"unread"),j()},children:"unread"})}),l.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[l.jsx(uh,{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,M=oQ(U),Y=M&&M!==U.title?M:"",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:lQ(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"}),p&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:p})]})]})]})}function uT(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function cQ(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 dQ(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function fQ(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 xb(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function hQ(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 wb(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 mQ(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Sb({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}),mQ(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function pQ(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 gQ(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 yQ(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,d=o.length===0||!/\s/.test(o[0]??""),m=d?` ${o}`:o,h=`${s}${c}${m}`,g=s.length+c.length+(d?1:0);return{text:h,cursor:g}}function cT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=x.useState(0),[d,m]=x.useState(null),h=x.useMemo(()=>s?null:pQ(e,t),[e,t,s]),g=x.useMemo(()=>h?gQ(n,h.query):[],[h,n]),p=h?`${h.triggerIndex}:${h.query}`:"";x.useEffect(()=>{c(0)},[p]),x.useEffect(()=>{h===null&&d!==null&&m(null)},[h,d]);const b=d!==null&&h!==null&&d===h.triggerIndex,w=h!==null&&g.length>0&&!b;function S(){m((h==null?void 0:h.triggerIndex)??null)}function j(C){if(!h)return;const N=yQ(e,h,t,C);N&&a(N)}return{trigger:w?h:null,results:w?g:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(N=>g.length===0?0:(N+1)%g.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(N=>g.length===0?0:(N-1+g.length)%g.length),!0;if(C.key==="Enter"||C.key==="Tab"){const N=g[o]??g[0];return N?(C.preventDefault(),j(N),!0):!1}return C.key==="Escape"?(C.preventDefault(),S(),!0):!1},pick:j,dismiss:S}}function dT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=x.useRef(null);return x.useEffect(()=>{var m;const d=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);d==null||d.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 d=wb(t);return t.map((m,h)=>{const g=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":g,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:p=>{p.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:g?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Sb,{candidate:m,ambiguous:d})},m.agentId)})})()})}function vQ({onCreated:e}){const t=mn(),{agentId:n}=gt(),a=Ov(),[s,o]=x.useState([]),[c,d]=x.useState(""),[m,h]=x.useState(0),[g,p]=x.useState(null),[b,w]=x.useState(!1),[S,j]=x.useState(!1),E=x.useRef(null),C=x.useRef(!1),N=x.useRef(null),{data:O}=Ye({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),z=x.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]);x.useEffect(()=>{if(C.current||s.length>0||z.length===0)return;const J=xQ(z,(O==null?void 0:O.agents)??[]);J&&(o([J]),C.current=!0)},[z,O,s.length]);const L=x.useMemo(()=>{const J=z.map(X=>({agentId:X.agentId,name:X.name}));return cN(c,J)},[c,z]),R=cT({value:c,cursor:m,candidates:z,disabled:b,onSelect:J=>{d(J.text),h(J.cursor),requestAnimationFrame(()=>{const X=E.current;X&&(X.focus(),X.setSelectionRange(J.cursor,J.cursor))})}});x.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]),x.useEffect(()=>{if(!S)return;const J=X=>{N.current&&(N.current.contains(X.target)||j(!1))};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[S]);const F=wt({mutationFn:async({participantIds:J,text:X})=>{const q=await aQ({participantIds:J}),te=X.trim();return te.length>0&&await ko(q.chatId,te),q.chatId},onSuccess:J=>{d(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(J)},onError:J=>{p(J instanceof Error?J.message:"Failed to create chat")}}),U=x.useMemo(()=>!(b||F.isPending||s.length===0||c.trim().length===0||s.length>=2&&L.length===0),[b,F.isPending,s.length,c,L.length]),V=x.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]),M=async()=>{if(!U)return;const J=Array.from(new Set([...s,...L]));p(null),w(!0);try{await F.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]),j(!1)},xe=x.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(bQ,{chips:s,candidates:z,chipCandidates:xe,pickerOpen:S,setPickerOpen:j,pickerContainerRef:N,onAdd:ae,onRemove:Y}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(dT,{trigger:R.trigger,results:R.results,highlightIndex:R.highlightIndex,anchorRef:E,onPick:R.pick}),l.jsx("textarea",{ref:E,value:c,onChange:J=>{d(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(),M())},disabled:b||F.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 M(),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(lC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),g&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:g})]})})})}function bQ({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:d}){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(p=>p.agentId===m),g=(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:g}),l.jsx("button",{type:"button",onClick:()=>d(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=wb(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(Sb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function xQ(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,d)=>(d.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 wQ="first-tree-hub-images",SQ=1,jo="images";let jf=null;function fT(){return jf||(jf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(wQ,SQ);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)}),jf)}async function kQ(e){const t=await fT();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 jQ(e){const t=await fT();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 CQ(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:hT,setPrototypeOf:Bk,isFrozen:EQ,getPrototypeOf:NQ,getOwnPropertyDescriptor:_Q}=Object;let{freeze:dr,seal:aa,create:Ql}=Object,{apply:Ky,construct:Yy}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});aa||(aa=function(t){return t});Ky||(Ky=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)});Yy||(Yy=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 $u=Cn(Array.prototype.forEach),TQ=Cn(Array.prototype.lastIndexOf),Fk=Cn(Array.prototype.pop),Hu=Cn(Array.prototype.push),AQ=Cn(Array.prototype.splice),sr=Array.isArray,Ku=Cn(String.prototype.toLowerCase),Pg=Cn(String.prototype.toString),$k=Cn(String.prototype.match),ql=Cn(String.prototype.replace),Hk=Cn(String.prototype.indexOf),RQ=Cn(String.prototype.trim),OQ=Cn(Number.prototype.toString),zQ=Cn(Boolean.prototype.toString),qk=typeof BigInt>"u"?null:Cn(BigInt.prototype.toString),Zk=typeof Symbol>"u"?null:Cn(Symbol.prototype.toString),rn=Cn(Object.prototype.hasOwnProperty),qu=Cn(Object.prototype.toString),Hn=Cn(RegExp.prototype.test),Cf=DQ(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 Ky(e,t,a)}}function DQ(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Yy(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ku;if(Bk&&Bk(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&&(EQ(t)||(t[a]=o),s=o)}e[s]=!0}return e}function MQ(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 hT(e))rn(e,n)&&(sr(a)?t[n]=MQ(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=xr(a):t[n]=a);return t}function IQ(e){switch(typeof e){case"string":return e;case"number":return OQ(e);case"boolean":return zQ(e);case"bigint":return qk?qk(e):"0";case"symbol":return Zk?Zk(e):"Symbol()";case"undefined":return qu(e);case"function":case"object":{if(e===null)return qu(e);const t=e,n=Kl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:qu(a)}return qu(e)}default:return qu(e)}}function Kl(e,t){for(;e!==null;){const a=_Q(e,t);if(a){if(a.get)return Cn(a.get);if(typeof a.value=="function")return Cn(a.value)}e=NQ(e)}function n(){return null}return n}function LQ(e){try{return Hn(e,""),!0}catch{return!1}}const Gk=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"]),Ug=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"]),Bg=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"]),PQ=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"]),Fg=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"]),UQ=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Vk=dr(["#text"]),Qk=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"]),$g=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"]),Kk=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"]),Ef=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),BQ=aa(/\{\{[\w\W]*|[\w\W]*\}\}/gm),FQ=aa(/<%[\w\W]*|[\w\W]*%>/gm),$Q=aa(/\$\{[\w\W]*/gm),HQ=aa(/^data-[\-\w.\u00B7-\uFFFF]+$/),qQ=aa(/^aria-[\-\w]+$/),mT=aa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ZQ=aa(/^(?:\w+script|data):/i),GQ=aa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pT=aa(/^html$/i),VQ=aa(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yk=Object.freeze({__proto__:null,ARIA_ATTR:qQ,ATTR_WHITESPACE:GQ,CUSTOM_ELEMENT:VQ,DATA_ATTR:HQ,DOCTYPE_NAME:pT,ERB_EXPR:FQ,IS_ALLOWED_URI:mT,IS_SCRIPT_OR_DATA:ZQ,MUSTACHE_EXPR:BQ,TMPLIT_EXPR:$Q});const Zu={element:1,text:3,progressingInstruction:7,comment:8,document:9},QQ=function(){return typeof window>"u"?null:window},KQ=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}},Xk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:QQ();const t=Pe=>gT(Pe);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Zu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:d,Element:m,NodeFilter:h,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:b,trustedTypes:w}=e,S=m.prototype,j=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:F,createDocumentFragment:U,getElementsByTagName:V}=n,{importNode:M}=a;let Y=Xk();t.isSupported=typeof hT=="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}=Yk;let{IS_ALLOWED_URI:D}=Yk,I=null;const P=We({},[...Gk,...Ug,...Bg,...Fg,...Vk]);let _=null;const Z=We({},[...Qk,...$g,...Kk,...Ef]);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,Me=!0,Ue=!1,dt=!0,ot=!1,re=!0,ie=!1,ge=!1,Le=!1,zt=!1,$t=!1,Ln=!1,fr=!0,hi=!1;const mi="user-content-";let on=!0,ua=!1,oe={},ye=null;const Fe=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 rt=Tt,nr=!1,Rn=null;const al=We({},[Ht,Lt,Tt],Pg);let ca=We({},["mi","mo","mn","ms","mtext"]),da=We({},["annotation-xml"]);const za=We({},["title","style","font","a","script"]);let Gn=null;const Da=["application/xhtml+xml","text/html"],wa="text/html";let qt=null,Ce=null;const et=n.createElement("form"),pn=function($){return $ instanceof RegExp||$ instanceof Function},_r=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ce&&Ce===$)return;(!$||typeof $!="object")&&($={}),$=xr($),Gn=Da.indexOf($.PARSER_MEDIA_TYPE)===-1?wa:$.PARSER_MEDIA_TYPE,qt=Gn==="application/xhtml+xml"?Pg:Ku,I=rn($,"ALLOWED_TAGS")&&sr($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,qt):P,_=rn($,"ALLOWED_ATTR")&&sr($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,qt):Z,Rn=rn($,"ALLOWED_NAMESPACES")&&sr($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Pg):al,un=rn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)?We(xr(tr),$.ADD_URI_SAFE_ATTR,qt):tr,Ve=rn($,"ADD_DATA_URI_TAGS")&&sr($.ADD_DATA_URI_TAGS)?We(xr(nt),$.ADD_DATA_URI_TAGS,qt):nt,ye=rn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,qt):Fe,ue=rn($,"FORBID_TAGS")&&sr($.FORBID_TAGS)?We({},$.FORBID_TAGS,qt):xr({}),je=rn($,"FORBID_ATTR")&&sr($.FORBID_ATTR)?We({},$.FORBID_ATTR,qt):xr({}),oe=rn($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?xr($.USE_PROFILES):$.USE_PROFILES:!1,pe=$.ALLOW_ARIA_ATTR!==!1,Me=$.ALLOW_DATA_ATTR!==!1,Ue=$.ALLOW_UNKNOWN_PROTOCOLS||!1,dt=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ot=$.SAFE_FOR_TEMPLATES||!1,re=$.SAFE_FOR_XML!==!1,ie=$.WHOLE_DOCUMENT||!1,zt=$.RETURN_DOM||!1,$t=$.RETURN_DOM_FRAGMENT||!1,Ln=$.RETURN_TRUSTED_TYPE||!1,Le=$.FORCE_BODY||!1,fr=$.SANITIZE_DOM!==!1,hi=$.SANITIZE_NAMED_PROPS||!1,on=$.KEEP_CONTENT!==!1,ua=$.IN_PLACE||!1,D=LQ($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:mT,rt=typeof $.NAMESPACE=="string"?$.NAMESPACE:Tt,ca=rn($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?xr($.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),da=rn($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?xr($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const me=rn($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?xr($.CUSTOM_ELEMENT_HANDLING):Ql(null);if(Q=Ql(null),rn(me,"tagNameCheck")&&pn(me.tagNameCheck)&&(Q.tagNameCheck=me.tagNameCheck),rn(me,"attributeNameCheck")&&pn(me.attributeNameCheck)&&(Q.attributeNameCheck=me.attributeNameCheck),rn(me,"allowCustomizedBuiltInElements")&&typeof me.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=me.allowCustomizedBuiltInElements),ot&&(Me=!1),$t&&(zt=!0),oe&&(I=We({},Vk),_=Ql(null),oe.html===!0&&(We(I,Gk),We(_,Qk)),oe.svg===!0&&(We(I,Ug),We(_,$g),We(_,Ef)),oe.svgFilters===!0&&(We(I,Bg),We(_,$g),We(_,Ef)),oe.mathMl===!0&&(We(I,Fg),We(_,Kk),We(_,Ef))),we.tagCheck=null,we.attributeCheck=null,rn($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?we.tagCheck=$.ADD_TAGS:sr($.ADD_TAGS)&&(I===P&&(I=xr(I)),We(I,$.ADD_TAGS,qt))),rn($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?we.attributeCheck=$.ADD_ATTR:sr($.ADD_ATTR)&&(_===Z&&(_=xr(_)),We(_,$.ADD_ATTR,qt))),rn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)&&We(un,$.ADD_URI_SAFE_ATTR,qt),rn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)&&(ye===Fe&&(ye=xr(ye)),We(ye,$.FORBID_CONTENTS,qt)),rn($,"ADD_FORBID_CONTENTS")&&sr($.ADD_FORBID_CONTENTS)&&(ye===Fe&&(ye=xr(ye)),We(ye,$.ADD_FORBID_CONTENTS,qt)),on&&(I["#text"]=!0),ie&&We(I,["html","head","body"]),I.table&&(We(I,["tbody"]),delete ue.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=$.TRUSTED_TYPES_POLICY,L=z.createHTML("")}else z===void 0&&(z=KQ(w,s)),z!==null&&typeof L=="string"&&(L=z.createHTML(""));dr&&dr($),Ce=$},pi=We({},[...Ug,...Bg,...PQ]),gs=We({},[...Fg,...UQ]),$c=function($){let me=O($);(!me||!me.tagName)&&(me={namespaceURI:rt,tagName:"template"});const Ne=Ku($.tagName),bt=Ku(me.tagName);return Rn[$.namespaceURI]?$.namespaceURI===Lt?me.namespaceURI===Tt?Ne==="svg":me.namespaceURI===Ht?Ne==="svg"&&(bt==="annotation-xml"||ca[bt]):!!pi[Ne]:$.namespaceURI===Ht?me.namespaceURI===Tt?Ne==="math":me.namespaceURI===Lt?Ne==="math"&&da[bt]:!!gs[Ne]:$.namespaceURI===Tt?me.namespaceURI===Lt&&!da[bt]||me.namespaceURI===Ht&&!ca[bt]?!1:!gs[Ne]&&(za[Ne]||!pi[Ne]):!!(Gn==="application/xhtml+xml"&&Rn[$.namespaceURI]):!1},rr=function($){Hu(t.removed,{element:$});try{O($).removeChild($)}catch{E($)}},fa=function($,me){try{Hu(t.removed,{attribute:me.getAttributeNode($),from:me})}catch{Hu(t.removed,{attribute:null,from:me})}if(me.removeAttribute($),$==="is")if(zt||$t)try{rr(me)}catch{}else try{me.setAttribute($,"")}catch{}},Io=function($){let me=null,Ne=null;if(Le)$="<remove></remove>"+$;else{const Wt=$k($,/^[\r\n\t ]+/);Ne=Wt&&Wt[0]}Gn==="application/xhtml+xml"&&rt===Tt&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const bt=z?z.createHTML($):$;if(rt===Tt)try{me=new b().parseFromString(bt,Gn)}catch{}if(!me||!me.documentElement){me=R.createDocument(rt,"template",null);try{me.documentElement.innerHTML=nr?L:bt}catch{}}const ft=me.body||me.documentElement;return $&&Ne&&ft.insertBefore(n.createTextNode(Ne),ft.childNodes[0]||null),rt===Tt?V.call(me,ie?"html":"body")[0]:ie?me.documentElement:ft},Lo=function($){return F.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Fr=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof g)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},cn=function($){return typeof d=="function"&&$ instanceof d};function Zt(Pe,$,me){$u(Pe,Ne=>{Ne.call(t,$,me,Ce)})}const Ma=function($){let me=null;if(Zt(Y.beforeSanitizeElements,$,null),Fr($))return rr($),!0;const Ne=qt($.nodeName);if(Zt(Y.uponSanitizeElement,$,{tagName:Ne,allowedTags:I}),re&&$.hasChildNodes()&&!cn($.firstElementChild)&&Hn(/<[/\w!]/g,$.innerHTML)&&Hn(/<[/\w!]/g,$.textContent)||re&&$.namespaceURI===Tt&&Ne==="style"&&cn($.firstElementChild)||$.nodeType===Zu.progressingInstruction||re&&$.nodeType===Zu.comment&&Hn(/<[/\w]/g,$.data))return rr($),!0;if(ue[Ne]||!(we.tagCheck instanceof Function&&we.tagCheck(Ne))&&!I[Ne]){if(!ue[Ne]&&Hc(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($)||$.parentNode,ft=N($)||$.childNodes;if(ft&&bt){const Wt=ft.length;for(let Pn=Wt-1;Pn>=0;--Pn){const gn=j(ft[Pn],!0);bt.insertBefore(gn,C($))}}}return rr($),!0}return $ instanceof m&&!$c($)||(Ne==="noscript"||Ne==="noembed"||Ne==="noframes")&&Hn(/<\/no(script|embed|frames)/i,$.innerHTML)?(rr($),!0):(ot&&$.nodeType===Zu.text&&(me=$.textContent,$u([ae,xe,J],bt=>{me=ql(me,bt," ")}),$.textContent!==me&&(Hu(t.removed,{element:$.cloneNode()}),$.textContent=me)),Zt(Y.afterSanitizeElements,$,null),!1)},il=function($,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,$);if(!(Me&&!je[me]&&Hn(X,me))){if(!(pe&&Hn(q,me))){if(!bt||je[me]){if(!(Hc($)&&(Q.tagNameCheck instanceof RegExp&&Hn(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($))&&(Q.attributeNameCheck instanceof RegExp&&Hn(Q.attributeNameCheck,me)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(me,$))||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(D,ql(Ne,ke,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&$!=="script"&&Hk(Ne,"data:")===0&&Ve[$])){if(!(Ue&&!Hn(te,ql(Ne,ke,"")))){if(Ne)return!1}}}}}}return!0},zh=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Hc=function($){return!zh[Ku($)]&&Hn(Ae,$)},Po=function($){Zt(Y.beforeSanitizeAttributes,$,null);const{attributes:me}=$;if(!me||Fr($))return;const Ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let bt=me.length;for(;bt--;){const ft=me[bt],{name:Wt,namespaceURI:Pn,value:gn}=ft,On=qt(Wt),Uo=gn;let dn=Wt==="value"?Uo:RQ(Uo);if(Ne.attrName=On,Ne.attrValue=dn,Ne.keepAttr=!0,Ne.forceKeepAttr=void 0,Zt(Y.uponSanitizeAttribute,$,Ne),dn=Ne.attrValue,hi&&(On==="id"||On==="name")&&Hk(dn,mi)!==0&&(fa(Wt,$),dn=mi+dn),re&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,dn)){fa(Wt,$);continue}if(On==="attributename"&&$k(dn,"href")){fa(Wt,$);continue}if(Ne.forceKeepAttr)continue;if(!Ne.keepAttr){fa(Wt,$);continue}if(!dt&&Hn(/\/>/i,dn)){fa(Wt,$);continue}ot&&$u([ae,xe,J],qc=>{dn=ql(dn,qc," ")});const Bo=qt($.nodeName);if(!il(Bo,On,dn)){fa(Wt,$);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?$.setAttributeNS(Pn,Wt,dn):$.setAttribute(Wt,dn),Fr($)?rr($):Fk(t.removed)}catch{fa(Wt,$)}}Zt(Y.afterSanitizeAttributes,$,null)},gi=function($){let me=null;const Ne=Lo($);for(Zt(Y.beforeSanitizeShadowDOM,$,null);me=Ne.nextNode();)Zt(Y.uponSanitizeShadowNode,me,null),Ma(me),Po(me),me.content instanceof o&&gi(me.content);Zt(Y.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Pe){let $=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=IQ(Pe),typeof Pe!="string"))throw Cf("dirty is not a string, aborting");if(!t.isSupported)return Pe;if(ge||_r($),t.removed=[],typeof Pe=="string"&&(ua=!1),ua){const gn=Pe.nodeName;if(typeof gn=="string"){const On=qt(gn);if(!I[On]||ue[On])throw Cf("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof d)me=Io("<!---->"),Ne=me.ownerDocument.importNode(Pe,!0),Ne.nodeType===Zu.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?me=Ne:me.appendChild(Ne);else{if(!zt&&!ot&&!ie&&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 Wt=Lo(ua?Pe:me);for(;bt=Wt.nextNode();)Ma(bt),Po(bt),bt.content instanceof o&&gi(bt.content);if(ua)return Pe;if(zt){if(ot){me.normalize();let gn=me.innerHTML;$u([ae,xe,J],On=>{gn=ql(gn,On," ")}),me.innerHTML=gn}if($t)for(ft=U.call(me.ownerDocument);me.firstChild;)ft.appendChild(me.firstChild);else ft=me;return(_.shadowroot||_.shadowrootmode)&&(ft=M.call(a,ft,!0)),ft}let Pn=ie?me.outerHTML:me.innerHTML;return ie&&I["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&Hn(pT,me.ownerDocument.doctype.name)&&(Pn="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
397
+ `+Pn),ot&&$u([ae,xe,J],gn=>{Pn=ql(Pn,gn," ")}),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,$,me){Ce||_r({});const Ne=qt(Pe),bt=qt($);return il(Ne,bt,me)},t.addHook=function(Pe,$){typeof $=="function"&&Hu(Y[Pe],$)},t.removeHook=function(Pe,$){if($!==void 0){const me=TQ(Y[Pe],$);return me===-1?void 0:AQ(Y[Pe],me,1)[0]}return Fk(Y[Pe])},t.removeHooks=function(Pe){Y[Pe]=[]},t.removeAllHooks=function(){Y=Xk()},t}var YQ=gT();function XQ({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=x.useMemo(()=>!e.preview||t!=="html"?null:YQ.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(Rh,{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 Gu(){return{picked:[],freeText:""}}function Wk(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 WQ({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",d=s==="superseded",[m,h]=x.useState(()=>{const E={};for(const C of n.questions)E[C.question]=Gu();return E});x.useEffect(()=>{if(!a)return;const E={};for(const C of n.questions){const N=a.answers[C.question];if(!N){E[C.question]=Gu();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 g=mn(),[p,b]=x.useState(null),w=wt({mutationFn:async E=>CQ(e,n.correlationId,E),onSuccess:()=>{b(null),g.invalidateQueries({queryKey:["chat-messages",e]})},onError:E=>{b(E instanceof Error?E.message:String(E))}}),S=x.useCallback(()=>{b(null);const E={};for(const C of n.questions){const N=m[C.question]??Gu(),O=Wk(C,N);if(O===null){b(`Please answer "${C.question}" before submitting.`);return}E[C.question]=O}w.mutate(E)},[n.questions,m,w]),j=x.useMemo(()=>n.questions.every(E=>{const C=m[E.question]??Gu();return Wk(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,d?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(JQ,{question:E,previewFormat:n.previewFormat,selection:m[E.question]??Gu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||d,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:[p?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:p}):null,l.jsx(ve,{type:"button",disabled:!j||w.isPending,onClick:S,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function JQ({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const d=x.useRef(null),m=n.picked.includes(Jl);x.useEffect(()=>{var g;m&&!s&&((g=d.current)==null||g.focus())},[m,s]);const h=x.useCallback(g=>{const p=n.picked.includes(g);let b;e.multiSelect?b=p?n.picked.filter(w=>w!==g):[...n.picked,g]:b=p?[]:[g],c({...n,picked:b})},[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(g=>l.jsx(XQ,{option:g,previewFormat:t,selected:n.picked.includes(g.label),disabled:s,showCheckmark:o,onToggle:()=>h(g.label)},g.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(g=>g!==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:d,value:n.freeText,disabled:s,onChange:g=>c({...n,freeText:g.target.value}),onClick:g=>g.stopPropagation(),onKeyDown:g=>{g.key==="Enter"&&!g.metaKey&&!g.ctrlKey&&g.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 eK(e){return SB.safeParse(e).success}function yT(e){return kB.safeParse(e).success}function tK(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=Jk(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=Jk(s.payload);return o?a.get(o)===s.seq:!0})}function Jk(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Mo(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 nK(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function ej(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function rK({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 aK({event:e}){const t=mD(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?ej(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:["(",ej(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:["· ",nK(t.durationMs)]}):null]})]})}function iK({event:e,agentNameFn:t,agentId:n}){const a=gD(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(Oh,{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:Mo(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 sK({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:Mo(e.createdAt)})]})}function lK({event:e}){const t=pD(e.payload),n=Mo(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 Oh({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(Mc,{width:9,height:10,style:{color:"var(--accent)"}})})}function oK({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(Oh,{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:Mo(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(rK,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&uK(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"&&cK(e.content)?l.jsx(dK,{content:e.content}):e.format==="text"?l.jsx(Rh,{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 uK(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 cK(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 dK({content:e}){const[t,n]=x.useState({kind:"loading"});return x.useEffect(()=>{let a=!1;return jQ(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 fK({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(Oh,{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:Mo(e.createdAt)})]}),l.jsx(WQ,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function hK({msg:e,agentNameFn:t}){const n=yT(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(Oh,{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:Mo(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 tj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var ot;const o=mn(),c=ph(),d=Ov(),{agentId:m}=gt(),[h,g]=x.useState(""),[p,b]=x.useState(0),[w,S]=x.useState([]),[j,E]=x.useState(!1),[C,N]=x.useState(null),O=x.useRef(null),z=x.useRef(null),L=x.useRef(null),R=x.useRef(!1),F=x.useRef(new Set);x.useEffect(()=>{R.current=!1},[t]);const{data:U}=Ye({queryKey:["chat-messages",t],queryFn:()=>hQ(t,{limit:50}),refetchInterval:5e3}),{data:V}=Ye({queryKey:["session-events",e,t],queryFn:()=>yD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:M}=Ye({queryKey:["chat-detail",t],queryFn:()=>uT(t),enabled:!!t}),{data:Y}=Ye({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),ae=wt({mutationFn:re=>ko(t,re),onSuccess:()=>{g(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:XS(e)})}}),xe=x.useCallback(re=>{const ge=re.filter($t=>$t.type.startsWith("image/"));if(ge.length===0)return;const Le=ge.find($t=>$t.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($t=>({id:crypto.randomUUID(),file:$t,previewUrl:URL.createObjectURL($t)}));S($t=>[...$t,...zt]),N(null)},[]),J=x.useCallback(re=>{S(ie=>{const ge=ie.find(Le=>Le.id===re);return ge&&URL.revokeObjectURL(ge.previewUrl),ie.filter(Le=>Le.id!==re)})},[]),X=async()=>{const re=h.trim(),ie=w;if(!(!re&&ie.length===0)&&!j&&!(pe&&Me.length===0)){if(Ue.length>0)try{await oT(t,{participantIds:Ue}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(ge){N(ge instanceof Error?ge.message:"Failed to add participants");return}if(ie.length>0){E(!0),N(null);try{for(const ge of ie){const Le=await fQ(ge.file),zt=crypto.randomUUID();await kQ({imageId:zt,base64:Le,mimeType:ge.file.type}),await dQ(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),g(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:XS(e)})}catch(ge){N(ge instanceof Error?ge.message:"Failed to send image")}finally{E(!1)}return}ae.mutate(re)}},[q,te]=x.useState(!1),[ke,Ae]=x.useState(""),D=x.useRef(null);x.useEffect(()=>{var re;q&&((re=D.current)==null||re.focus())},[q]);const I=wt({mutationFn:re=>cQ(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)},_=x.useMemo(()=>{const re=(U==null?void 0:U.items)??[],ie=tK((V==null?void 0:V.items)??[]),ge=[...re.map(Le=>({kind:"message",at:Le.createdAt,key:`m-${Le.id}`,data:Le})),...ie.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=x.useMemo(()=>{const re=new Map;for(const ie of(U==null?void 0:U.items)??[])ie.format==="question_answer"&&yT(ie.content)&&re.set(ie.content.correlationId,ie.content);return re},[U]),Q=_.length;x.useEffect(()=>{var re;Q>0&&((re=L.current)==null||re.scrollIntoView({behavior:"smooth"}))},[Q]);const ue=c(e),je=x.useMemo(()=>{var re;return new Set(((re=M==null?void 0:M.participants)==null?void 0:re.map(ie=>ie.agentId))??[])},[M==null?void 0:M.participants]),we=x.useMemo(()=>{const re=new Set;for(const ge of(M==null?void 0:M.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 ie=[];for(const ge of re){if(ge===m)continue;const Le=d(ge);!Le||!Le.name||ie.push({agentId:ge,name:Le.name,displayName:Le.displayName})}return ie},[M==null?void 0:M.participants,Y==null?void 0:Y.agents,e,d,m]),pe=x.useMemo(()=>{if(!M)return!1;if(M.type==="group")return!0;const re=M.participants.some(ie=>ie.agentId===m);return M.type==="direct"&&!re&&M.participants.length>=2},[M,m]);x.useEffect(()=>{if(n||F.current.has(t)||!U||!V||!M||_.length>0||h.length>0||pe||ue===e)return;const re=`Hi ${ue}! What can you help with?`;g(re),b(re.length),F.current.add(t),requestAnimationFrame(()=>{const ie=z.current;ie&&(ie.focus(),ie.setSelectionRange(re.length,re.length))})},[t,e,U,V,M,_.length,h.length,ue,pe,n]);const Me=x.useMemo(()=>{const re=we.map(ie=>({agentId:ie.agentId,name:ie.name}));return cN(h,re)},[h,we]),Ue=x.useMemo(()=>je.size===0?[]:Me.filter(re=>!je.has(re)),[Me,je]),dt=cT({value:h,cursor:p,candidates:we,disabled:ae.isPending||j,onSelect:re=>{g(re.text),b(re.cursor),requestAnimationFrame(()=>{const ie=z.current;ie&&(ie.focus(),ie.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.jsx("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:(M==null?void 0:M.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:D,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:(M==null?void 0:M.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((M==null?void 0:M.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:(M==null?void 0:M.title)??"…"})}),l.jsx(mK,{chatId:t,participantIds:((ot=M==null?void 0:M.participants)==null?void 0:ot.map(re=>re.agentId))??[e],candidates:we,agentIdentity:d,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(wv,{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(aK,{event:ge},re.key);case"assistant_text":return l.jsx(iK,{event:ge,agentId:e,agentNameFn:c},re.key);case"thinking":return l.jsx(sK,{event:ge},re.key);case"error":return l.jsx(lK,{event:ge},re.key);default:return null}}const ie=re.data;if(ie.format==="question"&&eK(ie.content)){const ge=Z.get(ie.content.correlationId)??null,Le=ge?"answered":"pending";return l.jsx(fK,{msg:ie,chatId:t,content:ie.content,answer:ge,status:Le,agentNameFn:c},re.key)}return ie.format==="question_answer"?l.jsx(hK,{msg:ie,agentNameFn:c},re.key):l.jsx(oK,{msg:ie,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(uC,{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(dT,{trigger:dt.trigger,results:dt.results,highlightIndex:dt.highlightIndex,anchorRef:z,onPick:dt.pick}),l.jsx("textarea",{ref:z,value:h,onChange:re=>{g(re.target.value),b(re.target.selectionStart??re.target.value.length)},onSelect:re=>{b(re.currentTarget.selectionStart??h.length)},onFocus:()=>{pe&&(R.current||h.length>0||we.length===0||(R.current=!0,g("@"),b(1),requestAnimationFrame(()=>{const re=z.current;re&&re.setSelectionRange(1,1)})))},onPaste:re=>{const ie=Array.from(re.clipboardData.files);ie.length>0&&(re.preventDefault(),xe(ie))},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||j,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 ie=re.selectionStart??h.length,ge=re.selectionEnd??ie,Le=`${h.slice(0,ie)}@${h.slice(ge)}`;g(Le),b(ie+1),requestAnimationFrame(()=>{re.focus(),re.setSelectionRange(ie+1,ie+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(Nz,{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(r3,{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:[j&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:X,disabled:ae.isPending||j||!h.trim()&&w.length===0||pe&&Me.length===0,title:pe&&Me.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||j||!h.trim()&&w.length===0||pe&&Me.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(lC,{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 mK({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,d]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!c)return;const p=b=>{m.current&&(m.current.contains(b.target)||d(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]);const h=wt({mutationFn:p=>oT(e,{participantIds:[p]}),onSuccess:()=>{d(!1),s()}}),g=x.useMemo(()=>n.filter(p=>!t.includes(p.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(p=>{const b=a(p),w=(b==null?void 0:b.displayName)??(b==null?void 0:b.name)??p.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},p)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>d(!c),disabled:g.length===0||h.isPending,title:g.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:g.length===0?"var(--fg-4)":"var(--fg-3)",cursor:g.length===0?"not-allowed":"pointer"},children:l.jsx(ba,{className:"h-3 w-3"})}),c&&g.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 p=wb(g);return g.map(b=>l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:b.name?`@${b.name}`:void 0,onClick:()=>h.mutate(b.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(Sb,{candidate:b,ambiguous:p})},b.agentId))})()})]})]})}function nj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function pK(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 gK({chatId:e}){const t=mn(),{agentId:n}=gt(),a=x.useRef(new Map),{data:s}=Ye({queryKey:["chat-detail",e],queryFn:()=>uT(e),enabled:!!e}),{data:o}=Ye({queryKey:["me","chats","all"],queryFn:()=>eh({filter:"all"}),refetchInterval:3e4}),{data:c}=Ye({queryKey:["me","chats","watching"],queryFn:()=>eh({filter:"watching"}),refetchInterval:3e4}),d=x.useMemo(()=>nj(o==null?void 0:o.rows,e)??nj(c==null?void 0:c.rows,e)??null,[o,c,e]),m=x.useMemo(()=>d?d.participants.map(j=>({agentId:j.agentId,type:j.type})):s?s.participants.map(j=>({agentId:j.agentId,type:void 0})):[],[d,s]),h=x.useMemo(()=>pK(m,n),[m,n]),p=wt({mutationFn:()=>iQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,b=(d==null?void 0:d.lastMessageAt)??"";x.useEffect(()=>{!d||a.current.get(e)===b||(a.current.set(e,b),p())},[e,d,b,p]);const w=wt({mutationFn:()=>sQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),S=(d==null?void 0:d.membershipKind)==="watching";return h?S?l.jsx(tj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(d==null?void 0:d.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(tj,{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 yK(){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(Mc,{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 vK({organizationId:e,onContinue:t}){const[n,a]=x.useState([]),[s,o]=x.useState(""),[c,d]=x.useState(""),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,w]=x.useState(!1),[S,j]=x.useState(null),E=x.useRef(null);x.useEffect(()=>{(async()=>{try{const z=await Ee.get("/me/organizations");a(z)}catch(z){j(z instanceof Error?z.message:"Failed to load your team")}finally{w(!0)}})()},[]),x.useEffect(()=>{var L;const z=((L=n.find(R=>R.id===e))==null?void 0:L.displayName)??"";o(z),d(z)},[n,e]),x.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&&b&&!S,O=x.useCallback(async z=>{if(z==null||z.preventDefault(),!(!N||!e)){p(null);try{C!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),ui("team_renamed")),t()}catch(L){p(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)"}})]}),g||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:g??`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(sC,{className:"h-4 w-4"})]})})]})}function kb(){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 bK=3e4,xK=1e3,wK=3e3;function SK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function kK({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var je;const s=_n(),o=iz(e,t),c=lz(o),d=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=d?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,g]=x.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[p,b]=x.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,S]=x.useState(null),[j,E]=x.useState(null),[C,N]=x.useState(null),[O,z]=x.useState(()=>d),[L,R]=x.useState(()=>m),[F,U]=x.useState([]),[V,M]=x.useState("form"),[Y,ae]=x.useState(null),xe=x.useRef(null),J=x.useRef(null),X=x.useRef(null),q=x.useRef(0);x.useEffect(()=>()=>{J.current&&(J.current.cancelled=!0)},[]),x.useEffect(()=>{oz(o,{displayName:h,selectedRuntime:p,connectToken:O,connectTokenExpiresAt:L})},[o,h,p,O,L]),x.useEffect(()=>{(async()=>{try{const we=await Ee.get("/me/organizations");U(we)}catch{}})()},[]),x.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(ie=>ie.status==="connected").sort((ie,ge)=>ge.lastSeenAt.localeCompare(ie.lastSeenAt))[0]??null;if(S(ie=>(ie==null?void 0:ie.id)===(re==null?void 0:re.id)?ie:re),re){X.current!==re.id&&(X.current=null,N(null),E(null));try{const ie=await ch(re.id);if(we||Ue!==q.current)return;X.current=re.id,N(re.id),E(ie.capabilities)}catch{}}else X.current=null,N(null),E(null)}catch{}};pe();const Me=setInterval(pe,wK);return()=>{we=!0,clearInterval(Me)}},[V]),x.useEffect(()=>{if(w)return;if(O&&L&&L>Date.now()){const pe=Math.max(L-Date.now(),0),Me=window.setTimeout(()=>{z(null),R(null)},pe);return()=>window.clearTimeout(Me)}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?j:null;x.useEffect(()=>{b(we=>{var Me;if(!te)return we;const pe=jK(te);return we&&pe&&Object.keys(te).includes(we)&&((Me=te[we])==null?void 0:Me.state)==="ok"?we:pe})},[te]);const ke=te?Object.entries(te).filter(([,we])=>we.state==="ok").map(([we])=>we):[],Ae=((je=F.find(we=>we.id===e))==null?void 0:je.displayName)??"",D=h.trim(),I=D||"your agent",P=O?`npm install -g @agent-team-foundation/first-tree-hub
398
+ first-tree-hub connect ${O}`:null,_=x.useCallback(async we=>{J.current&&(J.current.cancelled=!0);const pe={cancelled:!1};J.current=pe;const Me=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){uz(o);try{await a()}catch{}if(pe.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Me>bK){pe.cancelled||M("timeout");return}await new Promise(dt=>setTimeout(dt,xK))}},[o,a,s]),Z=!!(D&&w&&p&&ke.includes(p)&&V==="form"),Q=x.useCallback(async()=>{if(!w||!p||!D)return;ae(null),M("creating");const we=Qy(D);let pe;try{pe=(await Ee.post(Tn("/agents"),{type:"personal_assistant",displayName:D,...we?{name:we}:{},clientId:w.id,runtimeProvider:p,...e?{organizationId:e}:{}})).uuid,xe.current=pe,rz(pe),ui("agent_created",{runtimeProvider:p})}catch(Me){ae(Me instanceof Error?Me.message:"Failed to create agent"),M("form");return}await _(pe)},[D,w,p,_,e]),ue=x.useCallback(async()=>{const we=xe.current;we&&(ae(null),M("creating"),await _(we))},[_]);return V==="creating"?l.jsx(RK,{nameOrFallback:I}):V==="timeout"?l.jsx(OK,{nameOrFallback:I,hostname:(w==null?void 0:w.hostname)??null,error:Y,onRetry:ue}):l.jsx(CK,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:g,trimmedName:D,connectedClient:w,cliCommand:P,capabilitiesLoaded:te!==null,okRuntimes:ke,selectedRuntime:p,setSelectedRuntime:b,error:Y,canCreate:Z,onCreate:Q})}function jK(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 CK({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:d,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:g,error:p,canCreate:b,onCreate:w}){const S=x.useRef(null),j=e==="invite"&&t,E=d&&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 x.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:j?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(kb,{}),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:b?"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(TK,{hostname:o.hostname??o.id}),l.jsx(_K,{runtimes:m,selected:h,onSelect:g,capabilitiesLoaded:d})]}):l.jsxs(l.Fragment,{children:[l.jsx(EK,{command:c}),l.jsx(NK,{})]})]}):null]})})]}),p&&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:p}),s&&l.jsxs("div",{style:{marginTop:b?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!b&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),b&&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(sC,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:b?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function EK({command:e}){const[t,n]=x.useState(!1),s=(e?e.split(`
399
+ `):[]).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,d=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:d,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(oh,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function NK(){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(AK,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function _K({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)"}})}),SK(s)]},s)})]})]})}function TK({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 AK(){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 RK({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(zK,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function OK({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 zK(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Hg,{delayMs:0}),l.jsx(Hg,{delayMs:160}),l.jsx(Hg,{delayMs:320})]})}function Hg({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 vT(){return(await Ee.get("/me/github/repos")).repos}const bT="https://github.com/agent-team-foundation/first-tree";function xT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function jb(e,t){const n=xT(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: ${bT}`].join(`
400
+ `)}function DK(e){const t=xT(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: ${bT}`].join(`
401
+ `)}function MK(){const{role:e}=gt();return e==="admin"?l.jsx($K,{}):l.jsx(IK,{})}function IK(){var d,m;const{organizationId:e}=gt(),[t,n]=x.useState({kind:"loading"}),[a,s]=x.useState(0);if(x.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[g,p]=await Promise.all([yb(e),nT(e)]);if(h)return;n({kind:"loaded",tree:g,repos:p})}catch(g){if(h)return;n({kind:"error",message:g instanceof Error?g.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(PK,{});if(t.kind==="error")return l.jsx(LK,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((d=t.tree)==null?void 0:d.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return o&&c.length>0?l.jsx(UK,{treeUrl:o,teamRepos:c}):o?l.jsx(BK,{treeUrl:o}):l.jsx(FK,{})}function LK({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 PK(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function UK({treeUrl:e,teamRepos:t}){var j;const n=_n(),{dismissOnboarding:a}=gt(),{addToast:s}=Ic(),[o,c]=x.useState(!1),[d,m]=x.useState(null),[h,g]=x.useState(()=>t.map(E=>E.url)),p=h.length>0,b=x.useCallback(E=>{g(C=>C.includes(E)?C.filter(N=>N!==E):[...C,E])},[]),w=x.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const E=await Cb(),C=await jh(E.uuid);await Ch(E.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(z=>({url:z}))}});const N=await xb(E.uuid),O=jb(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=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),a(),s(Eb(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(Xy,{label:"Tree",value:e}),t.length===1?l.jsx(Xy,{label:"Source repo",value:((j=t[0])==null?void 0:j.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:()=>b(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)})]}),d?l.jsx(Nb,{children:d}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!p||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 BK({treeUrl:e}){const t=_n(),{dismissOnboarding:n}=gt(),{addToast:a}=Ic(),[s,o]=x.useState(!1),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),[b,w]=x.useState([]),S=b.length>0,j=x.useCallback(N=>{w(O=>O.includes(N)?O.filter(z=>z!==N):[...O,N])},[]);x.useEffect(()=>{let N=!1;return(async()=>{try{const O=await vT();if(N)return;h(O)}catch(O){N||p(O instanceof Error?O.message:"Failed to list GitHub repositories")}})(),()=>{N=!0}},[]);const E=x.useCallback(async()=>{if(b.length!==0){o(!0),d(null);try{const N=await Cb(),O=await jh(N.uuid);await Ch(N.uuid,{expectedVersion:O.version,payload:{gitRepos:b.map(R=>({url:R}))}});const z=await xb(N.uuid),L=jb(b,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){d(N instanceof Error?N.message:"Failed to start the chat"),o(!1)}}},[b,e,t,n]),C=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),n(),a(Eb(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(kb,{}),l.jsx(is,{number:"01",state:"complete",children:l.jsx(Xy,{label:"Tree",value:e})}),l.jsx(is,{number:"02",state:S?"complete":"active",children:l.jsx(wT,{disabled:s,repos:m,error:g,selectedRepoUrls:b,onToggle:j})}),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"," ",b.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?l.jsx(Nb,{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 FK(){const{dismissOnboarding:e}=gt(),{addToast:t}=Ic(),n=x.useRef(!1);return x.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 $K(){const e=_n(),{dismissOnboarding:t,organizationId:n}=gt(),{addToast:a}=Ic(),[s,o]=x.useState(!1),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(""),[b,w]=x.useState([]),[S,j]=x.useState(null),[E,C]=x.useState(null),N=x.useCallback(M=>{w(Y=>Y.includes(M)?Y.filter(ae=>ae!==M):[...Y,M])},[]);x.useEffect(()=>{let M=!1;return(async()=>{try{const Y=await vT();if(M)return;j(Y)}catch(Y){M||C(Y instanceof Error?Y.message:"Failed to list GitHub repositories")}})(),()=>{M=!0}},[]),x.useEffect(()=>{if(!n)return;let M=!1;return(async()=>{try{const Y=await yb(n);if(M)return;Y.repo&&(p(Y.repo),h(ae=>ae??"existing"))}catch{}})(),()=>{M=!0}},[n]);const O=g.trim(),z=(()=>{if(m!=="existing")return!0;if(!O)return!1;try{return new URL(O).protocol==="https:"}catch{return!1}})(),L=x.useCallback(()=>{ui("tree_intro_dismissed"),t(),a(Eb(e))},[t,a,e]),R=x.useCallback(async()=>{if(b.length!==0&&m&&!(m==="existing"&&!z)){d(null),o(!0);try{const M=await Cb(),Y=await jh(M.uuid),ae=b.map(X=>({url:X}));if(await Ch(M.uuid,{expectedVersion:Y.version,payload:{gitRepos:ae}}),n)try{await rT(n,{repos:ae})}catch(X){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",X)}if(m==="existing"&&n)try{await tT(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 xb(M.uuid),J=m==="existing"?jb(b,O):DK(b);try{await ko(xe.id,J)}catch{}ui("tree_chat_started",{agentUuid:M.uuid,chatId:xe.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(xe.id)}`,{replace:!1})}catch(M){d(M instanceof Error?M.message:"Failed to start the tree-init chat"),o(!1)}}},[b,m,z,O,n,e,t,a]),F=b.length>0,U=F&&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(kb,{}),l.jsx(is,{number:"01",state:F?"complete":"active",children:l.jsx(wT,{disabled:s,repos:S,error:E,selectedRepoUrls:b,onToggle:N})}),l.jsxs(is,{number:"02",state:V?"complete":F?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:F?"var(--fg)":"var(--fg-4)",fontWeight:F?600:500},children:"Bind or create the tree"}),F?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(M=>{const Y=m===M.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:M.value,checked:Y,onChange:()=>h(M.value),className:"sr-only"}),M.label]},M.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:g,onChange:M=>p(M.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"," ",b.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"," ",b.length>1?"each source repo":"your source repo","."]}),c?l.jsx(Nb,{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 Cb(){const e=nz(),t=await Rv(),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 Eb(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 Xy({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 Nb({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 wT({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(HK,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function HK({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>{if(!a)return;const g=b=>{o.current&&!o.current.contains(b.target)&&s(!1)},p=b=>{b.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",g),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",g),window.removeEventListener("keydown",p)}},[a]);const c=x.useMemo(()=>{const g=new Map;for(const p of e){const b=p.fullName.split("/")[0]??"",w=g.get(b);w?w.push(p):g.set(b,[p])}return[...g.entries()].sort(([p],[b])=>p.localeCompare(b))},[e]),d=x.useMemo(()=>new Set(t),[t]),m=x.useMemo(()=>e.filter(g=>d.has(g.cloneUrl)),[e,d]),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(g=>l.jsx(qK,{fullName:g.fullName,onRemove:()=>n(g.cloneUrl)},g.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(g=>!g),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(bv,{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(([g,p],b)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:b>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:g}),p.map(w=>{const S=d.has(w.cloneUrl),j=w.fullName.slice(g.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:j}),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)})]},g))})]})}function qK({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 ZK(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=gt(),[o,c]=sh(),d=o.get("step"),[m]=x.useState(()=>rC()),[h,g]=x.useState(()=>tC()),p=x.useCallback(j=>{tz(j),g(j)},[]),b=s==="admin",w=x.useMemo(()=>d==="team"&&b?"step1":d==="agent"?"step2":d==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&b?"step1":"step2",[d,e,h,m,b]),S=x.useCallback(()=>{p(!0);const j=new URLSearchParams(o);j.delete("step"),c(j,{replace:!0})},[p,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(vK,{organizationId:n,onContinue:S}):w==="step2"?l.jsx(kK,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(MK,{})})})}function GK({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=gt();return e===th?l.jsx(vQ,{onCreated:t}):e?l.jsx(gK,{chatId:e}):n!==null&&!a?l.jsx(ZK,{}):l.jsx(yK,{})}const VK={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function QK(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=gt(),{addToast:a}=Ic(),s=_n(),[o,c]=sh(),d=o.get("c"),m=o.get("step"),h=tC(),p=rC()==="invite",b=x.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||d||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!p?1:2,[m,d,e,h,p]);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")}})},j={1:qg(1,b,e),2:qg(2,b,e),3:qg(3,b,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=j[C],z=[1,2,3][N+1],L=z?rj(O)&&rj(j[z]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(KK,{index:C,state:O,label:VK[C],onClick:C===3&&O==="active"?()=>E(C):void 0}),z?l.jsx(XK,{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 qg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function rj(e){return e==="active"||e==="completed"}function KK({index:e,state:t,label:n,onClick:a}){const s=!!a,o=YK(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 YK(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 XK({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 WK(){const[e,t]=sh(),n=e.get("c"),a=e.get("a");DN(),x.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=x.useCallback(c=>{t({c})},[t]),o=x.useCallback(()=>{t({c:th})},[t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(uQ,{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(QK,{}),l.jsx(GK,{selectedChatId:n,onSelectChat:s})]})]})}const JK=new fR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function eY(){return l.jsx(hR,{client:JK,children:l.jsx(fz,{children:l.jsx(h4,{children:l.jsx($O,{children:l.jsxs(yO,{children:[l.jsx(Mt,{path:"/login",element:l.jsx(UG,{})}),l.jsx(Mt,{path:"/signup",element:l.jsx(or,{to:"/login",replace:!0})}),l.jsx(Mt,{path:"/auth/github/complete",element:l.jsx(BG,{})}),l.jsx(Mt,{path:"/invite/:token",element:l.jsx(MG,{})}),l.jsx(Mt,{element:l.jsx(yz,{}),children:l.jsxs(Mt,{element:l.jsx(MB,{children:l.jsx(d4,{})}),children:[l.jsx(Mt,{index:!0,element:l.jsx(WK,{})}),l.jsx(Mt,{path:"context",element:l.jsx(YZ,{})}),l.jsx(Mt,{path:"agents/:uuid",element:l.jsx(cZ,{})}),l.jsx(Mt,{path:"team",element:l.jsx(qV,{})}),l.jsxs(Mt,{path:"settings",element:l.jsx(NV,{}),children:[l.jsx(Mt,{index:!0,element:l.jsx(or,{to:"computers",replace:!0})}),l.jsx(Mt,{path:"team",element:l.jsx(rQ,{})}),l.jsx(Mt,{path:"computers",element:l.jsx(tV,{})}),l.jsx(Mt,{path:"github",element:l.jsx(oV,{})}),l.jsx(Mt,{path:"integrations",element:l.jsx(jV,{})}),l.jsx(Mt,{path:"onboarding",element:l.jsx(CV,{})}),l.jsx(Mt,{path:"setup",element:l.jsx(or,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(Mt,{path:"agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Mt,{path:"clients",element:l.jsx(or,{to:"/settings/computers",replace:!0})}),l.jsx(Mt,{path:"integrations",element:l.jsx(or,{to:"/settings/integrations",replace:!0})}),l.jsx(Mt,{path:"team/members",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Mt,{path:"team/agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Mt,{path:"team/invite",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Mt,{path:"team/settings",element:l.jsx(or,{to:"/settings/team",replace:!0})}),l.jsx(Mt,{path:"admin",element:l.jsx(tY,{})})]})})]})})})})})}function tY(){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 ST=document.getElementById("root");if(!ST)throw new Error("Root element not found");B2.createRoot(ST).render(l.jsx(x.StrictMode,{children:l.jsx(eY,{})}));export{sC as A,Mc as F,Ac as L,lt as c,l as j,x as r};