@agent-team-foundation/first-tree-hub 0.12.10 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,421 +0,0 @@
1
- var wS=e=>{throw TypeError(e)};var Zp=(e,t,n)=>t.has(e)||wS("Cannot "+n);var B=(e,t,n)=>(Zp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ne=(e,t,n)=>t.has(e)?wS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,a)=>(Zp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ge=(e,t,n)=>(Zp(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 K2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function rh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gp={exports:{}},Tu={};/**
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 SS;function Y2(){if(SS)return Tu;SS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var c=null;if(o!==void 0&&(c=""+o),s.key!==void 0&&(c=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:o}}return Tu.Fragment=t,Tu.jsx=n,Tu.jsxs=n,Tu}var kS;function X2(){return kS||(kS=1,Gp.exports=Y2()),Gp.exports}var l=X2(),Vp={exports:{}},Qe={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var jS;function W2(){if(jS)return Qe;jS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(U){return U===null||typeof U!="object"?null:(U=x&&U[x]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,S={};function C(U,F,T){this.props=U,this.context=F,this.refs=S,this.updater=T||k}C.prototype.isReactComponent={},C.prototype.setState=function(U,F){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,F,"setState")},C.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function _(){}_.prototype=C.prototype;function R(U,F,T){this.props=U,this.context=F,this.refs=S,this.updater=T||k}var z=R.prototype=new _;z.constructor=R,j(z,C.prototype),z.isPureReactComponent=!0;var P=Array.isArray;function O(){}var L={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function K(U,F,T){var G=T.ref;return{$$typeof:e,type:U,key:F,ref:G!==void 0?G:null,props:T}}function D(U,F){return K(U.type,F,U.props)}function Y(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function se(U){var F={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(T){return F[T]})}var xe=/\/+/g;function J(U,F){return typeof U=="object"&&U!==null&&U.key!=null?se(""+U.key):F.toString(36)}function W(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(O,O):(U.status="pending",U.then(function(F){U.status==="pending"&&(U.status="fulfilled",U.value=F)},function(F){U.status==="pending"&&(U.status="rejected",U.reason=F)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function Z(U,F,T,G,q){var ie=typeof U;(ie==="undefined"||ie==="boolean")&&(U=null);var ve=!1;if(U===null)ve=!0;else switch(ie){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(U.$$typeof){case e:case t:ve=!0;break;case p:return ve=U._init,Z(ve(U._payload),F,T,G,q)}}if(ve)return q=q(U),ve=G===""?"."+J(U,0):G,P(q)?(T="",ve!=null&&(T=ve.replace(xe,"$&/")+"/"),Z(q,F,T,"",function(Me){return Me})):q!=null&&(Y(q)&&(q=D(q,T+(q.key==null||U&&U.key===q.key?"":(""+q.key).replace(xe,"$&/")+"/")+ve)),F.push(q)),1;ve=0;var we=G===""?".":G+":";if(P(U))for(var me=0;me<U.length;me++)G=U[me],ie=we+J(G,me),ve+=Z(G,F,T,ie,q);else if(me=w(U),typeof me=="function")for(U=me.call(U),me=0;!(G=U.next()).done;)G=G.value,ie=we+J(G,me++),ve+=Z(G,F,T,ie,q);else if(ie==="object"){if(typeof U.then=="function")return Z(W(U),F,T,G,q);throw F=String(U),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return ve}function ne(U,F,T){if(U==null)return U;var G=[],q=0;return Z(U,G,"","",function(ie){return F.call(T,ie,q++)}),G}function ke(U){if(U._status===-1){var F=U._result;F=F(),F.then(function(T){(U._status===0||U._status===-1)&&(U._status=1,U._result=T)},function(T){(U._status===0||U._status===-1)&&(U._status=2,U._result=T)}),U._status===-1&&(U._status=0,U._result=F)}if(U._status===1)return U._result.default;throw U._result}var Ae=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},M={map:ne,forEach:function(U,F,T){ne(U,function(){F.apply(this,arguments)},T)},count:function(U){var F=0;return ne(U,function(){F++}),F},toArray:function(U){return ne(U,function(F){return F})||[]},only:function(U){if(!Y(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Qe.Activity=g,Qe.Children=M,Qe.Component=C,Qe.Fragment=n,Qe.Profiler=s,Qe.PureComponent=R,Qe.StrictMode=a,Qe.Suspense=m,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(U){return L.H.useMemoCache(U)}},Qe.cache=function(U){return function(){return U.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(U,F,T){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var G=j({},U.props),q=U.key;if(F!=null)for(ie in F.key!==void 0&&(q=""+F.key),F)!I.call(F,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&F.ref===void 0||(G[ie]=F[ie]);var ie=arguments.length-2;if(ie===1)G.children=T;else if(1<ie){for(var ve=Array(ie),we=0;we<ie;we++)ve[we]=arguments[we+2];G.children=ve}return K(U.type,q,G)},Qe.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Qe.createElement=function(U,F,T){var G,q={},ie=null;if(F!=null)for(G in F.key!==void 0&&(ie=""+F.key),F)I.call(F,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(q[G]=F[G]);var ve=arguments.length-2;if(ve===1)q.children=T;else if(1<ve){for(var we=Array(ve),me=0;me<ve;me++)we[me]=arguments[me+2];q.children=we}if(U&&U.defaultProps)for(G in ve=U.defaultProps,ve)q[G]===void 0&&(q[G]=ve[G]);return K(U,ie,q)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(U){return{$$typeof:f,render:U}},Qe.isValidElement=Y,Qe.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:ke}},Qe.memo=function(U,F){return{$$typeof:h,type:U,compare:F===void 0?null:F}},Qe.startTransition=function(U){var F=L.T,T={};L.T=T;try{var G=U(),q=L.S;q!==null&&q(T,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(O,Ae)}catch(ie){Ae(ie)}finally{F!==null&&T.types!==null&&(F.types=T.types),L.T=F}},Qe.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Qe.use=function(U){return L.H.use(U)},Qe.useActionState=function(U,F,T){return L.H.useActionState(U,F,T)},Qe.useCallback=function(U,F){return L.H.useCallback(U,F)},Qe.useContext=function(U){return L.H.useContext(U)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(U,F){return L.H.useDeferredValue(U,F)},Qe.useEffect=function(U,F){return L.H.useEffect(U,F)},Qe.useEffectEvent=function(U){return L.H.useEffectEvent(U)},Qe.useId=function(){return L.H.useId()},Qe.useImperativeHandle=function(U,F,T){return L.H.useImperativeHandle(U,F,T)},Qe.useInsertionEffect=function(U,F){return L.H.useInsertionEffect(U,F)},Qe.useLayoutEffect=function(U,F){return L.H.useLayoutEffect(U,F)},Qe.useMemo=function(U,F){return L.H.useMemo(U,F)},Qe.useOptimistic=function(U,F){return L.H.useOptimistic(U,F)},Qe.useReducer=function(U,F,T){return L.H.useReducer(U,F,T)},Qe.useRef=function(U){return L.H.useRef(U)},Qe.useState=function(U){return L.H.useState(U)},Qe.useSyncExternalStore=function(U,F,T){return L.H.useSyncExternalStore(U,F,T)},Qe.useTransition=function(){return L.H.useTransition()},Qe.version="19.2.4",Qe}var ES;function av(){return ES||(ES=1,Vp.exports=W2()),Vp.exports}var b=av();const J2=rh(b),iv=K2({__proto__:null,default:J2},[b]);var Qp={exports:{}},Au={},Kp={exports:{}},Yp={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var CS;function eR(){return CS||(CS=1,(function(e){function t(Z,ne){var ke=Z.length;Z.push(ne);e:for(;0<ke;){var Ae=ke-1>>>1,M=Z[Ae];if(0<s(M,ne))Z[Ae]=ne,Z[ke]=M,ke=Ae;else break e}}function n(Z){return Z.length===0?null:Z[0]}function a(Z){if(Z.length===0)return null;var ne=Z[0],ke=Z.pop();if(ke!==ne){Z[0]=ke;e:for(var Ae=0,M=Z.length,U=M>>>1;Ae<U;){var F=2*(Ae+1)-1,T=Z[F],G=F+1,q=Z[G];if(0>s(T,ke))G<M&&0>s(q,T)?(Z[Ae]=q,Z[G]=ke,Ae=G):(Z[Ae]=T,Z[F]=ke,Ae=F);else if(G<M&&0>s(q,ke))Z[Ae]=q,Z[G]=ke,Ae=G;else break e}}return ne}function s(Z,ne){var ke=Z.sortIndex-ne.sortIndex;return ke!==0?ke:Z.id-ne.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],p=1,g=null,x=3,w=!1,k=!1,j=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function z(Z){for(var ne=n(h);ne!==null;){if(ne.callback===null)a(h);else if(ne.startTime<=Z)a(h),ne.sortIndex=ne.expirationTime,t(m,ne);else break;ne=n(h)}}function P(Z){if(j=!1,z(Z),!k)if(n(m)!==null)k=!0,O||(O=!0,se());else{var ne=n(h);ne!==null&&W(P,ne.startTime-Z)}}var O=!1,L=-1,I=5,K=-1;function D(){return S?!0:!(e.unstable_now()-K<I)}function Y(){if(S=!1,O){var Z=e.unstable_now();K=Z;var ne=!0;try{e:{k=!1,j&&(j=!1,_(L),L=-1),w=!0;var ke=x;try{t:{for(z(Z),g=n(m);g!==null&&!(g.expirationTime>Z&&D());){var Ae=g.callback;if(typeof Ae=="function"){g.callback=null,x=g.priorityLevel;var M=Ae(g.expirationTime<=Z);if(Z=e.unstable_now(),typeof M=="function"){g.callback=M,z(Z),ne=!0;break t}g===n(m)&&a(m),z(Z)}else a(m);g=n(m)}if(g!==null)ne=!0;else{var U=n(h);U!==null&&W(P,U.startTime-Z),ne=!1}}break e}finally{g=null,x=ke,w=!1}ne=void 0}}finally{ne?se():O=!1}}}var se;if(typeof R=="function")se=function(){R(Y)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,J=xe.port2;xe.port1.onmessage=Y,se=function(){J.postMessage(null)}}else se=function(){C(Y,0)};function W(Z,ne){L=C(function(){Z(e.unstable_now())},ne)}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(Z){Z.callback=null},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(Z){switch(x){case 1:case 2:case 3:var ne=3;break;default:ne=x}var ke=x;x=ne;try{return Z()}finally{x=ke}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(Z,ne){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var ke=x;x=Z;try{return ne()}finally{x=ke}},e.unstable_scheduleCallback=function(Z,ne,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,Z){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=ke+M,Z={id:p++,callback:ne,priorityLevel:Z,startTime:ke,expirationTime:M,sortIndex:-1},ke>Ae?(Z.sortIndex=ke,t(h,Z),n(m)===null&&Z===n(h)&&(j?(_(L),L=-1):j=!0,W(P,ke-Ae))):(Z.sortIndex=M,t(m,Z),k||w||(k=!0,O||(O=!0,se()))),Z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Z){var ne=x;return function(){var ke=x;x=ne;try{return Z.apply(this,arguments)}finally{x=ke}}}})(Yp)),Yp}var NS;function tR(){return NS||(NS=1,Kp.exports=eR()),Kp.exports}var Xp={exports:{}},Qn={};/**
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 _S;function nR(){if(_S)return Qn;_S=1;var e=av();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Qn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Qn.createPortal=function(m,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,p)},Qn.flushSync=function(m){var h=c.T,p=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=p,a.d.f()}},Qn.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))},Qn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Qn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Qn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Qn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin);a.d.L(m,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Qn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Qn.requestFormReset=function(m){a.d.r(m)},Qn.unstable_batchedUpdates=function(m,h){return m(h)},Qn.useFormState=function(m,h,p){return c.H.useFormState(m,h,p)},Qn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Qn.version="19.2.4",Qn}var TS;function Tj(){if(TS)return Xp.exports;TS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xp.exports=nR(),Xp.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var AS;function rR(){if(AS)return Au;AS=1;var e=tR(),t=av(),n=Tj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var u=r,d=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){u=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==d.return)u=y,d=v;else{for(var E=!1,A=y.child;A;){if(A===u){E=!0,u=y,d=v;break}if(A===d){E=!0,d=y,u=v;break}A=A.sibling}if(!E){for(A=v.child;A;){if(A===u){E=!0,u=v,d=y;break}if(A===d){E=!0,d=v,u=y;break}A=A.sibling}if(!E)throw Error(a(189))}}if(u.alternate!==d)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),R=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function se(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 S:return"StrictMode";case P:return"Suspense";case O:return"SuspenseList";case K:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case R:return r.displayName||"Context";case _: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 L:return i=r.displayName||null,i!==null?i:J(r.type)||"Memo";case I:i=r._payload,r=r._init;try{return J(r(i))}catch{}}return null}var W=Array.isArray,Z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke={pending:!1,data:null,method:null,action:null},Ae=[],M=-1;function U(r){return{current:r}}function F(r){0>M||(r.current=Ae[M],Ae[M]=null,M--)}function T(r,i){M++,Ae[M]=r.current,r.current=i}var G=U(null),q=U(null),ie=U(null),ve=U(null);function we(r,i){switch(T(ie,i),T(q,r),T(G,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?qw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=qw(i),r=Zw(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(G),T(G,r)}function me(){F(G),F(q),F(ie)}function Me(r){r.memoizedState!==null&&T(ve,r);var i=G.current,u=Zw(i,r.type);i!==u&&(T(q,r),T(G,u))}function Ie(r){q.current===r&&(F(G),F(q)),ve.current===r&&(F(ve),Eu._currentValue=ke)}var St,tt;function it(r){if(St===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);St=i&&i[1]||"",tt=-1<u.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+St+r+tt}var V=!1;function pe(r,i){if(!r||V)return"";V=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var ae=le}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(le){ae=le}r.call(fe.prototype)}}else{try{throw Error()}catch(le){ae=le}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&ae&&typeof le.stack=="string")return[le.stack,ae.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),E=v[0],A=v[1];if(E&&A){var H=E.split(`
44
- `),te=A.split(`
45
- `);for(y=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;y<te.length&&!te[y].includes("DetermineComponentFrameRoot");)y++;if(d===H.length||y===te.length)for(d=H.length-1,y=te.length-1;1<=d&&0<=y&&H[d]!==te[y];)y--;for(;1<=d&&0<=y;d--,y--)if(H[d]!==te[y]){if(d!==1||y!==1)do if(d--,y--,0>y||H[d]!==te[y]){var ue=`
46
- `+H[d].replace(" at new "," at ");return r.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",r.displayName)),ue}while(1<=d&&0<=y);break}}}finally{V=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?it(u):""}function _e(r,i){switch(r.tag){case 26:case 27:case 5:return it(r.type);case 16:return it("Lazy");case 13:return r.child!==i&&i!==null?it("Suspense Fallback"):it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return pe(r.type,!1);case 11:return pe(r.type.render,!1);case 1:return pe(r.type,!0);case 31:return it("Activity");default:return""}}function Ue(r){try{var i="",u=null;do i+=_e(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
47
- Error generating stack: `+d.message+`
48
- `+d.stack}}var Mt=Object.prototype.hasOwnProperty,Pt=e.unstable_scheduleCallback,hr=e.unstable_cancelCallback,gi=e.unstable_shouldYield,yi=e.unstable_requestPaint,cn=e.unstable_now,fa=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,$e=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,st=e.unstable_IdlePriority,dn=e.log,tr=e.unstable_setDisableYieldValue,Zt=null,Ut=null;function At(r){if(typeof dn=="function"&&tr(r),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(Zt,r)}catch{}}var ot=Math.clz32?Math.clz32:il,nr=Math.log,Mn=Math.LN2;function il(r){return r>>>=0,r===0?32:31-(nr(r)/Mn|0)|0}var ha=256,ma=262144,Da=4194304;function Vn(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 Ia(r,i,u){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Vn(d):(E&=A,E!==0?y=Vn(E):u||(u=A&~r,u!==0&&(y=Vn(u))))):(A=d&~v,A!==0?y=Vn(A):E!==0?y=Vn(E):u||(u=d&~r,u!==0&&(y=Vn(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 ka(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Gt(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 je(){var r=Da;return Da<<=1,(Da&62914560)===0&&(Da=4194304),r}function nt(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function yn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ar(r,i,u,d,y,v){var E=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,te=r.hiddenUpdates;for(u=E&~u;0<u;){var ue=31-ot(u),fe=1<<ue;A[ue]=0,H[ue]=-1;var ae=te[ue];if(ae!==null)for(te[ue]=null,ue=0;ue<ae.length;ue++){var le=ae[ue];le!==null&&(le.lane&=-536870913)}u&=~fe}d!==0&&vi(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(E&~i))}function vi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-ot(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|u&261930}function ys(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var d=31-ot(u),y=1<<d;y&i|r[d]&i&&(r[d]|=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 pa(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Lo(){var r=ne.p;return r!==0?r:(r=window.event,r===void 0?32:mS(r.type))}function Po(r,i){var u=ne.p;try{return ne.p=r,i()}finally{ne.p=u}}var qr=Math.random().toString(36).slice(2),fn="__reactFiber$"+qr,Vt="__reactProps$"+qr,La="__reactContainer$"+qr,sl="__reactEvents$"+qr,Lh="__reactListeners$"+qr,Hc="__reactHandles$"+qr,Uo="__reactResources$"+qr,bi="__reactMarker$"+qr;function Be(r){delete r[fn],delete r[Vt],delete r[sl],delete r[Lh],delete r[Hc]}function $(r){var i=r[fn];if(i)return i;for(var u=r.parentNode;u;){if(i=u[La]||u[fn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=Ww(r);r!==null;){if(u=r[fn])return u;r=Ww(r)}return i}r=u,u=r.parentNode}return null}function he(r){if(r=r[fn]||r[La]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ce(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function wt(r){var i=r[Uo];return i||(i=r[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function pt(r){r[bi]=!0}var Jt=new Set,Un={};function vn(r,i){Dn(r,i),Dn(r+"Capture",i)}function Dn(r,i){for(Un[r]=i,r=0;r<i.length;r++)Jt.add(i[r])}var Bo=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]*$"),hn={},Fo={};function qc(r){return Mt.call(Fo,r)?!0:Mt.call(hn,r)?!1:Bo.test(r)?Fo[r]=!0:(hn[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 d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="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 Pa(r,i,u,d){if(d===null)r.removeAttribute(u);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+d)}}function Zr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ib(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function $T(r,i,u){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(E){u=""+E,v.call(this,E)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return u},setValue:function(E){u=""+E},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Ph(r){if(!r._valueTracker){var i=Ib(r)?"checked":"value";r._valueTracker=$T(r,i,""+r[i])}}function Lb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=Ib(r)?r.checked?"true":"false":r.value),r=d,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 HT=/[\n"\\]/g;function Gr(r){return r.replace(HT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Uh(r,i,u,d,y,v,E,A){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),i!=null?E==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Zr(i)):r.value!==""+Zr(i)&&(r.value=""+Zr(i)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),i!=null?Bh(r,E,Zr(i)):u!=null?Bh(r,E,Zr(u)):d!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+Zr(A):r.removeAttribute("name")}function Pb(r,i,u,d,y,v,E,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Ph(r);return}u=u!=null?""+Zr(u):"",i=i!=null?""+Zr(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=A?r.checked:!!d,r.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),Ph(r)}function Bh(r,i,u){i==="number"&&Vc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function ll(r,i,u,d){if(r=r.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=i.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&d&&(r[u].defaultSelected=!0)}else{for(u=""+Zr(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Ub(r,i,u){if(i!=null&&(i=""+Zr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+Zr(u):""}function Bb(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(W(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=Zr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Ph(r)}function ol(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var qT=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 Fb(r,i,u){var d=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,u):typeof u!="number"||u===0||qT.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function $b(r,i,u){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,u!=null){for(var d in u)!u.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in i)d=i[y],i.hasOwnProperty(y)&&u[y]!==d&&Fb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Fb(r,v,i[v])}function Fh(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 ZT=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"]]),GT=/^[\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 GT.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ua(){}var $h=null;function Hh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ul=null,cl=null;function Hb(r){var i=he(r);if(i&&(r=i.stateNode)){var u=r[Vt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Uh(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Gr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[Vt]||null;if(!y)throw Error(a(90));Uh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)d=u[i],d.form===r.form&&Lb(d)}break e;case"textarea":Ub(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&ll(r,!!u.multiple,i,!1)}}}var qh=!1;function qb(r,i,u){if(qh)return r(i,u);qh=!0;try{var d=r(i);return d}finally{if(qh=!1,(ul!==null||cl!==null)&&(Dd(),ul&&(i=ul,r=cl,cl=ul=null,Hb(i),r)))for(i=0;i<r.length;i++)Hb(r[i])}}function $o(r,i){var u=r.stateNode;if(u===null)return null;var d=u[Vt]||null;if(d===null)return null;u=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var Ba=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zh=!1;if(Ba)try{var Ho={};Object.defineProperty(Ho,"passive",{get:function(){Zh=!0}}),window.addEventListener("test",Ho,Ho),window.removeEventListener("test",Ho,Ho)}catch{Zh=!1}var xi=null,Gh=null,Kc=null;function Zb(){if(Kc)return Kc;var r,i=Gh,u=i.length,d,y="value"in xi?xi.value:xi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var E=u-r;for(d=1;d<=E&&i[u-d]===y[v-d];d++);return Kc=y.slice(r,1<d?1-d: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 Gb(){return!1}function mr(r){function i(u,d,y,v,E){this._reactName=u,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=E,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:Gb,this.isPropagationStopped=Gb,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=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 vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wc=mr(vs),qo=g({},vs,{view:0,detail:0}),VT=mr(qo),Vh,Qh,Zo,Jc=g({},qo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Zo&&(Zo&&r.type==="mousemove"?(Vh=r.screenX-Zo.screenX,Qh=r.screenY-Zo.screenY):Qh=Vh=0,Zo=r),Vh)},movementY:function(r){return"movementY"in r?r.movementY:Qh}}),Vb=mr(Jc),QT=g({},Jc,{dataTransfer:0}),KT=mr(QT),YT=g({},qo,{relatedTarget:0}),Kh=mr(YT),XT=g({},vs,{animationName:0,elapsedTime:0,pseudoElement:0}),WT=mr(XT),JT=g({},vs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),eA=mr(JT),tA=g({},vs,{data:0}),Qb=mr(tA),nA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rA={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"},aA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iA(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=aA[r])?!!i[r]:!1}function Yh(){return iA}var sA=g({},qo,{key:function(r){if(r.key){var i=nA[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"?rA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yh,charCode:function(r){return r.type==="keypress"?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}}),lA=mr(sA),oA=g({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kb=mr(oA),uA=g({},qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yh}),cA=mr(uA),dA=g({},vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),fA=mr(dA),hA=g({},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}),mA=mr(hA),pA=g({},vs,{newState:0,oldState:0}),gA=mr(pA),yA=[9,13,27,32],Xh=Ba&&"CompositionEvent"in window,Go=null;Ba&&"documentMode"in document&&(Go=document.documentMode);var vA=Ba&&"TextEvent"in window&&!Go,Yb=Ba&&(!Xh||Go&&8<Go&&11>=Go),Xb=" ",Wb=!1;function Jb(r,i){switch(r){case"keyup":return yA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ex(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var dl=!1;function bA(r,i){switch(r){case"compositionend":return ex(i);case"keypress":return i.which!==32?null:(Wb=!0,Xb);case"textInput":return r=i.data,r===Xb&&Wb?null:r;default:return null}}function xA(r,i){if(dl)return r==="compositionend"||!Xh&&Jb(r,i)?(r=Zb(),Kc=Gh=xi=null,dl=!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 Yb&&i.locale!=="ko"?null:i.data;default:return null}}var wA={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 tx(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!wA[r.type]:i==="textarea"}function nx(r,i,u,d){ul?cl?cl.push(d):cl=[d]:ul=d,i=$d(i,"onChange"),0<i.length&&(u=new Wc("onChange","change",null,u,d),r.push({event:u,listeners:i}))}var Vo=null,Qo=null;function SA(r){Pw(r,0)}function ed(r){var i=Ce(r);if(Lb(i))return r}function rx(r,i){if(r==="change")return i}var ax=!1;if(Ba){var Wh;if(Ba){var Jh="oninput"in document;if(!Jh){var ix=document.createElement("div");ix.setAttribute("oninput","return;"),Jh=typeof ix.oninput=="function"}Wh=Jh}else Wh=!1;ax=Wh&&(!document.documentMode||9<document.documentMode)}function sx(){Vo&&(Vo.detachEvent("onpropertychange",lx),Qo=Vo=null)}function lx(r){if(r.propertyName==="value"&&ed(Qo)){var i=[];nx(i,Qo,r,Hh(r)),qb(SA,i)}}function kA(r,i,u){r==="focusin"?(sx(),Vo=i,Qo=u,Vo.attachEvent("onpropertychange",lx)):r==="focusout"&&sx()}function jA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ed(Qo)}function EA(r,i){if(r==="click")return ed(i)}function CA(r,i){if(r==="input"||r==="change")return ed(i)}function NA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Rr=typeof Object.is=="function"?Object.is:NA;function Ko(r,i){if(Rr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var u=Object.keys(r),d=Object.keys(i);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var y=u[d];if(!Mt.call(i,y)||!Rr(r[y],i[y]))return!1}return!0}function ox(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ux(r,i){var u=ox(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=i&&d>=i)return{node:u,offset:i-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=ox(u)}}function cx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?cx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function dx(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 em(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var _A=Ba&&"documentMode"in document&&11>=document.documentMode,fl=null,tm=null,Yo=null,nm=!1;function fx(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;nm||fl==null||fl!==Vc(d)||(d=fl,"selectionStart"in d&&em(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Yo&&Ko(Yo,d)||(Yo=d,d=$d(tm,"onSelect"),0<d.length&&(i=new Wc("onSelect","select",null,i,u),r.push({event:i,listeners:d}),i.target=fl)))}function bs(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var hl={animationend:bs("Animation","AnimationEnd"),animationiteration:bs("Animation","AnimationIteration"),animationstart:bs("Animation","AnimationStart"),transitionrun:bs("Transition","TransitionRun"),transitionstart:bs("Transition","TransitionStart"),transitioncancel:bs("Transition","TransitionCancel"),transitionend:bs("Transition","TransitionEnd")},rm={},hx={};Ba&&(hx=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function xs(r){if(rm[r])return rm[r];if(!hl[r])return r;var i=hl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in hx)return rm[r]=i[u];return r}var mx=xs("animationend"),px=xs("animationiteration"),gx=xs("animationstart"),TA=xs("transitionrun"),AA=xs("transitionstart"),RA=xs("transitioncancel"),yx=xs("transitionend"),vx=new Map,am="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");am.push("scrollEnd");function ga(r,i){vx.set(r,i),vn(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)},Vr=[],ml=0,im=0;function nd(){for(var r=ml,i=im=ml=0;i<r;){var u=Vr[i];Vr[i++]=null;var d=Vr[i];Vr[i++]=null;var y=Vr[i];Vr[i++]=null;var v=Vr[i];if(Vr[i++]=null,d!==null&&y!==null){var E=d.pending;E===null?y.next=y:(y.next=E.next,E.next=y),d.pending=y}v!==0&&bx(u,y,v)}}function rd(r,i,u,d){Vr[ml++]=r,Vr[ml++]=i,Vr[ml++]=u,Vr[ml++]=d,im|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function sm(r,i,u,d){return rd(r,i,u,d),ad(r)}function ws(r,i){return rd(r,null,null,i),ad(r)}function bx(r,i,u){r.lanes|=u;var d=r.alternate;d!==null&&(d.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,d=v.alternate,d!==null&&(d.childLanes|=u),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-ot(u),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=u|536870912),v):null}function ad(r){if(50<vu)throw vu=0,pp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var pl={};function OA(r,i,u,d){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(r,i,u,d){return new OA(r,i,u,d)}function lm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Fa(r,i){var u=r.alternate;return u===null?(u=Or(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 xx(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,d,y,v){var E=0;if(d=r,typeof r=="function")lm(r)&&(E=1);else if(typeof r=="string")E=L2(r,u,G.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case K:return r=Or(31,u,i,y),r.elementType=K,r.lanes=v,r;case j:return Ss(u.children,y,v,i);case S:E=8,y|=24;break;case C:return r=Or(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case P:return r=Or(13,u,i,y),r.elementType=P,r.lanes=v,r;case O:return r=Or(19,u,i,y),r.elementType=O,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case R:E=10;break e;case _:E=9;break e;case z:E=11;break e;case L:E=14;break e;case I:E=16,d=null;break e}E=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Or(E,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function Ss(r,i,u,d){return r=Or(7,r,d,i),r.lanes=u,r}function om(r,i,u){return r=Or(6,r,null,i),r.lanes=u,r}function wx(r){var i=Or(18,null,null,0);return i.stateNode=r,i}function um(r,i,u){return i=Or(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Sx=new WeakMap;function Qr(r,i){if(typeof r=="object"&&r!==null){var u=Sx.get(r);return u!==void 0?u:(i={value:r,source:i,stack:Ue(i)},Sx.set(r,i),i)}return{value:r,source:i,stack:Ue(i)}}var gl=[],yl=0,sd=null,Xo=0,Kr=[],Yr=0,wi=null,ja=1,Ea="";function $a(r,i){gl[yl++]=Xo,gl[yl++]=sd,sd=r,Xo=i}function kx(r,i,u){Kr[Yr++]=ja,Kr[Yr++]=Ea,Kr[Yr++]=wi,wi=r;var d=ja;r=Ea;var y=32-ot(d)-1;d&=~(1<<y),u+=1;var v=32-ot(i)+y;if(30<v){var E=y-y%5;v=(d&(1<<E)-1).toString(32),d>>=E,y-=E,ja=1<<32-ot(i)+y|u<<y|d,Ea=v+r}else ja=1<<v|u<<y|d,Ea=r}function cm(r){r.return!==null&&($a(r,1),kx(r,1,0))}function dm(r){for(;r===sd;)sd=gl[--yl],gl[yl]=null,Xo=gl[--yl],gl[yl]=null;for(;r===wi;)wi=Kr[--Yr],Kr[Yr]=null,Ea=Kr[--Yr],Kr[Yr]=null,ja=Kr[--Yr],Kr[Yr]=null}function jx(r,i){Kr[Yr++]=ja,Kr[Yr++]=Ea,Kr[Yr++]=wi,ja=i.id,Ea=i.overflow,wi=r}var Bn=null,$t=null,gt=!1,Si=null,Xr=!1,fm=Error(a(519));function ki(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(Qr(i,r)),fm}function Ex(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[fn]=r,i[Vt]=d,u){case"dialog":ct("cancel",i),ct("close",i);break;case"iframe":case"object":case"embed":ct("load",i);break;case"video":case"audio":for(u=0;u<xu.length;u++)ct(xu[u],i);break;case"source":ct("error",i);break;case"img":case"image":case"link":ct("error",i),ct("load",i);break;case"details":ct("toggle",i);break;case"input":ct("invalid",i),Pb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ct("invalid",i);break;case"textarea":ct("invalid",i),Bb(i,d.value,d.defaultValue,d.children)}u=d.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||d.suppressHydrationWarning===!0||$w(i.textContent,u)?(d.popover!=null&&(ct("beforetoggle",i),ct("toggle",i)),d.onScroll!=null&&ct("scroll",i),d.onScrollEnd!=null&&ct("scrollend",i),d.onClick!=null&&(i.onclick=Ua),i=!0):i=!1,i||ki(r,!0)}function Cx(r){for(Bn=r.return;Bn;)switch(Bn.tag){case 5:case 31:case 13:Xr=!1;return;case 27:case 3:Xr=!0;return;default:Bn=Bn.return}}function vl(r){if(r!==Bn)return!1;if(!gt)return Cx(r),gt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Ap(r.type,r.memoizedProps)),u=!u),u&&$t&&ki(r),Cx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=Xw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=Xw(r)}else i===27?(i=$t,Li(r.type)?(r=Dp,Dp=null,$t=r):$t=i):$t=Bn?Jr(r.stateNode.nextSibling):null;return!0}function ks(){$t=Bn=null,gt=!1}function hm(){var r=Si;return r!==null&&(vr===null?vr=r:vr.push.apply(vr,r),Si=null),r}function Wo(r){Si===null?Si=[r]:Si.push(r)}var mm=U(null),js=null,Ha=null;function ji(r,i,u){T(mm,i._currentValue),i._currentValue=u}function qa(r){r._currentValue=mm.current,F(mm)}function pm(r,i,u){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===u)break;r=r.return}}function gm(r,i,u,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var E=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var H=0;H<i.length;H++)if(A.context===i[H]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),pm(v.return,u,r),d||(E=null);break e}v=A.next}}else if(y.tag===18){if(E=y.return,E===null)throw Error(a(341));E.lanes|=u,v=E.alternate,v!==null&&(v.lanes|=u),pm(E,u,r),E=null}else E=y.child;if(E!==null)E.return=y;else for(E=y;E!==null;){if(E===r){E=null;break}if(y=E.sibling,y!==null){y.return=E.return,E=y;break}E=E.return}y=E}}function bl(r,i,u,d){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var E=y.alternate;if(E===null)throw Error(a(387));if(E=E.memoizedProps,E!==null){var A=y.type;Rr(y.pendingProps.value,E.value)||(r!==null?r.push(A):r=[A])}}else if(y===ve.current){if(E=y.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Eu):r=[Eu])}y=y.return}r!==null&&gm(i,r,u,d),i.flags|=262144}function ld(r){for(r=r.firstContext;r!==null;){if(!Rr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Es(r){js=r,Ha=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Fn(r){return Nx(js,r)}function od(r,i){return js===null&&Es(r),Nx(r,i)}function Nx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},Ha===null){if(r===null)throw Error(a(308));Ha=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Ha=Ha.next=i;return u}var zA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},MA=e.unstable_scheduleCallback,DA=e.unstable_NormalPriority,bn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ym(){return{controller:new zA,data:new Map,refCount:0}}function Jo(r){r.refCount--,r.refCount===0&&MA(DA,function(){r.controller.abort()})}var eu=null,vm=0,xl=0,wl=null;function IA(r,i){if(eu===null){var u=eu=[];vm=0,xl=wp(),wl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return vm++,i.then(_x,_x),i}function _x(){if(--vm===0&&eu!==null){wl!==null&&(wl.status="fulfilled");var r=eu;eu=null,xl=0,wl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function LA(r,i){var u=[],d={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),d}var Tx=Z.S;Z.S=function(r,i){fw=cn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&IA(r,i),Tx!==null&&Tx(r,i)};var Cs=U(null);function bm(){var r=Cs.current;return r!==null?r:Dt.pooledCache}function ud(r,i){i===null?T(Cs,Cs.current):T(Cs,i.pool)}function Ax(){var r=bm();return r===null?null:{parent:bn._currentValue,pool:r}}var Sl=Error(a(460)),xm=Error(a(474)),cd=Error(a(542)),dd={then:function(){}};function Rx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ox(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(Ua,Ua),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Mx(r),r;default:if(typeof i.status=="string")i.then(Ua,Ua);else{if(r=Dt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Mx(r),r}throw _s=i,Sl}}function Ns(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(_s=u,Sl):u}}var _s=null;function zx(){if(_s===null)throw Error(a(459));var r=_s;return _s=null,r}function Mx(r){if(r===Sl||r===cd)throw Error(a(483))}var kl=null,tu=0;function fd(r){var i=tu;return tu+=1,kl===null&&(kl=[]),Ox(kl,r,i)}function nu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function hd(r,i){throw i.$$typeof===x?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Dx(r){function i(X,Q){if(r){var ee=X.deletions;ee===null?(X.deletions=[Q],X.flags|=16):ee.push(Q)}}function u(X,Q){if(!r)return null;for(;Q!==null;)i(X,Q),Q=Q.sibling;return null}function d(X){for(var Q=new Map;X!==null;)X.key!==null?Q.set(X.key,X):Q.set(X.index,X),X=X.sibling;return Q}function y(X,Q){return X=Fa(X,Q),X.index=0,X.sibling=null,X}function v(X,Q,ee){return X.index=ee,r?(ee=X.alternate,ee!==null?(ee=ee.index,ee<Q?(X.flags|=67108866,Q):ee):(X.flags|=67108866,Q)):(X.flags|=1048576,Q)}function E(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function A(X,Q,ee,de){return Q===null||Q.tag!==6?(Q=om(ee,X.mode,de),Q.return=X,Q):(Q=y(Q,ee),Q.return=X,Q)}function H(X,Q,ee,de){var Fe=ee.type;return Fe===j?ue(X,Q,ee.props.children,de,ee.key):Q!==null&&(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===I&&Ns(Fe)===Q.type)?(Q=y(Q,ee.props),nu(Q,ee),Q.return=X,Q):(Q=id(ee.type,ee.key,ee.props,null,X.mode,de),nu(Q,ee),Q.return=X,Q)}function te(X,Q,ee,de){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ee.containerInfo||Q.stateNode.implementation!==ee.implementation?(Q=um(ee,X.mode,de),Q.return=X,Q):(Q=y(Q,ee.children||[]),Q.return=X,Q)}function ue(X,Q,ee,de,Fe){return Q===null||Q.tag!==7?(Q=Ss(ee,X.mode,de,Fe),Q.return=X,Q):(Q=y(Q,ee),Q.return=X,Q)}function fe(X,Q,ee){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=om(""+Q,X.mode,ee),Q.return=X,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return ee=id(Q.type,Q.key,Q.props,null,X.mode,ee),nu(ee,Q),ee.return=X,ee;case k:return Q=um(Q,X.mode,ee),Q.return=X,Q;case I:return Q=Ns(Q),fe(X,Q,ee)}if(W(Q)||se(Q))return Q=Ss(Q,X.mode,ee,null),Q.return=X,Q;if(typeof Q.then=="function")return fe(X,fd(Q),ee);if(Q.$$typeof===R)return fe(X,od(X,Q),ee);hd(X,Q)}return null}function ae(X,Q,ee,de){var Fe=Q!==null?Q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Fe!==null?null:A(X,Q,""+ee,de);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Fe?H(X,Q,ee,de):null;case k:return ee.key===Fe?te(X,Q,ee,de):null;case I:return ee=Ns(ee),ae(X,Q,ee,de)}if(W(ee)||se(ee))return Fe!==null?null:ue(X,Q,ee,de,null);if(typeof ee.then=="function")return ae(X,Q,fd(ee),de);if(ee.$$typeof===R)return ae(X,Q,od(X,ee),de);hd(X,ee)}return null}function le(X,Q,ee,de,Fe){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return X=X.get(ee)||null,A(Q,X,""+de,Fe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return X=X.get(de.key===null?ee:de.key)||null,H(Q,X,de,Fe);case k:return X=X.get(de.key===null?ee:de.key)||null,te(Q,X,de,Fe);case I:return de=Ns(de),le(X,Q,ee,de,Fe)}if(W(de)||se(de))return X=X.get(ee)||null,ue(Q,X,de,Fe,null);if(typeof de.then=="function")return le(X,Q,ee,fd(de),Fe);if(de.$$typeof===R)return le(X,Q,ee,od(Q,de),Fe);hd(Q,de)}return null}function Te(X,Q,ee,de){for(var Fe=null,kt=null,De=Q,Xe=Q=0,ht=null;De!==null&&Xe<ee.length;Xe++){De.index>Xe?(ht=De,De=null):ht=De.sibling;var jt=ae(X,De,ee[Xe],de);if(jt===null){De===null&&(De=ht);break}r&&De&&jt.alternate===null&&i(X,De),Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt,De=ht}if(Xe===ee.length)return u(X,De),gt&&$a(X,Xe),Fe;if(De===null){for(;Xe<ee.length;Xe++)De=fe(X,ee[Xe],de),De!==null&&(Q=v(De,Q,Xe),kt===null?Fe=De:kt.sibling=De,kt=De);return gt&&$a(X,Xe),Fe}for(De=d(De);Xe<ee.length;Xe++)ht=le(De,X,Xe,ee[Xe],de),ht!==null&&(r&&ht.alternate!==null&&De.delete(ht.key===null?Xe:ht.key),Q=v(ht,Q,Xe),kt===null?Fe=ht:kt.sibling=ht,kt=ht);return r&&De.forEach(function($i){return i(X,$i)}),gt&&$a(X,Xe),Fe}function Ze(X,Q,ee,de){if(ee==null)throw Error(a(151));for(var Fe=null,kt=null,De=Q,Xe=Q=0,ht=null,jt=ee.next();De!==null&&!jt.done;Xe++,jt=ee.next()){De.index>Xe?(ht=De,De=null):ht=De.sibling;var $i=ae(X,De,jt.value,de);if($i===null){De===null&&(De=ht);break}r&&De&&$i.alternate===null&&i(X,De),Q=v($i,Q,Xe),kt===null?Fe=$i:kt.sibling=$i,kt=$i,De=ht}if(jt.done)return u(X,De),gt&&$a(X,Xe),Fe;if(De===null){for(;!jt.done;Xe++,jt=ee.next())jt=fe(X,jt.value,de),jt!==null&&(Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt);return gt&&$a(X,Xe),Fe}for(De=d(De);!jt.done;Xe++,jt=ee.next())jt=le(De,X,Xe,jt.value,de),jt!==null&&(r&&jt.alternate!==null&&De.delete(jt.key===null?Xe:jt.key),Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt);return r&&De.forEach(function(Q2){return i(X,Q2)}),gt&&$a(X,Xe),Fe}function zt(X,Q,ee,de){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:e:{for(var Fe=ee.key;Q!==null;){if(Q.key===Fe){if(Fe=ee.type,Fe===j){if(Q.tag===7){u(X,Q.sibling),de=y(Q,ee.props.children),de.return=X,X=de;break e}}else if(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===I&&Ns(Fe)===Q.type){u(X,Q.sibling),de=y(Q,ee.props),nu(de,ee),de.return=X,X=de;break e}u(X,Q);break}else i(X,Q);Q=Q.sibling}ee.type===j?(de=Ss(ee.props.children,X.mode,de,ee.key),de.return=X,X=de):(de=id(ee.type,ee.key,ee.props,null,X.mode,de),nu(de,ee),de.return=X,X=de)}return E(X);case k:e:{for(Fe=ee.key;Q!==null;){if(Q.key===Fe)if(Q.tag===4&&Q.stateNode.containerInfo===ee.containerInfo&&Q.stateNode.implementation===ee.implementation){u(X,Q.sibling),de=y(Q,ee.children||[]),de.return=X,X=de;break e}else{u(X,Q);break}else i(X,Q);Q=Q.sibling}de=um(ee,X.mode,de),de.return=X,X=de}return E(X);case I:return ee=Ns(ee),zt(X,Q,ee,de)}if(W(ee))return Te(X,Q,ee,de);if(se(ee)){if(Fe=se(ee),typeof Fe!="function")throw Error(a(150));return ee=Fe.call(ee),Ze(X,Q,ee,de)}if(typeof ee.then=="function")return zt(X,Q,fd(ee),de);if(ee.$$typeof===R)return zt(X,Q,od(X,ee),de);hd(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,Q!==null&&Q.tag===6?(u(X,Q.sibling),de=y(Q,ee),de.return=X,X=de):(u(X,Q),de=om(ee,X.mode,de),de.return=X,X=de),E(X)):u(X,Q)}return function(X,Q,ee,de){try{tu=0;var Fe=zt(X,Q,ee,de);return kl=null,Fe}catch(De){if(De===Sl||De===cd)throw De;var kt=Or(29,De,null,X.mode);return kt.lanes=de,kt.return=X,kt}finally{}}}var Ts=Dx(!0),Ix=Dx(!1),Ei=!1;function wm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sm(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ci(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ni(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=ad(r),bx(r,null,u),i}return rd(r,d,i,u),ad(r)}function ru(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ys(r,u)}}function km(r,i){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var E={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=E:v=v.next=E,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var jm=!1;function au(){if(jm){var r=wl;if(r!==null)throw r}}function iu(r,i,u,d){jm=!1;var y=r.updateQueue;Ei=!1;var v=y.firstBaseUpdate,E=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,te=H.next;H.next=null,E===null?v=te:E.next=te,E=H;var ue=r.alternate;ue!==null&&(ue=ue.updateQueue,A=ue.lastBaseUpdate,A!==E&&(A===null?ue.firstBaseUpdate=te:A.next=te,ue.lastBaseUpdate=H))}if(v!==null){var fe=y.baseState;E=0,ue=te=H=null,A=v;do{var ae=A.lane&-536870913,le=ae!==A.lane;if(le?(ft&ae)===ae:(d&ae)===ae){ae!==0&&ae===xl&&(jm=!0),ue!==null&&(ue=ue.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Te=r,Ze=A;ae=i;var zt=u;switch(Ze.tag){case 1:if(Te=Ze.payload,typeof Te=="function"){fe=Te.call(zt,fe,ae);break e}fe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ze.payload,ae=typeof Te=="function"?Te.call(zt,fe,ae):Te,ae==null)break e;fe=g({},fe,ae);break e;case 2:Ei=!0}}ae=A.callback,ae!==null&&(r.flags|=64,le&&(r.flags|=8192),le=y.callbacks,le===null?y.callbacks=[ae]:le.push(ae))}else le={lane:ae,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ue===null?(te=ue=le,H=fe):ue=ue.next=le,E|=ae;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);ue===null&&(H=fe),y.baseState=H,y.firstBaseUpdate=te,y.lastBaseUpdate=ue,v===null&&(y.shared.lanes=0),Oi|=E,r.lanes=E,r.memoizedState=fe}}function Lx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Px(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Lx(u[r],i)}var jl=U(null),md=U(0);function Ux(r,i){r=Ja,T(md,r),T(jl,i),Ja=r|i.baseLanes}function Em(){T(md,Ja),T(jl,jl.current)}function Cm(){Ja=md.current,F(jl),F(md)}var zr=U(null),Wr=null;function _i(r){var i=r.alternate;T(mn,mn.current&1),T(zr,r),Wr===null&&(i===null||jl.current!==null||i.memoizedState!==null)&&(Wr=r)}function Nm(r){T(mn,mn.current),T(zr,r),Wr===null&&(Wr=r)}function Bx(r){r.tag===22?(T(mn,mn.current),T(zr,r),Wr===null&&(Wr=r)):Ti()}function Ti(){T(mn,mn.current),T(zr,zr.current)}function Mr(r){F(zr),Wr===r&&(Wr=null),F(mn)}var mn=U(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||zp(u)||Mp(u)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Za=0,Ye=null,Rt=null,xn=null,gd=!1,El=!1,As=!1,yd=0,su=0,Cl=null,PA=0;function rn(){throw Error(a(321))}function _m(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!Rr(r[u],i[u]))return!1;return!0}function Tm(r,i,u,d,y,v){return Za=v,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Z.H=r===null||r.memoizedState===null?k0:qm,As=!1,v=u(d,y),As=!1,El&&(v=$x(i,u,d,y)),Fx(r),v}function Fx(r){Z.H=uu;var i=Rt!==null&&Rt.next!==null;if(Za=0,xn=Rt=Ye=null,gd=!1,su=0,Cl=null,i)throw Error(a(300));r===null||wn||(r=r.dependencies,r!==null&&ld(r)&&(wn=!0))}function $x(r,i,u,d){Ye=r;var y=0;do{if(El&&(Cl=null),su=0,El=!1,25<=y)throw Error(a(301));if(y+=1,xn=Rt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}Z.H=j0,v=i(u,d)}while(El);return v}function UA(){var r=Z.H,i=r.useState()[0];return i=typeof i.then=="function"?lu(i):i,r=r.useState()[0],(Rt!==null?Rt.memoizedState:null)!==r&&(Ye.flags|=1024),i}function Am(){var r=yd!==0;return yd=0,r}function Rm(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function Om(r){if(gd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gd=!1}Za=0,xn=Rt=Ye=null,El=!1,su=yd=0,Cl=null}function ar(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xn===null?Ye.memoizedState=xn=r:xn=xn.next=r,xn}function pn(){if(Rt===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=Rt.next;var i=xn===null?Ye.memoizedState:xn.next;if(i!==null)xn=i,Rt=r;else{if(r===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));Rt=r,r={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},xn===null?Ye.memoizedState=xn=r:xn=xn.next=r}return xn}function vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(r){var i=su;return su+=1,Cl===null&&(Cl=[]),r=Ox(Cl,r,i),i=Ye,(xn===null?i.memoizedState:xn.next)===null&&(i=i.alternate,Z.H=i===null||i.memoizedState===null?k0:qm),r}function bd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return lu(r);if(r.$$typeof===R)return Fn(r)}throw Error(a(438,String(r)))}function zm(r){var i=null,u=Ye.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var d=Ye.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=vd(),Ye.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),d=0;d<r;d++)u[d]=D;return i.index++,u}function Ga(r,i){return typeof i=="function"?i(r):i}function xd(r){var i=pn();return Mm(i,Rt,r)}function Mm(r,i,u){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=u;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var E=y.next;y.next=v.next,v.next=E}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=E=null,H=null,te=i,ue=!1;do{var fe=te.lane&-536870913;if(fe!==te.lane?(ft&fe)===fe:(Za&fe)===fe){var ae=te.revertLane;if(ae===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),fe===xl&&(ue=!0);else if((Za&ae)===ae){te=te.next,ae===xl&&(ue=!0);continue}else fe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(A=H=fe,E=v):H=H.next=fe,Ye.lanes|=ae,Oi|=ae;fe=te.action,As&&u(v,fe),v=te.hasEagerState?te.eagerState:u(v,fe)}else ae={lane:fe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(A=H=ae,E=v):H=H.next=ae,Ye.lanes|=fe,Oi|=fe;te=te.next}while(te!==null&&te!==i);if(H===null?E=v:H.next=A,!Rr(v,r.memoizedState)&&(wn=!0,ue&&(u=wl,u!==null)))throw u;r.memoizedState=v,r.baseState=E,r.baseQueue=H,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Dm(r){var i=pn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var E=y=y.next;do v=r(v,E.action),E=E.next;while(E!==y);Rr(v,i.memoizedState)||(wn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function Hx(r,i,u){var d=Ye,y=pn(),v=gt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var E=!Rr((Rt||y).memoizedState,u);if(E&&(y.memoizedState=u,wn=!0),y=y.queue,Pm(Gx.bind(null,d,y,r),[r]),y.getSnapshot!==i||E||xn!==null&&xn.memoizedState.tag&1){if(d.flags|=2048,Nl(9,{destroy:void 0},Zx.bind(null,d,y,u,i),null),Dt===null)throw Error(a(349));v||(Za&127)!==0||qx(d,i,u)}return u}function qx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Ye.updateQueue,i===null?(i=vd(),Ye.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Zx(r,i,u,d){i.value=u,i.getSnapshot=d,Vx(i)&&Qx(r)}function Gx(r,i,u){return u(function(){Vx(i)&&Qx(r)})}function Vx(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!Rr(r,u)}catch{return!0}}function Qx(r){var i=ws(r,2);i!==null&&br(i,r,2)}function Im(r){var i=ar();if(typeof r=="function"){var u=r;if(r=u(),As){At(!0);try{u()}finally{At(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:r},i}function Kx(r,i,u,d){return r.baseState=u,Mm(r,Rt,typeof d=="function"?d:Ga)}function BA(r,i,u,d,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(E){v.listeners.push(E)}};Z.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,Yx(i,v)):(v.next=u.next,i.pending=u.next=v)}}function Yx(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=Z.T,E={};Z.T=E;try{var A=u(y,d),H=Z.S;H!==null&&H(E,A),Xx(r,i,A)}catch(te){Lm(r,i,te)}finally{v!==null&&E.types!==null&&(v.types=E.types),Z.T=v}}else try{v=u(y,d),Xx(r,i,v)}catch(te){Lm(r,i,te)}}function Xx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){Wx(r,i,d)},function(d){return Lm(r,i,d)}):Wx(r,i,u)}function Wx(r,i,u){i.status="fulfilled",i.value=u,Jx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,Yx(r,u)))}function Lm(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,Jx(i),i=i.next;while(i!==d)}r.action=null}function Jx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function e0(r,i){return i}function t0(r,i){if(gt){var u=Dt.formState;if(u!==null){e:{var d=Ye;if(gt){if($t){t:{for(var y=$t,v=Xr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Jr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){$t=Jr(y.nextSibling),d=y.data==="F!";break e}}ki(d)}d=!1}d&&(i=u[0])}}return u=ar(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e0,lastRenderedState:i},u.queue=d,u=x0.bind(null,Ye,d),d.dispatch=u,d=Im(!1),v=Hm.bind(null,Ye,!1,d.queue),d=ar(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=BA.bind(null,Ye,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function n0(r){var i=pn();return r0(i,Rt,r)}function r0(r,i,u){if(i=Mm(r,i,e0)[0],r=xd(Ga)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=lu(i)}catch(E){throw E===Sl?cd:E}else d=i;i=pn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Ye.flags|=2048,Nl(9,{destroy:void 0},FA.bind(null,y,u),null)),[d,v,r]}function FA(r,i){r.action=i}function a0(r){var i=pn(),u=Rt;if(u!==null)return r0(i,u,r);pn(),i=i.memoizedState,u=pn();var d=u.queue.dispatch;return u.memoizedState=r,[i,d,!1]}function Nl(r,i,u,d){return r={tag:r,create:u,deps:d,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=vd(),Ye.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,i.lastEffect=r),r}function i0(){return pn().memoizedState}function wd(r,i,u,d){var y=ar();Ye.flags|=r,y.memoizedState=Nl(1|i,{destroy:void 0},u,d===void 0?null:d)}function Sd(r,i,u,d){var y=pn();d=d===void 0?null:d;var v=y.memoizedState.inst;Rt!==null&&d!==null&&_m(d,Rt.memoizedState.deps)?y.memoizedState=Nl(i,v,u,d):(Ye.flags|=r,y.memoizedState=Nl(1|i,v,u,d))}function s0(r,i){wd(8390656,8,r,i)}function Pm(r,i){Sd(2048,8,r,i)}function $A(r){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=vd(),Ye.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function l0(r){var i=pn().memoizedState;return $A({ref:i,nextImpl:r}),function(){if((Et&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function o0(r,i){return Sd(4,2,r,i)}function u0(r,i){return Sd(4,4,r,i)}function c0(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 d0(r,i,u){u=u!=null?u.concat([r]):null,Sd(4,4,c0.bind(null,i,r),u)}function Um(){}function f0(r,i){var u=pn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&_m(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function h0(r,i){var u=pn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&_m(i,d[1]))return d[0];if(d=r(),As){At(!0);try{r()}finally{At(!1)}}return u.memoizedState=[d,i],d}function Bm(r,i,u){return u===void 0||(Za&1073741824)!==0&&(ft&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=mw(),Ye.lanes|=r,Oi|=r,u)}function m0(r,i,u,d){return Rr(u,i)?u:jl.current!==null?(r=Bm(r,u,d),Rr(r,i)||(wn=!0),r):(Za&42)===0||(Za&1073741824)!==0&&(ft&261930)===0?(wn=!0,r.memoizedState=u):(r=mw(),Ye.lanes|=r,Oi|=r,i)}function p0(r,i,u,d,y){var v=ne.p;ne.p=v!==0&&8>v?v:8;var E=Z.T,A={};Z.T=A,Hm(r,!1,i,u);try{var H=y(),te=Z.S;if(te!==null&&te(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ue=LA(H,d);ou(r,i,ue,Lr(r))}else ou(r,i,d,Lr(r))}catch(fe){ou(r,i,{then:function(){},status:"rejected",reason:fe},Lr())}finally{ne.p=v,E!==null&&A.types!==null&&(E.types=A.types),Z.T=E}}function HA(){}function Fm(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=g0(r).queue;p0(r,y,i,ke,u===null?HA:function(){return y0(r),u(d)})}function g0(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:Ga,lastRenderedState:ke},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function y0(r){var i=g0(r);i.next===null&&(i=r.alternate.memoizedState),ou(r,i.next.queue,{},Lr())}function $m(){return Fn(Eu)}function v0(){return pn().memoizedState}function b0(){return pn().memoizedState}function qA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Lr();r=Ci(u);var d=Ni(i,r,u);d!==null&&(br(d,i,u),ru(d,i,u)),i={cache:ym()},r.payload=i;return}i=i.return}}function ZA(r,i,u){var d=Lr();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},kd(r)?w0(i,u):(u=sm(r,i,u,d),u!==null&&(br(u,r,d),S0(u,i,d)))}function x0(r,i,u){var d=Lr();ou(r,i,u,d)}function ou(r,i,u,d){var y={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(kd(r))w0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var E=i.lastRenderedState,A=v(E,u);if(y.hasEagerState=!0,y.eagerState=A,Rr(A,E))return rd(r,i,y,0),Dt===null&&nd(),!1}catch{}finally{}if(u=sm(r,i,y,d),u!==null)return br(u,r,d),S0(u,i,d),!0}return!1}function Hm(r,i,u,d){if(d={lane:2,revertLane:wp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},kd(r)){if(i)throw Error(a(479))}else i=sm(r,u,d,2),i!==null&&br(i,r,2)}function kd(r){var i=r.alternate;return r===Ye||i!==null&&i===Ye}function w0(r,i){El=gd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function S0(r,i,u){if((u&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ys(r,u)}}var uu={readContext:Fn,use:bd,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};uu.useEffectEvent=rn;var k0={readContext:Fn,use:bd,useCallback:function(r,i){return ar().memoizedState=[r,i===void 0?null:i],r},useContext:Fn,useEffect:s0,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,wd(4194308,4,c0.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 d=r();if(As){At(!0);try{r()}finally{At(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=ar();if(u!==void 0){var y=u(i);if(As){At(!0);try{u(i)}finally{At(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=ZA.bind(null,Ye,r),[d.memoizedState,r]},useRef:function(r){var i=ar();return r={current:r},i.memoizedState=r},useState:function(r){r=Im(r);var i=r.queue,u=x0.bind(null,Ye,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Um,useDeferredValue:function(r,i){var u=ar();return Bm(u,r,i)},useTransition:function(){var r=Im(!1);return r=p0.bind(null,Ye,r.queue,!0,!1),ar().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=Ye,y=ar();if(gt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Dt===null)throw Error(a(349));(ft&127)!==0||qx(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,s0(Gx.bind(null,d,v,r),[r]),d.flags|=2048,Nl(9,{destroy:void 0},Zx.bind(null,d,v,u,i),null),u},useId:function(){var r=ar(),i=Dt.identifierPrefix;if(gt){var u=Ea,d=ja;u=(d&~(1<<32-ot(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=yd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=PA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:$m,useFormState:t0,useActionState:t0,useOptimistic:function(r){var i=ar();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=Hm.bind(null,Ye,!0,u),u.dispatch=i,[r,i]},useMemoCache:zm,useCacheRefresh:function(){return ar().memoizedState=qA.bind(null,Ye)},useEffectEvent:function(r){var i=ar(),u={impl:r};return i.memoizedState=u,function(){if((Et&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},qm={readContext:Fn,use:bd,useCallback:f0,useContext:Fn,useEffect:Pm,useImperativeHandle:d0,useInsertionEffect:o0,useLayoutEffect:u0,useMemo:h0,useReducer:xd,useRef:i0,useState:function(){return xd(Ga)},useDebugValue:Um,useDeferredValue:function(r,i){var u=pn();return m0(u,Rt.memoizedState,r,i)},useTransition:function(){var r=xd(Ga)[0],i=pn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:Hx,useId:v0,useHostTransitionStatus:$m,useFormState:n0,useActionState:n0,useOptimistic:function(r,i){var u=pn();return Kx(u,Rt,r,i)},useMemoCache:zm,useCacheRefresh:b0};qm.useEffectEvent=l0;var j0={readContext:Fn,use:bd,useCallback:f0,useContext:Fn,useEffect:Pm,useImperativeHandle:d0,useInsertionEffect:o0,useLayoutEffect:u0,useMemo:h0,useReducer:Dm,useRef:i0,useState:function(){return Dm(Ga)},useDebugValue:Um,useDeferredValue:function(r,i){var u=pn();return Rt===null?Bm(u,r,i):m0(u,Rt.memoizedState,r,i)},useTransition:function(){var r=Dm(Ga)[0],i=pn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:Hx,useId:v0,useHostTransitionStatus:$m,useFormState:a0,useActionState:a0,useOptimistic:function(r,i){var u=pn();return Rt!==null?Kx(u,Rt,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:zm,useCacheRefresh:b0};j0.useEffectEvent=l0;function Zm(r,i,u,d){i=r.memoizedState,u=u(d,i),u=u==null?i:g({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Gm={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Lr(),y=Ci(d);y.payload=i,u!=null&&(y.callback=u),i=Ni(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Lr(),y=Ci(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=Ni(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Lr(),d=Ci(u);d.tag=2,i!=null&&(d.callback=i),i=Ni(r,d,u),i!==null&&(br(i,r,u),ru(i,r,u))}};function E0(r,i,u,d,y,v,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,E):i.prototype&&i.prototype.isPureReactComponent?!Ko(u,d)||!Ko(y,v):!0}function C0(r,i,u,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,d),i.state!==r&&Gm.enqueueReplaceState(i,i.state,null)}function Rs(r,i){var u=i;if("ref"in i){u={};for(var d in i)d!=="ref"&&(u[d]=i[d])}if(r=r.defaultProps){u===i&&(u=g({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function N0(r){td(r)}function _0(r){console.error(r)}function T0(r){td(r)}function jd(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function A0(r,i,u){try{var d=r.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Vm(r,i,u){return u=Ci(u),u.tag=3,u.payload={element:null},u.callback=function(){jd(r,i)},u}function R0(r){return r=Ci(r),r.tag=3,r}function O0(r,i,u,d){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){A0(i,u,d)}}var E=u.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){A0(i,u,d),typeof y!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function GA(r,i,u,d,y){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=u.alternate,i!==null&&bl(i,u,y,!0),u=zr.current,u!==null){switch(u.tag){case 31:case 13:return Wr===null?Id():u.alternate===null&&an===0&&(an=3),u.flags&=-257,u.flags|=65536,u.lanes=y,d===dd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([d]):i.add(d),vp(r,d,y)),!1;case 22:return u.flags|=65536,d===dd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([d]):u.add(d)),vp(r,d,y)),!1}throw Error(a(435,u.tag))}return vp(r,d,y),Id(),!1}if(gt)return i=zr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==fm&&(r=Error(a(422),{cause:d}),Wo(Qr(r,u)))):(d!==fm&&(i=Error(a(423),{cause:d}),Wo(Qr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Qr(d,u),y=Vm(r.stateNode,d,y),km(r,y),an!==4&&(an=2)),!1;var v=Error(a(520),{cause:d});if(v=Qr(v,u),yu===null?yu=[v]:yu.push(v),an!==4&&(an=2),i===null)return!0;d=Qr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Vm(u.stateNode,d,r),km(u,r),!1;case 1:if(i=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(zi===null||!zi.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=R0(y),O0(y,r,u,d),km(u,y),!1}u=u.return}while(u!==null);return!1}var Qm=Error(a(461)),wn=!1;function $n(r,i,u,d){i.child=r===null?Ix(i,null,u,d):Ts(i,r.child,u,d)}function z0(r,i,u,d,y){u=u.render;var v=i.ref;if("ref"in d){var E={};for(var A in d)A!=="ref"&&(E[A]=d[A])}else E=d;return Es(i),d=Tm(r,i,u,E,v,y),A=Am(),r!==null&&!wn?(Rm(r,i,y),Va(r,i,y)):(gt&&A&&cm(i),i.flags|=1,$n(r,i,d,y),i.child)}function M0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!lm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,D0(r,i,v,d,y)):(r=id(u.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!np(r,y)){var E=v.memoizedProps;if(u=u.compare,u=u!==null?u:Ko,u(E,d)&&r.ref===i.ref)return Va(r,i,y)}return i.flags|=1,r=Fa(v,d),r.ref=i.ref,r.return=i,i.child=r}function D0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(Ko(v,d)&&r.ref===i.ref)if(wn=!1,i.pendingProps=d=v,np(r,y))(r.flags&131072)!==0&&(wn=!0);else return i.lanes=r.lanes,Va(r,i,y)}return Km(r,i,u,d,y)}function I0(r,i,u,d){var y=d.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,r!==null){for(d=i.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~v}else d=0,i.child=null;return L0(r,i,v,u,d)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&ud(i,v!==null?v.cachePool:null),v!==null?Ux(i,v):Em(),Bx(i);else return d=i.lanes=536870912,L0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(ud(i,v.cachePool),Ux(i,v),Ti(),i.memoizedState=null):(r!==null&&ud(i,null),Em(),Ti());return $n(r,i,y,u),i.child}function cu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function L0(r,i,u,d,y){var v=bm();return v=v===null?null:{parent:bn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&ud(i,null),Em(),Bx(i),r!==null&&bl(r,i,d,!0),i.childLanes=y,null}function Ed(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 P0(r,i,u){return Ts(i,r.child,null,u),r=Ed(i,i.pendingProps),r.flags|=2,Mr(i),i.memoizedState=null,r}function VA(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(gt){if(d.mode==="hidden")return r=Ed(i,d),i.lanes=536870912,cu(null,r);if(Nm(i),(r=$t)?(r=Yw(r,Xr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:wi!==null?{id:ja,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},u=wx(r),u.return=i,i.child=u,Bn=i,$t=null)):r=null,r===null)throw ki(i);return i.lanes=536870912,null}return Ed(i,d)}var v=r.memoizedState;if(v!==null){var E=v.dehydrated;if(Nm(i),y)if(i.flags&256)i.flags&=-257,i=P0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(wn||bl(r,i,u,!1),y=(u&r.childLanes)!==0,wn||y){if(d=Dt,d!==null&&(E=$c(d,u),E!==0&&E!==v.retryLane))throw v.retryLane=E,ws(r,E),br(d,r,E),Qm;Id(),i=P0(r,i,u)}else r=v.treeContext,$t=Jr(E.nextSibling),Bn=i,gt=!0,Si=null,Xr=!1,r!==null&&jx(i,r),i=Ed(i,d),i.flags|=4096;return i}return r=Fa(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Cd(r,i){var u=i.ref;if(u===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(a(284));(r===null||r.ref!==u)&&(i.flags|=4194816)}}function Km(r,i,u,d,y){return Es(i),u=Tm(r,i,u,d,void 0,y),d=Am(),r!==null&&!wn?(Rm(r,i,y),Va(r,i,y)):(gt&&d&&cm(i),i.flags|=1,$n(r,i,u,y),i.child)}function U0(r,i,u,d,y,v){return Es(i),i.updateQueue=null,u=$x(i,d,u,y),Fx(r),d=Am(),r!==null&&!wn?(Rm(r,i,v),Va(r,i,v)):(gt&&d&&cm(i),i.flags|=1,$n(r,i,u,v),i.child)}function B0(r,i,u,d,y){if(Es(i),i.stateNode===null){var v=pl,E=u.contextType;typeof E=="object"&&E!==null&&(v=Fn(E)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Gm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},wm(i),E=u.contextType,v.context=typeof E=="object"&&E!==null?Fn(E):pl,v.state=i.memoizedState,E=u.getDerivedStateFromProps,typeof E=="function"&&(Zm(i,u,E,d),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(E=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),E!==v.state&&Gm.enqueueReplaceState(v,v.state,null),iu(i,d,v,y),au(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,H=Rs(u,A);v.props=H;var te=v.context,ue=u.contextType;E=pl,typeof ue=="object"&&ue!==null&&(E=Fn(ue));var fe=u.getDerivedStateFromProps;ue=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ue||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||te!==E)&&C0(i,v,d,E),Ei=!1;var ae=i.memoizedState;v.state=ae,iu(i,d,v,y),au(),te=i.memoizedState,A||ae!==te||Ei?(typeof fe=="function"&&(Zm(i,u,fe,d),te=i.memoizedState),(H=Ei||E0(i,u,H,d,ae,te,E))?(ue||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=te),v.props=d,v.state=te,v.context=E,d=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Sm(r,i),E=i.memoizedProps,ue=Rs(u,E),v.props=ue,fe=i.pendingProps,ae=v.context,te=u.contextType,H=pl,typeof te=="object"&&te!==null&&(H=Fn(te)),A=u.getDerivedStateFromProps,(te=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E!==fe||ae!==H)&&C0(i,v,d,H),Ei=!1,ae=i.memoizedState,v.state=ae,iu(i,d,v,y),au();var le=i.memoizedState;E!==fe||ae!==le||Ei||r!==null&&r.dependencies!==null&&ld(r.dependencies)?(typeof A=="function"&&(Zm(i,u,A,d),le=i.memoizedState),(ue=Ei||E0(i,u,ue,d,ae,le,H)||r!==null&&r.dependencies!==null&&ld(r.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=H,d=ue):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Cd(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Ts(i,r.child,null,y),i.child=Ts(i,null,u,y)):$n(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Va(r,i,y),r}function F0(r,i,u,d){return ks(),i.flags|=256,$n(r,i,u,d),i.child}var Ym={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xm(r){return{baseLanes:r,cachePool:Ax()}}function Wm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Ir),r}function $0(r,i,u){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,E;if((E=v)||(E=r!==null&&r.memoizedState===null?!1:(mn.current&2)!==0),E&&(y=!0,i.flags&=-129),E=(i.flags&32)!==0,i.flags&=-33,r===null){if(gt){if(y?_i(i):Ti(),(r=$t)?(r=Yw(r,Xr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:wi!==null?{id:ja,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},u=wx(r),u.return=i,i.child=u,Bn=i,$t=null)):r=null,r===null)throw ki(i);return Mp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(Ti(),y=i.mode,A=Nd({mode:"hidden",children:A},y),d=Ss(d,y,u,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=Xm(u),d.childLanes=Wm(r,E,u),i.memoizedState=Ym,cu(null,d)):(_i(i),Jm(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(_i(i),i.flags&=-257,i=ep(r,i,u)):i.memoizedState!==null?(Ti(),i.child=r.child,i.flags|=128,i=null):(Ti(),A=d.fallback,y=i.mode,d=Nd({mode:"visible",children:d.children},y),A=Ss(A,y,u,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,Ts(i,r.child,null,u),d=i.child,d.memoizedState=Xm(u),d.childLanes=Wm(r,E,u),i.memoizedState=Ym,i=cu(null,d));else if(_i(i),Mp(A)){if(E=A.nextSibling&&A.nextSibling.dataset,E)var te=E.dgst;E=te,d=Error(a(419)),d.stack="",d.digest=E,Wo({value:d,source:null,stack:null}),i=ep(r,i,u)}else if(wn||bl(r,i,u,!1),E=(u&r.childLanes)!==0,wn||E){if(E=Dt,E!==null&&(d=$c(E,u),d!==0&&d!==H.retryLane))throw H.retryLane=d,ws(r,d),br(E,r,d),Qm;zp(A)||Id(),i=ep(r,i,u)}else zp(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,$t=Jr(A.nextSibling),Bn=i,gt=!0,Si=null,Xr=!1,r!==null&&jx(i,r),i=Jm(i,d.children),i.flags|=4096);return i}return y?(Ti(),A=d.fallback,y=i.mode,H=r.child,te=H.sibling,d=Fa(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,te!==null?A=Fa(te,A):(A=Ss(A,y,u,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,cu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=Xm(u):(y=A.cachePool,y!==null?(H=bn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=Ax(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=Wm(r,E,u),i.memoizedState=Ym,cu(r.child,d)):(_i(i),u=r.child,r=u.sibling,u=Fa(u,{mode:"visible",children:d.children}),u.return=i,u.sibling=null,r!==null&&(E=i.deletions,E===null?(i.deletions=[r],i.flags|=16):E.push(r)),i.child=u,i.memoizedState=null,u)}function Jm(r,i){return i=Nd({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Nd(r,i){return r=Or(22,r,null,i),r.lanes=0,r}function ep(r,i,u){return Ts(i,r.child,null,u),r=Jm(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function H0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),pm(r.return,i,u)}function tp(r,i,u,d,y,v){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:y,treeForkCount:v}:(E.isBackwards=i,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=u,E.tailMode=y,E.treeForkCount=v)}function q0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var E=mn.current,A=(E&2)!==0;if(A?(E=E&1|2,i.flags|=128):E&=1,T(mn,E),$n(r,i,d,u),d=gt?Xo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&H0(r,u,i);else if(r.tag===19)H0(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),tp(i,!1,y,u,v,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&pd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}tp(i,!0,u,null,v,d);break;case"together":tp(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Va(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Oi|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(bl(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=Fa(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Fa(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function np(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&ld(r)))}function QA(r,i,u){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),ji(i,bn,r.memoizedState.cache),ks();break;case 27:case 5:Me(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:ji(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Nm(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(_i(i),i.flags|=128,null):(u&i.child.childLanes)!==0?$0(r,i,u):(_i(i),r=Va(r,i,u),r!==null?r.sibling:null);_i(i);break;case 19:var y=(r.flags&128)!==0;if(d=(u&i.childLanes)!==0,d||(bl(r,i,u,!1),d=(u&i.childLanes)!==0),y){if(d)return q0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(mn,mn.current),d)break;return null;case 22:return i.lanes=0,I0(r,i,u,i.pendingProps);case 24:ji(i,bn,r.memoizedState.cache)}return Va(r,i,u)}function Z0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)wn=!0;else{if(!np(r,u)&&(i.flags&128)===0)return wn=!1,QA(r,i,u);wn=(r.flags&131072)!==0}else wn=!1,gt&&(i.flags&1048576)!==0&&kx(i,Xo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ns(i.elementType),i.type=r,typeof r=="function")lm(r)?(d=Rs(r,d),i.tag=1,i=B0(null,i,r,d,u)):(i.tag=0,i=Km(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===z){i.tag=11,i=z0(null,i,r,d,u);break e}else if(y===L){i.tag=14,i=M0(null,i,r,d,u);break e}}throw i=J(r)||r,Error(a(306,i,""))}}return i;case 0:return Km(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=Rs(d,i.pendingProps),B0(r,i,d,y,u);case 3:e:{if(we(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,Sm(r,i),iu(i,d,null,u);var E=i.memoizedState;if(d=E.cache,ji(i,bn,d),d!==v.cache&&gm(i,[bn],u,!0),au(),d=E.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:E.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=F0(r,i,d,u);break e}else if(d!==y){y=Qr(Error(a(424)),i),Wo(y),i=F0(r,i,d,u);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for($t=Jr(r.firstChild),Bn=i,gt=!0,Si=null,Xr=!0,u=Ix(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(ks(),d===y){i=Va(r,i,u);break e}$n(r,i,d,u)}i=i.child}return i;case 26:return Cd(r,i),r===null?(u=nS(i.type,null,i.pendingProps,null))?i.memoizedState=u:gt||(u=i.type,r=i.pendingProps,d=Hd(ie.current).createElement(u),d[fn]=i,d[Vt]=r,Hn(d,u,r),pt(d),i.stateNode=d):i.memoizedState=nS(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Me(i),r===null&&gt&&(d=i.stateNode=Jw(i.type,i.pendingProps,ie.current),Bn=i,Xr=!0,y=$t,Li(i.type)?(Dp=y,$t=Jr(d.firstChild)):$t=y),$n(r,i,i.pendingProps.children,u),Cd(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&gt&&((y=d=$t)&&(d=j2(d,i.type,i.pendingProps,Xr),d!==null?(i.stateNode=d,Bn=i,$t=Jr(d.firstChild),Xr=!1,y=!0):y=!1),y||ki(i)),Me(i),y=i.type,v=i.pendingProps,E=r!==null?r.memoizedProps:null,d=v.children,Ap(y,v)?d=null:E!==null&&Ap(y,E)&&(i.flags|=32),i.memoizedState!==null&&(y=Tm(r,i,UA,null,null,u),Eu._currentValue=y),Cd(r,i),$n(r,i,d,u),i.child;case 6:return r===null&&gt&&((r=u=$t)&&(u=E2(u,i.pendingProps,Xr),u!==null?(i.stateNode=u,Bn=i,$t=null,r=!0):r=!1),r||ki(i)),null;case 13:return $0(r,i,u);case 4:return we(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ts(i,null,d,u):$n(r,i,d,u),i.child;case 11:return z0(r,i,i.type,i.pendingProps,u);case 7:return $n(r,i,i.pendingProps,u),i.child;case 8:return $n(r,i,i.pendingProps.children,u),i.child;case 12:return $n(r,i,i.pendingProps.children,u),i.child;case 10:return d=i.pendingProps,ji(i,i.type,d.value),$n(r,i,d.children,u),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,Es(i),y=Fn(y),d=d(y),i.flags|=1,$n(r,i,d,u),i.child;case 14:return M0(r,i,i.type,i.pendingProps,u);case 15:return D0(r,i,i.type,i.pendingProps,u);case 19:return q0(r,i,u);case 31:return VA(r,i,u);case 22:return I0(r,i,u,i.pendingProps);case 24:return Es(i),d=Fn(bn),r===null?(y=bm(),y===null&&(y=Dt,v=ym(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},wm(i),ji(i,bn,y)):((r.lanes&u)!==0&&(Sm(r,i),iu(i,null,null,u),au()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),ji(i,bn,d)):(d=v.cache,ji(i,bn,d),d!==y.cache&&gm(i,[bn],u,!0))),$n(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Qa(r){r.flags|=4}function rp(r,i,u,d,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(vw())r.flags|=8192;else throw _s=dd,xm}else r.flags&=-16777217}function G0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!lS(i))if(vw())r.flags|=8192;else throw _s=dd,xm}function _d(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?je():536870912,r.lanes|=i,Rl|=i)}function du(r,i){if(!gt)switch(r.tailMode){case"hidden":i=r.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ht(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,d=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=u,i}function KA(r,i,u){var d=i.pendingProps;switch(dm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(i),null;case 1:return Ht(i),null;case 3:return u=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),qa(bn),me(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(vl(i)?Qa(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,hm())),Ht(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Qa(i),v!==null?(Ht(i),G0(i,v)):(Ht(i),rp(i,y,null,d,u))):v?v!==r.memoizedState?(Qa(i),Ht(i),G0(i,v)):(Ht(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Qa(i),Ht(i),rp(i,y,r,d,u)),null;case 27:if(Ie(i),u=ie.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Qa(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}r=G.current,vl(i)?Ex(i):(r=Jw(y,d,u),i.stateNode=r,Qa(i))}return Ht(i),null;case 5:if(Ie(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Qa(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}if(v=G.current,vl(i))Ex(i);else{var E=Hd(ie.current);switch(v){case 1:v=E.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=E.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=E.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?E.createElement(y,{is:d.is}):E.createElement(y)}}v[fn]=i,v[Vt]=d;e:for(E=i.child;E!==null;){if(E.tag===5||E.tag===6)v.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===i)break e;for(;E.sibling===null;){if(E.return===null||E.return===i)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}i.stateNode=v;e:switch(Hn(v,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Qa(i)}}return Ht(i),rp(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Qa(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ie.current,vl(i)){if(r=i.stateNode,u=i.memoizedProps,d=null,y=Bn,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[fn]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||$w(r.nodeValue,u)),r||ki(i,!0)}else r=Hd(r).createTextNode(d),r[fn]=i,i.stateNode=r}return Ht(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(d=vl(i),u!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[fn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),r=!1}else u=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Mr(i),i):(Mr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ht(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=vl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[fn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),y=!1}else y=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Mr(i),i):(Mr(i),null)}return Mr(i),(i.flags&128)!==0?(i.lanes=u,i):(u=d!==null,r=r!==null&&r.memoizedState!==null,u&&(d=i.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==y&&(d.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),_d(i,i.updateQueue),Ht(i),null);case 4:return me(),r===null&&Ep(i.stateNode.containerInfo),Ht(i),null;case 10:return qa(i.type),Ht(i),null;case 19:if(F(mn),d=i.memoizedState,d===null)return Ht(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)du(d,!1);else{if(an!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=pd(r),v!==null){for(i.flags|=128,du(d,!1),r=v.updateQueue,i.updateQueue=r,_d(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)xx(u,r),u=u.sibling;return T(mn,mn.current&1|2),gt&&$a(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&cn()>zd&&(i.flags|=128,y=!0,du(d,!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),du(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!gt)return Ht(i),null}else 2*cn()-d.renderingStartTime>zd&&u!==536870912&&(i.flags|=128,y=!0,du(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=cn(),r.sibling=null,u=mn.current,T(mn,y?u&1|2:u&1),gt&&$a(i,d.treeForkCount),r):(Ht(i),null);case 22:case 23:return Mr(i),Cm(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(u&536870912)!==0&&(i.flags&128)===0&&(Ht(i),i.subtreeFlags&6&&(i.flags|=8192)):Ht(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),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048),r!==null&&F(Cs),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),qa(bn),Ht(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function YA(r,i){switch(dm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return qa(bn),me(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ie(i),null;case 31:if(i.memoizedState!==null){if(Mr(i),i.alternate===null)throw Error(a(340));ks()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Mr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));ks()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return F(mn),null;case 4:return me(),null;case 10:return qa(i.type),null;case 22:case 23:return Mr(i),Cm(),r!==null&&F(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return qa(bn),null;case 25:return null;default:return null}}function V0(r,i){switch(dm(i),i.tag){case 3:qa(bn),me();break;case 26:case 27:case 5:Ie(i);break;case 4:me();break;case 31:i.memoizedState!==null&&Mr(i);break;case 13:Mr(i);break;case 19:F(mn);break;case 10:qa(i.type);break;case 22:case 23:Mr(i),Cm(),r!==null&&F(Cs);break;case 24:qa(bn)}}function fu(r,i){try{var u=i.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var y=d.next;u=y;do{if((u.tag&r)===r){d=void 0;var v=u.create,E=u.inst;d=v(),E.destroy=d}u=u.next}while(u!==y)}}catch(A){Tt(i,i.return,A)}}function Ai(r,i,u){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var E=d.inst,A=E.destroy;if(A!==void 0){E.destroy=void 0,y=i;var H=u,te=A;try{te()}catch(ue){Tt(y,H,ue)}}}d=d.next}while(d!==v)}}catch(ue){Tt(i,i.return,ue)}}function Q0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Px(i,u)}catch(d){Tt(r,r.return,d)}}}function K0(r,i,u){u.props=Rs(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){Tt(r,i,d)}}function hu(r,i){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof u=="function"?r.refCleanup=u(d):u.current=d}}catch(y){Tt(r,i,y)}}function Ca(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){Tt(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){Tt(r,i,y)}else u.current=null}function Y0(r){var i=r.type,u=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&d.focus();break e;case"img":u.src?d.src=u.src:u.srcSet&&(d.srcset=u.srcSet)}}catch(y){Tt(r,r.return,y)}}function ap(r,i,u){try{var d=r.stateNode;v2(d,r.type,u,i),d[Vt]=i}catch(y){Tt(r,r.return,y)}}function X0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Li(r.type)||r.tag===4}function ip(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||X0(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&&Li(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sp(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(r),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=Ua));else if(d!==4&&(d===27&&Li(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(sp(r,i,u),r=r.sibling;r!==null;)sp(r,i,u),r=r.sibling}function Td(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(d!==4&&(d===27&&Li(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 W0(r){var i=r.stateNode,u=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Hn(i,d,u),i[fn]=r,i[Vt]=u}catch(v){Tt(r,r.return,v)}}var Ka=!1,Sn=!1,lp=!1,J0=typeof WeakSet=="function"?WeakSet:Set,In=null;function XA(r,i){if(r=r.containerInfo,_p=Yd,r=dx(r),em(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var E=0,A=-1,H=-1,te=0,ue=0,fe=r,ae=null;t:for(;;){for(var le;fe!==u||y!==0&&fe.nodeType!==3||(A=E+y),fe!==v||d!==0&&fe.nodeType!==3||(H=E+d),fe.nodeType===3&&(E+=fe.nodeValue.length),(le=fe.firstChild)!==null;)ae=fe,fe=le;for(;;){if(fe===r)break t;if(ae===u&&++te===y&&(A=E),ae===v&&++ue===d&&(H=E),(le=fe.nextSibling)!==null)break;fe=ae,ae=fe.parentNode}fe=le}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(Tp={focusedElem:r,selectionRange:u},Yd=!1,In=i;In!==null;)if(i=In,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,In=r;else for(;In!==null;){switch(i=In,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(u=0;u<r.length;u++)y=r[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,u=i,y=v.memoizedProps,v=v.memoizedState,d=u.stateNode;try{var Te=Rs(u.type,y);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ze){Tt(u,u.return,Ze)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)Op(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Op(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,In=r;break}In=i.return}}function ew(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Xa(r,u),d&4&&fu(5,u);break;case 1:if(Xa(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(E){Tt(u,u.return,E)}else{var y=Rs(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Tt(u,u.return,E)}}d&64&&Q0(u),d&512&&hu(u,u.return);break;case 3:if(Xa(r,u),d&64&&(r=u.updateQueue,r!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Px(r,i)}catch(E){Tt(u,u.return,E)}}break;case 27:i===null&&d&4&&W0(u);case 26:case 5:Xa(r,u),i===null&&d&4&&Y0(u),d&512&&hu(u,u.return);break;case 12:Xa(r,u);break;case 31:Xa(r,u),d&4&&rw(r,u);break;case 13:Xa(r,u),d&4&&aw(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=s2.bind(null,u),C2(r,u))));break;case 22:if(d=u.memoizedState!==null||Ka,!d){i=i!==null&&i.memoizedState!==null||Sn,y=Ka;var v=Sn;Ka=d,(Sn=i)&&!v?Wa(r,u,(u.subtreeFlags&8772)!==0):Xa(r,u),Ka=y,Sn=v}break;case 30:break;default:Xa(r,u)}}function tw(r){var i=r.alternate;i!==null&&(r.alternate=null,tw(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Be(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 Qt=null,pr=!1;function Ya(r,i,u){for(u=u.child;u!==null;)nw(r,i,u),u=u.sibling}function nw(r,i,u){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Zt,u)}catch{}switch(u.tag){case 26:Sn||Ca(u,i),Ya(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Sn||Ca(u,i);var d=Qt,y=pr;Li(u.type)&&(Qt=u.stateNode,pr=!1),Ya(r,i,u),Su(u.stateNode),Qt=d,pr=y;break;case 5:Sn||Ca(u,i);case 6:if(d=Qt,y=pr,Qt=null,Ya(r,i,u),Qt=d,pr=y,Qt!==null)if(pr)try{(Qt.nodeType===9?Qt.body:Qt.nodeName==="HTML"?Qt.ownerDocument.body:Qt).removeChild(u.stateNode)}catch(v){Tt(u,i,v)}else try{Qt.removeChild(u.stateNode)}catch(v){Tt(u,i,v)}break;case 18:Qt!==null&&(pr?(r=Qt,Qw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Ul(r)):Qw(Qt,u.stateNode));break;case 4:d=Qt,y=pr,Qt=u.stateNode.containerInfo,pr=!0,Ya(r,i,u),Qt=d,pr=y;break;case 0:case 11:case 14:case 15:Ai(2,u,i),Sn||Ai(4,u,i),Ya(r,i,u);break;case 1:Sn||(Ca(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&K0(u,i,d)),Ya(r,i,u);break;case 21:Ya(r,i,u);break;case 22:Sn=(d=Sn)||u.memoizedState!==null,Ya(r,i,u),Sn=d;break;default:Ya(r,i,u)}}function rw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Ul(r)}catch(u){Tt(i,i.return,u)}}}function aw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Ul(r)}catch(u){Tt(i,i.return,u)}}function WA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new J0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new J0),i;default:throw Error(a(435,r.tag))}}function Ad(r,i){var u=WA(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=l2.bind(null,r,d);d.then(y,y)}})}function gr(r,i){var u=i.deletions;if(u!==null)for(var d=0;d<u.length;d++){var y=u[d],v=r,E=i,A=E;e:for(;A!==null;){switch(A.tag){case 27:if(Li(A.type)){Qt=A.stateNode,pr=!1;break e}break;case 5:Qt=A.stateNode,pr=!1;break e;case 3:case 4:Qt=A.stateNode.containerInfo,pr=!0;break e}A=A.return}if(Qt===null)throw Error(a(160));nw(v,E,y),Qt=null,pr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)iw(i,r),i=i.sibling}var ya=null;function iw(r,i){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:gr(i,r),yr(r),d&4&&(Ai(3,r,r.return),fu(3,r),Ai(5,r,r.return));break;case 1:gr(i,r),yr(r),d&512&&(Sn||u===null||Ca(u,u.return)),d&64&&Ka&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:var y=ya;if(gr(i,r),yr(r),d&512&&(Sn||u===null||Ca(u,u.return)),d&4){var v=u!==null?u.memoizedState:null;if(d=r.memoizedState,u===null)if(d===null)if(r.stateNode===null){e:{d=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[bi]||v[fn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Hn(v,d,u),v[fn]=r,pt(v),d=v;break e;case"link":var E=iS("link","href",y).get(d+(u.href||""));if(E){for(var A=0;A<E.length;A++)if(v=E[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)){E.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;case"meta":if(E=iS("meta","content",y).get(d+(u.content||""))){for(A=0;A<E.length;A++)if(v=E[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)){E.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[fn]=r,pt(v),d=v}r.stateNode=d}else sS(y,r.type,r.stateNode);else r.stateNode=aS(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?sS(y,r.type,r.stateNode):aS(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ap(r,r.memoizedProps,u.memoizedProps)}break;case 27:gr(i,r),yr(r),d&512&&(Sn||u===null||Ca(u,u.return)),u!==null&&d&4&&ap(r,r.memoizedProps,u.memoizedProps);break;case 5:if(gr(i,r),yr(r),d&512&&(Sn||u===null||Ca(u,u.return)),r.flags&32){y=r.stateNode;try{ol(y,"")}catch(Te){Tt(r,r.return,Te)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ap(r,y,u!==null?u.memoizedProps:y)),d&1024&&(lp=!0);break;case 6:if(gr(i,r),yr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,u=r.stateNode;try{u.nodeValue=d}catch(Te){Tt(r,r.return,Te)}}break;case 3:if(Gd=null,y=ya,ya=qd(i.containerInfo),gr(i,r),ya=y,yr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{Ul(i.containerInfo)}catch(Te){Tt(r,r.return,Te)}lp&&(lp=!1,sw(r));break;case 4:d=ya,ya=qd(r.stateNode.containerInfo),gr(i,r),yr(r),ya=d;break;case 12:gr(i,r),yr(r);break;case 31:gr(i,r),yr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 13:gr(i,r),yr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Od=cn()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,te=Ka,ue=Sn;if(Ka=te||y,Sn=ue||H,gr(i,r),Sn=ue,Ka=te,yr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Ka||Sn||Os(r)),u=null,i=r;;){if(i.tag===5||i.tag===26){if(u===null){H=u=i;try{if(v=H.stateNode,y)E=v.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{A=H.stateNode;var fe=H.memoizedProps.style,ae=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Te){Tt(H,H.return,Te)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(Te){Tt(H,H.return,Te)}}}else if(i.tag===18){if(u===null){H=i;try{var le=H.stateNode;y?Kw(le,!0):Kw(H.stateNode,!1)}catch(Te){Tt(H,H.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Ad(r,u))));break;case 19:gr(i,r),yr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 30:break;case 21:break;default:gr(i,r),yr(r)}}function yr(r){var i=r.flags;if(i&2){try{for(var u,d=r.return;d!==null;){if(X0(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=ip(r);Td(r,v,y);break;case 5:var E=u.stateNode;u.flags&32&&(ol(E,""),u.flags&=-33);var A=ip(r);Td(r,A,E);break;case 3:case 4:var H=u.stateNode.containerInfo,te=ip(r);sp(r,te,H);break;default:throw Error(a(161))}}catch(ue){Tt(r,r.return,ue)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function sw(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;sw(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Xa(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)ew(r,i.alternate,i),i=i.sibling}function Os(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ai(4,i,i.return),Os(i);break;case 1:Ca(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&K0(i,i.return,u),Os(i);break;case 27:Su(i.stateNode);case 26:case 5:Ca(i,i.return),Os(i);break;case 22:i.memoizedState===null&&Os(i);break;case 30:Os(i);break;default:Os(i)}r=r.sibling}}function Wa(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,E=v.flags;switch(v.tag){case 0:case 11:case 15:Wa(y,v,u),fu(4,v);break;case 1:if(Wa(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(te){Tt(d,d.return,te)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Lx(H[y],A)}catch(te){Tt(d,d.return,te)}}u&&E&64&&Q0(v),hu(v,v.return);break;case 27:W0(v);case 26:case 5:Wa(y,v,u),u&&d===null&&E&4&&Y0(v),hu(v,v.return);break;case 12:Wa(y,v,u);break;case 31:Wa(y,v,u),u&&E&4&&rw(y,v);break;case 13:Wa(y,v,u),u&&E&4&&aw(y,v);break;case 22:v.memoizedState===null&&Wa(y,v,u),hu(v,v.return);break;case 30:break;default:Wa(y,v,u)}i=i.sibling}}function op(r,i){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Jo(u))}function up(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Jo(r))}function va(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)lw(r,i,u,d),i=i.sibling}function lw(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:va(r,i,u,d),y&2048&&fu(9,i);break;case 1:va(r,i,u,d);break;case 3:va(r,i,u,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Jo(r)));break;case 12:if(y&2048){va(r,i,u,d),r=i.stateNode;try{var v=i.memoizedProps,E=v.id,A=v.onPostCommit;typeof A=="function"&&A(E,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){Tt(i,i.return,H)}}else va(r,i,u,d);break;case 31:va(r,i,u,d);break;case 13:va(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,E=i.alternate,i.memoizedState!==null?v._visibility&2?va(r,i,u,d):mu(r,i):v._visibility&2?va(r,i,u,d):(v._visibility|=2,_l(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&op(E,i);break;case 24:va(r,i,u,d),y&2048&&up(i.alternate,i);break;default:va(r,i,u,d)}}function _l(r,i,u,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,E=i,A=u,H=d,te=E.flags;switch(E.tag){case 0:case 11:case 15:_l(v,E,A,H,y),fu(8,E);break;case 23:break;case 22:var ue=E.stateNode;E.memoizedState!==null?ue._visibility&2?_l(v,E,A,H,y):mu(v,E):(ue._visibility|=2,_l(v,E,A,H,y)),y&&te&2048&&op(E.alternate,E);break;case 24:_l(v,E,A,H,y),y&&te&2048&&up(E.alternate,E);break;default:_l(v,E,A,H,y)}i=i.sibling}}function mu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,d=i,y=d.flags;switch(d.tag){case 22:mu(u,d),y&2048&&op(d.alternate,d);break;case 24:mu(u,d),y&2048&&up(d.alternate,d);break;default:mu(u,d)}i=i.sibling}}var pu=8192;function Tl(r,i,u){if(r.subtreeFlags&pu)for(r=r.child;r!==null;)ow(r,i,u),r=r.sibling}function ow(r,i,u){switch(r.tag){case 26:Tl(r,i,u),r.flags&pu&&r.memoizedState!==null&&P2(u,ya,r.memoizedState,r.memoizedProps);break;case 5:Tl(r,i,u);break;case 3:case 4:var d=ya;ya=qd(r.stateNode.containerInfo),Tl(r,i,u),ya=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=pu,pu=16777216,Tl(r,i,u),pu=d):Tl(r,i,u));break;default:Tl(r,i,u)}}function uw(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 gu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];In=d,dw(d,r)}uw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)cw(r),r=r.sibling}function cw(r){switch(r.tag){case 0:case 11:case 15:gu(r),r.flags&2048&&Ai(9,r,r.return);break;case 3:gu(r);break;case 12:gu(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)):gu(r);break;default:gu(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 d=i[u];In=d,dw(d,r)}uw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ai(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 dw(r,i){for(;In!==null;){var u=In;switch(u.tag){case 0:case 11:case 15:Ai(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Jo(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,In=d;else e:for(u=r;In!==null;){d=In;var y=d.sibling,v=d.return;if(tw(d),d===u){In=null;break e}if(y!==null){y.return=v,In=y;break e}In=v}}}var JA={getCacheForType:function(r){var i=Fn(bn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Fn(bn).controller.signal}},e2=typeof WeakMap=="function"?WeakMap:Map,Et=0,Dt=null,ut=null,ft=0,_t=0,Dr=null,Ri=!1,Al=!1,cp=!1,Ja=0,an=0,Oi=0,zs=0,dp=0,Ir=0,Rl=0,yu=null,vr=null,fp=!1,Od=0,fw=0,zd=1/0,Md=null,zi=null,Tn=0,Mi=null,Ol=null,ei=0,hp=0,mp=null,hw=null,vu=0,pp=null;function Lr(){return(Et&2)!==0&&ft!==0?ft&-ft:Z.T!==null?wp():Lo()}function mw(){if(Ir===0)if((ft&536870912)===0||gt){var r=ma;ma<<=1,(ma&3932160)===0&&(ma=262144),Ir=r}else Ir=536870912;return r=zr.current,r!==null&&(r.flags|=32),Ir}function br(r,i,u){(r===Dt&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(zl(r,0),Di(r,ft,Ir,!1)),yn(r,u),((Et&2)===0||r!==Dt)&&(r===Dt&&((Et&2)===0&&(zs|=u),an===4&&Di(r,ft,Ir,!1)),Na(r))}function pw(r,i,u){if((Et&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||ka(r,i),y=d?r2(r,i):yp(r,i,!0),v=d;do{if(y===0){Al&&!d&&Di(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!t2(u)){y=yp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){i=E;e:{var A=r;y=yu;var H=A.current.memoizedState.isDehydrated;if(H&&(zl(A,E).flags|=256),E=yp(A,E,!1),E!==2){if(cp&&!H){A.errorRecoveryDisabledLanes|=v,zs|=v,y=4;break e}v=vr,vr=y,v!==null&&(vr===null?vr=v:vr.push.apply(vr,v))}y=E}if(v=!1,y!==2)continue}}if(y===1){zl(r,0),Di(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Di(d,i,Ir,!Ri);break e;case 2:vr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Od+300-cn(),10<y)){if(Di(d,i,Ir,!Ri),Ia(d,0,!0)!==0)break e;ei=i,d.timeoutHandle=Gw(gw.bind(null,d,u,vr,Md,fp,i,Ir,zs,Rl,Ri,v,"Throttled",-0,0),y);break e}gw(d,u,vr,Md,fp,i,Ir,zs,Rl,Ri,v,null,-0,0)}}break}while(!0);Na(r)}function gw(r,i,u,d,y,v,E,A,H,te,ue,fe,ae,le){if(r.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ua},ow(i,v,fe);var Te=(v&62914560)===v?Od-cn():(v&4194048)===v?fw-cn():0;if(Te=U2(fe,Te),Te!==null){ei=v,r.cancelPendingCommit=Te(jw.bind(null,r,i,v,u,d,y,E,A,H,ue,fe,null,ae,le)),Di(r,v,E,!te);return}}jw(r,i,v,u,d,y,E,A,H)}function t2(r){for(var i=r;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var y=u[d],v=y.getSnapshot;y=y.value;try{if(!Rr(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 Di(r,i,u,d){i&=~dp,i&=~zs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-ot(y),E=1<<v;d[v]=-1,y&=~E}u!==0&&vi(r,u,i)}function Dd(){return(Et&6)===0?(bu(0),!1):!0}function gp(){if(ut!==null){if(_t===0)var r=ut.return;else r=ut,Ha=js=null,Om(r),kl=null,tu=0,r=ut;for(;r!==null;)V0(r.alternate,r),r=r.return;ut=null}}function zl(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,w2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),ei=0,gp(),Dt=r,ut=u=Fa(r.current,null),ft=i,_t=0,Dr=null,Ri=!1,Al=ka(r,i),cp=!1,Rl=Ir=dp=zs=Oi=an=0,vr=yu=null,fp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var y=31-ot(d),v=1<<y;i|=r[y],d&=~v}return Ja=i,nd(),u}function yw(r,i){Ye=null,Z.H=uu,i===Sl||i===cd?(i=zx(),_t=3):i===xm?(i=zx(),_t=4):_t=i===Qm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Dr=i,ut===null&&(an=1,jd(r,Qr(i,r.current)))}function vw(){var r=zr.current;return r===null?!0:(ft&4194048)===ft?Wr===null:(ft&62914560)===ft||(ft&536870912)!==0?r===Wr:!1}function bw(){var r=Z.H;return Z.H=uu,r===null?uu:r}function xw(){var r=Z.A;return Z.A=JA,r}function Id(){an=4,Ri||(ft&4194048)!==ft&&zr.current!==null||(Al=!0),(Oi&134217727)===0&&(zs&134217727)===0||Dt===null||Di(Dt,ft,Ir,!1)}function yp(r,i,u){var d=Et;Et|=2;var y=bw(),v=xw();(Dt!==r||ft!==i)&&(Md=null,zl(r,i)),i=!1;var E=an;e:do try{if(_t!==0&&ut!==null){var A=ut,H=Dr;switch(_t){case 8:gp(),E=6;break e;case 3:case 2:case 9:case 6:zr.current===null&&(i=!0);var te=_t;if(_t=0,Dr=null,Ml(r,A,H,te),u&&Al){E=0;break e}break;default:te=_t,_t=0,Dr=null,Ml(r,A,H,te)}}n2(),E=an;break}catch(ue){yw(r,ue)}while(!0);return i&&r.shellSuspendCounter++,Ha=js=null,Et=d,Z.H=y,Z.A=v,ut===null&&(Dt=null,ft=0,nd()),E}function n2(){for(;ut!==null;)ww(ut)}function r2(r,i){var u=Et;Et|=2;var d=bw(),y=xw();Dt!==r||ft!==i?(Md=null,zd=cn()+500,zl(r,i)):Al=ka(r,i);e:do try{if(_t!==0&&ut!==null){i=ut;var v=Dr;t:switch(_t){case 1:_t=0,Dr=null,Ml(r,i,v,1);break;case 2:case 9:if(Rx(v)){_t=0,Dr=null,Sw(i);break}i=function(){_t!==2&&_t!==9||Dt!==r||(_t=7),Na(r)},v.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:Rx(v)?(_t=0,Dr=null,Sw(i)):(_t=0,Dr=null,Ml(r,i,v,7));break;case 5:var E=null;switch(ut.tag){case 26:E=ut.memoizedState;case 5:case 27:var A=ut;if(E?lS(E):A.stateNode.complete){_t=0,Dr=null;var H=A.sibling;if(H!==null)ut=H;else{var te=A.return;te!==null?(ut=te,Ld(te)):ut=null}break t}}_t=0,Dr=null,Ml(r,i,v,5);break;case 6:_t=0,Dr=null,Ml(r,i,v,6);break;case 8:gp(),an=6;break e;default:throw Error(a(462))}}a2();break}catch(ue){yw(r,ue)}while(!0);return Ha=js=null,Z.H=d,Z.A=y,Et=u,ut!==null?0:(Dt=null,ft=0,nd(),an)}function a2(){for(;ut!==null&&!gi();)ww(ut)}function ww(r){var i=Z0(r.alternate,r,Ja);r.memoizedProps=r.pendingProps,i===null?Ld(r):ut=i}function Sw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=U0(u,i,i.pendingProps,i.type,void 0,ft);break;case 11:i=U0(u,i,i.pendingProps,i.type.render,i.ref,ft);break;case 5:Om(i);default:V0(u,i),i=ut=xx(i,Ja),i=Z0(u,i,Ja)}r.memoizedProps=r.pendingProps,i===null?Ld(r):ut=i}function Ml(r,i,u,d){Ha=js=null,Om(i),kl=null,tu=0;var y=i.return;try{if(GA(r,y,i,u,ft)){an=1,jd(r,Qr(u,r.current)),ut=null;return}}catch(v){if(y!==null)throw ut=y,v;an=1,jd(r,Qr(u,r.current)),ut=null;return}i.flags&32768?(gt||d===1?r=!0:Al||(ft&536870912)!==0?r=!1:(Ri=r=!0,(d===2||d===9||d===3||d===6)&&(d=zr.current,d!==null&&d.tag===13&&(d.flags|=16384))),kw(i,r)):Ld(i)}function Ld(r){var i=r;do{if((i.flags&32768)!==0){kw(i,Ri);return}r=i.return;var u=KA(i.alternate,i,Ja);if(u!==null){ut=u;return}if(i=i.sibling,i!==null){ut=i;return}ut=i=r}while(i!==null);an===0&&(an=5)}function kw(r,i){do{var u=YA(r.alternate,r);if(u!==null){u.flags&=32767,ut=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){ut=r;return}ut=r=u}while(r!==null);an=6,ut=null}function jw(r,i,u,d,y,v,E,A,H){r.cancelPendingCommit=null;do Pd();while(Tn!==0);if((Et&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=im,Ar(r,u,v,E,A,H),r===Dt&&(ut=Dt=null,ft=0),Ol=i,Mi=r,ei=u,hp=v,mp=y,hw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,o2($e,function(){return Tw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=Z.T,Z.T=null,y=ne.p,ne.p=2,E=Et,Et|=4;try{XA(r,i,u)}finally{Et=E,ne.p=y,Z.T=d}}Tn=1,Ew(),Cw(),Nw()}}function Ew(){if(Tn===1){Tn=0;var r=Mi,i=Ol,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=Z.T,Z.T=null;var d=ne.p;ne.p=2;var y=Et;Et|=4;try{iw(i,r);var v=Tp,E=dx(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(E!==A&&A&&A.ownerDocument&&cx(A.ownerDocument.documentElement,A)){if(H!==null&&em(A)){var te=H.start,ue=H.end;if(ue===void 0&&(ue=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(ue,A.value.length);else{var fe=A.ownerDocument||document,ae=fe&&fe.defaultView||window;if(ae.getSelection){var le=ae.getSelection(),Te=A.textContent.length,Ze=Math.min(H.start,Te),zt=H.end===void 0?Ze:Math.min(H.end,Te);!le.extend&&Ze>zt&&(E=zt,zt=Ze,Ze=E);var X=ux(A,Ze),Q=ux(A,zt);if(X&&Q&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==Q.node||le.focusOffset!==Q.offset)){var ee=fe.createRange();ee.setStart(X.node,X.offset),le.removeAllRanges(),Ze>zt?(le.addRange(ee),le.extend(Q.node,Q.offset)):(ee.setEnd(Q.node,Q.offset),le.addRange(ee))}}}}for(fe=[],le=A;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var de=fe[A];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Yd=!!_p,Tp=_p=null}finally{Et=y,ne.p=d,Z.T=u}}r.current=i,Tn=2}}function Cw(){if(Tn===2){Tn=0;var r=Mi,i=Ol,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=Z.T,Z.T=null;var d=ne.p;ne.p=2;var y=Et;Et|=4;try{ew(r,i.alternate,i)}finally{Et=y,ne.p=d,Z.T=u}}Tn=3}}function Nw(){if(Tn===4||Tn===3){Tn=0,yi();var r=Mi,i=Ol,u=ei,d=hw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Tn=5:(Tn=0,Ol=Mi=null,_w(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(zi=null),pa(u),i=i.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Zt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=Z.T,y=ne.p,ne.p=2,Z.T=null;try{for(var v=r.onRecoverableError,E=0;E<d.length;E++){var A=d[E];v(A.value,{componentStack:A.stack})}}finally{Z.T=i,ne.p=y}}(ei&3)!==0&&Pd(),Na(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===pp?vu++:(vu=0,pp=r):vu=0,bu(0)}}function _w(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Jo(i)))}function Pd(){return Ew(),Cw(),Nw(),Tw()}function Tw(){if(Tn!==5)return!1;var r=Mi,i=hp;hp=0;var u=pa(ei),d=Z.T,y=ne.p;try{ne.p=32>u?32:u,Z.T=null,u=mp,mp=null;var v=Mi,E=ei;if(Tn=0,Ol=Mi=null,ei=0,(Et&6)!==0)throw Error(a(331));var A=Et;if(Et|=4,cw(v.current),lw(v,v.current,E,u),Et=A,bu(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Zt,v)}catch{}return!0}finally{ne.p=y,Z.T=d,_w(r,i)}}function Aw(r,i,u){i=Qr(u,i),i=Vm(r.stateNode,i,2),r=Ni(r,i,2),r!==null&&(yn(r,2),Na(r))}function Tt(r,i,u){if(r.tag===3)Aw(r,r,u);else for(;i!==null;){if(i.tag===3){Aw(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(zi===null||!zi.has(d))){r=Qr(u,r),u=R0(2),d=Ni(i,u,2),d!==null&&(O0(u,d,i,r),yn(d,2),Na(d));break}}i=i.return}}function vp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new e2;var y=new Set;d.set(i,y)}else y=d.get(i),y===void 0&&(y=new Set,d.set(i,y));y.has(u)||(cp=!0,y.add(u),r=i2.bind(null,r,i,u),i.then(r,r))}function i2(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Dt===r&&(ft&u)===u&&(an===4||an===3&&(ft&62914560)===ft&&300>cn()-Od?(Et&2)===0&&zl(r,0):dp|=u,Rl===ft&&(Rl=0)),Na(r)}function Rw(r,i){i===0&&(i=je()),r=ws(r,i),r!==null&&(yn(r,i),Na(r))}function s2(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),Rw(r,u)}function l2(r,i){var u=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),Rw(r,u)}function o2(r,i){return Pt(r,i)}var Ud=null,Dl=null,bp=!1,Bd=!1,xp=!1,Ii=0;function Na(r){r!==Dl&&r.next===null&&(Dl===null?Ud=Dl=r:Dl=Dl.next=r),Bd=!0,bp||(bp=!0,c2())}function bu(r,i){if(!xp&&Bd){xp=!0;do for(var u=!1,d=Ud;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var E=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-ot(42|r)+1)-1,v&=y&~(E&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,Dw(d,v))}else v=ft,v=Ia(d,d===Dt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||ka(d,v)||(u=!0,Dw(d,v));d=d.next}while(u);xp=!1}}function u2(){Ow()}function Ow(){Bd=bp=!1;var r=0;Ii!==0&&x2()&&(r=Ii);for(var i=cn(),u=null,d=Ud;d!==null;){var y=d.next,v=zw(d,i);v===0?(d.next=null,u===null?Ud=y:u.next=y,y===null&&(Dl=u)):(u=d,(r!==0||(v&3)!==0)&&(Bd=!0)),d=y}Tn!==0&&Tn!==5||bu(r),Ii!==0&&(Ii=0)}function zw(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var E=31-ot(v),A=1<<E,H=y[E];H===-1?((A&u)===0||(A&d)!==0)&&(y[E]=Gt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Dt,u=ft,u=Ia(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&hr(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||ka(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&hr(d),pa(u)){case 2:case 8:u=ge;break;case 32:u=$e;break;case 268435456:u=st;break;default:u=$e}return d=Mw.bind(null,r),u=Pt(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&hr(d),r.callbackPriority=2,r.callbackNode=null,2}function Mw(r,i){if(Tn!==0&&Tn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Pd()&&r.callbackNode!==u)return null;var d=ft;return d=Ia(r,r===Dt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(pw(r,d,i),zw(r,cn()),r.callbackNode!=null&&r.callbackNode===u?Mw.bind(null,r):null)}function Dw(r,i){if(Pd())return null;pw(r,i,!0)}function c2(){S2(function(){(Et&6)!==0?Pt(oe,u2):Ow()})}function wp(){if(Ii===0){var r=xl;r===0&&(r=ha,ha<<=1,(ha&261888)===0&&(ha=256)),Ii=r}return Ii}function Iw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Qc(""+r)}function Lw(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 d2(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=Iw((y[Vt]||null).action),E=d.submitter;E&&(i=(i=E[Vt]||null)?Iw(i.formAction):E.getAttribute("formAction"),i!==null&&(v=i,E=null));var A=new Wc("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ii!==0){var H=E?Lw(y,E):new FormData(y);Fm(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=E?Lw(y,E):new FormData(y),Fm(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var Sp=0;Sp<am.length;Sp++){var kp=am[Sp],f2=kp.toLowerCase(),h2=kp[0].toUpperCase()+kp.slice(1);ga(f2,"on"+h2)}ga(mx,"onAnimationEnd"),ga(px,"onAnimationIteration"),ga(gx,"onAnimationStart"),ga("dblclick","onDoubleClick"),ga("focusin","onFocus"),ga("focusout","onBlur"),ga(TA,"onTransitionRun"),ga(AA,"onTransitionStart"),ga(RA,"onTransitionCancel"),ga(yx,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),vn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vn("onBeforeInput",["compositionend","keypress","textInput","paste"]),vn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xu="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(" "),m2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xu));function Pw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var E=d.length-1;0<=E;E--){var A=d[E],H=A.instance,te=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=te;try{v(y)}catch(ue){td(ue)}y.currentTarget=null,v=H}else for(E=0;E<d.length;E++){if(A=d[E],H=A.instance,te=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=te;try{v(y)}catch(ue){td(ue)}y.currentTarget=null,v=H}}}}function ct(r,i){var u=i[sl];u===void 0&&(u=i[sl]=new Set);var d=r+"__bubble";u.has(d)||(Uw(i,r,2,!1),u.add(d))}function jp(r,i,u){var d=0;i&&(d|=4),Uw(u,r,d,i)}var Fd="_reactListening"+Math.random().toString(36).slice(2);function Ep(r){if(!r[Fd]){r[Fd]=!0,Jt.forEach(function(u){u!=="selectionchange"&&(m2.has(u)||jp(u,!1,r),jp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Fd]||(i[Fd]=!0,jp("selectionchange",!1,i))}}function Uw(r,i,u,d){switch(mS(i)){case 2:var y=$2;break;case 8:y=H2;break;default:y=Bp}u=y.bind(null,i,u,r),y=void 0,!Zh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Cp(r,i,u,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var A=d.stateNode.containerInfo;if(A===y)break;if(E===4)for(E=d.return;E!==null;){var H=E.tag;if((H===3||H===4)&&E.stateNode.containerInfo===y)return;E=E.return}for(;A!==null;){if(E=$(A),E===null)return;if(H=E.tag,H===5||H===6||H===26||H===27){d=v=E;continue e}A=A.parentNode}}d=d.return}qb(function(){var te=v,ue=Hh(u),fe=[];e:{var ae=vx.get(r);if(ae!==void 0){var le=Wc,Te=r;switch(r){case"keypress":if(Yc(u)===0)break e;case"keydown":case"keyup":le=lA;break;case"focusin":Te="focus",le=Kh;break;case"focusout":Te="blur",le=Kh;break;case"beforeblur":case"afterblur":le=Kh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Vb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=KT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=cA;break;case mx:case px:case gx:le=WT;break;case yx:le=fA;break;case"scroll":case"scrollend":le=VT;break;case"wheel":le=mA;break;case"copy":case"cut":case"paste":le=eA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Kb;break;case"toggle":case"beforetoggle":le=gA}var Ze=(i&4)!==0,zt=!Ze&&(r==="scroll"||r==="scrollend"),X=Ze?ae!==null?ae+"Capture":null:ae;Ze=[];for(var Q=te,ee;Q!==null;){var de=Q;if(ee=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ee===null||X===null||(de=$o(Q,X),de!=null&&Ze.push(wu(Q,de,ee))),zt)break;Q=Q.return}0<Ze.length&&(ae=new le(ae,Te,null,u,ue),fe.push({event:ae,listeners:Ze}))}}if((i&7)===0){e:{if(ae=r==="mouseover"||r==="pointerover",le=r==="mouseout"||r==="pointerout",ae&&u!==$h&&(Te=u.relatedTarget||u.fromElement)&&($(Te)||Te[La]))break e;if((le||ae)&&(ae=ue.window===ue?ue:(ae=ue.ownerDocument)?ae.defaultView||ae.parentWindow:window,le?(Te=u.relatedTarget||u.toElement,le=te,Te=Te?$(Te):null,Te!==null&&(zt=o(Te),Ze=Te.tag,Te!==zt||Ze!==5&&Ze!==27&&Ze!==6)&&(Te=null)):(le=null,Te=te),le!==Te)){if(Ze=Vb,de="onMouseLeave",X="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&(Ze=Kb,de="onPointerLeave",X="onPointerEnter",Q="pointer"),zt=le==null?ae:Ce(le),ee=Te==null?ae:Ce(Te),ae=new Ze(de,Q+"leave",le,u,ue),ae.target=zt,ae.relatedTarget=ee,de=null,$(ue)===te&&(Ze=new Ze(X,Q+"enter",Te,u,ue),Ze.target=ee,Ze.relatedTarget=zt,de=Ze),zt=de,le&&Te)t:{for(Ze=p2,X=le,Q=Te,ee=0,de=X;de;de=Ze(de))ee++;de=0;for(var Fe=Q;Fe;Fe=Ze(Fe))de++;for(;0<ee-de;)X=Ze(X),ee--;for(;0<de-ee;)Q=Ze(Q),de--;for(;ee--;){if(X===Q||Q!==null&&X===Q.alternate){Ze=X;break t}X=Ze(X),Q=Ze(Q)}Ze=null}else Ze=null;le!==null&&Bw(fe,ae,le,Ze,!1),Te!==null&&zt!==null&&Bw(fe,zt,Te,Ze,!0)}}e:{if(ae=te?Ce(te):window,le=ae.nodeName&&ae.nodeName.toLowerCase(),le==="select"||le==="input"&&ae.type==="file")var kt=rx;else if(tx(ae))if(ax)kt=CA;else{kt=jA;var De=kA}else le=ae.nodeName,!le||le.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?te&&Fh(te.elementType)&&(kt=rx):kt=EA;if(kt&&(kt=kt(r,te))){nx(fe,kt,u,ue);break e}De&&De(r,ae,te),r==="focusout"&&te&&ae.type==="number"&&te.memoizedProps.value!=null&&Bh(ae,"number",ae.value)}switch(De=te?Ce(te):window,r){case"focusin":(tx(De)||De.contentEditable==="true")&&(fl=De,tm=te,Yo=null);break;case"focusout":Yo=tm=fl=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,fx(fe,u,ue);break;case"selectionchange":if(_A)break;case"keydown":case"keyup":fx(fe,u,ue)}var Xe;if(Xh)e:{switch(r){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else dl?Jb(r,u)&&(ht="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ht="onCompositionStart");ht&&(Yb&&u.locale!=="ko"&&(dl||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&dl&&(Xe=Zb()):(xi=ue,Gh="value"in xi?xi.value:xi.textContent,dl=!0)),De=$d(te,ht),0<De.length&&(ht=new Qb(ht,r,null,u,ue),fe.push({event:ht,listeners:De}),Xe?ht.data=Xe:(Xe=ex(u),Xe!==null&&(ht.data=Xe)))),(Xe=vA?bA(r,u):xA(r,u))&&(ht=$d(te,"onBeforeInput"),0<ht.length&&(De=new Qb("onBeforeInput","beforeinput",null,u,ue),fe.push({event:De,listeners:ht}),De.data=Xe)),d2(fe,r,te,u,ue)}Pw(fe,i)})}function wu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function $d(r,i){for(var u=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=$o(r,u),y!=null&&d.unshift(wu(r,y,v)),y=$o(r,i),y!=null&&d.push(wu(r,y,v))),r.tag===3)return d;r=r.return}return[]}function p2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Bw(r,i,u,d,y){for(var v=i._reactName,E=[];u!==null&&u!==d;){var A=u,H=A.alternate,te=A.stateNode;if(A=A.tag,H!==null&&H===d)break;A!==5&&A!==26&&A!==27||te===null||(H=te,y?(te=$o(u,v),te!=null&&E.unshift(wu(u,te,H))):y||(te=$o(u,v),te!=null&&E.push(wu(u,te,H)))),u=u.return}E.length!==0&&r.push({event:i,listeners:E})}var g2=/\r\n?/g,y2=/\u0000|\uFFFD/g;function Fw(r){return(typeof r=="string"?r:""+r).replace(g2,`
49
- `).replace(y2,"")}function $w(r,i){return i=Fw(i),Fw(r)===i}function Ot(r,i,u,d,y,v){switch(u){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ol(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ol(r,""+d);break;case"className":Gc(r,"class",d);break;case"tabIndex":Gc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Gc(r,u,d);break;case"style":$b(r,d,v);break;case"data":if(i!=="object"){Gc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Qc(""+d),r.setAttribute(u,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(u==="formAction"?(i!=="input"&&Ot(r,i,"name",y.name,y,null),Ot(r,i,"formEncType",y.formEncType,y,null),Ot(r,i,"formMethod",y.formMethod,y,null),Ot(r,i,"formTarget",y.formTarget,y,null)):(Ot(r,i,"encType",y.encType,y,null),Ot(r,i,"method",y.method,y,null),Ot(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Qc(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=Ua);break;case"onScroll":d!=null&&ct("scroll",r);break;case"onScrollEnd":d!=null&&ct("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}u=Qc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,""+d):r.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":d===!0?r.setAttribute(u,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,d):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(u,d):r.removeAttribute(u);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(u):r.setAttribute(u,d);break;case"popover":ct("beforetoggle",r),ct("toggle",r),Zc(r,"popover",d);break;case"xlinkActuate":Pa(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Pa(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Pa(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Pa(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Pa(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Pa(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Pa(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Pa(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Pa(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Zc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=ZT.get(u)||u,Zc(r,u,d))}}function Np(r,i,u,d,y,v){switch(u){case"style":$b(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof d=="string"?ol(r,d):(typeof d=="number"||typeof d=="bigint")&&ol(r,""+d);break;case"onScroll":d!=null&&ct("scroll",r);break;case"onScrollEnd":d!=null&&ct("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Ua);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Un.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[Vt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,d,y);break e}u in r?r[u]=d:d===!0?r.setAttribute(u,""):Zc(r,u,d)}}}function Hn(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",r),ct("load",r);var d=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var E=u[v];if(E!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,v,E,u,null)}}y&&Ot(r,i,"srcSet",u.srcSet,u,null),d&&Ot(r,i,"src",u.src,u,null);return;case"input":ct("invalid",r);var A=v=E=y=null,H=null,te=null;for(d in u)if(u.hasOwnProperty(d)){var ue=u[d];if(ue!=null)switch(d){case"name":y=ue;break;case"type":E=ue;break;case"checked":H=ue;break;case"defaultChecked":te=ue;break;case"value":v=ue;break;case"defaultValue":A=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,i));break;default:Ot(r,i,d,ue,u,null)}}Pb(r,v,A,H,te,E,y,!1);return;case"select":ct("invalid",r),d=E=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":E=A;break;case"multiple":d=A;default:Ot(r,i,y,A,u,null)}i=v,u=E,r.multiple=!!d,i!=null?ll(r,!!d,i,!1):u!=null&&ll(r,!!d,u,!0);return;case"textarea":ct("invalid",r),v=y=d=null;for(E in u)if(u.hasOwnProperty(E)&&(A=u[E],A!=null))switch(E){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Ot(r,i,E,A,u,null)}Bb(r,d,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(d=u[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Ot(r,i,H,d,u,null)}return;case"dialog":ct("beforetoggle",r),ct("toggle",r),ct("cancel",r),ct("close",r);break;case"iframe":case"object":ct("load",r);break;case"video":case"audio":for(d=0;d<xu.length;d++)ct(xu[d],r);break;case"image":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"embed":case"source":case"link":ct("error",r),ct("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(te in u)if(u.hasOwnProperty(te)&&(d=u[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,te,d,u,null)}return;default:if(Fh(i)){for(ue in u)u.hasOwnProperty(ue)&&(d=u[ue],d!==void 0&&Np(r,i,ue,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&Ot(r,i,A,d,u,null))}function v2(r,i,u,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,E=null,A=null,H=null,te=null,ue=null;for(le in u){var fe=u[le];if(u.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=fe;default:d.hasOwnProperty(le)||Ot(r,i,le,null,d,fe)}}for(var ae in d){var le=d[ae];if(fe=u[ae],d.hasOwnProperty(ae)&&(le!=null||fe!=null))switch(ae){case"type":v=le;break;case"name":y=le;break;case"checked":te=le;break;case"defaultChecked":ue=le;break;case"value":E=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:le!==fe&&Ot(r,i,ae,le,d,fe)}}Uh(r,E,A,H,te,ue,v,y);return;case"select":le=E=A=ae=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":le=H;default:d.hasOwnProperty(v)||Ot(r,i,v,null,d,H)}for(y in d)if(v=d[y],H=u[y],d.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":ae=v;break;case"defaultValue":A=v;break;case"multiple":E=v;default:v!==H&&Ot(r,i,y,v,d,H)}i=A,u=E,d=le,ae!=null?ll(r,!!u,ae,!1):!!d!=!!u&&(i!=null?ll(r,!!u,i,!0):ll(r,!!u,u?[]:"",!1));return;case"textarea":le=ae=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ot(r,i,A,null,d,y)}for(E in d)if(y=d[E],v=u[E],d.hasOwnProperty(E)&&(y!=null||v!=null))switch(E){case"value":ae=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Ot(r,i,E,y,d,v)}Ub(r,ae,le);return;case"option":for(var Te in u)if(ae=u[Te],u.hasOwnProperty(Te)&&ae!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Ot(r,i,Te,null,d,ae)}for(H in d)if(ae=d[H],le=u[H],d.hasOwnProperty(H)&&ae!==le&&(ae!=null||le!=null))switch(H){case"selected":r.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:Ot(r,i,H,ae,d,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ze in u)ae=u[Ze],u.hasOwnProperty(Ze)&&ae!=null&&!d.hasOwnProperty(Ze)&&Ot(r,i,Ze,null,d,ae);for(te in d)if(ae=d[te],le=u[te],d.hasOwnProperty(te)&&ae!==le&&(ae!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:Ot(r,i,te,ae,d,le)}return;default:if(Fh(i)){for(var zt in u)ae=u[zt],u.hasOwnProperty(zt)&&ae!==void 0&&!d.hasOwnProperty(zt)&&Np(r,i,zt,void 0,d,ae);for(ue in d)ae=d[ue],le=u[ue],!d.hasOwnProperty(ue)||ae===le||ae===void 0&&le===void 0||Np(r,i,ue,ae,d,le);return}}for(var X in u)ae=u[X],u.hasOwnProperty(X)&&ae!=null&&!d.hasOwnProperty(X)&&Ot(r,i,X,null,d,ae);for(fe in d)ae=d[fe],le=u[fe],!d.hasOwnProperty(fe)||ae===le||ae==null&&le==null||Ot(r,i,fe,ae,d,le)}function Hw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function b2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),d=0;d<u.length;d++){var y=u[d],v=y.transferSize,E=y.initiatorType,A=y.duration;if(v&&A&&Hw(E)){for(E=0,A=y.responseEnd,d+=1;d<u.length;d++){var H=u[d],te=H.startTime;if(te>A)break;var ue=H.transferSize,fe=H.initiatorType;ue&&Hw(fe)&&(H=H.responseEnd,E+=ue*(H<A?1:(A-te)/(H-te)))}if(--d,i+=8*(v+E)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var _p=null,Tp=null;function Hd(r){return r.nodeType===9?r:r.ownerDocument}function qw(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 Zw(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Ap(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Rp=null;function x2(){var r=window.event;return r&&r.type==="popstate"?r===Rp?!1:(Rp=r,!0):(Rp=null,!1)}var Gw=typeof setTimeout=="function"?setTimeout:void 0,w2=typeof clearTimeout=="function"?clearTimeout:void 0,Vw=typeof Promise=="function"?Promise:void 0,S2=typeof queueMicrotask=="function"?queueMicrotask:typeof Vw<"u"?function(r){return Vw.resolve(null).then(r).catch(k2)}:Gw;function k2(r){setTimeout(function(){throw r})}function Li(r){return r==="head"}function Qw(r,i){var u=i,d=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(d===0){r.removeChild(y),Ul(i);return}d--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")d++;else if(u==="html")Su(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,Su(u);for(var v=u.firstChild;v;){var E=v.nextSibling,A=v.nodeName;v[bi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=E}}else u==="body"&&Su(r.ownerDocument.body);u=y}while(u);Ul(i)}function Kw(r,i){var u=r;r=0;do{var d=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),d&&d.nodeType===8)if(u=d.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=d}while(u)}function Op(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var u=i;switch(i=i.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Op(u),Be(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function j2(r,i,u,d){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[bi])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=Jr(r.nextSibling),r===null)break}return null}function E2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Jr(r.nextSibling),r===null))return null;return r}function Yw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Jr(r.nextSibling),r===null))return null;return r}function zp(r){return r.data==="$?"||r.data==="$~"}function Mp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function C2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var d=function(){i(),u.removeEventListener("DOMContentLoaded",d)};u.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Jr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Dp=null;function Xw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return Jr(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function Ww(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 Jw(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 Su(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Be(r)}var ea=new Map,eS=new Set;function qd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ti=ne.d;ne.d={f:N2,r:_2,D:T2,C:A2,L:R2,m:O2,X:M2,S:z2,M:D2};function N2(){var r=ti.f(),i=Dd();return r||i}function _2(r){var i=he(r);i!==null&&i.tag===5&&i.type==="form"?y0(i):ti.r(r)}var Il=typeof document>"u"?null:document;function tS(r,i,u){var d=Il;if(d&&typeof i=="string"&&i){var y=Gr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),eS.has(y)||(eS.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Hn(i,"link",r),pt(i),d.head.appendChild(i)))}}function T2(r){ti.D(r),tS("dns-prefetch",r,null)}function A2(r,i){ti.C(r,i),tS("preconnect",r,i)}function R2(r,i,u){ti.L(r,i,u);var d=Il;if(d&&r&&i){var y='link[rel="preload"][as="'+Gr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Gr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Gr(u.imageSizes)+'"]')):y+='[href="'+Gr(r)+'"]';var v=y;switch(i){case"style":v=Ll(r);break;case"script":v=Pl(r)}ea.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),ea.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(ku(v))||i==="script"&&d.querySelector(ju(v))||(i=d.createElement("link"),Hn(i,"link",r),pt(i),d.head.appendChild(i)))}}function O2(r,i){ti.m(r,i);var u=Il;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Gr(d)+'"][href="'+Gr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Pl(r)}if(!ea.has(v)&&(r=g({rel:"modulepreload",href:r},i),ea.set(v,r),u.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ju(v)))return}d=u.createElement("link"),Hn(d,"link",r),pt(d),u.head.appendChild(d)}}}function z2(r,i,u){ti.S(r,i,u);var d=Il;if(d&&r){var y=wt(d).hoistableStyles,v=Ll(r);i=i||"default";var E=y.get(v);if(!E){var A={loading:0,preload:null};if(E=d.querySelector(ku(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=ea.get(v))&&Ip(r,u);var H=E=d.createElement("link");pt(H),Hn(H,"link",r),H._p=new Promise(function(te,ue){H.onload=te,H.onerror=ue}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Zd(E,i,d)}E={type:"stylesheet",instance:E,count:1,state:A},y.set(v,E)}}}function M2(r,i){ti.X(r,i);var u=Il;if(u&&r){var d=wt(u).hoistableScripts,y=Pl(r),v=d.get(y);v||(v=u.querySelector(ju(y)),v||(r=g({src:r,async:!0},i),(i=ea.get(y))&&Lp(r,i),v=u.createElement("script"),pt(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function D2(r,i){ti.M(r,i);var u=Il;if(u&&r){var d=wt(u).hoistableScripts,y=Pl(r),v=d.get(y);v||(v=u.querySelector(ju(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=ea.get(y))&&Lp(r,i),v=u.createElement("script"),pt(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function nS(r,i,u,d){var y=(y=ie.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=Ll(u.href),u=wt(y).hoistableStyles,d=u.get(i),d||(d={type:"style",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Ll(u.href);var v=wt(y).hoistableStyles,E=v.get(r);if(E||(y=y.ownerDocument||y,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,E),(v=y.querySelector(ku(r)))&&!v._p&&(E.instance=v,E.state.loading=5),ea.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},ea.set(r,u),v||I2(y,r,u,E.state))),i&&d===null)throw Error(a(528,""));return E}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Pl(u),u=wt(y).hoistableScripts,d=u.get(i),d||(d={type:"script",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Ll(r){return'href="'+Gr(r)+'"'}function ku(r){return'link[rel="stylesheet"]['+r+"]"}function rS(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function I2(r,i,u,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Hn(i,"link",u),pt(i),r.head.appendChild(i))}function Pl(r){return'[src="'+Gr(r)+'"]'}function ju(r){return"script[async]"+r}function aS(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Gr(u.href)+'"]');if(d)return i.instance=d,pt(d),d;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),pt(d),Hn(d,"style",y),Zd(d,u.precedence,r),i.instance=d;case"stylesheet":y=Ll(u.href);var v=r.querySelector(ku(y));if(v)return i.state.loading|=4,i.instance=v,pt(v),v;d=rS(u),(y=ea.get(y))&&Ip(d,y),v=(r.ownerDocument||r).createElement("link"),pt(v);var E=v;return E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Hn(v,"link",d),i.state.loading|=4,Zd(v,u.precedence,r),i.instance=v;case"script":return v=Pl(u.src),(y=r.querySelector(ju(v)))?(i.instance=y,pt(y),y):(d=u,(y=ea.get(v))&&(d=g({},u),Lp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),pt(y),Hn(y,"link",d),r.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Zd(d,u.precedence,r));return i.instance}function Zd(r,i,u){for(var d=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,E=0;E<d.length;E++){var A=d[E];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Ip(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Lp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Gd=null;function iS(r,i,u){if(Gd===null){var d=new Map,y=Gd=new Map;y.set(u,d)}else y=Gd,d=y.get(u),d||(d=new Map,y.set(u,d));if(d.has(r))return d;for(d.set(r,null),u=u.getElementsByTagName(r),y=0;y<u.length;y++){var v=u[y];if(!(v[bi]||v[fn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var E=v.getAttribute(i)||"";E=r+E;var A=d.get(E);A?A.push(v):d.set(E,[v])}}return d}function sS(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function L2(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 lS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function P2(r,i,u,d){if(u.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Ll(d.href),v=i.querySelector(ku(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,pt(v);return}v=i.ownerDocument||i,d=rS(d),(y=ea.get(y))&&Ip(d,y),v=v.createElement("link"),pt(v);var E=v;E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Hn(v,"link",d),u.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Vd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Pp=0;function U2(r,i){return r.stylesheets&&r.count===0&&Kd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var d=setTimeout(function(){if(r.stylesheets&&Kd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Pp===0&&(Pp=62500*b2());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>Pp?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(d),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(B2,r),Qd=null,Vd.call(r))}function B2(r,i){if(!(i.state.loading&4)){var u=Qd.get(r);if(u)var d=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 E=y[v];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(u.set(E.dataset.precedence,E),d=E)}d&&u.set(null,d)}y=i.instance,E=y.getAttribute("data-precedence"),v=u.get(E)||d,v===d&&u.set(null,y),u.set(E,y),this.count++,d=Vd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var Eu={$$typeof:R,Provider:null,Consumer:null,_currentValue:ke,_currentValue2:ke,_threadCount:0};function F2(r,i,u,d,y,v,E,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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function oS(r,i,u,d,y,v,E,A,H,te,ue,fe){return r=new F2(r,i,u,E,H,te,ue,fe,A),i=1,v===!0&&(i|=24),v=Or(3,null,null,i),r.current=v,v.stateNode=r,i=ym(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},wm(v),r}function uS(r){return r?(r=pl,r):pl}function cS(r,i,u,d,y,v){y=uS(y),d.context===null?d.context=y:d.pendingContext=y,d=Ci(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=Ni(r,d,i),u!==null&&(br(u,r,i),ru(u,r,i))}function dS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Up(r,i){dS(r,i),(r=r.alternate)&&dS(r,i)}function fS(r){if(r.tag===13||r.tag===31){var i=ws(r,67108864);i!==null&&br(i,r,67108864),Up(r,67108864)}}function hS(r){if(r.tag===13||r.tag===31){var i=Lr();i=rr(i);var u=ws(r,i);u!==null&&br(u,r,i),Up(r,i)}}var Yd=!0;function $2(r,i,u,d){var y=Z.T;Z.T=null;var v=ne.p;try{ne.p=2,Bp(r,i,u,d)}finally{ne.p=v,Z.T=y}}function H2(r,i,u,d){var y=Z.T;Z.T=null;var v=ne.p;try{ne.p=8,Bp(r,i,u,d)}finally{ne.p=v,Z.T=y}}function Bp(r,i,u,d){if(Yd){var y=Fp(d);if(y===null)Cp(r,i,d,Xd,u),pS(r,d);else if(Z2(y,r,i,u,d))d.stopPropagation();else if(pS(r,d),i&4&&-1<q2.indexOf(r)){for(;y!==null;){var v=he(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var E=Vn(v.pendingLanes);if(E!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;E;){var H=1<<31-ot(E);A.entanglements[1]|=H,E&=~H}Na(v),(Et&6)===0&&(zd=cn()+500,bu(0))}}break;case 31:case 13:A=ws(v,2),A!==null&&br(A,v,2),Dd(),Up(v,2)}if(v=Fp(d),v===null&&Cp(r,i,d,Xd,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Cp(r,i,d,null,u)}}function Fp(r){return r=Hh(r),$p(r)}var Xd=null;function $p(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=f(i),r!==null)return r;r=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Xd=r,null}function mS(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(fa()){case oe:return 2;case ge:return 8;case $e:case Ve:return 32;case st:return 268435456;default:return 32}default:return 32}}var Hp=!1,Pi=null,Ui=null,Bi=null,Cu=new Map,Nu=new Map,Fi=[],q2="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 pS(r,i){switch(r){case"focusin":case"focusout":Pi=null;break;case"dragenter":case"dragleave":Ui=null;break;case"mouseover":case"mouseout":Bi=null;break;case"pointerover":case"pointerout":Cu.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nu.delete(i.pointerId)}}function _u(r,i,u,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=he(i),i!==null&&fS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function Z2(r,i,u,d,y){switch(i){case"focusin":return Pi=_u(Pi,r,i,u,d,y),!0;case"dragenter":return Ui=_u(Ui,r,i,u,d,y),!0;case"mouseover":return Bi=_u(Bi,r,i,u,d,y),!0;case"pointerover":var v=y.pointerId;return Cu.set(v,_u(Cu.get(v)||null,r,i,u,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Nu.set(v,_u(Nu.get(v)||null,r,i,u,d,y)),!0}return!1}function gS(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,Po(r.priority,function(){hS(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,Po(r.priority,function(){hS(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=Fp(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);$h=d,u.target.dispatchEvent(d),$h=null}else return i=he(u),i!==null&&fS(i),r.blockedOn=u,!1;i.shift()}return!0}function yS(r,i,u){Wd(r)&&u.delete(i)}function G2(){Hp=!1,Pi!==null&&Wd(Pi)&&(Pi=null),Ui!==null&&Wd(Ui)&&(Ui=null),Bi!==null&&Wd(Bi)&&(Bi=null),Cu.forEach(yS),Nu.forEach(yS)}function Jd(r,i){r.blockedOn===i&&(r.blockedOn=null,Hp||(Hp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,G2)))}var ef=null;function vS(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],d=r[i+1],y=r[i+2];if(typeof d!="function"){if($p(d||u)===null)continue;break}var v=he(u);v!==null&&(r.splice(i,3),i-=3,Fm(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function Ul(r){function i(H){return Jd(H,r)}Pi!==null&&Jd(Pi,r),Ui!==null&&Jd(Ui,r),Bi!==null&&Jd(Bi,r),Cu.forEach(i),Nu.forEach(i);for(var u=0;u<Fi.length;u++){var d=Fi[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Fi.length&&(u=Fi[0],u.blockedOn===null);)gS(u),u.blockedOn===null&&Fi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(d=0;d<u.length;d+=3){var y=u[d],v=u[d+1],E=y[Vt]||null;if(typeof v=="function")E||vS(u);else if(E){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,E=v[Vt]||null)A=E.formAction;else if($p(y)!==null)continue}else A=E.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),vS(u)}}}function bS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(E){return y=E})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(u,20)}function u(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function qp(r){this._internalRoot=r}tf.prototype.render=qp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Lr();cS(u,d,r,i,null,null)},tf.prototype.unmount=qp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;cS(r.current,2,null,r,null,null),Dd(),i[La]=null}};function tf(r){this._internalRoot=r}tf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Lo();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Fi.length&&i!==0&&i<Fi[u].priority;u++);Fi.splice(u,0,r),u===0&&gS(r)}};var xS=t.version;if(xS!=="19.2.4")throw Error(a(527,xS,"19.2.4"));ne.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var V2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nf.isDisabled&&nf.supportsFiber)try{Zt=nf.inject(V2),Ut=nf}catch{}}return Au.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=N0,v=_0,E=T0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(E=i.onRecoverableError)),i=oS(r,1,!1,null,null,u,d,null,y,v,E,bS),r[La]=i.current,Ep(r),new qp(i)},Au.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=N0,E=_0,A=T0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(d=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(E=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=oS(r,1,!0,i,u??null,d,y,H,v,E,A,bS),i.context=uS(null),u=i.current,d=Lr(),d=rr(d),y=Ci(d),y.callback=null,Ni(u,y,d),u=d,i.current.lanes=u,yn(i,u),Na(i),r[La]=i.current,Ep(r),new tf(i)},Au.version="19.2.4",Au}var RS;function aR(){if(RS)return Qp.exports;RS=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=rR(),Qp.exports}var iR=aR(),Ws=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(){}},Us,Ki,ao,yj,sR=(yj=class extends Ws{constructor(){super();Ne(this,Us);Ne(this,Ki);Ne(this,ao);Se(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){B(this,Ki)||this.setEventListener(B(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Ki))==null||t.call(this),Se(this,Ki,void 0))}setEventListener(t){var n;Se(this,ao,t),(n=B(this,Ki))==null||n.call(this),Se(this,Ki,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){B(this,Us)!==t&&(Se(this,Us,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof B(this,Us)=="boolean"?B(this,Us):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Us=new WeakMap,Ki=new WeakMap,ao=new WeakMap,yj),sv=new sR,lR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yi,rv,vj,oR=(vj=class{constructor(){Ne(this,Yi,lR);Ne(this,rv,!1)}setTimeoutProvider(e){Se(this,Yi,e)}setTimeout(e,t){return B(this,Yi).setTimeout(e,t)}clearTimeout(e){B(this,Yi).clearTimeout(e)}setInterval(e,t){return B(this,Yi).setInterval(e,t)}clearInterval(e){B(this,Yi).clearInterval(e)}},Yi=new WeakMap,rv=new WeakMap,vj),Is=new oR;function uR(e){setTimeout(e,0)}var cR=typeof window>"u"||"Deno"in globalThis;function Xn(){}function dR(e,t){return typeof e=="function"?e(t):e}function Vg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Aj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function is(e,t){return typeof e=="function"?e(t):e}function ra(e,t){return typeof e=="function"?e(t):e}function OS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==lv(c,t.options))return!1}else if(!ac(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||s&&s!==t.state.fetchStatus||o&&!o(t))}function zS(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Qs(t.options.mutationKey)!==Qs(o))return!1}else if(!ac(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function lv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qs)(e)}function Qs(e){return JSON.stringify(e,(t,n)=>Qg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function ac(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ac(e[n],t[n])):!1}var fR=Object.prototype.hasOwnProperty;function ov(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=MS(e)&&MS(t);if(!a&&!(Qg(e)&&Qg(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),f=c.length,m=a?new Array(f):{};let h=0;for(let p=0;p<f;p++){const g=a?p:c[p],x=e[g],w=t[g];if(x===w){m[g]=x,(a?p<o:fR.call(e,g))&&h++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){m[g]=w;continue}const k=ov(x,w,n+1);m[g]=k,k===x&&h++}return o===f&&h===o?e:m}function ic(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 MS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qg(e){if(!DS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!DS(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function DS(e){return Object.prototype.toString.call(e)==="[object Object]"}function hR(e){return new Promise(t=>{Is.setTimeout(t,e)})}function Kg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?ov(e,t):t}function mR(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function pR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var uv=Symbol();function Rj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===uv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function cv(e,t){return typeof e=="function"?e(...t):!!e}function gR(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 sc=(()=>{let e=()=>cR;return{isServer(){return e()},setIsServer(t){e=t}}})();function Yg(){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 yR=uR;function vR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=yR;const o=f=>{t?e.push(f):s(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var on=vR(),io,Xi,so,bj,bR=(bj=class extends Ws{constructor(){super();Ne(this,io,!0);Ne(this,Xi);Ne(this,so);Se(this,so,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,Xi)||this.setEventListener(B(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Xi))==null||t.call(this),Se(this,Xi,void 0))}setEventListener(t){var n;Se(this,so,t),(n=B(this,Xi))==null||n.call(this),Se(this,Xi,t(this.setOnline.bind(this)))}setOnline(t){B(this,io)!==t&&(Se(this,io,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return B(this,io)}},io=new WeakMap,Xi=new WeakMap,so=new WeakMap,bj),If=new bR;function xR(e){return Math.min(1e3*2**e,3e4)}function Oj(e){return(e??"online")==="online"?If.isOnline():!0}var Xg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function zj(e){let t=!1,n=0,a;const s=Yg(),o=()=>s.status!=="pending",c=j=>{var S;if(!o()){const C=new Xg(j);x(C),(S=e.onCancel)==null||S.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>sv.isFocused()&&(e.networkMode==="always"||If.isOnline())&&e.canRun(),p=()=>Oj(e.networkMode)&&e.canRun(),g=j=>{o()||(a==null||a(),s.resolve(j))},x=j=>{o()||(a==null||a(),s.reject(j))},w=()=>new Promise(j=>{var S;a=C=>{(o()||h())&&j(C)},(S=e.onPause)==null||S.call(e)}).then(()=>{var j;a=void 0,o()||(j=e.onContinue)==null||j.call(e)}),k=()=>{if(o())return;let j;const S=n===0?e.initialPromise:void 0;try{j=S??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(g).catch(C=>{var O;if(o())return;const _=e.retry??(sc.isServer()?0:3),R=e.retryDelay??xR,z=typeof R=="function"?R(n,C):R,P=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,C);if(t||!P){x(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),hR(z).then(()=>h()?void 0:w()).then(()=>{t?x(C):k()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?k():w().then(k),s)}}var Bs,xj,Mj=(xj=class{constructor(){Ne(this,Bs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vg(this.gcTime)&&Se(this,Bs,Is.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sc.isServer()?1/0:300*1e3))}clearGcTimeout(){B(this,Bs)&&(Is.clearTimeout(B(this,Bs)),Se(this,Bs,void 0))}},Bs=new WeakMap,xj),Fs,lo,ta,$s,Ln,xc,Hs,Br,Dj,ri,wj,wR=(wj=class extends Mj{constructor(t){super();Ne(this,Br);Ne(this,Fs);Ne(this,lo);Ne(this,ta);Ne(this,$s);Ne(this,Ln);Ne(this,xc);Ne(this,Hs);Se(this,Hs,!1),Se(this,xc,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,$s,t.client),Se(this,ta,B(this,$s).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,Fs,LS(this.options)),this.state=t.state??B(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=B(this,Ln))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,xc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=LS(this.options);n.data!==void 0&&(this.setState(IS(n.data,n.dataUpdatedAt)),Se(this,Fs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&B(this,ta).remove(this)}setData(t,n){const a=Kg(this.state.data,t,this.options);return Ge(this,Br,ri).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ge(this,Br,ri).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=B(this,Ln))==null?void 0:a.promise;return(s=B(this,Ln))==null||s.cancel(t),n?n.then(Xn).catch(Xn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return B(this,Fs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ra(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===uv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>is(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:!Aj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Ln))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Ln))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),B(this,ta).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,Ln)&&(B(this,Hs)||Ge(this,Br,Dj).call(this)?B(this,Ln).cancel({revert:!0}):B(this,Ln).cancelRetry()),this.scheduleGc()),B(this,ta).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ge(this,Br,ri).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,x,w,k,j,S,C,_,R;if(this.state.fetchStatus!=="idle"&&((m=B(this,Ln))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(B(this,Ln))return B(this,Ln).continueRetry(),B(this,Ln).promise}if(t&&this.setOptions(t),!this.options.queryFn){const z=this.observers.find(P=>P.options.queryFn);z&&this.setOptions(z.options)}const a=new AbortController,s=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(Se(this,Hs,!0),a.signal)})},o=()=>{const z=Rj(this.options,n),O=(()=>{const L={client:B(this,$s),queryKey:this.queryKey,meta:this.meta};return s(L),L})();return Se(this,Hs,!1),this.options.persister?this.options.persister(z,O,this):z(O)},f=(()=>{const z={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:B(this,$s),state:this.state,fetchFn:o};return s(z),z})();(h=this.options.behavior)==null||h.onFetch(f,this),Se(this,lo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Ge(this,Br,ri).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),Se(this,Ln,zj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:z=>{z instanceof Xg&&z.revert&&this.setState({...B(this,lo),fetchStatus:"idle"}),a.abort()},onFail:(z,P)=>{Ge(this,Br,ri).call(this,{type:"failed",failureCount:z,error:P})},onPause:()=>{Ge(this,Br,ri).call(this,{type:"pause"})},onContinue:()=>{Ge(this,Br,ri).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const z=await B(this,Ln).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(w=(x=B(this,ta).config).onSuccess)==null||w.call(x,z,this),(j=(k=B(this,ta).config).onSettled)==null||j.call(k,z,this.state.error,this),z}catch(z){if(z instanceof Xg){if(z.silent)return B(this,Ln).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ge(this,Br,ri).call(this,{type:"error",error:z}),(C=(S=B(this,ta).config).onError)==null||C.call(S,z,this),(R=(_=B(this,ta).config).onSettled)==null||R.call(_,this.state.data,z,this),z}finally{this.scheduleGc()}}},Fs=new WeakMap,lo=new WeakMap,ta=new WeakMap,$s=new WeakMap,Ln=new WeakMap,xc=new WeakMap,Hs=new WeakMap,Br=new WeakSet,Dj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ri=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,...Ij(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...IS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,lo,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),on.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),B(this,ta).notify({query:this,type:"updated",action:t})})},wj);function Ij(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Oj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function IS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function LS(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 Sr,yt,wc,lr,qs,oo,ai,Wi,Sc,uo,co,Zs,Gs,Ji,fo,Nt,Ku,Wg,Jg,ey,ty,ny,ry,ay,Lj,Sj,dv=(Sj=class extends Ws{constructor(t,n){super();Ne(this,Nt);Ne(this,Sr);Ne(this,yt);Ne(this,wc);Ne(this,lr);Ne(this,qs);Ne(this,oo);Ne(this,ai);Ne(this,Wi);Ne(this,Sc);Ne(this,uo);Ne(this,co);Ne(this,Zs);Ne(this,Gs);Ne(this,Ji);Ne(this,fo,new Set);this.options=n,Se(this,Sr,t),Se(this,Wi,null),Se(this,ai,Yg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,yt).addObserver(this),PS(B(this,yt),this.options)?Ge(this,Nt,Ku).call(this):this.updateResult(),Ge(this,Nt,ty).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return iy(B(this,yt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return iy(B(this,yt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ge(this,Nt,ny).call(this),Ge(this,Nt,ry).call(this),B(this,yt).removeObserver(this)}setOptions(t){const n=this.options,a=B(this,yt);if(this.options=B(this,Sr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ra(this.options.enabled,B(this,yt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ge(this,Nt,ay).call(this),B(this,yt).setOptions(this.options),n._defaulted&&!ic(this.options,n)&&B(this,Sr).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,yt),observer:this});const s=this.hasListeners();s&&US(B(this,yt),a,this.options,n)&&Ge(this,Nt,Ku).call(this),this.updateResult(),s&&(B(this,yt)!==a||ra(this.options.enabled,B(this,yt))!==ra(n.enabled,B(this,yt))||is(this.options.staleTime,B(this,yt))!==is(n.staleTime,B(this,yt)))&&Ge(this,Nt,Wg).call(this);const o=Ge(this,Nt,Jg).call(this);s&&(B(this,yt)!==a||ra(this.options.enabled,B(this,yt))!==ra(n.enabled,B(this,yt))||o!==B(this,Ji))&&Ge(this,Nt,ey).call(this,o)}getOptimisticResult(t){const n=B(this,Sr).getQueryCache().build(B(this,Sr),t),a=this.createResult(n,t);return kR(this,a)&&(Se(this,lr,a),Se(this,oo,this.options),Se(this,qs,B(this,yt).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,ai).status==="pending"&&B(this,ai).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){B(this,fo).add(t)}getCurrentQuery(){return B(this,yt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=B(this,Sr).defaultQueryOptions(t),a=B(this,Sr).getQueryCache().build(B(this,Sr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ge(this,Nt,Ku).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,lr)))}createResult(t,n){var K;const a=B(this,yt),s=this.options,o=B(this,lr),c=B(this,qs),f=B(this,oo),h=t!==a?t.state:B(this,wc),{state:p}=t;let g={...p},x=!1,w;if(n._optimisticResults){const D=this.hasListeners(),Y=!D&&PS(t,n),se=D&&US(t,a,n,s);(Y||se)&&(g={...g,...Ij(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:k,errorUpdatedAt:j,status:S}=g;w=g.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&S==="pending"){let D;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(D=o.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((K=B(this,co))==null?void 0:K.state.data,B(this,co)):n.placeholderData,D!==void 0&&(S="success",w=Kg(o==null?void 0:o.data,D,n),x=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===B(this,Sc))w=B(this,uo);else try{Se(this,Sc,n.select),w=n.select(w),w=Kg(o==null?void 0:o.data,w,n),Se(this,uo,w),Se(this,Wi,null)}catch(D){Se(this,Wi,D)}B(this,Wi)&&(k=B(this,Wi),w=B(this,uo),j=Date.now(),S="error");const _=g.fetchStatus==="fetching",R=S==="pending",z=S==="error",P=R&&_,O=w!==void 0,I={status:S,fetchStatus:g.fetchStatus,isPending:R,isSuccess:S==="success",isError:z,isInitialLoading:P,isLoading:P,data:w,dataUpdatedAt:g.dataUpdatedAt,error:k,errorUpdatedAt:j,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:_,isRefetching:_&&!R,isLoadingError:z&&!O,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:z&&O,isStale:fv(t,n),refetch:this.refetch,promise:B(this,ai),isEnabled:ra(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=I.data!==void 0,Y=I.status==="error"&&!D,se=W=>{Y?W.reject(I.error):D&&W.resolve(I.data)},xe=()=>{const W=Se(this,ai,I.promise=Yg());se(W)},J=B(this,ai);switch(J.status){case"pending":t.queryHash===a.queryHash&&se(J);break;case"fulfilled":(Y||I.data!==J.value)&&xe();break;case"rejected":(!Y||I.error!==J.reason)&&xe();break}}return I}updateResult(){const t=B(this,lr),n=this.createResult(B(this,yt),this.options);if(Se(this,qs,B(this,yt).state),Se(this,oo,this.options),B(this,qs).data!==void 0&&Se(this,co,B(this,yt)),ic(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,fo).size)return!0;const c=new Set(o??B(this,fo));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,lr)).some(f=>{const m=f;return B(this,lr)[m]!==t[m]&&c.has(m)})};Ge(this,Nt,Lj).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ge(this,Nt,ty).call(this)}},Sr=new WeakMap,yt=new WeakMap,wc=new WeakMap,lr=new WeakMap,qs=new WeakMap,oo=new WeakMap,ai=new WeakMap,Wi=new WeakMap,Sc=new WeakMap,uo=new WeakMap,co=new WeakMap,Zs=new WeakMap,Gs=new WeakMap,Ji=new WeakMap,fo=new WeakMap,Nt=new WeakSet,Ku=function(t){Ge(this,Nt,ay).call(this);let n=B(this,yt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Xn)),n},Wg=function(){Ge(this,Nt,ny).call(this);const t=is(this.options.staleTime,B(this,yt));if(sc.isServer()||B(this,lr).isStale||!Vg(t))return;const a=Aj(B(this,lr).dataUpdatedAt,t)+1;Se(this,Zs,Is.setTimeout(()=>{B(this,lr).isStale||this.updateResult()},a))},Jg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,yt)):this.options.refetchInterval)??!1},ey=function(t){Ge(this,Nt,ry).call(this),Se(this,Ji,t),!(sc.isServer()||ra(this.options.enabled,B(this,yt))===!1||!Vg(B(this,Ji))||B(this,Ji)===0)&&Se(this,Gs,Is.setInterval(()=>{(this.options.refetchIntervalInBackground||sv.isFocused())&&Ge(this,Nt,Ku).call(this)},B(this,Ji)))},ty=function(){Ge(this,Nt,Wg).call(this),Ge(this,Nt,ey).call(this,Ge(this,Nt,Jg).call(this))},ny=function(){B(this,Zs)&&(Is.clearTimeout(B(this,Zs)),Se(this,Zs,void 0))},ry=function(){B(this,Gs)&&(Is.clearInterval(B(this,Gs)),Se(this,Gs,void 0))},ay=function(){const t=B(this,Sr).getQueryCache().build(B(this,Sr),this.options);if(t===B(this,yt))return;const n=B(this,yt);Se(this,yt,t),Se(this,wc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Lj=function(t){on.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(B(this,lr))}),B(this,Sr).getQueryCache().notify({query:B(this,yt),type:"observerResultsUpdated"})})},Sj);function SR(e,t){return ra(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function PS(e,t){return SR(e,t)||e.state.data!==void 0&&iy(e,t,t.refetchOnMount)}function iy(e,t,n){if(ra(t.enabled,e)!==!1&&is(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&fv(e,t)}return!1}function US(e,t,n,a){return(e!==t||ra(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&fv(e,n)}function fv(e,t){return ra(t.enabled,e)!==!1&&e.isStaleByTime(is(t.staleTime,e))}function kR(e,t){return!ic(e.getCurrentResult(),t)}function BS(e){return{onFetch:(t,n)=>{var p,g,x,w,k;const a=t.options,s=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const S=R=>{gR(R,()=>t.signal,()=>j=!0)},C=Rj(t.options,t.fetchOptions),_=async(R,z,P)=>{if(j)return Promise.reject();if(z==null&&R.pages.length)return Promise.resolve(R);const L=(()=>{const Y={client:t.client,queryKey:t.queryKey,pageParam:z,direction:P?"backward":"forward",meta:t.options.meta};return S(Y),Y})(),I=await C(L),{maxPages:K}=t.options,D=P?pR:mR;return{pages:D(R.pages,I,K),pageParams:D(R.pageParams,z,K)}};if(s&&o.length){const R=s==="backward",z=R?jR:FS,P={pages:o,pageParams:c},O=z(a,P);f=await _(P,O,R)}else{const R=e??o.length;do{const z=m===0?c[0]??a.initialPageParam:FS(a,f);if(m>0&&z==null)break;f=await _(f,z),m++}while(m<R)}return f};t.options.persister?t.fetchFn=()=>{var j,S;return(S=(j=t.options).persister)==null?void 0:S.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function FS(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 jR(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var kc,Ta,Kn,Vs,Aa,Gi,kj,ER=(kj=class extends Mj{constructor(t){super();Ne(this,Aa);Ne(this,kc);Ne(this,Ta);Ne(this,Kn);Ne(this,Vs);Se(this,kc,t.client),this.mutationId=t.mutationId,Se(this,Kn,t.mutationCache),Se(this,Ta,[]),this.state=t.state||Pj(),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,Ta).includes(t)||(B(this,Ta).push(t),this.clearGcTimeout(),B(this,Kn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Se(this,Ta,B(this,Ta).filter(n=>n!==t)),this.scheduleGc(),B(this,Kn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){B(this,Ta).length||(this.state.status==="pending"?this.scheduleGc():B(this,Kn).remove(this))}continue(){var t;return((t=B(this,Vs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,x,w,k,j,S,C,_,R,z,P,O,L;const n=()=>{Ge(this,Aa,Gi).call(this,{type:"continue"})},a={client:B(this,kc),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,Vs,zj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(I,K)=>{Ge(this,Aa,Gi).call(this,{type:"failed",failureCount:I,error:K})},onPause:()=>{Ge(this,Aa,Gi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>B(this,Kn).canRun(this)}));const s=this.state.status==="pending",o=!B(this,Vs).canStart();try{if(s)n();else{Ge(this,Aa,Gi).call(this,{type:"pending",variables:t,isPaused:o}),B(this,Kn).config.onMutate&&await B(this,Kn).config.onMutate(t,this,a);const K=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));K!==this.state.context&&Ge(this,Aa,Gi).call(this,{type:"pending",context:K,variables:t,isPaused:o})}const I=await B(this,Vs).start();return await((h=(m=B(this,Kn).config).onSuccess)==null?void 0:h.call(m,I,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,I,t,this.state.context,a)),await((w=(x=B(this,Kn).config).onSettled)==null?void 0:w.call(x,I,null,this.state.variables,this.state.context,this,a)),await((j=(k=this.options).onSettled)==null?void 0:j.call(k,I,null,t,this.state.context,a)),Ge(this,Aa,Gi).call(this,{type:"success",data:I}),I}catch(I){try{await((C=(S=B(this,Kn).config).onError)==null?void 0:C.call(S,I,t,this.state.context,this,a))}catch(K){Promise.reject(K)}try{await((R=(_=this.options).onError)==null?void 0:R.call(_,I,t,this.state.context,a))}catch(K){Promise.reject(K)}try{await((P=(z=B(this,Kn).config).onSettled)==null?void 0:P.call(z,void 0,I,this.state.variables,this.state.context,this,a))}catch(K){Promise.reject(K)}try{await((L=(O=this.options).onSettled)==null?void 0:L.call(O,void 0,I,t,this.state.context,a))}catch(K){Promise.reject(K)}throw Ge(this,Aa,Gi).call(this,{type:"error",error:I}),I}finally{B(this,Kn).runNext(this)}}},kc=new WeakMap,Ta=new WeakMap,Kn=new WeakMap,Vs=new WeakMap,Aa=new WeakSet,Gi=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),on.batch(()=>{B(this,Ta).forEach(a=>{a.onMutationUpdate(t)}),B(this,Kn).notify({mutation:this,type:"updated",action:t})})},kj);function Pj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ii,ba,jc,jj,CR=(jj=class extends Ws{constructor(t={}){super();Ne(this,ii);Ne(this,ba);Ne(this,jc);this.config=t,Se(this,ii,new Set),Se(this,ba,new Map),Se(this,jc,0)}build(t,n,a){const s=new ER({client:t,mutationCache:this,mutationId:++rf(this,jc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){B(this,ii).add(t);const n=af(t);if(typeof n=="string"){const a=B(this,ba).get(n);a?a.push(t):B(this,ba).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(B(this,ii).delete(t)){const n=af(t);if(typeof n=="string"){const a=B(this,ba).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,ba).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=af(t);if(typeof n=="string"){const a=B(this,ba).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,ba).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(){on.batch(()=>{B(this,ii).forEach(t=>{this.notify({type:"removed",mutation:t})}),B(this,ii).clear(),B(this,ba).clear()})}getAll(){return Array.from(B(this,ii))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>zS(n,a))}findAll(t={}){return this.getAll().filter(n=>zS(t,n))}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return on.batch(()=>Promise.all(t.map(n=>n.continue().catch(Xn))))}},ii=new WeakMap,ba=new WeakMap,jc=new WeakMap,jj);function af(e){var t;return(t=e.options.scope)==null?void 0:t.id}var si,es,kr,li,ui,Nf,sy,Ej,NR=(Ej=class extends Ws{constructor(n,a){super();Ne(this,ui);Ne(this,si);Ne(this,es);Ne(this,kr);Ne(this,li);Se(this,si,n),this.setOptions(a),this.bindMethods(),Ge(this,ui,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,si).defaultMutationOptions(n),ic(this.options,a)||B(this,si).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,kr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Qs(a.mutationKey)!==Qs(this.options.mutationKey)?this.reset():((s=B(this,kr))==null?void 0:s.state.status)==="pending"&&B(this,kr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=B(this,kr))==null||n.removeObserver(this)}onMutationUpdate(n){Ge(this,ui,Nf).call(this),Ge(this,ui,sy).call(this,n)}getCurrentResult(){return B(this,es)}reset(){var n;(n=B(this,kr))==null||n.removeObserver(this),Se(this,kr,void 0),Ge(this,ui,Nf).call(this),Ge(this,ui,sy).call(this)}mutate(n,a){var s;return Se(this,li,a),(s=B(this,kr))==null||s.removeObserver(this),Se(this,kr,B(this,si).getMutationCache().build(B(this,si),this.options)),B(this,kr).addObserver(this),B(this,kr).execute(n)}},si=new WeakMap,es=new WeakMap,kr=new WeakMap,li=new WeakMap,ui=new WeakSet,Nf=function(){var a;const n=((a=B(this,kr))==null?void 0:a.state)??Pj();Se(this,es,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},sy=function(n){on.batch(()=>{var a,s,o,c,f,m,h,p;if(B(this,li)&&this.hasListeners()){const g=B(this,es).variables,x=B(this,es).context,w={client:B(this,si),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=B(this,li)).onSuccess)==null||s.call(a,n.data,g,x,w)}catch(k){Promise.reject(k)}try{(c=(o=B(this,li)).onSettled)==null||c.call(o,n.data,null,g,x,w)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=B(this,li)).onError)==null||m.call(f,n.error,g,x,w)}catch(k){Promise.reject(k)}try{(p=(h=B(this,li)).onSettled)==null||p.call(h,void 0,n.error,g,x,w)}catch(k){Promise.reject(k)}}}this.listeners.forEach(g=>{g(B(this,es))})})},Ej);function $S(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function _R(e,t,n){const a=e.slice(0);return a[t]=n,a}var ho,Ur,mo,po,na,ts,Ec,Cc,Nc,_c,Gn,ly,oy,uy,cy,dy,Cj,TR=(Cj=class extends Ws{constructor(t,n,a){super();Ne(this,Gn);Ne(this,ho);Ne(this,Ur);Ne(this,mo);Ne(this,po);Ne(this,na);Ne(this,ts);Ne(this,Ec);Ne(this,Cc);Ne(this,Nc);Ne(this,_c,[]);Se(this,ho,t),Se(this,po,a),Se(this,mo,[]),Se(this,na,[]),Se(this,Ur,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&B(this,na).forEach(t=>{t.subscribe(n=>{Ge(this,Gn,cy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,B(this,na).forEach(t=>{t.destroy()})}setQueries(t,n){Se(this,mo,t),Se(this,po,n),on.batch(()=>{const a=B(this,na),s=Ge(this,Gn,uy).call(this,B(this,mo));s.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=s.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,x)=>g!==a[x]),h=f||m,p=h?!0:c.some((g,x)=>{const w=B(this,Ur)[x];return!w||!ic(g,w)});!h&&!p||(h&&(Se(this,_c,s),Se(this,na,o)),Se(this,Ur,c),this.hasListeners()&&(h&&($S(a,o).forEach(g=>{g.destroy()}),$S(o,a).forEach(g=>{g.subscribe(x=>{Ge(this,Gn,cy).call(this,g,x)})})),Ge(this,Gn,dy).call(this)))})}getCurrentResult(){return B(this,Ur)}getQueries(){return B(this,na).map(t=>t.getCurrentQuery())}getObservers(){return B(this,na)}getOptimisticResult(t,n){const a=Ge(this,Gn,uy).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>Ge(this,Gn,oy).call(this,c??s,n,o),()=>Ge(this,Gn,ly).call(this,s,a)]}},ho=new WeakMap,Ur=new WeakMap,mo=new WeakMap,po=new WeakMap,na=new WeakMap,ts=new WeakMap,Ec=new WeakMap,Cc=new WeakMap,Nc=new WeakMap,_c=new WeakMap,Gn=new WeakSet,ly=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},oy=function(t,n,a){if(n){const s=B(this,Nc),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!B(this,ts)||B(this,Ur)!==B(this,Cc)||o||n!==B(this,Ec))&&(Se(this,Ec,n),Se(this,Cc,B(this,Ur)),a!==void 0&&Se(this,Nc,a),Se(this,ts,ov(B(this,ts),n(t)))),B(this,ts)}return t},uy=function(t){const n=new Map;B(this,na).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,ho).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new dv(B(this,ho),o);a.push({defaultedQueryOptions:o,observer:f})}),a},cy=function(t,n){const a=B(this,na).indexOf(t);a!==-1&&(Se(this,Ur,_R(B(this,Ur),a,n)),Ge(this,Gn,dy).call(this))},dy=function(){var t;if(this.hasListeners()){const n=B(this,ts),a=Ge(this,Gn,ly).call(this,B(this,Ur),B(this,_c)),s=Ge(this,Gn,oy).call(this,a,(t=B(this,po))==null?void 0:t.combine);n!==s&&on.batch(()=>{this.listeners.forEach(o=>{o(B(this,Ur))})})}},Cj),Ra,Nj,AR=(Nj=class extends Ws{constructor(t={}){super();Ne(this,Ra);this.config=t,Se(this,Ra,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??lv(s,n);let c=this.get(o);return c||(c=new wR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){B(this,Ra).has(t.queryHash)||(B(this,Ra).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=B(this,Ra).get(t.queryHash);n&&(t.destroy(),n===t&&B(this,Ra).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){on.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return B(this,Ra).get(t)}getAll(){return[...B(this,Ra).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>OS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>OS(t,a)):n}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){on.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ra=new WeakMap,Nj),ln,ns,rs,go,yo,as,vo,bo,_j,RR=(_j=class{constructor(e={}){Ne(this,ln);Ne(this,ns);Ne(this,rs);Ne(this,go);Ne(this,yo);Ne(this,as);Ne(this,vo);Ne(this,bo);Se(this,ln,e.queryCache||new AR),Se(this,ns,e.mutationCache||new CR),Se(this,rs,e.defaultOptions||{}),Se(this,go,new Map),Se(this,yo,new Map),Se(this,as,0)}mount(){rf(this,as)._++,B(this,as)===1&&(Se(this,vo,sv.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,ln).onFocus())})),Se(this,bo,If.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,ln).onOnline())})))}unmount(){var e,t;rf(this,as)._--,B(this,as)===0&&((e=B(this,vo))==null||e.call(this),Se(this,vo,void 0),(t=B(this,bo))==null||t.call(this),Se(this,bo,void 0))}isFetching(e){return B(this,ln).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return B(this,ns).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,ln).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=B(this,ln).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(is(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return B(this,ln).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,ln).get(a.queryHash),o=s==null?void 0:s.state.data,c=dR(t,o);if(c!==void 0)return B(this,ln).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>B(this,ln).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,ln).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=B(this,ln);on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=B(this,ln);return on.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=on.batch(()=>B(this,ln).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(Xn).catch(Xn)}invalidateQueries(e,t={}){return on.batch(()=>(B(this,ln).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=on.batch(()=>B(this,ln).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Xn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(Xn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=B(this,ln).build(this,t);return n.isStaleByTime(is(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xn).catch(Xn)}fetchInfiniteQuery(e){return e.behavior=BS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xn).catch(Xn)}ensureInfiniteQueryData(e){return e.behavior=BS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return If.isOnline()?B(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return B(this,ln)}getMutationCache(){return B(this,ns)}getDefaultOptions(){return B(this,rs)}setDefaultOptions(e){Se(this,rs,e)}setQueryDefaults(e,t){B(this,go).set(Qs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...B(this,go).values()],n={};return t.forEach(a=>{ac(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){B(this,yo).set(Qs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...B(this,yo).values()],n={};return t.forEach(a=>{ac(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...B(this,rs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=lv(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===uv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...B(this,rs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){B(this,ln).clear(),B(this,ns).clear()}},ln=new WeakMap,ns=new WeakMap,rs=new WeakMap,go=new WeakMap,yo=new WeakMap,as=new WeakMap,vo=new WeakMap,bo=new WeakMap,_j),Uj=b.createContext(void 0),gn=e=>{const t=b.useContext(Uj);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},OR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Uj.Provider,{value:e,children:t})),Bj=b.createContext(!1),Fj=()=>b.useContext(Bj);Bj.Provider;function zR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var MR=b.createContext(zR()),$j=()=>b.useContext(MR),Hj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?cv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},qj=e=>{b.useEffect(()=>{e.clearReset()},[e])},Zj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||cv(n,[e.error,a])),Gj=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))}},DR=(e,t)=>e.isLoading&&e.isFetching&&!t,fy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,hy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function IR({queries:e,...t},n){const a=gn(),s=Fj(),o=$j(),c=b.useMemo(()=>e.map(j=>{const S=a.defaultQueryOptions(j);return S._optimisticResults=s?"isRestoring":"optimistic",S}),[e,a,s]);c.forEach(j=>{Gj(j);const S=a.getQueryCache().get(j.queryHash);Hj(j,o,S)}),qj(o);const[f]=b.useState(()=>new TR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(j=>g?f.subscribe(on.batchCalls(j)):Xn,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((j,S)=>fy(c[S],j))?m.flatMap((j,S)=>{const C=c[S];if(C&&fy(C,j)){const _=new dv(a,C);return hy(C,_,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const k=m.find((j,S)=>{const C=c[S];return C&&Zj({result:j,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(k!=null&&k.error)throw k.error;return h(p())}function LR(e,t,n){var x,w,k,j;const a=Fj(),s=$j(),o=gn(),c=o.defaultQueryOptions(e);(w=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||w.call(x,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Gj(c),Hj(c,s,f),qj(s);const m=!o.getQueryCache().get(c.queryHash),[h]=b.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(S=>{const C=g?h.subscribe(on.batchCalls(S)):Xn;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),fy(c,p))throw hy(c,h,s);if(Zj({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((j=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||j.call(k,c,p),c.experimental_prefetchInRender&&!sc.isServer()&&DR(p,a)){const S=m?hy(c,h,s):f==null?void 0:f.promise;S==null||S.catch(Xn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ke(e,t){return LR(e,dv)}function mt(e,t){const n=gn(),[a]=b.useState(()=>new NR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(on.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(Xn)},[a]);if(s.error&&cv(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 HS="popstate";function qS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function PR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=o||a.location;return my("",{pathname:c,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:lc(s)}return BR(t,n,null,e)}function Kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function UR(){return Math.random().toString(36).substring(2,10)}function ZS(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 my(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||UR(),unstable_mask:s}}function lc({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 BR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){f="POP";let S=p(),C=S==null?null:S-h;h=S,m&&m({action:f,location:j.location,delta:C})}function x(S,C){f="PUSH";let _=qS(S)?S:my(j.location,S,C);h=p()+1;let R=ZS(_,h),z=j.createHref(_.unstable_mask||_);try{c.pushState(R,"",z)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;s.location.assign(z)}o&&m&&m({action:f,location:j.location,delta:1})}function w(S,C){f="REPLACE";let _=qS(S)?S:my(j.location,S,C);h=p();let R=ZS(_,h),z=j.createHref(_.unstable_mask||_);c.replaceState(R,"",z),o&&m&&m({action:f,location:j.location,delta:0})}function k(S){return FR(S)}let j={get action(){return f},get location(){return e(s,c)},listen(S){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(HS,g),m=S,()=>{s.removeEventListener(HS,g),m=null}},createHref(S){return t(s,S)},createURL:k,encodeLocation(S){let C=k(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:w,go(S){return c.go(S)}};return j}function FR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Kt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:lc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Vj(e,t,n="/"){return $R(e,t,n,!1)}function $R(e,t,n,a){let s=typeof t=="string"?Co(t):t,o=ci(s.pathname||"/",n);if(o==null)return null;let c=Qj(e);HR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=eO(o);f=WR(c[m],h,a)}return f}function Qj(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Kt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=za([a,p.relativePath]),x=n.concat(p);c.children&&c.children.length>0&&(Kt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Qj(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:YR(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of Kj(c.path))o(c,f,!0,h)}),t}function Kj(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=Kj(a.join("/")),f=[];return f.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function HR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:XR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var qR=/^:[\w-]+$/,ZR=3,GR=2,VR=1,QR=10,KR=-2,GS=e=>e==="*";function YR(e,t){let n=e.split("/"),a=n.length;return n.some(GS)&&(a+=KR),t&&(a+=GR),n.filter(s=>!GS(s)).reduce((s,o)=>s+(qR.test(o)?ZR:o===""?VR:QR),a)}function XR(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 WR(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,p=o==="/"?t:t.slice(o.length)||"/",g=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),x=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),c.push({params:s,pathname:za([o,g.pathname]),pathnameBase:aO(za([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=za([o,g.pathnameBase]))}return c}function Lf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=JR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:p,isOptional:g},x)=>{if(p==="*"){let k=f[x]||"";c=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function JR(e,t=!1,n=!0){sa(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,h,p)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=p.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function eO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return sa(!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 ci(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 tO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function nO(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=VS(n.substring(1),"/"):o=VS(n,t)):o=t,{pathname:o,search:iO(a),hash:sO(s)}}function VS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Wp(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function rO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function hv(e){let t=rO(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ah(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Kt(!s.pathname||!s.pathname.includes("?"),Wp("?","pathname","search",s)),Kt(!s.pathname||!s.pathname.includes("#"),Wp("#","pathname","hash",s)),Kt(!s.search||!s.search.includes("#"),Wp("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,f;if(c==null)f=n;else{let g=t.length-1;if(!a&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;s.pathname=x.join("/")}f=g>=0?t[g]:"/"}let m=nO(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var za=e=>e.join("/").replace(/\/\/+/g,"/"),aO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),iO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,lO=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 oO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function uO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Yj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xj(e,t){let n=e;if(typeof n!="string"||!tO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Yj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=ci(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{sa(!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 Wj=["POST","PUT","PATCH","DELETE"];new Set(Wj);var cO=["GET",...Wj];new Set(cO);var No=b.createContext(null);No.displayName="DataRouter";var ih=b.createContext(null);ih.displayName="DataRouterState";var dO=b.createContext(!1),Jj=b.createContext({isTransitioning:!1});Jj.displayName="ViewTransition";var fO=b.createContext(new Map);fO.displayName="Fetchers";var hO=b.createContext(null);hO.displayName="Await";var Hr=b.createContext(null);Hr.displayName="Navigation";var Tc=b.createContext(null);Tc.displayName="Location";var oa=b.createContext({outlet:null,matches:[],isDataRoute:!1});oa.displayName="Route";var mv=b.createContext(null);mv.displayName="RouteError";var eE="REACT_ROUTER_ERROR",mO="REDIRECT",pO="ROUTE_ERROR_RESPONSE";function gO(e){if(e.startsWith(`${eE}:${mO}:{`))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 yO(e){if(e.startsWith(`${eE}:${pO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new lO(t.status,t.statusText,t.data)}catch{}}function vO(e,{relative:t}={}){Kt(_o(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Hr),{hash:s,pathname:o,search:c}=Ac(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:za([n,o])),a.createHref({pathname:f,search:c,hash:s})}function _o(){return b.useContext(Tc)!=null}function Cr(){return Kt(_o(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Tc).location}var tE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nE(e){b.useContext(Hr).static||b.useLayoutEffect(e)}function Rn(){let{isDataRoute:e}=b.useContext(oa);return e?zO():bO()}function bO(){Kt(_o(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(No),{basename:t,navigator:n}=b.useContext(Hr),{matches:a}=b.useContext(oa),{pathname:s}=Cr(),o=JSON.stringify(hv(a)),c=b.useRef(!1);return nE(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(sa(c.current,tE),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=ah(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:za([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var xO=b.createContext(null);function wO(e){let t=b.useContext(oa).outlet;return b.useMemo(()=>t&&b.createElement(xO.Provider,{value:e},t),[t,e])}function rE(){let{matches:e}=b.useContext(oa),t=e[e.length-1];return t?t.params:{}}function Ac(e,{relative:t}={}){let{matches:n}=b.useContext(oa),{pathname:a}=Cr(),s=JSON.stringify(hv(n));return b.useMemo(()=>ah(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function SO(e,t){return aE(e,t)}function aE(e,t,n){var S;Kt(_o(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Hr),{matches:s}=b.useContext(oa),o=s[s.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";sE(f,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let p=Cr(),g;if(t){let C=typeof t=="string"?Co(t):t;Kt(m==="/"||((S=C.pathname)==null?void 0:S.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",w=x;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=Vj(e,{pathname:w});sa(h||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),sa(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=NO(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:za([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:za([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&j?b.createElement(Tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function kO(){let e=OO(),t=oO(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,c)}var jO=b.createElement(kO,null),iE=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=yO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(oa.Provider,{value:this.props.routeContext},b.createElement(mv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(EO,{error:e},t):t}};iE.contextType=dO;var Jp=new WeakMap;function EO({children:e,error:t}){let{basename:n}=b.useContext(Hr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=gO(t.digest);if(a){let s=Jp.get(t);if(s)throw s;let o=Xj(a.location,n);if(Yj&&!Jp.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Jp.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function CO({routeContext:e,match:t,children:n}){let a=b.useContext(No);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(oa.Provider,{value:e},n)}function NO(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Kt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:x,errors:w}=a,k=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||k){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(p,g)=>{var x,w;m(p,{location:a.location,params:((w=(x=a.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:uO(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,x)=>{let w,k=!1,j=null,S=null;a&&(w=o&&g.route.id?o[g.route.id]:void 0,j=g.route.errorElement||jO,c&&(f<0&&x===0?(sE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,S=null):f===x&&(k=!0,S=g.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,x+1)),_=()=>{let R;return w?R=j:k?R=S:g.route.Component?R=b.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=p,b.createElement(CO,{match:g,routeContext:{outlet:p,matches:C,isDataRoute:a!=null},children:R})};return a&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?b.createElement(iE,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:_(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):_()},null)}function pv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _O(e){let t=b.useContext(No);return Kt(t,pv(e)),t}function TO(e){let t=b.useContext(ih);return Kt(t,pv(e)),t}function AO(e){let t=b.useContext(oa);return Kt(t,pv(e)),t}function gv(e){let t=AO(e),n=t.matches[t.matches.length-1];return Kt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function RO(){return gv("useRouteId")}function OO(){var a;let e=b.useContext(mv),t=TO("useRouteError"),n=gv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function zO(){let{router:e}=_O("useNavigate"),t=gv("useNavigate"),n=b.useRef(!1);return nE(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{sa(n.current,tE),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var QS={};function sE(e,t,n){!t&&!QS[e]&&(QS[e]=!0,sa(!1,n))}b.memo(MO);function MO({routes:e,future:t,state:n,isStatic:a,onError:s}){return aE(e,void 0,{state:n,isStatic:a,onError:s})}function or({to:e,replace:t,state:n,relative:a}){Kt(_o(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Hr);sa(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=b.useContext(oa),{pathname:c}=Cr(),f=Rn(),m=ah(e,hv(o),c,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Pf(e){return wO(e.context)}function It(e){Kt(!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 DO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Kt(!_o(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[f,s,o,c]);typeof n=="string"&&(n=Co(n));let{pathname:h="/",search:p="",hash:g="",state:x=null,key:w="default",unstable_mask:k}=n,j=b.useMemo(()=>{let S=ci(h,f);return S==null?null:{location:{pathname:S,search:p,hash:g,state:x,key:w,unstable_mask:k},navigationType:a}},[f,h,p,g,x,w,a,k]);return sa(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:b.createElement(Hr.Provider,{value:m},b.createElement(Tc.Provider,{children:t,value:j}))}function IO({children:e,location:t}){return SO(py(e),t)}function py(e,t=[]){let n=[];return b.Children.forEach(e,(a,s)=>{if(!b.isValidElement(a))return;let o=[...t,s];if(a.type===b.Fragment){n.push.apply(n,py(a.props.children,o));return}Kt(a.type===It,`[${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>`),Kt(!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=py(a.props.children,o)),n.push(c)}),n}var _f="get",Tf="application/x-www-form-urlencoded";function sh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function LO(e){return sh(e)&&e.tagName.toLowerCase()==="button"}function PO(e){return sh(e)&&e.tagName.toLowerCase()==="form"}function UO(e){return sh(e)&&e.tagName.toLowerCase()==="input"}function BO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function FO(e,t){return e.button===0&&(!t||t==="_self")&&!BO(e)}function gy(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 $O(e,t){let n=gy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var sf=null;function HO(){if(sf===null)try{new FormData(document.createElement("form"),0),sf=!1}catch{sf=!0}return sf}var qO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function eg(e){return e!=null&&!qO.has(e)?(sa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tf}"`),null):e}function ZO(e,t){let n,a,s,o,c;if(PO(e)){let f=e.getAttribute("action");a=f?ci(f,t):null,n=e.getAttribute("method")||_f,s=eg(e.getAttribute("enctype"))||Tf,o=new FormData(e)}else if(LO(e)||UO(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?ci(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||_f,s=eg(e.getAttribute("formenctype"))||eg(f.getAttribute("enctype"))||Tf,o=new FormData(f,e),!HO()){let{name:h,type:p,value:g}=e;if(p==="image"){let x=h?`${h}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else h&&o.append(h,g)}}else{if(sh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_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 yv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function GO(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&&ci(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function VO(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 QO(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 KO(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await VO(o,n);return c.links?c.links():[]}return[]}));return JO(a.flat(1).filter(QO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function KS(e,t,n,a,s,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var p;return n[h].pathname!==m.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var g;let p=a.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function YO(e,t,{includeHydrateFallback:n}={}){return XO(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 XO(e){return[...new Set(e)]}function WO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function JO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(WO(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function lE(){let e=b.useContext(No);return yv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ez(){let e=b.useContext(ih);return yv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var vv=b.createContext(void 0);vv.displayName="FrameworkContext";function oE(){let e=b.useContext(vv);return yv(e,"You must render this element inside a <HydratedRouter> element"),e}function tz(e,t){let n=b.useContext(vv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,x=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=C=>{C.forEach(_=>{c(_.isIntersecting)})},S=new IntersectionObserver(j,{threshold:.5});return x.current&&S.observe(x.current),()=>{S.disconnect()}}},[e]),b.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{s(!0)},k=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,x,{}]:[o,x,{onFocus:Ru(f,w),onBlur:Ru(m,k),onMouseEnter:Ru(h,w),onMouseLeave:Ru(p,k),onTouchStart:Ru(g,w)}]:[!1,x,{}]}function Ru(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function nz({page:e,...t}){let{router:n}=lE(),a=b.useMemo(()=>Vj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(az,{page:e,matches:a,...t}):null}function rz(e){let{manifest:t,routeModules:n}=oE(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return KO(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function az({page:e,matches:t,...n}){let a=Cr(),{future:s,manifest:o,routeModules:c}=oE(),{basename:f}=lE(),{loaderData:m,matches:h}=ez(),p=b.useMemo(()=>KS(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>KS(e,t,h,o,a,"assets"),[e,t,h,o,a]),x=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,S=!1;if(t.forEach(_=>{var z;let R=o.routes[_.route.id];!R||!R.hasLoader||(!p.some(P=>P.route.id===_.route.id)&&_.route.id in m&&((z=c[_.route.id])!=null&&z.shouldRevalidate)||R.hasClientLoader?S=!0:j.add(_.route.id))}),j.size===0)return[];let C=GO(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return S&&j.size>0&&C.searchParams.set("_routes",t.filter(_=>j.has(_.route.id)).map(_=>_.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),w=b.useMemo(()=>YO(g,o),[g,o]),k=rz(g);return b.createElement(b.Fragment,null,x.map(j=>b.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),w.map(j=>b.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:S})=>b.createElement("link",{key:j,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function iz(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var sz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{sz&&(window.__reactRouterVersion="7.13.1")}catch{}function lz({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=PR({window:a,v5Compat:!0}));let o=s.current,[c,f]=b.useState({action:o.action,location:o.location}),m=b.useCallback(h=>{n===!1?f(h):b.startTransition(()=>f(h))},[n]);return b.useLayoutEffect(()=>o.listen(m),[o,m]),b.createElement(DO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var uE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...k},j){let{basename:S,navigator:C,unstable_useTransitions:_}=b.useContext(Hr),R=typeof p=="string"&&uE.test(p),z=Xj(p,S);p=z.to;let P=vO(p,{relative:s}),O=Cr(),L=null;if(f){let W=ah(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);S!=="/"&&(W.pathname=W.pathname==="/"?S:za([S,W.pathname])),L=C.createHref(W)}let[I,K,D]=tz(a,k),Y=cz(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:_});function se(W){t&&t(W),W.defaultPrevented||Y(W)}let xe=!(z.isExternal||o),J=b.createElement("a",{...k,...D,href:(xe?L:void 0)||z.absoluteURL||P,onClick:xe?se:t,ref:iz(j,K),target:h,"data-discover":!R&&n==="render"?"true":void 0});return I&&!R?b.createElement(b.Fragment,null,J,b.createElement(nz,{page:P})):J});Rc.displayName="Link";var bv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},p){let g=Ac(c,{relative:h.relative}),x=Cr(),w=b.useContext(ih),{navigator:k,basename:j}=b.useContext(Hr),S=w!=null&&pz(g)&&f===!0,C=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,_=x.pathname,R=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(_=_.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&j&&(R=ci(R,j)||R);const z=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let P=_===C||!s&&_.startsWith(C)&&_.charAt(z)==="/",O=R!=null&&(R===C||!s&&R.startsWith(C)&&R.charAt(C.length)==="/"),L={isActive:P,isPending:O,isTransitioning:S},I=P?t:void 0,K;typeof a=="function"?K=a(L):K=[a,P?"active":null,O?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(L):o;return b.createElement(Rc,{...h,"aria-current":I,className:K,ref:p,style:D,to:c,viewTransition:f},typeof m=="function"?m(L):m)});bv.displayName="NavLink";var oz=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=_f,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},k)=>{let{unstable_useTransitions:j}=b.useContext(Hr),S=hz(),C=mz(f,{relative:h}),_=c.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&uE.test(f),z=P=>{if(m&&m(P),P.defaultPrevented)return;P.preventDefault();let O=P.nativeEvent.submitter,L=(O==null?void 0:O.getAttribute("formmethod"))||c,I=()=>S(O||P.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});j&&n!==!1?b.startTransition(()=>I()):I()};return b.createElement("form",{ref:k,method:_,action:C,onSubmit:a?m:z,...w,"data-discover":!R&&e==="render"?"true":void 0})});oz.displayName="Form";function uz(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cE(e){let t=b.useContext(No);return Kt(t,uz(e)),t}function cz(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=Rn(),g=Cr(),x=Ac(e,{relative:c});return b.useCallback(w=>{if(FO(w,t)){w.preventDefault();let k=n!==void 0?n:lc(g)===lc(x),j=()=>p(e,{replace:k,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>j()):j()}},[g,p,x,n,a,s,t,e,o,c,f,m,h])}function lh(e){sa(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(gy(e)),n=b.useRef(!1),a=Cr(),s=b.useMemo(()=>$O(a.search,n.current?null:t.current),[a.search]),o=Rn(),c=b.useCallback((f,m)=>{const h=gy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var dz=0,fz=()=>`__${String(++dz)}__`;function hz(){let{router:e}=cE("useSubmit"),{basename:t}=b.useContext(Hr),n=RO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=ZO(o,t);if(c.navigate===!1){let x=c.fetcherKey||fz();await a(x,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function mz(e,{relative:t}={}){let{basename:n}=b.useContext(Hr),a=b.useContext(oa);Kt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Ac(e||".",{relative:t})},c=Cr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:za([n,o.pathname])),lc(o)}function pz(e,{relative:t}={}){let n=b.useContext(Jj);Kt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=cE("useViewTransitionState"),s=Ac(e,{relative:t});if(!n.isTransitioning)return!1;let o=ci(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=ci(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Lf(s.pathname,c)!=null||Lf(s.pathname,o)!=null}const gz="/api/v1";async function yz(e,t){const n=await fetch(`${gz}/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 dE="/api/v1",xv="first-tree-hub:tokens";let yy=null;function Ou(e){yy=e}function Nn(e){if(!yy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(yy)}${e}`}function vy(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function oh(){const e=localStorage.getItem(xv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function by(e){localStorage.setItem(xv,JSON.stringify(e))}function fE(){localStorage.removeItem(xv)}class Js extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let zu=null;async function vz(){const e=oh();return e!=null&&e.refreshToken?hE(e.refreshToken):null}async function hE(e){return zu||(zu=(async()=>{try{const t=await fetch(`${dE}/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 by(a),a}catch{return null}finally{zu=null}})(),zu)}async function Mu(e,t){const{method:n="GET",body:a}=t??{},s=f=>{const m={};return f&&(m.Authorization=`Bearer ${f}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${dE}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=oh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await hE(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(fE(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const p=JSON.parse(f);m=p.error??f,Array.isArray(p.details)&&(h=p.details.filter(g=>typeof g=="object"&&g!==null&&Array.isArray(g.path)))}catch{m=f}throw new Js(c.status,m,h)}if(c.status!==204)return await c.json()}const Ee={get:e=>Mu(e),post:(e,t)=>Mu(e,{method:"POST",body:t}),patch:(e,t)=>Mu(e,{method:"PATCH",body:t}),put:(e,t)=>Mu(e,{method:"PUT",body:t}),delete:e=>Mu(e,{method:"DELETE"})},wv="onboarding:joinPath",bz="onboarding:draft",xy="onboarding:step1Confirmed";function mE(){return typeof window>"u"?!1:window.sessionStorage.getItem(xy)==="1"}function xz(e){typeof window>"u"||(e?window.sessionStorage.setItem(xy,"1"):window.sessionStorage.removeItem(xy))}const wy="onboarding:agentUuid";function wz(){return typeof window>"u"?null:window.sessionStorage.getItem(wy)}function Sz(e){typeof window>"u"||(e?window.sessionStorage.setItem(wy,e):window.sessionStorage.removeItem(wy))}function pE(e){typeof window>"u"||window.sessionStorage.setItem(wv,e)}function gE(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(wv);return e==="solo"||e==="invite"?e:null}function kz(){typeof window>"u"||window.sessionStorage.removeItem(wv)}function jz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function Sv(e){return`${bz}:${e}`}function Ez(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 Cz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(Sv(e));if(!t)return null;try{return Ez(JSON.parse(t))}catch{return null}}function Nz(e,t){typeof window>"u"||window.sessionStorage.setItem(Sv(e),JSON.stringify(t))}function _z(e){typeof window>"u"||window.sessionStorage.removeItem(Sv(e))}function Tz(){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 yE=b.createContext(null),Sy="first-tree-hub:selectedOrganizationId";function Az(){try{return localStorage.getItem(Sy)}catch{return null}}function tg(e){try{e===null?localStorage.removeItem(Sy):localStorage.setItem(Sy,e)}catch{}}function Rz({children:e}){const t=gn(),[n,a]=b.useState(()=>!!oh()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const K=Az();return Ou(K),K}),[p,g]=b.useState(null),[x,w]=b.useState(null),[k,j]=b.useState(!1),S=b.useCallback(()=>{fE(),tg(null),Ou(null),t.clear(),Tz(),a(!1),o(null),f([]),h(null),g(null),w(null),j(!1)},[t]),C=b.useCallback(async()=>{var K,D;try{const Y=await Ee.get("/me");o(Y.user??null);const se=Y.memberships??[];f(se);const xe=((K=Y.onboarding)==null?void 0:K.step)??null;g(xe),w(((D=Y.onboarding)==null?void 0:D.dismissedAt)??null),xe==="completed"&&kz(),h(J=>{var ne;const W=J&&se.some(ke=>ke.organizationId===J)?J:null;if(W)return Ou(W),W;const Z=Y.defaultOrganizationId??((ne=se[0])==null?void 0:ne.organizationId)??null;return tg(Z),Ou(Z),Z})}catch{}finally{j(!0)}},[]),_=b.useCallback(async(K,D)=>{const Y=await yz(K,D);by({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await C()},[C]),R=b.useCallback(async K=>{by(K),a(!0),await C()},[C]),z=b.useCallback(async K=>{tg(K),Ou(K),t.clear(),h(K),await C()},[C,t]),P=b.useRef(null);b.useEffect(()=>{P.current=x},[x]);const O=b.useCallback(async()=>{const K=P.current;w(new Date().toISOString());try{const D=await Ee.patch("/me/onboarding",{dismissed:!0});D!=null&&D.dismissedAt&&w(D.dismissedAt)}catch{w(K)}},[]),L=b.useCallback(async()=>{const K=P.current;w(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{w(K)}},[]);b.useEffect(()=>{n&&!s&&C()},[n,s,C]),b.useEffect(()=>{const K=()=>S();return window.addEventListener("auth:logout",K),()=>window.removeEventListener("auth:logout",K)},[S]);const I=b.useMemo(()=>c.length===0?null:c.find(D=>D.organizationId===m)??c[0]??null,[c,m]);return l.jsx(yE.Provider,{value:{isAuthenticated:n,meLoaded:k,user:s,memberships:c,currentMembership:I,organizationId:(I==null?void 0:I.organizationId)??null,memberId:(I==null?void 0:I.id)??null,role:(I==null?void 0:I.role)??null,agentId:(I==null?void 0:I.agentId)??null,onboardingStep:p,onboardingDismissedAt:x,dismissOnboarding:O,restoreOnboarding:L,login:_,adoptTokens:R,selectOrganization:z,refreshMe:C,logout:S},children:e})}function vt(){const e=b.useContext(yE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Oz="modulepreload",zz=function(e){return"/"+e},YS={},Mz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=c(n.map(h=>{if(h=zz(h),h in YS)return;YS[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":Oz,p||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),p)return new Promise((w,k)=>{x.addEventListener("load",w),x.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return s.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},Dz=b.lazy(()=>Mz(()=>import("./index-B7FIVwrn.js"),[]).then(e=>({default:e.LandingPage}))),XS=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function Iz(){const{isAuthenticated:e,meLoaded:t}=vt(),n=Cr();return e?t?l.jsx(Pf,{}):l.jsx(XS,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(XS,{}),children:l.jsx(Dz,{})}):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 vE=(...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 Lz=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 Pz=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 WS=e=>{const t=Pz(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 Uz={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 Bz=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 Fz=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...f},m)=>b.createElement("svg",{ref:m,...Uz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:vE("lucide",s),...!o&&!Bz(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,p])=>b.createElement(h,p)),...Array.isArray(o)?o:[o]]));/**
96
- * @license lucide-react v0.577.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const et=(e,t)=>{const n=b.forwardRef(({className:a,...s},o)=>b.createElement(Fz,{ref:o,iconNode:t,className:vE(`lucide-${Lz(WS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=WS(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 $z=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],kv=et("arrow-left",$z);/**
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 Hz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],bE=et("arrow-right",Hz);/**
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 qz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xE=et("arrow-up",qz);/**
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 Zz=[["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"}]],Gz=et("at-sign",Zz);/**
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 Vz=[["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"}]],Qz=et("bell",Vz);/**
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 Kz=[["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"}]],wE=et("bot",Kz);/**
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 Yz=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Xz=et("building-2",Yz);/**
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 Wz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=et("check",Wz);/**
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 Jz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],jv=et("chevron-down",Jz);/**
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 eM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],SE=et("chevron-right",eM);/**
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 tM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],nM=et("circle-check",tM);/**
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 rM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],aM=et("circle-pause",rM);/**
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 iM=[["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"}]],Ev=et("copy",iM);/**
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 sM=[["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"}]],lM=et("ellipsis",sM);/**
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 oM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Cv=et("external-link",oM);/**
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 uM=[["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"}]],cM=et("eye-off",uM);/**
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 dM=[["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"}]],kE=et("eye",dM);/**
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 fM=[["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"}]],hM=et("folder-tree",fM);/**
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 mM=[["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"}]],jE=et("github",mM);/**
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 pM=[["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"}]],gM=et("layout-dashboard",pM);/**
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 yM=[["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"}]],ky=et("link-2",yM);/**
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 vM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],EE=et("loader-circle",vM);/**
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 bM=[["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"}]],uh=et("lock",bM);/**
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 xM=[["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"}]],wM=et("log-out",xM);/**
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 SM=[["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"}]],Nv=et("message-square",SM);/**
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 kM=[["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"}]],jM=et("moon",kM);/**
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 EM=[["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"}]],CM=et("paperclip",EM);/**
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 NM=[["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"}]],_v=et("pencil",NM);/**
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 _M=[["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"}]],CE=et("play",_M);/**
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 TM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],wa=et("plus",TM);/**
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 AM=[["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"}]],RM=et("refresh-cw",AM);/**
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 OM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Tv=et("search",OM);/**
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 zM=[["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"}]],MM=et("sun",zM);/**
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 DM=[["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=et("trash-2",DM);/**
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 IM=[["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"}]],To=et("triangle-alert",IM);/**
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 LM=[["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"}]],PM=et("undo-2",LM);/**
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 UM=[["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"}]],NE=et("user-plus",UM);/**
286
- * @license lucide-react v0.577.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */const BM=[["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"}]],_E=et("user",BM);/**
291
- * @license lucide-react v0.577.0 - ISC
292
- *
293
- * This source code is licensed under the ISC license.
294
- * See the LICENSE file in the root directory of this source tree.
295
- */const FM=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],$M=et("users",FM);/**
296
- * @license lucide-react v0.577.0 - ISC
297
- *
298
- * This source code is licensed under the ISC license.
299
- * See the LICENSE file in the root directory of this source tree.
300
- */const HM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],os=et("x",HM);/**
301
- * @license lucide-react v0.577.0 - ISC
302
- *
303
- * This source code is licensed under the ISC license.
304
- * See the LICENSE file in the root directory of this source tree.
305
- */const qM=[["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"}]],ZM=et("zap",qM);function TE(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=TE(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function AE(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=TE(e))&&(a&&(a+=" "),a+=t);return a}const GM=(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},VM=(e,t)=>({classGroupId:e,validator:t}),RE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bf="-",JS=[],QM="arbitrary..",KM=e=>{const t=XM(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return YM(c);const f=c.split(Bf),m=f[0]===""&&f.length>1?1:0;return OE(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?GM(h,m):m:h||JS}return n[c]||JS}}},OE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=OE(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Bf):e.slice(t).join(Bf),m=c.length;for(let h=0;h<m;h++){const p=c[h];if(p.validator(f))return p.classGroupId}},YM=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?QM+a:void 0})(),XM=e=>{const{theme:t,classGroups:n}=e;return WM(n,t)},WM=(e,t)=>{const n=RE();for(const a in e){const s=e[a];Av(s,n,a,t)}return n},Av=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];JM(c,t,n,a)}},JM=(e,t,n,a)=>{if(typeof e=="string"){eD(e,t,n);return}if(typeof e=="function"){tD(e,t,n,a);return}nD(e,t,n,a)},eD=(e,t,n)=>{const a=e===""?t:zE(t,e);a.classGroupId=n},tD=(e,t,n,a)=>{if(rD(e)){Av(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(VM(n,e))},nD=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];Av(m,zE(t,f),n,a)}},zE=(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 f=n.nextPart.get(c);f||(f=RE(),n.nextPart.set(c,f)),n=f}return n},rD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,aD=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)}}},jy="!",e1=":",iD=[],t1=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),sD=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const p=s.length;for(let j=0;j<p;j++){const S=s[j];if(c===0&&f===0){if(S===e1){o.push(s.slice(m,j)),m=j+1;continue}if(S==="/"){h=j;continue}}S==="["?c++:S==="]"?c--:S==="("?f++:S===")"&&f--}const g=o.length===0?s:s.slice(m);let x=g,w=!1;g.endsWith(jy)?(x=g.slice(0,-1),w=!0):g.startsWith(jy)&&(x=g.slice(1),w=!0);const k=h&&h>m?h-m:void 0;return t1(o,w,x,k)};if(t){const s=t+e1,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):t1(iD,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},lD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",m=t.has(c);f||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(c)):s.push(c)}return s.length>0&&(s.sort(),a.push(...s)),a}},oD=e=>({cache:aD(e.cacheSize),parseClassName:sD(e),sortModifiers:lD(e),...KM(e)}),uD=/\s+/,cD=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(uD);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:x,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:j}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let S=!!j,C=a(S?k.substring(0,j):k);if(!C){if(!S){m=p+(m.length>0?" "+m:m);continue}if(C=a(k),!C){m=p+(m.length>0?" "+m:m);continue}S=!1}const _=x.length===0?"":x.length===1?x[0]:o(x).join(":"),R=w?_+jy:_,z=R+C;if(c.indexOf(z)>-1)continue;c.push(z);const P=s(C,S);for(let O=0;O<P.length;++O){const L=P[O];c.push(R+L)}m=p+(m.length>0?" "+m:m)}return m},dD=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=ME(n))&&(s&&(s+=" "),s+=a);return s},ME=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=ME(e[a]))&&(n&&(n+=" "),n+=t);return n},fD=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=oD(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const p=cD(m,n);return s(m,p),p};return o=c,(...m)=>o(dD(...m))},hD=[],An=e=>{const t=n=>n[e]||hD;return t.isThemeGetter=!0,t},DE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,IE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gD=/\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$/,yD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Hi=e=>mD.test(e),rt=e=>!!e&&!Number.isNaN(Number(e)),qi=e=>!!e&&Number.isInteger(Number(e)),ng=e=>e.endsWith("%")&&rt(e.slice(0,-1)),ni=e=>pD.test(e),LE=()=>!0,xD=e=>gD.test(e)&&!yD.test(e),Rv=()=>!1,wD=e=>vD.test(e),SD=e=>bD.test(e),kD=e=>!Re(e)&&!Oe(e),jD=e=>hs(e,BE,Rv),Re=e=>DE.test(e),Ms=e=>hs(e,FE,xD),n1=e=>hs(e,OD,rt),ED=e=>hs(e,HE,LE),CD=e=>hs(e,$E,Rv),r1=e=>hs(e,PE,Rv),ND=e=>hs(e,UE,SD),lf=e=>hs(e,qE,wD),Oe=e=>IE.test(e),Du=e=>el(e,FE),_D=e=>el(e,$E),a1=e=>el(e,PE),TD=e=>el(e,BE),AD=e=>el(e,UE),of=e=>el(e,qE,!0),RD=e=>el(e,HE,!0),hs=(e,t,n)=>{const a=DE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},el=(e,t,n=!1)=>{const a=IE.exec(e);return a?a[1]?t(a[1]):n:!1},PE=e=>e==="position"||e==="percentage",UE=e=>e==="image"||e==="url",BE=e=>e==="length"||e==="size"||e==="bg-size",FE=e=>e==="length",OD=e=>e==="number",$E=e=>e==="family-name",HE=e=>e==="number"||e==="weight",qE=e=>e==="shadow",zD=()=>{const e=An("color"),t=An("font"),n=An("text"),a=An("font-weight"),s=An("tracking"),o=An("leading"),c=An("breakpoint"),f=An("container"),m=An("spacing"),h=An("radius"),p=An("shadow"),g=An("inset-shadow"),x=An("text-shadow"),w=An("drop-shadow"),k=An("blur"),j=An("perspective"),S=An("aspect"),C=An("ease"),_=An("animate"),R=()=>["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"],P=()=>[...z(),Oe,Re],O=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[Oe,Re,m],K=()=>[Hi,"full","auto",...I()],D=()=>[qi,"none","subgrid",Oe,Re],Y=()=>["auto",{span:["full",qi,Oe,Re]},qi,Oe,Re],se=()=>[qi,"auto",Oe,Re],xe=()=>["auto","min","max","fr",Oe,Re],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...I()],ne=()=>[Hi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ke=()=>[Hi,"screen","full","dvw","lvw","svw","min","max","fit",...I()],Ae=()=>[Hi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],M=()=>[e,Oe,Re],U=()=>[...z(),a1,r1,{position:[Oe,Re]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",TD,jD,{size:[Oe,Re]}],G=()=>[ng,Du,Ms],q=()=>["","none","full",h,Oe,Re],ie=()=>["",rt,Du,Ms],ve=()=>["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"],me=()=>[rt,ng,a1,r1],Me=()=>["","none",k,Oe,Re],Ie=()=>["none",rt,Oe,Re],St=()=>["none",rt,Oe,Re],tt=()=>[rt,Oe,Re],it=()=>[Hi,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ni],breakpoint:[ni],color:[LE],container:[ni],"drop-shadow":[ni],ease:["in","out","in-out"],font:[kD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ni],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ni],shadow:[ni],spacing:["px",rt],text:[ni],"text-shadow":[ni],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Hi,Re,Oe,S]}],container:["container"],columns:[{columns:[rt,Re,Oe,f]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:P()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[qi,"auto",Oe,Re]}],basis:[{basis:[Hi,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,Hi,"auto","initial","none",Re]}],grow:[{grow:["",rt,Oe,Re]}],shrink:[{shrink:["",rt,Oe,Re]}],order:[{order:[qi,"first","last","none",Oe,Re]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":xe()}],"auto-rows":[{"auto-rows":xe()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...ke()]}],"min-inline-size":[{"min-inline":["auto",...ke()]}],"max-inline-size":[{"max-inline":["none",...ke()]}],"block-size":[{block:["auto",...Ae()]}],"min-block-size":[{"min-block":["auto",...Ae()]}],"max-block-size":[{"max-block":["none",...Ae()]}],w:[{w:[f,"screen",...ne()]}],"min-w":[{"min-w":[f,"screen","none",...ne()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",n,Du,Ms]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,RD,ED]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ng,Re]}],"font-family":[{font:[_D,CD,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":[rt,"none",Oe,n1]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",Oe,Re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,Re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",Oe,Ms]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[rt,"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:I()}],"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:U()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qi,Oe,Re],radial:["",Oe,Re],conic:[qi,Oe,Re]},AD,ND]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,Oe,Re]}],"outline-w":[{outline:["",rt,Du,Ms]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,of,lf]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,of,lf]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[rt,Ms]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",x,of,lf]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[rt,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":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Oe,Re]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,Re]}],filter:[{filter:["","none",Oe,Re]}],blur:[{blur:Me()}],brightness:[{brightness:[rt,Oe,Re]}],contrast:[{contrast:[rt,Oe,Re]}],"drop-shadow":[{"drop-shadow":["","none",w,of,lf]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",rt,Oe,Re]}],"hue-rotate":[{"hue-rotate":[rt,Oe,Re]}],invert:[{invert:["",rt,Oe,Re]}],saturate:[{saturate:[rt,Oe,Re]}],sepia:[{sepia:["",rt,Oe,Re]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,Re]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[rt,Oe,Re]}],"backdrop-contrast":[{"backdrop-contrast":[rt,Oe,Re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,Oe,Re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,Oe,Re]}],"backdrop-invert":[{"backdrop-invert":["",rt,Oe,Re]}],"backdrop-opacity":[{"backdrop-opacity":[rt,Oe,Re]}],"backdrop-saturate":[{"backdrop-saturate":[rt,Oe,Re]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,Oe,Re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"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:[rt,"initial",Oe,Re]}],ease:[{ease:["linear","initial",C,Oe,Re]}],delay:[{delay:[rt,Oe,Re]}],animate:[{animate:["none",_,Oe,Re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Oe,Re]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:St()}],"scale-x":[{"scale-x":St()}],"scale-y":[{"scale-y":St()}],"scale-z":[{"scale-z":St()}],"scale-3d":["scale-3d"],skew:[{skew:tt()}],"skew-x":[{"skew-x":tt()}],"skew-y":[{"skew-y":tt()}],transform:[{transform:[Oe,Re,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,Re]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,Re]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[rt,Du,Ms,n1]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},MD=fD(zD);function ze(...e){return MD(AE(e))}function oc(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 ZE(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(Nn("/activity"))}function di(){return Ee.get("/me/clients")}function ch(e){return Ee.get(`/clients/${e}`)}function ID(e){return Ee.post(`/clients/${e}/disconnect`)}function LD(){return Ee.post("/me/connect-tokens")}const i1=e=>["agent-sessions",e];function PD(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 UD(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 BD(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function GE(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 FD(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 s1=1,$D=.9,HD=.8,qD=.17,rg=.1,ag=.999,ZD=.9999,GD=.99,VD=/[\\\/_+.#"@\[\(\{&]/,QD=/[\\\/_+.#"@\[\(\{&]/g,KD=/[\s-]/,VE=/[\s-]/g;function Ey(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?s1:GD;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,x,w,k;h>=0;)g=Ey(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=s1:VD.test(e.charAt(h-1))?(g*=HD,w=e.slice(s,h-1).match(QD),w&&s>0&&(g*=Math.pow(ag,w.length))):KD.test(e.charAt(h-1))?(g*=$D,k=e.slice(s,h-1).match(VE),k&&s>0&&(g*=Math.pow(ag,k.length))):(g*=qD,s>0&&(g*=Math.pow(ag,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=ZD)),(g<rg&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(x=Ey(e,t,n,a,h+1,o+2,c),x*rg>g&&(g=x*rg)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function l1(e){return e.toLowerCase().replace(VE," ")}function YD(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ey(e,t,l1(e),l1(t),0,0,{})}function ss(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 o1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function us(...e){return t=>{let n=!1;const a=e.map(s=>{const o=o1(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():o1(e[s],null)}}}}function tl(...e){return b.useCallback(us(...e),e)}function XD(e,t){const n=b.createContext(t),a=o=>{const{children:c,...f}=o,m=b.useMemo(()=>f,Object.values(f));return l.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=b.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,s]}function WD(e,t=[]){let n=[];function a(o,c){const f=b.createContext(c),m=n.length;n=[...n,c];const h=g=>{var C;const{scope:x,children:w,...k}=g,j=((C=x==null?void 0:x[e])==null?void 0:C[m])||f,S=b.useMemo(()=>k,Object.values(k));return l.jsx(j.Provider,{value:S,children:w})};h.displayName=o+"Provider";function p(g,x){var j;const w=((j=x==null?void 0:x[e])==null?void 0:j[m])||f,k=b.useContext(w);if(k)return k;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(c=>b.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,JD(s,...t)]}function JD(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const g=m(o)[`__scope${h}`];return{...f,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var uc=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},e3=iv[" useId ".trim().toString()]||(()=>{}),t3=0;function oi(e){const[t,n]=b.useState(e3());return uc(()=>{n(a=>a??String(t3++))},[e]),t?`radix-${t}`:""}var n3=iv[" useInsertionEffect ".trim().toString()]||uc;function r3({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=a3({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const g=p.current;g!==f&&console.warn(`${a} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=f},[f,a])}const h=b.useCallback(p=>{var g;if(f){const x=i3(p)?p(e):p;x!==e&&((g=c.current)==null||g.call(c,x))}else o(p)},[f,e,o,c]);return[m,h]}function a3({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return n3(()=>{o.current=t},[t]),b.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function i3(e){return typeof e=="function"}var Ov=Tj();const s3=rh(Ov);function QE(e){const t=l3(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find(u3);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function l3(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=d3(s),f=c3(o,s.props);return s.type!==b.Fragment&&(f.ref=a?us(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var o3=Symbol("radix.slottable");function u3(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===o3}function c3(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function d3(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 f3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hi=f3.reduce((e,t)=>{const n=QE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function h3(e,t){e&&Ov.flushSync(()=>e.dispatchEvent(t))}function cc(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function m3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e);b.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var p3="DismissableLayer",Cy="dismissableLayer.update",g3="dismissableLayer.pointerDownOutside",y3="dismissableLayer.focusOutside",u1,KE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),YE=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(KE),[p,g]=b.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=b.useState({}),k=tl(t,L=>g(L)),j=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(S),_=p?j.indexOf(p):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,z=_>=C,P=x3(L=>{const I=L.target,K=[...h.branches].some(D=>D.contains(I));!z||K||(s==null||s(L),c==null||c(L),L.defaultPrevented||f==null||f())},x),O=w3(L=>{const I=L.target;[...h.branches].some(D=>D.contains(I))||(o==null||o(L),c==null||c(L),L.defaultPrevented||f==null||f())},x);return m3(L=>{_===h.layers.size-1&&(a==null||a(L),!L.defaultPrevented&&f&&(L.preventDefault(),f()))},x),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(u1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),c1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=u1)}},[p,x,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),c1())},[p,h]),b.useEffect(()=>{const L=()=>w({});return document.addEventListener(Cy,L),()=>document.removeEventListener(Cy,L)},[]),l.jsx(hi.div,{...m,ref:k,style:{pointerEvents:R?z?"auto":"none":void 0,...e.style},onFocusCapture:ss(e.onFocusCapture,O.onFocusCapture),onBlurCapture:ss(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ss(e.onPointerDownCapture,P.onPointerDownCapture)})});YE.displayName=p3;var v3="DismissableLayerBranch",b3=b.forwardRef((e,t)=>{const n=b.useContext(KE),a=b.useRef(null),s=tl(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(hi.div,{...e,ref:s})});b3.displayName=v3;function x3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){XE(g3,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function w3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&XE(y3,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 c1(){const e=new CustomEvent(Cy);document.dispatchEvent(e)}function XE(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?h3(s,o):s.dispatchEvent(o)}var ig="focusScope.autoFocusOnMount",sg="focusScope.autoFocusOnUnmount",d1={bubbles:!1,cancelable:!0},S3="FocusScope",WE=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=b.useState(null),h=cc(s),p=cc(o),g=b.useRef(null),x=tl(t,j=>m(j)),w=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let j=function(R){if(w.paused||!f)return;const z=R.target;f.contains(z)?g.current=z:Vi(g.current,{select:!0})},S=function(R){if(w.paused||!f)return;const z=R.relatedTarget;z!==null&&(f.contains(z)||Vi(g.current,{select:!0}))},C=function(R){if(document.activeElement===document.body)for(const P of R)P.removedNodes.length>0&&Vi(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",S);const _=new MutationObserver(C);return f&&_.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",S),_.disconnect()}}},[a,f,w.paused]),b.useEffect(()=>{if(f){h1.add(w);const j=document.activeElement;if(!f.contains(j)){const C=new CustomEvent(ig,d1);f.addEventListener(ig,h),f.dispatchEvent(C),C.defaultPrevented||(k3(_3(JE(f)),{select:!0}),document.activeElement===j&&Vi(f))}return()=>{f.removeEventListener(ig,h),setTimeout(()=>{const C=new CustomEvent(sg,d1);f.addEventListener(sg,p),f.dispatchEvent(C),C.defaultPrevented||Vi(j??document.body,{select:!0}),f.removeEventListener(sg,p),h1.remove(w)},0)}}},[f,h,p,w]);const k=b.useCallback(j=>{if(!n&&!a||w.paused)return;const S=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(S&&C){const _=j.currentTarget,[R,z]=j3(_);R&&z?!j.shiftKey&&C===z?(j.preventDefault(),n&&Vi(R,{select:!0})):j.shiftKey&&C===R&&(j.preventDefault(),n&&Vi(z,{select:!0})):C===_&&j.preventDefault()}},[n,a,w.paused]);return l.jsx(hi.div,{tabIndex:-1,...c,ref:x,onKeyDown:k})});WE.displayName=S3;function k3(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Vi(a,{select:t}),document.activeElement!==n)return}function j3(e){const t=JE(e),n=f1(t,e),a=f1(t.reverse(),e);return[n,a]}function JE(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 f1(e,t){for(const n of e)if(!E3(n,{upTo:t}))return n}function E3(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 C3(e){return e instanceof HTMLInputElement&&"select"in e}function Vi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&C3(e)&&t&&e.select()}}var h1=N3();function N3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=m1(e,t),e.unshift(t)},remove(t){var n;e=m1(e,t),(n=e[0])==null||n.resume()}}}function m1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function _3(e){return e.filter(t=>t.tagName!=="A")}var T3="Portal",eC=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);uc(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?s3.createPortal(l.jsx(hi.div,{...a,ref:t}),c):null});eC.displayName=T3;function A3(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var dh=e=>{const{present:t,children:n}=e,a=R3(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=tl(a.ref,O3(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};dh.displayName="Presence";function R3(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=A3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=uf(a.current);o.current=f==="mounted"?h:"none"},[f]),uc(()=>{const h=a.current,p=s.current;if(p!==e){const x=o.current,w=uf(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),uc(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=w=>{const j=uf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!s.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},x=w=>{w.target===t&&(o.current=uf(a.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function uf(e){return(e==null?void 0:e.animationName)||"none"}function O3(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lg=0;function z3(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??p1()),document.body.insertAdjacentElement("beforeend",e[1]??p1()),lg++,()=>{lg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),lg--}},[])}function p1(){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 Oa=function(){return Oa=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},Oa.apply(this,arguments)};function tC(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 M3(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",D3="with-scroll-bars-hidden",I3="--removed-body-scroll-bar-size";function og(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function L3(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var P3=typeof window<"u"?b.useLayoutEffect:b.useEffect,g1=new WeakMap;function U3(e,t){var n=L3(null,function(a){return e.forEach(function(s){return og(s,a)})});return P3(function(){var a=g1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||og(f,null)}),o.forEach(function(f){s.has(f)||og(f,c)})}g1.set(n,e)},[e]),n}function B3(e){return e}function F3(e,t){t===void 0&&(t=B3);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(o),c=n}var m=function(){var p=c;c=[],p.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return s}function $3(e){e===void 0&&(e={});var t=F3(null);return t.options=Oa({async:!0,ssr:!1},e),t}var nC=function(e){var t=e.sideCar,n=tC(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return b.createElement(a,Oa({},n))};nC.isSideCarExport=!0;function H3(e,t){return e.useMedium(t),nC}var rC=$3(),ug=function(){},fh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:ug,onWheelCapture:ug,onTouchMoveCapture:ug}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,x=e.sideCar,w=e.noRelative,k=e.noIsolation,j=e.inert,S=e.allowPinchZoom,C=e.as,_=C===void 0?"div":C,R=e.gapMode,z=tC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=x,O=U3([n,t]),L=Oa(Oa({},z),s);return b.createElement(b.Fragment,null,p&&b.createElement(P,{sideCar:rC,removeScrollBar:h,shards:g,noRelative:w,noIsolation:k,inert:j,setCallbacks:o,allowPinchZoom:!!S,lockRef:n,gapMode:R}),c?b.cloneElement(b.Children.only(f),Oa(Oa({},L),{ref:O})):b.createElement(_,Oa({},L,{className:m,ref:O}),f))});fh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fh.classNames={fullWidth:Rf,zeroRight:Af};var q3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Z3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=q3();return t&&e.setAttribute("nonce",t),e}function G3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function V3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Q3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Z3())&&(G3(t,n),V3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},K3=function(){var e=Q3();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},aC=function(){var e=K3(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},Y3={left:0,top:0,right:0,gap:0},cg=function(e){return parseInt(e||"",10)||0},X3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[cg(n),cg(a),cg(s)]},W3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Y3;var t=X3(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])}},J3=aC(),to="data-scroll-locked",eI=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
306
- .`.concat(D3,` {
307
- overflow: hidden `).concat(a,`;
308
- padding-right: `).concat(f,"px ").concat(a,`;
309
- }
310
- body[`).concat(to,`] {
311
- overflow: hidden `).concat(a,`;
312
- overscroll-behavior: contain;
313
- `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
314
- padding-left: `.concat(s,`px;
315
- padding-top: `).concat(o,`px;
316
- padding-right: `).concat(c,`px;
317
- margin-left:0;
318
- margin-top:0;
319
- margin-right: `).concat(f,"px ").concat(a,`;
320
- `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
321
- }
322
-
323
- .`).concat(Af,` {
324
- right: `).concat(f,"px ").concat(a,`;
325
- }
326
-
327
- .`).concat(Rf,` {
328
- margin-right: `).concat(f,"px ").concat(a,`;
329
- }
330
-
331
- .`).concat(Af," .").concat(Af,` {
332
- right: 0 `).concat(a,`;
333
- }
334
-
335
- .`).concat(Rf," .").concat(Rf,` {
336
- margin-right: 0 `).concat(a,`;
337
- }
338
-
339
- body[`).concat(to,`] {
340
- `).concat(I3,": ").concat(f,`px;
341
- }
342
- `)},y1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},tI=function(){b.useEffect(function(){return document.body.setAttribute(to,(y1()+1).toString()),function(){var e=y1()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},nI=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;tI();var o=b.useMemo(function(){return W3(s)},[s]);return b.createElement(J3,{styles:eI(o,!t,s,n?"":"!important")})},Ny=!1;if(typeof window<"u")try{var cf=Object.defineProperty({},"passive",{get:function(){return Ny=!0,!0}});window.addEventListener("test",cf,cf),window.removeEventListener("test",cf,cf)}catch{Ny=!1}var Bl=Ny?{passive:!1}:!1,rI=function(e){return e.tagName==="TEXTAREA"},iC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!rI(e)&&n[t]==="visible")},aI=function(e){return iC(e,"overflowY")},iI=function(e){return iC(e,"overflowX")},v1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=sC(e,a);if(s){var o=lC(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},sI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},lI=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},sC=function(e,t){return e==="v"?aI(t):iI(t)},lC=function(e,t){return e==="v"?sI(t):lI(t)},oI=function(e,t){return e==="h"&&t==="rtl"?-1:1},uI=function(e,t,n,a,s){var o=oI(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,p=c>0,g=0,x=0;do{if(!f)break;var w=lC(e,f),k=w[0],j=w[1],S=w[2],C=j-S-o*k;(k||C)&&sC(e,f)&&(g+=C,x+=k);var _=f.parentNode;f=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},df=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},b1=function(e){return[e.deltaX,e.deltaY]},x1=function(e){return e&&"current"in e?e.current:e},cI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dI=function(e){return`
343
- .block-interactivity-`.concat(e,` {pointer-events: none;}
344
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
345
- `)},fI=0,Fl=[];function hI(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(fI++)[0],o=b.useState(aC)[0],c=b.useRef(e);b.useEffect(function(){c.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=M3([e.lockRef.current],(e.shards||[]).map(x1),!0).filter(Boolean);return j.forEach(function(S){return S.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(j,S){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var C=df(j),_=n.current,R="deltaX"in j?j.deltaX:_[0]-C[0],z="deltaY"in j?j.deltaY:_[1]-C[1],P,O=j.target,L=Math.abs(R)>Math.abs(z)?"h":"v";if("touches"in j&&L==="h"&&O.type==="range")return!1;var I=window.getSelection(),K=I&&I.anchorNode,D=K?K===O||K.contains(O):!1;if(D)return!1;var Y=v1(L,O);if(!Y)return!0;if(Y?P=L:(P=L==="v"?"h":"v",Y=v1(L,O)),!Y)return!1;if(!a.current&&"changedTouches"in j&&(R||z)&&(a.current=P),!P)return!0;var se=a.current||P;return uI(se,S,j,se==="h"?R:z)},[]),m=b.useCallback(function(j){var S=j;if(!(!Fl.length||Fl[Fl.length-1]!==o)){var C="deltaY"in S?b1(S):df(S),_=t.current.filter(function(P){return P.name===S.type&&(P.target===S.target||S.target===P.shadowParent)&&cI(P.delta,C)})[0];if(_&&_.should){S.cancelable&&S.preventDefault();return}if(!_){var R=(c.current.shards||[]).map(x1).filter(Boolean).filter(function(P){return P.contains(S.target)}),z=R.length>0?f(S,R[0]):!c.current.noIsolation;z&&S.cancelable&&S.preventDefault()}}},[]),h=b.useCallback(function(j,S,C,_){var R={name:j,delta:S,target:C,should:_,shadowParent:mI(C)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(z){return z!==R})},1)},[]),p=b.useCallback(function(j){n.current=df(j),a.current=void 0},[]),g=b.useCallback(function(j){h(j.type,b1(j),j.target,f(j,e.lockRef.current))},[]),x=b.useCallback(function(j){h(j.type,df(j),j.target,f(j,e.lockRef.current))},[]);b.useEffect(function(){return Fl.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Bl),document.addEventListener("touchmove",m,Bl),document.addEventListener("touchstart",p,Bl),function(){Fl=Fl.filter(function(j){return j!==o}),document.removeEventListener("wheel",m,Bl),document.removeEventListener("touchmove",m,Bl),document.removeEventListener("touchstart",p,Bl)}},[]);var w=e.removeScrollBar,k=e.inert;return b.createElement(b.Fragment,null,k?b.createElement(o,{styles:dI(s)}):null,w?b.createElement(nI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const pI=H3(rC,hI);var oC=b.forwardRef(function(e,t){return b.createElement(fh,Oa({},e,{ref:t,sideCar:pI}))});oC.classNames=fh.classNames;var gI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$l=new WeakMap,ff=new WeakMap,hf={},dg=0,uC=function(e){return e&&(e.host||uC(e.parentNode))},yI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=uC(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})},vI=function(e,t,n,a){var s=yI(t,Array.isArray(e)?e:[e]);hf[n]||(hf[n]=new WeakMap);var o=hf[n],c=[],f=new Set,m=new Set(s),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};s.forEach(h);var p=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(x){if(f.has(x))p(x);else try{var w=x.getAttribute(a),k=w!==null&&w!=="false",j=($l.get(x)||0)+1,S=(o.get(x)||0)+1;$l.set(x,j),o.set(x,S),c.push(x),j===1&&k&&ff.set(x,!0),S===1&&x.setAttribute(n,"true"),k||x.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(t),f.clear(),dg++,function(){c.forEach(function(g){var x=$l.get(g)-1,w=o.get(g)-1;$l.set(g,x),o.set(g,w),x||(ff.has(g)||g.removeAttribute(a),ff.delete(g)),w||g.removeAttribute(n)}),dg--,dg||($l=new WeakMap,$l=new WeakMap,ff=new WeakMap,hf={})}},bI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=gI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),vI(a,s,n,"aria-hidden")):function(){return null}},hh="Dialog",[cC]=WD(hh),[xI,Sa]=cC(hh),dC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=r3({prop:a,defaultProp:s??!1,onChange:o,caller:hh});return l.jsx(xI,{scope:t,triggerRef:f,contentRef:m,contentId:oi(),titleId:oi(),descriptionId:oi(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};dC.displayName=hh;var fC="DialogTrigger",wI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Sa(fC,n),o=tl(t,s.triggerRef);return l.jsx(hi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dv(s.open),...a,ref:o,onClick:ss(e.onClick,s.onOpenToggle)})});wI.displayName=fC;var zv="DialogPortal",[SI,hC]=cC(zv,{forceMount:void 0}),mC=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=Sa(zv,t);return l.jsx(SI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(dh,{present:n||o.open,children:l.jsx(eC,{asChild:!0,container:s,children:c})}))})};mC.displayName=zv;var Ff="DialogOverlay",pC=b.forwardRef((e,t)=>{const n=hC(Ff,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=Sa(Ff,e.__scopeDialog);return o.modal?l.jsx(dh,{present:a||o.open,children:l.jsx(jI,{...s,ref:t})}):null});pC.displayName=Ff;var kI=QE("DialogOverlay.RemoveScroll"),jI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Sa(Ff,n);return l.jsx(oC,{as:kI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(hi.div,{"data-state":Dv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Ks="DialogContent",gC=b.forwardRef((e,t)=>{const n=hC(Ks,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=Sa(Ks,e.__scopeDialog);return l.jsx(dh,{present:a||o.open,children:o.modal?l.jsx(EI,{...s,ref:t}):l.jsx(CI,{...s,ref:t})})});gC.displayName=Ks;var EI=b.forwardRef((e,t)=>{const n=Sa(Ks,e.__scopeDialog),a=b.useRef(null),s=tl(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return bI(o)},[]),l.jsx(yC,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ss(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:ss(e.onFocusOutside,o=>o.preventDefault())})}),CI=b.forwardRef((e,t)=>{const n=Sa(Ks,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(yC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),yC=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=Sa(Ks,n),m=b.useRef(null),h=tl(t,m);return z3(),l.jsxs(l.Fragment,{children:[l.jsx(WE,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(YE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Dv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(NI,{titleId:f.titleId}),l.jsx(TI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Mv="DialogTitle",vC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Sa(Mv,n);return l.jsx(hi.h2,{id:s.titleId,...a,ref:t})});vC.displayName=Mv;var bC="DialogDescription",xC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Sa(bC,n);return l.jsx(hi.p,{id:s.descriptionId,...a,ref:t})});xC.displayName=bC;var wC="DialogClose",SC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Sa(wC,n);return l.jsx(hi.button,{type:"button",...a,ref:t,onClick:ss(e.onClick,()=>s.onOpenChange(!1))})});SC.displayName=wC;function Dv(e){return e?"open":"closed"}var kC="DialogTitleWarning",[dX,jC]=XD(kC,{contentName:Ks,titleName:Mv,docsSlug:"dialog"}),NI=({titleId:e})=>{const t=jC(kC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
346
-
347
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
348
-
349
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_I="DialogDescriptionWarning",TI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jC(_I).contentName}}.`;return b.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},EC=dC,CC=mC,NC=pC,_C=gC,AI=vC,RI=xC,OI=SC,zI=Symbol.for("react.lazy"),$f=iv[" use ".trim().toString()];function MI(e){return typeof e=="object"&&e!==null&&"then"in e}function TC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zI&&"_payload"in e&&MI(e._payload)}function AC(e){const t=II(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;TC(o)&&typeof $f=="function"&&(o=$f(o._payload));const f=b.Children.toArray(o),m=f.find(PI);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var DI=AC("Slot");function II(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(TC(s)&&typeof $f=="function"&&(s=$f(s._payload)),b.isValidElement(s)){const c=BI(s),f=UI(o,s.props);return s.type!==b.Fragment&&(f.ref=a?us(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var LI=Symbol("radix.slottable");function PI(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LI}function UI(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function BI(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 FI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mi=FI.reduce((e,t)=>{const n=AC(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Iu='[cmdk-group=""]',fg='[cmdk-group-items=""]',$I='[cmdk-group-heading=""]',RC='[cmdk-item=""]',w1=`${RC}:not([aria-disabled="true"])`,_y="cmdk-item-select",Gl="data-value",HI=(e,t,n)=>YD(e,t,n),OC=b.createContext(void 0),zc=()=>b.useContext(OC),zC=b.createContext(void 0),Iv=()=>b.useContext(zC),MC=b.createContext(void 0),DC=b.forwardRef((e,t)=>{let n=Vl(()=>{var F,T;return{search:"",value:(T=(F=e.value)!=null?F:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Vl(()=>new Set),s=Vl(()=>new Map),o=Vl(()=>new Map),c=Vl(()=>new Set),f=IC(e),{label:m,children:h,value:p,onValueChange:g,filter:x,shouldFilter:w,loop:k,disablePointerSelection:j=!1,vimBindings:S=!0,...C}=e,_=oi(),R=oi(),z=oi(),P=b.useRef(null),O=e4();Ys(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,L.emit()}},[p]),Ys(()=>{O(6,xe)},[]);let L=b.useMemo(()=>({subscribe:F=>(c.current.add(F),()=>c.current.delete(F)),snapshot:()=>n.current,setState:(F,T,G)=>{var q,ie,ve,we;if(!Object.is(n.current[F],T)){if(n.current[F]=T,F==="search")se(),D(),O(1,Y);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(z);me?me.focus():(q=document.getElementById(_))==null||q.focus()}if(O(7,()=>{var me;n.current.selectedItemId=(me=J())==null?void 0:me.id,L.emit()}),G||O(5,xe),((ie=f.current)==null?void 0:ie.value)!==void 0){let me=T??"";(we=(ve=f.current).onValueChange)==null||we.call(ve,me);return}}L.emit()}},emit:()=>{c.current.forEach(F=>F())}}),[]),I=b.useMemo(()=>({value:(F,T,G)=>{var q;T!==((q=o.current.get(F))==null?void 0:q.value)&&(o.current.set(F,{value:T,keywords:G}),n.current.filtered.items.set(F,K(T,G)),O(2,()=>{D(),L.emit()}))},item:(F,T)=>(a.current.add(F),T&&(s.current.has(T)?s.current.get(T).add(F):s.current.set(T,new Set([F]))),O(3,()=>{se(),D(),n.current.value||Y(),L.emit()}),()=>{o.current.delete(F),a.current.delete(F),n.current.filtered.items.delete(F);let G=J();O(4,()=>{se(),(G==null?void 0:G.getAttribute("id"))===F&&Y(),L.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{o.current.delete(F),s.current.delete(F)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:_,inputId:z,labelId:R,listInnerRef:P}),[]);function K(F,T){var G,q;let ie=(q=(G=f.current)==null?void 0:G.filter)!=null?q:HI;return F?ie(F,n.current.search,T):0}function D(){if(!n.current.search||f.current.shouldFilter===!1)return;let F=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(q=>{let ie=s.current.get(q),ve=0;ie.forEach(we=>{let me=F.get(we);ve=Math.max(me,ve)}),T.push([q,ve])});let G=P.current;W().sort((q,ie)=>{var ve,we;let me=q.getAttribute("id"),Me=ie.getAttribute("id");return((ve=F.get(Me))!=null?ve:0)-((we=F.get(me))!=null?we:0)}).forEach(q=>{let ie=q.closest(fg);ie?ie.appendChild(q.parentElement===ie?q:q.closest(`${fg} > *`)):G.appendChild(q.parentElement===G?q:q.closest(`${fg} > *`))}),T.sort((q,ie)=>ie[1]-q[1]).forEach(q=>{var ie;let ve=(ie=P.current)==null?void 0:ie.querySelector(`${Iu}[${Gl}="${encodeURIComponent(q[0])}"]`);ve==null||ve.parentElement.appendChild(ve)})}function Y(){let F=W().find(G=>G.getAttribute("aria-disabled")!=="true"),T=F==null?void 0:F.getAttribute(Gl);L.setState("value",T||void 0)}function se(){var F,T,G,q;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ie=0;for(let ve of a.current){let we=(T=(F=o.current.get(ve))==null?void 0:F.value)!=null?T:"",me=(q=(G=o.current.get(ve))==null?void 0:G.keywords)!=null?q:[],Me=K(we,me);n.current.filtered.items.set(ve,Me),Me>0&&ie++}for(let[ve,we]of s.current)for(let me of we)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=ie}function xe(){var F,T,G;let q=J();q&&(((F=q.parentElement)==null?void 0:F.firstChild)===q&&((G=(T=q.closest(Iu))==null?void 0:T.querySelector($I))==null||G.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function J(){var F;return(F=P.current)==null?void 0:F.querySelector(`${RC}[aria-selected="true"]`)}function W(){var F;return Array.from(((F=P.current)==null?void 0:F.querySelectorAll(w1))||[])}function Z(F){let T=W()[F];T&&L.setState("value",T.getAttribute(Gl))}function ne(F){var T;let G=J(),q=W(),ie=q.findIndex(we=>we===G),ve=q[ie+F];(T=f.current)!=null&&T.loop&&(ve=ie+F<0?q[q.length-1]:ie+F===q.length?q[0]:q[ie+F]),ve&&L.setState("value",ve.getAttribute(Gl))}function ke(F){let T=J(),G=T==null?void 0:T.closest(Iu),q;for(;G&&!q;)G=F>0?WI(G,Iu):JI(G,Iu),q=G==null?void 0:G.querySelector(w1);q?L.setState("value",q.getAttribute(Gl)):ne(F)}let Ae=()=>Z(W().length-1),M=F=>{F.preventDefault(),F.metaKey?Ae():F.altKey?ke(1):ne(1)},U=F=>{F.preventDefault(),F.metaKey?Z(0):F.altKey?ke(-1):ne(-1)};return b.createElement(mi.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:F=>{var T;(T=C.onKeyDown)==null||T.call(C,F);let G=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||G))switch(F.key){case"n":case"j":{S&&F.ctrlKey&&M(F);break}case"ArrowDown":{M(F);break}case"p":case"k":{S&&F.ctrlKey&&U(F);break}case"ArrowUp":{U(F);break}case"Home":{F.preventDefault(),Z(0);break}case"End":{F.preventDefault(),Ae();break}case"Enter":{F.preventDefault();let q=J();if(q){let ie=new Event(_y);q.dispatchEvent(ie)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:n4},m),mh(e,F=>b.createElement(zC.Provider,{value:L},b.createElement(OC.Provider,{value:I},F))))}),qI=b.forwardRef((e,t)=>{var n,a;let s=oi(),o=b.useRef(null),c=b.useContext(MC),f=zc(),m=IC(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ys(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let p=LC(s,o,[e.value,e.children,o],e.keywords),g=Iv(),x=cs(O=>O.value&&O.value===p.current),w=cs(O=>h||f.filter()===!1?!0:O.search?O.filtered.items.get(s)>0:!0);b.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(_y,k),()=>O.removeEventListener(_y,k)},[w,e.onSelect,e.disabled]);function k(){var O,L;j(),(L=(O=m.current).onSelect)==null||L.call(O,p.current)}function j(){g.setState("value",p.current,!0)}if(!w)return null;let{disabled:S,value:C,onSelect:_,forceMount:R,keywords:z,...P}=e;return b.createElement(mi.div,{ref:us(o,t),...P,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!x,"data-disabled":!!S,"data-selected":!!x,onPointerMove:S||f.getDisablePointerSelection()?void 0:j,onClick:S?void 0:k},e.children)}),ZI=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=oi(),f=b.useRef(null),m=b.useRef(null),h=oi(),p=zc(),g=cs(w=>s||p.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ys(()=>p.group(c),[]),LC(c,f,[e.value,e.heading,m]);let x=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(mi.div,{ref:us(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),mh(e,w=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(MC.Provider,{value:x},w))))}),GI=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=cs(c=>!c.search);return!n&&!o?null:b.createElement(mi.div,{ref:us(s,t),...a,"cmdk-separator":"",role:"separator"})}),VI=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Iv(),c=cs(h=>h.search),f=cs(h=>h.selectedItemId),m=zc();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(mi.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),QI=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),c=b.useRef(null),f=cs(h=>h.selectedItemId),m=zc();return b.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=h.offsetHeight;p.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(g),x.unobserve(h)}}},[]),b.createElement(mi.div,{ref:us(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},mh(e,h=>b.createElement("div",{ref:us(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),KI=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(EC,{open:n,onOpenChange:a},b.createElement(CC,{container:c},b.createElement(NC,{"cmdk-overlay":"",className:s}),b.createElement(_C,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(DC,{ref:t,...f}))))}),YI=b.forwardRef((e,t)=>cs(n=>n.filtered.count===0)?b.createElement(mi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),XI=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(mi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},mh(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),Nr=Object.assign(DC,{List:QI,Item:qI,Input:VI,Group:ZI,Separator:GI,Dialog:KI,Empty:YI,Loading:XI});function WI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function JI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function IC(e){let t=b.useRef(e);return Ys(()=>{t.current=e}),t}var Ys=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Vl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function cs(e){let t=Iv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function LC(e,t,n,a=[]){let s=b.useRef(),o=zc();return Ys(()=>{var c;let f=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(c=t.current)==null||c.setAttribute(Gl,f),s.current=f}),s}var e4=()=>{let[e,t]=b.useState(),n=Vl(()=>new Map);return Ys(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function t4(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&&b.isValidElement(t)?b.cloneElement(t4(t),{ref:t.ref},n(t.props.children)):n(t)}var n4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const On=EC,r4=CC,PC=b.forwardRef(({className:e,...t},n)=>l.jsx(NC,{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}));PC.displayName="DialogOverlay";const _n=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(r4,{children:[l.jsx(PC,{}),l.jsxs(_C,{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(os,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_n.displayName="DialogContent";function Pn({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function fr({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 zn=b.forwardRef(({className:e,...t},n)=>l.jsx(AI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));zn.displayName="DialogTitle";const Lv=b.forwardRef(({className:e,...t},n)=>l.jsx(RI,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));Lv.displayName="DialogDescription";const UC=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr,{ref:n,className:ze("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));UC.displayName=Nr.displayName;function a4({open:e,onOpenChange:t,children:n}){return l.jsx(On,{open:e,onOpenChange:t,children:l.jsx(_n,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(UC,{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 BC=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(Tv,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Nr.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})]}));BC.displayName=Nr.Input.displayName;const FC=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.List,{ref:n,className:ze("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));FC.displayName=Nr.List.displayName;const $C=b.forwardRef((e,t)=>l.jsx(Nr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));$C.displayName=Nr.Empty.displayName;const Of=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.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=Nr.Group.displayName;const Ty=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));Ty.displayName=Nr.Separator.displayName;const zf=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.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=Nr.Item.displayName;function Mc(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(Nn(`/agents${n?`?${n}`:""}`))}function i4(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return Ee.get(Nn(`/agents/all${n?`?${n}`:""}`))}function Pv(){return Ee.get("/me/managed-agents")}function s4(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function l4(e){return Ee.post(Nn("/agents"),e)}function o4(e){return Ee.get(Nn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Ay(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function u4(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function HC(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function qC(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function ZC(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function c4(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function ph(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Pv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Uv(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Pv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const d4=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function f4({open:e,onOpenChange:t}){const n=Rn(),a=ph(),{data:s}=Ke({queryKey:["activity"],queryFn:Oc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=Ke({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await GE(p.agentId);for(const x of g)h.push({agentId:p.agentId,session:x})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(a4,{open:e,onOpenChange:t,children:[l.jsx(BC,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(FC,{children:[l.jsx($C,{children:"No results"}),o.length>0&&l.jsx(Of,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(zf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(wE,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:p}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ty,{}),l.jsx(Of,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(zf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(Nv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:g}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:p.chatId.slice(0,8)})]},`${h}-${p.chatId}`)})})]}),l.jsx(Ty,{}),l.jsx(Of,{heading:"Pages",children:d4.map(h=>l.jsxs(zf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(gM,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function h4(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function m4(){var a;const{user:e}=vt(),{data:t}=Ke({queryKey:["clients"],queryFn:di,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=h4(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const p4=160;function g4(){const e=Rn(),{rows:t,firstHostname:n}=m4();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(y4,{}),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:p4,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 y4(){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 Dc(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 v4(e){const t=new URLSearchParams;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(Nn(`/notifications${n?`?${n}`:""}`))}function b4(e){return Ee.post(Nn(`/notifications/${e}/read`))}function x4(){return Ee.post(Nn("/notifications/read-all"))}function w4(){return Ee.get(Nn("/notifications/unread-count"))}const S4={agent_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale"};function k4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function j4({notification:e,onClick:t,clickable:n}){const a=(S4[e.type]??e.type).toString(),s=k4(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:oc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function E4(){const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=Rn(),c=gn(),{data:f}=Ke({queryKey:["notifications","bell"],queryFn:()=>v4({limit:8})}),{data:m}=Ke({queryKey:["notifications","unread-count"],queryFn:()=>w4()}),h=(m==null?void 0:m.count)??0,p=h>0,g=b.useCallback(async w=>{w.read||(b4(w.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),w.chatId?o(`/?c=${w.chatId}`):w.agentId&&o(`/agents/${w.agentId}`)},[o,c]),x=b.useCallback(async()=>{a(null);try{await x4(),await c.invalidateQueries({queryKey:["notifications"]})}catch(w){a(w instanceof Error?w.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(Qz,{className:"h-4 w-4"}),p&&l.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:x,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),l.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(w=>l.jsx(j4,{notification:w,clickable:!!w.chatId||!!w.agentId,onClick:()=>g(w)},w.id))})]})]})]})}function C4(){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 N4(){const[e,t]=b.useState(C4);return b.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),l.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?l.jsx(MM,{className:"h-4 w-4"}):l.jsx(jM,{className:"h-4 w-4"})})}function _4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function S1({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:_4(t)})})}const k1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,j1=AE,T4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return j1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const x=k1(p)||k1(g);return s[h][x]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,x]=p;return x===void 0||(h[g]=x),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:x,...w}=p;return Object.entries(w).every(k=>{let[j,S]=k;return Array.isArray(S)?S.includes({...o,...f}[j]):{...o,...f}[j]===S})?[...h,g,x]:h},[]);return j1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},A4=T4("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"}}),ye=b.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})});ye.displayName="Button";const Ft=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:ze("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));Ft.displayName="Input";function R4({action:e,onClose:t}){const n=e!==null;return l.jsx(On,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(_n,{children:[l.jsxs(Pn,{children:[l.jsx(zn,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(Lv,{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(z4,{onDone:t}),e==="join"&&l.jsx(M4,{onDone:t})]})})}function O4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function z4({onDone:e}){const{adoptTokens:t}=vt(),n=Rn(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{p.preventDefault();const g=a.trim();if(g){m(!0),c(null);try{const x=await Ee.post("/me/organizations",{name:O4(g),displayName:g});await t(x.tokens),e(),n("/",{replace:!0})}catch(x){c(x instanceof Error?x.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ft,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(ye,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function M4({onDone:e}){const{adoptTokens:t}=vt(),n=Rn(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),x=/\/invite\/([^/?#]+)/.exec(g),w=(x==null?void 0:x[1])??g,k=await Ee.post("/me/organizations/join",{token:w});await t(k.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ft,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(ye,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function D4(){var P,O;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=vt(),o=Rn(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),x=b.useRef(null);b.useEffect(()=>{(async()=>{try{const L=await Ee.get("/me/organizations");f(L)}catch{}})()},[]),b.useEffect(()=>{const L=K=>{m&&x.current&&!x.current.contains(K.target)&&h(!1)},I=K=>{m&&K.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",L),window.addEventListener("keydown",I),()=>{window.removeEventListener("mousedown",L),window.removeEventListener("keydown",I)}},[m]);const w=(n==null?void 0:n.displayName)??"User",k=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,S=c.find(L=>L.id===e)??null,C=(S==null?void 0:S.role)??(t==="admin"||t==="member"?t:null),_=async L=>{if(L===e){h(!1);return}try{await a(L),h(!1),o("/",{replace:!0})}catch{}},R=()=>{h(!1),g("create")},z=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:x,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${w}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(L=>!L),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(S1,{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(S1,{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}),k&&k!==w&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",k]})]})]}),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:(P=c[0])==null?void 0:P.displayName}),l.jsx(E1,{role:((O=c[0])==null?void 0:O.role)??C})]}):l.jsx("div",{children:c.map(L=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void _(L.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:L.id===e?l.jsx(cr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:L.displayName}),l.jsx(E1,{role:L.role})]},L.id))})]}),l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:R,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(wa,{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(NE,{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(wM,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(R4,{action:p,onClose:()=>g(null)})]})}function E1({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 I4=[{to:"/",label:"Workspace",end:!0},{to:"/context",label:"Context",end:!1},{to:"/team",label:"Team",end:!1},{to:"/settings",label:"Settings",end:!1}];function L4(){const[e,t]=b.useState(!1),n=Cr(),a=n.pathname==="/"||n.search.includes("a=");return 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(Dc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(g4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:I4.map(s=>l.jsx(bv,{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.jsx("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})},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-3)",minWidth:200,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(Tv,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(E4,{}),l.jsx(N4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(D4,{})]})]}),l.jsx(f4,{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 GC=b.createContext(null),P4=5e3;function U4({children:e}){const[t,n]=b.useState([]),a=b.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),o={addToast:b.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return l.jsxs(GC.Provider,{value:o,children:[e,l.jsx(B4,{toasts:t,onDismiss:a})]})}function Ic(){const e=b.useContext(GC);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function B4({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(F4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function F4({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??P4,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(os,{className:"h-4 w-4"})})]})}function ce(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const x=p[g];x in f||(f[x]=h[x].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class no extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class VC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const QC={};function ds(e){return QC}function KC(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function Ry(e,t){return typeof t=="bigint"?t.toString():t}function gh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Bv(e){return e==null}function Fv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function $4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const C1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==C1)return a===void 0&&(a=C1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function nl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ms(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function N1(e){return JSON.stringify(e)}function H4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const YC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const q4=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 xo(e){if(dc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function XC(e){return xo(e)?{...e}:Array.isArray(e)?[...e]:e}const Z4=new Set(["string","number","symbol"]);function wo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ps(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 Le(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 G4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const V4={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 Q4(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=ms(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=n.shape[f])}return nl(this,"shape",c),c},checks:[]});return ps(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=ms(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return nl(this,"shape",c),c},checks:[]});return ps(e,o)}function Y4(e,t){if(!xo(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=ms(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return nl(this,"shape",o),o}});return ps(e,s)}function X4(e,t){if(!xo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ms(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return nl(this,"shape",a),a}});return ps(e,n)}function W4(e,t){const n=ms(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return nl(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ps(e,n)}function J4(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=ms(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return nl(this,"shape",m),m},checks:[]});return ps(t,c)}function e5(e,t,n){const a=ms(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 nl(this,"shape",o),o}});return ps(t,a)}function Xl(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 Wl(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 fs(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=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((f=t==null?void 0:t.error)==null?void 0:f.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=p}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function $v(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const WC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ry,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},JC=ce("$ZodError",WC),eN=ce("$ZodError",WC,{Parent:Error});function t5(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 n5(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>a({issues:c}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let c=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Hv=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 no;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>fs(m,o,ds())));throw YC(f,s==null?void 0:s.callee),f}return c.value},qv=e=>async(t,n,a,s)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>fs(m,o,ds())));throw YC(f,s==null?void 0:s.callee),f}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 no;return o.issues.length?{success:!1,error:new(e??JC)(o.issues.map(c=>fs(c,s,ds())))}:{success:!0,data:o.value}},r5=yh(eN),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=>fs(c,s,ds())))}:{success:!0,data:o.value}},a5=vh(eN),i5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Hv(e)(t,n,s)},s5=e=>(t,n,a)=>Hv(e)(t,n,a),l5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return qv(e)(t,n,s)},o5=e=>async(t,n,a)=>qv(e)(t,n,a),u5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return yh(e)(t,n,s)},c5=e=>(t,n,a)=>yh(e)(t,n,a),d5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},f5=e=>async(t,n,a)=>vh(e)(t,n,a),h5=/^[cC][^\s-]{8,}$/,m5=/^[0-9a-z]+$/,p5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g5=/^[0-9a-vA-V]{20}$/,y5=/^[A-Za-z0-9]{27}$/,v5=/^[a-zA-Z0-9_-]{21}$/,b5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,x5=/^([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})$/,_1=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)$/,w5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,S5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function k5(){return new RegExp(S5,"u")}const j5=/^(?:(?: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])$/,E5=/^(([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}|:))$/,C5=/^((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])$/,N5=/^(([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])$/,_5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tN=/^[A-Za-z0-9_-]*$/,T5=/^\+[1-9]\d{6,14}$/,nN="(?:(?:\\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(`^${nN}$`);function rN(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 R5(e){return new RegExp(`^${rN(e)}$`)}function O5(e){const t=rN({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(`^${nN}T(?:${a})$`)}const z5=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}$`)},M5=/^-?\d+$/,aN=/^-?\d+(?:\.\d+)?$/,D5=/^(?:true|false)$/i,I5=/^null$/i,L5=/^[^A-Z]*$/,P5=/^[^a-z]*$/,_r=ce("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),iN={number:"number",bigint:"bigint",object:"date"},sN=ce("$ZodCheckLessThan",(e,t)=>{_r.init(e,t);const n=iN[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})}}),lN=ce("$ZodCheckGreaterThan",(e,t)=>{_r.init(e,t);const n=iN[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})}}),U5=ce("$ZodCheckMultipleOf",(e,t)=>{_r.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):$4(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})}}),B5=ce("$ZodCheckNumberFormat",(e,t)=>{var c;_r.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]=V4[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=M5)}),e._zod.check=f=>{const m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),F5=ce("$ZodCheckMaxLength",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(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=$v(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),$5=ce("$ZodCheckMinLength",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(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=$v(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),H5=ce("$ZodCheckLengthEquals",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(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=$v(s),f=o>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),bh=ce("$ZodCheckStringFormat",(e,t)=>{var n,a;_r.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=()=>{})}),q5=ce("$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})}}),Z5=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=L5),bh.init(e,t)}),G5=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=P5),bh.init(e,t)}),V5=ce("$ZodCheckIncludes",(e,t)=>{_r.init(e,t);const n=wo(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})}}),Q5=ce("$ZodCheckStartsWith",(e,t)=>{_r.init(e,t);const n=new RegExp(`^${wo(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=ce("$ZodCheckEndsWith",(e,t)=>{_r.init(e,t);const n=new RegExp(`.*${wo(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})}}),Y5=ce("$ZodCheckOverwrite",(e,t)=>{_r.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class X5{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(`
350
- `).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(`
351
- `))}}const W5={major:4,minor:3,patch:6},Yt=ce("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=W5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let p=Xl(f),g;for(const x of m){if(x._zod.def.when){if(!x._zod.def.when(f))continue}else if(p)continue;const w=f.issues.length,k=x._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new no;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,f.issues.length!==w&&(p||(p=Xl(f,w)))});else{if(f.issues.length===w)continue;p||(p=Xl(f,w))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(Xl(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new no;return p.then(g=>e._zod.parse(g,h))}return e._zod.parse(p,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const p=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return p instanceof Promise?p.then(g=>c(g,f,m)):c(p,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new no;return h.then(p=>o(p,a,m))}return o(h,a,m)}}Ct(e,"~standard",()=>({validate:o=>{var c;try{const f=r5(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return a5(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}))}),Zv=ce("$ZodString",(e,t)=>{var n;Yt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??z5(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}}),Xt=ce("$ZodStringFormat",(e,t)=>{bh.init(e,t),Zv.init(e,t)}),J5=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=x5),Xt.init(e,t)}),eL=ce("$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=_1(a))}else t.pattern??(t.pattern=_1());Xt.init(e,t)}),tL=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=w5),Xt.init(e,t)}),nL=ce("$ZodURL",(e,t)=>{Xt.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})}}}),rL=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=k5()),Xt.init(e,t)}),aL=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=v5),Xt.init(e,t)}),iL=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=h5),Xt.init(e,t)}),sL=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=m5),Xt.init(e,t)}),lL=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=p5),Xt.init(e,t)}),oL=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=g5),Xt.init(e,t)}),uL=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=y5),Xt.init(e,t)}),cL=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=O5(t)),Xt.init(e,t)}),dL=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=A5),Xt.init(e,t)}),fL=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=R5(t)),Xt.init(e,t)}),hL=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=b5),Xt.init(e,t)}),mL=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=j5),Xt.init(e,t),e._zod.bag.format="ipv4"}),pL=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=E5),Xt.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})}}}),gL=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=C5),Xt.init(e,t)}),yL=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=N5),Xt.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 oN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const vL=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_5),Xt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{oN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function bL(e){if(!tN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return oN(n)}const xL=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tN),Xt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{bL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),wL=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=T5),Xt.init(e,t)});function SL(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 kL=ce("$ZodJWT",(e,t)=>{Xt.init(e,t),e._zod.check=n=>{SL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uN=ce("$ZodNumber",(e,t)=>{Yt.init(e,t),e._zod.pattern=e._zod.bag.pattern??aN,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}}),jL=ce("$ZodNumberFormat",(e,t)=>{B5.init(e,t),uN.init(e,t)}),EL=ce("$ZodBoolean",(e,t)=>{Yt.init(e,t),e._zod.pattern=D5,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),CL=ce("$ZodNull",(e,t)=>{Yt.init(e,t),e._zod.pattern=I5,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}}),NL=ce("$ZodUnknown",(e,t)=>{Yt.init(e,t),e._zod.parse=n=>n}),_L=ce("$ZodNever",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function T1(e,t,n){e.issues.length&&t.issues.push(...Wl(n,e.issues)),t.value[n]=e.value}const TL=ce("$ZodArray",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>T1(h,n,c))):T1(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(...Wl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function cN(e){var a,s,o,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(o=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=G4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function dN(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const x=m.run({value:t[g],issues:[]},a);x instanceof Promise?e.push(x.then(w=>Hf(w,n,g,t,p))):Hf(x,n,g,t,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const AL=ce("$ZodObject",(e,t)=>{Yt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=gh(()=>cN(t));Ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const s=dc,o=t.catchall;let c;e._zod.parse=(f,m)=>{c??(c=a.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const p=[],g=c.shape;for(const x of c.keys){const w=g[x],k=w._zod.optout==="optional",j=w._zod.run({value:h[x],issues:[]},m);j instanceof Promise?p.push(j.then(S=>Hf(S,f,x,h,k))):Hf(j,f,x,h,k)}return o?dN(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),RL=ce("$ZodObjectJIT",(e,t)=>{AL.init(e,t);const n=e._zod.parse,a=gh(()=>cN(t)),s=x=>{var R;const w=new X5(["shape","payload","ctx"]),k=a.value,j=z=>{const P=N1(z);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};w.write("const input = payload.value;");const S=Object.create(null);let C=0;for(const z of k.keys)S[z]=`key_${C++}`;w.write("const newResult = {};");for(const z of k.keys){const P=S[z],O=N1(z),L=x[z],I=((R=L==null?void 0:L._zod)==null?void 0:R.optout)==="optional";w.write(`const ${P} = ${j(z)};`),I?w.write(`
352
- if (${P}.issues.length) {
353
- if (${O} in input) {
354
- payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
355
- ...iss,
356
- path: iss.path ? [${O}, ...iss.path] : [${O}]
357
- })));
358
- }
359
- }
360
-
361
- if (${P}.value === undefined) {
362
- if (${O} in input) {
363
- newResult[${O}] = undefined;
364
- }
365
- } else {
366
- newResult[${O}] = ${P}.value;
367
- }
368
-
369
- `):w.write(`
370
- if (${P}.issues.length) {
371
- payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
372
- ...iss,
373
- path: iss.path ? [${O}, ...iss.path] : [${O}]
374
- })));
375
- }
376
-
377
- if (${P}.value === undefined) {
378
- if (${O} in input) {
379
- newResult[${O}] = undefined;
380
- }
381
- } else {
382
- newResult[${O}] = ${P}.value;
383
- }
384
-
385
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const _=w.compile();return(z,P)=>_(x,z,P)};let o;const c=dc,f=!QC.jitless,h=f&&q4.value,p=t.catchall;let g;e._zod.parse=(x,w)=>{g??(g=a.value);const k=x.value;return c(k)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),x=o(x,w),p?dN([],k,x,w,g,e):x):n(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),x)}});function A1(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=>!Xl(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=>fs(c,a,ds())))}),t)}const fN=ce("$ZodUnion",(e,t)=>{Yt.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=>Fv(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return a(s,o);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(m=>A1(m,s,e,o)):A1(f,s,e,o)}}),OL=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,fN.init(e,t);const n=e._zod.parse;Ct(e._zod,"propValues",()=>{const s={};for(const o of t.options){const c=o._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(c)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=gh(()=>{var c;const s=t.options,o=new Map;for(const f of s){const m=(c=f._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(s,o)=>{const c=s.value;if(!dc(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const f=a.value.get(c==null?void 0:c[t.discriminator]);return f?f._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),zL=ce("$ZodIntersection",(e,t)=>{Yt.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])=>R1(n,m,h)):R1(n,o,c)}});function Oy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xo(e)&&xo(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of a){const c=Oy(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};s[o]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],o=t[a],c=Oy(s,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function R1(e,t,n){const a=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&s&&e.issues.push({...s,keys:o}),Xl(e))return e;const c=Oy(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const ML=ce("$ZodRecord",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!xo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],c=t.keyType._zod.values;if(c){n.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:s[h],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Wl(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...Wl(h,p.issues)),n.value[h]=p.value)}let m;for(const h in s)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&aN.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>fs(g,a,ds())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:s[f],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Wl(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...Wl(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),DL=ce("$ZodEnum",(e,t)=>{Yt.init(e,t);const n=KC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>Z4.has(typeof s)).map(s=>typeof s=="string"?wo(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}}),IL=ce("$ZodLiteral",(e,t)=>{if(Yt.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"?wo(a):a?wo(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}}),LL=ce("$ZodTransform",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new VC(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 no;return n.value=s,n}});function O1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hN=ce("$ZodOptional",(e,t)=>{Yt.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(`^(${Fv(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=>O1(o,n.value)):O1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),PL=ce("$ZodExactOptional",(e,t)=>{hN.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)}),UL=ce("$ZodNullable",(e,t)=>{Yt.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(`^(${Fv(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)}),BL=ce("$ZodDefault",(e,t)=>{Yt.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=>z1(o,t)):z1(s,t)}});function z1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const FL=ce("$ZodPrefault",(e,t)=>{Yt.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))}),$L=ce("$ZodNonOptional",(e,t)=>{Yt.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=>M1(o,e)):M1(s,e)}});function M1(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 HL=ce("$ZodCatch",(e,t)=>{Yt.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=>fs(c,a,ds()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>fs(o,a,ds()))},input:n.value}),n.issues=[]),n)}}),qL=ce("$ZodPipe",(e,t)=>{Yt.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 ZL=ce("$ZodReadonly",(e,t)=>{Yt.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(D1):D1(s)}});function D1(e){return e.value=Object.freeze(e.value),e}const GL=ce("$ZodCustom",(e,t)=>{_r.init(e,t),Yt.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=>I1(o,n,a,e));I1(s,n,a,e)}});function I1(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(fc(s))}}var L1;class VL{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 QL(){return new VL}(L1=globalThis).__zod_globalRegistry??(L1.__zod_globalRegistry=QL());const Yu=globalThis.__zod_globalRegistry;function KL(e,t){return new e({type:"string",...Le(t)})}function YL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Le(t)})}function P1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Le(t)})}function XL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Le(t)})}function WL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Le(t)})}function JL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Le(t)})}function eP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Le(t)})}function tP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Le(t)})}function nP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Le(t)})}function rP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Le(t)})}function aP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Le(t)})}function iP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Le(t)})}function sP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Le(t)})}function lP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Le(t)})}function oP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Le(t)})}function uP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Le(t)})}function cP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Le(t)})}function dP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Le(t)})}function fP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Le(t)})}function hP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Le(t)})}function mP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Le(t)})}function pP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Le(t)})}function gP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Le(t)})}function yP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Le(t)})}function vP(e,t){return new e({type:"string",format:"date",check:"string_format",...Le(t)})}function bP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Le(t)})}function xP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Le(t)})}function wP(e,t){return new e({type:"number",checks:[],...Le(t)})}function SP(e,t){return new e({type:"number",coerce:!0,checks:[],...Le(t)})}function kP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Le(t)})}function jP(e,t){return new e({type:"boolean",...Le(t)})}function EP(e,t){return new e({type:"null",...Le(t)})}function CP(e){return new e({type:"unknown"})}function NP(e,t){return new e({type:"never",...Le(t)})}function U1(e,t){return new sN({check:"less_than",...Le(t),value:e,inclusive:!1})}function hg(e,t){return new sN({check:"less_than",...Le(t),value:e,inclusive:!0})}function B1(e,t){return new lN({check:"greater_than",...Le(t),value:e,inclusive:!1})}function mg(e,t){return new lN({check:"greater_than",...Le(t),value:e,inclusive:!0})}function F1(e,t){return new U5({check:"multiple_of",...Le(t),value:e})}function mN(e,t){return new F5({check:"max_length",...Le(t),maximum:e})}function qf(e,t){return new $5({check:"min_length",...Le(t),minimum:e})}function pN(e,t){return new H5({check:"length_equals",...Le(t),length:e})}function _P(e,t){return new q5({check:"string_format",format:"regex",...Le(t),pattern:e})}function TP(e){return new Z5({check:"string_format",format:"lowercase",...Le(e)})}function AP(e){return new G5({check:"string_format",format:"uppercase",...Le(e)})}function RP(e,t){return new V5({check:"string_format",format:"includes",...Le(t),includes:e})}function OP(e,t){return new Q5({check:"string_format",format:"starts_with",...Le(t),prefix:e})}function zP(e,t){return new K5({check:"string_format",format:"ends_with",...Le(t),suffix:e})}function Ao(e){return new Y5({check:"overwrite",tx:e})}function MP(e){return Ao(t=>t.normalize(e))}function DP(){return Ao(e=>e.trim())}function IP(){return Ao(e=>e.toLowerCase())}function LP(){return Ao(e=>e.toUpperCase())}function PP(){return Ao(e=>H4(e))}function UP(e,t,n){return new e({type:"array",element:t,...Le(n)})}function BP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Le(n)})}function FP(e){const t=$P(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(fc(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(fc(s))}},e(n.value,n)));return t}function $P(e,t){const n=new _r({check:"custom",...Le(t)});return n._zod.check=e,n}function gN(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)??Yu,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 jn(e,t,n={path:[],schemaPath:[]}){var p,g;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)c.schema=f;else{const x={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,x);else{const k=c.schema,j=t.processors[s.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);j(e,t,k,x)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),jn(w,t,x),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&ir(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function yN(e,t){var c,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const p of e.seen.entries()){const g=(c=e.metadataRegistry.get(p[0]))==null?void 0:c.id;if(g){const x=a.get(g);if(x&&x!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var j;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(j=e.external.registry.get(p[0]))==null?void 0:j.id,C=e.external.uri??(R=>R);if(S)return{ref:C(S)};const _=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=_,{defId:_,ref:`${C("__shared")}#/${g}/${_}`}}if(p[1]===n)return{ref:"#"};const w=`#/${g}/`,k=p[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:w+k}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:x,defId:w}=s(p);g.def={...g.schema},w&&(g.defId=w);const k=g.schema;for(const j in k)delete k[j];k.$ref=x};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
386
-
387
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const g=p[1];if(t===p[0]){o(p);continue}if(e.external){const w=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&w){o(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&e.reused==="ref"){o(p);continue}}}function vN(e,t){var c,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,x={...g},w=p.ref;if(p.ref=null,w){a(w);const j=e.seen.get(w),S=j.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(S)):Object.assign(g,S),Object.assign(g,x),h._zod.parent===w)for(const _ in g)_==="$ref"||_==="allOf"||_ in x||delete g[_];if(S.$ref&&j.def)for(const _ in g)_==="$ref"||_==="allOf"||_ in j.def&&JSON.stringify(g[_])===JSON.stringify(j.def[_])&&delete g[_]}const k=h._zod.parent;if(k&&k!==w){a(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(g.$ref=j.schema.$ref,j.def))for(const S in g)S==="$ref"||S==="allOf"||S in j.def&&JSON.stringify(g[S])===JSON.stringify(j.def[S])&&delete g[S]}e.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(o[p.defId]=p.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input: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 HP=(e,t={})=>n=>{const a=gN({...n,processors:t});return jn(e,a),yN(a,e),vN(a,e)},Zf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=gN({...s??{},target:o,io:t,processors:n});return jn(e,c),yN(c,e),vN(c,e)},qP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ZP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof c=="number"&&(s.maxLength=c),f&&(s.format=qP[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},GP=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p),typeof o=="number"&&(s.minimum=o,typeof p=="number"&&t.target!=="draft-04"&&(p>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof c=="number"&&(s.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},VP=(e,t,n,a)=>{n.type="boolean"},QP=(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={}},YP=(e,t,n,a)=>{},XP=(e,t,n,a)=>{const s=e._zod.def,o=KC(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},WP=(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},JP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},eU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},tU=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=jn(o.element,t,{...a,path:[...a.path,"items"]})},nU=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const p in c)s.properties[p]=jn(c[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(p=>{const g=o.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=jn(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},rU=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>jn(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},aU=(e,t,n,a)=>{const s=e._zod.def,o=jn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=jn(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},iU=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const c=o.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const p=jn(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const g of m)s.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=jn(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=jn(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const p=[...h].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(s.required=p)}},sU=(e,t,n,a)=>{const s=e._zod.def,o=jn(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"}]},lU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},oU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},uU=(e,t,n,a)=>{const s=e._zod.def;jn(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)))},cU=(e,t,n,a)=>{const s=e._zod.def;jn(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},dU=(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;jn(o,t,a);const c=t.seen.get(e);c.ref=o},fU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},bN=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},hU=ce("ZodISODateTime",(e,t)=>{cL.init(e,t),nn.init(e,t)});function mU(e){return yP(hU,e)}const pU=ce("ZodISODate",(e,t)=>{dL.init(e,t),nn.init(e,t)});function gU(e){return vP(pU,e)}const yU=ce("ZodISOTime",(e,t)=>{fL.init(e,t),nn.init(e,t)});function vU(e){return bP(yU,e)}const bU=ce("ZodISODuration",(e,t)=>{hL.init(e,t),nn.init(e,t)});function xU(e){return xP(bU,e)}const wU=(e,t)=>{JC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>n5(e,n)},flatten:{value:n=>t5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ry,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ry,2)}},isEmpty:{get(){return e.issues.length===0}}})},ua=ce("ZodError",wU,{Parent:Error}),SU=Hv(ua),kU=qv(ua),jU=yh(ua),EU=vh(ua),CU=i5(ua),NU=s5(ua),_U=l5(ua),TU=o5(ua),AU=u5(ua),RU=c5(ua),OU=d5(ua),zU=f5(ua),Wt=ce("ZodType",(e,t)=>(Yt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zf(e,"input"),output:Zf(e,"output")}}),e.toJSONSchema=HP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ms(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)=>ps(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>SU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>jU(e,n,a),e.parseAsync=async(n,a)=>kU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>EU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>CU(e,n,a),e.decode=(n,a)=>NU(e,n,a),e.encodeAsync=async(n,a)=>_U(e,n,a),e.decodeAsync=async(n,a)=>TU(e,n,a),e.safeEncode=(n,a)=>AU(e,n,a),e.safeDecode=(n,a)=>RU(e,n,a),e.safeEncodeAsync=async(n,a)=>OU(e,n,a),e.safeDecodeAsync=async(n,a)=>zU(e,n,a),e.refine=(n,a)=>e.check(N6(n,a)),e.superRefine=n=>e.check(_6(n)),e.overwrite=n=>e.check(Ao(n)),e.optional=()=>q1(e),e.exactOptional=()=>m6(e),e.nullable=()=>Z1(e),e.nullish=()=>q1(Z1(e)),e.nonoptional=n=>x6(e,n),e.array=()=>lt(e),e.or=n=>xh([e,n]),e.and=n=>u6(e,n),e.transform=n=>My(e,SN(n)),e.default=n=>y6(e,n),e.prefault=n=>b6(e,n),e.catch=n=>S6(e,n),e.pipe=n=>My(e,n),e.readonly=()=>E6(e),e.describe=n=>{const a=e.clone();return Yu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Yu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Yu.get(e);const a=e.clone();return Yu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),xN=ce("_ZodString",(e,t)=>{Zv.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>ZP(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(_P(...a)),e.includes=(...a)=>e.check(RP(...a)),e.startsWith=(...a)=>e.check(OP(...a)),e.endsWith=(...a)=>e.check(zP(...a)),e.min=(...a)=>e.check(qf(...a)),e.max=(...a)=>e.check(mN(...a)),e.length=(...a)=>e.check(pN(...a)),e.nonempty=(...a)=>e.check(qf(1,...a)),e.lowercase=a=>e.check(TP(a)),e.uppercase=a=>e.check(AP(a)),e.trim=()=>e.check(DP()),e.normalize=(...a)=>e.check(MP(...a)),e.toLowerCase=()=>e.check(IP()),e.toUpperCase=()=>e.check(LP()),e.slugify=()=>e.check(PP())}),MU=ce("ZodString",(e,t)=>{Zv.init(e,t),xN.init(e,t),e.email=n=>e.check(YL(DU,n)),e.url=n=>e.check(tP(IU,n)),e.jwt=n=>e.check(gP(XU,n)),e.emoji=n=>e.check(nP(LU,n)),e.guid=n=>e.check(P1($1,n)),e.uuid=n=>e.check(XL(gf,n)),e.uuidv4=n=>e.check(WL(gf,n)),e.uuidv6=n=>e.check(JL(gf,n)),e.uuidv7=n=>e.check(eP(gf,n)),e.nanoid=n=>e.check(rP(PU,n)),e.guid=n=>e.check(P1($1,n)),e.cuid=n=>e.check(aP(UU,n)),e.cuid2=n=>e.check(iP(BU,n)),e.ulid=n=>e.check(sP(FU,n)),e.base64=n=>e.check(hP(QU,n)),e.base64url=n=>e.check(mP(KU,n)),e.xid=n=>e.check(lP($U,n)),e.ksuid=n=>e.check(oP(HU,n)),e.ipv4=n=>e.check(uP(qU,n)),e.ipv6=n=>e.check(cP(ZU,n)),e.cidrv4=n=>e.check(dP(GU,n)),e.cidrv6=n=>e.check(fP(VU,n)),e.e164=n=>e.check(pP(YU,n)),e.datetime=n=>e.check(mU(n)),e.date=n=>e.check(gU(n)),e.time=n=>e.check(vU(n)),e.duration=n=>e.check(xU(n))});function N(e){return KL(MU,e)}const nn=ce("ZodStringFormat",(e,t)=>{Xt.init(e,t),xN.init(e,t)}),DU=ce("ZodEmail",(e,t)=>{tL.init(e,t),nn.init(e,t)}),$1=ce("ZodGUID",(e,t)=>{J5.init(e,t),nn.init(e,t)}),gf=ce("ZodUUID",(e,t)=>{eL.init(e,t),nn.init(e,t)}),IU=ce("ZodURL",(e,t)=>{nL.init(e,t),nn.init(e,t)}),LU=ce("ZodEmoji",(e,t)=>{rL.init(e,t),nn.init(e,t)}),PU=ce("ZodNanoID",(e,t)=>{aL.init(e,t),nn.init(e,t)}),UU=ce("ZodCUID",(e,t)=>{iL.init(e,t),nn.init(e,t)}),BU=ce("ZodCUID2",(e,t)=>{sL.init(e,t),nn.init(e,t)}),FU=ce("ZodULID",(e,t)=>{lL.init(e,t),nn.init(e,t)}),$U=ce("ZodXID",(e,t)=>{oL.init(e,t),nn.init(e,t)}),HU=ce("ZodKSUID",(e,t)=>{uL.init(e,t),nn.init(e,t)}),qU=ce("ZodIPv4",(e,t)=>{mL.init(e,t),nn.init(e,t)}),ZU=ce("ZodIPv6",(e,t)=>{pL.init(e,t),nn.init(e,t)}),GU=ce("ZodCIDRv4",(e,t)=>{gL.init(e,t),nn.init(e,t)}),VU=ce("ZodCIDRv6",(e,t)=>{yL.init(e,t),nn.init(e,t)}),QU=ce("ZodBase64",(e,t)=>{vL.init(e,t),nn.init(e,t)}),KU=ce("ZodBase64URL",(e,t)=>{xL.init(e,t),nn.init(e,t)}),YU=ce("ZodE164",(e,t)=>{wL.init(e,t),nn.init(e,t)}),XU=ce("ZodJWT",(e,t)=>{kL.init(e,t),nn.init(e,t)}),Gv=ce("ZodNumber",(e,t)=>{uN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>GP(e,a,s),e.gt=(a,s)=>e.check(B1(a,s)),e.gte=(a,s)=>e.check(mg(a,s)),e.min=(a,s)=>e.check(mg(a,s)),e.lt=(a,s)=>e.check(U1(a,s)),e.lte=(a,s)=>e.check(hg(a,s)),e.max=(a,s)=>e.check(hg(a,s)),e.int=a=>e.check(H1(a)),e.safe=a=>e.check(H1(a)),e.positive=a=>e.check(B1(0,a)),e.nonnegative=a=>e.check(mg(0,a)),e.negative=a=>e.check(U1(0,a)),e.nonpositive=a=>e.check(hg(0,a)),e.multipleOf=(a,s)=>e.check(F1(a,s)),e.step=(a,s)=>e.check(F1(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 He(e){return wP(Gv,e)}const WU=ce("ZodNumberFormat",(e,t)=>{jL.init(e,t),Gv.init(e,t)});function H1(e){return kP(WU,e)}const JU=ce("ZodBoolean",(e,t)=>{EL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>VP(e,n,a)});function Zn(e){return jP(JU,e)}const e6=ce("ZodNull",(e,t)=>{CL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>QP(e,n,a)});function t6(e){return EP(e6,e)}const n6=ce("ZodUnknown",(e,t)=>{NL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>YP()});function tn(){return CP(n6)}const r6=ce("ZodNever",(e,t)=>{_L.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>KP(e,n,a)});function a6(e){return NP(r6,e)}const i6=ce("ZodArray",(e,t)=>{TL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>tU(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(mN(n,a)),e.length=(n,a)=>e.check(pN(n,a)),e.unwrap=()=>e.element});function lt(e,t){return UP(i6,e,t)}const s6=ce("ZodObject",(e,t)=>{RL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>nU(e,n,a,s),Ct(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:tn()}),e.loose=()=>e.clone({...e._zod.def,catchall:tn()}),e.strict=()=>e.clone({...e._zod.def,catchall:a6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Y4(e,n),e.safeExtend=n=>X4(e,n),e.merge=n=>W4(e,n),e.pick=n=>Q4(e,n),e.omit=n=>K4(e,n),e.partial=(...n)=>J4(kN,e,n[0]),e.required=(...n)=>e5(jN,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},...Le(t)};return new s6(n)}const wN=ce("ZodUnion",(e,t)=>{fN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>rU(e,n,a,s),e.options=t.options});function xh(e,t){return new wN({type:"union",options:e,...Le(t)})}const l6=ce("ZodDiscriminatedUnion",(e,t)=>{wN.init(e,t),OL.init(e,t)});function wh(e,t,n){return new l6({type:"union",options:t,discriminator:e,...Le(n)})}const o6=ce("ZodIntersection",(e,t)=>{zL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>aU(e,n,a,s)});function u6(e,t){return new o6({type:"intersection",left:e,right:t})}const c6=ce("ZodRecord",(e,t)=>{ML.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>iU(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function un(e,t,n){return new c6({type:"record",keyType:e,valueType:t,...Le(n)})}const zy=ce("ZodEnum",(e,t)=>{DL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>XP(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const o={};for(const c of a)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new zy({...t,checks:[],...Le(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new zy({...t,checks:[],...Le(s),entries:o})}});function Pe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new zy({type:"enum",entries:n,...Le(t)})}const d6=ce("ZodLiteral",(e,t)=>{IL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>WP(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 qt(e,t){return new d6({type:"literal",values:Array.isArray(e)?e:[e],...Le(t)})}const f6=ce("ZodTransform",(e,t)=>{LL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eU(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new VC(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(fc(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(fc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function SN(e){return new f6({type:"transform",transform:e})}const kN=ce("ZodOptional",(e,t)=>{hN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>bN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function q1(e){return new kN({type:"optional",innerType:e})}const h6=ce("ZodExactOptional",(e,t)=>{PL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>bN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function m6(e){return new h6({type:"optional",innerType:e})}const p6=ce("ZodNullable",(e,t)=>{UL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Z1(e){return new p6({type:"nullable",innerType:e})}const g6=ce("ZodDefault",(e,t)=>{BL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>oU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function y6(e,t){return new g6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():XC(t)}})}const v6=ce("ZodPrefault",(e,t)=>{FL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>uU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function b6(e,t){return new v6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():XC(t)}})}const jN=ce("ZodNonOptional",(e,t)=>{$L.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>lU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function x6(e,t){return new jN({type:"nonoptional",innerType:e,...Le(t)})}const w6=ce("ZodCatch",(e,t)=>{HL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>cU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function S6(e,t){return new w6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const k6=ce("ZodPipe",(e,t)=>{qL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>dU(e,n,a,s),e.in=t.in,e.out=t.out});function My(e,t){return new k6({type:"pipe",in:e,out:t})}const j6=ce("ZodReadonly",(e,t)=>{ZL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>fU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function E6(e){return new j6({type:"readonly",innerType:e})}const C6=ce("ZodCustom",(e,t)=>{GL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>JP(e,n)});function N6(e,t={}){return BP(C6,e,t)}function _6(e){return FP(e)}function T6(e,t){return My(SN(e),t)}const Ls={custom:"custom"};function Sh(e){return SP(Gv,e)}const A6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function R6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function EN(e,t){const n=R6(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 f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const O6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,G1="/";function CN(e){return!e||typeof e!="string"||e.length>256||!O6.test(e)?"/":e}const z6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},NN=Pe(["feishu","slack","kael"]),_N=Pe(["active","inactive"]);re({platform:NN,agentId:N().min(1),credentials:un(N(),tn()),status:_N.default("active")});re({agentId:N().min(1).optional(),credentials:un(N(),tn()).optional(),status:_N.optional()});re({id:He(),platform:N(),agentId:N(),hasCredentials:Zn(),status:N(),createdAt:N(),updatedAt:N()});const M6=Pe(["code","reverse_token","oauth","manual"]);re({appId:N().min(1),appSecret:N().min(1)});re({platform:NN,externalUserId:N().min(1),agentId:N().min(1),boundVia:M6.default("manual"),displayName:N().max(200).optional()});re({id:He(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});re({feishuUserId:N().min(1),displayName:N().max(200).optional()});re({configId:He(),platform:N(),agentId:N(),appId:N(),connected:Zn(),lastActiveAt:N().nullable()});const D6=32e3,Vv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,I6=/^[A-Z][A-Z0-9_]*$/,TN=re({append:N().max(D6).default("")}),L6=re({name:N().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:qt("stdio"),command:N().min(1),args:lt(N()).optional()}),P6=re({name:N().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:qt("http"),url:N().url(),headers:un(N(),N()).optional()}),U6=re({name:N().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:qt("sse"),url:N().url(),headers:un(N(),N()).optional()}),AN=wh("transport",[L6,P6,U6]),RN=re({key:N().regex(I6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Zn().default(!1)}),Qv=re({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).optional()}),ON=re({prompt:TN.default({append:""}),model:N().default("opus"),mcpServers:lt(AN).default([]),env:lt(RN).default([]),gitRepos:lt(Qv).default([])}),B6=ON.extend({kind:qt("claude-code")}),F6=ON.extend({kind:qt("codex")}),$6=wh("kind",[B6,F6]),H6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:Ls.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,c)=>{a.has(o.key)&&t.addIssue({code:Ls.custom,path:["env",c,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const s=new Set;e.gitRepos.forEach((o,c)=>{const f=o.localPath??Vf(o.url);f&&(s.has(f)&&t.addIssue({code:Ls.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},zN=T6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,$6).superRefine((e,t)=>{H6(e,t)}),q6=re({agentId:N(),version:He().int().positive(),payload:zN,updatedAt:N(),updatedBy:N()}),MN=re({prompt:TN,model:N(),mcpServers:lt(AN),env:lt(RN),gitRepos:lt(Qv)}).partial();re({expectedVersion:He().int().positive(),payload:MN});re({payload:MN});re({current:q6,next:zN,diff:lt(re({path:N(),op:Pe(["add","remove","replace"]),before:tn().optional(),after:tn().optional()}))});const Gf="***";function Vf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const DN=Pe(["online","offline"]),IN=Pe(["idle","working","blocked","error"]);Pe(["active","suspended","evicted","errored"]);const Z6=Pe(["active","suspended","errored"]);re({chatId:N().min(1),state:Z6});re({runtimeState:IN});re({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});Pe(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);re({agentId:N(),status:DN,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:IN.nullable().optional(),activeSessions:He().int().nullable().optional(),totalSessions:He().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});re({total:He().int(),running:He().int(),byState:re({idle:He().int(),working:He().int(),blocked:He().int(),error:He().int()}),clients:He().int()});const Qf={CLAUDE_CODE:"claude-code",CODEX:"codex"},kh=Pe(["claude-code","codex"]),jh=Pe(["human","personal_assistant","autonomous_agent"]),V1={PRIVATE:"private",ORGANIZATION:"organization"},Kv=Pe(["private","organization"]),G6=Pe(["admin-api","portal"]);Pe(["active","suspended"]);const Dy=/^[a-z0-9][a-z0-9_-]{0,63}$/,Jl=64,V6=["admin","agent","first-tree","hub","me","null","system","undefined"],Q6=new Set(V6);function Iy(e){return Q6.has(e)}re({name:N().min(1).max(64).regex(Dy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Iy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:jh,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:G6.optional(),visibility:Kv.optional(),metadata:un(N(),tn()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:kh.optional(),gitRepos:lt(Qv).optional()});re({type:jh.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:Kv.optional(),metadata:un(N(),tn()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional()});re({clientId:N().min(1).max(100),runtimeProvider:kh,force:Zn().optional()});re({uuid:N(),name:N().nullable(),organizationId:N(),type:jh,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:Kv,metadata:un(N(),tn()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:kh,presenceStatus:DN.optional(),createdAt:N(),updatedAt:N()});re({repo:N().nullable(),branch:N().nullable()});re({type:qt("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:jh,runtimeProvider:kh});re({username:N().min(1),password:N().min(1)});re({accessToken:N(),refreshToken:N()});re({refreshToken:N().min(1)});re({token:N().min(1)});re({token:N(),expiresIn:He(),command:N()});const K6=["issue","pull_request","discussion","commit"],Yv=Pe(K6),Y6=re({source:qt("github"),entityType:Yv,entityKey:N().min(1),entityUrl:N().url().optional()}),X6=re({source:qt("feishu"),externalChannelId:N().min(1)}),W6=wh("source",[Y6,X6]),J6=xh([re({}).strict(),W6]),eB=Pe(["direct","group"]),Ly={ACTIVE:"active",ARCHIVED:"archived",DELETED:"deleted"},Xv=Pe(["active","archived","deleted"]);re({status:Xv});re({type:eB,topic:N().max(500).optional(),participantIds:lt(N()).min(1),metadata:J6.optional()});const LN=re({agentId:N(),role:N(),mode:N(),joinedAt:N()});LN.extend({name:N().nullable(),displayName:N(),type:N()});const tB=re({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:un(N(),tn()),createdAt:N(),updatedAt:N()});tB.extend({participants:lt(LN),title:N(),firstMessagePreview:N().nullable(),engagementStatus:Xv});re({topic:N().trim().max(500).nullable()});re({agentId:N().min(1)});re({agentId:N().min(1)});const nB=Pe(["connected","disconnected"]),rB=Pe(["ok","expired"]);re({id:N(),userId:N().nullable(),status:nB,authState:rB,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:He().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:un(N(),tn()).nullable()});const aB=re({wsInboxDeliver:Zn().default(!1)}).partial();re({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:aB.optional()});re({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:He().int().nonnegative()});const iB=Pe(["ok","missing","unauthenticated","error"]),sB=Pe(["api_key","oauth","auth_json","none"]),lB=re({state:iB,available:Zn(),authenticated:Zn(),sdkVersion:N().nullable().optional(),authMethod:sB,error:N().nullable().optional(),detectedAt:N()}),oB=un(N(),lB);re({capabilities:oB});re({limit:Sh().int().min(1).max(100).default(20),cursor:N().optional()});const uB=Pe(["active","stale","unavailable"]),cB=Pe(["ok","warning","error"]),dB=re({label:N(),detail:N().nullable(),severity:cB}),fB=Pe(["root","domain","subdomain","leaf"]),Wv=Pe(["added","edited","removed"]),hB=Pe(["parent","soft_link","markdown_link"]),mB=Pe(["low","medium","high"]),pB=re({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:fB,owners:lt(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:lt(N()),affectedContextArea:N(),changeType:Wv.nullable(),changedAtCommit:N().nullable()}),gB=re({source:N(),target:N(),kind:hB}),yB=re({path:N(),nodeId:N().nullable(),type:Wv,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),vB=re({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:Wv,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:lt(N()),relatedNodeIds:lt(N()),sourceCommit:N().nullable(),riskLevel:mB}),bB=re({addedCount:He().int().nonnegative(),editedCount:He().int().nonnegative(),removedCount:He().int().nonnegative(),changedNodeCount:He().int().nonnegative()});re({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:uB,contextStatus:dB,summary:bB,updates:lt(vB),nodes:lt(pB),edges:lt(gB),changes:lt(yB)});const xB=["User","Organization"],wB=Pe(xB),SB=["read","write","admin"],kB=Pe(SB),jB=un(N(),kB),EB=lt(N());re({login:N().optional(),accessToken:N().optional(),accessTokenExpiresAt:N().datetime({offset:!0}).optional(),refreshToken:N().optional(),refreshTokenExpiresAt:N().datetime({offset:!0}).optional()});re({installationId:He().int().positive()});re({installationId:He().int().positive(),accountType:wB,accountLogin:N(),accountGithubId:He().int().positive(),permissions:jB,events:EB,suspended:Zn(),manageUrl:N().url(),createdAt:N().datetime({offset:!0}),updatedAt:N().datetime({offset:!0})});const CB=["image/png","image/jpeg","image/gif","image/webp"],Jv=Pe(CB);re({data:N().min(1),mimeType:Jv,filename:N().min(1),size:He().int().nonnegative().optional(),imageId:N().uuid().optional()});re({imageId:N().uuid(),mimeType:Jv,filename:N().min(1),size:He().int().nonnegative().optional()});re({type:qt("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:Jv,filename:N().min(1),size:He().int().nonnegative().optional()});const eb=Pe(["hub_ui","cli","feishu","github","api"]),PN=Pe(["text","markdown","card","reference","file","question","question_answer"]);re({format:PN.default("text"),content:tn(),metadata:un(N(),tn()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:eb.optional()});re({format:PN.default("text"),content:tn(),metadata:un(N(),tn()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:eb.optional()});const NB=re({id:N(),chatId:N(),senderId:N(),format:N(),content:tn(),metadata:un(N(),tn()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:eb.nullable(),createdAt:N()}),_B=re({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),TB=Pe(["full","mention_only"]),AB=re({id:N(),senderId:N(),format:N(),content:tn(),metadata:un(N(),tn()).default({}),createdAt:N()}),UN=NB.extend({configVersion:He().int().positive(),recipientMode:TB.default("full"),inReplyToSnapshot:_B.default(null),precedingMessages:lt(AB).default([])});Pe(["pending","delivered","acked","failed"]);const RB=re({id:He(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:He(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});RB.extend({message:UN});re({limit:Sh().int().min(1).max(50).default(10)});re({type:qt("inbox:deliver"),entryId:He().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:UN}).passthrough();re({type:qt("inbox:ack"),entryId:He().int().nonnegative()});const OB=7;re({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});re({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});re({token:N().min(1)});re({}).optional();const zB=["all","unread","watching"],MB=Pe(zB),BN=Pe(["participant","watching"]),DB=["active","archived","all"],FN=Pe(DB);re({cursor:N().optional(),limit:Sh().int().min(1).max(200).default(50),filter:MB.default("all"),engagement:FN.default("active")});const IB=re({agentId:N(),displayName:N(),type:N()}),LB=re({chatId:N(),type:N(),membershipKind:BN,title:N(),topic:N().nullable(),participants:lt(IB),participantCount:He().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:He().int(),canReply:Zn(),engagementStatus:Xv,workingAgentIds:lt(N())});re({rows:lt(LB),nextCursor:N().nullable()});re({participantIds:lt(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});re({participantIds:lt(N().min(1)).min(1)});re({chatId:N(),lastReadAt:N(),unreadMentionCount:He().int()});re({chatId:N(),membershipKind:BN.nullable()});re({type:qt("chat:message"),chatId:N()});Pe(["connect","create_agent","completed"]);re({id:N(),name:N(),displayName:N(),role:Pe(["admin","member"])});re({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});re({dismissed:Zn().optional()});const PB=Pe(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);re({event:PB,attrs:un(N(),xh([N(),He(),Zn(),t6()])).optional()});re({id:N(),organizationId:N(),organizationName:N(),role:Pe(["admin","member"]),agentId:N()});const UB={ADMIN:"admin",MEMBER:"member"},tb=Pe(["admin","member"]),BB=re({id:N(),userId:N(),organizationId:N(),agentId:N(),role:tb,createdAt:N()});re({username:N().min(1).max(100),displayName:N().min(1).max(200),role:tb.default("member")});re({role:tb.optional(),displayName:N().min(1).max(200).optional()});BB.extend({username:N(),displayName:N(),password:N()});const FB=re({kind:qt("github-app-installation"),installationId:He().int(),organizationId:N().min(1)}),$B=["mentioned","review_requested","assigned"],HB=Pe($B),qB=["opened","edited","closed","merged","reopened","commented","review_requested","reviewed","review_comment","synchronized","commit_commented","assigned","other"],$N=Pe(qB),ZB=re({type:Yv,repo:N().min(1),key:N().min(1),title:N().optional(),url:N().optional()}),GB=re({githubLogin:N().min(1),isBot:Zn()}),VB=re({githubLogin:N().min(1),reason:HB}),QB=re({title:N(),body:N(),url:N()}),KB=re({type:qt("issue"),key:N().min(1)});re({source:FB,deliveryId:N().nullable(),rawEventType:N().min(1),rawAction:N().nullable(),entity:ZB,actor:GB,kind:$N,involves:lt(VB),surface:QB,relatedRefs:lt(KB)});const YB=["mentioned","review_requested","assigned","subscribed"],XB=Pe(YB);re({type:qt("github_event"),reason:XB,event:N().min(1),action:N().nullable(),kind:$N,repository:N(),sender:N(),title:N(),body:N(),url:N(),entity:re({type:Yv,key:N().min(1),url:N().nullable()}),mentionedUser:N().optional()});const WB=Pe(["agent_error","agent_blocked","agent_stale"]),HN=Pe(["high","medium","low"]);re({id:N(),organizationId:N(),type:WB,severity:HN,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Zn(),createdAt:N()});re({limit:Sh().int().min(1).max(100).default(20),cursor:N().optional(),severity:HN.optional(),read:Pe(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});re({next:N().max(256).optional()});re({code:N().min(1),state:N().min(1),installation_id:N().regex(/^\d+$/).optional(),setup_action:Pe(["install","update","request"]).optional()});re({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional(),installationId:N().regex(/^\d+$/).optional(),installationAccountType:Pe(["User","Organization"]).optional(),installationAccountLogin:N().min(1).optional(),installationAccountGithubId:N().regex(/^\d+$/).optional()});const JB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function e9(e){return e.includes("://")?!1:JB.test(e)}const Eh=N().min(1).superRefine((e,t)=>{if(e9(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:Ls.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:Ls.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:Ls.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:Ls.custom,message:"Repo URL must not include credentials."});return}}),t9=re({repo:Eh.optional(),branch:N().default("main")}),n9=re({repo:Eh.nullish(),branch:N().min(1).nullish()}),r9=re({repo:N().optional(),branch:N().optional()}),a9=re({repos:lt(re({url:Eh,defaultBranch:N().optional()})).default([])}),i9=re({repos:lt(re({url:Eh,defaultBranch:N().min(1).optional()})).optional()}),s9=re({repos:lt(re({url:N(),defaultBranch:N().optional()}))}),l9={context_tree:{storage:t9,input:n9,output:r9,readPolicy:"member"},source_repos:{storage:a9,input:i9,output:s9,readPolicy:"member"}},o9=Object.keys(l9);Pe(o9);const qN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;re({name:N().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=>!qN.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:He().int().min(0).default(0),maxMessagesPerMinute:He().int().min(0).default(0),features:un(N(),tn()).default({})});re({name:N().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=>!qN.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:He().int().min(0).optional(),maxMessagesPerMinute:He().int().min(0).optional(),features:un(N(),tn()).optional()});re({id:N(),name:N(),displayName:N(),maxAgents:He(),maxMessagesPerMinute:He(),features:un(N(),tn()),createdAt:N(),updatedAt:N()});const u9=re({workingCount:He().int().nonnegative(),errorMask:Zn()}),c9=re({type:qt("pulse:tick"),organizationId:N(),agents:un(N(),lt(u9).length(32))}),d9=re({label:N().min(1),description:N(),preview:N().nullable().optional()}),f9=re({question:N().min(1),header:N().min(1).max(24),options:lt(d9).min(2).max(4),multiSelect:Zn()}),h9=Pe(["html","markdown"]).nullable(),m9=re({correlationId:N().min(1),questions:lt(f9).min(1).max(4),previewFormat:h9,allowFreeText:Zn()}),p9=re({correlationId:N().min(1),answers:un(N().min(1),N())});re({answers:un(N().min(1),N())});Pe(["pending","answered","superseded"]);const g9=Pe(["tool_call","error","assistant_text","thinking","turn_end"]),ZN=re({toolUseId:N(),name:N(),args:tn(),status:Pe(["pending","ok","error"]),durationMs:He().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),GN=re({source:Pe(["sdk","runtime","tool"]),message:N().max(2e3)}),VN=re({text:N().max(8e3)}),QN=re({}),KN=re({status:Pe(["success","error"])}),y9=wh("kind",[re({kind:qt("tool_call"),payload:ZN}),re({kind:qt("error"),payload:GN}),re({kind:qt("assistant_text"),payload:VN}),re({kind:qt("thinking"),payload:QN}),re({kind:qt("turn_end"),payload:KN})]);re({id:N(),agentId:N(),chatId:N(),seq:He().int().positive(),kind:g9,payload:xh([ZN,GN,VN,QN,KN]),createdAt:N()});re({agentId:N(),chatId:N(),event:y9});re({type:qt("session:reconcile"),agentId:N().min(1),chatIds:lt(N().min(1)).max(500)});re({type:qt("session:reconcile:result"),agentId:N().min(1),staleChatIds:lt(N().min(1))});const v9=re({organizationId:N(),agentCount:He(),chatCount:He(),messageCount:He()});re({totalAgents:He(),totalChats:He(),totalMessages:He(),byOrganization:lt(v9)});const b9=Pe(["active","suspended"]);re({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:b9,createdAt:N(),updatedAt:N()});re({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});re({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});re({type:qt("auth"),token:N().min(1)});const x9=re({wsInboxDeliver:Zn().default(!1)}).partial();re({type:qt("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:He().int().nonnegative(),capabilities:x9.optional()}).passthrough();const YN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function w9(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 S9=2e3,k9=3e4;let Qi=null,hc=!1,Kf=0,Wu=null;const Py=new Set;let Fr=null,Ps=0;function j9(e){for(const t of Py)try{t(e)}catch{}if(Fr){if(e.type==="notification")Fr.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Fr.invalidateQueries({queryKey:["activity"]}),Fr.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Fr.invalidateQueries({queryKey:["me","chats"]}),t&&(Fr.invalidateQueries({queryKey:["chat-messages",t]}),Fr.invalidateQueries({queryKey:["chat-detail",t]}))}}}function nb(){const e=oh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Qi=s,s.onmessage=o=>{if(s===Qi)try{const c=JSON.parse(o.data);j9(c)}catch{}},s.onopen=()=>{s===Qi&&(Kf=0,Fr&&(Fr.invalidateQueries({queryKey:["notifications"]}),Fr.invalidateQueries({queryKey:["activity"]}),Fr.invalidateQueries({queryKey:["sessions"]}),Fr.invalidateQueries({queryKey:["me","chats"]})))},s.onclose=o=>{if(s===Qi&&(Qi=null,!(hc||Ps===0))){if(o.code===4001){vz().then(c=>{hc||Ps===0||(c?(Kf=0,nb()):Q1())});return}Q1()}}}function Q1(){Kf++;const e=Math.min(S9*2**(Kf-1),k9);Wu=setTimeout(()=>{Wu=null,!hc&&Ps>0&&nb()},e)}function E9(){hc=!0,Wu&&(clearTimeout(Wu),Wu=null),Qi&&(Qi.close(1e3,"unmount"),Qi=null)}function XN(e){const{onMessage:t,enabled:n=!0}=e??{},a=gn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Fr=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return Py.add(o),Ps++,Ps===1&&(hc=!1,nb()),()=>{Py.delete(o),Ps--,Ps===0&&E9()}},[n])}const C9=b.createContext({aggregated:YN,agents:{},receivedAtMs:null,stale:!0});function N9({children:e}){const[t,n]=b.useState({aggregated:YN,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());XN({onMessage:c=>{const f=c9.safeParse(c);f.success&&n({aggregated:w9(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),b.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=b.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(C9.Provider,{value:o,children:e})}function Ch(e){return Ee.get(`/agents/${e}/config`)}function Nh(e,t){return Ee.patch(`/agents/${e}/config`,t)}function _9(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function T9(e){return Ee.get(`/agents/${e}/client-status`)}function A9({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 R9({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 O9(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function z9({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const M9={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 Er({tone:e="neutral",className:t,style:n,...a}){const s=M9[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 Uy({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 rb({className:e,style:t,...n}){return l.jsx("span",{className:ze("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Ju({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 D9(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function mc({state:e,className:t}){const n=e!==null&&D9(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(Ju,{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 I9({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 L9(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),c=t.displayName||t.name||t.uuid;return l.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[l.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[l.jsx(To,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),l.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),l.jsxs("div",{children:[t.status==="active"?l.jsx(pg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(ye,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(pg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(ye,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(pg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:l.jsxs(ye,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[l.jsx(Uf,{className:"h-3 w-3"}),"Delete"]})})]}),l.jsx(P9,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(U9,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function pg(e){return l.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),l.jsx("div",{children:e.action})]})}function P9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsxs(zn,{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(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ye,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function U9({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(On,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsxs(zn,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Ft,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ye,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var B9="Label",WN=b.forwardRef((e,t)=>l.jsx(mi.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())}}));WN.displayName=B9;var F9=WN;const bt=b.forwardRef(({className:e,...t},n)=>l.jsx(F9,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));bt.displayName="Label";const En=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));En.displayName="Panel";const ca=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));ca.displayName="PanelHeader";const da=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));da.displayName="PanelTitle";const Jn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Jn.displayName="PanelBody";const $9={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 ab({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=$9[e],f=e==="deleted";return l.jsxs("div",{className:ze("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&l.jsx("span",{className:ze("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?l.jsxs(ye,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(PM,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(ye,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(_v,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(ye,{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 H9(e){const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=f=>s(m=>{const h=new Set(m);return h.has(f)?h.delete(f):h.add(f),h}),c=e.items.filter(f=>f.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ca,{children:[l.jsxs(da,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(wa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(f=>{const m=f.value.sensitive,h=f.value.value===Gf,p=m&&!h&&!!f.value.value,g=a.has(f.key);let x;return m?p&&g?x=f.value.value:x="••••••":x=f.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(ab,{status:f.status,onEdit:()=>n({mode:"edit",key:f.key,initial:f.value}),onDelete:()=>e.onDelete(f.key),onUndo:()=>e.onUndoDelete(f.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:f.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),m&&l.jsx(uh,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&l.jsx("button",{type:"button",onClick:()=>p&&o(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:p?g?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":g?"Hide value":"Reveal value",disabled:!p,style:{padding:0,opacity:p?1:.4},children:g?l.jsx(cM,{className:"h-3.5 w-3.5"}):l.jsx(kE,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&l.jsx(q9,{open:!!t,onOpenChange:f=>!f&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:f=>{t.mode==="edit"?e.onUpdate(t.key,f):e.onAdd(f),n(null)}})]})}function q9({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.key)??""),[f,m]=b.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,p]=b.useState((n==null?void 0:n.sensitive)??!1),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),p((n==null?void 0:n.sensitive)??!1),x(null))},[e,n]);function w(k){if(k.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){x(`Another entry already uses key "${o}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=Gf),!h&&!n&&!f){x("Value is required for non-sensitive entries.");return}s({key:o,value:j,sensitive:h})}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{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(bt,{htmlFor:"env-key",children:"Key"}),l.jsx(Ft,{id:"env-key",value:o,onChange:k=>c(k.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(bt,{htmlFor:"env-value",children:"Value"}),l.jsx(Ft,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:k=>m(k.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:k=>p(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function Z9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ca,{children:[l.jsxs(da,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(wa,{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(ab,{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(G9,{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 G9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),x(null))},[e,n]);function w(k){k.preventDefault();const j=o.trim();if(!j){x("URL is required.");return}const S=h.trim()||Vf(j);if(S&&a.has(S)){x(`Another repo already occupies local path "${S}".`);return}const C={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{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(bt,{htmlFor:"git-url",children:"URL"}),l.jsx(Ft,{id:"git-url",value:o,onChange:k=>c(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Ft,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Ft,{id:"git-path",value:h,onChange:k=>p(k.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."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function JN({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return l.jsx("span",{className:ze("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:s});const p=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,x=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?l.jsxs("span",{className:ze("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:p??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]}):l.jsxs("span",{className:ze("inline-flex items-baseline gap-1.5",o),style:c,title:p??void 0,children:[h&&l.jsx("span",{style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]})}function e_(){return Ee.get(Nn("/members"))}function V9(e,t){return Ee.patch(Nn(`/members/${encodeURIComponent(e)}`),t)}function Q9(e){return Ee.delete(Nn(`/members/${encodeURIComponent(e)}`))}function t_(){const{data:e}=Ke({queryKey:["members","name-map"],queryFn:e_,staleTime:3e4});return b.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function K9({agent:e,onSave:t}){const[n,a]=b.useState(!1),s=Uv(),o=t_(),c=e.metadata,f=c==null?void 0:c.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(x=>typeof x=="string"):[],p=e.managerId?o(e.managerId):null,g=e.delegateMention?s(e.delegateMention):null;return l.jsxs(En,{children:[l.jsxs(ca,{children:[l.jsx(da,{children:"Profile"}),e.status==="active"&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[l.jsx(_v,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(Jn,{className:"text-body space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&l.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),g&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-muted-foreground",children:["delegate ",l.jsx(JN,{name:g.name,displayName:g.displayName})]})]})]}),l.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsxs("span",{children:["owner ",l.jsx("span",{className:"text-foreground",children:p??"—"})]}),m&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:m})]}),l.jsxs("span",{children:["type ",l.jsx(Er,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(Er,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(x=>l.jsx(Er,{tone:"outline",children:x},x))})]})]})]}),l.jsx(Y9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function Y9({agent:e,open:t,onOpenChange:n,onSave:a}){var z;const{memberId:s,role:o}=vt(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[x,w]=b.useState(!1),[k,j]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),j(null))},[t,e]);const S=e.type==="human",C=o==="admin"||e.managerId===s,_=Ke({queryKey:["agents-for-delegate"],queryFn:async()=>(await Mc({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&S});async function R(P){P.preventDefault(),j(null);const O=c.trim();if(!O){j("Display name is required.");return}w(!0);try{const L={displayName:O,delegateMention:m||null};p!==e.visibility&&(L.visibility=p),await a(L),n(!1)}catch(L){j(L instanceof Error?L.message:String(L))}finally{w(!1)}}return l.jsx(On,{open:t,onOpenChange:n,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:R,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Agent name"}),l.jsx(Ft,{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(bt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Ft,{id:"id-display",value:c,onChange:P=>f(P.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:P=>g(P.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:V1.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:V1.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."})]}),S&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:P=>h(P.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=_.data)==null?void 0:z.map(P=>l.jsx("option",{value:P.uuid,children:P.displayName?`${P.displayName} (@${P.name??P.uuid})`:P.name?`@${P.name}`:P.uuid},P.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:x,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:x,children:x?"Saving…":"Save"})]})]})]})})}function X9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function W9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ca,{children:[l.jsxs(da,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(wa,{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(ab,{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(Er,{tone:X9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:J9(s.value)})]},s.key)})}),t&&l.jsx(eF,{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 J9(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 eF({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,x]=b.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,k]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,S]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),x((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),S(null))},[e,n]);function C(_){if(_.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){S("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){S(`Another MCP server is already named "${f}".`);return}let R;if(o==="stdio"){if(!h.trim()){S("stdio transport requires a command.");return}const z=g.trim().split(/\s+/).filter(P=>P.length>0);R={name:f,transport:"stdio",command:h.trim(),...z.length?{args:z}:{}}}else{const z=w.trim();try{new URL(z)}catch{S("URL is not valid.");return}R={name:f,transport:o,url:z}}s(R)}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{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(bt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:_=>c(_.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(bt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Ft,{id:"mcp-name",value:f,onChange:_=>m(_.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Ft,{id:"mcp-command",value:h,onChange:_=>p(_.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),l.jsx(Ft,{id:"mcp-args",value:g,onChange:_=>x(_.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Ft,{id:"mcp-url",value:w,onChange:_=>k(_.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&l.jsx("p",{className:"text-body text-destructive",children:j}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const tF=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],nF=[{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"}],rF={"claude-code":tF,codex:nF},aF={"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."},iF={value:"",label:"(unset — inherits local)"};function sF({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=rF[o],m=b.useMemo(()=>{const h=[iF,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(En,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ca,{children:[l.jsxs(da,{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(ye,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Jn,{className:"space-y-2",children:[l.jsx(lF,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:aF[o]})]})]})}function lF({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[c,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(x=>x.value===t)??e[0],g=b.useCallback(()=>{const x=m.current;if(!x)return;const w=x.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const x=j=>{var C,_;const S=j.target;(C=m.current)!=null&&C.contains(S)||(_=h.current)!=null&&_.contains(S)||o(!1)},w=j=>{var S;j.key==="Escape"&&(o(!1),(S=m.current)==null||S.focus())},k=()=>g();return document.addEventListener("pointerdown",x),document.addEventListener("keydown",w),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(x=>!x),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(jv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Ov.createPortal(l.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(x=>{const w=x.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(x.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:x.value===""?"var(--fg-3)":void 0},children:[l.jsx(cr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:x.label}),x.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:x.hint})]},x.value||"__unset")})}),document.body)]})}function oF(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const uF=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cF=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dF={};function K1(e,t){return(dF.jsx?cF:uF).test(e)}const fF=/[ \t\n\f\r]/g;function hF(e){return typeof e=="object"?e.type==="text"?Y1(e.value):!1:Y1(e)}function Y1(e){return e.replace(fF,"")===""}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 n_(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 By(e){return e.toLowerCase()}class Tr{constructor(t,n){this.attribute=n,this.property=t}}Tr.prototype.attribute="";Tr.prototype.booleanish=!1;Tr.prototype.boolean=!1;Tr.prototype.commaOrSpaceSeparated=!1;Tr.prototype.commaSeparated=!1;Tr.prototype.defined=!1;Tr.prototype.mustUseProperty=!1;Tr.prototype.number=!1;Tr.prototype.overloadedBoolean=!1;Tr.prototype.property="";Tr.prototype.spaceSeparated=!1;Tr.prototype.space=void 0;let mF=0;const Je=rl(),kn=rl(),Fy=rl(),be=rl(),Bt=rl(),ro=rl(),Pr=rl();function rl(){return 2**++mF}const $y=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:kn,commaOrSpaceSeparated:Pr,commaSeparated:ro,number:be,overloadedBoolean:Fy,spaceSeparated:Bt},Symbol.toStringTag,{value:"Module"})),gg=Object.keys($y);class ib extends Tr{constructor(t,n,a,s){let o=-1;if(super(t,n),X1(this,"space",s),typeof a=="number")for(;++o<gg.length;){const c=gg[o];X1(this,gg[o],(a&$y[c])===$y[c])}}}ib.prototype.defined=!0;function X1(e,t,n){n&&(e[t]=n)}function Ro(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new ib(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[By(a)]=a,n[By(o.attribute)]=a}return new Lc(t,n,e.space)}const r_=Ro({properties:{ariaActiveDescendant:null,ariaAtomic:kn,ariaAutoComplete:null,ariaBusy:kn,ariaChecked:kn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Bt,ariaCurrent:null,ariaDescribedBy:Bt,ariaDetails:null,ariaDisabled:kn,ariaDropEffect:Bt,ariaErrorMessage:null,ariaExpanded:kn,ariaFlowTo:Bt,ariaGrabbed:kn,ariaHasPopup:null,ariaHidden:kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bt,ariaLevel:be,ariaLive:null,ariaModal:kn,ariaMultiLine:kn,ariaMultiSelectable:kn,ariaOrientation:null,ariaOwns:Bt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:kn,ariaReadOnly:kn,ariaRelevant:null,ariaRequired:kn,ariaRoleDescription:Bt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:kn,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 a_(e,t){return t in e?e[t]:t}function i_(e,t){return a_(e,t.toLowerCase())}const pF=Ro({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ro,acceptCharset:Bt,accessKey:Bt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Bt,autoFocus:Je,autoPlay:Je,blocking:Bt,capture:null,charSet:null,checked:Je,cite:null,className:Bt,cols:be,colSpan:null,content:null,contentEditable:kn,controls:Je,controlsList:Bt,coords:be|ro,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:Fy,draggable:kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Bt,height:be,hidden:Fy,high:be,href:null,hrefLang:null,htmlFor:Bt,httpEquiv:Bt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Bt,itemRef:Bt,itemScope:Je,itemType:Bt,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:Bt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Bt,required:Je,reversed:Je,rows:be,rowSpan:be,sandbox:Bt,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:kn,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:kn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bt,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:kn,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:i_}),gF=Ro({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:Pr,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:Bt,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:ro,g2:ro,glyphName:ro,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:Pr,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:Bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pr,rev:Pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pr,requiredFeatures:Pr,requiredFonts:Pr,requiredFormats:Pr,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:Pr,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:Pr,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:Pr,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:a_}),s_=Ro({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()}}),l_=Ro({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:i_}),o_=Ro({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),yF={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"},vF=/[A-Z]/g,W1=/-[a-z]/g,bF=/^data[-\w.:]+$/i;function xF(e,t){const n=By(t);let a=t,s=Tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&bF.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(W1,SF);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!W1.test(o)){let c=o.replace(vF,wF);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=ib}return new s(a,t)}function wF(e){return"-"+e.toLowerCase()}function SF(e){return e.charAt(1).toUpperCase()}const kF=n_([r_,pF,s_,l_,o_],"html"),sb=n_([r_,gF,s_,l_,o_],"svg");function jF(e){return e.join(" ").trim()}var Hl={},yg,J1;function EF(){if(J1)return yg;J1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
388
- `,h="/",p="*",g="",x="comment",w="declaration";function k(S,C){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];C=C||{};var _=1,R=1;function z(J){var W=J.match(t);W&&(_+=W.length);var Z=J.lastIndexOf(m);R=~Z?J.length-Z:R+J.length}function P(){var J={line:_,column:R};return function(W){return W.position=new O(J),K(),W}}function O(J){this.start=J,this.end={line:_,column:R},this.source=C.source}O.prototype.content=S;function L(J){var W=new Error(C.source+":"+_+":"+R+": "+J);if(W.reason=J,W.filename=C.source,W.line=_,W.column=R,W.source=S,!C.silent)throw W}function I(J){var W=J.exec(S);if(W){var Z=W[0];return z(Z),S=S.slice(Z.length),W}}function K(){I(n)}function D(J){var W;for(J=J||[];W=Y();)W!==!1&&J.push(W);return J}function Y(){var J=P();if(!(h!=S.charAt(0)||p!=S.charAt(1))){for(var W=2;g!=S.charAt(W)&&(p!=S.charAt(W)||h!=S.charAt(W+1));)++W;if(W+=2,g===S.charAt(W-1))return L("End of comment missing");var Z=S.slice(2,W-2);return R+=2,z(Z),S=S.slice(W),R+=2,J({type:x,comment:Z})}}function se(){var J=P(),W=I(a);if(W){if(Y(),!I(s))return L("property missing ':'");var Z=I(o),ne=J({type:w,property:j(W[0].replace(e,g)),value:Z?j(Z[0].replace(e,g)):g});return I(c),ne}}function xe(){var J=[];D(J);for(var W;W=se();)W!==!1&&(J.push(W),D(J));return J}return K(),xe()}function j(S){return S?S.replace(f,g):g}return yg=k,yg}var ek;function CF(){if(ek)return Hl;ek=1;var e=Hl&&Hl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.default=n;const t=e(EF());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),f=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;f?s(h,p,m):p&&(o=o||{},o[h]=p)}),o}return Hl}var Lu={},tk;function NF(){if(tk)return Lu;tk=1,Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return Lu.camelCase=m,Lu}var Pu,nk;function _F(){if(nk)return Pu;nk=1;var e=Pu&&Pu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(CF()),n=NF();function a(s,o){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(c[(0,n.camelCase)(f,o)]=m)}),c}return a.default=a,Pu=a,Pu}var TF=_F();const AF=rh(TF),u_=c_("end"),lb=c_("start");function c_(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 RF(e){const t=lb(e),n=u_(e);if(t&&n)return{start:t,end:n}}function ec(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rk(e.position):"start"in e||"end"in e?rk(e):"line"in e||"column"in e?Hy(e):""}function Hy(e){return ak(e&&e.line)+":"+ak(e&&e.column)}function rk(e){return Hy(e&&e.start)+"-"+Hy(e&&e.end)}function ak(e){return e&&typeof e=="number"?e:1}class er extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(c=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=ec(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 ob={}.hasOwnProperty,OF=new Map,zF=/[A-Z]/g,MF=new Set(["table","tbody","thead","tfoot","tr"]),DF=new Set(["td","th"]),d_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IF(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=qF(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=HF(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"?sb:kF,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=f_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function f_(e,t,n){if(t.type==="element")return LF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return PF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BF(e,t,n);if(t.type==="mdxjsEsm")return UF(e,t);if(t.type==="root")return FF(e,t,n);if(t.type==="text")return $F(e,t)}function LF(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=sb,e.schema=s),e.ancestors.push(t);const o=m_(e,t.tagName,!1),c=ZF(e,t);let f=cb(e,t);return MF.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!hF(m):!0})),h_(e,c,o,t),ub(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function PF(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)}pc(e,t.position)}function UF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pc(e,t.position)}function BF(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=sb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:m_(e,t.name,!0),c=GF(e,t),f=cb(e,t);return h_(e,c,o,t),ub(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function FF(e,t,n){const a={};return ub(a,cb(e,t)),e.create(t,e.Fragment,a,n)}function $F(e,t){return t.value}function h_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function ub(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function HF(e,t,n){return a;function a(s,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function qF(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=lb(a);return t(s,o,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function ZF(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&ob.call(t.properties,s)){const o=VF(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&DF.has(t.tagName)?a=f:n[c]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function GF(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else pc(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else pc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function cb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:OF;for(;++a<t.children.length;){const o=t.children[a];let c;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const f=f_(e,o,c);f!==void 0&&n.push(f)}return n}function VF(e,t,n){const a=xF(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?oF(n):jF(n)),a.property==="style"){let s=typeof n=="object"?n:QF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=KF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?yF[a.property]||a.property:a.attribute,n]}}function QF(e,t){try{return AF(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=d_+"#cannot-parse-style-attribute",s}}function m_(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,c;for(;++o<s.length;){const f=K1(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=K1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return ob.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);pc(e)}function pc(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=d_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function KF(e){const t={};let n;for(n in e)ob.call(e,n)&&(t[YF(n)]=e[n]);return t}function YF(e){let t=e.replace(zF,XF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XF(e){return"-"+e.toLowerCase()}const vg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WF={};function db(e,t){const n=WF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return p_(e,a,s)}function p_(e,t,n){if(JF(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 ik(e.children,t,n)}return Array.isArray(e)?ik(e,t,n):""}function ik(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=p_(e[s],t,n);return a.join("")}function JF(e){return!!(e&&typeof e=="object")}const sk=document.createElement("i");function fb(e){const t="&"+e+";";sk.innerHTML=t;const n=sk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $r(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 aa(e,t){return e.length>0?($r(e,e.length,0,t),e):t}const lk={}.hasOwnProperty;function g_(e){const t={};let n=-1;for(;++n<e.length;)e$(t,e[n]);return t}function e$(e,t){let n;for(n in t){const s=(lk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){lk.call(s,c)||(s[c]=[]);const f=o[c];t$(s[c],Array.isArray(f)?f:f?[f]:[])}}}function t$(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);$r(e,0,0,a)}function y_(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 xa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ur=gs(/[A-Za-z]/),Wn=gs(/[\dA-Za-z]/),n$=gs(/[#-'*+\--9=?A-Z^-~]/);function Yf(e){return e!==null&&(e<32||e===127)}const qy=gs(/\d/),r$=gs(/[\dA-Fa-f]/),a$=gs(/[!-/:-@[-`{-~]/);function qe(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const _h=gs(new RegExp("\\p{P}|\\p{S}","u")),Xs=gs(/\s/);function gs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Oo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Wn(e.charCodeAt(n+1))&&Wn(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),s=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function xt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return dt(m)?(e.enter(n),f(m)):t(m)}function f(m){return dt(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const i$={tokenize:s$};function s$(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return qe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const l$={tokenize:o$},ok={tokenize:u$};function o$(e){const t=this,n=[];let a=0,s,o,c;return f;function f(R){if(a<n.length){const z=n[a];return t.containerState=z[1],e.attempt(z[0].continuation,m,h)(R)}return h(R)}function m(R){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&_();const z=t.events.length;let P=z,O;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){O=t.events[P][1].end;break}C(a);let L=z;for(;L<t.events.length;)t.events[L][1].end={...O},L++;return $r(t.events,P+1,0,t.events.slice(z)),t.events.length=L,h(R)}return f(R)}function h(R){if(a===n.length){if(!s)return x(R);if(s.currentConstruct&&s.currentConstruct.concrete)return k(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ok,p,g)(R)}function p(R){return s&&_(),C(a),x(R)}function g(R){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,k(R)}function x(R){return t.containerState={},e.attempt(ok,w,k)(R)}function w(R){return a++,n.push([t.currentConstruct,t.containerState]),x(R)}function k(R){if(R===null){s&&_(),C(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),j(R)}function j(R){if(R===null){S(e.exit("chunkFlow"),!0),C(0),e.consume(R);return}return qe(R)?(e.consume(R),S(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(R),j)}function S(R,z){const P=t.sliceStream(R);if(z&&P.push(null),R.previous=o,o&&(o.next=R),o=R,s.defineSkip(R.start),s.write(P),t.parser.lazy[R.start.line]){let O=s.events.length;for(;O--;)if(s.events[O][1].start.offset<c&&(!s.events[O][1].end||s.events[O][1].end.offset>c))return;const L=t.events.length;let I=L,K,D;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(K){D=t.events[I][1].end;break}K=!0}for(C(a),O=L;O<t.events.length;)t.events[O][1].end={...D},O++;$r(t.events,I+1,0,t.events.slice(L)),t.events.length=O}}function C(R){let z=n.length;for(;z-- >R;){const P=n[z];t.containerState=P[1],P[0].exit.call(t,e)}n.length=R}function _(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function u$(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function So(e){if(e===null||Lt(e)||Xs(e))return 1;if(_h(e))return 2}function Th(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 Zy={name:"attention",resolveAll:c$,tokenize:d$};function c$(e,t){let n=-1,a,s,o,c,f,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},x={...e[n][1].start};uk(g,-m),uk(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=aa(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=aa(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=aa(h,Th(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=aa(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=aa(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,$r(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function d$(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=So(a);let o;return c;function c(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),p=So(m),g=!p||p===2&&s||n.includes(m),x=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!x)),h._close=!!(o===42?x:x&&(p||!g)),t(m)}}function uk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const f$={name:"autolink",tokenize:h$};function h$(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||Wn(w)?(a=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Wn(w))&&a++<32?(e.consume(w),f):(a=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Yf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),p):n$(w)?(e.consume(w),h):n(w)}function p(w){return Wn(w)?g(w):n(w)}function g(w){return w===46?(e.consume(w),a=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||Wn(w))&&a++<63){const k=w===45?x:g;return e.consume(w),k}return n(w)}}const Pc={partial:!0,tokenize:m$};function m$(e,t,n){return a;function a(o){return dt(o)?xt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||qe(o)?t(o):n(o)}}const v_={continuation:{tokenize:g$},exit:y$,name:"blockQuote",tokenize:p$};function p$(e,t,n){const a=this;return s;function s(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return dt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function g$(e,t,n){const a=this;return s;function s(c){return dt(c)?xt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(v_,t,n)(c)}}function y$(e){e.exit("blockQuote")}const b_={name:"characterEscape",tokenize:v$};function v$(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 a$(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const x_={name:"characterReference",tokenize:b$};function b$(e,t,n){const a=this;let s=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Wn,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=r$,p):(e.enter("characterReferenceValue"),o=7,c=qy,p(g))}function p(g){if(g===59&&s){const x=e.exit("characterReferenceValue");return c===Wn&&!fb(a.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<o?(e.consume(g),p):n(g)}}const ck={partial:!0,tokenize:w$},dk={concrete:!0,name:"codeFenced",tokenize:x$};function x$(e,t,n){const a=this,s={partial:!0,tokenize:P};let o=0,c=0,f;return m;function m(O){return h(O)}function h(O){const L=a.events[a.events.length-1];return o=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===f?(c++,e.consume(O),p):c<3?n(O):(e.exit("codeFencedFenceSequence"),dt(O)?xt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||qe(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(ck,j,z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||qe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):dt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,w,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),x)}function w(O){return O===null||qe(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(O))}function k(O){return O===null||qe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?n(O):(e.consume(O),k)}function j(O){return e.attempt(s,z,S)(O)}function S(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return o>0&&dt(O)?xt(e,_,"linePrefix",o+1)(O):_(O)}function _(O){return O===null||qe(O)?e.check(ck,j,z)(O):(e.enter("codeFlowValue"),R(O))}function R(O){return O===null||qe(O)?(e.exit("codeFlowValue"),_(O)):(e.consume(O),R)}function z(O){return e.exit("codeFenced"),t(O)}function P(O,L,I){let K=0;return D;function D(W){return O.enter("lineEnding"),O.consume(W),O.exit("lineEnding"),Y}function Y(W){return O.enter("codeFencedFence"),dt(W)?xt(O,se,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):se(W)}function se(W){return W===f?(O.enter("codeFencedFenceSequence"),xe(W)):I(W)}function xe(W){return W===f?(K++,O.consume(W),xe):K>=c?(O.exit("codeFencedFenceSequence"),dt(W)?xt(O,J,"whitespace")(W):J(W)):I(W)}function J(W){return W===null||qe(W)?(O.exit("codeFencedFence"),L(W)):I(W)}}}function w$(e,t,n){const a=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const bg={name:"codeIndented",tokenize:k$},S$={partial:!0,tokenize:j$};function k$(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),xt(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):qe(h)?e.attempt(S$,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||qe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function j$(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):qe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):xt(e,o,"linePrefix",5)(c)}function o(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):qe(c)?s(c):n(c)}}const E$={name:"codeText",previous:N$,resolve:C$,tokenize:_$};function C$(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 N$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _$(e,t,n){let a=0,s,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):qe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||qe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class T${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&&Uu(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),Uu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Uu(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);Uu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Uu(this.left,n.reverse())}}}function Uu(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 w_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new T$(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,A$(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=p.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...p.get(s)[1].start},f=p.slice(s,n),f.unshift(a),p.splice(s,n-s+1,f))}}return $r(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function A$(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let p,g,x=-1,w=n,k=0,j=0;const S=[j];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(p=a.sliceStream(w),w.next||p.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=n;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(j=x+1,S.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):S.pop(),x=S.length;x--;){const C=f.slice(S[x],S[x+1]),_=o.pop();m.push([_,_+C.length-1]),e.splice(_,2,C)}for(m.reverse(),x=-1;++x<m.length;)h[k+m[x][0]]=k+m[x][1],k+=m[x][1]-m[x][0]-1;return h}const R$={resolve:z$,tokenize:M$},O$={partial:!0,tokenize:D$};function z$(e){return w_(e),e}function M$(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){return f===null?o(f):qe(f)?e.check(O$,c,o)(f):(e.consume(f),s)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function D$(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),xt(e,o,"linePrefix")}function o(c){if(c===null||qe(c))return n(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function S_(e,t,n,a,s,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),x):C===null||C===32||C===41||Yf(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(C))}function x(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),x(C)):C===null||C===60||qe(C)?n(C):(e.consume(C),C===92?k:w)}function k(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function j(C){return!p&&(C===null||C===41||Lt(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):p<h&&C===40?(e.consume(C),p++,j):C===41?(e.consume(C),p--,j):C===null||C===32||C===40||Yf(C)?n(C):(e.consume(C),C===92?S:j)}function S(C){return C===40||C===41||C===92?(e.consume(C),j):j(C)}}function k_(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(o),p}function p(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(o),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):qe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||qe(w)||f++>999?(e.exit("chunkString"),p(w)):(e.consume(w),m||(m=!dt(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function j_(e,t,n,a,s,o){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(a),e.enter(s),e.consume(x),e.exit(s),c=x===40?41:x,m):n(x)}function m(x){return x===c?(e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):(e.enter(o),h(x))}function h(x){return x===c?(e.exit(o),m(c)):x===null?n(x):qe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),xt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===c||x===null||qe(x)?(e.exit("chunkString"),h(x)):(e.consume(x),x===92?g:p)}function g(x){return x===c||x===92?(e.consume(x),p):p(x)}}function tc(e,t){let n;return a;function a(s){return qe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):dt(s)?xt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const I$={name:"definition",tokenize:P$},L$={partial:!0,tokenize:U$};function P$(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return k_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=xa(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 Lt(w)?tc(e,h)(w):h(w)}function h(w){return S_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(L$,g,g)(w)}function g(w){return dt(w)?xt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||qe(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function U$(e,t,n){return a;function a(f){return Lt(f)?tc(e,s)(f):n(f)}function s(f){return j_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return dt(f)?xt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||qe(f)?t(f):n(f)}}const B$={name:"hardBreakEscape",tokenize:F$};function F$(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return qe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const $$={name:"headingAtx",resolve:H$,tokenize:q$};function H$(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"},$r(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function q$(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||Lt(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||qe(p)?(e.exit("atxHeading"),t(p)):dt(p)?xt(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||Lt(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const Z$=["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"],fk=["pre","script","style","textarea"],G$={concrete:!0,name:"htmlFlow",resolveTo:K$,tokenize:Y$},V$={partial:!0,tokenize:W$},Q$={partial:!0,tokenize:X$};function K$(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 Y$(e,t,n){const a=this;let s,o,c,f,m;return h;function h(T){return p(T)}function p(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),x):T===47?(e.consume(T),o=!0,j):T===63?(e.consume(T),s=3,a.interrupt?t:M):ur(T)?(e.consume(T),c=String.fromCharCode(T),S):n(T)}function x(T){return T===45?(e.consume(T),s=2,w):T===91?(e.consume(T),s=5,f=0,k):ur(T)?(e.consume(T),s=4,a.interrupt?t:M):n(T)}function w(T){return T===45?(e.consume(T),a.interrupt?t:M):n(T)}function k(T){const G="CDATA[";return T===G.charCodeAt(f++)?(e.consume(T),f===G.length?a.interrupt?t:se:k):n(T)}function j(T){return ur(T)?(e.consume(T),c=String.fromCharCode(T),S):n(T)}function S(T){if(T===null||T===47||T===62||Lt(T)){const G=T===47,q=c.toLowerCase();return!G&&!o&&fk.includes(q)?(s=1,a.interrupt?t(T):se(T)):Z$.includes(c.toLowerCase())?(s=6,G?(e.consume(T),C):a.interrupt?t(T):se(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?_(T):R(T))}return T===45||Wn(T)?(e.consume(T),c+=String.fromCharCode(T),S):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:se):n(T)}function _(T){return dt(T)?(e.consume(T),_):D(T)}function R(T){return T===47?(e.consume(T),D):T===58||T===95||ur(T)?(e.consume(T),z):dt(T)?(e.consume(T),R):D(T)}function z(T){return T===45||T===46||T===58||T===95||Wn(T)?(e.consume(T),z):P(T)}function P(T){return T===61?(e.consume(T),O):dt(T)?(e.consume(T),P):R(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),m=T,L):dt(T)?(e.consume(T),O):I(T)}function L(T){return T===m?(e.consume(T),m=null,K):T===null||qe(T)?n(T):(e.consume(T),L)}function I(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Lt(T)?P(T):(e.consume(T),I)}function K(T){return T===47||T===62||dt(T)?R(T):n(T)}function D(T){return T===62?(e.consume(T),Y):n(T)}function Y(T){return T===null||qe(T)?se(T):dt(T)?(e.consume(T),Y):n(T)}function se(T){return T===45&&s===2?(e.consume(T),Z):T===60&&s===1?(e.consume(T),ne):T===62&&s===4?(e.consume(T),U):T===63&&s===3?(e.consume(T),M):T===93&&s===5?(e.consume(T),Ae):qe(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(V$,F,xe)(T)):T===null||qe(T)?(e.exit("htmlFlowData"),xe(T)):(e.consume(T),se)}function xe(T){return e.check(Q$,J,F)(T)}function J(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),W}function W(T){return T===null||qe(T)?xe(T):(e.enter("htmlFlowData"),se(T))}function Z(T){return T===45?(e.consume(T),M):se(T)}function ne(T){return T===47?(e.consume(T),c="",ke):se(T)}function ke(T){if(T===62){const G=c.toLowerCase();return fk.includes(G)?(e.consume(T),U):se(T)}return ur(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ke):se(T)}function Ae(T){return T===93?(e.consume(T),M):se(T)}function M(T){return T===62?(e.consume(T),U):T===45&&s===2?(e.consume(T),M):se(T)}function U(T){return T===null||qe(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),U)}function F(T){return e.exit("htmlFlow"),t(T)}}function X$(e,t,n){const a=this;return s;function s(c){return qe(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 W$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Pc,t,n)}}const J$={name:"htmlText",tokenize:e8};function e8(e,t,n){const a=this;let s,o,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),P):M===63?(e.consume(M),R):ur(M)?(e.consume(M),I):n(M)}function h(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),o=0,k):ur(M)?(e.consume(M),_):n(M)}function p(M){return M===45?(e.consume(M),w):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),x):qe(M)?(c=g,ne(M)):(e.consume(M),g)}function x(M){return M===45?(e.consume(M),w):g(M)}function w(M){return M===62?Z(M):M===45?x(M):g(M)}function k(M){const U="CDATA[";return M===U.charCodeAt(o++)?(e.consume(M),o===U.length?j:k):n(M)}function j(M){return M===null?n(M):M===93?(e.consume(M),S):qe(M)?(c=j,ne(M)):(e.consume(M),j)}function S(M){return M===93?(e.consume(M),C):j(M)}function C(M){return M===62?Z(M):M===93?(e.consume(M),C):j(M)}function _(M){return M===null||M===62?Z(M):qe(M)?(c=_,ne(M)):(e.consume(M),_)}function R(M){return M===null?n(M):M===63?(e.consume(M),z):qe(M)?(c=R,ne(M)):(e.consume(M),R)}function z(M){return M===62?Z(M):R(M)}function P(M){return ur(M)?(e.consume(M),O):n(M)}function O(M){return M===45||Wn(M)?(e.consume(M),O):L(M)}function L(M){return qe(M)?(c=L,ne(M)):dt(M)?(e.consume(M),L):Z(M)}function I(M){return M===45||Wn(M)?(e.consume(M),I):M===47||M===62||Lt(M)?K(M):n(M)}function K(M){return M===47?(e.consume(M),Z):M===58||M===95||ur(M)?(e.consume(M),D):qe(M)?(c=K,ne(M)):dt(M)?(e.consume(M),K):Z(M)}function D(M){return M===45||M===46||M===58||M===95||Wn(M)?(e.consume(M),D):Y(M)}function Y(M){return M===61?(e.consume(M),se):qe(M)?(c=Y,ne(M)):dt(M)?(e.consume(M),Y):K(M)}function se(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,xe):qe(M)?(c=se,ne(M)):dt(M)?(e.consume(M),se):(e.consume(M),J)}function xe(M){return M===s?(e.consume(M),s=void 0,W):M===null?n(M):qe(M)?(c=xe,ne(M)):(e.consume(M),xe)}function J(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Lt(M)?K(M):(e.consume(M),J)}function W(M){return M===47||M===62||Lt(M)?K(M):n(M)}function Z(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function ne(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ke}function ke(M){return dt(M)?xt(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Ae(M)}function Ae(M){return e.enter("htmlTextData"),c(M)}}const hb={name:"labelEnd",resolveAll:a8,resolveTo:i8,tokenize:s8},t8={tokenize:l8},n8={tokenize:o8},r8={tokenize:u8};function a8(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&&$r(e,0,e.length,n),e}function i8(e,t){let n=e.length,a=0,s,o,c,f;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=aa(f,e.slice(o+1,o+a+3)),f=aa(f,[["enter",p,t]]),f=aa(f,Th(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=aa(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=aa(f,e.slice(c+1)),f=aa(f,[["exit",m,t]]),$r(e,o,e.length,f),e}function s8(e,t,n){const a=this;let s=a.events.length,o,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return f;function f(x){return o?o._inactive?g(x):(c=a.parser.defined.includes(xa(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):n(x)}function m(x){return x===40?e.attempt(t8,p,c?p:g)(x):x===91?e.attempt(n8,p,c?h:g)(x):c?p(x):g(x)}function h(x){return e.attempt(r8,p,g)(x)}function p(x){return t(x)}function g(x){return o._balanced=!0,n(x)}}function l8(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return Lt(g)?tc(e,o)(g):o(g)}function o(g){return g===41?p(g):S_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Lt(g)?tc(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?j_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return Lt(g)?tc(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function o8(e,t,n){const a=this;return s;function s(f){return k_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(xa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function u8(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 c8={name:"labelStartImage",resolveAll:hb.resolveAll,tokenize:d8};function d8(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const f8={name:"labelStartLink",resolveAll:hb.resolveAll,tokenize:h8};function h8(e,t,n){const a=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const xg={name:"lineEnding",tokenize:m8};function m8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const Mf={name:"thematicBreak",tokenize:p8};function p8(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||qe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),dt(h)?xt(e,f,"whitespace")(h):f(h))}}const xr={continuation:{tokenize:b8},exit:w8,name:"list",tokenize:v8},g8={partial:!0,tokenize:S8},y8={partial:!0,tokenize:x8};function v8(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const k=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:qy(w)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Mf,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 qy(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:p,e.attempt(g8,x,g))}function p(w){return a.containerState.initialBlankLine=!0,o++,x(w)}function g(w){return dt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):n(w)}function x(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function b8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Pc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,xt(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!dt(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(y8,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,xt(e,e.attempt(xr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function x8(e,t,n){const a=this;return xt(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 w8(e){e.exit(this.containerState.type)}function S8(e,t,n){const a=this;return xt(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!dt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const hk={name:"setextUnderline",resolveTo:k8,tokenize:j8};function k8(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 j8(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,g;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){g=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),dt(h)?xt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||qe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const E8={tokenize:C8};function C8(e){const t=this,n=e.attempt(Pc,a,e.attempt(this.parser.constructs.flowInitial,s,xt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(R$,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 N8={resolveAll:C_()},_8=E_("string"),T8=E_("text");function E_(e){return{resolveAll:C_(e==="text"?A8:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,c,f);return c;function c(p){return h(p)?o(p):f(p)}function f(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function C_(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function A8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,c=-1,f=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const R8={42:xr,43:xr,45:xr,48:xr,49:xr,50:xr,51:xr,52:xr,53:xr,54:xr,55:xr,56:xr,57:xr,62:v_},O8={91:I$},z8={[-2]:bg,[-1]:bg,32:bg},M8={35:$$,42:Mf,45:[hk,Mf],60:G$,61:hk,95:Mf,96:dk,126:dk},D8={38:x_,92:b_},I8={[-5]:xg,[-4]:xg,[-3]:xg,33:c8,38:x_,42:Zy,60:[f$,J$],91:f8,92:[B$,b_],93:hb,95:Zy,96:E$},L8={null:[Zy,N8]},P8={null:[42,95]},U8={null:[]},B8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:P8,contentInitial:O8,disable:U8,document:R8,flow:M8,flowInitial:z8,insideSpan:L8,string:D8,text:I8},Symbol.toStringTag,{value:"Module"}));function F8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let c=[],f=[];const m={attempt:L(P),check:L(O),consume:_,enter:R,exit:z,interrupt:L(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(Y){return c=aa(c,Y),S(),c[c.length-1]!==null?[]:(I(t,0),h.events=Th(o,h.events,h),h.events)}function x(Y,se){return H8(w(Y),se)}function w(Y){return $8(c,Y)}function k(){const{_bufferIndex:Y,_index:se,line:xe,column:J,offset:W}=a;return{_bufferIndex:Y,_index:se,line:xe,column:J,offset:W}}function j(Y){s[Y.line]=Y.column,D()}function S(){let Y;for(;a._index<c.length;){const se=c[a._index];if(typeof se=="string")for(Y=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Y&&a._bufferIndex<se.length;)C(se.charCodeAt(a._bufferIndex));else C(se)}}function C(Y){p=p(Y)}function _(Y){qe(Y)?(a.line++,a.column=1,a.offset+=Y===-3?2:1,D()):Y!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=Y}function R(Y,se){const xe=se||{};return xe.type=Y,xe.start=k(),h.events.push(["enter",xe,h]),f.push(xe),xe}function z(Y){const se=f.pop();return se.end=k(),h.events.push(["exit",se,h]),se}function P(Y,se){I(Y,se.from)}function O(Y,se){se.restore()}function L(Y,se){return xe;function xe(J,W,Z){let ne,ke,Ae,M;return Array.isArray(J)?F(J):"tokenize"in J?F([J]):U(J);function U(ie){return ve;function ve(we){const me=we!==null&&ie[we],Me=we!==null&&ie.null,Ie=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return F(Ie)(we)}}function F(ie){return ne=ie,ke=0,ie.length===0?Z:T(ie[ke])}function T(ie){return ve;function ve(we){return M=K(),Ae=ie,ie.partial||(h.currentConstruct=ie),ie.name&&h.parser.constructs.disable.null.includes(ie.name)?q():ie.tokenize.call(se?Object.assign(Object.create(h),se):h,m,G,q)(we)}}function G(ie){return Y(Ae,M),W}function q(ie){return M.restore(),++ke<ne.length?T(ne[ke]):Z}}}function I(Y,se){Y.resolveAll&&!o.includes(Y)&&o.push(Y),Y.resolve&&$r(h.events,se,h.events.length-se,Y.resolve(h.events.slice(se),h)),Y.resolveTo&&(h.events=Y.resolveTo(h.events,h))}function K(){const Y=k(),se=h.previous,xe=h.currentConstruct,J=h.events.length,W=Array.from(f);return{from:J,restore:Z};function Z(){a=Y,h.previous=se,h.currentConstruct=xe,h.events.length=J,f=W,D()}}function D(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function $8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,o)];else{if(c=e.slice(n,s),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}o>0&&c.push(e[s].slice(0,o))}return c}function H8(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=`
389
- `;break}case-3:{c=`\r
390
- `;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 q8(e){const a={constructs:g_([B8,...(e||{}).extensions||[]]),content:s(i$),defined:[],document:s(l$),flow:s(E8),lazy:{},string:s(_8),text:s(T8)};return a;function s(o){return c;function c(f){return F8(a,o,f)}}}function Z8(e){for(;!w_(e););return e}const mk=/[\0\t\n\r]/g;function G8(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,x,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(mk.lastIndex=g,h=mk.exec(o),x=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(x),!h){t=o.slice(g);break}if(w===10&&g===x&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<x&&(m.push(o.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=x+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const V8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Q8(e){return e.replace(V8,K8)}function K8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return y_(n.slice(o?2:1),o?16:10)}return fb(n)||e}const N_={}.hasOwnProperty;function Y8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),X8(n)(Z8(q8(n).document().write(G8()(e,t,!0))))}function X8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Mt),autolinkProtocol:K,autolinkEmail:K,atxHeading:o(V),blockQuote:o(Me),characterEscape:K,characterReference:K,codeFenced:o(Ie),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ie,c),codeText:o(St,c),codeTextData:K,data:K,codeFlowValue:K,definition:o(tt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(it),hardBreakEscape:o(pe),hardBreakTrailing:o(pe),htmlFlow:o(_e,c),htmlFlowData:K,htmlText:o(_e,c),htmlTextData:K,image:o(Ue),label:c,link:o(Mt),listItem:o(hr),listItemValue:x,listOrdered:o(Pt,g),listUnordered:o(Pt),paragraph:o(gi),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(V),strong:o(yi),thematicBreak:o(fa)},exit:{atxHeading:m(),atxHeadingSequence:P,autolink:m(),autolinkEmail:me,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:ie,characterReference:ve,codeFenced:m(S),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:m(C),codeText:m(W),codeTextData:D,data:D,definition:m(),definitionDestinationString:z,definitionLabelString:_,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(se),hardBreakTrailing:m(se),htmlFlow:m(xe),htmlFlowData:D,htmlText:m(J),htmlTextData:D,image:m(ne),label:Ae,labelText:ke,lineEnding:Y,link:m(Z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:G,resourceDestinationString:M,resourceTitleString:U,resource:F,setextHeading:m(I),setextHeadingLineSequence:L,setextHeadingText:O,strong:m(),thematicBreak:m()}};__(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(oe){let ge={type:"root",children:[]};const $e={stack:[ge],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Ve=[];let st=-1;for(;++st<oe.length;)if(oe[st][1].type==="listOrdered"||oe[st][1].type==="listUnordered")if(oe[st][0]==="enter")Ve.push(st);else{const dn=Ve.pop();st=s(oe,dn,st)}for(st=-1;++st<oe.length;){const dn=t[oe[st][0]];N_.call(dn,oe[st][1].type)&&dn[oe[st][1].type].call(Object.assign({sliceSerialize:oe[st][2].sliceSerialize},$e),oe[st][1])}if($e.tokenStack.length>0){const dn=$e.tokenStack[$e.tokenStack.length-1];(dn[1]||pk).call($e,void 0,dn[0])}for(ge.position={start:Zi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Zi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<t.transforms.length;)ge=t.transforms[st](ge)||ge;return ge}function s(oe,ge,$e){let Ve=ge-1,st=-1,dn=!1,tr,Zt,Ut,At;for(;++Ve<=$e;){const ot=oe[Ve];switch(ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ot[0]==="enter"?st++:st--,At=void 0;break}case"lineEndingBlank":{ot[0]==="enter"&&(tr&&!At&&!st&&!Ut&&(Ut=Ve),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!st&&ot[0]==="enter"&&ot[1].type==="listItemPrefix"||st===-1&&ot[0]==="exit"&&(ot[1].type==="listUnordered"||ot[1].type==="listOrdered")){if(tr){let nr=Ve;for(Zt=void 0;nr--;){const Mn=oe[nr];if(Mn[1].type==="lineEnding"||Mn[1].type==="lineEndingBlank"){if(Mn[0]==="exit")continue;Zt&&(oe[Zt][1].type="lineEndingBlank",dn=!0),Mn[1].type="lineEnding",Zt=nr}else if(!(Mn[1].type==="linePrefix"||Mn[1].type==="blockQuotePrefix"||Mn[1].type==="blockQuotePrefixWhitespace"||Mn[1].type==="blockQuoteMarker"||Mn[1].type==="listItemIndent"))break}Ut&&(!Zt||Ut<Zt)&&(tr._spread=!0),tr.end=Object.assign({},Zt?oe[Zt][1].start:ot[1].end),oe.splice(Zt||Ve,0,["exit",tr,ot[2]]),Ve++,$e++}if(ot[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},ot[1].start),end:void 0};tr=nr,oe.splice(Ve,0,["enter",nr,ot[2]]),Ve++,$e++,Ut=void 0,At=!0}}}return oe[ge][1]._spread=dn,$e}function o(oe,ge){return $e;function $e(Ve){f.call(this,oe(Ve),Ve),ge&&ge.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,ge,$e){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ge,$e||void 0]),oe.position={start:Zi(ge.start),end:void 0}}function m(oe){return ge;function ge($e){oe&&oe.call(this,$e),h.call(this,$e)}}function h(oe,ge){const $e=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(ge?ge.call(this,oe,Ve[0]):(Ve[1]||pk).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+ec({start:oe.start,end:oe.end})+"): it’s not open");$e.position.end=Zi(oe.end)}function p(){return db(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(oe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=oe}function k(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/(\r?\n|\r)$/g,"")}function _(oe){const ge=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ge,$e.identifier=xa(this.sliceSerialize(oe)).toLowerCase()}function R(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function z(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function P(oe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const $e=this.sliceSerialize(oe).length;ge.depth=$e}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function L(oe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function K(oe){const $e=this.stack[this.stack.length-1].children;let Ve=$e[$e.length-1];(!Ve||Ve.type!=="text")&&(Ve=cn(),Ve.position={start:Zi(oe.start),end:void 0},$e.push(Ve)),this.stack.push(Ve)}function D(oe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(oe),ge.position.end=Zi(oe.end)}function Y(oe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const $e=ge.children[ge.children.length-1];$e.position.end=Zi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(K.call(this,oe),D.call(this,oe))}function se(){this.data.atHardBreak=!0}function xe(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function J(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function W(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function Z(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ne(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ke(oe){const ge=this.sliceSerialize(oe),$e=this.stack[this.stack.length-2];$e.label=Q8(ge),$e.identifier=xa(ge).toLowerCase()}function Ae(){const oe=this.stack[this.stack.length-1],ge=this.resume(),$e=this.stack[this.stack.length-1];if(this.data.inReference=!0,$e.type==="link"){const Ve=oe.children;$e.children=Ve}else $e.alt=ge}function M(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function U(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function F(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function G(oe){const ge=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ge,$e.identifier=xa(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function q(oe){this.data.characterReferenceType=oe.type}function ie(oe){const ge=this.sliceSerialize(oe),$e=this.data.characterReferenceType;let Ve;$e?(Ve=y_(ge,$e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=fb(ge);const st=this.stack[this.stack.length-1];st.value+=Ve}function ve(oe){const ge=this.stack.pop();ge.position.end=Zi(oe.end)}function we(oe){D.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(oe)}function me(oe){D.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(oe)}function Me(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function St(){return{type:"inlineCode",value:""}}function tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function V(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Ue(){return{type:"image",title:null,url:"",alt:null}}function Mt(){return{type:"link",title:null,url:"",children:[]}}function Pt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function hr(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function gi(){return{type:"paragraph",children:[]}}function yi(){return{type:"strong",children:[]}}function cn(){return{type:"text",value:""}}function fa(){return{type:"thematicBreak"}}}function Zi(e){return{line:e.line,column:e.column,offset:e.offset}}function __(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?__(e,a):W8(e,a)}}function W8(e,t){let n;for(n in t)if(N_.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 pk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ec({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ec({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ec({start:t.start,end:t.end})+") is still open")}function J8(e){const t=this;t.parser=n;function n(a){return Y8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eH(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 tH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
391
- `}]}function nH(e,t){const n=t.value?t.value+`
392
- `:"",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 rH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=Oo(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function sH(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 lH(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function T_(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 oH(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return T_(e,t);const s={src:Oo(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 uH(e,t){const n={src:Oo(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 cH(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 dH(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return T_(e,t);const s={href:Oo(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 fH(e,t){const n={href:Oo(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 hH(e,t,n){const a=e.all(t),s=n?mH(n):A_(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
393
- `}),p.type==="element"&&p.tagName==="p"&&!s?c.push(...p.children):c.push(p)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
394
- `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function mH(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=A_(n[a])}return t}function A_(e){const t=e.spread;return t??e.children.length>1}function pH(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 gH(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yH(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function vH(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bH(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=lb(t.children[1]),m=u_(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),s.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function xH(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let k={type:"element",tagName:o,properties:x,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),h.push(k)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function wH(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gk=9,yk=32;function SH(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(vk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(vk(t.slice(s),s>0,!1)),o.join("")}function vk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===gk||o===yk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===gk||o===yk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function kH(e,t){const n={type:"text",value:SH(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jH(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const EH={blockquote:eH,break:tH,code:nH,delete:rH,emphasis:aH,footnoteReference:iH,heading:sH,html:lH,imageReference:oH,image:uH,inlineCode:cH,linkReference:dH,link:fH,listItem:hH,list:pH,paragraph:gH,root:yH,strong:vH,table:bH,tableCell:wH,tableRow:xH,text:kH,thematicBreak:jH,toml:vf,yaml:vf,definition:vf,footnoteDefinition:vf};function vf(){}const R_=-1,Ah=0,nc=1,Xf=2,mb=3,pb=4,gb=5,yb=6,O_=7,z_=8,bk=typeof self=="object"?self:globalThis,CH=(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 Ah:case R_:return n(c,s);case nc:{const f=n([],s);for(const m of c)f.push(a(m));return f}case Xf:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case mb:return n(new Date(c),s);case pb:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case gb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case yb:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case O_:{const{name:f,message:m}=c;return n(new bk[f](m),s)}case z_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new bk[o](c),s)};return a},xk=e=>CH(new Map,e)(0),ql="",{toString:NH}={},{keys:_H}=Object,Bu=e=>{const t=typeof e;if(t!=="object"||!e)return[Ah,t];const n=NH.call(e).slice(8,-1);switch(n){case"Array":return[nc,ql];case"Object":return[Xf,ql];case"Date":return[mb,ql];case"RegExp":return[pb,ql];case"Map":return[gb,ql];case"Set":return[yb,ql];case"DataView":return[nc,n]}return n.includes("Array")?[nc,n]:n.includes("Error")?[O_,n]:[Xf,n]},bf=([e,t])=>e===Ah&&(t==="function"||t==="symbol"),TH=(e,t,n,a)=>{const s=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},o=c=>{if(n.has(c))return n.get(c);let[f,m]=Bu(c);switch(f){case Ah:{let p=c;switch(m){case"bigint":f=z_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([R_],c)}return s([f,p],c)}case nc:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),s([m,[...x]],c)}const p=[],g=s([f,p],c);for(const x of c)p.push(o(x));return g}case 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 p=[],g=s([f,p],c);for(const x of _H(c))(e||!bf(Bu(c[x])))&&p.push([o(x),o(c[x])]);return g}case mb:return s([f,c.toISOString()],c);case pb:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case gb:{const p=[],g=s([f,p],c);for(const[x,w]of c)(e||!(bf(Bu(x))||bf(Bu(w))))&&p.push([o(x),o(w)]);return g}case yb:{const p=[],g=s([f,p],c);for(const x of c)(e||!bf(Bu(x)))&&p.push(o(x));return g}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},wk=(e,{json:t,lossy:n}={})=>{const a=[];return TH(!(t||n),!!t,new Map,a)(e),a},Wf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xk(wk(e,t)):structuredClone(e):(e,t)=>xk(wk(e,t));function AH(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 RH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function OH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||AH,a=e.options.footnoteBackLabel||RH,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const p=e.all(h),g=String(h.identifier).toUpperCase(),x=Oo(g.toLowerCase());let w=0;const k=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++w<=j;){k.length>0&&k.push({type:"text",value:" "});let _=typeof n=="string"?n:n(m,w);typeof _=="string"&&(_={type:"text",value:_}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const _=S.children[S.children.length-1];_&&_.type==="text"?_.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...k)}else p.push(...k);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(p,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Wf(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
395
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
396
- `}]}}const Rh=(function(e){if(e==null)return IH;if(typeof e=="function")return Oh(e);if(typeof e=="object")return Array.isArray(e)?zH(e):MH(e);if(typeof e=="string")return DH(e);throw new Error("Expected function, string, or object as test")});function zH(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rh(e[n]);return Oh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function MH(e){const t=e;return Oh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function DH(e){return Oh(t);function t(n){return n&&n.type===e}}function Oh(e){return t;function t(n,a,s){return!!(LH(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function IH(){return!0}function LH(e){return e!==null&&typeof e=="object"&&"type"in e}const M_=[],PH=!0,Gy=!1,UH="skip";function D_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Rh(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,p){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=M_,k,j,S;if((!t||o(m,h,p[p.length-1]||void 0))&&(w=BH(n(m,p)),w[0]===Gy))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==UH)for(j=(a?C.children.length:-1)+c,S=p.concat(C);j>-1&&j<C.children.length;){const _=C.children[j];if(k=f(_,j,S)(),k[0]===Gy)return k;j=typeof k[1]=="number"?k[1]:j+c}}return w}}}function BH(e){return Array.isArray(e)?e:typeof e=="number"?[PH,e]:e==null?M_:[e]}function vb(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),D_(e,o,f,s);function f(m,h){const p=h[h.length-1],g=p?p.children.indexOf(m):void 0;return c(m,g,p)}}const Vy={}.hasOwnProperty,FH={};function $H(e,t){const n=t||FH,a=new Map,s=new Map,o=new Map,c={...EH,...n.handlers},f={all:h,applyData:qH,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:HH,wrap:GH};return vb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,x=String(p.identifier).toUpperCase();g.has(x)||g.set(x,p)}}),f;function m(p,g){const x=p.type,w=f.handlers[x];if(Vy.call(f.handlers,x)&&w)return w(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in p){const{children:j,...S}=p,C=Wf(S);return C.children=f.all(p),C}return Wf(p)}return(f.options.unknownHandler||ZH)(f,p,g)}function h(p){const g=[];if("children"in p){const x=p.children;let w=-1;for(;++w<x.length;){const k=f.one(x[w],p);if(k){if(w&&x[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Sk(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=Sk(j.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function HH(e,t){e.position&&(t.position=RF(e))}function qH(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 ZH(e,t){const n=t.data||{},a="value"in t&&!(Vy.call(n,"hProperties")||Vy.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 GH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
397
- `});++a<e.length;)a&&n.push({type:"text",value:`
398
- `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
399
- `}),n}function Sk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function kk(e,t){const n=$H(e,t),a=n.one(e,void 0),s=OH(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
400
- `},s),o}function VH(e,t){return e&&"run"in e?async function(n,a){const s=kk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return kk(n,{file:a,...e||t})}}function jk(e){if(e)throw e}var wg,Ek;function QH(){if(Ek)return wg;Ek=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var x;for(x in h);return typeof x>"u"||e.call(h,x)},c=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return wg=function m(){var h,p,g,x,w,k,j=arguments[0],S=1,C=arguments.length,_=!1;for(typeof j=="boolean"&&(_=j,j=arguments[1]||{},S=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});S<C;++S)if(h=arguments[S],h!=null)for(p in h)g=f(j,p),x=f(h,p),j!==x&&(_&&x&&(o(x)||(w=s(x)))?(w?(w=!1,k=g&&s(g)?g:[]):k=g&&o(g)?g:{},c(j,{name:p,newValue:m(_,k,x)})):typeof x<"u"&&c(j,{name:p,newValue:x}));return j},wg}var KH=QH();const Sg=rh(KH);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 YH(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...s);function f(m,...h){const p=e[++o];let g=-1;if(m){c(m);return}for(;++g<s.length;)(h[g]===null||h[g]===void 0)&&(h[g]=s[g]);s=h,p?XH(p,f)(...h):c(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function XH(e,t){let n;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(s);try{m=e.apply(this,c)}catch(h){const p=h;if(f&&n)throw p;return s(p)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(c,...f){n||(n=!0,t(c,...f))}function o(c){s(null,c)}}const _a={basename:WH,dirname:JH,extname:eq,join:tq,sep:"/"};function WH(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,f=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else c<0&&(o=!0,c=s+1),f>-1&&(e.codePointAt(s)===t.codePointAt(f--)?f<0&&(a=s):(f=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function JH(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 eq(e){Uc(e);let t=e.length,n=-1,a=0,s=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function tq(...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?".":nq(n)}function nq(e){Uc(e);const t=e.codePointAt(0)===47;let n=rq(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function rq(e,t){let n="",a=0,s=-1,o=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(s===c-1||o===1))if(s!==c-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=c,o=0;continue}}else if(n.length>0){n="",a=0,s=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),a=c-s-1;s=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function Uc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const aq={cwd:iq};function iq(){return"/"}function Ky(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function sq(e){if(typeof e=="string")e=new URL(e);else if(!Ky(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 lq(e)}function lq(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const kg=["history","path","basename","stem","extname","dirname"];class I_{constructor(t){let n;t?Ky(t)?n={path:t}:typeof t=="string"||oq(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":aq.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<kg.length;){const o=kg[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)kg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?_a.basename(this.path):void 0}set basename(t){Eg(t,"basename"),jg(t,"basename"),this.path=_a.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?_a.dirname(this.path):void 0}set dirname(t){Ck(this.basename,"dirname"),this.path=_a.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?_a.extname(this.path):void 0}set extname(t){if(jg(t,"extname"),Ck(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=_a.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ky(t)&&(t=sq(t)),Eg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?_a.basename(this.path,this.extname):void 0}set stem(t){Eg(t,"stem"),jg(t,"stem"),this.path=_a.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new er(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function jg(e,t){if(e&&e.includes(_a.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+_a.sep+"`")}function Eg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ck(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function oq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uq=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),cq={}.hasOwnProperty;class bb extends uq{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=YH()}copy(){const t=new bb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Sg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_g("data",this.frozen),this.namespace[t]=n,this):cq.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_g("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xf(t),a=this.parser||this.Parser;return Cg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Cg("process",this.parser||this.Parser),Ng("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=xf(t),m=a.parse(f);a.run(m,f,function(p,g,x){if(p||!g||!x)return h(p);const w=g,k=a.stringify(w,x);hq(k)?x.value=k:x.result=k,h(p,x)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Cg("processSync",this.parser||this.Parser),Ng("processSync",this.compiler||this.Compiler),this.process(t,s),_k("processSync","process",n),a;function s(o,c){n=!0,jk(o),a=c}}run(t,n,a){Nk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=xf(n);s.run(t,m,h);function h(p,g,x){const w=g||t;p?f(p):c?c(w):a(void 0,w,x)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),_k("runSync","run",a),s;function o(c,f){jk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=xf(n),s=this.compiler||this.Compiler;return Ng("stringify",s),Nk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(_g("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...g]=h;m(p,g)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=Sg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,x=-1;for(;++g<a.length;)if(a[g][0]===h){x=g;break}if(x===-1)a.push([h,...p]);else if(p.length>0){let[w,...k]=p;const j=a[x][1];Qy(j)&&Qy(w)&&(w=Sg(!0,j,w)),a[x]=[h,w,...k]}}}}const dq=new bb().freeze();function Cg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _g(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nk(e){if(!Qy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _k(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xf(e){return fq(e)?e:new I_(e)}function fq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function hq(e){return typeof e=="string"||mq(e)}function mq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tk=[],Ak={allowDangerousHtml:!0},gq=/^(https?|ircs?|mailto|xmpp)$/i,yq=[{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 vq(e){const t=bq(e),n=xq(e);return wq(t.runSync(t.parse(n),n),e)}function bq(e){const t=e.rehypePlugins||Tk,n=e.remarkPlugins||Tk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ak}:Ak;return dq().use(J8).use(n).use(VH,a).use(t)}function xq(e){const t=e.children||"",n=new I_;return typeof t=="string"&&(n.value=t),n}function wq(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||Sq;for(const p of yq)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+pq+p.id,void 0);return vb(e,h),IF(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,x){if(p.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let w;for(w in vg)if(Object.hasOwn(vg,w)&&Object.hasOwn(p.properties,w)){const k=p.properties[w],j=vg[w];(j===null||j.includes(p.tagName))&&(p.properties[w]=m(String(k||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(p,g,x)),w&&x&&typeof g=="number")return f&&p.children?x.children.splice(g,1,...p.children):x.children.splice(g,1),g}}}function Sq(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||gq.test(e.slice(0,t))?e:""}function kq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function L_(e,t,n){const s=Rh((n||{}).ignore||[]),o=jq(t);let c=-1;for(;++c<o.length;)D_(e,"text",f);function f(h,p){let g=-1,x;for(;++g<p.length;){const w=p[g],k=x?x.children:void 0;if(s(w,k?k.indexOf(w):void 0,x))return;x=w}if(x)return m(h,p)}function m(h,p){const g=p[p.length-1],x=o[c][0],w=o[c][1];let k=0;const S=g.children.indexOf(h);let C=!1,_=[];x.lastIndex=0;let R=x.exec(h.value);for(;R;){const z=R.index,P={index:R.index,input:R.input,stack:[...p,h]};let O=w(...R,P);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?x.lastIndex=z+1:(k!==z&&_.push({type:"text",value:h.value.slice(k,z)}),Array.isArray(O)?_.push(...O):O&&_.push(O),k=z+R[0].length,C=!0),!x.global)break;R=x.exec(h.value)}return C?(k<h.value.length&&_.push({type:"text",value:h.value.slice(k)}),g.children.splice(S,1,..._)):_=[h],S+_.length}}function jq(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([Eq(s[0]),Cq(s[1])])}return t}function Eq(e){return typeof e=="string"?new RegExp(kq(e),"g"):e}function Cq(e){return typeof e=="function"?e:function(){return e}}function Nq(e){L_(e,[/\r?\n|\r/g,_q])}function _q(){return{type:"break"}}function Tq(){return function(e){Nq(e)}}function Rk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Tg="phrasing",Ag=["autolink","link","image","label"];function Aq(){return{transforms:[Lq],enter:{literalAutolink:Oq,literalAutolinkEmail:Rg,literalAutolinkHttp:Rg,literalAutolinkWww:Rg},exit:{literalAutolink:Iq,literalAutolinkEmail:Dq,literalAutolinkHttp:zq,literalAutolinkWww:Mq}}}function Rq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Ag},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Ag},{character:":",before:"[ps]",after:"\\/",inConstruct:Tg,notInConstruct:Ag}]}}function Oq(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Rg(e){this.config.enter.autolinkProtocol.call(this,e)}function zq(e){this.config.exit.autolinkProtocol.call(this,e)}function Mq(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 Dq(e){this.config.exit.autolinkEmail.call(this,e)}function Iq(e){this.exit(e)}function Lq(e){L_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Pq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Uq]],{ignore:["link","linkReference"]})}function Pq(e,t,n,a,s){let o="";if(!P_(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!Bq(n)))return!1;const c=Fq(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function Uq(e,t,n,a){return!P_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Bq(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 Fq(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=Rk(e,"(");let o=Rk(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 P_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xs(n)||_h(n))&&(!t||n!==47)}U_.peek=Yq;function $q(){this.buffer()}function Hq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qq(){this.buffer()}function Zq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Gq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=xa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vq(e){this.exit(e)}function Qq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=xa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Kq(e){this.exit(e)}function Yq(){return"["}function U_(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=s.move("]"),o}function Xq(){return{enter:{gfmFootnoteCallString:$q,gfmFootnoteCall:Hq,gfmFootnoteDefinitionLabelString:qq,gfmFootnoteDefinition:Zq},exit:{gfmFootnoteCallString:Gq,gfmFootnoteCall:Vq,gfmFootnoteDefinitionLabelString:Qq,gfmFootnoteDefinition:Kq}}}function Wq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:U_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,c){const f=o.createTracker(c);let m=f.move("[^");const h=o.enter("footnoteDefinition"),p=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
401
- `:" ")+o.indentLines(o.containerFlow(a,f.current()),t?B_:Jq))),h(),m}}function Jq(e,t,n){return t===0?e:B_(e,t,n)}function B_(e,t,n){return(n?"":" ")+e}const e7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];F_.peek=i7;function t7(){return{canContainEols:["delete"],enter:{strikethrough:r7},exit:{strikethrough:a7}}}function n7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:e7}],handlers:{delete:F_}}}function r7(e){this.enter({type:"delete",children:[]},e)}function a7(e){this.exit(e)}function F_(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 i7(){return"~"}function s7(e){return e.length}function l7(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||s7,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const j=[],S=[];let C=-1;for(e[p].length>h&&(h=e[p].length);++C<e[p].length;){const _=o7(e[p][C]);if(n.alignDelimiters!==!1){const R=s(_);S[C]=R,(m[C]===void 0||R>m[C])&&(m[C]=R)}j.push(_)}c[p]=j,f[p]=S}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Ok(a[g]);else{const j=Ok(a);for(;++g<h;)o[g]=j}g=-1;const x=[],w=[];for(;++g<h;){const j=o[g];let S="",C="";j===99?(S=":",C=":"):j===108?S=":":j===114&&(C=":");let _=n.alignDelimiters===!1?1:Math.max(1,m[g]-S.length-C.length);const R=S+"-".repeat(_)+C;n.alignDelimiters!==!1&&(_=S.length+_+C.length,_>m[g]&&(m[g]=_),w[g]=_),x[g]=R}c.splice(1,0,x),f.splice(1,0,w),p=-1;const k=[];for(;++p<c.length;){const j=c[p],S=f[p];g=-1;const C=[];for(;++g<h;){const _=j[g]||"";let R="",z="";if(n.alignDelimiters!==!1){const P=m[g]-(S[g]||0),O=o[g];O===114?R=" ".repeat(P):O===99?P%2?(R=" ".repeat(P/2+.5),z=" ".repeat(P/2-.5)):(R=" ".repeat(P/2),z=R):z=" ".repeat(P)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(R),C.push(_),n.alignDelimiters!==!1&&C.push(z),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}k.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return k.join(`
402
- `)}function o7(e){return e==null?"":String(e)}function Ok(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 u7(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()),c7);return s(),c}function c7(e,t,n){return">"+(n?"":" ")+e}function d7(e,t){return zk(e,t.inConstruct,!0)&&!zk(e,t.notInConstruct,!1)}function zk(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 Mk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
403
- `&&d7(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
404
- `}function f7(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 h7(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 m7(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 p7(e,t,n,a){const s=m7(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(h7(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(o,g7);return g(),x}const f=n.createTracker(a),m=s.repeat(Math.max(f7(o,s)+1,3)),h=n.enter("codeFenced");let p=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${c}`);p+=f.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${c}`);p+=f.move(" "),p+=f.move(n.safe(e.meta,{before:p,after:`
405
- `,encode:["`"],...f.current()})),g()}return p+=f.move(`
406
- `),o&&(p+=f.move(o+`
407
- `)),p+=f.move(m),h(),p}function g7(e,t,n){return(n?"":" ")+e}function xb(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 y7(e,t,n,a){const s=xb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
408
- `,...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),c(),h}function v7(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 gc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Jf(e,t,n){const a=So(e),s=So(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}}$_.peek=b7;function $_(e,t,n,a){const s=v7(n),o=n.enter("emphasis"),c=n.createTracker(a),f=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=Jf(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=gc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Jf(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+gc(g));const w=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function b7(e,t,n){return n.options.emphasis||"*"}function x7(e,t){let n=!1;return vb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Gy}),!!((!e.depth||e.depth<3)&&db(e)&&(t.options.setext||n))}function w7(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(x7(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
409
- `,after:`
410
- `});return g(),p(),x+`
411
- `+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
412
- `))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
413
- `,...o.current()});return/^[\t ]/.test(h)&&(h=gc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}H_.peek=S7;function H_(e){return e.value||""}function S7(){return"<"}q_.peek=k7;function q_(e,t,n,a){const s=xb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),h+=m.move(")"),c(),h}function k7(){return"!"}Z_.peek=j7;function Z_(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function j7(){return"!"}G_.peek=E7;function G_(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function E7(){return"`"}function V_(e,t){const n=db(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))}Q_.peek=C7;function Q_(e,t,n,a){const s=xb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(V_(e,n)){const p=n.stack;n.stack=[],f=n.enter("autolink");let g=c.move("<");return g+=c.move(n.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),n.stack=p,g}f=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),m()),h+=c.move(")"),f(),h}function C7(e,t,n){return V_(e,n)?"<":"["}K_.peek=N7;function K_(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function N7(){return"["}function wb(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 _7(e){const t=wb(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 T7(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 Y_(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 A7(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?T7(n):wb(n);const f=e.ordered?c==="."?")":".":_7(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),Y_(n)===c&&p){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=o,s(),h}function R7(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 O7(e,t,n,a){const s=R7(n);let o=n.bulletCurrent||wb(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(c-o.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),p);return m(),h;function p(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?o:o+" ".repeat(c-o.length))+g}}function z7(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const M7=Rh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function D7(e,t,n,a){return(e.children.some(function(c){return M7(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function I7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}X_.peek=L7;function X_(e,t,n,a){const s=I7(n),o=n.enter("strong"),c=n.createTracker(a),f=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=Jf(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=gc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Jf(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+gc(g));const w=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function L7(e,t,n){return n.options.strong||"*"}function P7(e,t,n,a){return n.safe(e.value,a)}function U7(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 B7(e,t,n){const a=(Y_(n)+(n.options.ruleSpaces?" ":"")).repeat(U7(n));return n.options.ruleSpaces?a.slice(0,-1):a}const W_={blockquote:u7,break:Mk,code:p7,definition:y7,emphasis:$_,hardBreak:Mk,heading:w7,html:H_,image:q_,imageReference:Z_,inlineCode:G_,link:Q_,linkReference:K_,list:A7,listItem:O7,paragraph:z7,root:D7,strong:X_,text:P7,thematicBreak:B7};function F7(){return{enter:{table:$7,tableData:Dk,tableHeader:Dk,tableRow:q7},exit:{codeText:Z7,table:H7,tableData:Og,tableHeader:Og,tableRow:Og}}}function $7(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 H7(e){this.exit(e),this.data.inTable=void 0}function q7(e){this.enter({type:"tableRow",children:[]},e)}function Og(e){this.exit(e)}function Dk(e){this.enter({type:"tableCell",children:[]},e)}function Z7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,G7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function G7(e,t){return t==="|"?t:e}function V7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
414
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,k,j,S){return h(p(w,j,S),w.align)}function f(w,k,j,S){const C=g(w,j,S),_=h([C]);return _.slice(0,_.indexOf(`
415
- `))}function m(w,k,j,S){const C=j.enter("tableCell"),_=j.enter("phrasing"),R=j.containerPhrasing(w,{...S,before:o,after:o});return _(),C(),R}function h(w,k){return l7(w,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function p(w,k,j){const S=w.children;let C=-1;const _=[],R=k.enter("table");for(;++C<S.length;)_[C]=g(S[C],k,j);return R(),_}function g(w,k,j){const S=w.children;let C=-1;const _=[],R=k.enter("tableRow");for(;++C<S.length;)_[C]=m(S[C],w,k,j);return R(),_}function x(w,k,j){let S=W_.inlineCode(w,k,j);return j.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Q7(){return{exit:{taskListCheckValueChecked:Ik,taskListCheckValueUnchecked:Ik,paragraph:Y7}}}function K7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:X7}}}function Ik(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Y7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,c;for(;++o<s.length;){const f=s[o];if(f.type==="paragraph"){c=f;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function X7(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(c);let m=W_.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+c}}function W7(){return[Aq(),Xq(),t7(),F7(),Q7()]}function J7(e){return{extensions:[Rq(),Wq(e),n7(),V7(e),K7()]}}const eZ={tokenize:sZ,partial:!0},J_={tokenize:lZ,partial:!0},eT={tokenize:oZ,partial:!0},tT={tokenize:uZ,partial:!0},tZ={tokenize:cZ,partial:!0},nT={name:"wwwAutolink",tokenize:aZ,previous:aT},rT={name:"protocolAutolink",tokenize:iZ,previous:iT},pi={name:"emailAutolink",tokenize:rZ,previous:sT},Ma={};function nZ(){return{text:Ma}}let Ds=48;for(;Ds<123;)Ma[Ds]=pi,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);Ma[43]=pi;Ma[45]=pi;Ma[46]=pi;Ma[95]=pi;Ma[72]=[pi,rT];Ma[104]=[pi,rT];Ma[87]=[pi,nT];Ma[119]=[pi,nT];function rZ(e,t,n){const a=this;let s,o;return c;function c(g){return!Yy(g)||!sT.call(a,a.previous)||Sb(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Yy(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(tZ,p,h)(g):g===45||g===95||Wn(g)?(o=!0,e.consume(g),m):p(g)}function h(g){return e.consume(g),s=!0,m}function p(g){return o&&s&&ur(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function aZ(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!aT.call(a,a.previous)||Sb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(eZ,e.attempt(J_,e.attempt(eT,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function iZ(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&iT.call(a,a.previous)&&!Sb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(ur(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=s.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||Yf(g)||Lt(g)||Xs(g)||_h(g)?n(g):e.attempt(J_,e.attempt(eT,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function sZ(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 lZ(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(tT,m,f)(h):h===null||Lt(h)||Xs(h)||h!==45&&_h(h)?m(h):(o=!0,e.consume(h),c)}function f(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),c}function m(h){return s||a||!o?n(h):t(h)}}function oZ(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(tT,t,o)(c):c===null||Lt(c)||Xs(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function uZ(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||Lt(f)||Xs(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Lt(f)||Xs(f)?t(f):a(f)}function o(f){return ur(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):ur(f)?(e.consume(f),c):n(f)}}function cZ(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Wn(o)?n(o):t(o)}}function aT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function iT(e){return!ur(e)}function sT(e){return!(e===47||Yy(e))}function Yy(e){return e===43||e===45||e===46||e===95||Wn(e)}function Sb(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 dZ={tokenize:bZ,partial:!0};function fZ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:gZ,continuation:{tokenize:yZ},exit:vZ}},text:{91:{name:"gfmFootnoteCall",tokenize:pZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hZ,resolveTo:mZ}}}}function hZ(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return n(m);const h=xa(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 mZ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function pZ(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||Lt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return s.includes(xa(a.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Lt(g)||(c=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function gZ(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(k)}function p(k){if(c>999||k===93&&!f||k===null||k===91||Lt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=xa(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Lt(k)||(f=!0),c++,e.consume(k),k===92?g:p}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,p):p(k)}function x(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(o)||s.push(o),xt(e,w,"gfmFootnoteDefinitionWhitespace")):n(k)}function w(k){return t(k)}}function yZ(e,t,n){return e.check(Pc,t,e.attempt(dZ,t,n))}function vZ(e){e.exit("gfmFootnoteDefinition")}function bZ(e,t,n){const a=this;return xt(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 xZ(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",p,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&$r(x,x.length,0,Th(w,c.slice(h+1,m),f)),$r(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),$r(c,h-1,m-h+3,x),m=h+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,p=this.events;let g=0;return x;function x(k){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const j=So(h);if(k===126)return g>1?m(k):(c.consume(k),g++,w);if(g<2&&!n)return m(k);const S=c.exit("strikethroughSequenceTemporary"),C=So(k);return S._open=!C||C===2&&!!j,S._close=!j||j===2&&!!C,f(k)}}}class wZ{constructor(){this.map=[]}add(t,n,a){SZ(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 SZ(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 kZ(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 jZ(){return{flow:{null:{name:"table",tokenize:EZ,resolveAll:CZ}}}}function EZ(e,t,n){const a=this;let s=0,o=0,c;return f;function f(D){let Y=a.events.length-1;for(;Y>-1;){const J=a.events[Y][1].type;if(J==="lineEnding"||J==="linePrefix")Y--;else break}const se=Y>-1?a.events[Y][1].type:null,xe=se==="tableHead"||se==="tableRow"?O:m;return xe===O&&a.parser.lazy[a.now().line]?n(D):xe(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),h(D)}function h(D){return D===124||(c=!0,o+=1),p(D)}function p(D){return D===null?n(D):qe(D)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):n(D):dt(D)?xt(e,p,"whitespace")(D):(o+=1,c&&(c=!1,s+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),g(D)))}function g(D){return D===null||D===124||Lt(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?x:g)}function x(D){return D===92||D===124?(e.consume(D),g):g(D)}function w(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(D):(e.enter("tableDelimiterRow"),c=!1,dt(D)?xt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):k(D))}function k(D){return D===45||D===58?S(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),j):P(D)}function j(D){return dt(D)?xt(e,S,"whitespace")(D):S(D)}function S(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(o+=1,C(D)):D===null||qe(D)?z(D):P(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),_(D)):P(D)}function _(D){return D===45?(e.consume(D),_):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(D))}function R(D){return dt(D)?xt(e,z,"whitespace")(D):z(D)}function z(D){return D===124?k(D):D===null||qe(D)?!c||s!==o?P(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):P(D)}function P(D){return n(D)}function O(D){return e.enter("tableRow"),L(D)}function L(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),L):D===null||qe(D)?(e.exit("tableRow"),t(D)):dt(D)?xt(e,L,"whitespace")(D):(e.enter("data"),I(D))}function I(D){return D===null||D===124||Lt(D)?(e.exit("data"),L(D)):(e.consume(D),D===92?K:I)}function K(D){return D===92||D===124?(e.consume(D),I):I(D)}}function CZ(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,p,g;const x=new wZ;for(;++n<e.length;){const w=e[n],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Lk(x,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.add(n,0,[["enter",p,t]])),s=k.type==="tableDelimiterRow"?2:p?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g)),o=c,c=[o[1],n,0,0])):k.type==="tableHead"?(f=!0,m=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=wf(x,t,o,s,n,g)):c[1]!==0&&(g=wf(x,t,c,s,n,g)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Lk(x,t,m,h,p),x.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=kZ(t.events,n))}return e}function wf(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Ql(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Ql(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=Ql(t.events,n[2]),p=Ql(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),a!==2){const x=t.events[n[2]],w=t.events[n[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Ql(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Lk(e,t,n,a,s){const o=[],c=Ql(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 Ql(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const NZ={name:"tasklistCheck",tokenize:TZ};function _Z(){return{text:{91:NZ}}}function TZ(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 Lt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return qe(m)?t(m):dt(m)?e.check({tokenize:AZ},t,n)(m):n(m)}}function AZ(e,t,n){return xt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function RZ(e){return g_([nZ(),fZ(),xZ(e),jZ(),_Z()])}const OZ={};function zZ(e){const t=this,n=e||OZ,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(RZ(n)),o.push(W7()),c.push(J7(n))}function zh({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(vq,{remarkPlugins:[zZ,Tq],components:{a:({node:n,...a})=>l.jsx("a",{...a,target:"_blank",rel:"noopener noreferrer"})},children:e})})}function MZ({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=b.useState(!1),f=b.useRef(null),m=e!==t;return b.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),l.jsxs(En,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ca,{children:[l.jsxs(da,{children:["System prompt append",m&&l.jsx(DZ,{})]}),!o&&!s&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(_v,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Jn,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ye,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(ye,{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(zh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function DZ(){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 lT={"claude-code":"Claude Code",codex:"Codex"},IZ=[Qf.CLAUDE_CODE,Qf.CODEX];function LZ({open:e,onOpenChange:t,agent:n}){const a=gn(),s=n.clientId,o=n.runtimeProvider,[c,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),w=Ke({queryKey:["clients-rebind"],queryFn:di,enabled:e}).data??[],k=IR({queries:w.map(I=>({queryKey:["client-capabilities",I.id],queryFn:()=>ch(I.id),enabled:e}))}),j=b.useMemo(()=>{const I=new Map;return k.forEach((K,D)=>{const Y=w[D];if(!Y)return;const se=K.data;se!=null&&se.capabilities&&I.set(Y.id,se.capabilities)}),I},[k,w]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const S=c?j.get(c)??null:null,C=(S==null?void 0:S[m])??null,_=!C||C.state==="missing"||C.state==="error",R=!!c&&(c!==s||m!==o)&&(!_||p),z=m!==o,P=c!==s,O=mt({mutationFn:()=>{if(!c)throw new Error("clientId required");return u4(n.uuid,{clientId:c,runtimeProvider:m,force:_&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),L=O.error instanceof Js||O.error instanceof Error?O.error.message:null;return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(zn,{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:UZ(s,w,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:I=>f(I.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(I=>l.jsx("option",{value:I.id,children:PZ(I)},I.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:IZ.map(I=>{const K=(S==null?void 0:S[I])??null,D=!!K&&K.state!=="missing",Y=m===I;return l.jsxs("label",{className:Y?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":D?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[l.jsx("input",{type:"radio",name:"rebind-runtime",checked:Y,onChange:()=>h(I),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:lT[I]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:FZ(K,I)})]})]},I)})})]}),(P||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)."})]}),_&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange:I=>g(I.target.checked),className:"mt-0.5"}),l.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),L&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:L})]}),l.jsxs(fr,{children:[l.jsx(ye,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),l.jsx(ye,{onClick:()=>O.mutate(),disabled:!R||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function PZ(e){return`${e.hostname??e.id} · ${e.status}`}function UZ(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${lT[n]}`}const BZ={"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 FZ(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. ${BZ[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const $Z={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function HZ(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(Ju,{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:$Z[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(ye,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),l.jsx(ye,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(ye,{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(EE,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function rc(e){return`agent-cfg-${e}`}function Fu({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 qZ(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const ZZ={"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 GZ(e){const t=ZZ[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(VZ,{name:t.name,caption:t.caption,locked:!0}),l.jsx(QZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function VZ({name:e,caption:t,locked:n}){return l.jsxs(En,{children:[l.jsx(ca,{children:l.jsxs(da,{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(uh,{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(CE,{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 QZ(e){const t=!!e.computerLabel;return l.jsxs(En,{children:[l.jsxs(ca,{children:[l.jsx(da,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[l.jsx(ky,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:e.onRebind,children:[l.jsx(ky,{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 KZ(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 YZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function XZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function zg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Pk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:XZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Mg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=YZ(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Pk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Pk(f)}}),remove:a=>t(s=>{const c=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:c}})}}function WZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:zg(e.payload.mcpServers,"mcp"),env:zg(e.payload.env,"env"),git:zg(e.payload.gitRepos,"git")}}function JZ(e){const[t,n]=b.useState(null);b.useEffect(()=>{e&&t===null&&n(WZ(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",o=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,f=a.model!==o,m=b.useMemo(()=>{const R=[],z=I=>I.reduce((K,D)=>D.status==="unchanged"?K:K+1,0),P=z(a.mcp),O=z(a.env),L=z(a.git);return c&&R.push("prompt"),f&&R.push("model"),P>0&&R.push("mcp"),O>0&&R.push("env"),L>0&&R.push("git"),{anyDirty:R.length>0,dirtySections:R,counts:{prompt:c?1:0,model:f?1:0,mcp:P,env:O,git:L}}},[a,c,f]),h=b.useCallback(R=>{n(z=>z&&R(z))},[]),p=b.useCallback(R=>h(z=>({...z,promptAppend:R})),[h]),g=b.useCallback(()=>h(R=>({...R,promptAppend:s})),[h,s]),x=b.useCallback(R=>h(z=>({...z,model:R})),[h]),w=b.useCallback(()=>h(R=>({...R,model:o})),[h,o]),k=b.useMemo(()=>Mg("mcp",h),[h]),j=b.useMemo(()=>Mg("env",h),[h]),S=b.useMemo(()=>Mg("git",h),[h]),C=b.useCallback(()=>{n(null)},[]),_=b.useCallback(()=>{if(!t||!e)return{};const R={};c&&(R.prompt={append:t.promptAppend}),f&&(R.model=t.model);const z=m.counts.mcp>0,P=m.counts.env>0,O=m.counts.git>0;return z&&(R.mcpServers=t.mcp.filter(L=>L.status!=="deleted").map(L=>L.value)),P&&(R.env=t.env.filter(L=>L.status!=="deleted").map(L=>{const I=L.value;return I.sensitive&&I.value===Gf?{key:I.key,value:Gf,sensitive:!0}:I})),O&&(R.gitRepos=t.git.filter(L=>L.status!=="deleted").map(L=>L.value)),R},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:p,revertPrompt:g,setModel:x,revertModel:w,addMcp:k.add,updateMcp:k.update,deleteMcp:k.remove,undoDeleteMcp:k.undo,addEnv:j.add,updateEnv:j.update,deleteEnv:j.remove,undoDeleteEnv:j.undo,addGit:S.add,updateGit:S.update,deleteGit:S.remove,undoDeleteGit:S.undo,resetAll:C,buildPayloadPatch:_}}const Yn={overview:"ad-overview",setup:"ad-setup",prompt:rc("prompt"),tools:rc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function eG(e){const t=[{key:"overview",label:"Profile",anchor:Yn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Yn.setup},{key:"prompt",label:"Prompt",anchor:Yn.prompt},{key:"tools",label:"Tools",anchor:Yn.tools},{key:"advanced",label:"Advanced",anchor:Yn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Yn.danger,divider:!0,danger:!0}),t}function tG(){var At,ot,nr,Mn,il,ha,ma,Da,Vn,Ia,ka,Gt;const t=rE().uuid??"",n=Rn(),a=gn(),s=Ke({queryKey:["agent",t],queryFn:()=>s4(t),enabled:!!t}),o=Ke({queryKey:["agent-config",t],queryFn:()=>Ch(t),enabled:!!t&&((At=s.data)==null?void 0:At.type)!=="human"}),c=Ke({queryKey:["agent-client-status",t],queryFn:()=>T9(t),enabled:!!t&&((ot=s.data)==null?void 0:ot.type)!=="human"}),f=Ke({queryKey:["agent-sessions-active",t],queryFn:()=>GE(t,{state:"active"}),enabled:!!t&&((nr=s.data)==null?void 0:nr.type)!=="human"}),m=Ke({queryKey:["clients"],queryFn:di,enabled:!!t&&((Mn=s.data)==null?void 0:Mn.type)!=="human",refetchInterval:3e4}),h=JZ(o.data),[p,g]=b.useState(null),[x,w]=b.useState(null),[k,j]=b.useState(!1),S=mt({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const je=h.buildPayloadPatch();return Nh(t,{expectedVersion:o.data.version,payload:je})},onSuccess:je=>{a.setQueryData(["agent-config",t],je),g(null),w(null),j(!0)},onError:je=>{if(j(!1),je instanceof Js&&je.status===409){w("Someone else saved a newer version while you were editing."),g(null);return}g(je instanceof Error?je.message:String(je))}});b.useEffect(()=>{if(!k)return;const je=setTimeout(()=>j(!1),2500);return()=>clearTimeout(je)},[k]),b.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const C=b.useCallback(()=>{w(null),g(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),_=b.useCallback(je=>{const nt=document.getElementById(je);nt&&nt.scrollIntoView({behavior:"smooth",block:"start"})},[]),R=mt({mutationFn:je=>Ay(t,je),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),z=mt({mutationFn:()=>qC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),P=mt({mutationFn:()=>ZC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),O=mt({mutationFn:()=>HC(t),onSuccess:()=>n("/team")}),L=mt({mutationFn:()=>c4(t)}),[I,K]=b.useState(!1),[D,Y]=b.useState(""),[se,xe]=b.useState(null),[J,W]=b.useState(!1),Z=Ke({queryKey:["clients"],queryFn:di,enabled:I}),ne=mt({mutationFn:je=>Ay(t,{clientId:je}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),K(!1),Y(""),xe(null)},onError:je=>xe(je instanceof Error?je.message:String(je))}),[ke,Ae]=b.useState(!1),[M,U]=b.useState(null),F=mt({mutationFn:()=>_9(t,h.buildPayloadPatch()),onSuccess:je=>{const nt=je.diff.length?je.diff.map(yn=>`${yn.op} ${yn.path}`).join(`
416
- `):"(no changes)";U(nt)},onError:je=>U(`Dry run failed: ${je instanceof Error?je.message:String(je)}`)});b.useEffect(()=>{if(!h.summary.anyDirty)return;const je=nt=>{nt.preventDefault(),nt.returnValue=""};return window.addEventListener("beforeunload",je),()=>window.removeEventListener("beforeunload",je)},[h.summary.anyDirty]);const T=((il=s.data)==null?void 0:il.type)==="human",G=b.useMemo(()=>eG(T),[T]),q=b.useRef(null),[ie,ve]=b.useState(!1);b.useEffect(()=>{if(T)return;const je=q.current;if(!je||typeof IntersectionObserver>"u")return;const nt=new IntersectionObserver(yn=>{const Ar=yn[0];Ar&&ve(!Ar.isIntersecting&&Ar.boundingClientRect.top<0)},{threshold:0});return nt.observe(je),()=>nt.disconnect()},[T]);const[we,me]=b.useState(Yn.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const je=[];for(const nt of G){const yn=document.getElementById(nt.anchor);if(!yn)continue;const Ar=new IntersectionObserver(vi=>{for(const ys of vi)ys.isIntersecting&&me(nt.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Ar.observe(yn),je.push(Ar)}return()=>{for(const nt of je)nt.disconnect()}},[G]);const Me=b.useMemo(()=>{const je=new Set;for(const nt of h.summary.dirtySections)nt==="prompt"&&je.add(Yn.prompt),nt==="model"&&je.add(Yn.setup),nt==="mcp"&&je.add(Yn.tools),(nt==="env"||nt==="git")&&je.add(Yn.advanced);return je},[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 Ie=s.data;if(!Ie)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const St=Ie.type==="human",tt=c.data,it=((ha=f.data)==null?void 0:ha.length)??0,V=!St&&!(tt!=null&&tt.clientId),pe=!St&&tt?!tt.online&&!!tt.clientId:!1,_e=Ie,Ue=_e.runtimeState??null,Mt=_e.runtimeType??null,Pt=_e.totalSessions??null,hr=Ie.uuid.slice(0,8),gi=KZ({activeSessions:it,isUnclaimed:V,isOffline:pe}),yi=h.draft.mcp.filter(je=>je.status!=="deleted"),cn=h.draft.env.filter(je=>je.status!=="deleted"),fa=h.draft.git.filter(je=>je.status!=="deleted"),oe=je=>new Set(yi.filter(nt=>nt.key!==je).map(nt=>nt.value.name.toLowerCase())),ge=je=>new Set(cn.filter(nt=>nt.key!==je).map(nt=>nt.value.key)),$e=je=>new Set(fa.filter(nt=>nt.key!==je).map(nt=>{const{value:yn}=nt;return yn.localPath?yn.localPath:((yn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ve={sessions:Pt??"—",active:it,runtime:Mt??(St?"human":"—"),model:((Da=(ma=o.data)==null?void 0:ma.payload.model)==null?void 0:Da.trim())||"—"},st=(tt==null?void 0:tt.clientId)??null,dn=st?((Vn=m.data)==null?void 0:Vn.find(je=>je.id===st))??null:null,tr=st?(dn==null?void 0:dn.hostname)??st:null,Zt=Ie.runtimeProvider??"claude-code",Ut=Zt==="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(rb,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),G.map(je=>l.jsxs("div",{children:[je.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(nG,{label:je.label,active:we===je.anchor,danger:je.danger??!1,dirty:Me.has(je.anchor),onClick:()=>_(je.anchor)})]},je.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(A9,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(R9,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(O9,{}),l.jsx(z9,{mono:!0,children:Ie.name??hr})]}),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(Dc,{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_${hr}`,children:Ie.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Ie.name??hr]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(Er,{tone:Ie.type==="autonomous_agent"?"accent":"neutral",children:Ie.type}),Ie.visibility&&l.jsx(Er,{tone:Ie.visibility==="organization"?"accent":"outline",children:Ie.visibility}),(tt==null?void 0:tt.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",oc(tt.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(mc,{state:Ue}),l.jsxs(ye,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ie.uuid}`),children:[l.jsx(Nv,{className:"h-3 w-3"})," Open chat"]}),!St&&Ie.status==="active"&&l.jsxs(ye,{variant:"outline",size:"xs",onClick:()=>{L.reset(),L.mutate()},disabled:L.isPending,children:[l.jsx(CE,{className:"h-3 w-3"}),L.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}}),!St&&l.jsx(I9,{runtimeLabel:Ut,computerLabel:tr,visible:ie}),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:[(L.data||L.error)&&l.jsx(oG,{result:L.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>L.reset()}),l.jsx(Fu,{anchorId:Yn.overview,title:"Profile",right:l.jsxs(ye,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Ie.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(ky,{className:"h-3 w-3"}),"Manage bindings"]}),children:l.jsx(K9,{agent:Ie,onSave:async je=>{await R.mutateAsync(je)}})}),!St&&l.jsxs(l.Fragment,{children:[l.jsxs(Fu,{anchorId:Yn.setup,title:"Setup",caption:((Ia=o.data)==null?void 0:Ia.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(GZ,{runtimeProvider:Zt,computerLabel:tr,canBindComputer:V&&Ie.status==="active",bindComputerPending:ne.isPending,onBindComputer:()=>K(!0),onRebind:Ie.clientId?()=>W(!0):void 0,modelSlot:l.jsx(sF,{value:h.draft.model,baseline:((ka=o.data)==null?void 0:ka.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Ie.status!=="active",provider:Zt})})]}),l.jsx(Fu,{anchorId:Yn.prompt,title:"Prompt",children:o.data?l.jsx(MZ,{value:h.draft.promptAppend,baseline:((Gt=o.data)==null?void 0:Gt.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Ie.status!=="active"}):null}),l.jsx(Fu,{anchorId:Yn.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?l.jsx(W9,{items:h.draft.mcp,otherNames:oe,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Ie.status!=="active"}):null}),l.jsx(Fu,{anchorId:Yn.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:rc("env"),children:l.jsx(H9,{items:h.draft.env,otherKeys:ge,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Ie.status!=="active"})}),l.jsx("div",{id:rc("git"),children:l.jsx(Z9,{items:h.draft.git,otherPaths:$e,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Ie.status!=="active"})}),M&&l.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:M}),h.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>F.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:F.isPending,children:F.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),l.jsx(qZ,{}),l.jsx(L9,{agent:Ie,suspendPending:z.isPending,reactivatePending:P.isPending,deletePending:O.isPending,onSuspend:()=>z.mutate(),onReactivate:()=>P.mutate(),onDelete:()=>O.mutate()})]}),!St&&l.jsx(HZ,{summary:h.summary,saveHint:gi,conflictMessage:x,errorMessage:p,saving:S.isPending,justSaved:k,onSave:()=>S.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:je=>_(rc(je))})]}),l.jsx(rG,{open:ke,onOpenChange:Ae,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),g(null),w(null),Ae(!1)}}),l.jsx(On,{open:I,onOpenChange:je=>{K(je),je||(Y(""),xe(null),ne.reset())},children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{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."}),Z.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):Z.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",Z.error instanceof Error?Z.error.message:"Unknown"]}):l.jsx(aG,{clients:Z.data??[],selected:D,onSelect:Y}),se&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:se})]}),l.jsxs(fr,{children:[l.jsx(ye,{variant:"outline",onClick:()=>K(!1),children:"Cancel"}),l.jsx(ye,{disabled:!D||ne.isPending,onClick:()=>{xe(null),ne.mutate(D)},children:ne.isPending?"Binding…":"Bind"})]})]})}),l.jsx(LZ,{open:J,onOpenChange:W,agent:Ie})]})}function nG({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 rG(e){return l.jsx(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function aG({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 iG={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},sG={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},lG={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function oG({result:e,onDismiss:t}){const n=sG[e.status],a=lG[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(Er,{tone:a,children:iG[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(ye,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function uG(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 cG(){return this.eachAfter(uG)}function dG(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function fG(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 hG(e,t){for(var n=this,a=[n],s=[],o,c,f,m=-1;n=a.pop();)if(s.push(n),o=n.children)for(c=0,f=o.length;c<f;++c)a.push(o[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function mG(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function pG(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 gG(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function yG(e){for(var t=this,n=vG(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 vG(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 bG(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function xG(){return Array.from(this)}function wG(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function SG(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*kG(){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 oT(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=CG)):t===void 0&&(t=EG);for(var n=new ko(e),a,s=[n],o,c,f,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,f=m-1;f>=0;--f)s.push(o=c[f]=new ko(c[f])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(uT)}function jG(){return oT(this).eachBefore(NG)}function EG(e){return e.children}function CG(e){return Array.isArray(e)?e[1]:null}function NG(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function uT(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function ko(e){this.data=e,this.depth=this.height=0,this.parent=null}ko.prototype=oT.prototype={constructor:ko,count:cG,each:dG,eachAfter:hG,eachBefore:fG,find:mG,sum:pG,sort:gG,path:yG,ancestors:bG,descendants:xG,leaves:wG,links:SG,copy:jG,[Symbol.iterator]:kG};function Dg(e){return e==null?null:_G(e)}function _G(e){if(typeof e!="function")throw new Error;return e}var TG={depth:-1},Uk={},Ig={};function AG(e){return e.id}function RG(e){return e.parentId}function OG(){var e=AG,t=RG,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,p,g,x,w,k,j,S=new Map;if(n!=null){const C=o.map((z,P)=>zG(n(z,P,s))),_=C.map(Bk),R=new Set(C).add("");for(const z of _)R.has(z)||(R.add(z),C.push(z),_.push(Bk(z)),o.push(Ig));c=(z,P)=>C[P],f=(z,P)=>_[P]}for(p=0,m=o.length;p<m;++p)h=o[p],w=o[p]=new ko(h),(k=c(h,p,s))!=null&&(k+="")&&(j=w.id=k,S.set(j,S.has(j)?Uk:w)),(k=f(h,p,s))!=null&&(k+="")&&(w.parent=k);for(p=0;p<m;++p)if(w=o[p],k=w.parent){if(x=S.get(k),!x)throw new Error("missing: "+k);if(x===Uk)throw new Error("ambiguous: "+k);x.children?x.children.push(w):x.children=[w],w.parent=x}else{if(g)throw new Error("multiple roots");g=w}if(!g)throw new Error("no root");if(n!=null){for(;g.data===Ig&&g.children.length===1;)g=g.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Ig);--C)w.data=null}if(g.parent=TG,g.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(uT),g.parent=null,m>0)throw new Error("cycle");return g}return a.id=function(s){return arguments.length?(e=Dg(s),a):e},a.parentId=function(s){return arguments.length?(t=Dg(s),a):t},a.path=function(s){return arguments.length?(n=Dg(s),a):n},a}function zG(e){e=`${e}`;let t=e.length;return Xy(e,t-1)&&!Xy(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Bk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Xy(e,t););return e.slice(0,t)}function Xy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function MG(e,t){return e.parent===t.parent?1:2}function Lg(e){var t=e.children;return t?t[0]:e.t}function Pg(e){var t=e.children;return t?t[t.length-1]:e.t}function DG(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 IG(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 LG(e,t,n){return e.a.parent===t.parent?e.a:n}function Df(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}Df.prototype=Object.create(ko.prototype);function PG(e){for(var t=new Df(e,0),n,a=[t],s,o,c,f;n=a.pop();)if(o=n._.children)for(n.children=new Array(f=o.length),c=f-1;c>=0;--c)a.push(s=n.children[c]=new Df(o[c],c)),s.parent=n;return(t.parent=new Df(null,0)).children=[t],t}function UG(){var e=MG,t=1,n=1,a=null;function s(h){var p=PG(h);if(p.eachAfter(o),p.parent.m=-p.z,p.eachBefore(c),a)h.eachBefore(m);else{var g=h,x=h,w=h;h.eachBefore(function(_){_.x<g.x&&(g=_),_.x>x.x&&(x=_),_.depth>w.depth&&(w=_)});var k=g===x?1:e(g,x)/2,j=k-g.x,S=t/(x.x+k+j),C=n/(w.depth||1);h.eachBefore(function(_){_.x=(_.x+j)*S,_.y=_.depth*C})}return h}function o(h){var p=h.children,g=h.parent.children,x=h.i?g[h.i-1]:null;if(p){IG(h);var w=(p[0].z+p[p.length-1].z)/2;x?(h.z=x.z+e(h._,x._),h.m=h.z-w):h.z=w}else x&&(h.z=x.z+e(h._,x._));h.parent.A=f(h,x,h.parent.A||g[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,p,g){if(p){for(var x=h,w=h,k=p,j=x.parent.children[0],S=x.m,C=w.m,_=k.m,R=j.m,z;k=Pg(k),x=Lg(x),k&&x;)j=Lg(j),w=Pg(w),w.a=h,z=k.z+_-x.z-S+e(k._,x._),z>0&&(DG(LG(k,h,g),h,z),S+=z,C+=z),_+=k.m,S+=x.m,R+=j.m,C+=w.m;k&&!Pg(w)&&(w.t=k,w.m+=_-C),x&&!Lg(j)&&(j.t=x,j.m+=S-R,g=h)}return g}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function BG(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(vy(e,`/context-tree/snapshot${n}`))}function eh({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 al({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 cT=[{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 FG({previewSnapshot:e}={}){const{organizationId:t}=vt(),[n,a]=b.useState("7d"),[s,o]=b.useState(null),[c,f]=b.useState(null),m=e!==void 0,h=Ke({queryKey:["context-tree-snapshot",t,n,m],queryFn:()=>{if(!t)throw new Error("No organization selected");return BG(t,n)},enabled:!m&&!!t}),p=e??h.data,g=b.useMemo(()=>p?p.updates.find(k=>k.id===s)??p.updates[0]??null:null,[s,p]),x=b.useMemo(()=>p&&g!=null&&g.nodeId?p.nodes.find(k=>k.id===g.nodeId)??null:null,[g,p]),w=c??(g==null?void 0:g.nodeId)??(x==null?void 0:x.id)??null;return b.useEffect(()=>{var k;p&&(s&&p.updates.some(j=>j.id===s)||o(((k=p.updates[0])==null?void 0:k.id)??null))},[s,p]),l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[!m&&h.isLoading?l.jsx(XG,{}):null,!m&&h.error?l.jsx(WG,{message:h.error instanceof Error?h.error.message:"Failed to load"}):null,p&&(m||!h.isLoading)?p.snapshotStatus==="unavailable"?l.jsx(fT,{snapshot:p}):l.jsxs(l.Fragment,{children:[l.jsx($G,{snapshot:p}),l.jsx(HG,{snapshot:p,window:n,onWindowChange:a}),l.jsx(qG,{snapshot:p,selectedUpdate:g,selectedUpdateNode:x,selectedOverviewNodeId:w,onSelectUpdate:k=>{o(k.id),f(k.nodeId)},onSelectOverviewNode:f})]}):null]})]})}function $G({snapshot:e}){const t=e.contextStatus.severity==="ok"?l.jsx(nM,{size:18}):l.jsx(To,{size:18}),n=e.contextStatus.label,a=fV(e);return l.jsx(En,{children:l.jsx(Jn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex items-start",style:{gap:"var(--sp-2)",minWidth:0},children:[l.jsx("span",{style:{color:dV(e.contextStatus.severity),flex:"0 0 auto",marginTop:"var(--sp-0_5)"},children:t}),l.jsxs("div",{style:{minWidth:0,flex:1},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:n}),a?l.jsx("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:a}):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."})]})]})})})}function HG({snapshot:e,window:t,onWindowChange:n}){const a=cV(t);return l.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:[l.jsx("legend",{className:"sr-only",children:"Context update window"}),cT.map(s=>l.jsx(eh,{active:s.value===t,onClick:()=>n(s.value),children:s.label},s.value))]}),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 ${a}`}),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"})]})]})}function qG({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=f=>{o(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-3)",alignItems:"stretch"},children:[l.jsxs(En,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsx(ca,{children:l.jsx(da,{children:"Context Updates"})}),l.jsx(Jn,{className:"flex-1",style:{padding:0,overflow:"auto"},children:e.updates.length===0?l.jsx("div",{style:{padding:"var(--sp-3) var(--sp-3_5)"},children:l.jsx(hT,{})}):e.updates.map((f,m)=>l.jsx(ZG,{update:f,selected:f.id===(t==null?void 0:t.id),isLast:m===e.updates.length-1,onClick:()=>s(f)},f.id))})]}),l.jsx(GG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(VG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function ZG({update:e,selected:t,isLast:n,onClick:a}){return l.jsx("button",{type:"button",onClick:a,className:"block w-full text-left transition-colors",style:{background:t?"var(--bg-sunken)":"transparent",borderBottom:n?"none":"var(--hairline) solid var(--border-faint)",padding:"var(--sp-2) var(--sp-3_5)"},children:l.jsx("div",{className:"flex items-start",style:{gap:"var(--sp-2)",minWidth:0},children:l.jsxs("div",{style:{minWidth:0,flex:1},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(dT,{type:e.changeType}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:gV(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",pT(e.path)," · ",SV(e.owners),e.relatedNodeIds.length>0?` · ${kV(e.relatedNodeIds.length)}`:""]})]})})})}function GG({update:e,node:t,snapshot:n}){const[a,s]=b.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(g=>n.nodes.find(x=>x.id===g)).filter(g=>!!g),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,f=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?wV(e.owners):"No owner",h=o&&o.length>0?o.map(g=>g.title||g.path||"root"):[],p=e?jV(e.path)||pT(e.path):"root";return l.jsxs(En,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsxs(ca,{children:[l.jsx(da,{children:"Selected Change"}),e?l.jsx(dT,{type:e.changeType}):null]}),l.jsx(Jn,{className:"flex-1",style:{overflow:"auto"},children:e?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},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:[yV(e)," · ",mV(e.changeType)," · ",p]}),l.jsx("div",{className:"text-label font-mono",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),l.jsx(KG,{value:vV(e),impact:pV(e)}),l.jsx(YG,{commit:f,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(g=>!g)}})]}):l.jsx(hT,{})})]})}function VG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const[a,s]=b.useState(()=>new Set),o=b.useMemo(()=>uV(e.nodes),[e.nodes]),c=b.useMemo(()=>nV(e.nodes,t,o,a),[t,e.nodes,o,a]),f=b.useRef(null),m=b.useCallback(S=>{if(!S)return;const C=f.current;if(!C)return;const _=S.getBoundingClientRect(),R=C.getBoundingClientRect();if(_.top>=R.top&&_.bottom<=R.bottom)return;const z=_.top-R.top-(R.height-_.height)/2;C.scrollBy({top:z})},[]),h=b.useCallback(S=>{s(C=>{const _=new Set(C);return _.has(S)?_.delete(S):_.add(S),_})},[]),p=Math.max(760,...c.map(S=>S.x+280)),g=Math.max(280,...c.map(S=>S.y+48)),x=g+24,w=560,k=x>w,j=sV(e.nodes,t);return l.jsxs(En,{children:[l.jsx(ca,{children:l.jsxs("div",{children:[l.jsxs(da,{children:[l.jsx(hM,{size:17}),"Where Context Changed"]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Numbers = updated areas under each branch."})]})}),l.jsx(Jn,{children:c.length===0?l.jsx(fT,{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:j??"No update selected"})]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx($u,{color:"var(--accent)",label:"Selected path"}),l.jsx($u,{color:"var(--ok)",label:"Added"}),l.jsx($u,{color:"var(--warn)",label:"Edited"}),l.jsx($u,{color:"var(--danger)",label:"Removed"}),l.jsx($u,{color:"var(--bg-raised)",label:"Quiet"})]})]}),l.jsx("div",{ref:f,style:{overflow:k?"auto":"hidden",maxHeight:k?`${w}px`:void 0,minHeight:`${Math.min(x,w)}px`},children:l.jsxs("svg",{viewBox:`0 0 ${p} ${g}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${x}px`},children:[c.map(S=>!S.parent||S.isSummary&&S.isExpanded?null:l.jsx("line",{x1:S.parent.x,y1:S.parent.y,x2:S.x,y2:S.y,stroke:S.selectedPath&&S.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:S.muted?.34:S.selectedPath?.72:.56,strokeWidth:S.selectedPath&&S.parent.selectedPath?1.6:1},`edge:${S.id}`)),c.map(S=>{const C=S.isSummary||S.sourceNodeId!==null,_=()=>{S.isSummary&&S.parentId?h(S.parentId):S.sourceNodeId&&n(S.sourceNodeId)};return l.jsx("foreignObject",{x:S.x-10,y:S.y-15,width:p-S.x-8,height:30,children:l.jsxs("button",{ref:S.selected?m:void 0,type:"button",disabled:!C,"aria-expanded":S.isSummary?S.isExpanded:void 0,onClick:_,className:"flex w-full items-center text-left text-label transition-colors",style:{background:"transparent",color:S.muted?"var(--fg-3)":"var(--fg)",cursor:C?"pointer":"default",gap:"var(--sp-2)",opacity:S.muted?.66:1,padding:"0 var(--sp-1)"},onMouseEnter:R=>{C&&(R.currentTarget.style.background="var(--bg-sunken)")},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:[S.isSummary?l.jsx(SE,{size:12,style:{color:"var(--fg-4)",flex:"0 0 auto",transform:S.isExpanded?"rotate(90deg)":void 0,transition:"transform 120ms"}}):l.jsx("span",{"aria-hidden":"true",style:{width:S.selected?"var(--sp-4)":"var(--sp-3)",height:S.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:EV(S),border:`${S.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${S.selected?"var(--accent)":CV(S)}`,flex:"0 0 auto"}}),l.jsx("span",{className:S.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.title}),S.updateCount>0&&!S.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:S.updateCount}):null]})},S.id)})]})})]})})]})}function $u({color:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{"aria-hidden":"true",style:{background:e,border:"var(--hairline) solid var(--border-strong)",borderRadius:"50%",height:"var(--sp-2)",width:"var(--sp-2)"}}),l.jsx("span",{children:t})]})}function 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?Mh(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function QG({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?Mh(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 dT({type:e}){return l.jsx(QG,{label:hV(e),tone:e})}function KG({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 YG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:o,onTogglePreview:c}){const f=[{label:"Owner",value:a},...n.length>0?[{label:"Linked",value:n.join(", ")}]:[],{label:"Source",value:e,mono:!0},{label:"Commit",value:t,mono:!0}];return l.jsxs("div",{children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Reference"}),l.jsx("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:f.map((m,h)=>l.jsxs("span",{className:"inline-flex items-baseline",style:{gap:"var(--sp-1)",minWidth:0},children:[h>0?l.jsx("span",{"aria-hidden":"true",style:{color:"var(--fg-4)"},children:"·"}):null,l.jsx("span",{style:{color:"var(--fg-3)"},children:m.label}),l.jsx("span",{className: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-2_5)"},children:[l.jsx(ye,{variant:"outline",size:"xs",onClick:c,children:o?"Hide source":"Preview source"}),l.jsxs(ye,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[l.jsx(Ev,{size:14}),"Copy path"]})]}),o?l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:s?l.jsx(zh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function XG(){return l.jsx(En,{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(RM,{size:17}),"Loading team context..."]})})})}function WG({message:e}){return l.jsx(En,{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(To,{size:17}),e]})})})}function fT({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?JG(e.repo):null;return l.jsx(En,{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(To,{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 JG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function hT(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const eV=1,tV=3;function nV(e,t,n,a){const s=rV(e,t,n,a);if(s.length===0)return[];const o=OG().id(p=>p.id).parentId(p=>p.parentId)(s).sort((p,g)=>p.data.isSummary!==g.data.isSummary?p.data.isSummary?-1:1:p.data.path.localeCompare(g.data.path)),f=UG().nodeSize([30,170])(o).descendants(),m=Math.min(...f.map(p=>p.x));return f.map(p=>({...p.data,x:28+p.y,y:28+p.x-m,parent:null})).map((p,g,x)=>({...p,parent:p.parentId?x.find(w=>w.id===p.parentId)??null:null}))}function rV(e,t,n,a){const s=new Map(e.map(j=>[j.id,j])),o=e.filter(j=>!j.parentId||s.has(j.parentId)).sort((j,S)=>j.path.localeCompare(S.path));if(o.length===0)return[];const c=aV(o),f=iV(t,s),m=new Set,h=new Map;for(const j of o){const S=mT(j,s,h),C=n.get(j.id)??0;(S<=eV||f.has(j.id)||C>0&&S<=tV)&&lV(j.id,s,m)}let p=!0;for(;p;){p=!1;for(const j of[...m]){const S=(c.get(j)??[]).filter(C=>!m.has(C.id));if(S.length===1){const C=S[0];C&&(m.add(C.id),p=!0)}}}const g=new Set(m);for(const j of a)if(g.has(j))for(const S of c.get(j)??[])g.add(S.id);const x=f.size>0,w=o.filter(j=>g.has(j.id)).map(j=>{const S=n.get(j.id)??0,C=f.has(j.id);return{id:j.id,parentId:j.parentId&&g.has(j.parentId)?j.parentId:null,sourceNodeId:j.id,title:j.title,path:j.path,changeType:j.changeType,updateCount:S,isSummary:!1,isExpanded:!1,selected:t===j.id,selectedPath:C,muted:x&&!C&&S===0}}),k=[];for(const j of o){if(!g.has(j.id))continue;const S=(c.get(j.id)??[]).filter(R=>!m.has(R.id));if(S.length===0)continue;const C=a.has(j.id),_=S.filter(R=>(n.get(R.id)??0)>0).length;k.push({id:`summary:${j.id}`,parentId:j.id,sourceNodeId:null,title:C?"Show less":oV(S.length,_),path:`${j.path}/~summary`,changeType:null,updateCount:_,isSummary:!0,isExpanded:C,selected:!1,selectedPath:f.has(j.id),muted:x&&!f.has(j.id)})}return[...w,...k]}function aV(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 iV(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 sV(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 lV(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function mT(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?mT(s,t,n)+1:0;return n.set(e.id,o),o}function oV(e,t){return t>0?`Show ${e} more · ${t} changed`:`Show ${e} more`}function uV(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 cV(e){var t;return((t=cT.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function dV(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function fV(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 hV(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function mV(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function pV(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 gV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function yV(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function vV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=xV(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function bV(e){return e.summary.replace(/^updated:\s*/i,"")}function xV(e){const t=bV(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 wV(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function SV(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function kV(e){return`${e} linked context${e===1?"":"s"}`}function jV(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(gT).join(" / ")}function pT(e){return e.split("/").filter(Boolean).map(gT).join(" / ")||"root"}function gT(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function Mh(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function EV(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType?Mh(e.changeType):e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}function CV(e){return e.changeType?Mh(e.changeType):"var(--border-strong)"}const zo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));zo.displayName="Card";const Mo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex flex-col space-y-1.5 p-6",e),...t}));Mo.displayName="CardHeader";const Bc=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-subtitle leading-none",e),...t}));Bc.displayName="CardTitle";const yT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));yT.displayName="CardDescription";const Do=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("p-6 pt-0",e),...t}));Do.displayName="CardContent";const NV=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));NV.displayName="CardFooter";function _V(){const{token:e}=rE(),t=Rn(),{isAuthenticated:n,adoptTokens:a}=vt(),[s,o]=b.useState(null),[c,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const S=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!S.ok){f("This invitation is no longer valid");return}o(await S.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const S=await Ee.get("/me/organizations"),C=await Ee.get("/me"),_=S.find(R=>R.id===C.member.organizationId);g((_==null?void 0:_.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(Fk,{message:"Bad invitation URL"});if(c)return l.jsx(Fk,{message:"This invitation is no longer valid"});if(!s)return l.jsx(TV,{});const x=async()=>{h(!0);try{const S=await Ee.post("/me/organizations/join",{token:e});await a(S.tokens),pE("invite"),t("/",{replace:!0})}catch(S){f(S instanceof Error?S.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&p&&p!==s.organizationDisplayName,j=AV(s.expiresAt);return l.jsx(kb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsx(Mo,{className:"text-center",children:l.jsxs(Bc,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(Do,{className:"space-y-4",children:[k&&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(To,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsxs("span",{children:["You'll switch from ",l.jsx("span",{className:"font-medium",children:p})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(ye,{className:"w-full",disabled:m,onClick:x,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(ye,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:w,children:[l.jsx(jE,{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 kb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(kv,{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 TV(){return l.jsx(kb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{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(Do,{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 Fk({message:e}){return l.jsx(kb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(To,{className:"h-6 w-6"})}),l.jsx(Bc,{className:"text-title",children:e})]}),l.jsxs(Do,{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(ye,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Rc,{to:"/",children:[l.jsx(kv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function AV(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 RV(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=CN(s);return o===G1&&s!==G1?null:o}function OV(){const{isAuthenticated:e}=vt(),t=Cr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=RV(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?l.jsx(or,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(kv,{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(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Dc,{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(Do,{className:"space-y-4",children:[l.jsx(ye,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(jE,{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(ye,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(ZM,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function zV(){const e=Rn(),{adoptTokens:t}=vt(),[n,a]=b.useState(null);return b.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),c=o.get("access"),f=o.get("refresh"),m=CN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&pE(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const yc=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:ze("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));yc.displayName="DenseTable";const vc=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));vc.displayName="DenseTableHeader";const bc=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));bc.displayName="DenseTableBody";const ia=b.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>l.jsx("tr",{ref:o,className:ze("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));ia.displayName="DenseTableRow";const en=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:ze("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));en.displayName="DenseTableHead";const at=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("td",{ref:a,className:ze("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));at.displayName="DenseTableCell";const MV=1500;function DV({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:o,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,p]=b.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),p(!0),setTimeout(()=>p(!1),MV))},x=t!==void 0?Math.max(1,Math.round(t/60)):null,w=l.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?l.jsxs(l.Fragment,{children:[e,x!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",x,"m"]})]}):"Generating token…"}),k=l.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(Ev,{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,k]}):l.jsxs(l.Fragment,{children:[w,k]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[l.jsx(IV,{}),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 IV(){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 LV=3e3,PV=1200;function UV({open:e,onOpenChange:t}){const n=gn(),{user:a}=vt(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),x=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),x.current=new Set;return}let w=!1;const k=(n.getQueryData(["clients"])??[]).map(j=>j.id);return x.current=new Set(k),(async()=>{try{const j=await LD();if(w)return;f(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]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const k=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:di}),S=x.current,C=j.find(_=>!S.has(_.id)&&_.status==="connected"&&_.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},LV);return()=>clearInterval(k)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},PV);return()=>clearTimeout(w)},[s,t,n]),l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{children:[l.jsxs(Pn,{children:[l.jsx(zn,{children:"Connect computer"}),l.jsx(Lv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(DV,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function BV({embedded:e=!1}={}){const t=gn(),n=ph(),[a,s]=b.useState(()=>new Set),[o,c]=b.useState(null),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,x]=b.useState(!1),{data:w}=Ke({queryKey:["clients"],queryFn:di,refetchInterval:1e4}),{data:k}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),j=mt({mutationFn:ID,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),S=mt({mutationFn:DD,onSuccess:()=>{m(null),p(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:O=>{O instanceof Js?p(O.message):p(O instanceof Error?O.message:String(O))}}),C=b.useMemo(()=>{const O=new Map;for(const L of(k==null?void 0:k.agents)??[]){if(!L.clientId)continue;const I=O.get(L.clientId)??[];I.push(L),O.set(L.clientId,I)}return O},[k==null?void 0:k.agents]),_=O=>C.get(O)??[],R=(w??[]).filter(O=>O.status==="connected").length,z=(w??[]).reduce((O,L)=>O+L.agentCount,0),P=(w??[]).filter(O=>O.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(al,{title:"Computers",subtitle:w&&w.length>0?l.jsxs(l.Fragment,{children:[w.length," total · ",R," connected · ",z," agents bound",P>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[P," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(ye,{size:"xs",onClick:()=>x(!0),children:[l.jsx(wa,{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(UV,{open:g,onOpenChange:x}),f&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),_(f.id).length>0&&l.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:_(f.id).map(O=>l.jsx("li",{className:"font-medium",children:n(O.agentId)},O.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(ye,{variant:"outline",size:"sm",onClick:()=>{m(null),p(null)},children:"Cancel"}),l.jsx(ye,{variant:"destructive",size:"sm",onClick:()=>S.mutate(f.id),disabled:S.isPending,children:S.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:_(o.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):_(o.id).map(O=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(O.agentId)}),l.jsx(mc,{state:O.runtimeState})]},O.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ye,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),l.jsx(ye,{variant:"destructive",size:"sm",onClick:()=>j.mutate(o.id),disabled:j.isPending,children:j.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?l.jsx(En,{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(En,{children:[l.jsxs(Uy,{children:["Registered · ",w.length]}),l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(ia,{children:[l.jsx(en,{style:{width:16}}),l.jsx(en,{children:"Hostname"}),l.jsx(en,{children:"OS"}),l.jsx(en,{children:"SDK"}),l.jsx(en,{children:"Agents"}),l.jsx(en,{children:"Connected"}),l.jsx(en,{children:"Status"}),l.jsx(en,{"aria-hidden":!0})]})}),l.jsx(bc,{children:w.map(O=>{const L=!a.has(O.id),I=_(O.id);return l.jsx(VV,{client:O,boundAgents:I,isExpanded:L,agentName:n,onToggle:()=>s(K=>{const D=new Set(K);return D.has(O.id)?D.delete(O.id):D.add(O.id),D}),onDisconnect:()=>c(O),onRetire:()=>{p(null),m(O)},onReconnect:()=>x(!0)},O.id)})})]})]})]})]})}const FV={"claude-code":"Claude Code",codex:"Codex"},$V=[Qf.CLAUDE_CODE,Qf.CODEX],$k={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},HV={"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 qV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ke({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(rb,{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:$V.map(o=>l.jsx(ZV,{provider:o,entry:s?s[o]??null:null},o))})]})}function ZV({provider:e,entry:t}){const n=FV[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 · ",$k[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 ·"," ",HV[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 · ",$k[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 GV(){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 VV({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f}){const h=e.status!=="connected",p=e.authState!=="ok",g=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(ia,{interactive:!0,selected:n,onClick:s,children:[l.jsx(at,{style:{width:16},children:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?l.jsx(jv,{className:"h-3.5 w-3.5"}):l.jsx(SE,{className:"h-3.5 w-3.5"})})}),l.jsx(at,{className:"font-medium",children:e.hostname??"—"}),l.jsx(at,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(at,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(at,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?oc(e.connectedAt):"—"}),l.jsx(at,{children:p?l.jsx(GV,{}):l.jsx(mc,{state:g})}),l.jsx(at,{style:{width:1,whiteSpace:"nowrap"},children:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:p?"var(--state-error)":"var(--fg-2)"},onClick:x=>{x.stopPropagation(),f()},children:"Reconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:x=>{x.stopPropagation(),o()},children:"Disconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:x=>{x.stopPropagation(),c()},children:"Retire"})]})})]}),n&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(at,{}),l.jsxs(at,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(qV,{clientId:e.id,enabled:n}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(rb,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),l.jsx("div",{className:"flex flex-col gap-1",children:t.map(x=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(x.agentId)}),l.jsx(mc,{state:x.runtimeState}),x.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[x.activeSessions," / ",x.totalSessions??0," sessions"]})]},x.agentId))})]})]})]})]})}function QV(){return l.jsx(BV,{embedded:!0})}async function KV(e){try{return await Ee.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof Js&&t.status===404)return null;throw t}}async function YV(e){const{installUrl:t}=await Ee.get(`/orgs/${e}/github-app-installation/install-url`);return t}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 XV({isFirst:e=!1}){const{organizationId:t}=vt(),n=Ke({queryKey:["github-app-installation",t],queryFn:()=>t?KV(t):Promise.reject(new Error("no org")),enabled:!!t});return l.jsx(Fc,{title:"GitHub App",description:"One installation unlocks user sign-in, webhook ingestion, and (later) server-side write access.",isFirst:e,children:n.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:n.error instanceof Error?n.error.message:"Failed to load installation"}):n.data==null?l.jsx(WV,{organizationId:t}):l.jsx(JV,{data:n.data})})}function WV({organizationId:e}){const t=mt({mutationFn:()=>{if(!e)throw new Error("No organization selected");return YV(e)},onSuccess:o=>{window.location.assign(o)}}),n=t.error instanceof Js&&t.error.status===503,a=t.isPending,s=!e||a;return l.jsxs("div",{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)",marginBottom:"var(--sp-3)"},children:"Install the GitHub App on your personal account or organization to start receiving issues, pull requests, and reviews as routed messages."}),n?l.jsxs("p",{className:"text-body",style:{color:"var(--state-error)"},children:["The GitHub App slug isn't configured on this hub. Ask your operator to set"," ",l.jsx("code",{className:"mono",children:"FIRST_TREE_HUB_GITHUB_APP_SLUG"}),"."]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>t.mutate(),disabled:s,className:"inline-flex items-center justify-center font-medium",style:{gap:"var(--sp-1)",padding:"var(--sp-2) var(--sp-3)",background:"var(--accent)",color:"var(--accent-fg, white)",border:"none",borderRadius:"var(--radius-input)",cursor:s?"default":"pointer",opacity:s?.6:1},children:[a?"Opening GitHub…":"Install on GitHub",l.jsx(Cv,{className:"h-3 w-3"})]}),t.error&&!n&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:t.error instanceof Error?t.error.message:"Failed to build the install URL"})]})]})}function JV({data:e}){const t=e.accountType==="Organization"?Xz:_E,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx(eQ,{}),l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Connected as"}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(t,{className:"h-4 w-4",style:{color:"var(--fg-2)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.accountLogin}),l.jsx("span",{className:"text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-3)"},children:e.accountType})]})]}),n.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Permissions granted"}),l.jsx("ul",{className:"text-body",style:{listStyle:"none",padding:0,margin:0,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--sp-1)",color:"var(--fg-2)"},children:n.map(([a,s])=>l.jsxs("li",{className:"mono",children:[a,": ",l.jsx("strong",{style:{color:"var(--fg)"},children:s})]},a))})]}),e.events.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Subscribed events"}),l.jsx("div",{className:"text-body mono",style:{color:"var(--fg-2)"},children:e.events.join(", ")})]}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs("a",{href:e.manageUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center text-body",style:{gap:"var(--sp-1)",padding:"var(--sp-1_5) var(--sp-2_5)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",textDecoration:"none"},children:["Manage on GitHub",l.jsx(Cv,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function eQ(){return l.jsxs("div",{className:"flex items-start text-body",style:{gap:"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(aM,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),l.jsx("span",{children:"This installation is suspended upstream. GitHub is not delivering webhooks and Hub can't act as the App on this account. Unsuspend it from the GitHub side to restore service."})]})}function tQ(){const{role:e}=vt();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(al,{title:"GitHub",subtitle:"Connected GitHub App and granted permissions"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(XV,{isFirst:!0})})]})}function nQ(){return Ee.get(Nn("/adapter-mappings"))}function rQ(e){return Ee.post(Nn("/adapter-mappings"),e)}function aQ(e){return Ee.delete(`/adapter-mappings/${e}`)}function iQ(){return Ee.get(Nn("/adapters/status"))}function sQ(){return Ee.get(Nn("/adapters"))}function lQ(e){return Ee.post(Nn("/adapters"),e)}function oQ(e,t){return Ee.patch(`/adapters/${e}`,t)}function uQ(e){return Ee.delete(`/adapters/${e}`)}const cQ=Object.values(z6),Hk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function qk(e){const[t,n]=b.useState(Hk),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...Hk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=dQ(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(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-platform",children:"Platform"}),l.jsx("select",{id:"binding-platform",value:t.platform,onChange:f=>n({...t,platform:f.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:cQ.map(f=>l.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Ft,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Ft,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),l.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:f=>n({...t,credentialsJson:f.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-status",children:"Status"}),l.jsxs("select",{id:"binding-status",value:t.status,onChange:f=>n({...t,status:f.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"active",children:"active"}),l.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function dQ(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 fQ(){var T;const e=Rn(),t=gn(),[n,a]=lh(),s=n.get("agent"),o=ph(),c=Ke({queryKey:["adapters"],queryFn:sQ}),f=Ke({queryKey:["adapter-mappings"],queryFn:nQ}),m=Ke({queryKey:["adapter-statuses"],queryFn:iQ,refetchInterval:15e3}),p=((T=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],g=b.useMemo(()=>{const G=new Map;for(const q of m.data??[])G.set(q.configId,q);return G},[m.data]),x=b.useMemo(()=>{const G=c.data??[];return s?G.filter(q=>q.agentId===s):G},[c.data,s]),w=b.useMemo(()=>{const G=f.data??[];return s?G.filter(q=>q.agentId===s):G},[f.data,s]),k=x.reduce((G,q)=>{var ie;return G+((ie=g.get(q.id))!=null&&ie.connected?1:0)},0),j=x.length-k,S=c.isLoading||f.isLoading,[C,_]=b.useState(null),[R,z]=b.useState(""),[P,O]=b.useState(null),[L,I]=b.useState(null),[K,D]=b.useState(null),[Y,se]=b.useState(null),xe=mt({mutationFn:G=>lQ({platform:G.platform,agentId:G.agentId,credentials:G.credentials,status:G.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),J=mt({mutationFn:G=>{const q={status:G.status};return G.credentials&&(q.credentials=G.credentials),oQ(G.id,q)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),W=mt({mutationFn:uQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),Z=mt({mutationFn:G=>rQ({platform:G.platform,externalUserId:G.externalUserId,agentId:G.agentId,boundVia:"manual",displayName:G.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),I(null)}}),ne=mt({mutationFn:aQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ke(G){if(s){G==="bot"?O({agentId:s,editingId:null}):I({agentId:s});return}z(""),_({kind:G})}function Ae(){!C||!R||(C.kind==="bot"?O({agentId:R,editingId:null}):I({agentId:R}),_(null))}function M(G){if(P){if(G.kind==="bot-create")xe.mutate({agentId:P.agentId,platform:G.draft.platform,status:G.draft.status,credentials:G.draft.credentials});else if(G.kind==="bot-update"){if(!P.editingId)return;J.mutate({id:P.editingId,status:G.status,credentials:G.credentials})}}}function U(G){!L||G.kind!=="user-create"||Z.mutate({agentId:L.agentId,platform:G.draft.platform,externalUserId:G.draft.externalUserId,displayName:G.draft.displayName})}const F=s?p.find(G=>G.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:[(F==null?void 0:F.displayName)??s,l.jsx("button",{type:"button",onClick:()=>{const G=new URLSearchParams(n);G.delete("agent"),a(G,{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(os,{className:"h-3 w-3"})})]})]}),l.jsxs(En,{className:"mb-3.5",children:[l.jsxs(Uy,{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(Ju,{state:"idle",size:6})," ",k," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(Ju,{state:"offline",size:6})," ",j," offline"]})]}),l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>ke("bot"),children:[l.jsx(wa,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",x.length]}),S?l.jsx(kf,{children:"Loading…"}):x.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(ia,{children:[l.jsx(en,{children:"Agent"}),l.jsx(en,{children:"Platform"}),l.jsx(en,{children:"Status"}),l.jsx(en,{children:"Connection"}),l.jsx(en,{children:"Created"}),l.jsx(en,{style:{width:96,textAlign:"right"}})]})}),l.jsx(bc,{children:x.map(G=>{var ie;const q=((ie=g.get(G.id))==null?void 0:ie.connected)??!1;return l.jsxs(ia,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(at,{children:l.jsx("span",{className:"mono font-medium",children:o(G.agentId)})}),l.jsx(at,{children:l.jsx(Er,{children:G.platform})}),l.jsx(at,{children:l.jsx(Er,{tone:G.status==="active"?"accent":"outline",children:G.status})}),l.jsx(at,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(Ju,{state:q?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:q?"Online":"Offline"})]})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsxs(at,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:ve=>ve.stopPropagation(),children:[l.jsx(ye,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:G.agentId,editingId:G.id,initialPlatform:hQ(G.platform),initialStatus:mQ(G.status)}),children:"Edit"}),l.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(G.id),disabled:W.isPending,title:"Delete",children:l.jsx(Uf,{className:"h-3.5 w-3.5"})})]})]},G.id)})})]}):l.jsx(kf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(En,{children:[l.jsxs(Uy,{right:l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>ke("user"),children:[l.jsx(wa,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),S?l.jsx(kf,{children:"Loading…"}):w.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(ia,{children:[l.jsx(en,{children:"Agent"}),l.jsx(en,{children:"Platform"}),l.jsx(en,{children:"External user ID"}),l.jsx(en,{children:"Display name"}),l.jsx(en,{children:"Bound via"}),l.jsx(en,{children:"Created"}),l.jsx(en,{style:{width:32}})]})}),l.jsx(bc,{children:w.map(G=>l.jsxs(ia,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(at,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(G.agentId)})}),l.jsx(at,{children:l.jsx(Er,{children:G.platform})}),l.jsx(at,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:G.externalUserId})}),l.jsx(at,{style:{color:"var(--fg-2)"},children:G.displayName??"—"}),l.jsx(at,{children:l.jsx(Er,{tone:"outline",children:G.boundVia??"—"})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsx(at,{onClick:q=>q.stopPropagation(),children:l.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>se(G.id),disabled:ne.isPending,title:"Delete",children:l.jsx(Uf,{className:"h-3.5 w-3.5"})})})]},G.id))})]}):l.jsx(kf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(pQ,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:p,agentId:R,onAgentChange:z,onCancel:()=>_(null),onConfirm:Ae}),l.jsx(qk,{open:P!=null,kind:"bot",editingId:(P==null?void 0:P.editingId)??null,initialPlatform:P==null?void 0:P.initialPlatform,initialStatus:P==null?void 0:P.initialStatus,agentLabel:P?o(P.agentId):"",pending:xe.isPending||J.isPending,errorMessage:(xe.error??J.error)instanceof Error?(xe.error??J.error).message:null,onOpenChange:G=>{G||(O(null),xe.reset(),J.reset())},onSubmit:M}),l.jsx(qk,{open:L!=null,kind:"user",editingId:null,agentLabel:L?o(L.agentId):"",pending:Z.isPending,errorMessage:Z.error instanceof Error?Z.error.message:null,onOpenChange:G=>{G||(I(null),Z.reset())},onSubmit:U}),l.jsx(Zk,{open:K!=null,onOpenChange:G=>!G&&D(null),title:"Remove this bot binding?",description:"The bot will stop routing to this agent and any platform credentials stored here will be dropped.",confirmLabel:"Remove binding",pending:W.isPending,onConfirm:()=>{K!=null&&(W.mutate(K),D(null))}}),l.jsx(Zk,{open:Y!=null,onOpenChange:G=>!G&&se(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:ne.isPending,onConfirm:()=>{Y!=null&&(ne.mutate(Y),se(null))}})]})}function hQ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function mQ(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 pQ(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(On,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{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(fr,{children:[l.jsx(ye,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(ye,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Zk(e){return l.jsx(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function gQ({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(al,{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(fQ,{})})]})}function yQ(){return l.jsx(gQ,{embedded:!0})}function vQ(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=vt(),s=!!t,o=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(al,{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(bQ,{}),isFirst:!0,children:s?l.jsx(ye,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):l.jsx(ye,{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 bQ(){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 xQ(){const{role:e}=vt(),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(Hu,{to:"/settings/team",label:"Team"}),l.jsx(Hu,{to:"/settings/computers",label:"Computers"}),t&&l.jsx(Hu,{to:"/settings/github",label:"GitHub"}),l.jsx(Hu,{to:"/settings/integrations",label:"Messaging"}),l.jsx(Hu,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(Pf,{})})]})}function Hu({to:e,label:t}){return l.jsx(bv,{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 Wy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Jl)}const Ug=200;function wQ(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 SQ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Jl)}function vT(e){return e==="claude-code"||e==="codex"?e:null}function kQ(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=vT(a);if(o)return o}return null}function jQ(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function EQ(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 CQ({open:e,onOpenChange:t,onCreated:n}){const a=gn(),{refreshMe:s,organizationId:o}=vt(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[x,w]=b.useState("private"),[k,j]=b.useState("claude-code"),[S,C]=b.useState(!1),[_,R]=b.useState([]),[z,P]=b.useState(!1),[O,L]=b.useState(null),[I,K]=b.useState(null),[D,Y]=b.useState(null),[se,xe]=b.useState(null),[J,W]=b.useState(null),[Z,ne]=b.useState(null),[ke,Ae]=b.useState(!1),[M,U]=b.useState({}),[F,T]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),w("private"),j("claude-code"),C(!1),R([]),P(!1),L(null),K(null),Y(null),xe(null),W(null),ne(null),Ae(!1),U({}),T({status:"idle"}))},[e]),b.useEffect(()=>{p||h(Wy(c))},[c,p]);const G=b.useRef(0);b.useEffect(()=>{if(!e||!m){T({status:"idle"});return}if(!Dy.test(m)){T({status:"bad",reason:"invalid"});return}if(Iy(m)){T({status:"bad",reason:"reserved"});return}const V=++G.current;T({status:"checking"});const pe=window.setTimeout(()=>{o4(m).then(_e=>{V===G.current&&(_e.available?T({status:"ok"}):T({status:"bad",reason:_e.reason}))}).catch(()=>{V===G.current&&T({status:"idle"})})},300);return()=>window.clearTimeout(pe)},[m,e]),b.useEffect(()=>{if(!e)return;let V=!1;const pe=async()=>{try{const Ue=await di();if(V)return;const Mt=Ue.filter(Pt=>Pt.status==="connected").sort((Pt,hr)=>hr.lastSeenAt.localeCompare(Pt.lastSeenAt));R(Mt),P(!0)}catch{V||P(!0)}};pe();const _e=window.setInterval(pe,3e3);return()=>{V=!0,window.clearInterval(_e)}},[e]),b.useEffect(()=>{if(_.length===0){L(null);return}L(V=>{var pe;return V&&_.some(_e=>_e.id===V)?V:((pe=_[0])==null?void 0:pe.id)??null})},[_]),b.useEffect(()=>{if(!O){K(null),Y(null);return}let V=!1;const pe=async()=>{try{const Ue=await ch(O);if(V)return;K(Ue.capabilities),Y(O)}catch{}};pe();const _e=window.setInterval(pe,3e3);return()=>{V=!0,window.clearInterval(_e)}},[O]),b.useEffect(()=>{if(!e||_.length>0)return;if(se&&Z&&Z>Date.now()){const pe=Math.max(Z-Date.now(),0),_e=window.setTimeout(()=>{xe(null),ne(null)},pe);return()=>window.clearTimeout(_e)}se&&(xe(null),W(null),ne(null));let V=!1;return(async()=>{try{const pe=await Ee.post("/me/connect-tokens",{});if(V)return;xe(pe.token),W(pe.command),ne(Date.now()+pe.expiresIn*1e3)}catch{}})(),()=>{V=!0}},[e,_.length,se,Z]);const q=O&&D===O?I:null,ie=b.useMemo(()=>{if(!q)return[];const V=[];for(const[pe,_e]of Object.entries(q)){if(_e.state!=="ok")continue;const Ue=vT(pe);Ue&&V.push(Ue)}return V},[q]);b.useEffect(()=>{q&&j(V=>{var pe;return((pe=q[V])==null?void 0:pe.state)==="ok"?V:kQ(q)??V})},[q]);const ve=mt({mutationFn:async V=>{const pe=c.trim()||m.trim()||"Untitled assistant";return l4({name:m||void 0,type:"personal_assistant",displayName:pe,clientId:V.clientId,runtimeProvider:k,visibility:x,...o?{organizationId:o}:{}})},onSuccess:V=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(V,k)}}),we=b.useMemo(()=>{const V=ve.error;if(!V)return{};if(V instanceof Js){const pe=wQ(V.issues);return Object.keys(pe).length>0?pe:V.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:V.message}}return V instanceof Error?{_root:V.message}:{}},[ve.error]),me=F.status==="bad"?EQ(F.reason):void 0,Me={...me?{name:me}:{},...we,...M};function Ie(){const V={};return m?m.length>Jl?V.name=`Agent name must be at most ${Jl} characters (got ${m.length}).`:Dy.test(m)?Iy(m)&&(V.name="That agent name is reserved — pick a different one."):V.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(V.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Ug&&(V.displayName=`Display name must be at most ${Ug} characters (got ${c.length}).`),V}function St(V){V.preventDefault();const pe=Ie();U(pe),!(Object.keys(pe).length>0)&&F.status!=="bad"&&O&&(ie.length===0||!ie.includes(k)||ve.mutate({clientId:O}))}const tt=F.status==="bad",it=c.trim().length>0&&!tt&&!ve.isPending&&!!O&&ie.length>0&&ie.includes(k);return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(_n,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(zn,{children:"New Agent"})}),l.jsxs("form",{onSubmit:St,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Ft,{id:"new-agent-display-name",value:c,onChange:V=>{f(V.target.value),M.displayName&&U(pe=>({...pe,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Ug,"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}),!S&&(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"})]}),!S&&Me.name&&l.jsx("p",{className:"text-caption text-destructive",children:Me.name})]}),S&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(bt,{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(Ft,{id:"new-agent-name",value:m,autoFocus:!0,onChange:V=>{const pe=SQ(V.target.value);h(pe),g(!0),M.name&&U(_e=>({..._e,name:void 0}))},onBlur:V=>{const pe=Wy(V.target.value);pe!==m&&h(pe)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Jl,"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"," ",Jl," characters. Permanent after creation."]}),m&&!Me.name&&F.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:F.status==="ok"?"var(--state-idle)":F.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[F.status==="checking"&&"Checking availability…",F.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(bt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:x==="organization"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="organization",onChange:()=>w("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent."})]})]}),l.jsxs("label",{className:x==="private"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="private",onChange:()=>w("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed. (default)"})]})]})]})]}),l.jsxs("div",{className:"space-y-3",style:{minHeight:168},children:[l.jsx(bt,{children:"Where it runs"}),z?_.length===0?l.jsx(NQ,{command:J,copied:ke,onCopy:async()=>{J&&(await navigator.clipboard.writeText(J),Ae(!0),window.setTimeout(()=>Ae(!1),1500))}}):_.length===1?l.jsx(_Q,{client:_[0]}):l.jsx("div",{className:"space-y-2",children:_.map(V=>{const pe=O===V.id;return l.jsxs("label",{className:pe?"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:pe,onChange:()=>L(V.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:V.hostname??V.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[V.os??"unknown OS"," · last seen ",new Date(V.lastSeenAt).toLocaleString()]})]})]},V.id)})}):l.jsx(TQ,{label:"Detecting connected computers…"}),(O||!z)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),!O||q===null?l.jsx(AQ,{}):ie.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:ie.map(V=>{const pe=k===V;return l.jsxs("label",{className:pe?"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:pe,onChange:()=>j(V)}),l.jsx("span",{className:"text-body",children:jQ(V)})]},V)})})]}),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(fr,{children:l.jsx(ye,{type:"submit",disabled:!it,children:ve.isPending?"Creating…":"Create"})})]})]})})}function NQ({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 _Q({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 TQ({label:e}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",role:"status","aria-live":"polite","aria-label":e,children:[l.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg-3)"},children:e}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Looking for a machine running the Hub client…"})]})}function AQ(){return l.jsx("div",{className:"flex flex-wrap gap-2",role:"status","aria-live":"polite","aria-label":"Detecting installed runtimes",children:l.jsx("span",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 px-3 py-1.5 text-body",style:{color:"var(--fg-4)"},children:"Detecting installed runtimes…"})})}function RQ(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 OQ(){const{organizationId:e}=vt(),[t,n]=b.useState(null),[a,s]=b.useState(null),[o,c]=b.useState(!1),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(async()=>{try{const p=await Ee.get(vy(e,"/invitations"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const p=await Ee.post(vy(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(zo,{children:[l.jsxs(Mo,{children:[l.jsx(Bc,{children:"Invite link"}),l.jsxs(yT,{children:["Anyone with this link can join your team as a member. Links expire after ",OB," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(Do,{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(ye,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(ye,{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?` · ${RQ(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}function jb({actions:e,ariaLabel:t,triggerClassName:n,icon:a=lM}){const[s,o]=b.useState(!1),[c,f]=b.useState("down"),m=b.useRef(null),h=b.useRef(null);return b.useEffect(()=>{if(!s)return;const p=x=>{m.current&&!m.current.contains(x.target)&&o(!1)},g=x=>{x.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[s]),b.useEffect(()=>{if(!s||!h.current)return;const p=32,g=8,x=h.current.getBoundingClientRect(),w=window.innerHeight-x.bottom,k=e.length*p+g;f(w>=k?"down":"up")},[s,e.length]),e.length===0?null:l.jsxs("div",{ref:m,className:"relative inline-flex",children:[l.jsx("button",{ref:h,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":s,onClick:p=>{p.stopPropagation(),o(g=>!g)},className:ze("inline-flex items-center justify-center",n),style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(a,{className:"h-3.5 w-3.5"})}),s&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),style:{minWidth:180,borderColor:"var(--border)",...c==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(p=>l.jsx("button",{type:"button",role:"menuitem",disabled:p.disabled,onClick:g=>{g.stopPropagation(),o(!1),p.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:p.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:p.disabled?"not-allowed":"pointer"},children:p.label},p.key))})]})}const Eb=[{key:"name",label:"Name",width:220},{key:"delegate",label:"Delegate",width:180},{key:"manager",label:"Manager",width:180},{key:"runtime",label:"Runs on",width:220},{key:"status",label:"Status",width:160},{key:"created",label:"Created",width:160},{key:"actions",label:"",width:44}];function jr(e,t){return e?{...t,borderBottom:0}:t}function zQ({groups:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){return l.jsxs(yc,{className:"table-fixed",children:[l.jsx(vc,{children:l.jsx(ia,{children:Eb.map(c=>l.jsx(en,{style:{width:c.width,...c.key==="name"?{paddingLeft:"var(--sp-6)"}:null},"aria-hidden":c.key==="actions",children:c.label},c.key))})}),e.map(c=>l.jsx(MQ,{group:c,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},c.key))]})}function MQ({group:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){const[c,f]=b.useState(!e.collapsible);return l.jsxs(bc,{children:[l.jsx(IQ,{group:e,open:c,onToggle:()=>f(m=>!m)}),c&&e.rows.length===0&&e.emptyMessage&&l.jsx(ia,{children:l.jsx(at,{colSpan:Eb.length,style:{color:"var(--fg-4)",textAlign:"left",padding:"0 var(--sp-3_5) var(--sp-3) var(--sp-6)",borderBottom:0},children:e.emptyMessage})}),c&&e.rows.map((m,h)=>{const p=h===e.rows.length-1;return m.kind==="human"?l.jsx(LQ,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(UQ,{row:m,runtime:t.get(m.agent.uuid)??null,clientHost:m.agent.clientId?n.get(m.agent.clientId)??null:null,actions:o(m),onClick:()=>a(m.agent.uuid),isLast:p},`a:${m.agent.uuid}`)})]})}function DQ(e){switch(e){case"humans":return _E;case"yours":case"team":return wE;case"other-private":return uh;default:return null}}function IQ({group:e,open:t,onToggle:n}){const a=DQ(e.key),s=l.jsxs("span",{className:"inline-flex items-center relative",style:{gap:"var(--sp-2)"},children:[e.collapsible&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:"calc(-1 * var(--sp-3))",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",lineHeight:1},children:t?"▾":"▸"}),a&&l.jsx(a,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx(Er,{tone:"outline",children:e.count})]});return l.jsx(ia,{children:l.jsx("td",{colSpan:Eb.length,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:e.collapsible?l.jsx("button",{type:"button",onClick:n,"aria-expanded":t,style:{background:"transparent",border:0,cursor:"pointer",color:"inherit",padding:"0 0 0 var(--sp-3)",marginLeft:"calc(-1 * var(--sp-3))"},children:s}):s})})}function LQ({row:e,actions:t,isLast:n}){return l.jsxs(ia,{children:[l.jsx(at,{style:jr(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(bT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(at,{style:jr(n),children:l.jsx(PQ,{row:e})}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"mono text-caption",style:jr(n,{color:"var(--fg-4)"}),children:ZE(e.createdAt)}),l.jsx(at,{style:jr(n,{padding:0,textAlign:"right"}),children:l.jsx(jb,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function PQ({row:e}){if(!e.delegate&&!e.canEditDelegate)return l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"—"});const t=e.delegate?e.delegate.name?`${e.delegate.displayName} (@${e.delegate.name})`:e.delegate.displayName:"Set delegate",n=e.delegate?l.jsx("span",{className:"block max-w-full overflow-hidden text-ellipsis whitespace-nowrap",children:l.jsx(JN,{name:e.delegate.name,displayName:e.delegate.displayName})}):l.jsx("span",{style:{color:"var(--accent-dim)"},children:"Set delegate →"}),a=e.delegate?e.canEditDelegate?`Change delegate · ${t}`:t:"Set delegate";return e.canEditDelegate?l.jsx("button",{type:"button",onClick:e.onEditDelegate,className:"text-label hover:underline block max-w-full overflow-hidden",style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"inherit",textAlign:"left"},title:a,children:n}):l.jsx("span",{className:"text-label block max-w-full overflow-hidden",title:a,children:n})}function UQ({row:e,runtime:t,clientHost:n,actions:a,onClick:s,isLast:o}){const{agent:c,managerLabel:f,isOwnedBySelf:m,showVisibilityChip:h}=e;return l.jsxs(ia,{interactive:!0,onClick:s,children:[l.jsx(at,{style:jr(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(bT,{displayName:c.displayName,handle:c.name?`@${c.name}`:null,visibility:h?c.visibility:null})}),l.jsx(at,{className:"text-label",style:jr(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(o,{color:"var(--fg-2)"}),children:f?l.jsxs("span",{className:"truncate inline-block max-w-full",title:f,children:[f,m&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}):l.jsx("span",{style:{color:"var(--fg-4)"},children:"—"})}),l.jsx(at,{className:"mono text-caption",style:jr(o,{color:"var(--fg-3)"}),children:l.jsxs("div",{className:"truncate",title:n?`${c.runtimeProvider} @ ${n}`:c.runtimeProvider,children:[c.runtimeProvider,n&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" @ ",n]})]})}),l.jsx(at,{style:jr(o),children:l.jsx(mc,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(at,{className:"mono text-caption",style:jr(o,{color:"var(--fg-4)"}),children:ZE(c.createdAt)}),l.jsx(at,{style:jr(o,{padding:0,textAlign:"right"}),onClick:p=>p.stopPropagation(),children:l.jsx(jb,{actions:a,ariaLabel:`Actions for ${c.displayName}`})})]})}function bT({displayName:e,handle:t,selfTag:n,visibility:a}){return l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-1.5 min-w-0",children:[l.jsx("span",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:e,children:e}),n&&l.jsx("span",{className:"text-label italic shrink-0",style:{color:"var(--fg-3)"},children:"(you)"}),a&&l.jsx(BQ,{visibility:a})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function BQ({visibility:e}){return e==="private"?l.jsxs(Er,{tone:"outline",title:"Private — only you can see this agent",className:"shrink-0",children:[l.jsx(uh,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Private"]}):l.jsxs(Er,{tone:"accent",title:"Shared — anyone in the team can @mention this agent",className:"shrink-0",children:[l.jsx($M,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Shared"]})}const Gk=100,Vk=100;async function FQ(e){const t=[];let n;for(let a=0;a<Vk;a++){const s=await e(n?{limit:Gk,cursor:n}:{limit:Gk});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${Vk} pages; server cursor pagination may be broken`)}function $Q(){const{role:e,memberId:t}=vt(),n=e==="admin",a=Rn(),s=gn(),o=t_(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(null),[k,j]=b.useState("all"),[S,C]=b.useState(""),_=Ke({queryKey:["members"],queryFn:e_}),R=Ke({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>FQ(q=>n?i4(q):Mc(q))}),{data:z}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),P=b.useMemo(()=>{const q=new Map;for(const ie of(z==null?void 0:z.agents)??[])q.set(ie.agentId,ie);return q},[z==null?void 0:z.agents]),{data:O}=Ke({queryKey:["clients","team-page"],queryFn:di,staleTime:3e4}),L=b.useMemo(()=>{const q=new Map;for(const ie of O??[])ie.hostname&&q.set(ie.id,ie.hostname);return q},[O]),I=b.useMemo(()=>_.data??[],[_.data]),K=b.useMemo(()=>R.data??[],[R.data]),D=b.useMemo(()=>{const q=new Map;for(const ie of K)q.set(ie.uuid,ie);return q},[K]),Y=b.useMemo(()=>K.filter(q=>q.type!=="human"),[K]),se=b.useMemo(()=>Y.filter(q=>q.managerId===t),[Y,t]),xe=b.useMemo(()=>Y.filter(q=>q.visibility==="organization"&&q.managerId!==t),[Y,t]),J=b.useMemo(()=>Y.filter(q=>q.visibility==="private"&&q.managerId!==t),[Y,t]),W=mt({mutationFn:async q=>V9(q.id,q.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),Z=mt({mutationFn:Q9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),ne=mt({mutationFn:HC,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),ke=mt({mutationFn:qC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),Ae=mt({mutationFn:ZC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),M=mt({mutationFn:async q=>Ay(q.humanAgentId,{delegateMention:q.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),U=S.trim().toLowerCase(),F=b.useMemo(()=>ZQ({filter:k,search:U,isAdmin:n,selfMemberId:t,members:I,yourAgents:se,teamAgents:xe,otherPrivateAgents:J,resolveMember:o,agentByUuid:D,openDelegate:(q,ie)=>{var ve;return w({humanAgentId:q,humanDisplayName:ie,currentDelegate:((ve=D.get(q))==null?void 0:ve.delegateMention)??null})}}),[k,U,n,t,I,se,xe,J,o,D]);function T(q){const ie=[];return n&&ie.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:q.id,username:q.username,displayName:q.displayName,role:q.role})}),n&&!q.isSelf&&ie.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${q.displayName} from the org? The human agent will be deactivated.`)&&Z.mutate(q.id)}}),ie}function G(q){const{agent:ie,isOwnedBySelf:ve}=q,we=n||ve,me=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(ie.uuid)}`)}];return we&&(ie.status==="suspended"?me.push({key:"reactivate",label:"Reactivate",onSelect:()=>Ae.mutate(ie.uuid)}):me.push({key:"suspend",label:"Suspend",onSelect:()=>ke.mutate(ie.uuid)}),me.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${ie.displayName}? This cannot be undone.`)&&ne.mutate(ie.uuid)}})),me}return l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Team",right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(ye,{size:"xs",onClick:()=>h(!0),children:[l.jsx(wa,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(ye,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(NE,{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(qQ,{filter:k,onFilter:j,query:S,onQuery:C,counts:{yours:se.length,humans:I.length,team:xe.length}}),R.isLoading||_.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):R.error||_.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",HQ(R.error??_.error)]}):l.jsx(zQ,{groups:F,runtimeMap:P,clientHostMap:L,onAgentClick:q=>a(`/agents/${encodeURIComponent(q)}`),getHumanActions:T,getAgentActions:G})]}),l.jsx(On,{open:c,onOpenChange:f,children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Invite link"})}),l.jsx(OQ,{})]})}),l.jsx(CQ,{open:m,onOpenChange:h,onCreated:(q,ie)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(QQ,{target:p,isAdmin:n,isSaving:W.isPending,onClose:()=>g(null),onSave:async q=>{p&&(await W.mutateAsync({id:p.id,patch:q}),g(null))}}),l.jsx(KQ,{target:x,candidates:GQ(K),isSaving:M.isPending,onClose:()=>w(null),onSave:async q=>{x&&(await M.mutateAsync({humanAgentId:x.humanAgentId,delegateMention:q}),w(null))}})]})}function HQ(e){return e instanceof Error?e.message:String(e)}function qQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"yours",label:"Your agents",count:s.yours},{key:"humans",label:"Humans",count:s.humans},{key:"team",label:"Team agents",count:s.team}];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(eh,{active:e===c.key,count:c.count,onClick:()=>t(c.key),children:c.label},c.key))}),l.jsxs("div",{className:"relative",style:{width:220},children:[l.jsx(Tv,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-1_5)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx(Ft,{value:n,onChange:c=>a(c.target.value),placeholder:"Search name or @handle","aria-label":"Search team",className:"h-7 text-caption",style:{paddingLeft:"var(--sp-5)",borderRadius:3}})]})]})}function ZQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,yourAgents:c,teamAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=I=>{const K=h.get(I);if(!(K!=null&&K.delegateMention))return null;const D=h.get(K.delegateMention);return D?{name:D.name,displayName:D.displayName}:null},x=I=>!n||I.displayName.toLowerCase().includes(n)||I.username.toLowerCase().includes(n),w=I=>!n||I.displayName.toLowerCase().includes(n)||(I.name??"").toLowerCase().includes(n),k=t==="all"||t==="yours",j=t==="all"||t==="humans",S=t==="all"||t==="team",C=a&&t==="all",_=o.filter(x).map(I=>{const K=s===I.id;return{kind:"human",id:I.id,agentId:I.agentId,username:I.username,displayName:I.displayName,role:I.role,createdAt:I.createdAt,isSelf:K,delegate:g(I.agentId),canEditDelegate:K||a,onEditDelegate:()=>p(I.agentId,I.displayName)}}).sort((I,K)=>Number(K.isSelf)-Number(I.isSelf)),R=(I,K)=>({kind:"agent",agent:I,managerLabel:I.managerId?e.resolveMember(I.managerId):null,isOwnedBySelf:I.managerId===s,showVisibilityChip:(K==null?void 0:K.showVisibilityChip)??!1}),z=c.filter(w).map(I=>R(I,{showVisibilityChip:!0})).sort((I,K)=>{const D=I.agent.visibility==="private"?0:1,Y=K.agent.visibility==="private"?0:1;return D!==Y?D-Y:I.agent.displayName.localeCompare(K.agent.displayName,void 0,{sensitivity:"base"})}),P=f.filter(w).map(I=>R(I)),O=m.filter(w).map(I=>R(I)),L=[];return k&&L.push({key:"yours",title:"Your agents",count:z.length,rows:z,emptyMessage:n?"No agents match this search.":"You haven't created any agents yet. Click New agent above to add one."}),j&&L.push({key:"humans",title:"Humans",count:_.length,rows:_,emptyMessage:n?"No humans match this search.":void 0}),S&&L.push({key:"team",title:"Team agents",count:P.length,rows:P,emptyMessage:n?"No team agents match this search.":"No shared agents from other team members yet."}),C&&O.length>0&&L.push({key:"other-private",title:"Other members' private agents",count:O.length,rows:O,collapsible:!0}),L}function GQ(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const VQ=Object.values(UB);function QQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(c(e.displayName),m(e.role),p(null))},[e]);async function g(w){if(w.preventDefault(),!e)return;const k={};if(o.trim()&&o!==e.displayName&&(k.displayName=o.trim()),t&&f!==e.role&&(k.role=f),Object.keys(k).length===0){a();return}try{await s(k)}catch(j){p(j instanceof Error?j.message:String(j))}}const x=e!==null;return l.jsx(On,{open:x,onOpenChange:w=>w?void 0:a(),children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Username"}),l.jsx(Ft,{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(bt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Ft,{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(bt,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:w=>m(w.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:VQ.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(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function KQ({target:e,candidates:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState(null);b.useEffect(()=>{e&&(c(e.currentDelegate??""),m(null))},[e]);async function h(g){if(g.preventDefault(),!!e){m(null);try{await s(o||null)}catch(x){m(x instanceof Error?x.message:String(x))}}}const p=e!==null;return l.jsx(On,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(_n,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Set delegate"})}),e&&l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-2)"},children:["Pick a personal assistant to act on behalf of ",l.jsx("strong",{children:e.humanDisplayName}),". When teammates @mention this human, the assistant receives the message and can reply in their place."]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"set-delegate-pick",children:"Delegate"}),l.jsxs("select",{id:"set-delegate-pick",value:o,onChange:g=>c(g.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 — no delegate"}),t.map(g=>l.jsx("option",{value:g.uuid,children:g.displayName?`${g.displayName} (@${g.name??g.uuid})`:g.name?`@${g.name}`:g.uuid},g.uuid))]}),t.length===0&&l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["No personal assistants available. Create one from the ",l.jsx("em",{children:"New agent"})," button above first."]})]}),f&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Dh(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function Cb(e){return Ee.get(Dh(e,"context_tree"))}function xT(e,t){return Ee.put(Dh(e,"context_tree"),t)}function wT(e){return Ee.get(Dh(e,"source_repos"))}function ST(e,t){return Ee.put(Dh(e,"source_repos"),t)}function Jy({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:c="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:p}){const g=b.useId(),x=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,w={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:g,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(YQ,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:x,style:{...w,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:k=>a==null?void 0:a(k.target.value),type:c,placeholder:f,pattern:p,className:x,style:w}),m]})]})}function YQ(){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 kT({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(EE,{className:"h-4 w-4 animate-spin"}):l.jsx(cr,{className:"h-4 w-4"})})}function XQ({isFirst:e=!1}){const{organizationId:t}=vt(),n=gn(),a=Ke({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?Cb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1);b.useEffect(()=>{a.data&&(o(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const p=mt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return xT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:x=>{n.setQueryData(["org-setting",t,"context_tree"],x),h(!0),setTimeout(()=>h(!1),2e3)}}),g=x=>{x.preventDefault(),p.mutate()};return l.jsx(Fc,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:g,children:[l.jsx(Jy,{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(Jy,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(kT,{pending:p.isPending,disabled:!a.data})}),p.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:p.error.message})]})})}function WQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=vt(),a=n==="admin",s=gn(),o=Ke({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?wT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=mt({mutationFn:async p=>{var w;if(!t)throw new Error("organization not loaded");const x=(((w=o.data)==null?void 0:w.repos)??[]).filter(k=>k.url!==p);return ST(t,{repos:x})},onSuccess:p=>{s.setQueryData(["org-setting",t,"source_repos"],p)}}),f=((h=o.data)==null?void 0:h.repos)??[],m=f.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return l.jsxs(Fc,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[o.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):o.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:o.error instanceof Error?o.error.message:"Failed to load setting"}):f.length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(p=>l.jsx(JQ,{url:p.url,defaultBranch:p.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(p.url)},p.url))}),c.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function JQ({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(os,{className:"h-3.5 w-3.5"})})]})}function eK(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function tK(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function nK({isFirst:e=!1}){const{organizationId:t}=vt(),n=gn(),a=Ke({queryKey:["organization",t],queryFn:()=>t?eK(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(!1);b.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=mt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const p=s.trim();return!p||p===a.data.displayName?Promise.resolve(a.data):tK(t,{displayName:p})},onSuccess:p=>{n.setQueryData(["organization",t],p),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=p=>{p.preventDefault(),m.mutate()};return l.jsx(Fc,{title:"Identity",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):l.jsxs("form",{onSubmit:h,children:[l.jsx(Jy,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(kT,{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 rK(){const{role:e}=vt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(nK,{isFirst:!0}),t&&l.jsx(XQ,{}),l.jsx(WQ,{isFirst:!t})]})}function aK(){const{role:e}=vt();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(al,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(rK,{})})]})}function th(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter),e!=null&&e.engagement&&t.set("engagement",e.engagement);const n=t.toString();return Ee.get(Nn(`/chats${n?`?${n}`:""}`))}function iK(e){return Ee.post(Nn("/chats"),e)}function sK(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function jT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function lK(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}function ET(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function oK(e,t){return Ee.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function CT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/engagement`,{status:t})}function jo(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function uK(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function cK(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 Nb(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function dK(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}`:""}`)}const{ACTIVE:Qk,ARCHIVED:Kk,DELETED:Yk}=Ly;function fK(e,t){return e===Qk?[{key:"archive",label:"Archive",onSelect:()=>t(Kk)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(Yk)}]:e===Kk?[{key:"unarchive",label:"Unarchive",onSelect:()=>t(Qk)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(Yk)}]:[]}const hK="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100";function mK({chatId:e,status:t}){const n=gn(),a=mt({mutationFn:o=>CT(e,o),onSuccess:()=>{n.invalidateQueries({queryKey:["me","chats"]}),n.invalidateQueries({queryKey:["chat-detail",e]})}}),s=fK(t,o=>a.mutate(o));return l.jsx(jb,{actions:s,ariaLabel:"Manage chat",triggerClassName:hK})}const nh="draft",pK=[{value:"active",label:"Active"},{value:"archived",label:"Archived"},{value:"all",label:"All"}];function gK(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),o=c=>{var f;return((f=s.find(m=>m.type===c))==null?void 0:f.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function yK(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function vK({selectedChatId:e,onSelectChat:t,onNewChat:n,engagement:a,onEngagementChange:s}){const[o,c]=b.useState("all"),[f,m]=b.useState([]),[h,p]=b.useState(!1),[g,x]=b.useState(null),{data:w,isLoading:k}=Ke({queryKey:["me","chats",o,a],queryFn:()=>th({filter:o,engagement:a}),refetchInterval:15e3}),j=()=>{f.length>0&&m([]),x(null)},S=(w==null?void 0:w.rows)??[],C=b.useMemo(()=>[...S,...f],[S,f]),_=async()=>{if(h)return;const L=w==null?void 0:w.nextCursor;if(L){p(!0),x(null);try{const I=await th({filter:o,engagement:a,cursor:L});m(K=>[...K,...I.rows]),z(I.nextCursor)}catch(I){x(I instanceof Error?I.message:"Failed to load more")}finally{p(!1)}}},[R,z]=b.useState(null),P=(w==null?void 0:w.nextCursor)??null;b.useEffect(()=>{z(P)},[P]);const O=b.useMemo(()=>C.reduce((L,I)=>L+(I.unreadMentionCount>0?1:0),0),[C]);return l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===nh?"var(--bg-active)":"transparent",color:e===nh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[l.jsx(wa,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),l.jsx("div",{className:"flex items-center",style:{gap:4},children:pK.map(L=>l.jsx(eh,{active:a===L.value,onClick:()=>{a!==L.value&&(s(L.value),j())},children:L.label},L.value))}),O>0&&l.jsx("div",{className:"flex items-center gap-1 shrink-0",children:l.jsx(eh,{active:o==="unread",count:O,onClick:()=>{c(o==="unread"?"all":"unread"),j()},children:"unread"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[k&&C.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!k&&C.length===0&&l.jsxs("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},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."})]}),C.map(L=>{const I=e===L.chatId,K=yK(L),D=K&&K!==L.title?K:"",Y=L.unreadMentionCount>0;return l.jsxs("div",{className:"group relative",style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:()=>t(L.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:I?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${I?"var(--accent)":"transparent"}`},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[Y&&l.jsx("span",{"aria-label":`${L.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:Y?"var(--fg)":"var(--fg-2)",fontWeight:Y?700:500,flex:1,minWidth:0},children:L.title}),L.lastMessageAt&&l.jsx("span",{className:"mono text-caption shrink-0 transition-opacity group-hover:opacity-0 group-has-aria-expanded:opacity-0",style:{color:"var(--fg-4)"},children:gK(L.lastMessageAt)})]}),l.jsx("div",{className:"truncate text-body",style:{color:Y?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:D||"—"})]}),l.jsx("div",{className:"absolute",style:{top:"var(--sp-2)",right:"var(--sp-3)"},children:l.jsx(mK,{chatId:L.chatId,status:L.engagementStatus})})]},L.chatId)}),R&&C.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:_,disabled:h,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:h?"default":"pointer",opacity:h?.6:1},children:h?"Loading…":"Load more"}),g&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:g})]})]})]})}function _b(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 bK(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Tb({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}),bK(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function xK(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 Xk(e,t){return(e.displayName??e.name??"").localeCompare(t.displayName??t.name??"")}function Ab(e){const t=e.filter(a=>a.managedByMe).sort(Xk),n=e.filter(a=>!a.managedByMe).sort(Xk);return t.length>0&&n.length>0?[...t,{divider:!0},...n]:[...t,...n]}function wK(e,t){if(!t)return Ab(e).filter(a=>!("divider"in a)).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 SK(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${s}${c}${m}`,p=s.length+c.length+(f?1:0);return{text:h,cursor:p}}function NT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=b.useState(0),[f,m]=b.useState(null),h=b.useMemo(()=>s?null:xK(e,t),[e,t,s]),p=b.useMemo(()=>h?wK(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{c(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const x=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&p.length>0&&!x;function k(){m((h==null?void 0:h.triggerIndex)??null)}function j(C){if(!h)return;const _=SK(e,h,t,C);_&&a(_)}return{trigger:w?h:null,results:w?p:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(_=>p.length===0?0:(_+1)%p.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(_=>p.length===0?0:(_-1+p.length)%p.length),!0;if(C.key==="Enter"||C.key==="Tab"){const _=p[o]??p[0];return _?(C.preventDefault(),j(_),!0):!1}return C.key==="Escape"?(C.preventDefault(),k(),!0):!1},pick:j,dismiss:k}}function _T({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=b.useRef(null);return b.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:l.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:ze("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const f=_b(t);return t.map((m,h)=>{const p=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":p,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:g=>{g.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:p?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Tb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function TT(e,t){b.useLayoutEffect(()=>{const n=e.current;n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)},[e,t])}function kK({onCreated:e}){const t=gn(),{agentId:n}=vt(),a=Uv(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[x,w]=b.useState(!1),[k,j]=b.useState(!1),S=b.useRef(null),C=b.useRef(!1),_=b.useRef(null);TT(S,c);const{data:R}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),z=b.useMemo(()=>{const J=(R==null?void 0:R.agents)??[],W=[];for(const Z of J){if(n&&Z.agentId===n)continue;const ne=a(Z.agentId);!ne||!ne.name||W.push({agentId:Z.agentId,name:ne.name,displayName:ne.displayName,managedByMe:Z.managedByMe})}return W},[R,a,n]);b.useEffect(()=>{if(C.current||s.length>0||z.length===0)return;const J=EK(z,(R==null?void 0:R.agents)??[]);J&&(o([J]),C.current=!0)},[z,R,s.length]);const P=b.useMemo(()=>{const J=z.map(W=>({agentId:W.agentId,name:W.name}));return EN(c,J)},[c,z]),O=NT({value:c,cursor:m,candidates:z,disabled:x,onSelect:J=>{f(J.text),h(J.cursor),requestAnimationFrame(()=>{const W=S.current;W&&(W.focus(),W.setSelectionRange(J.cursor,J.cursor))})}});b.useEffect(()=>{P.length!==0&&o(J=>{const W=new Set(J);let Z=!1;for(const ne of P)W.has(ne)||(W.add(ne),Z=!0);return Z?[...W]:J})},[P]),b.useEffect(()=>{if(!k)return;const J=W=>{_.current&&(_.current.contains(W.target)||j(!1))};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[k]);const L=mt({mutationFn:async({participantIds:J,text:W})=>{const Z=await iK({participantIds:J}),ne=W.trim();return ne.length>0&&await jo(Z.chatId,ne),Z.chatId},onSuccess:J=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(J)},onError:J=>{g(J instanceof Error?J.message:"Failed to create chat")}}),I=b.useMemo(()=>!(x||L.isPending||s.length===0||c.trim().length===0||s.length>=2&&P.length===0),[x,L.isPending,s.length,c,P.length]),K=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&P.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,P.length]),D=async()=>{if(!I)return;const J=Array.from(new Set([...s,...P]));g(null),w(!0);try{await L.mutateAsync({participantIds:J,text:c})}finally{w(!1)}},Y=J=>{o(W=>W.filter(Z=>Z!==J))},se=J=>{o(W=>W.includes(J)?W:[...W,J]),j(!1)},xe=b.useMemo(()=>z.filter(J=>!s.includes(J.agentId)),[z,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(jK,{chips:s,candidates:z,chipCandidates:xe,pickerOpen:k,setPickerOpen:j,pickerContainerRef:_,onAdd:se,onRemove:Y}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(_T,{trigger:O.trigger,results:O.results,highlightIndex:O.highlightIndex,anchorRef:S,onPick:O.pick}),l.jsx("textarea",{ref:S,value:c,onChange:J=>{f(J.target.value),h(J.target.selectionStart??J.target.value.length)},onSelect:J=>{h(J.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:J=>{J.nativeEvent.isComposing||O.handleKey(J)||J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),D())},disabled:x||L.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}}),s.length>=2&&P.length===0&&c.trim().length>0&&l.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void D(),disabled:!I,title:K??"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",!I&&"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(xE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),p&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:p})]})})})}function jK({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:f}){return l.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(g=>g.agentId===m),p=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return l.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[l.jsx("span",{children:p}),l.jsx("button",{type:"button",onClick:()=>f(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:l.jsx(os,{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(wa,{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=_b(n);return Ab(n).map(h=>"divider"in h?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):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(Tb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function EK(e,t){var c;const n=new Set(e.map(f=>f.agentId)),a=t.filter(f=>n.has(f.agentId)&&f.managedByMe);if(a.length===0)return null;const s=[...a].filter(f=>f.runtimeUpdatedAt).sort((f,m)=>(m.runtimeUpdatedAt??"").localeCompare(f.runtimeUpdatedAt??""))[0];if(s)return s.agentId;const o=a.find(f=>f.type==="personal_assistant");return o?o.agentId:((c=a[0])==null?void 0:c.agentId)??null}const CK="first-tree-hub-images",NK=1,Eo="images";let jf=null;function AT(){return jf||(jf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(CK,NK);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(Eo)||n.createObjectStore(Eo,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),jf)}async function _K(e){const t=await AT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(Eo,"readwrite"),o=s.objectStore(Eo),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 TK(e){const t=await AT();return t?new Promise(n=>{const o=t.transaction(Eo,"readonly").objectStore(Eo).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 AK(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:RT,setPrototypeOf:Wk,isFrozen:RK,getPrototypeOf:OK,getOwnPropertyDescriptor:zK}=Object;let{freeze:dr,seal:la,create:Kl}=Object,{apply:ev,construct:tv}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});la||(la=function(t){return t});ev||(ev=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)});tv||(tv=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 qu=Cn(Array.prototype.forEach),MK=Cn(Array.prototype.lastIndexOf),Jk=Cn(Array.prototype.pop),Zu=Cn(Array.prototype.push),DK=Cn(Array.prototype.splice),sr=Array.isArray,Xu=Cn(String.prototype.toLowerCase),Bg=Cn(String.prototype.toString),ej=Cn(String.prototype.match),Zl=Cn(String.prototype.replace),tj=Cn(String.prototype.indexOf),IK=Cn(String.prototype.trim),LK=Cn(Number.prototype.toString),PK=Cn(Boolean.prototype.toString),nj=typeof BigInt>"u"?null:Cn(BigInt.prototype.toString),rj=typeof Symbol>"u"?null:Cn(Symbol.prototype.toString),sn=Cn(Object.prototype.hasOwnProperty),Gu=Cn(Object.prototype.toString),qn=Cn(RegExp.prototype.test),Ef=UK(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 ev(e,t,a)}}function UK(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return tv(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xu;if(Wk&&Wk(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&&(RK(t)||(t[a]=o),s=o)}e[s]=!0}return e}function BK(e){for(let t=0;t<e.length;t++)sn(e,t)||(e[t]=null);return e}function wr(e){const t=Kl(null);for(const[n,a]of RT(e))sn(e,n)&&(sr(a)?t[n]=BK(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=wr(a):t[n]=a);return t}function FK(e){switch(typeof e){case"string":return e;case"number":return LK(e);case"boolean":return PK(e);case"bigint":return nj?nj(e):"0";case"symbol":return rj?rj(e):"Symbol()";case"undefined":return Gu(e);case"function":case"object":{if(e===null)return Gu(e);const t=e,n=Yl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Gu(a)}return Gu(e)}default:return Gu(e)}}function Yl(e,t){for(;e!==null;){const a=zK(e,t);if(a){if(a.get)return Cn(a.get);if(typeof a.value=="function")return Cn(a.value)}e=OK(e)}function n(){return null}return n}function $K(e){try{return qn(e,""),!0}catch{return!1}}const aj=dr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fg=dr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$g=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"]),HK=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"]),Hg=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"]),qK=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ij=dr(["#text"]),sj=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"]),qg=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"]),lj=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"]),Cf=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ZK=la(/\{\{[\w\W]*|[\w\W]*\}\}/gm),GK=la(/<%[\w\W]*|[\w\W]*%>/gm),VK=la(/\$\{[\w\W]*/gm),QK=la(/^data-[\-\w.\u00B7-\uFFFF]+$/),KK=la(/^aria-[\-\w]+$/),OT=la(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),YK=la(/^(?:\w+script|data):/i),XK=la(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zT=la(/^html$/i),WK=la(/^[a-z][.\w]*(-[.\w]+)+$/i);var oj=Object.freeze({__proto__:null,ARIA_ATTR:KK,ATTR_WHITESPACE:XK,CUSTOM_ELEMENT:WK,DATA_ATTR:QK,DOCTYPE_NAME:zT,ERB_EXPR:GK,IS_ALLOWED_URI:OT,IS_SCRIPT_OR_DATA:YK,MUSTACHE_EXPR:ZK,TMPLIT_EXPR:VK});const Vu={element:1,text:3,progressingInstruction:7,comment:8,document:9},JK=function(){return typeof window>"u"?null:window},eY=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}},uj=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function MT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:JK();const t=Be=>MT(Be);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Vu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:x,trustedTypes:w}=e,k=m.prototype,j=Yl(k,"cloneNode"),S=Yl(k,"remove"),C=Yl(k,"nextSibling"),_=Yl(k,"childNodes"),R=Yl(k,"parentNode");if(typeof c=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let z,P="";const{implementation:O,createNodeIterator:L,createDocumentFragment:I,getElementsByTagName:K}=n,{importNode:D}=a;let Y=uj();t.isSupported=typeof RT=="function"&&typeof R=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:se,ERB_EXPR:xe,TMPLIT_EXPR:J,DATA_ATTR:W,ARIA_ATTR:Z,IS_SCRIPT_OR_DATA:ne,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:Ae}=oj;let{IS_ALLOWED_URI:M}=oj,U=null;const F=We({},[...aj,...Fg,...$g,...Hg,...ij]);let T=null;const G=We({},[...sj,...qg,...lj,...Cf]);let q=Object.seal(Kl(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}})),ie=null,ve=null;const we=Object.seal(Kl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let me=!0,Me=!0,Ie=!1,St=!0,tt=!1,it=!0,V=!1,pe=!1,_e=!1,Ue=!1,Mt=!1,Pt=!1,hr=!0,gi=!1;const yi="user-content-";let cn=!0,fa=!1,oe={},ge=null;const $e=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const st=We({},["audio","video","img","source","image","track"]);let dn=null;const tr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zt="http://www.w3.org/1998/Math/MathML",Ut="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let ot=At,nr=!1,Mn=null;const il=We({},[Zt,Ut,At],Bg);let ha=We({},["mi","mo","mn","ms","mtext"]),ma=We({},["annotation-xml"]);const Da=We({},["title","style","font","a","script"]);let Vn=null;const Ia=["application/xhtml+xml","text/html"],ka="text/html";let Gt=null,je=null;const nt=n.createElement("form"),yn=function($){return $ instanceof RegExp||$ instanceof Function},Ar=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(je&&je===$)return;(!$||typeof $!="object")&&($={}),$=wr($),Vn=Ia.indexOf($.PARSER_MEDIA_TYPE)===-1?ka:$.PARSER_MEDIA_TYPE,Gt=Vn==="application/xhtml+xml"?Bg:Xu,U=sn($,"ALLOWED_TAGS")&&sr($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,Gt):F,T=sn($,"ALLOWED_ATTR")&&sr($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,Gt):G,Mn=sn($,"ALLOWED_NAMESPACES")&&sr($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Bg):il,dn=sn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)?We(wr(tr),$.ADD_URI_SAFE_ATTR,Gt):tr,Ve=sn($,"ADD_DATA_URI_TAGS")&&sr($.ADD_DATA_URI_TAGS)?We(wr(st),$.ADD_DATA_URI_TAGS,Gt):st,ge=sn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,Gt):$e,ie=sn($,"FORBID_TAGS")&&sr($.FORBID_TAGS)?We({},$.FORBID_TAGS,Gt):wr({}),ve=sn($,"FORBID_ATTR")&&sr($.FORBID_ATTR)?We({},$.FORBID_ATTR,Gt):wr({}),oe=sn($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?wr($.USE_PROFILES):$.USE_PROFILES:!1,me=$.ALLOW_ARIA_ATTR!==!1,Me=$.ALLOW_DATA_ATTR!==!1,Ie=$.ALLOW_UNKNOWN_PROTOCOLS||!1,St=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,tt=$.SAFE_FOR_TEMPLATES||!1,it=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,Ue=$.RETURN_DOM||!1,Mt=$.RETURN_DOM_FRAGMENT||!1,Pt=$.RETURN_TRUSTED_TYPE||!1,_e=$.FORCE_BODY||!1,hr=$.SANITIZE_DOM!==!1,gi=$.SANITIZE_NAMED_PROPS||!1,cn=$.KEEP_CONTENT!==!1,fa=$.IN_PLACE||!1,M=$K($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:OT,ot=typeof $.NAMESPACE=="string"?$.NAMESPACE:At,ha=sn($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?wr($.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),ma=sn($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?wr($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const he=sn($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?wr($.CUSTOM_ELEMENT_HANDLING):Kl(null);if(q=Kl(null),sn(he,"tagNameCheck")&&yn(he.tagNameCheck)&&(q.tagNameCheck=he.tagNameCheck),sn(he,"attributeNameCheck")&&yn(he.attributeNameCheck)&&(q.attributeNameCheck=he.attributeNameCheck),sn(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),tt&&(Me=!1),Mt&&(Ue=!0),oe&&(U=We({},ij),T=Kl(null),oe.html===!0&&(We(U,aj),We(T,sj)),oe.svg===!0&&(We(U,Fg),We(T,qg),We(T,Cf)),oe.svgFilters===!0&&(We(U,$g),We(T,qg),We(T,Cf)),oe.mathMl===!0&&(We(U,Hg),We(T,lj),We(T,Cf))),we.tagCheck=null,we.attributeCheck=null,sn($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?we.tagCheck=$.ADD_TAGS:sr($.ADD_TAGS)&&(U===F&&(U=wr(U)),We(U,$.ADD_TAGS,Gt))),sn($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?we.attributeCheck=$.ADD_ATTR:sr($.ADD_ATTR)&&(T===G&&(T=wr(T)),We(T,$.ADD_ATTR,Gt))),sn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)&&We(dn,$.ADD_URI_SAFE_ATTR,Gt),sn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)&&(ge===$e&&(ge=wr(ge)),We(ge,$.FORBID_CONTENTS,Gt)),sn($,"ADD_FORBID_CONTENTS")&&sr($.ADD_FORBID_CONTENTS)&&(ge===$e&&(ge=wr(ge)),We(ge,$.ADD_FORBID_CONTENTS,Gt)),cn&&(U["#text"]=!0),V&&We(U,["html","head","body"]),U.table&&(We(U,["tbody"]),delete ie.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=$.TRUSTED_TYPES_POLICY,P=z.createHTML("")}else z===void 0&&(z=eY(w,s)),z!==null&&typeof P=="string"&&(P=z.createHTML(""));dr&&dr($),je=$},vi=We({},[...Fg,...$g,...HK]),ys=We({},[...Hg,...qK]),$c=function($){let he=R($);(!he||!he.tagName)&&(he={namespaceURI:ot,tagName:"template"});const Ce=Xu($.tagName),wt=Xu(he.tagName);return Mn[$.namespaceURI]?$.namespaceURI===Ut?he.namespaceURI===At?Ce==="svg":he.namespaceURI===Zt?Ce==="svg"&&(wt==="annotation-xml"||ha[wt]):!!vi[Ce]:$.namespaceURI===Zt?he.namespaceURI===At?Ce==="math":he.namespaceURI===Ut?Ce==="math"&&ma[wt]:!!ys[Ce]:$.namespaceURI===At?he.namespaceURI===Ut&&!ma[wt]||he.namespaceURI===Zt&&!ha[wt]?!1:!ys[Ce]&&(Da[Ce]||!vi[Ce]):!!(Vn==="application/xhtml+xml"&&Mn[$.namespaceURI]):!1},rr=function($){Zu(t.removed,{element:$});try{R($).removeChild($)}catch{S($)}},pa=function($,he){try{Zu(t.removed,{attribute:he.getAttributeNode($),from:he})}catch{Zu(t.removed,{attribute:null,from:he})}if(he.removeAttribute($),$==="is")if(Ue||Mt)try{rr(he)}catch{}else try{he.setAttribute($,"")}catch{}},Lo=function($){let he=null,Ce=null;if(_e)$="<remove></remove>"+$;else{const Jt=ej($,/^[\r\n\t ]+/);Ce=Jt&&Jt[0]}Vn==="application/xhtml+xml"&&ot===At&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const wt=z?z.createHTML($):$;if(ot===At)try{he=new x().parseFromString(wt,Vn)}catch{}if(!he||!he.documentElement){he=O.createDocument(ot,"template",null);try{he.documentElement.innerHTML=nr?P:wt}catch{}}const pt=he.body||he.documentElement;return $&&Ce&&pt.insertBefore(n.createTextNode(Ce),pt.childNodes[0]||null),ot===At?K.call(he,V?"html":"body")[0]:V?he.documentElement:pt},Po=function($){return L.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},qr=function($){return $ instanceof g&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof p)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},fn=function($){return typeof f=="function"&&$ instanceof f};function Vt(Be,$,he){qu(Be,Ce=>{Ce.call(t,$,he,je)})}const La=function($){let he=null;if(Vt(Y.beforeSanitizeElements,$,null),qr($))return rr($),!0;const Ce=Gt($.nodeName);if(Vt(Y.uponSanitizeElement,$,{tagName:Ce,allowedTags:U}),it&&$.hasChildNodes()&&!fn($.firstElementChild)&&qn(/<[/\w!]/g,$.innerHTML)&&qn(/<[/\w!]/g,$.textContent)||it&&$.namespaceURI===At&&Ce==="style"&&fn($.firstElementChild)||$.nodeType===Vu.progressingInstruction||it&&$.nodeType===Vu.comment&&qn(/<[/\w]/g,$.data))return rr($),!0;if(ie[Ce]||!(we.tagCheck instanceof Function&&we.tagCheck(Ce))&&!U[Ce]){if(!ie[Ce]&&Hc(Ce)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ce)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ce)))return!1;if(cn&&!ge[Ce]){const wt=R($)||$.parentNode,pt=_($)||$.childNodes;if(pt&&wt){const Jt=pt.length;for(let Un=Jt-1;Un>=0;--Un){const vn=j(pt[Un],!0);wt.insertBefore(vn,C($))}}}return rr($),!0}return $ instanceof m&&!$c($)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&qn(/<\/no(script|embed|frames)/i,$.innerHTML)?(rr($),!0):(tt&&$.nodeType===Vu.text&&(he=$.textContent,qu([se,xe,J],wt=>{he=Zl(he,wt," ")}),$.textContent!==he&&(Zu(t.removed,{element:$.cloneNode()}),$.textContent=he)),Vt(Y.afterSanitizeElements,$,null),!1)},sl=function($,he,Ce){if(ve[he]||hr&&(he==="id"||he==="name")&&(Ce in n||Ce in nt))return!1;const wt=T[he]||we.attributeCheck instanceof Function&&we.attributeCheck(he,$);if(!(Me&&!ve[he]&&qn(W,he))){if(!(me&&qn(Z,he))){if(!wt||ve[he]){if(!(Hc($)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,$)||q.tagNameCheck instanceof Function&&q.tagNameCheck($))&&(q.attributeNameCheck instanceof RegExp&&qn(q.attributeNameCheck,he)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(he,$))||he==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ce)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ce))))return!1}else if(!dn[he]){if(!qn(M,Zl(Ce,ke,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&$!=="script"&&tj(Ce,"data:")===0&&Ve[$])){if(!(Ie&&!qn(ne,Zl(Ce,ke,"")))){if(Ce)return!1}}}}}}return!0},Lh=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Hc=function($){return!Lh[Xu($)]&&qn(Ae,$)},Uo=function($){Vt(Y.beforeSanitizeAttributes,$,null);const{attributes:he}=$;if(!he||qr($))return;const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let wt=he.length;for(;wt--;){const pt=he[wt],{name:Jt,namespaceURI:Un,value:vn}=pt,Dn=Gt(Jt),Bo=vn;let hn=Jt==="value"?Bo:IK(Bo);if(Ce.attrName=Dn,Ce.attrValue=hn,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,Vt(Y.uponSanitizeAttribute,$,Ce),hn=Ce.attrValue,gi&&(Dn==="id"||Dn==="name")&&tj(hn,yi)!==0&&(pa(Jt,$),hn=yi+hn),it&&qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,hn)){pa(Jt,$);continue}if(Dn==="attributename"&&ej(hn,"href")){pa(Jt,$);continue}if(Ce.forceKeepAttr)continue;if(!Ce.keepAttr){pa(Jt,$);continue}if(!St&&qn(/\/>/i,hn)){pa(Jt,$);continue}tt&&qu([se,xe,J],qc=>{hn=Zl(hn,qc," ")});const Fo=Gt($.nodeName);if(!sl(Fo,Dn,hn)){pa(Jt,$);continue}if(z&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Un)switch(w.getAttributeType(Fo,Dn)){case"TrustedHTML":{hn=z.createHTML(hn);break}case"TrustedScriptURL":{hn=z.createScriptURL(hn);break}}if(hn!==Bo)try{Un?$.setAttributeNS(Un,Jt,hn):$.setAttribute(Jt,hn),qr($)?rr($):Jk(t.removed)}catch{pa(Jt,$)}}Vt(Y.afterSanitizeAttributes,$,null)},bi=function($){let he=null;const Ce=Po($);for(Vt(Y.beforeSanitizeShadowDOM,$,null);he=Ce.nextNode();)Vt(Y.uponSanitizeShadowNode,he,null),La(he),Uo(he),he.content instanceof o&&bi(he.content);Vt(Y.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Be){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Ce=null,wt=null,pt=null;if(nr=!Be,nr&&(Be="<!-->"),typeof Be!="string"&&!fn(Be)&&(Be=FK(Be),typeof Be!="string"))throw Ef("dirty is not a string, aborting");if(!t.isSupported)return Be;if(pe||Ar($),t.removed=[],typeof Be=="string"&&(fa=!1),fa){const vn=Be.nodeName;if(typeof vn=="string"){const Dn=Gt(vn);if(!U[Dn]||ie[Dn])throw Ef("root node is forbidden and cannot be sanitized in-place")}}else if(Be instanceof f)he=Lo("<!---->"),Ce=he.ownerDocument.importNode(Be,!0),Ce.nodeType===Vu.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?he=Ce:he.appendChild(Ce);else{if(!Ue&&!tt&&!V&&Be.indexOf("<")===-1)return z&&Pt?z.createHTML(Be):Be;if(he=Lo(Be),!he)return Ue?null:Pt?P:""}he&&_e&&rr(he.firstChild);const Jt=Po(fa?Be:he);for(;wt=Jt.nextNode();)La(wt),Uo(wt),wt.content instanceof o&&bi(wt.content);if(fa)return Be;if(Ue){if(tt){he.normalize();let vn=he.innerHTML;qu([se,xe,J],Dn=>{vn=Zl(vn,Dn," ")}),he.innerHTML=vn}if(Mt)for(pt=I.call(he.ownerDocument);he.firstChild;)pt.appendChild(he.firstChild);else pt=he;return(T.shadowroot||T.shadowrootmode)&&(pt=D.call(a,pt,!0)),pt}let Un=V?he.outerHTML:he.innerHTML;return V&&U["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&qn(zT,he.ownerDocument.doctype.name)&&(Un="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
417
- `+Un),tt&&qu([se,xe,J],vn=>{Un=Zl(Un,vn," ")}),z&&Pt?z.createHTML(Un):Un},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ar(Be),pe=!0},t.clearConfig=function(){je=null,pe=!1},t.isValidAttribute=function(Be,$,he){je||Ar({});const Ce=Gt(Be),wt=Gt($);return sl(Ce,wt,he)},t.addHook=function(Be,$){typeof $=="function"&&Zu(Y[Be],$)},t.removeHook=function(Be,$){if($!==void 0){const he=MK(Y[Be],$);return he===-1?void 0:DK(Y[Be],he,1)[0]}return Jk(Y[Be])},t.removeHooks=function(Be){Y[Be]=[]},t.removeAllHooks=function(){Y=uj()},t}var DT=MT();let cj=!1;function tY(){cj||(cj=!0,DT.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}))}function nY({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:(tY(),DT.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(zh,{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 eo="__free_text__";function Qu(){return{picked:[],freeText:""}}function dj(e,t){if(t.picked.includes(eo)){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 rY({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const S={};for(const C of n.questions)S[C.question]=Qu();return S});b.useEffect(()=>{if(!a)return;const S={};for(const C of n.questions){const _=a.answers[C.question];if(!_){S[C.question]=Qu();continue}const R=new Set(C.options.map(O=>O.label)),z=C.multiSelect?_.split(/,\s*/u):[_],P=z.filter(O=>R.has(O));P.length===z.length&&P.length>0?S[C.question]={picked:P,freeText:""}:S[C.question]={picked:[eo],freeText:_}}h(S)},[a,n.questions]);const p=gn(),[g,x]=b.useState(null),w=mt({mutationFn:async S=>AK(e,n.correlationId,S),onSuccess:()=>{x(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:S=>{x(S instanceof Error?S.message:String(S))}}),k=b.useCallback(()=>{x(null);const S={};for(const C of n.questions){const _=m[C.question]??Qu(),R=dj(C,_);if(R===null){x(`Please answer "${C.question}" before submitting.`);return}S[C.question]=R}w.mutate(S)},[n.questions,m,w]),j=b.useMemo(()=>n.questions.every(S=>{const C=m[S.question]??Qu();return dj(S,C)!==null}),[n.questions,m]);return l.jsxs("div",{className:ze("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(S=>l.jsx(aY,{question:S,previewFormat:n.previewFormat,selection:m[S.question]??Qu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:C=>h(_=>({..._,[S.question]:C}))},S.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(ye,{type:"button",disabled:!j||w.isPending,onClick:k,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function aY({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const f=b.useRef(null),m=n.picked.includes(eo);b.useEffect(()=>{var p;m&&!s&&((p=f.current)==null||p.focus())},[m,s]);const h=b.useCallback(p=>{const g=n.picked.includes(p);let x;e.multiSelect?x=g?n.picked.filter(w=>w!==p):[...n.picked,p]:x=g?[]:[p],c({...n,picked:x})},[e.multiSelect,n,c]);return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(p=>l.jsx(nY,{option:p,previewFormat:t,selected:n.picked.includes(p.label),disabled:s,showCheckmark:o,onToggle:()=>h(p.label)},p.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(p=>p!==eo):[...n.picked,eo]:m?[]:[eo],freeText:n.freeText}),className:ze("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?l.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:p=>c({...n,freeText:p.target.value}),onClick:p=>p.stopPropagation(),onKeyDown:p=>{p.key==="Enter"&&!p.metaKey&&!p.ctrlKey&&p.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function iY(e){return m9.safeParse(e).success}function IT(e){return p9.safeParse(e).success}function sY(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=fj(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=fj(s.payload);return o?a.get(o)===s.seq:!0})}function fj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Io(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 lY(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function hj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function oY({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 uY({event:e}){const t=PD(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?hj(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:["(",hj(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:["· ",lY(t.durationMs)]}):null]})]})}function cY({event:e,agentNameFn:t,agentId:n}){const a=BD(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[l.jsx(Ih,{name:s,isSelf:!1}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(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 dY({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:Io(e.createdAt)})]})}function fY({event:e}){const t=UD(e.payload),n=Io(e.createdAt);return l.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[l.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),l.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Ih({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return l.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?n:l.jsx(Dc,{width:9,height:10,style:{color:"var(--accent)"}})})}function hY({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:a,isSelf:s}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(oY,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&mY(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"&&pY(e.content)?l.jsx(gY,{content:e.content}):e.format==="text"?l.jsx(zh,{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 mY(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 pY(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 gY({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return TK(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 yY({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:o}){const c=o(e.senderId);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:c,isSelf:!1}),l.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)})]}),l.jsx(rY,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function vY({msg:e,agentNameFn:t}){const n=IT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([o,c])=>`${o.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ih,{name:a,isSelf:!0}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(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 bY({metadata:e}){if(!e||e.source!=="github")return null;const t=typeof e.entityUrl=="string"?e.entityUrl:null;return t?l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:"View on GitHub",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:"0 var(--sp-1)",textDecoration:"none"},children:l.jsx(Cv,{className:"h-3.5 w-3.5"})}):null}function mj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var it;const o=gn(),c=ph(),f=Uv(),{agentId:m}=vt(),[h,p]=b.useState(""),[g,x]=b.useState(0),[w,k]=b.useState([]),[j,S]=b.useState(!1),[C,_]=b.useState(null),R=b.useRef(null),z=b.useRef(null),P=b.useRef(null);TT(z,h);const O=b.useRef(!1),L=b.useRef(new Set);b.useEffect(()=>{O.current=!1},[t]);const{data:I}=Ke({queryKey:["chat-messages",t],queryFn:()=>dK(t,{limit:50}),refetchInterval:5e3}),{data:K}=Ke({queryKey:["session-events",e,t],queryFn:()=>FD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:D}=Ke({queryKey:["chat-detail",t],queryFn:()=>ET(t),enabled:!!t}),{data:Y}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),se=mt({mutationFn:V=>jo(t,V),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:i1(e)})}}),xe=b.useCallback(V=>{const _e=V.filter(Pt=>Pt.type.startsWith("image/"));if(_e.length===0)return;const Ue=_e.find(Pt=>Pt.size>5242880);if(Ue){_(`Image too large (${(Ue.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const Mt=_e.map(Pt=>({id:crypto.randomUUID(),file:Pt,previewUrl:URL.createObjectURL(Pt)}));k(Pt=>[...Pt,...Mt]),_(null)},[]),J=b.useCallback(V=>{k(pe=>{const _e=pe.find(Ue=>Ue.id===V);return _e&&URL.revokeObjectURL(_e.previewUrl),pe.filter(Ue=>Ue.id!==V)})},[]),W=async()=>{const V=h.trim(),pe=w;if(!(!V&&pe.length===0)&&!j&&!(Me&&Ie.length===0)){if(St.length>0)try{await jT(t,{participantIds:St}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(_e){_(_e instanceof Error?_e.message:"Failed to add participants");return}if(pe.length>0){S(!0),_(null);try{for(const _e of pe){const Ue=await cK(_e.file),Mt=crypto.randomUUID();await _K({imageId:Mt,base64:Ue,mimeType:_e.file.type}),await uK(t,{data:Ue,mimeType:_e.file.type,filename:_e.file.name,size:_e.file.size,imageId:Mt}),URL.revokeObjectURL(_e.previewUrl)}k([]),V&&await jo(t,V),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:i1(e)})}catch(_e){_(_e instanceof Error?_e.message:"Failed to send image")}finally{S(!1)}return}se.mutate(V)}},[Z,ne]=b.useState(!1),[ke,Ae]=b.useState(""),M=b.useRef(null);b.useEffect(()=>{var V;Z&&((V=M.current)==null||V.focus())},[Z]);const U=mt({mutationFn:V=>oK(t,V),onSuccess:()=>{ne(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),F=()=>{const V=ke.trim();U.mutate(V.length>0?V:null)},T=mt({mutationFn:()=>CT(t,Ly.ACTIVE),onSuccess:()=>{o.invalidateQueries({queryKey:["me","chats"]}),o.invalidateQueries({queryKey:["chat-detail",t]})}}),G=b.useMemo(()=>{const V=(I==null?void 0:I.items)??[],pe=sY((K==null?void 0:K.items)??[]),_e=[...V.map(Ue=>({kind:"message",at:Ue.createdAt,key:`m-${Ue.id}`,data:Ue})),...pe.map(Ue=>({kind:"event",at:Ue.createdAt,key:`e-${Ue.id}`,data:Ue}))];return _e.sort((Ue,Mt)=>Ue.at.localeCompare(Mt.at)),_e},[I,K]),q=b.useMemo(()=>{const V=new Map;for(const pe of(I==null?void 0:I.items)??[])pe.format==="question_answer"&&IT(pe.content)&&V.set(pe.content.correlationId,pe.content);return V},[I]),ie=G.length;b.useEffect(()=>{var V;ie>0&&((V=P.current)==null||V.scrollIntoView({behavior:"smooth"}))},[ie]);const ve=c(e),we=b.useMemo(()=>{var V;return new Set(((V=D==null?void 0:D.participants)==null?void 0:V.map(pe=>pe.agentId))??[])},[D==null?void 0:D.participants]),me=b.useMemo(()=>{const V=new Set;for(const Ue of(D==null?void 0:D.participants)??[])V.add(Ue.agentId);for(const Ue of(Y==null?void 0:Y.agents)??[])V.add(Ue.agentId);V.size===0&&V.add(e);const pe=new Map;for(const Ue of(Y==null?void 0:Y.agents)??[])pe.set(Ue.agentId,Ue.managedByMe);const _e=[];for(const Ue of V){if(Ue===m)continue;const Mt=f(Ue);!Mt||!Mt.name||_e.push({agentId:Ue,name:Mt.name,displayName:Mt.displayName,managedByMe:pe.get(Ue)??!1})}return _e},[D==null?void 0:D.participants,Y==null?void 0:Y.agents,e,f,m]),Me=b.useMemo(()=>{if(!D)return!1;if(D.type==="group")return!0;const V=D.participants.some(pe=>pe.agentId===m);return D.type==="direct"&&!V&&D.participants.length>=2},[D,m]);b.useEffect(()=>{if(n||L.current.has(t)||!I||!K||!D||G.length>0||h.length>0||Me||ve===e)return;const V=`Hi ${ve}! What can you help with?`;p(V),x(V.length),L.current.add(t),requestAnimationFrame(()=>{const pe=z.current;pe&&(pe.focus(),pe.setSelectionRange(V.length,V.length))})},[t,e,I,K,D,G.length,h.length,ve,Me,n]);const Ie=b.useMemo(()=>{const V=me.map(pe=>({agentId:pe.agentId,name:pe.name}));return EN(h,V)},[h,me]),St=b.useMemo(()=>we.size===0?[]:Ie.filter(V=>!we.has(V)),[Ie,we]),tt=NT({value:h,cursor:g,candidates:me,disabled:se.isPending||j,onSelect:V=>{p(V.text),x(V.cursor),requestAnimationFrame(()=>{const pe=z.current;pe&&(pe.focus(),pe.setSelectionRange(V.cursor,V.cursor))})}});return l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[l.jsxs("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:[n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(D==null?void 0:D.title)??a??"…"}),l.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):Z?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:M,value:ke,onChange:V=>Ae(V.target.value),onKeyDown:V=>{V.nativeEvent.isComposing||(V.key==="Enter"?(V.preventDefault(),F()):V.key==="Escape"&&(V.preventDefault(),ne(!1)))},disabled:U.isPending,maxLength:500,placeholder:(D==null?void 0:D.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),l.jsx("button",{type:"button",onClick:F,disabled:U.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:()=>ne(!1),disabled:U.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(os,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{Ae((D==null?void 0:D.topic)??""),ne(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(D==null?void 0:D.title)??"…"}),l.jsx(bY,{metadata:D==null?void 0:D.metadata})]}),l.jsx(xY,{chatId:t,participantIds:((it=D==null?void 0:D.participants)==null?void 0:it.map(V=>V.agentId))??[e],candidates:me,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),(D==null?void 0:D.engagementStatus)===Ly.DELETED&&l.jsxs("div",{className:"shrink-0 flex items-center",style:{gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-6)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:[l.jsx("span",{className:"text-body",style:{flex:1},children:"This chat is deleted and won't appear in your conversation list."}),l.jsx("button",{type:"button",disabled:T.isPending,onClick:()=>T.mutate(),className:"text-body",style:{padding:"var(--sp-0_5) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-raised)",color:"var(--fg)",cursor:T.isPending?"default":"pointer",opacity:T.isPending?.6:1},children:T.isPending?"Restoring…":"Restore"})]}),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:[ie===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(Nv,{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:G.map(V=>{if(V.kind==="event"){const _e=V.data;switch(_e.kind){case"tool_call":return l.jsx(uY,{event:_e},V.key);case"assistant_text":return l.jsx(cY,{event:_e,agentId:e,agentNameFn:c},V.key);case"thinking":return l.jsx(dY,{event:_e},V.key);case"error":return l.jsx(fY,{event:_e},V.key);default:return null}}const pe=V.data;if(pe.format==="question"&&iY(pe.content)){const _e=q.get(pe.content.correlationId)??null,Ue=_e?"answered":"pending";return l.jsx(yY,{msg:pe,chatId:t,content:pe.content,answer:_e,status:Ue,agentNameFn:c},V.key)}return pe.format==="question_answer"?l.jsx(vY,{msg:pe,agentNameFn:c},V.key):l.jsx(hY,{msg:pe,myAgentId:m,agentNameFn:c},V.key)})}),l.jsx("div",{ref:P})]})}),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(kE,{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(ye,{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:V=>V.preventDefault(),onDrop:V=>{V.preventDefault(),xe(Array.from(V.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(V=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:V.previewUrl,alt:V.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>J(V.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(os,{className:"h-2 w-2"})})]},V.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(_T,{trigger:tt.trigger,results:tt.results,highlightIndex:tt.highlightIndex,anchorRef:z,onPick:tt.pick}),l.jsx("textarea",{ref:z,value:h,onChange:V=>{p(V.target.value),x(V.target.selectionStart??V.target.value.length)},onSelect:V=>{x(V.currentTarget.selectionStart??h.length)},onFocus:()=>{Me&&(O.current||h.length>0||me.length===0||(O.current=!0,p("@"),x(1),requestAnimationFrame(()=>{const V=z.current;V&&V.setSelectionRange(1,1)})))},onPaste:V=>{const pe=Array.from(V.clipboardData.files);pe.length>0&&(V.preventDefault(),xe(pe))},placeholder:Me?"Type @ to pick a recipient, then your message":`Message @${ve} · / for commands · @ to mention`,rows:2,onKeyDown:V=>{V.nativeEvent.isComposing||tt.handleKey(V)||V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),W())},disabled:se.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",minHeight:"calc(2lh + var(--sp-2_25) + var(--sp-7_5))",maxHeight:"10.5rem",overflowY:"auto",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 V=z.current;if(!V)return;const pe=V.selectionStart??h.length,_e=V.selectionEnd??pe,Ue=`${h.slice(0,pe)}@${h.slice(_e)}`;p(Ue),x(pe+1),requestAnimationFrame(()=>{V.focus(),V.setSelectionRange(pe+1,pe+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(Gz,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var V;return(V=R.current)==null?void 0:V.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(CM,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:V=>{V.target.files&&(xe(Array.from(V.target.files)),V.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:W,disabled:se.isPending||j||!h.trim()&&w.length===0||Me&&Ie.length===0,title:Me&&Ie.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",(se.isPending||j||!h.trim()&&w.length===0||Me&&Ie.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(xE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(se.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??(se.error instanceof Error?se.error.message:"Failed to send")})]})})})]})}function xY({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,f]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{if(!c)return;const g=x=>{m.current&&(m.current.contains(x.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);const h=mt({mutationFn:g=>jT(e,{participantIds:[g]}),onSuccess:()=>{f(!1),s()}}),p=b.useMemo(()=>n.filter(g=>!t.includes(g.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(g=>{const x=a(g),w=(x==null?void 0:x.displayName)??(x==null?void 0:x.name)??g.slice(0,8);return l.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},g)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>f(!c),disabled:p.length===0||h.isPending,title:p.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:p.length===0?"var(--fg-4)":"var(--fg-3)",cursor:p.length===0?"not-allowed":"pointer"},children:l.jsx(wa,{className:"h-3 w-3"})}),c&&p.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const g=_b(p);return Ab(p).map(x=>"divider"in x?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:x.name?`@${x.name}`:void 0,onClick:()=>h.mutate(x.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Tb,{candidate:x,ambiguous:g})},x.agentId))})()})]})]})}function pj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function wY(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 SY({chatId:e}){const t=gn(),{agentId:n}=vt(),a=b.useRef(new Map),{data:s}=Ke({queryKey:["chat-detail",e],queryFn:()=>ET(e),enabled:!!e}),{data:o}=Ke({queryKey:["me","chats","all"],queryFn:()=>th({filter:"all"}),refetchInterval:3e4}),{data:c}=Ke({queryKey:["me","chats","watching"],queryFn:()=>th({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>pj(o==null?void 0:o.rows,e)??pj(c==null?void 0:c.rows,e)??null,[o,c,e]),m=b.useMemo(()=>f?f.participants.map(j=>({agentId:j.agentId,type:j.type})):s?s.participants.map(j=>({agentId:j.agentId,type:void 0})):[],[f,s]),h=b.useMemo(()=>wY(m,n),[m,n]),g=mt({mutationFn:()=>sK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,x=(f==null?void 0:f.lastMessageAt)??"";b.useEffect(()=>{!f||a.current.get(e)===x||(a.current.set(e,x),g())},[e,f,x,g]);const w=mt({mutationFn:()=>lK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),k=(f==null?void 0:f.membershipKind)==="watching";return h?k?l.jsx(mj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>w.mutate(),joining:w.isPending,error:w.isError?w.error instanceof Error?w.error.message:"Failed to join":null}}):l.jsx(mj,{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 kY(){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(Dc,{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 fi(e,t){try{await Ee.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function jY({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(!1),[k,j]=b.useState(null),S=b.useRef(null);b.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)}})()},[]),b.useEffect(()=>{var P;const z=((P=n.find(O=>O.id===e))==null?void 0:P.displayName)??"";o(z),f(z)},[n,e]),b.useEffect(()=>{const z=S.current;if(!z||!c)return;z.focus();const P=z.value.length;z.setSelectionRange(P,P)},[c]);const C=s.trim(),_=C.length>0&&!m&&x&&!k,R=b.useCallback(async z=>{if(z==null||z.preventDefault(),!(!_||!e)){g(null);try{C!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),fi("team_renamed")),t()}catch(P){g(P instanceof Error?P.message:"Failed to rename team")}finally{h(!1)}}},[_,e,C,c,t]);return l.jsxs("form",{onSubmit:R,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:S,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:z=>o(z.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:z=>{z.currentTarget.style.borderColor="var(--accent)"},onBlur:z=>{z.currentTarget.style.borderColor="var(--border)"}})]}),p||k?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p??`Couldn't load your team — ${k}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(ye,{type:"submit",disabled:!_,children:[l.jsx("span",{children:"Continue"}),l.jsx(bE,{className:"h-4 w-4"})]})})]})}function Rb(){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 ls({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 EY=3e4,CY=1e3,NY=3e3;function _Y(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function TY({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var ve;const s=Rn(),o=jz(e,t),c=Cz(o),f=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=f?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,p]=b.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[g,x]=b.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,k]=b.useState(null),[j,S]=b.useState(null),[C,_]=b.useState(null),[R,z]=b.useState(()=>f),[P,O]=b.useState(()=>m),[L,I]=b.useState([]),[K,D]=b.useState("form"),[Y,se]=b.useState(null),xe=b.useRef(null),J=b.useRef(null),W=b.useRef(null),Z=b.useRef(0);b.useEffect(()=>()=>{J.current&&(J.current.cancelled=!0)},[]),b.useEffect(()=>{Nz(o,{displayName:h,selectedRuntime:g,connectToken:R,connectTokenExpiresAt:P})},[o,h,g,R,P]),b.useEffect(()=>{(async()=>{try{const we=await Ee.get("/me/organizations");I(we)}catch{}})()},[]),b.useEffect(()=>{if(K!=="form")return;let we=!1;const me=async()=>{const Ie=++Z.current;try{const St=await di();if(we||Ie!==Z.current)return;const it=St.filter(V=>V.status==="connected").sort((V,pe)=>pe.lastSeenAt.localeCompare(V.lastSeenAt))[0]??null;if(k(V=>(V==null?void 0:V.id)===(it==null?void 0:it.id)?V:it),it){W.current!==it.id&&(W.current=null,_(null),S(null));try{const V=await ch(it.id);if(we||Ie!==Z.current)return;W.current=it.id,_(it.id),S(V.capabilities)}catch{}}else W.current=null,_(null),S(null)}catch{}};me();const Me=setInterval(me,NY);return()=>{we=!0,clearInterval(Me)}},[K]),b.useEffect(()=>{if(w)return;if(R&&P&&P>Date.now()){const me=Math.max(P-Date.now(),0),Me=window.setTimeout(()=>{z(null),O(null)},me);return()=>window.clearTimeout(Me)}R&&(z(null),O(null));let we=!1;return(async()=>{try{const me=await Ee.post("/me/connect-tokens",{});we||(z(me.token),O(Date.now()+me.expiresIn*1e3))}catch(me){we||se(me instanceof Error?me.message:"Failed to generate connect token")}})(),()=>{we=!0}},[w,R,P]);const ne=w&&C===w.id?j:null;b.useEffect(()=>{x(we=>{var Me;if(!ne)return we;const me=AY(ne);return we&&me&&Object.keys(ne).includes(we)&&((Me=ne[we])==null?void 0:Me.state)==="ok"?we:me})},[ne]);const ke=ne?Object.entries(ne).filter(([,we])=>we.state==="ok").map(([we])=>we):[],Ae=((ve=L.find(we=>we.id===e))==null?void 0:ve.displayName)??"",M=h.trim(),U=M||"your agent",F=R?`npm install -g @agent-team-foundation/first-tree-hub
418
- first-tree-hub connect ${R}`:null,T=b.useCallback(async we=>{J.current&&(J.current.cancelled=!0);const me={cancelled:!1};J.current=me;const Me=Date.now();for(;!me.cancelled;){let Ie=!1;try{const St=await Ee.get(`/agents/${encodeURIComponent(we)}/client-status`);if(me.cancelled)return;Ie=St.online===!0}catch{if(me.cancelled)return}if(Ie){_z(o);try{await a()}catch{}if(me.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Me>EY){me.cancelled||D("timeout");return}await new Promise(St=>setTimeout(St,CY))}},[o,a,s]),G=!!(M&&w&&g&&ke.includes(g)&&K==="form"),q=b.useCallback(async()=>{if(!w||!g||!M)return;se(null),D("creating");const we=Wy(M);let me;try{me=(await Ee.post(Nn("/agents"),{type:"personal_assistant",displayName:M,...we?{name:we}:{},clientId:w.id,runtimeProvider:g,...e?{organizationId:e}:{}})).uuid,xe.current=me,Sz(me),fi("agent_created",{runtimeProvider:g})}catch(Me){se(Me instanceof Error?Me.message:"Failed to create agent"),D("form");return}await T(me)},[M,w,g,T,e]),ie=b.useCallback(async()=>{const we=xe.current;we&&(se(null),D("creating"),await T(we))},[T]);return K==="creating"?l.jsx(LY,{nameOrFallback:U}):K==="timeout"?l.jsx(PY,{nameOrFallback:U,hostname:(w==null?void 0:w.hostname)??null,error:Y,onRetry:ie}):l.jsx(RY,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:p,trimmedName:M,connectedClient:w,cliCommand:F,capabilitiesLoaded:ne!==null,okRuntimes:ke,selectedRuntime:g,setSelectedRuntime:x,error:Y,canCreate:G,onCreate:q})}function AY(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 RY({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,error:g,canCreate:x,onCreate:w}){const k=b.useRef(null),j=e==="invite"&&t,S=f&&m.length===0&&!!o,C=s?o?S?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return b.useEffect(()=>{var _;s||(_=k.current)==null||_.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(Rb,{}),l.jsx(ls,{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:k,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:_=>a(_.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:_=>{_.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:_=>{_.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(ls,{number:"02",state:x?"complete":s?"active":"idle",children:l.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!o&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?l.jsxs(l.Fragment,{children:[l.jsx(DY,{hostname:o.hostname??o.id}),l.jsx(MY,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(OY,{command:c}),l.jsx(zY,{})]})]}):null]})})]}),g&&l.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g}),s&&l.jsxs("div",{style:{marginTop:x?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!x&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),x&&l.jsxs(ye,{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:_=>{_.currentTarget.style.transform="scale(1.01)",_.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:_=>{_.currentTarget.style.transform="scale(1)",_.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(bE,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:x?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function OY({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
419
- `):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),l.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(Ev,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function zY(){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(IY,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function MY({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)"}})}),_Y(s)]},s)})]})]})}function DY({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 IY(){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 LY({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(UY,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function PY({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(ye,{onClick:a,children:"Try again"})})]})}function UY(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Zg,{delayMs:0}),l.jsx(Zg,{delayMs:160}),l.jsx(Zg,{delayMs:320})]})}function Zg({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 LT(){return(await Ee.get("/me/github/repos")).repos}const PT="https://github.com/agent-team-foundation/first-tree";function UT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Ob(e,t){const n=UT(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: ${PT}`].join(`
420
- `)}function BY(e){const t=UT(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: ${PT}`].join(`
421
- `)}function FY(){const{role:e}=vt();return e==="admin"?l.jsx(QY,{}):l.jsx($Y,{})}function $Y(){var f,m;const{organizationId:e}=vt(),[t,n]=b.useState({kind:"loading"}),[a,s]=b.useState(0);if(b.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[p,g]=await Promise.all([Cb(e),wT(e)]);if(h)return;n({kind:"loaded",tree:p,repos:g})}catch(p){if(h)return;n({kind:"error",message:p instanceof Error?p.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(qY,{});if(t.kind==="error")return l.jsx(HY,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((f=t.tree)==null?void 0:f.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return o&&c.length>0?l.jsx(ZY,{treeUrl:o,teamRepos:c}):o?l.jsx(GY,{treeUrl:o}):l.jsx(VY,{})}function HY({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(ye,{type:"button",onClick:t,children:"Try again"})})]})}function qY(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function ZY({treeUrl:e,teamRepos:t}){var j;const n=Rn(),{dismissOnboarding:a}=vt(),{addToast:s}=Ic(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(()=>t.map(S=>S.url)),g=h.length>0,x=b.useCallback(S=>{p(C=>C.includes(S)?C.filter(_=>_!==S):[...C,S])},[]),w=b.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const S=await zb(),C=await Ch(S.uuid);await Nh(S.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(z=>({url:z}))}});const _=await Nb(S.uuid),R=Ob(h,e);try{await jo(_.id,R)}catch{}fi("tree_chat_started",{agentUuid:S.uuid,chatId:_.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(_.id)}`,{replace:!1})}catch(S){m(S instanceof Error?S.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),k=b.useCallback(()=>{fi("tree_intro_dismissed",{joinPath:"invite"}),a(),s(Mb(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(nv,{label:"Tree",value:e}),t.length===1?l.jsx(nv,{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(S=>{const C=h.includes(S.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:S.url,checked:C,onChange:()=>x(S.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:S.url})]},S.url)})]}),f?l.jsx(Db,{children:f}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(ye,{type:"button",disabled:!g||o,onClick:()=>void w(),children:o?"Starting…":"Confirm"}),l.jsx(ye,{type:"button",variant:"outline",onClick:k,disabled:o,children:"I'll do it later"})]})]})]})}function GY({treeUrl:e}){const t=Rn(),{dismissOnboarding:n}=vt(),{addToast:a}=Ic(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),[x,w]=b.useState([]),k=x.length>0,j=b.useCallback(_=>{w(R=>R.includes(_)?R.filter(z=>z!==_):[...R,_])},[]);b.useEffect(()=>{let _=!1;return(async()=>{try{const R=await LT();if(_)return;h(R)}catch(R){_||g(R instanceof Error?R.message:"Failed to list GitHub repositories")}})(),()=>{_=!0}},[]);const S=b.useCallback(async()=>{if(x.length!==0){o(!0),f(null);try{const _=await zb(),R=await Ch(_.uuid);await Nh(_.uuid,{expectedVersion:R.version,payload:{gitRepos:x.map(O=>({url:O}))}});const z=await Nb(_.uuid),P=Ob(x,e);try{await jo(z.id,P)}catch{}fi("tree_chat_started",{agentUuid:_.uuid,chatId:z.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(z.id)}`,{replace:!1})}catch(_){f(_ instanceof Error?_.message:"Failed to start the chat"),o(!1)}}},[x,e,t,n]),C=b.useCallback(()=>{fi("tree_intro_dismissed",{joinPath:"invite"}),n(),a(Mb(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(Rb,{}),l.jsx(ls,{number:"01",state:"complete",children:l.jsx(nv,{label:"Tree",value:e})}),l.jsx(ls,{number:"02",state:k?"complete":"active",children:l.jsx(BT,{disabled:s,repos:m,error:p,selectedRepoUrls:x,onToggle:j})}),l.jsxs(ls,{number:"03",state:k?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:k?"var(--fg)":"var(--fg-4)",fontWeight:k?600:500},children:"Let your agent join the tree"}),k?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?l.jsx(Db,{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(ye,{type:"button",disabled:!k||s,onClick:()=>void S(),children:s?"Starting…":"Continue"}),l.jsx(ye,{type:"button",variant:"outline",onClick:C,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function VY(){const{dismissOnboarding:e}=vt(),{addToast:t}=Ic(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,fi("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 QY(){const e=Rn(),{dismissOnboarding:t,organizationId:n}=vt(),{addToast:a}=Ic(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(""),[x,w]=b.useState([]),[k,j]=b.useState(null),[S,C]=b.useState(null),_=b.useCallback(D=>{w(Y=>Y.includes(D)?Y.filter(se=>se!==D):[...Y,D])},[]);b.useEffect(()=>{let D=!1;return(async()=>{try{const Y=await LT();if(D)return;j(Y)}catch(Y){D||C(Y instanceof Error?Y.message:"Failed to list GitHub repositories")}})(),()=>{D=!0}},[]),b.useEffect(()=>{if(!n)return;let D=!1;return(async()=>{try{const Y=await Cb(n);if(D)return;Y.repo&&(g(Y.repo),h(se=>se??"existing"))}catch{}})(),()=>{D=!0}},[n]);const R=p.trim(),z=(()=>{if(m!=="existing")return!0;if(!R)return!1;try{return new URL(R).protocol==="https:"}catch{return!1}})(),P=b.useCallback(()=>{fi("tree_intro_dismissed"),t(),a(Mb(e))},[t,a,e]),O=b.useCallback(async()=>{if(x.length!==0&&m&&!(m==="existing"&&!z)){f(null),o(!0);try{const D=await zb(),Y=await Ch(D.uuid),se=x.map(W=>({url:W}));if(await Nh(D.uuid,{expectedVersion:Y.version,payload:{gitRepos:se}}),n)try{await ST(n,{repos:se})}catch(W){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",W)}if(m==="existing"&&n)try{await xT(n,{repo:R})}catch(W){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",W),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 Nb(D.uuid),J=m==="existing"?Ob(x,R):BY(x);try{await jo(xe.id,J)}catch{}fi("tree_chat_started",{agentUuid:D.uuid,chatId:xe.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(xe.id)}`,{replace:!1})}catch(D){f(D instanceof Error?D.message:"Failed to start the tree-init chat"),o(!1)}}},[x,m,z,R,n,e,t,a]),L=x.length>0,I=L&&m!==null&&!s&&(m==="new"||z),K=!!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(Rb,{}),l.jsx(ls,{number:"01",state:L?"complete":"active",children:l.jsx(BT,{disabled:s,repos:k,error:S,selectedRepoUrls:x,onToggle:_})}),l.jsxs(ls,{number:"02",state:K?"complete":L?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:L?"var(--fg)":"var(--fg-4)",fontWeight:L?600:500},children:"Bind or create the tree"}),L?l.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:s,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[l.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(D=>{const Y=m===D.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Y?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Y?"var(--fg)":"var(--fg-3)",fontWeight:Y?600:400,boxShadow:Y?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:D.value,checked:Y,onChange:()=>h(D.value),className:"sr-only"}),D.label]},D.value)})]}),m==="existing"?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),l.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:p,onChange:D=>g(D.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?l.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:["Your agent will scaffold a new GitHub repo for the tree and bind"," ",x.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),l.jsxs(ls,{number:"03",state:K?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:K?"var(--fg)":"var(--fg-4)",fontWeight:K?600:500},children:"Let your agent build it"}),K?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill, set up the tree, and open a PR back to"," ",x.length>1?"each source repo":"your source repo","."]}),c?l.jsx(Db,{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(ye,{type:"button",disabled:!I,onClick:()=>void O(),children:s?"Starting…":"Continue"}),l.jsx(ye,{type:"button",variant:"outline",onClick:P,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function zb(){const e=wz(),t=await Pv(),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 Mb(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 nv({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 Db({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 BT({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(ye,{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(KY,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function KY({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=x=>{o.current&&!o.current.contains(x.target)&&s(!1)},g=x=>{x.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[a]);const c=b.useMemo(()=>{const p=new Map;for(const g of e){const x=g.fullName.split("/")[0]??"",w=p.get(x);w?w.push(g):p.set(x,[g])}return[...p.entries()].sort(([g],[x])=>g.localeCompare(x))},[e]),f=b.useMemo(()=>new Set(t),[t]),m=b.useMemo(()=>e.filter(p=>f.has(p.cloneUrl)),[e,f]),h=m.length===0?"Select repositories…":"Add another repository";return l.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&l.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(p=>l.jsx(YY,{fullName:p.fullName,onRemove:()=>n(p.cloneUrl)},p.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(p=>!p),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),l.jsx(jv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([p,g],x)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:x>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(w=>{const k=f.has(w.cloneUrl),j=w.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":k,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:k?"var(--accent-bg)":"transparent",color:k?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:S=>{k||(S.currentTarget.style.background="var(--surface-1)")},onMouseLeave:S=>{k||(S.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:k?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:k?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:k?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)})]},p))})]})}function YY({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(os,{className:"h-3 w-3"})})]})}function XY(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=vt(),[o,c]=lh(),f=o.get("step"),[m]=b.useState(()=>gE()),[h,p]=b.useState(()=>mE()),g=b.useCallback(j=>{xz(j),p(j)},[]),x=s==="admin",w=b.useMemo(()=>f==="team"&&x?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&x?"step1":"step2",[f,e,h,m,x]),k=b.useCallback(()=>{g(!0);const j=new URLSearchParams(o);j.delete("step"),c(j,{replace:!0})},[g,o,c]);return l.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:l.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?l.jsx(jY,{organizationId:n,onContinue:k}):w==="step2"?l.jsx(TY,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(FY,{})})})}function WY({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=vt();return e===nh?l.jsx(kK,{onCreated:t}):e?l.jsx(SY,{chatId:e}):n!==null&&!a?l.jsx(XY,{}):l.jsx(kY,{})}const JY={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function eX(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=vt(),{addToast:a}=Ic(),s=Rn(),[o,c]=lh(),f=o.get("c"),m=o.get("step"),h=mE(),g=gE()==="invite",x=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const w=e==="completed",k=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},j={1:Gg(1,x,e),2:Gg(2,x,e),3:Gg(3,x,e)},S=C=>{if(C!==3)return;const _=new URLSearchParams(o);_.delete("c"),_.set("step","tree"),c(_,{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,_)=>{const R=j[C],z=[1,2,3][_+1],P=z?gj(R)&&gj(j[z]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(tX,{index:C,state:R,label:JY[C],onClick:C===3&&R==="active"?()=>S(C):void 0}),z?l.jsx(rX,{solid:P}):null]},C)})}),l.jsx("button",{type:"button",onClick:k,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 Gg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function gj(e){return e==="active"||e==="completed"}function tX({index:e,state:t,label:n,onClick:a}){const s=!!a,o=nX(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 nX(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 rX({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)"}})}const aX=FN.catch("active");function iX(){const[e,t]=lh(),n=e.get("c"),a=e.get("a"),s=aX.parse(e.get("engagement"));XN(),b.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const o=b.useCallback(m=>{const h=new URLSearchParams(e);h.set("c",m),t(h)},[e,t]),c=b.useCallback(()=>{const m=new URLSearchParams(e);m.set("c",nh),t(m)},[e,t]),f=b.useCallback(m=>{const h=new URLSearchParams(e);m==="active"?h.delete("engagement"):h.set("engagement",m),t(h,{replace:!0})},[e,t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(vK,{selectedChatId:n,onSelectChat:o,onNewChat:c,engagement:s,onEngagementChange:f}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx(eX,{}),l.jsx(WY,{selectedChatId:n,onSelectChat:o})]})]})}const sX=new RR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function lX(){return l.jsx(OR,{client:sX,children:l.jsx(Rz,{children:l.jsx(U4,{children:l.jsx(lz,{children:l.jsxs(IO,{children:[l.jsx(It,{path:"/login",element:l.jsx(OV,{})}),l.jsx(It,{path:"/signup",element:l.jsx(or,{to:"/login",replace:!0})}),l.jsx(It,{path:"/auth/github/complete",element:l.jsx(zV,{})}),l.jsx(It,{path:"/invite/:token",element:l.jsx(_V,{})}),null,l.jsx(It,{element:l.jsx(Iz,{}),children:l.jsxs(It,{element:l.jsx(N9,{children:l.jsx(L4,{})}),children:[l.jsx(It,{index:!0,element:l.jsx(iX,{})}),l.jsx(It,{path:"context",element:l.jsx(FG,{})}),l.jsx(It,{path:"agents/:uuid",element:l.jsx(tG,{})}),l.jsx(It,{path:"team",element:l.jsx($Q,{})}),l.jsxs(It,{path:"settings",element:l.jsx(xQ,{}),children:[l.jsx(It,{index:!0,element:l.jsx(or,{to:"computers",replace:!0})}),l.jsx(It,{path:"team",element:l.jsx(aK,{})}),l.jsx(It,{path:"computers",element:l.jsx(QV,{})}),l.jsx(It,{path:"github",element:l.jsx(tQ,{})}),l.jsx(It,{path:"integrations",element:l.jsx(yQ,{})}),l.jsx(It,{path:"onboarding",element:l.jsx(vQ,{})}),l.jsx(It,{path:"setup",element:l.jsx(or,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(It,{path:"agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"clients",element:l.jsx(or,{to:"/settings/computers",replace:!0})}),l.jsx(It,{path:"integrations",element:l.jsx(or,{to:"/settings/integrations",replace:!0})}),l.jsx(It,{path:"team/members",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/invite",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/settings",element:l.jsx(or,{to:"/settings/team",replace:!0})}),l.jsx(It,{path:"admin",element:l.jsx(oX,{})})]})})]})})})})})}function oX(){const e=Cr();return e.hash==="#bindings"?l.jsx(or,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(or,{to:`/team${e.hash}`,replace:!0})}const FT=document.getElementById("root");if(!FT)throw new Error("Root element not found");iR.createRoot(FT).render(l.jsx(b.StrictMode,{children:l.jsx(lX,{})}));export{bE as A,Dc as F,Rc as L,$M as U,et as c,l as j,b as r};