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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,416 +0,0 @@
1
- var pS=e=>{throw TypeError(e)};var qp=(e,t,n)=>t.has(e)||pS("Cannot "+n);var U=(e,t,n)=>(qp(e,t,"read from private field"),n?n.call(e):t.get(e)),_e=(e,t,n)=>t.has(e)?pS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ke=(e,t,n,a)=>(qp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ge=(e,t,n)=>(qp(e,t,"access private method"),n);var rf=(e,t,n,a)=>({set _(s){ke(e,t,s,n)},get _(){return U(e,t,a)}});function I2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function nh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zp={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 gS;function L2(){if(gS)return Tu;gS=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 yS;function P2(){return yS||(yS=1,Zp.exports=L2()),Zp.exports}var l=P2(),Gp={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 vS;function U2(){if(vS)return Qe;vS=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(P){return P===null||typeof P!="object"?null:(P=x&&P[x]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,E={};function C(P,F,T){this.props=P,this.context=F,this.refs=E,this.updater=T||S}C.prototype.isReactComponent={},C.prototype.setState=function(P,F){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,F,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function N(){}N.prototype=C.prototype;function R(P,F,T){this.props=P,this.context=F,this.refs=E,this.updater=T||S}var z=R.prototype=new N;z.constructor=R,k(z,C.prototype),z.isPureReactComponent=!0;var L=Array.isArray;function O(){}var B={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function Q(P,F,T){var G=T.ref;return{$$typeof:e,type:P,key:F,ref:G!==void 0?G:null,props:T}}function D(P,F){return Q(P.type,F,P.props)}function Y(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function ae(P){var F={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(T){return F[T]})}var be=/\/+/g;function W(P,F){return typeof P=="object"&&P!==null&&P.key!=null?ae(""+P.key):F.toString(36)}function X(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(O,O):(P.status="pending",P.then(function(F){P.status==="pending"&&(P.status="fulfilled",P.value=F)},function(F){P.status==="pending"&&(P.status="rejected",P.reason=F)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function Z(P,F,T,G,q){var re=typeof P;(re==="undefined"||re==="boolean")&&(P=null);var xe=!1;if(P===null)xe=!0;else switch(re){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(P.$$typeof){case e:case t:xe=!0;break;case p:return xe=P._init,Z(xe(P._payload),F,T,G,q)}}if(xe)return q=q(P),xe=G===""?"."+W(P,0):G,L(q)?(T="",xe!=null&&(T=xe.replace(be,"$&/")+"/"),Z(q,F,T,"",function(De){return De})):q!=null&&(Y(q)&&(q=D(q,T+(q.key==null||P&&P.key===q.key?"":(""+q.key).replace(be,"$&/")+"/")+xe)),F.push(q)),1;xe=0;var we=G===""?".":G+":";if(L(P))for(var me=0;me<P.length;me++)G=P[me],re=we+W(G,me),xe+=Z(G,F,T,re,q);else if(me=w(P),typeof me=="function")for(P=me.call(P),me=0;!(G=P.next()).done;)G=G.value,re=we+W(G,me++),xe+=Z(G,F,T,re,q);else if(re==="object"){if(typeof P.then=="function")return Z(X(P),F,T,G,q);throw F=String(P),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return xe}function te(P,F,T){if(P==null)return P;var G=[],q=0;return Z(P,G,"","",function(re){return F.call(T,re,q++)}),G}function je(P){if(P._status===-1){var F=P._result;F=F(),F.then(function(T){(P._status===0||P._status===-1)&&(P._status=1,P._result=T)},function(T){(P._status===0||P._status===-1)&&(P._status=2,P._result=T)}),P._status===-1&&(P._status=0,P._result=F)}if(P._status===1)return P._result.default;throw P._result}var Ae=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},M={map:te,forEach:function(P,F,T){te(P,function(){F.apply(this,arguments)},T)},count:function(P){var F=0;return te(P,function(){F++}),F},toArray:function(P){return te(P,function(F){return F})||[]},only:function(P){if(!Y(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};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=B,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return B.H.useMemoCache(P)}},Qe.cache=function(P){return function(){return P.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(P,F,T){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var G=k({},P.props),q=P.key;if(F!=null)for(re in F.key!==void 0&&(q=""+F.key),F)!I.call(F,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&F.ref===void 0||(G[re]=F[re]);var re=arguments.length-2;if(re===1)G.children=T;else if(1<re){for(var xe=Array(re),we=0;we<re;we++)xe[we]=arguments[we+2];G.children=xe}return Q(P.type,q,G)},Qe.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},Qe.createElement=function(P,F,T){var G,q={},re=null;if(F!=null)for(G in F.key!==void 0&&(re=""+F.key),F)I.call(F,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(q[G]=F[G]);var xe=arguments.length-2;if(xe===1)q.children=T;else if(1<xe){for(var we=Array(xe),me=0;me<xe;me++)we[me]=arguments[me+2];q.children=we}if(P&&P.defaultProps)for(G in xe=P.defaultProps,xe)q[G]===void 0&&(q[G]=xe[G]);return Q(P,re,q)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(P){return{$$typeof:f,render:P}},Qe.isValidElement=Y,Qe.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:je}},Qe.memo=function(P,F){return{$$typeof:h,type:P,compare:F===void 0?null:F}},Qe.startTransition=function(P){var F=B.T,T={};B.T=T;try{var G=P(),q=B.S;q!==null&&q(T,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(O,Ae)}catch(re){Ae(re)}finally{F!==null&&T.types!==null&&(F.types=T.types),B.T=F}},Qe.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Qe.use=function(P){return B.H.use(P)},Qe.useActionState=function(P,F,T){return B.H.useActionState(P,F,T)},Qe.useCallback=function(P,F){return B.H.useCallback(P,F)},Qe.useContext=function(P){return B.H.useContext(P)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(P,F){return B.H.useDeferredValue(P,F)},Qe.useEffect=function(P,F){return B.H.useEffect(P,F)},Qe.useEffectEvent=function(P){return B.H.useEffectEvent(P)},Qe.useId=function(){return B.H.useId()},Qe.useImperativeHandle=function(P,F,T){return B.H.useImperativeHandle(P,F,T)},Qe.useInsertionEffect=function(P,F){return B.H.useInsertionEffect(P,F)},Qe.useLayoutEffect=function(P,F){return B.H.useLayoutEffect(P,F)},Qe.useMemo=function(P,F){return B.H.useMemo(P,F)},Qe.useOptimistic=function(P,F){return B.H.useOptimistic(P,F)},Qe.useReducer=function(P,F,T){return B.H.useReducer(P,F,T)},Qe.useRef=function(P){return B.H.useRef(P)},Qe.useState=function(P){return B.H.useState(P)},Qe.useSyncExternalStore=function(P,F,T){return B.H.useSyncExternalStore(P,F,T)},Qe.useTransition=function(){return B.H.useTransition()},Qe.version="19.2.4",Qe}var bS;function nv(){return bS||(bS=1,Gp.exports=U2()),Gp.exports}var b=nv();const B2=nh(b),rv=I2({__proto__:null,default:B2},[b]);var Vp={exports:{}},Au={},Qp={exports:{}},Kp={};/**
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 xS;function F2(){return xS||(xS=1,(function(e){function t(Z,te){var je=Z.length;Z.push(te);e:for(;0<je;){var Ae=je-1>>>1,M=Z[Ae];if(0<s(M,te))Z[Ae]=te,Z[je]=M,je=Ae;else break e}}function n(Z){return Z.length===0?null:Z[0]}function a(Z){if(Z.length===0)return null;var te=Z[0],je=Z.pop();if(je!==te){Z[0]=je;e:for(var Ae=0,M=Z.length,P=M>>>1;Ae<P;){var F=2*(Ae+1)-1,T=Z[F],G=F+1,q=Z[G];if(0>s(T,je))G<M&&0>s(q,T)?(Z[Ae]=q,Z[G]=je,Ae=G):(Z[Ae]=T,Z[F]=je,Ae=F);else if(G<M&&0>s(q,je))Z[Ae]=q,Z[G]=je,Ae=G;else break e}}return te}function s(Z,te){var je=Z.sortIndex-te.sortIndex;return je!==0?je:Z.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],p=1,g=null,x=3,w=!1,S=!1,k=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function z(Z){for(var te=n(h);te!==null;){if(te.callback===null)a(h);else if(te.startTime<=Z)a(h),te.sortIndex=te.expirationTime,t(m,te);else break;te=n(h)}}function L(Z){if(k=!1,z(Z),!S)if(n(m)!==null)S=!0,O||(O=!0,ae());else{var te=n(h);te!==null&&X(L,te.startTime-Z)}}var O=!1,B=-1,I=5,Q=-1;function D(){return E?!0:!(e.unstable_now()-Q<I)}function Y(){if(E=!1,O){var Z=e.unstable_now();Q=Z;var te=!0;try{e:{S=!1,k&&(k=!1,N(B),B=-1),w=!0;var je=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),te=!0;break t}g===n(m)&&a(m),z(Z)}else a(m);g=n(m)}if(g!==null)te=!0;else{var P=n(h);P!==null&&X(L,P.startTime-Z),te=!1}}break e}finally{g=null,x=je,w=!1}te=void 0}}finally{te?ae():O=!1}}}var ae;if(typeof R=="function")ae=function(){R(Y)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,W=be.port2;be.port1.onmessage=Y,ae=function(){W.postMessage(null)}}else ae=function(){C(Y,0)};function X(Z,te){B=C(function(){Z(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(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 te=3;break;default:te=x}var je=x;x=te;try{return Z()}finally{x=je}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(Z,te){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var je=x;x=Z;try{return te()}finally{x=je}},e.unstable_scheduleCallback=function(Z,te,je){var Ae=e.unstable_now();switch(typeof je=="object"&&je!==null?(je=je.delay,je=typeof je=="number"&&0<je?Ae+je:Ae):je=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=je+M,Z={id:p++,callback:te,priorityLevel:Z,startTime:je,expirationTime:M,sortIndex:-1},je>Ae?(Z.sortIndex=je,t(h,Z),n(m)===null&&Z===n(h)&&(k?(N(B),B=-1):k=!0,X(L,je-Ae))):(Z.sortIndex=M,t(m,Z),S||w||(S=!0,O||(O=!0,ae()))),Z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Z){var te=x;return function(){var je=x;x=te;try{return Z.apply(this,arguments)}finally{x=je}}}})(Kp)),Kp}var wS;function $2(){return wS||(wS=1,Qp.exports=F2()),Qp.exports}var Yp={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 SS;function H2(){if(SS)return Qn;SS=1;var e=nv();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return 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 kS;function bj(){if(kS)return Yp.exports;kS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Yp.exports=H2(),Yp.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 jS;function q2(){if(jS)return Au;jS=1;var e=$2(),t=nv(),n=bj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var u=r,d=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){u=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==d.return)u=y,d=v;else{for(var j=!1,A=y.child;A;){if(A===u){j=!0,u=y,d=v;break}if(A===d){j=!0,d=y,u=v;break}A=A.sibling}if(!j){for(A=v.child;A;){if(A===u){j=!0,u=v,d=y;break}if(A===d){j=!0,d=v,u=y;break}A=A.sibling}if(!j)throw Error(a(189))}}if(u.alternate!==d)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),R=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function ae(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var be=Symbol.for("react.client.reference");function W(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===be?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case Q:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case R:return r.displayName||"Context";case N:return(r._context.displayName||"Context")+".Consumer";case z:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case B:return i=r.displayName||null,i!==null?i:W(r.type)||"Memo";case I:i=r._payload,r=r._init;try{return W(r(i))}catch{}}return null}var X=Array.isArray,Z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,je={pending:!1,data:null,method:null,action:null},Ae=[],M=-1;function P(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=P(null),q=P(null),re=P(null),xe=P(null);function we(r,i){switch(T(re,i),T(q,r),T(G,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Pw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Pw(i),r=Uw(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(re)}function De(r){r.memoizedState!==null&&T(xe,r);var i=G.current,u=Uw(i,r.type);i!==u&&(T(q,r),T(G,u))}function Ue(r){q.current===r&&(F(G),F(q)),xe.current===r&&(F(xe),Eu._currentValue=je)}var ft,ut;function ie(r){if(ft===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);ft=i&&i[1]||"",ut=-1<u.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ft+r+ut}var le=!1;function ge(r,i){if(!r||le)return"";le=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(oe){var ne=oe}Reflect.construct(r,[],he)}else{try{he.call()}catch(oe){ne=oe}r.call(he.prototype)}}else{try{throw Error()}catch(oe){ne=oe}(he=r())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(oe){if(oe&&ne&&typeof oe.stack=="string")return[oe.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),j=v[0],A=v[1];if(j&&A){var H=j.split(`
44
- `),ee=A.split(`
45
- `);for(y=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ee.length&&!ee[y].includes("DetermineComponentFrameRoot");)y++;if(d===H.length||y===ee.length)for(d=H.length-1,y=ee.length-1;1<=d&&0<=y&&H[d]!==ee[y];)y--;for(;1<=d&&0<=y;d--,y--)if(H[d]!==ee[y]){if(d!==1||y!==1)do if(d--,y--,0>y||H[d]!==ee[y]){var ce=`
46
- `+H[d].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=d&&0<=y);break}}}finally{le=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?ie(u):""}function Le(r,i){switch(r.tag){case 26:case 27:case 5:return ie(r.type);case 16:return ie("Lazy");case 13:return r.child!==i&&i!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return ge(r.type,!1);case 11:return ge(r.type.render,!1);case 1:return ge(r.type,!0);case 31:return ie("Activity");default:return""}}function zt(r){try{var i="",u=null;do i+=Le(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
47
- Error generating stack: `+d.message+`
48
- `+d.stack}}var $t=Object.prototype.hasOwnProperty,Pn=e.unstable_scheduleCallback,hr=e.unstable_cancelCallback,pi=e.unstable_shouldYield,gi=e.unstable_requestPaint,un=e.unstable_now,da=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Fe=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,at=e.unstable_IdlePriority,cn=e.log,tr=e.unstable_setDisableYieldValue,Ht=null,Lt=null;function Tt(r){if(typeof cn=="function"&&tr(r),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(Ht,r)}catch{}}var it=Math.clz32?Math.clz32:il,nr=Math.log,zn=Math.LN2;function il(r){return r>>>=0,r===0?32:31-(nr(r)/zn|0)|0}var fa=256,ha=262144,Ma=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 Da(r,i,u){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,j=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Vn(d):(j&=A,j!==0?y=Vn(j):u||(u=A&~r,u!==0&&(y=Vn(u))))):(A=d&~v,A!==0?y=Vn(A):j!==0?y=Vn(j):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 Sa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function qt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ee(){var r=Ma;return Ma<<=1,(Ma&62914560)===0&&(Ma=4194304),r}function tt(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function pn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Tr(r,i,u,d,y,v){var j=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var A=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(u=j&~u;0<u;){var ce=31-it(u),he=1<<ce;A[ce]=0,H[ce]=-1;var ne=ee[ce];if(ne!==null)for(ee[ce]=null,ce=0;ce<ne.length;ce++){var oe=ne[ce];oe!==null&&(oe.lane&=-536870913)}u&=~he}d!==0&&yi(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(j&~i))}function yi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-it(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-it(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 ma(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Lo(){var r=te.p;return r!==0?r:(r=window.event,r===void 0?32:oS(r.type))}function Po(r,i){var u=te.p;try{return te.p=r,i()}finally{te.p=u}}var $r=Math.random().toString(36).slice(2),dn="__reactFiber$"+$r,Zt="__reactProps$"+$r,Ia="__reactContainer$"+$r,sl="__reactEvents$"+$r,Ih="__reactListeners$"+$r,Hc="__reactHandles$"+$r,Uo="__reactResources$"+$r,vi="__reactMarker$"+$r;function Pe(r){delete r[dn],delete r[Zt],delete r[sl],delete r[Ih],delete r[Hc]}function $(r){var i=r[dn];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Ia]||u[dn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=Gw(r);r!==null;){if(u=r[dn])return u;r=Gw(r)}return i}r=u,u=r.parentNode}return null}function pe(r){if(r=r[dn]||r[Ia]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ne(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function wt(r){var i=r[Uo];return i||(i=r[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ht(r){r[vi]=!0}var Xt=new Set,Un={};function gn(r,i){Mn(r,i),Mn(r+"Capture",i)}function Mn(r,i){for(Un[r]=i,r=0;r<i.length;r++)Xt.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]*$"),fn={},Fo={};function qc(r){return $t.call(Fo,r)?!0:$t.call(fn,r)?!1:Bo.test(r)?Fo[r]=!0:(fn[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 La(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 Hr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ab(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function TT(r,i,u){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(j){u=""+j,v.call(this,j)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return u},setValue:function(j){u=""+j},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Lh(r){if(!r._valueTracker){var i=Ab(r)?"checked":"value";r._valueTracker=TT(r,i,""+r[i])}}function Rb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=Ab(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 AT=/[\n"\\]/g;function qr(r){return r.replace(AT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ph(r,i,u,d,y,v,j,A){r.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?r.type=j:r.removeAttribute("type"),i!=null?j==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Hr(i)):r.value!==""+Hr(i)&&(r.value=""+Hr(i)):j!=="submit"&&j!=="reset"||r.removeAttribute("value"),i!=null?Uh(r,j,Hr(i)):u!=null?Uh(r,j,Hr(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=""+Hr(A):r.removeAttribute("name")}function Ob(r,i,u,d,y,v,j,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Lh(r);return}u=u!=null?""+Hr(u):"",i=i!=null?""+Hr(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=A?r.checked:!!d,r.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(r.name=j),Lh(r)}function Uh(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=""+Hr(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 zb(r,i,u){if(i!=null&&(i=""+Hr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+Hr(u):""}function Mb(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(X(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=Hr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Lh(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 RT=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 Db(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||RT.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Ib(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&&Db(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Db(r,v,i[v])}function Bh(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 OT=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"]]),zT=/^[\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 zT.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Pa(){}var Fh=null;function $h(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 Lb(r){var i=pe(r);if(i&&(r=i.stateNode)){var u=r[Zt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Ph(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="'+qr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[Zt]||null;if(!y)throw Error(a(90));Ph(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&&Rb(d)}break e;case"textarea":zb(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&ll(r,!!u.multiple,i,!1)}}}var Hh=!1;function Pb(r,i,u){if(Hh)return r(i,u);Hh=!0;try{var d=r(i);return d}finally{if(Hh=!1,(ul!==null||cl!==null)&&(Dd(),ul&&(i=ul,r=cl,cl=ul=null,Lb(i),r)))for(i=0;i<r.length;i++)Lb(r[i])}}function $o(r,i){var u=r.stateNode;if(u===null)return null;var d=u[Zt]||null;if(d===null)return null;u=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var Ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qh=!1;if(Ua)try{var Ho={};Object.defineProperty(Ho,"passive",{get:function(){qh=!0}}),window.addEventListener("test",Ho,Ho),window.removeEventListener("test",Ho,Ho)}catch{qh=!1}var bi=null,Zh=null,Kc=null;function Ub(){if(Kc)return Kc;var r,i=Zh,u=i.length,d,y="value"in bi?bi.value:bi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var j=u-r;for(d=1;d<=j&&i[u-d]===y[v-d];d++);return 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 Bb(){return!1}function mr(r){function i(u,d,y,v,j){this._reactName=u,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=j,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(u=r[A],this[A]=u?u(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Xc:Bb,this.isPropagationStopped=Bb,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}),MT=mr(qo),Gh,Vh,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:Kh,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"?(Gh=r.screenX-Zo.screenX,Vh=r.screenY-Zo.screenY):Vh=Gh=0,Zo=r),Gh)},movementY:function(r){return"movementY"in r?r.movementY:Vh}}),Fb=mr(Jc),DT=g({},Jc,{dataTransfer:0}),IT=mr(DT),LT=g({},qo,{relatedTarget:0}),Qh=mr(LT),PT=g({},vs,{animationName:0,elapsedTime:0,pseudoElement:0}),UT=mr(PT),BT=g({},vs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),FT=mr(BT),$T=g({},vs,{data:0}),$b=mr($T),HT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qT={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"},ZT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GT(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=ZT[r])?!!i[r]:!1}function Kh(){return GT}var VT=g({},qo,{key:function(r){if(r.key){var i=HT[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"?qT[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kh,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}}),QT=mr(VT),KT=g({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hb=mr(KT),YT=g({},qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kh}),XT=mr(YT),WT=g({},vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),JT=mr(WT),eA=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}),tA=mr(eA),nA=g({},vs,{newState:0,oldState:0}),rA=mr(nA),aA=[9,13,27,32],Yh=Ua&&"CompositionEvent"in window,Go=null;Ua&&"documentMode"in document&&(Go=document.documentMode);var iA=Ua&&"TextEvent"in window&&!Go,qb=Ua&&(!Yh||Go&&8<Go&&11>=Go),Zb=" ",Gb=!1;function Vb(r,i){switch(r){case"keyup":return aA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var dl=!1;function sA(r,i){switch(r){case"compositionend":return Qb(i);case"keypress":return i.which!==32?null:(Gb=!0,Zb);case"textInput":return r=i.data,r===Zb&&Gb?null:r;default:return null}}function lA(r,i){if(dl)return r==="compositionend"||!Yh&&Vb(r,i)?(r=Ub(),Kc=Zh=bi=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 qb&&i.locale!=="ko"?null:i.data;default:return null}}var oA={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 Kb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!oA[r.type]:i==="textarea"}function Yb(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 uA(r){Ow(r,0)}function ed(r){var i=Ne(r);if(Rb(i))return r}function Xb(r,i){if(r==="change")return i}var Wb=!1;if(Ua){var Xh;if(Ua){var Wh="oninput"in document;if(!Wh){var Jb=document.createElement("div");Jb.setAttribute("oninput","return;"),Wh=typeof Jb.oninput=="function"}Xh=Wh}else Xh=!1;Wb=Xh&&(!document.documentMode||9<document.documentMode)}function ex(){Vo&&(Vo.detachEvent("onpropertychange",tx),Qo=Vo=null)}function tx(r){if(r.propertyName==="value"&&ed(Qo)){var i=[];Yb(i,Qo,r,$h(r)),Pb(uA,i)}}function cA(r,i,u){r==="focusin"?(ex(),Vo=i,Qo=u,Vo.attachEvent("onpropertychange",tx)):r==="focusout"&&ex()}function dA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ed(Qo)}function fA(r,i){if(r==="click")return ed(i)}function hA(r,i){if(r==="input"||r==="change")return ed(i)}function mA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Ar=typeof Object.is=="function"?Object.is:mA;function Ko(r,i){if(Ar(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(!$t.call(i,y)||!Ar(r[y],i[y]))return!1}return!0}function nx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function rx(r,i){var u=nx(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=nx(u)}}function ax(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?ax(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function ix(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 Jh(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 pA=Ua&&"documentMode"in document&&11>=document.documentMode,fl=null,em=null,Yo=null,tm=!1;function sx(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;tm||fl==null||fl!==Vc(d)||(d=fl,"selectionStart"in d&&Jh(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(em,"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")},nm={},lx={};Ua&&(lx=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(nm[r])return nm[r];if(!hl[r])return r;var i=hl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in lx)return nm[r]=i[u];return r}var ox=xs("animationend"),ux=xs("animationiteration"),cx=xs("animationstart"),gA=xs("transitionrun"),yA=xs("transitionstart"),vA=xs("transitioncancel"),dx=xs("transitionend"),fx=new Map,rm="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(" ");rm.push("scrollEnd");function pa(r,i){fx.set(r,i),gn(i,[r])}var td=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Zr=[],ml=0,am=0;function nd(){for(var r=ml,i=am=ml=0;i<r;){var u=Zr[i];Zr[i++]=null;var d=Zr[i];Zr[i++]=null;var y=Zr[i];Zr[i++]=null;var v=Zr[i];if(Zr[i++]=null,d!==null&&y!==null){var j=d.pending;j===null?y.next=y:(y.next=j.next,j.next=y),d.pending=y}v!==0&&hx(u,y,v)}}function rd(r,i,u,d){Zr[ml++]=r,Zr[ml++]=i,Zr[ml++]=u,Zr[ml++]=d,am|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function im(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 hx(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-it(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,mp=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 bA(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 Rr(r,i,u,d){return new bA(r,i,u,d)}function sm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ba(r,i){var u=r.alternate;return u===null?(u=Rr(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 mx(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 j=0;if(d=r,typeof r=="function")sm(r)&&(j=1);else if(typeof r=="string")j=j2(r,u,G.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Q:return r=Rr(31,u,i,y),r.elementType=Q,r.lanes=v,r;case k:return Ss(u.children,y,v,i);case E:j=8,y|=24;break;case C:return r=Rr(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case L:return r=Rr(13,u,i,y),r.elementType=L,r.lanes=v,r;case O:return r=Rr(19,u,i,y),r.elementType=O,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case R:j=10;break e;case N:j=9;break e;case z:j=11;break e;case B:j=14;break e;case I:j=16,d=null;break e}j=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Rr(j,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function Ss(r,i,u,d){return r=Rr(7,r,d,i),r.lanes=u,r}function lm(r,i,u){return r=Rr(6,r,null,i),r.lanes=u,r}function px(r){var i=Rr(18,null,null,0);return i.stateNode=r,i}function om(r,i,u){return i=Rr(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var gx=new WeakMap;function Gr(r,i){if(typeof r=="object"&&r!==null){var u=gx.get(r);return u!==void 0?u:(i={value:r,source:i,stack:zt(i)},gx.set(r,i),i)}return{value:r,source:i,stack:zt(i)}}var gl=[],yl=0,sd=null,Xo=0,Vr=[],Qr=0,xi=null,ka=1,ja="";function Fa(r,i){gl[yl++]=Xo,gl[yl++]=sd,sd=r,Xo=i}function yx(r,i,u){Vr[Qr++]=ka,Vr[Qr++]=ja,Vr[Qr++]=xi,xi=r;var d=ka;r=ja;var y=32-it(d)-1;d&=~(1<<y),u+=1;var v=32-it(i)+y;if(30<v){var j=y-y%5;v=(d&(1<<j)-1).toString(32),d>>=j,y-=j,ka=1<<32-it(i)+y|u<<y|d,ja=v+r}else ka=1<<v|u<<y|d,ja=r}function um(r){r.return!==null&&(Fa(r,1),yx(r,1,0))}function cm(r){for(;r===sd;)sd=gl[--yl],gl[yl]=null,Xo=gl[--yl],gl[yl]=null;for(;r===xi;)xi=Vr[--Qr],Vr[Qr]=null,ja=Vr[--Qr],Vr[Qr]=null,ka=Vr[--Qr],Vr[Qr]=null}function vx(r,i){Vr[Qr++]=ka,Vr[Qr++]=ja,Vr[Qr++]=xi,ka=i.id,ja=i.overflow,xi=r}var Bn=null,Bt=null,mt=!1,wi=null,Kr=!1,dm=Error(a(519));function Si(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(Gr(i,r)),dm}function bx(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[dn]=r,i[Zt]=d,u){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(u=0;u<xu.length;u++)lt(xu[u],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),Ob(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("invalid",i),Mb(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||Iw(i.textContent,u)?(d.popover!=null&&(lt("beforetoggle",i),lt("toggle",i)),d.onScroll!=null&&lt("scroll",i),d.onScrollEnd!=null&&lt("scrollend",i),d.onClick!=null&&(i.onclick=Pa),i=!0):i=!1,i||Si(r,!0)}function xx(r){for(Bn=r.return;Bn;)switch(Bn.tag){case 5:case 31:case 13:Kr=!1;return;case 27:case 3:Kr=!0;return;default:Bn=Bn.return}}function vl(r){if(r!==Bn)return!1;if(!mt)return xx(r),mt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Tp(r.type,r.memoizedProps)),u=!u),u&&Bt&&Si(r),xx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Zw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Zw(r)}else i===27?(i=Bt,Ii(r.type)?(r=Mp,Mp=null,Bt=r):Bt=i):Bt=Bn?Xr(r.stateNode.nextSibling):null;return!0}function ks(){Bt=Bn=null,mt=!1}function fm(){var r=wi;return r!==null&&(vr===null?vr=r:vr.push.apply(vr,r),wi=null),r}function Wo(r){wi===null?wi=[r]:wi.push(r)}var hm=P(null),js=null,$a=null;function ki(r,i,u){T(hm,i._currentValue),i._currentValue=u}function Ha(r){r._currentValue=hm.current,F(hm)}function mm(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 pm(r,i,u,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var j=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var H=0;H<i.length;H++)if(A.context===i[H]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),mm(v.return,u,r),d||(j=null);break e}v=A.next}}else if(y.tag===18){if(j=y.return,j===null)throw Error(a(341));j.lanes|=u,v=j.alternate,v!==null&&(v.lanes|=u),mm(j,u,r),j=null}else j=y.child;if(j!==null)j.return=y;else for(j=y;j!==null;){if(j===r){j=null;break}if(y=j.sibling,y!==null){y.return=j.return,j=y;break}j=j.return}y=j}}function 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 j=y.alternate;if(j===null)throw Error(a(387));if(j=j.memoizedProps,j!==null){var A=y.type;Ar(y.pendingProps.value,j.value)||(r!==null?r.push(A):r=[A])}}else if(y===xe.current){if(j=y.alternate,j===null)throw Error(a(387));j.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Eu):r=[Eu])}y=y.return}r!==null&&pm(i,r,u,d),i.flags|=262144}function ld(r){for(r=r.firstContext;r!==null;){if(!Ar(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Es(r){js=r,$a=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Fn(r){return wx(js,r)}function od(r,i){return js===null&&Es(r),wx(r,i)}function wx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},$a===null){if(r===null)throw Error(a(308));$a=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else $a=$a.next=i;return u}var xA=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()})}},wA=e.unstable_scheduleCallback,SA=e.unstable_NormalPriority,yn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gm(){return{controller:new xA,data:new Map,refCount:0}}function Jo(r){r.refCount--,r.refCount===0&&wA(SA,function(){r.controller.abort()})}var eu=null,ym=0,xl=0,wl=null;function kA(r,i){if(eu===null){var u=eu=[];ym=0,xl=xp(),wl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return ym++,i.then(Sx,Sx),i}function Sx(){if(--ym===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 jA(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 kx=Z.S;Z.S=function(r,i){sw=un(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&kA(r,i),kx!==null&&kx(r,i)};var Cs=P(null);function vm(){var r=Cs.current;return r!==null?r:Mt.pooledCache}function ud(r,i){i===null?T(Cs,Cs.current):T(Cs,i.pool)}function jx(){var r=vm();return r===null?null:{parent:yn._currentValue,pool:r}}var Sl=Error(a(460)),bm=Error(a(474)),cd=Error(a(542)),dd={then:function(){}};function Ex(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Cx(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(Pa,Pa),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,_x(r),r;default:if(typeof i.status=="string")i.then(Pa,Pa);else{if(r=Mt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,_x(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 Nx(){if(_s===null)throw Error(a(459));var r=_s;return _s=null,r}function _x(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=[]),Cx(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 Tx(r){function i(K,V){if(r){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function u(K,V){if(!r)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function y(K,V){return K=Ba(K,V),K.index=0,K.sibling=null,K}function v(K,V,J){return K.index=J,r?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function j(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function A(K,V,J,fe){return V===null||V.tag!==6?(V=lm(J,K.mode,fe),V.return=K,V):(V=y(V,J),V.return=K,V)}function H(K,V,J,fe){var Be=J.type;return Be===k?ce(K,V,J.props.children,fe,J.key):V!==null&&(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===I&&Ns(Be)===V.type)?(V=y(V,J.props),nu(V,J),V.return=K,V):(V=id(J.type,J.key,J.props,null,K.mode,fe),nu(V,J),V.return=K,V)}function ee(K,V,J,fe){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=om(J,K.mode,fe),V.return=K,V):(V=y(V,J.children||[]),V.return=K,V)}function ce(K,V,J,fe,Be){return V===null||V.tag!==7?(V=Ss(J,K.mode,fe,Be),V.return=K,V):(V=y(V,J),V.return=K,V)}function he(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=lm(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return J=id(V.type,V.key,V.props,null,K.mode,J),nu(J,V),J.return=K,J;case S:return V=om(V,K.mode,J),V.return=K,V;case I:return V=Ns(V),he(K,V,J)}if(X(V)||ae(V))return V=Ss(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return he(K,fd(V),J);if(V.$$typeof===R)return he(K,od(K,V),J);hd(K,V)}return null}function ne(K,V,J,fe){var Be=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Be!==null?null:A(K,V,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Be?H(K,V,J,fe):null;case S:return J.key===Be?ee(K,V,J,fe):null;case I:return J=Ns(J),ne(K,V,J,fe)}if(X(J)||ae(J))return Be!==null?null:ce(K,V,J,fe,null);if(typeof J.then=="function")return ne(K,V,fd(J),fe);if(J.$$typeof===R)return ne(K,V,od(K,J),fe);hd(K,J)}return null}function oe(K,V,J,fe,Be){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return K=K.get(J)||null,A(V,K,""+fe,Be);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return K=K.get(fe.key===null?J:fe.key)||null,H(V,K,fe,Be);case S:return K=K.get(fe.key===null?J:fe.key)||null,ee(V,K,fe,Be);case I:return fe=Ns(fe),oe(K,V,J,fe,Be)}if(X(fe)||ae(fe))return K=K.get(J)||null,ce(V,K,fe,Be,null);if(typeof fe.then=="function")return oe(K,V,J,fd(fe),Be);if(fe.$$typeof===R)return oe(K,V,J,od(V,fe),Be);hd(V,fe)}return null}function Te(K,V,J,fe){for(var Be=null,St=null,Me=V,Xe=V=0,dt=null;Me!==null&&Xe<J.length;Xe++){Me.index>Xe?(dt=Me,Me=null):dt=Me.sibling;var kt=ne(K,Me,J[Xe],fe);if(kt===null){Me===null&&(Me=dt);break}r&&Me&&kt.alternate===null&&i(K,Me),V=v(kt,V,Xe),St===null?Be=kt:St.sibling=kt,St=kt,Me=dt}if(Xe===J.length)return u(K,Me),mt&&Fa(K,Xe),Be;if(Me===null){for(;Xe<J.length;Xe++)Me=he(K,J[Xe],fe),Me!==null&&(V=v(Me,V,Xe),St===null?Be=Me:St.sibling=Me,St=Me);return mt&&Fa(K,Xe),Be}for(Me=d(Me);Xe<J.length;Xe++)dt=oe(Me,K,Xe,J[Xe],fe),dt!==null&&(r&&dt.alternate!==null&&Me.delete(dt.key===null?Xe:dt.key),V=v(dt,V,Xe),St===null?Be=dt:St.sibling=dt,St=dt);return r&&Me.forEach(function(Fi){return i(K,Fi)}),mt&&Fa(K,Xe),Be}function Ze(K,V,J,fe){if(J==null)throw Error(a(151));for(var Be=null,St=null,Me=V,Xe=V=0,dt=null,kt=J.next();Me!==null&&!kt.done;Xe++,kt=J.next()){Me.index>Xe?(dt=Me,Me=null):dt=Me.sibling;var Fi=ne(K,Me,kt.value,fe);if(Fi===null){Me===null&&(Me=dt);break}r&&Me&&Fi.alternate===null&&i(K,Me),V=v(Fi,V,Xe),St===null?Be=Fi:St.sibling=Fi,St=Fi,Me=dt}if(kt.done)return u(K,Me),mt&&Fa(K,Xe),Be;if(Me===null){for(;!kt.done;Xe++,kt=J.next())kt=he(K,kt.value,fe),kt!==null&&(V=v(kt,V,Xe),St===null?Be=kt:St.sibling=kt,St=kt);return mt&&Fa(K,Xe),Be}for(Me=d(Me);!kt.done;Xe++,kt=J.next())kt=oe(Me,K,Xe,kt.value,fe),kt!==null&&(r&&kt.alternate!==null&&Me.delete(kt.key===null?Xe:kt.key),V=v(kt,V,Xe),St===null?Be=kt:St.sibling=kt,St=kt);return r&&Me.forEach(function(D2){return i(K,D2)}),mt&&Fa(K,Xe),Be}function Ot(K,V,J,fe){if(typeof J=="object"&&J!==null&&J.type===k&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var Be=J.key;V!==null;){if(V.key===Be){if(Be=J.type,Be===k){if(V.tag===7){u(K,V.sibling),fe=y(V,J.props.children),fe.return=K,K=fe;break e}}else if(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===I&&Ns(Be)===V.type){u(K,V.sibling),fe=y(V,J.props),nu(fe,J),fe.return=K,K=fe;break e}u(K,V);break}else i(K,V);V=V.sibling}J.type===k?(fe=Ss(J.props.children,K.mode,fe,J.key),fe.return=K,K=fe):(fe=id(J.type,J.key,J.props,null,K.mode,fe),nu(fe,J),fe.return=K,K=fe)}return j(K);case S:e:{for(Be=J.key;V!==null;){if(V.key===Be)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){u(K,V.sibling),fe=y(V,J.children||[]),fe.return=K,K=fe;break e}else{u(K,V);break}else i(K,V);V=V.sibling}fe=om(J,K.mode,fe),fe.return=K,K=fe}return j(K);case I:return J=Ns(J),Ot(K,V,J,fe)}if(X(J))return Te(K,V,J,fe);if(ae(J)){if(Be=ae(J),typeof Be!="function")throw Error(a(150));return J=Be.call(J),Ze(K,V,J,fe)}if(typeof J.then=="function")return Ot(K,V,fd(J),fe);if(J.$$typeof===R)return Ot(K,V,od(K,J),fe);hd(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(u(K,V.sibling),fe=y(V,J),fe.return=K,K=fe):(u(K,V),fe=lm(J,K.mode,fe),fe.return=K,K=fe),j(K)):u(K,V)}return function(K,V,J,fe){try{tu=0;var Be=Ot(K,V,J,fe);return kl=null,Be}catch(Me){if(Me===Sl||Me===cd)throw Me;var St=Rr(29,Me,null,K.mode);return St.lanes=fe,St.return=K,St}finally{}}}var Ts=Tx(!0),Ax=Tx(!1),ji=!1;function xm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wm(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 Ei(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ci(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(jt&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=ad(r),hx(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 Sm(r,i){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var j={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=j:v=v.next=j,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var km=!1;function au(){if(km){var r=wl;if(r!==null)throw r}}function iu(r,i,u,d){km=!1;var y=r.updateQueue;ji=!1;var v=y.firstBaseUpdate,j=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,ee=H.next;H.next=null,j===null?v=ee:j.next=ee,j=H;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==j&&(A===null?ce.firstBaseUpdate=ee:A.next=ee,ce.lastBaseUpdate=H))}if(v!==null){var he=y.baseState;j=0,ce=ee=H=null,A=v;do{var ne=A.lane&-536870913,oe=ne!==A.lane;if(oe?(ct&ne)===ne:(d&ne)===ne){ne!==0&&ne===xl&&(km=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Te=r,Ze=A;ne=i;var Ot=u;switch(Ze.tag){case 1:if(Te=Ze.payload,typeof Te=="function"){he=Te.call(Ot,he,ne);break e}he=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ze.payload,ne=typeof Te=="function"?Te.call(Ot,he,ne):Te,ne==null)break e;he=g({},he,ne);break e;case 2:ji=!0}}ne=A.callback,ne!==null&&(r.flags|=64,oe&&(r.flags|=8192),oe=y.callbacks,oe===null?y.callbacks=[ne]:oe.push(ne))}else oe={lane:ne,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(ee=ce=oe,H=he):ce=ce.next=oe,j|=ne;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,y.lastBaseUpdate=oe,y.shared.pending=null}}while(!0);ce===null&&(H=he),y.baseState=H,y.firstBaseUpdate=ee,y.lastBaseUpdate=ce,v===null&&(y.shared.lanes=0),Ri|=j,r.lanes=j,r.memoizedState=he}}function Rx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Ox(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Rx(u[r],i)}var jl=P(null),md=P(0);function zx(r,i){r=Wa,T(md,r),T(jl,i),Wa=r|i.baseLanes}function jm(){T(md,Wa),T(jl,jl.current)}function Em(){Wa=md.current,F(jl),F(md)}var Or=P(null),Yr=null;function Ni(r){var i=r.alternate;T(hn,hn.current&1),T(Or,r),Yr===null&&(i===null||jl.current!==null||i.memoizedState!==null)&&(Yr=r)}function Cm(r){T(hn,hn.current),T(Or,r),Yr===null&&(Yr=r)}function Mx(r){r.tag===22?(T(hn,hn.current),T(Or,r),Yr===null&&(Yr=r)):_i()}function _i(){T(hn,hn.current),T(Or,Or.current)}function zr(r){F(Or),Yr===r&&(Yr=null),F(hn)}var hn=P(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||Op(u)||zp(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 qa=0,Ye=null,At=null,vn=null,gd=!1,El=!1,As=!1,yd=0,su=0,Cl=null,EA=0;function tn(){throw Error(a(321))}function Nm(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!Ar(r[u],i[u]))return!1;return!0}function _m(r,i,u,d,y,v){return qa=v,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Z.H=r===null||r.memoizedState===null?y0:Hm,As=!1,v=u(d,y),As=!1,El&&(v=Ix(i,u,d,y)),Dx(r),v}function Dx(r){Z.H=uu;var i=At!==null&&At.next!==null;if(qa=0,vn=At=Ye=null,gd=!1,su=0,Cl=null,i)throw Error(a(300));r===null||bn||(r=r.dependencies,r!==null&&ld(r)&&(bn=!0))}function Ix(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,vn=At=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}Z.H=v0,v=i(u,d)}while(El);return v}function CA(){var r=Z.H,i=r.useState()[0];return i=typeof i.then=="function"?lu(i):i,r=r.useState()[0],(At!==null?At.memoizedState:null)!==r&&(Ye.flags|=1024),i}function Tm(){var r=yd!==0;return yd=0,r}function Am(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function Rm(r){if(gd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gd=!1}qa=0,vn=At=Ye=null,El=!1,su=yd=0,Cl=null}function ar(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Ye.memoizedState=vn=r:vn=vn.next=r,vn}function mn(){if(At===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=At.next;var i=vn===null?Ye.memoizedState:vn.next;if(i!==null)vn=i,At=r;else{if(r===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));At=r,r={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},vn===null?Ye.memoizedState=vn=r:vn=vn.next=r}return vn}function vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(r){var i=su;return su+=1,Cl===null&&(Cl=[]),r=Cx(Cl,r,i),i=Ye,(vn===null?i.memoizedState:vn.next)===null&&(i=i.alternate,Z.H=i===null||i.memoizedState===null?y0:Hm),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 Om(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 Za(r,i){return typeof i=="function"?i(r):i}function xd(r){var i=mn();return zm(i,At,r)}function zm(r,i,u){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=u;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var j=y.next;y.next=v.next,v.next=j}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=j=null,H=null,ee=i,ce=!1;do{var he=ee.lane&-536870913;if(he!==ee.lane?(ct&he)===he:(qa&he)===he){var ne=ee.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),he===xl&&(ce=!0);else if((qa&ne)===ne){ee=ee.next,ne===xl&&(ce=!0);continue}else he={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=he,j=v):H=H.next=he,Ye.lanes|=ne,Ri|=ne;he=ee.action,As&&u(v,he),v=ee.hasEagerState?ee.eagerState:u(v,he)}else ne={lane:he,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=ne,j=v):H=H.next=ne,Ye.lanes|=he,Ri|=he;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?j=v:H.next=A,!Ar(v,r.memoizedState)&&(bn=!0,ce&&(u=wl,u!==null)))throw u;r.memoizedState=v,r.baseState=j,r.baseQueue=H,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Mm(r){var i=mn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var j=y=y.next;do v=r(v,j.action),j=j.next;while(j!==y);Ar(v,i.memoizedState)||(bn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function Lx(r,i,u){var d=Ye,y=mn(),v=mt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var j=!Ar((At||y).memoizedState,u);if(j&&(y.memoizedState=u,bn=!0),y=y.queue,Lm(Bx.bind(null,d,y,r),[r]),y.getSnapshot!==i||j||vn!==null&&vn.memoizedState.tag&1){if(d.flags|=2048,Nl(9,{destroy:void 0},Ux.bind(null,d,y,u,i),null),Mt===null)throw Error(a(349));v||(qa&127)!==0||Px(d,i,u)}return u}function Px(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 Ux(r,i,u,d){i.value=u,i.getSnapshot=d,Fx(i)&&$x(r)}function Bx(r,i,u){return u(function(){Fx(i)&&$x(r)})}function Fx(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!Ar(r,u)}catch{return!0}}function $x(r){var i=ws(r,2);i!==null&&br(i,r,2)}function Dm(r){var i=ar();if(typeof r=="function"){var u=r;if(r=u(),As){Tt(!0);try{u()}finally{Tt(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:r},i}function Hx(r,i,u,d){return r.baseState=u,zm(r,At,typeof d=="function"?d:Za)}function NA(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(j){v.listeners.push(j)}};Z.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,qx(i,v)):(v.next=u.next,i.pending=u.next=v)}}function qx(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=Z.T,j={};Z.T=j;try{var A=u(y,d),H=Z.S;H!==null&&H(j,A),Zx(r,i,A)}catch(ee){Im(r,i,ee)}finally{v!==null&&j.types!==null&&(v.types=j.types),Z.T=v}}else try{v=u(y,d),Zx(r,i,v)}catch(ee){Im(r,i,ee)}}function Zx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){Gx(r,i,d)},function(d){return Im(r,i,d)}):Gx(r,i,u)}function Gx(r,i,u){i.status="fulfilled",i.value=u,Vx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,qx(r,u)))}function Im(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,Vx(i),i=i.next;while(i!==d)}r.action=null}function Vx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Qx(r,i){return i}function Kx(r,i){if(mt){var u=Mt.formState;if(u!==null){e:{var d=Ye;if(mt){if(Bt){t:{for(var y=Bt,v=Kr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Xr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Bt=Xr(y.nextSibling),d=y.data==="F!";break e}}Si(d)}d=!1}d&&(i=u[0])}}return u=ar(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qx,lastRenderedState:i},u.queue=d,u=m0.bind(null,Ye,d),d.dispatch=u,d=Dm(!1),v=$m.bind(null,Ye,!1,d.queue),d=ar(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=NA.bind(null,Ye,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function Yx(r){var i=mn();return Xx(i,At,r)}function Xx(r,i,u){if(i=zm(r,i,Qx)[0],r=xd(Za)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=lu(i)}catch(j){throw j===Sl?cd:j}else d=i;i=mn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Ye.flags|=2048,Nl(9,{destroy:void 0},_A.bind(null,y,u),null)),[d,v,r]}function _A(r,i){r.action=i}function Wx(r){var i=mn(),u=At;if(u!==null)return Xx(i,u,r);mn(),i=i.memoizedState,u=mn();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 Jx(){return mn().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=mn();d=d===void 0?null:d;var v=y.memoizedState.inst;At!==null&&d!==null&&Nm(d,At.memoizedState.deps)?y.memoizedState=Nl(i,v,u,d):(Ye.flags|=r,y.memoizedState=Nl(1|i,v,u,d))}function e0(r,i){wd(8390656,8,r,i)}function Lm(r,i){Sd(2048,8,r,i)}function TA(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 t0(r){var i=mn().memoizedState;return TA({ref:i,nextImpl:r}),function(){if((jt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function n0(r,i){return Sd(4,2,r,i)}function r0(r,i){return Sd(4,4,r,i)}function a0(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 i0(r,i,u){u=u!=null?u.concat([r]):null,Sd(4,4,a0.bind(null,i,r),u)}function Pm(){}function s0(r,i){var u=mn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&Nm(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function l0(r,i){var u=mn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&Nm(i,d[1]))return d[0];if(d=r(),As){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[d,i],d}function Um(r,i,u){return u===void 0||(qa&1073741824)!==0&&(ct&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=ow(),Ye.lanes|=r,Ri|=r,u)}function o0(r,i,u,d){return Ar(u,i)?u:jl.current!==null?(r=Um(r,u,d),Ar(r,i)||(bn=!0),r):(qa&42)===0||(qa&1073741824)!==0&&(ct&261930)===0?(bn=!0,r.memoizedState=u):(r=ow(),Ye.lanes|=r,Ri|=r,i)}function u0(r,i,u,d,y){var v=te.p;te.p=v!==0&&8>v?v:8;var j=Z.T,A={};Z.T=A,$m(r,!1,i,u);try{var H=y(),ee=Z.S;if(ee!==null&&ee(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=jA(H,d);ou(r,i,ce,Ir(r))}else ou(r,i,d,Ir(r))}catch(he){ou(r,i,{then:function(){},status:"rejected",reason:he},Ir())}finally{te.p=v,j!==null&&A.types!==null&&(j.types=A.types),Z.T=j}}function AA(){}function Bm(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=c0(r).queue;u0(r,y,i,je,u===null?AA:function(){return d0(r),u(d)})}function c0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:je,baseState:je,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:je},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function d0(r){var i=c0(r);i.next===null&&(i=r.alternate.memoizedState),ou(r,i.next.queue,{},Ir())}function Fm(){return Fn(Eu)}function f0(){return mn().memoizedState}function h0(){return mn().memoizedState}function RA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Ir();r=Ei(u);var d=Ci(i,r,u);d!==null&&(br(d,i,u),ru(d,i,u)),i={cache:gm()},r.payload=i;return}i=i.return}}function OA(r,i,u){var d=Ir();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},kd(r)?p0(i,u):(u=im(r,i,u,d),u!==null&&(br(u,r,d),g0(u,i,d)))}function m0(r,i,u){var d=Ir();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))p0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var j=i.lastRenderedState,A=v(j,u);if(y.hasEagerState=!0,y.eagerState=A,Ar(A,j))return rd(r,i,y,0),Mt===null&&nd(),!1}catch{}finally{}if(u=im(r,i,y,d),u!==null)return br(u,r,d),g0(u,i,d),!0}return!1}function $m(r,i,u,d){if(d={lane:2,revertLane:xp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},kd(r)){if(i)throw Error(a(479))}else i=im(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 p0(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 g0(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:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn};uu.useEffectEvent=tn;var y0={readContext:Fn,use:bd,useCallback:function(r,i){return ar().memoizedState=[r,i===void 0?null:i],r},useContext:Fn,useEffect:e0,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,wd(4194308,4,a0.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){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=ar();if(u!==void 0){var y=u(i);if(As){Tt(!0);try{u(i)}finally{Tt(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=OA.bind(null,Ye,r),[d.memoizedState,r]},useRef:function(r){var i=ar();return r={current:r},i.memoizedState=r},useState:function(r){r=Dm(r);var i=r.queue,u=m0.bind(null,Ye,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Pm,useDeferredValue:function(r,i){var u=ar();return Um(u,r,i)},useTransition:function(){var r=Dm(!1);return r=u0.bind(null,Ye,r.queue,!0,!1),ar().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=Ye,y=ar();if(mt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Mt===null)throw Error(a(349));(ct&127)!==0||Px(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,e0(Bx.bind(null,d,v,r),[r]),d.flags|=2048,Nl(9,{destroy:void 0},Ux.bind(null,d,v,u,i),null),u},useId:function(){var r=ar(),i=Mt.identifierPrefix;if(mt){var u=ja,d=ka;u=(d&~(1<<32-it(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=yd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=EA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Fm,useFormState:Kx,useActionState:Kx,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=$m.bind(null,Ye,!0,u),u.dispatch=i,[r,i]},useMemoCache:Om,useCacheRefresh:function(){return ar().memoizedState=RA.bind(null,Ye)},useEffectEvent:function(r){var i=ar(),u={impl:r};return i.memoizedState=u,function(){if((jt&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},Hm={readContext:Fn,use:bd,useCallback:s0,useContext:Fn,useEffect:Lm,useImperativeHandle:i0,useInsertionEffect:n0,useLayoutEffect:r0,useMemo:l0,useReducer:xd,useRef:Jx,useState:function(){return xd(Za)},useDebugValue:Pm,useDeferredValue:function(r,i){var u=mn();return o0(u,At.memoizedState,r,i)},useTransition:function(){var r=xd(Za)[0],i=mn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:Lx,useId:f0,useHostTransitionStatus:Fm,useFormState:Yx,useActionState:Yx,useOptimistic:function(r,i){var u=mn();return Hx(u,At,r,i)},useMemoCache:Om,useCacheRefresh:h0};Hm.useEffectEvent=t0;var v0={readContext:Fn,use:bd,useCallback:s0,useContext:Fn,useEffect:Lm,useImperativeHandle:i0,useInsertionEffect:n0,useLayoutEffect:r0,useMemo:l0,useReducer:Mm,useRef:Jx,useState:function(){return Mm(Za)},useDebugValue:Pm,useDeferredValue:function(r,i){var u=mn();return At===null?Um(u,r,i):o0(u,At.memoizedState,r,i)},useTransition:function(){var r=Mm(Za)[0],i=mn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:Lx,useId:f0,useHostTransitionStatus:Fm,useFormState:Wx,useActionState:Wx,useOptimistic:function(r,i){var u=mn();return At!==null?Hx(u,At,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Om,useCacheRefresh:h0};v0.useEffectEvent=t0;function qm(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 Zm={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Ir(),y=Ei(d);y.payload=i,u!=null&&(y.callback=u),i=Ci(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Ir(),y=Ei(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=Ci(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Ir(),d=Ei(u);d.tag=2,i!=null&&(d.callback=i),i=Ci(r,d,u),i!==null&&(br(i,r,u),ru(i,r,u))}};function b0(r,i,u,d,y,v,j){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,j):i.prototype&&i.prototype.isPureReactComponent?!Ko(u,d)||!Ko(y,v):!0}function x0(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&&Zm.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 w0(r){td(r)}function S0(r){console.error(r)}function k0(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 j0(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 Gm(r,i,u){return u=Ei(u),u.tag=3,u.payload={element:null},u.callback=function(){jd(r,i)},u}function E0(r){return r=Ei(r),r.tag=3,r}function C0(r,i,u,d){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){j0(i,u,d)}}var j=u.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(r.callback=function(){j0(i,u,d),typeof y!="function"&&(Oi===null?Oi=new Set([this]):Oi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function zA(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=Or.current,u!==null){switch(u.tag){case 31:case 13:return Yr===null?Id():u.alternate===null&&nn===0&&(nn=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),yp(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)),yp(r,d,y)),!1}throw Error(a(435,u.tag))}return yp(r,d,y),Id(),!1}if(mt)return i=Or.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==dm&&(r=Error(a(422),{cause:d}),Wo(Gr(r,u)))):(d!==dm&&(i=Error(a(423),{cause:d}),Wo(Gr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Gr(d,u),y=Gm(r.stateNode,d,y),Sm(r,y),nn!==4&&(nn=2)),!1;var v=Error(a(520),{cause:d});if(v=Gr(v,u),yu===null?yu=[v]:yu.push(v),nn!==4&&(nn=2),i===null)return!0;d=Gr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Gm(u.stateNode,d,r),Sm(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"&&(Oi===null||!Oi.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=E0(y),C0(y,r,u,d),Sm(u,y),!1}u=u.return}while(u!==null);return!1}var Vm=Error(a(461)),bn=!1;function $n(r,i,u,d){i.child=r===null?Ax(i,null,u,d):Ts(i,r.child,u,d)}function N0(r,i,u,d,y){u=u.render;var v=i.ref;if("ref"in d){var j={};for(var A in d)A!=="ref"&&(j[A]=d[A])}else j=d;return Es(i),d=_m(r,i,u,j,v,y),A=Tm(),r!==null&&!bn?(Am(r,i,y),Ga(r,i,y)):(mt&&A&&um(i),i.flags|=1,$n(r,i,d,y),i.child)}function _0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!sm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,T0(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,!tp(r,y)){var j=v.memoizedProps;if(u=u.compare,u=u!==null?u:Ko,u(j,d)&&r.ref===i.ref)return Ga(r,i,y)}return i.flags|=1,r=Ba(v,d),r.ref=i.ref,r.return=i,i.child=r}function T0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(Ko(v,d)&&r.ref===i.ref)if(bn=!1,i.pendingProps=d=v,tp(r,y))(r.flags&131072)!==0&&(bn=!0);else return i.lanes=r.lanes,Ga(r,i,y)}return Qm(r,i,u,d,y)}function A0(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 R0(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?zx(i,v):jm(),Mx(i);else return d=i.lanes=536870912,R0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(ud(i,v.cachePool),zx(i,v),_i(),i.memoizedState=null):(r!==null&&ud(i,null),jm(),_i());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 R0(r,i,u,d,y){var v=vm();return v=v===null?null:{parent:yn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&ud(i,null),jm(),Mx(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 O0(r,i,u){return Ts(i,r.child,null,u),r=Ed(i,i.pendingProps),r.flags|=2,zr(i),i.memoizedState=null,r}function MA(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(mt){if(d.mode==="hidden")return r=Ed(i,d),i.lanes=536870912,cu(null,r);if(Cm(i),(r=Bt)?(r=qw(r,Kr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xi!==null?{id:ka,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},u=px(r),u.return=i,i.child=u,Bn=i,Bt=null)):r=null,r===null)throw Si(i);return i.lanes=536870912,null}return Ed(i,d)}var v=r.memoizedState;if(v!==null){var j=v.dehydrated;if(Cm(i),y)if(i.flags&256)i.flags&=-257,i=O0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(bn||bl(r,i,u,!1),y=(u&r.childLanes)!==0,bn||y){if(d=Mt,d!==null&&(j=$c(d,u),j!==0&&j!==v.retryLane))throw v.retryLane=j,ws(r,j),br(d,r,j),Vm;Id(),i=O0(r,i,u)}else r=v.treeContext,Bt=Xr(j.nextSibling),Bn=i,mt=!0,wi=null,Kr=!1,r!==null&&vx(i,r),i=Ed(i,d),i.flags|=4096;return i}return r=Ba(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 Qm(r,i,u,d,y){return Es(i),u=_m(r,i,u,d,void 0,y),d=Tm(),r!==null&&!bn?(Am(r,i,y),Ga(r,i,y)):(mt&&d&&um(i),i.flags|=1,$n(r,i,u,y),i.child)}function z0(r,i,u,d,y,v){return Es(i),i.updateQueue=null,u=Ix(i,d,u,y),Dx(r),d=Tm(),r!==null&&!bn?(Am(r,i,v),Ga(r,i,v)):(mt&&d&&um(i),i.flags|=1,$n(r,i,u,v),i.child)}function M0(r,i,u,d,y){if(Es(i),i.stateNode===null){var v=pl,j=u.contextType;typeof j=="object"&&j!==null&&(v=Fn(j)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Zm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},xm(i),j=u.contextType,v.context=typeof j=="object"&&j!==null?Fn(j):pl,v.state=i.memoizedState,j=u.getDerivedStateFromProps,typeof j=="function"&&(qm(i,u,j,d),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(j=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),j!==v.state&&Zm.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 ee=v.context,ce=u.contextType;j=pl,typeof ce=="object"&&ce!==null&&(j=Fn(ce));var he=u.getDerivedStateFromProps;ce=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||ee!==j)&&x0(i,v,d,j),ji=!1;var ne=i.memoizedState;v.state=ne,iu(i,d,v,y),au(),ee=i.memoizedState,A||ne!==ee||ji?(typeof he=="function"&&(qm(i,u,he,d),ee=i.memoizedState),(H=ji||b0(i,u,H,d,ne,ee,j))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),v.props=d,v.state=ee,v.context=j,d=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,wm(r,i),j=i.memoizedProps,ce=Rs(u,j),v.props=ce,he=i.pendingProps,ne=v.context,ee=u.contextType,H=pl,typeof ee=="object"&&ee!==null&&(H=Fn(ee)),A=u.getDerivedStateFromProps,(ee=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(j!==he||ne!==H)&&x0(i,v,d,H),ji=!1,ne=i.memoizedState,v.state=ne,iu(i,d,v,y),au();var oe=i.memoizedState;j!==he||ne!==oe||ji||r!==null&&r.dependencies!==null&&ld(r.dependencies)?(typeof A=="function"&&(qm(i,u,A,d),oe=i.memoizedState),(ce=ji||b0(i,u,ce,d,ne,oe,H)||r!==null&&r.dependencies!==null&&ld(r.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,oe,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,oe,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=oe),v.props=d,v.state=oe,v.context=H,d=ce):(typeof v.componentDidUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,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=Ga(r,i,y),r}function D0(r,i,u,d){return ks(),i.flags|=256,$n(r,i,u,d),i.child}var Km={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ym(r){return{baseLanes:r,cachePool:jx()}}function Xm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Dr),r}function I0(r,i,u){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,j;if((j=v)||(j=r!==null&&r.memoizedState===null?!1:(hn.current&2)!==0),j&&(y=!0,i.flags&=-129),j=(i.flags&32)!==0,i.flags&=-33,r===null){if(mt){if(y?Ni(i):_i(),(r=Bt)?(r=qw(r,Kr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xi!==null?{id:ka,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},u=px(r),u.return=i,i.child=u,Bn=i,Bt=null)):r=null,r===null)throw Si(i);return zp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(_i(),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=Ym(u),d.childLanes=Xm(r,j,u),i.memoizedState=Km,cu(null,d)):(Ni(i),Wm(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(Ni(i),i.flags&=-257,i=Jm(r,i,u)):i.memoizedState!==null?(_i(),i.child=r.child,i.flags|=128,i=null):(_i(),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=Ym(u),d.childLanes=Xm(r,j,u),i.memoizedState=Km,i=cu(null,d));else if(Ni(i),zp(A)){if(j=A.nextSibling&&A.nextSibling.dataset,j)var ee=j.dgst;j=ee,d=Error(a(419)),d.stack="",d.digest=j,Wo({value:d,source:null,stack:null}),i=Jm(r,i,u)}else if(bn||bl(r,i,u,!1),j=(u&r.childLanes)!==0,bn||j){if(j=Mt,j!==null&&(d=$c(j,u),d!==0&&d!==H.retryLane))throw H.retryLane=d,ws(r,d),br(j,r,d),Vm;Op(A)||Id(),i=Jm(r,i,u)}else Op(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Bt=Xr(A.nextSibling),Bn=i,mt=!0,wi=null,Kr=!1,r!==null&&vx(i,r),i=Wm(i,d.children),i.flags|=4096);return i}return y?(_i(),A=d.fallback,y=i.mode,H=r.child,ee=H.sibling,d=Ba(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=Ba(ee,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=Ym(u):(y=A.cachePool,y!==null?(H=yn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=jx(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=Xm(r,j,u),i.memoizedState=Km,cu(r.child,d)):(Ni(i),u=r.child,r=u.sibling,u=Ba(u,{mode:"visible",children:d.children}),u.return=i,u.sibling=null,r!==null&&(j=i.deletions,j===null?(i.deletions=[r],i.flags|=16):j.push(r)),i.child=u,i.memoizedState=null,u)}function Wm(r,i){return i=Nd({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Nd(r,i){return r=Rr(22,r,null,i),r.lanes=0,r}function Jm(r,i,u){return Ts(i,r.child,null,u),r=Wm(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function L0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),mm(r.return,i,u)}function ep(r,i,u,d,y,v){var j=r.memoizedState;j===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:y,treeForkCount:v}:(j.isBackwards=i,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=u,j.tailMode=y,j.treeForkCount=v)}function P0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var j=hn.current,A=(j&2)!==0;if(A?(j=j&1|2,i.flags|=128):j&=1,T(hn,j),$n(r,i,d,u),d=mt?Xo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&L0(r,u,i);else if(r.tag===19)L0(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),ep(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}ep(i,!0,u,null,v,d);break;case"together":ep(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ga(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Ri|=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=Ba(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ba(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function tp(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&ld(r)))}function DA(r,i,u){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),ki(i,yn,r.memoizedState.cache),ks();break;case 27:case 5:De(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:ki(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Cm(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ni(i),i.flags|=128,null):(u&i.child.childLanes)!==0?I0(r,i,u):(Ni(i),r=Ga(r,i,u),r!==null?r.sibling:null);Ni(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 P0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(hn,hn.current),d)break;return null;case 22:return i.lanes=0,A0(r,i,u,i.pendingProps);case 24:ki(i,yn,r.memoizedState.cache)}return Ga(r,i,u)}function U0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)bn=!0;else{if(!tp(r,u)&&(i.flags&128)===0)return bn=!1,DA(r,i,u);bn=(r.flags&131072)!==0}else bn=!1,mt&&(i.flags&1048576)!==0&&yx(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")sm(r)?(d=Rs(r,d),i.tag=1,i=M0(null,i,r,d,u)):(i.tag=0,i=Qm(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===z){i.tag=11,i=N0(null,i,r,d,u);break e}else if(y===B){i.tag=14,i=_0(null,i,r,d,u);break e}}throw i=W(r)||r,Error(a(306,i,""))}}return i;case 0:return Qm(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=Rs(d,i.pendingProps),M0(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,wm(r,i),iu(i,d,null,u);var j=i.memoizedState;if(d=j.cache,ki(i,yn,d),d!==v.cache&&pm(i,[yn],u,!0),au(),d=j.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:j.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=D0(r,i,d,u);break e}else if(d!==y){y=Gr(Error(a(424)),i),Wo(y),i=D0(r,i,d,u);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=Xr(r.firstChild),Bn=i,mt=!0,wi=null,Kr=!0,u=Ax(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(ks(),d===y){i=Ga(r,i,u);break e}$n(r,i,d,u)}i=i.child}return i;case 26:return Cd(r,i),r===null?(u=Yw(i.type,null,i.pendingProps,null))?i.memoizedState=u:mt||(u=i.type,r=i.pendingProps,d=Hd(re.current).createElement(u),d[dn]=i,d[Zt]=r,Hn(d,u,r),ht(d),i.stateNode=d):i.memoizedState=Yw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return De(i),r===null&&mt&&(d=i.stateNode=Vw(i.type,i.pendingProps,re.current),Bn=i,Kr=!0,y=Bt,Ii(i.type)?(Mp=y,Bt=Xr(d.firstChild)):Bt=y),$n(r,i,i.pendingProps.children,u),Cd(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&mt&&((y=d=Bt)&&(d=d2(d,i.type,i.pendingProps,Kr),d!==null?(i.stateNode=d,Bn=i,Bt=Xr(d.firstChild),Kr=!1,y=!0):y=!1),y||Si(i)),De(i),y=i.type,v=i.pendingProps,j=r!==null?r.memoizedProps:null,d=v.children,Tp(y,v)?d=null:j!==null&&Tp(y,j)&&(i.flags|=32),i.memoizedState!==null&&(y=_m(r,i,CA,null,null,u),Eu._currentValue=y),Cd(r,i),$n(r,i,d,u),i.child;case 6:return r===null&&mt&&((r=u=Bt)&&(u=f2(u,i.pendingProps,Kr),u!==null?(i.stateNode=u,Bn=i,Bt=null,r=!0):r=!1),r||Si(i)),null;case 13:return I0(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 N0(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,ki(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 _0(r,i,i.type,i.pendingProps,u);case 15:return T0(r,i,i.type,i.pendingProps,u);case 19:return P0(r,i,u);case 31:return MA(r,i,u);case 22:return A0(r,i,u,i.pendingProps);case 24:return Es(i),d=Fn(yn),r===null?(y=vm(),y===null&&(y=Mt,v=gm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},xm(i),ki(i,yn,y)):((r.lanes&u)!==0&&(wm(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),ki(i,yn,d)):(d=v.cache,ki(i,yn,d),d!==y.cache&&pm(i,[yn],u,!0))),$n(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Va(r){r.flags|=4}function np(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(fw())r.flags|=8192;else throw _s=dd,bm}else r.flags&=-16777217}function B0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!tS(i))if(fw())r.flags|=8192;else throw _s=dd,bm}function _d(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Ee():536870912,r.lanes|=i,Rl|=i)}function du(r,i){if(!mt)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 Ft(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 IA(r,i,u){var d=i.pendingProps;switch(cm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(i),null;case 1:return Ft(i),null;case 3:return u=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ha(yn),me(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(vl(i)?Va(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,fm())),Ft(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Va(i),v!==null?(Ft(i),B0(i,v)):(Ft(i),np(i,y,null,d,u))):v?v!==r.memoizedState?(Va(i),Ft(i),B0(i,v)):(Ft(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Va(i),Ft(i),np(i,y,r,d,u)),null;case 27:if(Ue(i),u=re.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}r=G.current,vl(i)?bx(i):(r=Vw(y,d,u),i.stateNode=r,Va(i))}return Ft(i),null;case 5:if(Ue(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}if(v=G.current,vl(i))bx(i);else{var j=Hd(re.current);switch(v){case 1:v=j.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=j.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=j.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=j.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=j.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?j.createElement(y,{is:d.is}):j.createElement(y)}}v[dn]=i,v[Zt]=d;e:for(j=i.child;j!==null;){if(j.tag===5||j.tag===6)v.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===i)break e;for(;j.sibling===null;){if(j.return===null||j.return===i)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}i.stateNode=v;e:switch(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&&Va(i)}}return Ft(i),np(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=re.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[dn]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||Iw(r.nodeValue,u)),r||Si(i,!0)}else r=Hd(r).createTextNode(d),r[dn]=i,i.stateNode=r}return Ft(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[dn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),r=!1}else u=fm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(zr(i),i):(zr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ft(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[dn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),y=!1}else y=fm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(zr(i),i):(zr(i),null)}return zr(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),Ft(i),null);case 4:return me(),r===null&&jp(i.stateNode.containerInfo),Ft(i),null;case 10:return Ha(i.type),Ft(i),null;case 19:if(F(hn),d=i.memoizedState,d===null)return Ft(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)du(d,!1);else{if(nn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=pd(r),v!==null){for(i.flags|=128,du(d,!1),r=v.updateQueue,i.updateQueue=r,_d(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)mx(u,r),u=u.sibling;return T(hn,hn.current&1|2),mt&&Fa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&un()>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&&!mt)return Ft(i),null}else 2*un()-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=un(),r.sibling=null,u=hn.current,T(hn,y?u&1|2:u&1),mt&&Fa(i,d.treeForkCount),r):(Ft(i),null);case 22:case 23:return zr(i),Em(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(u&536870912)!==0&&(i.flags&128)===0&&(Ft(i),i.subtreeFlags&6&&(i.flags|=8192)):Ft(i),u=i.updateQueue,u!==null&&_d(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),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),Ha(yn),Ft(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function LA(r,i){switch(cm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ha(yn),me(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ue(i),null;case 31:if(i.memoizedState!==null){if(zr(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(zr(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(hn),null;case 4:return me(),null;case 10:return Ha(i.type),null;case 22:case 23:return zr(i),Em(),r!==null&&F(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ha(yn),null;case 25:return null;default:return null}}function F0(r,i){switch(cm(i),i.tag){case 3:Ha(yn),me();break;case 26:case 27:case 5:Ue(i);break;case 4:me();break;case 31:i.memoizedState!==null&&zr(i);break;case 13:zr(i);break;case 19:F(hn);break;case 10:Ha(i.type);break;case 22:case 23:zr(i),Em(),r!==null&&F(Cs);break;case 24:Ha(yn)}}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,j=u.inst;d=v(),j.destroy=d}u=u.next}while(u!==y)}}catch(A){_t(i,i.return,A)}}function Ti(r,i,u){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var j=d.inst,A=j.destroy;if(A!==void 0){j.destroy=void 0,y=i;var H=u,ee=A;try{ee()}catch(ce){_t(y,H,ce)}}}d=d.next}while(d!==v)}}catch(ce){_t(i,i.return,ce)}}function $0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Ox(i,u)}catch(d){_t(r,r.return,d)}}}function H0(r,i,u){u.props=Rs(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){_t(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){_t(r,i,y)}}function Ea(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){_t(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){_t(r,i,y)}else u.current=null}function q0(r){var i=r.type,u=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&d.focus();break e;case"img":u.src?d.src=u.src:u.srcSet&&(d.srcset=u.srcSet)}}catch(y){_t(r,r.return,y)}}function rp(r,i,u){try{var d=r.stateNode;i2(d,r.type,u,i),d[Zt]=i}catch(y){_t(r,r.return,y)}}function Z0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Ii(r.type)||r.tag===4}function ap(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Z0(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&&Ii(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 ip(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=Pa));else if(d!==4&&(d===27&&Ii(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(ip(r,i,u),r=r.sibling;r!==null;)ip(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&&Ii(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 G0(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[dn]=r,i[Zt]=u}catch(v){_t(r,r.return,v)}}var Qa=!1,xn=!1,sp=!1,V0=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function PA(r,i){if(r=r.containerInfo,Np=Yd,r=ix(r),Jh(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var j=0,A=-1,H=-1,ee=0,ce=0,he=r,ne=null;t:for(;;){for(var oe;he!==u||y!==0&&he.nodeType!==3||(A=j+y),he!==v||d!==0&&he.nodeType!==3||(H=j+d),he.nodeType===3&&(j+=he.nodeValue.length),(oe=he.firstChild)!==null;)ne=he,he=oe;for(;;){if(he===r)break t;if(ne===u&&++ee===y&&(A=j),ne===v&&++ce===d&&(H=j),(oe=he.nextSibling)!==null)break;he=ne,ne=he.parentNode}he=oe}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(_p={focusedElem:r,selectionRange:u},Yd=!1,Dn=i;Dn!==null;)if(i=Dn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Dn=r;else for(;Dn!==null;){switch(i=Dn,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){_t(u,u.return,Ze)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)Rp(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Rp(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,Dn=r;break}Dn=i.return}}function Q0(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Ya(r,u),d&4&&fu(5,u);break;case 1:if(Ya(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(j){_t(u,u.return,j)}else{var y=Rs(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(j){_t(u,u.return,j)}}d&64&&$0(u),d&512&&hu(u,u.return);break;case 3:if(Ya(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{Ox(r,i)}catch(j){_t(u,u.return,j)}}break;case 27:i===null&&d&4&&G0(u);case 26:case 5:Ya(r,u),i===null&&d&4&&q0(u),d&512&&hu(u,u.return);break;case 12:Ya(r,u);break;case 31:Ya(r,u),d&4&&X0(r,u);break;case 13:Ya(r,u),d&4&&W0(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=VA.bind(null,u),h2(r,u))));break;case 22:if(d=u.memoizedState!==null||Qa,!d){i=i!==null&&i.memoizedState!==null||xn,y=Qa;var v=xn;Qa=d,(xn=i)&&!v?Xa(r,u,(u.subtreeFlags&8772)!==0):Ya(r,u),Qa=y,xn=v}break;case 30:break;default:Ya(r,u)}}function K0(r){var i=r.alternate;i!==null&&(r.alternate=null,K0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Pe(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Gt=null,pr=!1;function Ka(r,i,u){for(u=u.child;u!==null;)Y0(r,i,u),u=u.sibling}function Y0(r,i,u){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(Ht,u)}catch{}switch(u.tag){case 26:xn||Ea(u,i),Ka(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:xn||Ea(u,i);var d=Gt,y=pr;Ii(u.type)&&(Gt=u.stateNode,pr=!1),Ka(r,i,u),Su(u.stateNode),Gt=d,pr=y;break;case 5:xn||Ea(u,i);case 6:if(d=Gt,y=pr,Gt=null,Ka(r,i,u),Gt=d,pr=y,Gt!==null)if(pr)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(u.stateNode)}catch(v){_t(u,i,v)}else try{Gt.removeChild(u.stateNode)}catch(v){_t(u,i,v)}break;case 18:Gt!==null&&(pr?(r=Gt,$w(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Ul(r)):$w(Gt,u.stateNode));break;case 4:d=Gt,y=pr,Gt=u.stateNode.containerInfo,pr=!0,Ka(r,i,u),Gt=d,pr=y;break;case 0:case 11:case 14:case 15:Ti(2,u,i),xn||Ti(4,u,i),Ka(r,i,u);break;case 1:xn||(Ea(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&H0(u,i,d)),Ka(r,i,u);break;case 21:Ka(r,i,u);break;case 22:xn=(d=xn)||u.memoizedState!==null,Ka(r,i,u),xn=d;break;default:Ka(r,i,u)}}function X0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Ul(r)}catch(u){_t(i,i.return,u)}}}function W0(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){_t(i,i.return,u)}}function UA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new V0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new V0),i;default:throw Error(a(435,r.tag))}}function Ad(r,i){var u=UA(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=QA.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,j=i,A=j;e:for(;A!==null;){switch(A.tag){case 27:if(Ii(A.type)){Gt=A.stateNode,pr=!1;break e}break;case 5:Gt=A.stateNode,pr=!1;break e;case 3:case 4:Gt=A.stateNode.containerInfo,pr=!0;break e}A=A.return}if(Gt===null)throw Error(a(160));Y0(v,j,y),Gt=null,pr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)J0(i,r),i=i.sibling}var ga=null;function J0(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&&(Ti(3,r,r.return),fu(3,r),Ti(5,r,r.return));break;case 1:gr(i,r),yr(r),d&512&&(xn||u===null||Ea(u,u.return)),d&64&&Qa&&(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=ga;if(gr(i,r),yr(r),d&512&&(xn||u===null||Ea(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[vi]||v[dn]||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[dn]=r,ht(v),d=v;break e;case"link":var j=Jw("link","href",y).get(d+(u.href||""));if(j){for(var A=0;A<j.length;A++)if(v=j[A],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){j.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;case"meta":if(j=Jw("meta","content",y).get(d+(u.content||""))){for(A=0;A<j.length;A++)if(v=j[A],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){j.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[dn]=r,ht(v),d=v}r.stateNode=d}else eS(y,r.type,r.stateNode);else r.stateNode=Ww(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?eS(y,r.type,r.stateNode):Ww(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&rp(r,r.memoizedProps,u.memoizedProps)}break;case 27:gr(i,r),yr(r),d&512&&(xn||u===null||Ea(u,u.return)),u!==null&&d&4&&rp(r,r.memoizedProps,u.memoizedProps);break;case 5:if(gr(i,r),yr(r),d&512&&(xn||u===null||Ea(u,u.return)),r.flags&32){y=r.stateNode;try{ol(y,"")}catch(Te){_t(r,r.return,Te)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,rp(r,y,u!==null?u.memoizedProps:y)),d&1024&&(sp=!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){_t(r,r.return,Te)}}break;case 3:if(Gd=null,y=ga,ga=qd(i.containerInfo),gr(i,r),ga=y,yr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{Ul(i.containerInfo)}catch(Te){_t(r,r.return,Te)}sp&&(sp=!1,ew(r));break;case 4:d=ga,ga=qd(r.stateNode.containerInfo),gr(i,r),yr(r),ga=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=un()),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,ee=Qa,ce=xn;if(Qa=ee||y,xn=ce||H,gr(i,r),xn=ce,Qa=ee,yr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Qa||xn||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)j=v.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{A=H.stateNode;var he=H.memoizedProps.style,ne=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Te){_t(H,H.return,Te)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(Te){_t(H,H.return,Te)}}}else if(i.tag===18){if(u===null){H=i;try{var oe=H.stateNode;y?Hw(oe,!0):Hw(H.stateNode,!1)}catch(Te){_t(H,H.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,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(Z0(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=ap(r);Td(r,v,y);break;case 5:var j=u.stateNode;u.flags&32&&(ol(j,""),u.flags&=-33);var A=ap(r);Td(r,A,j);break;case 3:case 4:var H=u.stateNode.containerInfo,ee=ap(r);ip(r,ee,H);break;default:throw Error(a(161))}}catch(ce){_t(r,r.return,ce)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function ew(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;ew(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ya(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Q0(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:Ti(4,i,i.return),Os(i);break;case 1:Ea(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&H0(i,i.return,u),Os(i);break;case 27:Su(i.stateNode);case 26:case 5:Ea(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 Xa(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,j=v.flags;switch(v.tag){case 0:case 11:case 15:Xa(y,v,u),fu(4,v);break;case 1:if(Xa(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ee){_t(d,d.return,ee)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Rx(H[y],A)}catch(ee){_t(d,d.return,ee)}}u&&j&64&&$0(v),hu(v,v.return);break;case 27:G0(v);case 26:case 5:Xa(y,v,u),u&&d===null&&j&4&&q0(v),hu(v,v.return);break;case 12:Xa(y,v,u);break;case 31:Xa(y,v,u),u&&j&4&&X0(y,v);break;case 13:Xa(y,v,u),u&&j&4&&W0(y,v);break;case 22:v.memoizedState===null&&Xa(y,v,u),hu(v,v.return);break;case 30:break;default:Xa(y,v,u)}i=i.sibling}}function lp(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 op(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 ya(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)tw(r,i,u,d),i=i.sibling}function tw(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:ya(r,i,u,d),y&2048&&fu(9,i);break;case 1:ya(r,i,u,d);break;case 3:ya(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){ya(r,i,u,d),r=i.stateNode;try{var v=i.memoizedProps,j=v.id,A=v.onPostCommit;typeof A=="function"&&A(j,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){_t(i,i.return,H)}}else ya(r,i,u,d);break;case 31:ya(r,i,u,d);break;case 13:ya(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,j=i.alternate,i.memoizedState!==null?v._visibility&2?ya(r,i,u,d):mu(r,i):v._visibility&2?ya(r,i,u,d):(v._visibility|=2,_l(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&lp(j,i);break;case 24:ya(r,i,u,d),y&2048&&op(i.alternate,i);break;default:ya(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,j=i,A=u,H=d,ee=j.flags;switch(j.tag){case 0:case 11:case 15:_l(v,j,A,H,y),fu(8,j);break;case 23:break;case 22:var ce=j.stateNode;j.memoizedState!==null?ce._visibility&2?_l(v,j,A,H,y):mu(v,j):(ce._visibility|=2,_l(v,j,A,H,y)),y&&ee&2048&&lp(j.alternate,j);break;case 24:_l(v,j,A,H,y),y&&ee&2048&&op(j.alternate,j);break;default:_l(v,j,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&&lp(d.alternate,d);break;case 24:mu(u,d),y&2048&&op(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;)nw(r,i,u),r=r.sibling}function nw(r,i,u){switch(r.tag){case 26:Tl(r,i,u),r.flags&pu&&r.memoizedState!==null&&E2(u,ga,r.memoizedState,r.memoizedProps);break;case 5:Tl(r,i,u);break;case 3:case 4:var d=ga;ga=qd(r.stateNode.containerInfo),Tl(r,i,u),ga=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 rw(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];Dn=d,iw(d,r)}rw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)aw(r),r=r.sibling}function aw(r){switch(r.tag){case 0:case 11:case 15:gu(r),r.flags&2048&&Ti(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];Dn=d,iw(d,r)}rw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ti(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 iw(r,i){for(;Dn!==null;){var u=Dn;switch(u.tag){case 0:case 11:case 15:Ti(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,Dn=d;else e:for(u=r;Dn!==null;){d=Dn;var y=d.sibling,v=d.return;if(K0(d),d===u){Dn=null;break e}if(y!==null){y.return=v,Dn=y;break e}Dn=v}}}var BA={getCacheForType:function(r){var i=Fn(yn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Fn(yn).controller.signal}},FA=typeof WeakMap=="function"?WeakMap:Map,jt=0,Mt=null,st=null,ct=0,Nt=0,Mr=null,Ai=!1,Al=!1,up=!1,Wa=0,nn=0,Ri=0,zs=0,cp=0,Dr=0,Rl=0,yu=null,vr=null,dp=!1,Od=0,sw=0,zd=1/0,Md=null,Oi=null,Nn=0,zi=null,Ol=null,Ja=0,fp=0,hp=null,lw=null,vu=0,mp=null;function Ir(){return(jt&2)!==0&&ct!==0?ct&-ct:Z.T!==null?xp():Lo()}function ow(){if(Dr===0)if((ct&536870912)===0||mt){var r=ha;ha<<=1,(ha&3932160)===0&&(ha=262144),Dr=r}else Dr=536870912;return r=Or.current,r!==null&&(r.flags|=32),Dr}function br(r,i,u){(r===Mt&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)&&(zl(r,0),Mi(r,ct,Dr,!1)),pn(r,u),((jt&2)===0||r!==Mt)&&(r===Mt&&((jt&2)===0&&(zs|=u),nn===4&&Mi(r,ct,Dr,!1)),Ca(r))}function uw(r,i,u){if((jt&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||Sa(r,i),y=d?qA(r,i):gp(r,i,!0),v=d;do{if(y===0){Al&&!d&&Mi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!$A(u)){y=gp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var j=0;else j=r.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){i=j;e:{var A=r;y=yu;var H=A.current.memoizedState.isDehydrated;if(H&&(zl(A,j).flags|=256),j=gp(A,j,!1),j!==2){if(up&&!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=j}if(v=!1,y!==2)continue}}if(y===1){zl(r,0),Mi(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:Mi(d,i,Dr,!Ai);break e;case 2:vr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Od+300-un(),10<y)){if(Mi(d,i,Dr,!Ai),Da(d,0,!0)!==0)break e;Ja=i,d.timeoutHandle=Bw(cw.bind(null,d,u,vr,Md,dp,i,Dr,zs,Rl,Ai,v,"Throttled",-0,0),y);break e}cw(d,u,vr,Md,dp,i,Dr,zs,Rl,Ai,v,null,-0,0)}}break}while(!0);Ca(r)}function cw(r,i,u,d,y,v,j,A,H,ee,ce,he,ne,oe){if(r.timeoutHandle=-1,he=i.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pa},nw(i,v,he);var Te=(v&62914560)===v?Od-un():(v&4194048)===v?sw-un():0;if(Te=C2(he,Te),Te!==null){Ja=v,r.cancelPendingCommit=Te(vw.bind(null,r,i,v,u,d,y,j,A,H,ce,he,null,ne,oe)),Mi(r,v,j,!ee);return}}vw(r,i,v,u,d,y,j,A,H)}function $A(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(!Ar(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 Mi(r,i,u,d){i&=~cp,i&=~zs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-it(y),j=1<<v;d[v]=-1,y&=~j}u!==0&&yi(r,u,i)}function Dd(){return(jt&6)===0?(bu(0),!1):!0}function pp(){if(st!==null){if(Nt===0)var r=st.return;else r=st,$a=js=null,Rm(r),kl=null,tu=0,r=st;for(;r!==null;)F0(r.alternate,r),r=r.return;st=null}}function zl(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,o2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),Ja=0,pp(),Mt=r,st=u=Ba(r.current,null),ct=i,Nt=0,Mr=null,Ai=!1,Al=Sa(r,i),up=!1,Rl=Dr=cp=zs=Ri=nn=0,vr=yu=null,dp=!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-it(d),v=1<<y;i|=r[y],d&=~v}return Wa=i,nd(),u}function dw(r,i){Ye=null,Z.H=uu,i===Sl||i===cd?(i=Nx(),Nt=3):i===bm?(i=Nx(),Nt=4):Nt=i===Vm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Mr=i,st===null&&(nn=1,jd(r,Gr(i,r.current)))}function fw(){var r=Or.current;return r===null?!0:(ct&4194048)===ct?Yr===null:(ct&62914560)===ct||(ct&536870912)!==0?r===Yr:!1}function hw(){var r=Z.H;return Z.H=uu,r===null?uu:r}function mw(){var r=Z.A;return Z.A=BA,r}function Id(){nn=4,Ai||(ct&4194048)!==ct&&Or.current!==null||(Al=!0),(Ri&134217727)===0&&(zs&134217727)===0||Mt===null||Mi(Mt,ct,Dr,!1)}function gp(r,i,u){var d=jt;jt|=2;var y=hw(),v=mw();(Mt!==r||ct!==i)&&(Md=null,zl(r,i)),i=!1;var j=nn;e:do try{if(Nt!==0&&st!==null){var A=st,H=Mr;switch(Nt){case 8:pp(),j=6;break e;case 3:case 2:case 9:case 6:Or.current===null&&(i=!0);var ee=Nt;if(Nt=0,Mr=null,Ml(r,A,H,ee),u&&Al){j=0;break e}break;default:ee=Nt,Nt=0,Mr=null,Ml(r,A,H,ee)}}HA(),j=nn;break}catch(ce){dw(r,ce)}while(!0);return i&&r.shellSuspendCounter++,$a=js=null,jt=d,Z.H=y,Z.A=v,st===null&&(Mt=null,ct=0,nd()),j}function HA(){for(;st!==null;)pw(st)}function qA(r,i){var u=jt;jt|=2;var d=hw(),y=mw();Mt!==r||ct!==i?(Md=null,zd=un()+500,zl(r,i)):Al=Sa(r,i);e:do try{if(Nt!==0&&st!==null){i=st;var v=Mr;t:switch(Nt){case 1:Nt=0,Mr=null,Ml(r,i,v,1);break;case 2:case 9:if(Ex(v)){Nt=0,Mr=null,gw(i);break}i=function(){Nt!==2&&Nt!==9||Mt!==r||(Nt=7),Ca(r)},v.then(i,i);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:Ex(v)?(Nt=0,Mr=null,gw(i)):(Nt=0,Mr=null,Ml(r,i,v,7));break;case 5:var j=null;switch(st.tag){case 26:j=st.memoizedState;case 5:case 27:var A=st;if(j?tS(j):A.stateNode.complete){Nt=0,Mr=null;var H=A.sibling;if(H!==null)st=H;else{var ee=A.return;ee!==null?(st=ee,Ld(ee)):st=null}break t}}Nt=0,Mr=null,Ml(r,i,v,5);break;case 6:Nt=0,Mr=null,Ml(r,i,v,6);break;case 8:pp(),nn=6;break e;default:throw Error(a(462))}}ZA();break}catch(ce){dw(r,ce)}while(!0);return $a=js=null,Z.H=d,Z.A=y,jt=u,st!==null?0:(Mt=null,ct=0,nd(),nn)}function ZA(){for(;st!==null&&!pi();)pw(st)}function pw(r){var i=U0(r.alternate,r,Wa);r.memoizedProps=r.pendingProps,i===null?Ld(r):st=i}function gw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=z0(u,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=z0(u,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Rm(i);default:F0(u,i),i=st=mx(i,Wa),i=U0(u,i,Wa)}r.memoizedProps=r.pendingProps,i===null?Ld(r):st=i}function Ml(r,i,u,d){$a=js=null,Rm(i),kl=null,tu=0;var y=i.return;try{if(zA(r,y,i,u,ct)){nn=1,jd(r,Gr(u,r.current)),st=null;return}}catch(v){if(y!==null)throw st=y,v;nn=1,jd(r,Gr(u,r.current)),st=null;return}i.flags&32768?(mt||d===1?r=!0:Al||(ct&536870912)!==0?r=!1:(Ai=r=!0,(d===2||d===9||d===3||d===6)&&(d=Or.current,d!==null&&d.tag===13&&(d.flags|=16384))),yw(i,r)):Ld(i)}function Ld(r){var i=r;do{if((i.flags&32768)!==0){yw(i,Ai);return}r=i.return;var u=IA(i.alternate,i,Wa);if(u!==null){st=u;return}if(i=i.sibling,i!==null){st=i;return}st=i=r}while(i!==null);nn===0&&(nn=5)}function yw(r,i){do{var u=LA(r.alternate,r);if(u!==null){u.flags&=32767,st=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){st=r;return}st=r=u}while(r!==null);nn=6,st=null}function vw(r,i,u,d,y,v,j,A,H){r.cancelPendingCommit=null;do Pd();while(Nn!==0);if((jt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=am,Tr(r,u,v,j,A,H),r===Mt&&(st=Mt=null,ct=0),Ol=i,zi=r,Ja=u,fp=v,hp=y,lw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,KA(Fe,function(){return kw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=Z.T,Z.T=null,y=te.p,te.p=2,j=jt,jt|=4;try{PA(r,i,u)}finally{jt=j,te.p=y,Z.T=d}}Nn=1,bw(),xw(),ww()}}function bw(){if(Nn===1){Nn=0;var r=zi,i=Ol,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=Z.T,Z.T=null;var d=te.p;te.p=2;var y=jt;jt|=4;try{J0(i,r);var v=_p,j=ix(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(j!==A&&A&&A.ownerDocument&&ax(A.ownerDocument.documentElement,A)){if(H!==null&&Jh(A)){var ee=H.start,ce=H.end;if(ce===void 0&&(ce=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(ce,A.value.length);else{var he=A.ownerDocument||document,ne=he&&he.defaultView||window;if(ne.getSelection){var oe=ne.getSelection(),Te=A.textContent.length,Ze=Math.min(H.start,Te),Ot=H.end===void 0?Ze:Math.min(H.end,Te);!oe.extend&&Ze>Ot&&(j=Ot,Ot=Ze,Ze=j);var K=rx(A,Ze),V=rx(A,Ot);if(K&&V&&(oe.rangeCount!==1||oe.anchorNode!==K.node||oe.anchorOffset!==K.offset||oe.focusNode!==V.node||oe.focusOffset!==V.offset)){var J=he.createRange();J.setStart(K.node,K.offset),oe.removeAllRanges(),Ze>Ot?(oe.addRange(J),oe.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),oe.addRange(J))}}}}for(he=[],oe=A;oe=oe.parentNode;)oe.nodeType===1&&he.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var fe=he[A];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Yd=!!Np,_p=Np=null}finally{jt=y,te.p=d,Z.T=u}}r.current=i,Nn=2}}function xw(){if(Nn===2){Nn=0;var r=zi,i=Ol,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=Z.T,Z.T=null;var d=te.p;te.p=2;var y=jt;jt|=4;try{Q0(r,i.alternate,i)}finally{jt=y,te.p=d,Z.T=u}}Nn=3}}function ww(){if(Nn===4||Nn===3){Nn=0,gi();var r=zi,i=Ol,u=Ja,d=lw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Nn=5:(Nn=0,Ol=zi=null,Sw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Oi=null),ma(u),i=i.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(Ht,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=Z.T,y=te.p,te.p=2,Z.T=null;try{for(var v=r.onRecoverableError,j=0;j<d.length;j++){var A=d[j];v(A.value,{componentStack:A.stack})}}finally{Z.T=i,te.p=y}}(Ja&3)!==0&&Pd(),Ca(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===mp?vu++:(vu=0,mp=r):vu=0,bu(0)}}function Sw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Jo(i)))}function Pd(){return bw(),xw(),ww(),kw()}function kw(){if(Nn!==5)return!1;var r=zi,i=fp;fp=0;var u=ma(Ja),d=Z.T,y=te.p;try{te.p=32>u?32:u,Z.T=null,u=hp,hp=null;var v=zi,j=Ja;if(Nn=0,Ol=zi=null,Ja=0,(jt&6)!==0)throw Error(a(331));var A=jt;if(jt|=4,aw(v.current),tw(v,v.current,j,u),jt=A,bu(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(Ht,v)}catch{}return!0}finally{te.p=y,Z.T=d,Sw(r,i)}}function jw(r,i,u){i=Gr(u,i),i=Gm(r.stateNode,i,2),r=Ci(r,i,2),r!==null&&(pn(r,2),Ca(r))}function _t(r,i,u){if(r.tag===3)jw(r,r,u);else for(;i!==null;){if(i.tag===3){jw(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Oi===null||!Oi.has(d))){r=Gr(u,r),u=E0(2),d=Ci(i,u,2),d!==null&&(C0(u,d,i,r),pn(d,2),Ca(d));break}}i=i.return}}function yp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new FA;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)||(up=!0,y.add(u),r=GA.bind(null,r,i,u),i.then(r,r))}function GA(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Mt===r&&(ct&u)===u&&(nn===4||nn===3&&(ct&62914560)===ct&&300>un()-Od?(jt&2)===0&&zl(r,0):cp|=u,Rl===ct&&(Rl=0)),Ca(r)}function Ew(r,i){i===0&&(i=Ee()),r=ws(r,i),r!==null&&(pn(r,i),Ca(r))}function VA(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),Ew(r,u)}function QA(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),Ew(r,u)}function KA(r,i){return Pn(r,i)}var Ud=null,Dl=null,vp=!1,Bd=!1,bp=!1,Di=0;function Ca(r){r!==Dl&&r.next===null&&(Dl===null?Ud=Dl=r:Dl=Dl.next=r),Bd=!0,vp||(vp=!0,XA())}function bu(r,i){if(!bp&&Bd){bp=!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 j=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-it(42|r)+1)-1,v&=y&~(j&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,Tw(d,v))}else v=ct,v=Da(d,d===Mt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Sa(d,v)||(u=!0,Tw(d,v));d=d.next}while(u);bp=!1}}function YA(){Cw()}function Cw(){Bd=vp=!1;var r=0;Di!==0&&l2()&&(r=Di);for(var i=un(),u=null,d=Ud;d!==null;){var y=d.next,v=Nw(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}Nn!==0&&Nn!==5||bu(r),Di!==0&&(Di=0)}function Nw(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var j=31-it(v),A=1<<j,H=y[j];H===-1?((A&u)===0||(A&d)!==0)&&(y[j]=qt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Mt,u=ct,u=Da(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&hr(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||Sa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&hr(d),ma(u)){case 2:case 8:u=ye;break;case 32:u=Fe;break;case 268435456:u=at;break;default:u=Fe}return d=_w.bind(null,r),u=Pn(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&hr(d),r.callbackPriority=2,r.callbackNode=null,2}function _w(r,i){if(Nn!==0&&Nn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Pd()&&r.callbackNode!==u)return null;var d=ct;return d=Da(r,r===Mt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(uw(r,d,i),Nw(r,un()),r.callbackNode!=null&&r.callbackNode===u?_w.bind(null,r):null)}function Tw(r,i){if(Pd())return null;uw(r,i,!0)}function XA(){u2(function(){(jt&6)!==0?Pn(ue,YA):Cw()})}function xp(){if(Di===0){var r=xl;r===0&&(r=fa,fa<<=1,(fa&261888)===0&&(fa=256)),Di=r}return Di}function Aw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Qc(""+r)}function Rw(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 WA(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=Aw((y[Zt]||null).action),j=d.submitter;j&&(i=(i=j[Zt]||null)?Aw(i.formAction):j.getAttribute("formAction"),i!==null&&(v=i,j=null));var A=new Wc("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Di!==0){var H=j?Rw(y,j):new FormData(y);Bm(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=j?Rw(y,j):new FormData(y),Bm(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var wp=0;wp<rm.length;wp++){var Sp=rm[wp],JA=Sp.toLowerCase(),e2=Sp[0].toUpperCase()+Sp.slice(1);pa(JA,"on"+e2)}pa(ox,"onAnimationEnd"),pa(ux,"onAnimationIteration"),pa(cx,"onAnimationStart"),pa("dblclick","onDoubleClick"),pa("focusin","onFocus"),pa("focusout","onBlur"),pa(gA,"onTransitionRun"),pa(yA,"onTransitionStart"),pa(vA,"onTransitionCancel"),pa(dx,"onTransitionEnd"),Mn("onMouseEnter",["mouseout","mouseover"]),Mn("onMouseLeave",["mouseout","mouseover"]),Mn("onPointerEnter",["pointerout","pointerover"]),Mn("onPointerLeave",["pointerout","pointerover"]),gn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gn("onBeforeInput",["compositionend","keypress","textInput","paste"]),gn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var 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(" "),t2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xu));function Ow(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var j=d.length-1;0<=j;j--){var A=d[j],H=A.instance,ee=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(ce){td(ce)}y.currentTarget=null,v=H}else for(j=0;j<d.length;j++){if(A=d[j],H=A.instance,ee=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(ce){td(ce)}y.currentTarget=null,v=H}}}}function lt(r,i){var u=i[sl];u===void 0&&(u=i[sl]=new Set);var d=r+"__bubble";u.has(d)||(zw(i,r,2,!1),u.add(d))}function kp(r,i,u){var d=0;i&&(d|=4),zw(u,r,d,i)}var Fd="_reactListening"+Math.random().toString(36).slice(2);function jp(r){if(!r[Fd]){r[Fd]=!0,Xt.forEach(function(u){u!=="selectionchange"&&(t2.has(u)||kp(u,!1,r),kp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Fd]||(i[Fd]=!0,kp("selectionchange",!1,i))}}function zw(r,i,u,d){switch(oS(i)){case 2:var y=T2;break;case 8:y=A2;break;default:y=Up}u=y.bind(null,i,u,r),y=void 0,!qh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Ep(r,i,u,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var A=d.stateNode.containerInfo;if(A===y)break;if(j===4)for(j=d.return;j!==null;){var H=j.tag;if((H===3||H===4)&&j.stateNode.containerInfo===y)return;j=j.return}for(;A!==null;){if(j=$(A),j===null)return;if(H=j.tag,H===5||H===6||H===26||H===27){d=v=j;continue e}A=A.parentNode}}d=d.return}Pb(function(){var ee=v,ce=$h(u),he=[];e:{var ne=fx.get(r);if(ne!==void 0){var oe=Wc,Te=r;switch(r){case"keypress":if(Yc(u)===0)break e;case"keydown":case"keyup":oe=QT;break;case"focusin":Te="focus",oe=Qh;break;case"focusout":Te="blur",oe=Qh;break;case"beforeblur":case"afterblur":oe=Qh;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":oe=Fb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=IT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=XT;break;case ox:case ux:case cx:oe=UT;break;case dx:oe=JT;break;case"scroll":case"scrollend":oe=MT;break;case"wheel":oe=tA;break;case"copy":case"cut":case"paste":oe=FT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Hb;break;case"toggle":case"beforetoggle":oe=rA}var Ze=(i&4)!==0,Ot=!Ze&&(r==="scroll"||r==="scrollend"),K=Ze?ne!==null?ne+"Capture":null:ne;Ze=[];for(var V=ee,J;V!==null;){var fe=V;if(J=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||J===null||K===null||(fe=$o(V,K),fe!=null&&Ze.push(wu(V,fe,J))),Ot)break;V=V.return}0<Ze.length&&(ne=new oe(ne,Te,null,u,ce),he.push({event:ne,listeners:Ze}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",ne&&u!==Fh&&(Te=u.relatedTarget||u.fromElement)&&($(Te)||Te[Ia]))break e;if((oe||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,oe?(Te=u.relatedTarget||u.toElement,oe=ee,Te=Te?$(Te):null,Te!==null&&(Ot=o(Te),Ze=Te.tag,Te!==Ot||Ze!==5&&Ze!==27&&Ze!==6)&&(Te=null)):(oe=null,Te=ee),oe!==Te)){if(Ze=Fb,fe="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ze=Hb,fe="onPointerLeave",K="onPointerEnter",V="pointer"),Ot=oe==null?ne:Ne(oe),J=Te==null?ne:Ne(Te),ne=new Ze(fe,V+"leave",oe,u,ce),ne.target=Ot,ne.relatedTarget=J,fe=null,$(ce)===ee&&(Ze=new Ze(K,V+"enter",Te,u,ce),Ze.target=J,Ze.relatedTarget=Ot,fe=Ze),Ot=fe,oe&&Te)t:{for(Ze=n2,K=oe,V=Te,J=0,fe=K;fe;fe=Ze(fe))J++;fe=0;for(var Be=V;Be;Be=Ze(Be))fe++;for(;0<J-fe;)K=Ze(K),J--;for(;0<fe-J;)V=Ze(V),fe--;for(;J--;){if(K===V||V!==null&&K===V.alternate){Ze=K;break t}K=Ze(K),V=Ze(V)}Ze=null}else Ze=null;oe!==null&&Mw(he,ne,oe,Ze,!1),Te!==null&&Ot!==null&&Mw(he,Ot,Te,Ze,!0)}}e:{if(ne=ee?Ne(ee):window,oe=ne.nodeName&&ne.nodeName.toLowerCase(),oe==="select"||oe==="input"&&ne.type==="file")var St=Xb;else if(Kb(ne))if(Wb)St=hA;else{St=dA;var Me=cA}else oe=ne.nodeName,!oe||oe.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Bh(ee.elementType)&&(St=Xb):St=fA;if(St&&(St=St(r,ee))){Yb(he,St,u,ce);break e}Me&&Me(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Uh(ne,"number",ne.value)}switch(Me=ee?Ne(ee):window,r){case"focusin":(Kb(Me)||Me.contentEditable==="true")&&(fl=Me,em=ee,Yo=null);break;case"focusout":Yo=em=fl=null;break;case"mousedown":tm=!0;break;case"contextmenu":case"mouseup":case"dragend":tm=!1,sx(he,u,ce);break;case"selectionchange":if(pA)break;case"keydown":case"keyup":sx(he,u,ce)}var Xe;if(Yh)e:{switch(r){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else dl?Vb(r,u)&&(dt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(dt="onCompositionStart");dt&&(qb&&u.locale!=="ko"&&(dl||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&dl&&(Xe=Ub()):(bi=ce,Zh="value"in bi?bi.value:bi.textContent,dl=!0)),Me=$d(ee,dt),0<Me.length&&(dt=new $b(dt,r,null,u,ce),he.push({event:dt,listeners:Me}),Xe?dt.data=Xe:(Xe=Qb(u),Xe!==null&&(dt.data=Xe)))),(Xe=iA?sA(r,u):lA(r,u))&&(dt=$d(ee,"onBeforeInput"),0<dt.length&&(Me=new $b("onBeforeInput","beforeinput",null,u,ce),he.push({event:Me,listeners:dt}),Me.data=Xe)),WA(he,r,ee,u,ce)}Ow(he,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 n2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Mw(r,i,u,d,y){for(var v=i._reactName,j=[];u!==null&&u!==d;){var A=u,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===d)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,y?(ee=$o(u,v),ee!=null&&j.unshift(wu(u,ee,H))):y||(ee=$o(u,v),ee!=null&&j.push(wu(u,ee,H)))),u=u.return}j.length!==0&&r.push({event:i,listeners:j})}var r2=/\r\n?/g,a2=/\u0000|\uFFFD/g;function Dw(r){return(typeof r=="string"?r:""+r).replace(r2,`
49
- `).replace(a2,"")}function Iw(r,i){return i=Dw(i),Dw(r)===i}function Rt(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":Ib(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"&&Rt(r,i,"name",y.name,y,null),Rt(r,i,"formEncType",y.formEncType,y,null),Rt(r,i,"formMethod",y.formMethod,y,null),Rt(r,i,"formTarget",y.formTarget,y,null)):(Rt(r,i,"encType",y.encType,y,null),Rt(r,i,"method",y.method,y,null),Rt(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Qc(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=Pa);break;case"onScroll":d!=null&&lt("scroll",r);break;case"onScrollEnd":d!=null&&lt("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":lt("beforetoggle",r),lt("toggle",r),Zc(r,"popover",d);break;case"xlinkActuate":La(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":La(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":La(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":La(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":La(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":La(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":La(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":La(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":La(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=OT.get(u)||u,Zc(r,u,d))}}function Cp(r,i,u,d,y,v){switch(u){case"style":Ib(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&&lt("scroll",r);break;case"onScrollEnd":d!=null&&lt("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Pa);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[Zt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,d,y);break e}u in r?r[u]=d:d===!0?r.setAttribute(u,""):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":lt("error",r),lt("load",r);var d=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var j=u[v];if(j!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,v,j,u,null)}}y&&Rt(r,i,"srcSet",u.srcSet,u,null),d&&Rt(r,i,"src",u.src,u,null);return;case"input":lt("invalid",r);var A=v=j=y=null,H=null,ee=null;for(d in u)if(u.hasOwnProperty(d)){var ce=u[d];if(ce!=null)switch(d){case"name":y=ce;break;case"type":j=ce;break;case"checked":H=ce;break;case"defaultChecked":ee=ce;break;case"value":v=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,i));break;default:Rt(r,i,d,ce,u,null)}}Ob(r,v,A,H,ee,j,y,!1);return;case"select":lt("invalid",r),d=j=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":j=A;break;case"multiple":d=A;default:Rt(r,i,y,A,u,null)}i=v,u=j,r.multiple=!!d,i!=null?ll(r,!!d,i,!1):u!=null&&ll(r,!!d,u,!0);return;case"textarea":lt("invalid",r),v=y=d=null;for(j in u)if(u.hasOwnProperty(j)&&(A=u[j],A!=null))switch(j){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Rt(r,i,j,A,u,null)}Mb(r,d,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(d=u[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Rt(r,i,H,d,u,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<xu.length;d++)lt(xu[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in u)if(u.hasOwnProperty(ee)&&(d=u[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,ee,d,u,null)}return;default:if(Bh(i)){for(ce in u)u.hasOwnProperty(ce)&&(d=u[ce],d!==void 0&&Cp(r,i,ce,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&Rt(r,i,A,d,u,null))}function i2(r,i,u,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,j=null,A=null,H=null,ee=null,ce=null;for(oe in u){var he=u[oe];if(u.hasOwnProperty(oe)&&he!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":H=he;default:d.hasOwnProperty(oe)||Rt(r,i,oe,null,d,he)}}for(var ne in d){var oe=d[ne];if(he=u[ne],d.hasOwnProperty(ne)&&(oe!=null||he!=null))switch(ne){case"type":v=oe;break;case"name":y=oe;break;case"checked":ee=oe;break;case"defaultChecked":ce=oe;break;case"value":j=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:oe!==he&&Rt(r,i,ne,oe,d,he)}}Ph(r,j,A,H,ee,ce,v,y);return;case"select":oe=j=A=ne=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":oe=H;default:d.hasOwnProperty(v)||Rt(r,i,v,null,d,H)}for(y in d)if(v=d[y],H=u[y],d.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":ne=v;break;case"defaultValue":A=v;break;case"multiple":j=v;default:v!==H&&Rt(r,i,y,v,d,H)}i=A,u=j,d=oe,ne!=null?ll(r,!!u,ne,!1):!!d!=!!u&&(i!=null?ll(r,!!u,i,!0):ll(r,!!u,u?[]:"",!1));return;case"textarea":oe=ne=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(r,i,A,null,d,y)}for(j in d)if(y=d[j],v=u[j],d.hasOwnProperty(j)&&(y!=null||v!=null))switch(j){case"value":ne=y;break;case"defaultValue":oe=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Rt(r,i,j,y,d,v)}zb(r,ne,oe);return;case"option":for(var Te in u)if(ne=u[Te],u.hasOwnProperty(Te)&&ne!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Rt(r,i,Te,null,d,ne)}for(H in d)if(ne=d[H],oe=u[H],d.hasOwnProperty(H)&&ne!==oe&&(ne!=null||oe!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:Rt(r,i,H,ne,d,oe)}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)ne=u[Ze],u.hasOwnProperty(Ze)&&ne!=null&&!d.hasOwnProperty(Ze)&&Rt(r,i,Ze,null,d,ne);for(ee in d)if(ne=d[ee],oe=u[ee],d.hasOwnProperty(ee)&&ne!==oe&&(ne!=null||oe!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:Rt(r,i,ee,ne,d,oe)}return;default:if(Bh(i)){for(var Ot in u)ne=u[Ot],u.hasOwnProperty(Ot)&&ne!==void 0&&!d.hasOwnProperty(Ot)&&Cp(r,i,Ot,void 0,d,ne);for(ce in d)ne=d[ce],oe=u[ce],!d.hasOwnProperty(ce)||ne===oe||ne===void 0&&oe===void 0||Cp(r,i,ce,ne,d,oe);return}}for(var K in u)ne=u[K],u.hasOwnProperty(K)&&ne!=null&&!d.hasOwnProperty(K)&&Rt(r,i,K,null,d,ne);for(he in d)ne=d[he],oe=u[he],!d.hasOwnProperty(he)||ne===oe||ne==null&&oe==null||Rt(r,i,he,ne,d,oe)}function Lw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function s2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),d=0;d<u.length;d++){var y=u[d],v=y.transferSize,j=y.initiatorType,A=y.duration;if(v&&A&&Lw(j)){for(j=0,A=y.responseEnd,d+=1;d<u.length;d++){var H=u[d],ee=H.startTime;if(ee>A)break;var ce=H.transferSize,he=H.initiatorType;ce&&Lw(he)&&(H=H.responseEnd,j+=ce*(H<A?1:(A-ee)/(H-ee)))}if(--d,i+=8*(v+j)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Np=null,_p=null;function Hd(r){return r.nodeType===9?r:r.ownerDocument}function Pw(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 Uw(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 Tp(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 Ap=null;function l2(){var r=window.event;return r&&r.type==="popstate"?r===Ap?!1:(Ap=r,!0):(Ap=null,!1)}var Bw=typeof setTimeout=="function"?setTimeout:void 0,o2=typeof clearTimeout=="function"?clearTimeout:void 0,Fw=typeof Promise=="function"?Promise:void 0,u2=typeof queueMicrotask=="function"?queueMicrotask:typeof Fw<"u"?function(r){return Fw.resolve(null).then(r).catch(c2)}:Bw;function c2(r){setTimeout(function(){throw r})}function Ii(r){return r==="head"}function $w(r,i){var u=i,d=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(d===0){r.removeChild(y),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 j=v.nextSibling,A=v.nodeName;v[vi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=j}}else u==="body"&&Su(r.ownerDocument.body);u=y}while(u);Ul(i)}function Hw(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 Rp(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":Rp(u),Pe(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function d2(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[vi])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=Xr(r.nextSibling),r===null)break}return null}function f2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Xr(r.nextSibling),r===null))return null;return r}function qw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Xr(r.nextSibling),r===null))return null;return r}function Op(r){return r.data==="$?"||r.data==="$~"}function zp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function h2(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 Xr(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 Mp=null;function Zw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return Xr(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function Gw(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 Vw(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]);Pe(r)}var Wr=new Map,Qw=new Set;function qd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ei=te.d;te.d={f:m2,r:p2,D:g2,C:y2,L:v2,m:b2,X:w2,S:x2,M:S2};function m2(){var r=ei.f(),i=Dd();return r||i}function p2(r){var i=pe(r);i!==null&&i.tag===5&&i.type==="form"?d0(i):ei.r(r)}var Il=typeof document>"u"?null:document;function Kw(r,i,u){var d=Il;if(d&&typeof i=="string"&&i){var y=qr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Qw.has(y)||(Qw.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Hn(i,"link",r),ht(i),d.head.appendChild(i)))}}function g2(r){ei.D(r),Kw("dns-prefetch",r,null)}function y2(r,i){ei.C(r,i),Kw("preconnect",r,i)}function v2(r,i,u){ei.L(r,i,u);var d=Il;if(d&&r&&i){var y='link[rel="preload"][as="'+qr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+qr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+qr(u.imageSizes)+'"]')):y+='[href="'+qr(r)+'"]';var v=y;switch(i){case"style":v=Ll(r);break;case"script":v=Pl(r)}Wr.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),Wr.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),ht(i),d.head.appendChild(i)))}}function b2(r,i){ei.m(r,i);var u=Il;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+qr(d)+'"][href="'+qr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Pl(r)}if(!Wr.has(v)&&(r=g({rel:"modulepreload",href:r},i),Wr.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),ht(d),u.head.appendChild(d)}}}function x2(r,i,u){ei.S(r,i,u);var d=Il;if(d&&r){var y=wt(d).hoistableStyles,v=Ll(r);i=i||"default";var j=y.get(v);if(!j){var A={loading:0,preload:null};if(j=d.querySelector(ku(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=Wr.get(v))&&Dp(r,u);var H=j=d.createElement("link");ht(H),Hn(H,"link",r),H._p=new Promise(function(ee,ce){H.onload=ee,H.onerror=ce}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Zd(j,i,d)}j={type:"stylesheet",instance:j,count:1,state:A},y.set(v,j)}}}function w2(r,i){ei.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=Wr.get(y))&&Ip(r,i),v=u.createElement("script"),ht(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function S2(r,i){ei.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=Wr.get(y))&&Ip(r,i),v=u.createElement("script"),ht(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function Yw(r,i,u,d){var y=(y=re.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,j=v.get(r);if(j||(y=y.ownerDocument||y,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,j),(v=y.querySelector(ku(r)))&&!v._p&&(j.instance=v,j.state.loading=5),Wr.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},Wr.set(r,u),v||k2(y,r,u,j.state))),i&&d===null)throw Error(a(528,""));return j}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=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="'+qr(r)+'"'}function ku(r){return'link[rel="stylesheet"]['+r+"]"}function Xw(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function k2(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),ht(i),r.head.appendChild(i))}function Pl(r){return'[src="'+qr(r)+'"]'}function ju(r){return"script[async]"+r}function Ww(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+qr(u.href)+'"]');if(d)return i.instance=d,ht(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"),ht(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,ht(v),v;d=Xw(u),(y=Wr.get(y))&&Dp(d,y),v=(r.ownerDocument||r).createElement("link"),ht(v);var j=v;return j._p=new Promise(function(A,H){j.onload=A,j.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,ht(y),y):(d=u,(y=Wr.get(v))&&(d=g({},u),Ip(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),ht(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,j=0;j<d.length;j++){var A=d[j];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Dp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Ip(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 Jw(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[vi]||v[dn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var j=v.getAttribute(i)||"";j=r+j;var A=d.get(j);A?A.push(v):d.set(j,[v])}}return d}function eS(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function j2(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 tS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function E2(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,ht(v);return}v=i.ownerDocument||i,d=Xw(d),(y=Wr.get(y))&&Dp(d,y),v=v.createElement("link"),ht(v);var j=v;j._p=new Promise(function(A,H){j.onload=A,j.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 Lp=0;function C2(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&&Lp===0&&(Lp=62500*s2());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>Lp?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(N2,r),Qd=null,Vd.call(r))}function N2(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 j=y[v];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(u.set(j.dataset.precedence,j),d=j)}d&&u.set(null,d)}y=i.instance,j=y.getAttribute("data-precedence"),v=u.get(j)||d,v===d&&u.set(null,y),u.set(j,y),this.count++,d=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:je,_currentValue2:je,_threadCount:0};function _2(r,i,u,d,y,v,j,A,H){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function nS(r,i,u,d,y,v,j,A,H,ee,ce,he){return r=new _2(r,i,u,j,H,ee,ce,he,A),i=1,v===!0&&(i|=24),v=Rr(3,null,null,i),r.current=v,v.stateNode=r,i=gm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},xm(v),r}function rS(r){return r?(r=pl,r):pl}function aS(r,i,u,d,y,v){y=rS(y),d.context===null?d.context=y:d.pendingContext=y,d=Ei(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=Ci(r,d,i),u!==null&&(br(u,r,i),ru(u,r,i))}function iS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Pp(r,i){iS(r,i),(r=r.alternate)&&iS(r,i)}function sS(r){if(r.tag===13||r.tag===31){var i=ws(r,67108864);i!==null&&br(i,r,67108864),Pp(r,67108864)}}function lS(r){if(r.tag===13||r.tag===31){var i=Ir();i=rr(i);var u=ws(r,i);u!==null&&br(u,r,i),Pp(r,i)}}var Yd=!0;function T2(r,i,u,d){var y=Z.T;Z.T=null;var v=te.p;try{te.p=2,Up(r,i,u,d)}finally{te.p=v,Z.T=y}}function A2(r,i,u,d){var y=Z.T;Z.T=null;var v=te.p;try{te.p=8,Up(r,i,u,d)}finally{te.p=v,Z.T=y}}function Up(r,i,u,d){if(Yd){var y=Bp(d);if(y===null)Ep(r,i,d,Xd,u),uS(r,d);else if(O2(y,r,i,u,d))d.stopPropagation();else if(uS(r,d),i&4&&-1<R2.indexOf(r)){for(;y!==null;){var v=pe(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var j=Vn(v.pendingLanes);if(j!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;j;){var H=1<<31-it(j);A.entanglements[1]|=H,j&=~H}Ca(v),(jt&6)===0&&(zd=un()+500,bu(0))}}break;case 31:case 13:A=ws(v,2),A!==null&&br(A,v,2),Dd(),Pp(v,2)}if(v=Bp(d),v===null&&Ep(r,i,d,Xd,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Ep(r,i,d,null,u)}}function Bp(r){return r=$h(r),Fp(r)}var Xd=null;function Fp(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 oS(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(da()){case ue:return 2;case ye:return 8;case Fe:case Ve:return 32;case at:return 268435456;default:return 32}default:return 32}}var $p=!1,Li=null,Pi=null,Ui=null,Cu=new Map,Nu=new Map,Bi=[],R2="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 uS(r,i){switch(r){case"focusin":case"focusout":Li=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Ui=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=pe(i),i!==null&&sS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function O2(r,i,u,d,y){switch(i){case"focusin":return Li=_u(Li,r,i,u,d,y),!0;case"dragenter":return Pi=_u(Pi,r,i,u,d,y),!0;case"mouseover":return Ui=_u(Ui,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 cS(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(){lS(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,Po(r.priority,function(){lS(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=Bp(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);Fh=d,u.target.dispatchEvent(d),Fh=null}else return i=pe(u),i!==null&&sS(i),r.blockedOn=u,!1;i.shift()}return!0}function dS(r,i,u){Wd(r)&&u.delete(i)}function z2(){$p=!1,Li!==null&&Wd(Li)&&(Li=null),Pi!==null&&Wd(Pi)&&(Pi=null),Ui!==null&&Wd(Ui)&&(Ui=null),Cu.forEach(dS),Nu.forEach(dS)}function Jd(r,i){r.blockedOn===i&&(r.blockedOn=null,$p||($p=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,z2)))}var ef=null;function fS(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(Fp(d||u)===null)continue;break}var v=pe(u);v!==null&&(r.splice(i,3),i-=3,Bm(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function Ul(r){function i(H){return Jd(H,r)}Li!==null&&Jd(Li,r),Pi!==null&&Jd(Pi,r),Ui!==null&&Jd(Ui,r),Cu.forEach(i),Nu.forEach(i);for(var u=0;u<Bi.length;u++){var d=Bi[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Bi.length&&(u=Bi[0],u.blockedOn===null);)cS(u),u.blockedOn===null&&Bi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(d=0;d<u.length;d+=3){var y=u[d],v=u[d+1],j=y[Zt]||null;if(typeof v=="function")j||fS(u);else if(j){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,j=v[Zt]||null)A=j.formAction;else if(Fp(y)!==null)continue}else A=j.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),fS(u)}}}function hS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(j){return y=j})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(u,20)}function u(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Hp(r){this._internalRoot=r}tf.prototype.render=Hp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Ir();aS(u,d,r,i,null,null)},tf.prototype.unmount=Hp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;aS(r.current,2,null,r,null,null),Dd(),i[Ia]=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<Bi.length&&i!==0&&i<Bi[u].priority;u++);Bi.splice(u,0,r),u===0&&cS(r)}};var mS=t.version;if(mS!=="19.2.4")throw Error(a(527,mS,"19.2.4"));te.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var M2={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{Ht=nf.inject(M2),Lt=nf}catch{}}return Au.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=w0,v=S0,j=k0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(j=i.onRecoverableError)),i=nS(r,1,!1,null,null,u,d,null,y,v,j,hS),r[Ia]=i.current,jp(r),new Hp(i)},Au.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=w0,j=S0,A=k0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(d=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(j=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=nS(r,1,!0,i,u??null,d,y,H,v,j,A,hS),i.context=rS(null),u=i.current,d=Ir(),d=rr(d),y=Ei(d),y.callback=null,Ci(u,y,d),u=d,i.current.lanes=u,pn(i,u),Ca(i),r[Ia]=i.current,jp(r),new tf(i)},Au.version="19.2.4",Au}var ES;function Z2(){if(ES)return Vp.exports;ES=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Vp.exports=q2(),Vp.exports}var G2=Z2(),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,lj,V2=(lj=class extends Ws{constructor(){super();_e(this,Us);_e(this,Ki);_e(this,ao);ke(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Ki)||this.setEventListener(U(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Ki))==null||t.call(this),ke(this,Ki,void 0))}setEventListener(t){var n;ke(this,ao,t),(n=U(this,Ki))==null||n.call(this),ke(this,Ki,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){U(this,Us)!==t&&(ke(this,Us,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof U(this,Us)=="boolean"?U(this,Us):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Us=new WeakMap,Ki=new WeakMap,ao=new WeakMap,lj),av=new V2,Q2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yi,tv,oj,K2=(oj=class{constructor(){_e(this,Yi,Q2);_e(this,tv,!1)}setTimeoutProvider(e){ke(this,Yi,e)}setTimeout(e,t){return U(this,Yi).setTimeout(e,t)}clearTimeout(e){U(this,Yi).clearTimeout(e)}setInterval(e,t){return U(this,Yi).setInterval(e,t)}clearInterval(e){U(this,Yi).clearInterval(e)}},Yi=new WeakMap,tv=new WeakMap,oj),Is=new K2;function Y2(e){setTimeout(e,0)}var X2=typeof window>"u"||"Deno"in globalThis;function Xn(){}function W2(e,t){return typeof e=="function"?e(t):e}function Gg(e){return typeof e=="number"&&e>=0&&e!==1/0}function xj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function is(e,t){return typeof e=="function"?e(t):e}function ta(e,t){return typeof e=="function"?e(t):e}function CS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==iv(c,t.options))return!1}else if(!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 NS(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 iv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qs)(e)}function Qs(e){return JSON.stringify(e,(t,n)=>Vg(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 J2=Object.prototype.hasOwnProperty;function sv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=_S(e)&&_S(t);if(!a&&!(Vg(e)&&Vg(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:J2.call(e,g))&&h++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){m[g]=w;continue}const S=sv(x,w,n+1);m[g]=S,S===x&&h++}return o===f&&h===o?e:m}function 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 _S(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vg(e){if(!TS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!TS(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function TS(e){return Object.prototype.toString.call(e)==="[object Object]"}function eR(e){return new Promise(t=>{Is.setTimeout(t,e)})}function Qg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?sv(e,t):t}function tR(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function nR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var lv=Symbol();function wj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===lv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ov(e,t){return typeof e=="function"?e(...t):!!e}function rR(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=()=>X2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Kg(){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 aR=Y2;function iR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=aR;const o=f=>{t?e.push(f):s(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var sn=iR(),io,Xi,so,uj,sR=(uj=class extends Ws{constructor(){super();_e(this,io,!0);_e(this,Xi);_e(this,so);ke(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(){U(this,Xi)||this.setEventListener(U(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Xi))==null||t.call(this),ke(this,Xi,void 0))}setEventListener(t){var n;ke(this,so,t),(n=U(this,Xi))==null||n.call(this),ke(this,Xi,t(this.setOnline.bind(this)))}setOnline(t){U(this,io)!==t&&(ke(this,io,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return U(this,io)}},io=new WeakMap,Xi=new WeakMap,so=new WeakMap,uj),If=new sR;function lR(e){return Math.min(1e3*2**e,3e4)}function Sj(e){return(e??"online")==="online"?If.isOnline():!0}var Yg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function kj(e){let t=!1,n=0,a;const s=Kg(),o=()=>s.status!=="pending",c=k=>{var E;if(!o()){const C=new Yg(k);x(C),(E=e.onCancel)==null||E.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>av.isFocused()&&(e.networkMode==="always"||If.isOnline())&&e.canRun(),p=()=>Sj(e.networkMode)&&e.canRun(),g=k=>{o()||(a==null||a(),s.resolve(k))},x=k=>{o()||(a==null||a(),s.reject(k))},w=()=>new Promise(k=>{var E;a=C=>{(o()||h())&&k(C)},(E=e.onPause)==null||E.call(e)}).then(()=>{var k;a=void 0,o()||(k=e.onContinue)==null||k.call(e)}),S=()=>{if(o())return;let k;const E=n===0?e.initialPromise:void 0;try{k=E??e.fn()}catch(C){k=Promise.reject(C)}Promise.resolve(k).then(g).catch(C=>{var O;if(o())return;const N=e.retry??(sc.isServer()?0:3),R=e.retryDelay??lR,z=typeof R=="function"?R(n,C):R,L=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!L){x(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),eR(z).then(()=>h()?void 0:w()).then(()=>{t?x(C):S()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?S():w().then(S),s)}}var Bs,cj,jj=(cj=class{constructor(){_e(this,Bs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gg(this.gcTime)&&ke(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(){U(this,Bs)&&(Is.clearTimeout(U(this,Bs)),ke(this,Bs,void 0))}},Bs=new WeakMap,cj),Fs,lo,Jr,$s,In,xc,Hs,Ur,Ej,ni,dj,oR=(dj=class extends jj{constructor(t){super();_e(this,Ur);_e(this,Fs);_e(this,lo);_e(this,Jr);_e(this,$s);_e(this,In);_e(this,xc);_e(this,Hs);ke(this,Hs,!1),ke(this,xc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ke(this,$s,t.client),ke(this,Jr,U(this,$s).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ke(this,Fs,RS(this.options)),this.state=t.state??U(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=U(this,In))==null?void 0:t.promise}setOptions(t){if(this.options={...U(this,xc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=RS(this.options);n.data!==void 0&&(this.setState(AS(n.data,n.dataUpdatedAt)),ke(this,Fs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,Jr).remove(this)}setData(t,n){const a=Qg(this.state.data,t,this.options);return Ge(this,Ur,ni).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,Ur,ni).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=U(this,In))==null?void 0:a.promise;return(s=U(this,In))==null||s.cancel(t),n?n.then(Xn).catch(Xn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return U(this,Fs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ta(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>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:!xj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,In))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,In))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),U(this,Jr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(U(this,In)&&(U(this,Hs)||Ge(this,Ur,Ej).call(this)?U(this,In).cancel({revert:!0}):U(this,In).cancelRetry()),this.scheduleGc()),U(this,Jr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ge(this,Ur,ni).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,x,w,S,k,E,C,N,R;if(this.state.fetchStatus!=="idle"&&((m=U(this,In))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,In))return U(this,In).continueRetry(),U(this,In).promise}if(t&&this.setOptions(t),!this.options.queryFn){const z=this.observers.find(L=>L.options.queryFn);z&&this.setOptions(z.options)}const a=new AbortController,s=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(ke(this,Hs,!0),a.signal)})},o=()=>{const z=wj(this.options,n),O=(()=>{const B={client:U(this,$s),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return ke(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:U(this,$s),state:this.state,fetchFn:o};return s(z),z})();(h=this.options.behavior)==null||h.onFetch(f,this),ke(this,lo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Ge(this,Ur,ni).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),ke(this,In,kj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:z=>{z instanceof Yg&&z.revert&&this.setState({...U(this,lo),fetchStatus:"idle"}),a.abort()},onFail:(z,L)=>{Ge(this,Ur,ni).call(this,{type:"failed",failureCount:z,error:L})},onPause:()=>{Ge(this,Ur,ni).call(this,{type:"pause"})},onContinue:()=>{Ge(this,Ur,ni).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const z=await U(this,In).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(w=(x=U(this,Jr).config).onSuccess)==null||w.call(x,z,this),(k=(S=U(this,Jr).config).onSettled)==null||k.call(S,z,this.state.error,this),z}catch(z){if(z instanceof Yg){if(z.silent)return U(this,In).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ge(this,Ur,ni).call(this,{type:"error",error:z}),(C=(E=U(this,Jr).config).onError)==null||C.call(E,z,this),(R=(N=U(this,Jr).config).onSettled)==null||R.call(N,this.state.data,z,this),z}finally{this.scheduleGc()}}},Fs=new WeakMap,lo=new WeakMap,Jr=new WeakMap,$s=new WeakMap,In=new WeakMap,xc=new WeakMap,Hs=new WeakMap,Ur=new WeakSet,Ej=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ni=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,...Cj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...AS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ke(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),sn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),U(this,Jr).notify({query:this,type:"updated",action:t})})},dj);function Cj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function AS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function RS(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,pt,wc,lr,qs,oo,ri,Wi,Sc,uo,co,Zs,Gs,Ji,fo,Ct,Ku,Xg,Wg,Jg,ey,ty,ny,ry,Nj,fj,uv=(fj=class extends Ws{constructor(t,n){super();_e(this,Ct);_e(this,Sr);_e(this,pt);_e(this,wc);_e(this,lr);_e(this,qs);_e(this,oo);_e(this,ri);_e(this,Wi);_e(this,Sc);_e(this,uo);_e(this,co);_e(this,Zs);_e(this,Gs);_e(this,Ji);_e(this,fo,new Set);this.options=n,ke(this,Sr,t),ke(this,Wi,null),ke(this,ri,Kg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,pt).addObserver(this),OS(U(this,pt),this.options)?Ge(this,Ct,Ku).call(this):this.updateResult(),Ge(this,Ct,ey).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ay(U(this,pt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ay(U(this,pt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ge(this,Ct,ty).call(this),Ge(this,Ct,ny).call(this),U(this,pt).removeObserver(this)}setOptions(t){const n=this.options,a=U(this,pt);if(this.options=U(this,Sr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ta(this.options.enabled,U(this,pt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ge(this,Ct,ry).call(this),U(this,pt).setOptions(this.options),n._defaulted&&!ic(this.options,n)&&U(this,Sr).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,pt),observer:this});const s=this.hasListeners();s&&zS(U(this,pt),a,this.options,n)&&Ge(this,Ct,Ku).call(this),this.updateResult(),s&&(U(this,pt)!==a||ta(this.options.enabled,U(this,pt))!==ta(n.enabled,U(this,pt))||is(this.options.staleTime,U(this,pt))!==is(n.staleTime,U(this,pt)))&&Ge(this,Ct,Xg).call(this);const o=Ge(this,Ct,Wg).call(this);s&&(U(this,pt)!==a||ta(this.options.enabled,U(this,pt))!==ta(n.enabled,U(this,pt))||o!==U(this,Ji))&&Ge(this,Ct,Jg).call(this,o)}getOptimisticResult(t){const n=U(this,Sr).getQueryCache().build(U(this,Sr),t),a=this.createResult(n,t);return cR(this,a)&&(ke(this,lr,a),ke(this,oo,this.options),ke(this,qs,U(this,pt).state)),a}getCurrentResult(){return U(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&&U(this,ri).status==="pending"&&U(this,ri).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){U(this,fo).add(t)}getCurrentQuery(){return U(this,pt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=U(this,Sr).defaultQueryOptions(t),a=U(this,Sr).getQueryCache().build(U(this,Sr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ge(this,Ct,Ku).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,lr)))}createResult(t,n){var Q;const a=U(this,pt),s=this.options,o=U(this,lr),c=U(this,qs),f=U(this,oo),h=t!==a?t.state:U(this,wc),{state:p}=t;let g={...p},x=!1,w;if(n._optimisticResults){const D=this.hasListeners(),Y=!D&&OS(t,n),ae=D&&zS(t,a,n,s);(Y||ae)&&(g={...g,...Cj(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:k,status:E}=g;w=g.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&E==="pending"){let D;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(D=o.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((Q=U(this,co))==null?void 0:Q.state.data,U(this,co)):n.placeholderData,D!==void 0&&(E="success",w=Qg(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===U(this,Sc))w=U(this,uo);else try{ke(this,Sc,n.select),w=n.select(w),w=Qg(o==null?void 0:o.data,w,n),ke(this,uo,w),ke(this,Wi,null)}catch(D){ke(this,Wi,D)}U(this,Wi)&&(S=U(this,Wi),w=U(this,uo),k=Date.now(),E="error");const N=g.fetchStatus==="fetching",R=E==="pending",z=E==="error",L=R&&N,O=w!==void 0,I={status:E,fetchStatus:g.fetchStatus,isPending:R,isSuccess:E==="success",isError:z,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:k,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!R,isLoadingError:z&&!O,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:z&&O,isStale:cv(t,n),refetch:this.refetch,promise:U(this,ri),isEnabled:ta(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=I.data!==void 0,Y=I.status==="error"&&!D,ae=X=>{Y?X.reject(I.error):D&&X.resolve(I.data)},be=()=>{const X=ke(this,ri,I.promise=Kg());ae(X)},W=U(this,ri);switch(W.status){case"pending":t.queryHash===a.queryHash&&ae(W);break;case"fulfilled":(Y||I.data!==W.value)&&be();break;case"rejected":(!Y||I.error!==W.reason)&&be();break}}return I}updateResult(){const t=U(this,lr),n=this.createResult(U(this,pt),this.options);if(ke(this,qs,U(this,pt).state),ke(this,oo,this.options),U(this,qs).data!==void 0&&ke(this,co,U(this,pt)),ic(n,t))return;ke(this,lr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!U(this,fo).size)return!0;const c=new Set(o??U(this,fo));return this.options.throwOnError&&c.add("error"),Object.keys(U(this,lr)).some(f=>{const m=f;return U(this,lr)[m]!==t[m]&&c.has(m)})};Ge(this,Ct,Nj).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ge(this,Ct,ey).call(this)}},Sr=new WeakMap,pt=new WeakMap,wc=new WeakMap,lr=new WeakMap,qs=new WeakMap,oo=new WeakMap,ri=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,Ct=new WeakSet,Ku=function(t){Ge(this,Ct,ry).call(this);let n=U(this,pt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Xn)),n},Xg=function(){Ge(this,Ct,ty).call(this);const t=is(this.options.staleTime,U(this,pt));if(sc.isServer()||U(this,lr).isStale||!Gg(t))return;const a=xj(U(this,lr).dataUpdatedAt,t)+1;ke(this,Zs,Is.setTimeout(()=>{U(this,lr).isStale||this.updateResult()},a))},Wg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,pt)):this.options.refetchInterval)??!1},Jg=function(t){Ge(this,Ct,ny).call(this),ke(this,Ji,t),!(sc.isServer()||ta(this.options.enabled,U(this,pt))===!1||!Gg(U(this,Ji))||U(this,Ji)===0)&&ke(this,Gs,Is.setInterval(()=>{(this.options.refetchIntervalInBackground||av.isFocused())&&Ge(this,Ct,Ku).call(this)},U(this,Ji)))},ey=function(){Ge(this,Ct,Xg).call(this),Ge(this,Ct,Jg).call(this,Ge(this,Ct,Wg).call(this))},ty=function(){U(this,Zs)&&(Is.clearTimeout(U(this,Zs)),ke(this,Zs,void 0))},ny=function(){U(this,Gs)&&(Is.clearInterval(U(this,Gs)),ke(this,Gs,void 0))},ry=function(){const t=U(this,Sr).getQueryCache().build(U(this,Sr),this.options);if(t===U(this,pt))return;const n=U(this,pt);ke(this,pt,t),ke(this,wc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Nj=function(t){sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(U(this,lr))}),U(this,Sr).getQueryCache().notify({query:U(this,pt),type:"observerResultsUpdated"})})},fj);function uR(e,t){return ta(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function OS(e,t){return uR(e,t)||e.state.data!==void 0&&ay(e,t,t.refetchOnMount)}function ay(e,t,n){if(ta(t.enabled,e)!==!1&&is(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&cv(e,t)}return!1}function zS(e,t,n,a){return(e!==t||ta(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&cv(e,n)}function cv(e,t){return ta(t.enabled,e)!==!1&&e.isStaleByTime(is(t.staleTime,e))}function cR(e,t){return!ic(e.getCurrentResult(),t)}function MS(e){return{onFetch:(t,n)=>{var p,g,x,w,S;const a=t.options,s=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let k=!1;const E=R=>{rR(R,()=>t.signal,()=>k=!0)},C=wj(t.options,t.fetchOptions),N=async(R,z,L)=>{if(k)return Promise.reject();if(z==null&&R.pages.length)return Promise.resolve(R);const B=(()=>{const Y={client:t.client,queryKey:t.queryKey,pageParam:z,direction:L?"backward":"forward",meta:t.options.meta};return E(Y),Y})(),I=await C(B),{maxPages:Q}=t.options,D=L?nR:tR;return{pages:D(R.pages,I,Q),pageParams:D(R.pageParams,z,Q)}};if(s&&o.length){const R=s==="backward",z=R?dR:DS,L={pages:o,pageParams:c},O=z(a,L);f=await N(L,O,R)}else{const R=e??o.length;do{const z=m===0?c[0]??a.initialPageParam:DS(a,f);if(m>0&&z==null)break;f=await N(f,z),m++}while(m<R)}return f};t.options.persister?t.fetchFn=()=>{var k,E;return(E=(k=t.options).persister)==null?void 0:E.call(k,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function DS(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 dR(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,_a,Kn,Vs,Ta,Zi,hj,fR=(hj=class extends jj{constructor(t){super();_e(this,Ta);_e(this,kc);_e(this,_a);_e(this,Kn);_e(this,Vs);ke(this,kc,t.client),this.mutationId=t.mutationId,ke(this,Kn,t.mutationCache),ke(this,_a,[]),this.state=t.state||_j(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){U(this,_a).includes(t)||(U(this,_a).push(t),this.clearGcTimeout(),U(this,Kn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ke(this,_a,U(this,_a).filter(n=>n!==t)),this.scheduleGc(),U(this,Kn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,_a).length||(this.state.status==="pending"?this.scheduleGc():U(this,Kn).remove(this))}continue(){var t;return((t=U(this,Vs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,x,w,S,k,E,C,N,R,z,L,O,B;const n=()=>{Ge(this,Ta,Zi).call(this,{type:"continue"})},a={client:U(this,kc),meta:this.options.meta,mutationKey:this.options.mutationKey};ke(this,Vs,kj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(I,Q)=>{Ge(this,Ta,Zi).call(this,{type:"failed",failureCount:I,error:Q})},onPause:()=>{Ge(this,Ta,Zi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,Kn).canRun(this)}));const s=this.state.status==="pending",o=!U(this,Vs).canStart();try{if(s)n();else{Ge(this,Ta,Zi).call(this,{type:"pending",variables:t,isPaused:o}),U(this,Kn).config.onMutate&&await U(this,Kn).config.onMutate(t,this,a);const Q=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));Q!==this.state.context&&Ge(this,Ta,Zi).call(this,{type:"pending",context:Q,variables:t,isPaused:o})}const I=await U(this,Vs).start();return await((h=(m=U(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=U(this,Kn).config).onSettled)==null?void 0:w.call(x,I,null,this.state.variables,this.state.context,this,a)),await((k=(S=this.options).onSettled)==null?void 0:k.call(S,I,null,t,this.state.context,a)),Ge(this,Ta,Zi).call(this,{type:"success",data:I}),I}catch(I){try{await((C=(E=U(this,Kn).config).onError)==null?void 0:C.call(E,I,t,this.state.context,this,a))}catch(Q){Promise.reject(Q)}try{await((R=(N=this.options).onError)==null?void 0:R.call(N,I,t,this.state.context,a))}catch(Q){Promise.reject(Q)}try{await((L=(z=U(this,Kn).config).onSettled)==null?void 0:L.call(z,void 0,I,this.state.variables,this.state.context,this,a))}catch(Q){Promise.reject(Q)}try{await((B=(O=this.options).onSettled)==null?void 0:B.call(O,void 0,I,t,this.state.context,a))}catch(Q){Promise.reject(Q)}throw Ge(this,Ta,Zi).call(this,{type:"error",error:I}),I}finally{U(this,Kn).runNext(this)}}},kc=new WeakMap,_a=new WeakMap,Kn=new WeakMap,Vs=new WeakMap,Ta=new WeakSet,Zi=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sn.batch(()=>{U(this,_a).forEach(a=>{a.onMutationUpdate(t)}),U(this,Kn).notify({mutation:this,type:"updated",action:t})})},hj);function _j(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ai,va,jc,mj,hR=(mj=class extends Ws{constructor(t={}){super();_e(this,ai);_e(this,va);_e(this,jc);this.config=t,ke(this,ai,new Set),ke(this,va,new Map),ke(this,jc,0)}build(t,n,a){const s=new fR({client:t,mutationCache:this,mutationId:++rf(this,jc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){U(this,ai).add(t);const n=af(t);if(typeof n=="string"){const a=U(this,va).get(n);a?a.push(t):U(this,va).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(U(this,ai).delete(t)){const n=af(t);if(typeof n=="string"){const a=U(this,va).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&U(this,va).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=af(t);if(typeof n=="string"){const a=U(this,va).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=U(this,va).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sn.batch(()=>{U(this,ai).forEach(t=>{this.notify({type:"removed",mutation:t})}),U(this,ai).clear(),U(this,va).clear()})}getAll(){return Array.from(U(this,ai))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>NS(n,a))}findAll(t={}){return this.getAll().filter(n=>NS(t,n))}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return sn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Xn))))}},ai=new WeakMap,va=new WeakMap,jc=new WeakMap,mj);function af(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ii,es,kr,si,oi,Nf,iy,pj,mR=(pj=class extends Ws{constructor(n,a){super();_e(this,oi);_e(this,ii);_e(this,es);_e(this,kr);_e(this,si);ke(this,ii,n),this.setOptions(a),this.bindMethods(),Ge(this,oi,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=U(this,ii).defaultMutationOptions(n),ic(this.options,a)||U(this,ii).getMutationCache().notify({type:"observerOptionsUpdated",mutation:U(this,kr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Qs(a.mutationKey)!==Qs(this.options.mutationKey)?this.reset():((s=U(this,kr))==null?void 0:s.state.status)==="pending"&&U(this,kr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=U(this,kr))==null||n.removeObserver(this)}onMutationUpdate(n){Ge(this,oi,Nf).call(this),Ge(this,oi,iy).call(this,n)}getCurrentResult(){return U(this,es)}reset(){var n;(n=U(this,kr))==null||n.removeObserver(this),ke(this,kr,void 0),Ge(this,oi,Nf).call(this),Ge(this,oi,iy).call(this)}mutate(n,a){var s;return ke(this,si,a),(s=U(this,kr))==null||s.removeObserver(this),ke(this,kr,U(this,ii).getMutationCache().build(U(this,ii),this.options)),U(this,kr).addObserver(this),U(this,kr).execute(n)}},ii=new WeakMap,es=new WeakMap,kr=new WeakMap,si=new WeakMap,oi=new WeakSet,Nf=function(){var a;const n=((a=U(this,kr))==null?void 0:a.state)??_j();ke(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})},iy=function(n){sn.batch(()=>{var a,s,o,c,f,m,h,p;if(U(this,si)&&this.hasListeners()){const g=U(this,es).variables,x=U(this,es).context,w={client:U(this,ii),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=U(this,si)).onSuccess)==null||s.call(a,n.data,g,x,w)}catch(S){Promise.reject(S)}try{(c=(o=U(this,si)).onSettled)==null||c.call(o,n.data,null,g,x,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=U(this,si)).onError)==null||m.call(f,n.error,g,x,w)}catch(S){Promise.reject(S)}try{(p=(h=U(this,si)).onSettled)==null||p.call(h,void 0,n.error,g,x,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(U(this,es))})})},pj);function IS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function pR(e,t,n){const a=e.slice(0);return a[t]=n,a}var ho,Pr,mo,po,ea,ts,Ec,Cc,Nc,_c,Gn,sy,ly,oy,uy,cy,gj,gR=(gj=class extends Ws{constructor(t,n,a){super();_e(this,Gn);_e(this,ho);_e(this,Pr);_e(this,mo);_e(this,po);_e(this,ea);_e(this,ts);_e(this,Ec);_e(this,Cc);_e(this,Nc);_e(this,_c,[]);ke(this,ho,t),ke(this,po,a),ke(this,mo,[]),ke(this,ea,[]),ke(this,Pr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&U(this,ea).forEach(t=>{t.subscribe(n=>{Ge(this,Gn,uy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,U(this,ea).forEach(t=>{t.destroy()})}setQueries(t,n){ke(this,mo,t),ke(this,po,n),sn.batch(()=>{const a=U(this,ea),s=Ge(this,Gn,oy).call(this,U(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=U(this,Pr)[x];return!w||!ic(g,w)});!h&&!p||(h&&(ke(this,_c,s),ke(this,ea,o)),ke(this,Pr,c),this.hasListeners()&&(h&&(IS(a,o).forEach(g=>{g.destroy()}),IS(o,a).forEach(g=>{g.subscribe(x=>{Ge(this,Gn,uy).call(this,g,x)})})),Ge(this,Gn,cy).call(this)))})}getCurrentResult(){return U(this,Pr)}getQueries(){return U(this,ea).map(t=>t.getCurrentQuery())}getObservers(){return U(this,ea)}getOptimisticResult(t,n){const a=Ge(this,Gn,oy).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,ly).call(this,c??s,n,o),()=>Ge(this,Gn,sy).call(this,s,a)]}},ho=new WeakMap,Pr=new WeakMap,mo=new WeakMap,po=new WeakMap,ea=new WeakMap,ts=new WeakMap,Ec=new WeakMap,Cc=new WeakMap,Nc=new WeakMap,_c=new WeakMap,Gn=new WeakSet,sy=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)})})})},ly=function(t,n,a){if(n){const s=U(this,Nc),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!U(this,ts)||U(this,Pr)!==U(this,Cc)||o||n!==U(this,Ec))&&(ke(this,Ec,n),ke(this,Cc,U(this,Pr)),a!==void 0&&ke(this,Nc,a),ke(this,ts,sv(U(this,ts),n(t)))),U(this,ts)}return t},oy=function(t){const n=new Map;U(this,ea).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=U(this,ho).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new uv(U(this,ho),o);a.push({defaultedQueryOptions:o,observer:f})}),a},uy=function(t,n){const a=U(this,ea).indexOf(t);a!==-1&&(ke(this,Pr,pR(U(this,Pr),a,n)),Ge(this,Gn,cy).call(this))},cy=function(){var t;if(this.hasListeners()){const n=U(this,ts),a=Ge(this,Gn,sy).call(this,U(this,Pr),U(this,_c)),s=Ge(this,Gn,ly).call(this,a,(t=U(this,po))==null?void 0:t.combine);n!==s&&sn.batch(()=>{this.listeners.forEach(o=>{o(U(this,Pr))})})}},gj),Aa,yj,yR=(yj=class extends Ws{constructor(t={}){super();_e(this,Aa);this.config=t,ke(this,Aa,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??iv(s,n);let c=this.get(o);return c||(c=new oR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){U(this,Aa).has(t.queryHash)||(U(this,Aa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=U(this,Aa).get(t.queryHash);n&&(t.destroy(),n===t&&U(this,Aa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,Aa).get(t)}getAll(){return[...U(this,Aa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>CS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>CS(t,a)):n}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Aa=new WeakMap,yj),an,ns,rs,go,yo,as,vo,bo,vj,vR=(vj=class{constructor(e={}){_e(this,an);_e(this,ns);_e(this,rs);_e(this,go);_e(this,yo);_e(this,as);_e(this,vo);_e(this,bo);ke(this,an,e.queryCache||new yR),ke(this,ns,e.mutationCache||new hR),ke(this,rs,e.defaultOptions||{}),ke(this,go,new Map),ke(this,yo,new Map),ke(this,as,0)}mount(){rf(this,as)._++,U(this,as)===1&&(ke(this,vo,av.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,an).onFocus())})),ke(this,bo,If.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,an).onOnline())})))}unmount(){var e,t;rf(this,as)._--,U(this,as)===0&&((e=U(this,vo))==null||e.call(this),ke(this,vo,void 0),(t=U(this,bo))==null||t.call(this),ke(this,bo,void 0))}isFetching(e){return U(this,an).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,ns).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=U(this,an).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=U(this,an).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 U(this,an).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=U(this,an).get(a.queryHash),o=s==null?void 0:s.state.data,c=W2(t,o);if(c!==void 0)return U(this,an).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return sn.batch(()=>U(this,an).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=U(this,an).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=U(this,an);sn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=U(this,an);return sn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=sn.batch(()=>U(this,an).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(Xn).catch(Xn)}invalidateQueries(e,t={}){return sn.batch(()=>(U(this,an).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=sn.batch(()=>U(this,an).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(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=U(this,an).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=MS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xn).catch(Xn)}ensureInfiniteQueryData(e){return e.behavior=MS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return If.isOnline()?U(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,an)}getMutationCache(){return U(this,ns)}getDefaultOptions(){return U(this,rs)}setDefaultOptions(e){ke(this,rs,e)}setQueryDefaults(e,t){U(this,go).set(Qs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,go).values()],n={};return t.forEach(a=>{ac(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){U(this,yo).set(Qs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(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={...U(this,rs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=iv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===lv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,rs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,an).clear(),U(this,ns).clear()}},an=new WeakMap,ns=new WeakMap,rs=new WeakMap,go=new WeakMap,yo=new WeakMap,as=new WeakMap,vo=new WeakMap,bo=new WeakMap,vj),Tj=b.createContext(void 0),En=e=>{const t=b.useContext(Tj);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},bR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Tj.Provider,{value:e,children:t})),Aj=b.createContext(!1),Rj=()=>b.useContext(Aj);Aj.Provider;function xR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wR=b.createContext(xR()),Oj=()=>b.useContext(wR),zj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ov(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Mj=e=>{b.useEffect(()=>{e.clearReset()},[e])},Dj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||ov(n,[e.error,a])),Ij=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))}},SR=(e,t)=>e.isLoading&&e.isFetching&&!t,dy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function kR({queries:e,...t},n){const a=En(),s=Rj(),o=Oj(),c=b.useMemo(()=>e.map(k=>{const E=a.defaultQueryOptions(k);return E._optimisticResults=s?"isRestoring":"optimistic",E}),[e,a,s]);c.forEach(k=>{Ij(k);const E=a.getQueryCache().get(k.queryHash);zj(k,o,E)}),Mj(o);const[f]=b.useState(()=>new gR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(k=>g?f.subscribe(sn.batchCalls(k)):Xn,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((k,E)=>dy(c[E],k))?m.flatMap((k,E)=>{const C=c[E];if(C&&dy(C,k)){const N=new uv(a,C);return fy(C,N,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const S=m.find((k,E)=>{const C=c[E];return C&&Dj({result:k,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(S!=null&&S.error)throw S.error;return h(p())}function jR(e,t,n){var x,w,S,k;const a=Rj(),s=Oj(),o=En(),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",Ij(c),zj(c,s,f),Mj(s);const m=!o.getQueryCache().get(c.queryHash),[h]=b.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(E=>{const C=g?h.subscribe(sn.batchCalls(E)):Xn;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),dy(c,p))throw fy(c,h,s);if(Dj({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((k=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||k.call(S,c,p),c.experimental_prefetchInRender&&!sc.isServer()&&SR(p,a)){const E=m?fy(c,h,s):f==null?void 0:f.promise;E==null||E.catch(Xn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ke(e,t){return jR(e,uv)}function bt(e,t){const n=En(),[a]=b.useState(()=>new mR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(sn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(Xn)},[a]);if(s.error&&ov(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}/**
50
- * react-router v7.13.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var LS="popstate";function PS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ER(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 hy("",{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 NR(t,n,null,e)}function Vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ia(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function CR(){return Math.random().toString(36).substring(2,10)}function US(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 hy(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||CR(),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 NR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){f="POP";let E=p(),C=E==null?null:E-h;h=E,m&&m({action:f,location:k.location,delta:C})}function x(E,C){f="PUSH";let N=PS(E)?E:hy(k.location,E,C);h=p()+1;let R=US(N,h),z=k.createHref(N.unstable_mask||N);try{c.pushState(R,"",z)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;s.location.assign(z)}o&&m&&m({action:f,location:k.location,delta:1})}function w(E,C){f="REPLACE";let N=PS(E)?E:hy(k.location,E,C);h=p();let R=US(N,h),z=k.createHref(N.unstable_mask||N);c.replaceState(R,"",z),o&&m&&m({action:f,location:k.location,delta:0})}function S(E){return _R(E)}let k={get action(){return f},get location(){return e(s,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(LS,g),m=E,()=>{s.removeEventListener(LS,g),m=null}},createHref(E){return t(s,E)},createURL:S,encodeLocation(E){let C=S(E);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:w,go(E){return c.go(E)}};return k}function _R(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Vt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:lc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Lj(e,t,n="/"){return TR(e,t,n,!1)}function TR(e,t,n,a){let s=typeof t=="string"?Co(t):t,o=ui(s.pathname||"/",n);if(o==null)return null;let c=Pj(e);AR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=FR(o);f=UR(c[m],h,a)}return f}function Pj(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Vt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=Oa([a,p.relativePath]),x=n.concat(p);c.children&&c.children.length>0&&(Vt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Pj(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:LR(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 Uj(c.path))o(c,f,!0,h)}),t}function Uj(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=Uj(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 AR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:PR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var RR=/^:[\w-]+$/,OR=3,zR=2,MR=1,DR=10,IR=-2,BS=e=>e==="*";function LR(e,t){let n=e.split("/"),a=n.length;return n.some(BS)&&(a+=IR),t&&(a+=zR),n.filter(s=>!BS(s)).reduce((s,o)=>s+(RR.test(o)?OR:o===""?MR:DR),a)}function PR(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 UR(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:Oa([o,g.pathname]),pathnameBase:ZR(Oa([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Oa([o,g.pathnameBase]))}return c}function Lf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=BR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:p,isOptional:g},x)=>{if(p==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function BR(e,t=!1,n=!0){ia(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 FR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ia(!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 ui(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 $R=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function HR(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=FS(n.substring(1),"/"):o=FS(n,t)):o=t,{pathname:o,search:GR(a),hash:VR(s)}}function FS(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 Xp(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 qR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function dv(e){let t=qR(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function rh(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Vt(!s.pathname||!s.pathname.includes("?"),Xp("?","pathname","search",s)),Vt(!s.pathname||!s.pathname.includes("#"),Xp("#","pathname","hash",s)),Vt(!s.search||!s.search.includes("#"),Xp("#","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=HR(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Oa=e=>e.join("/").replace(/\/\/+/g,"/"),ZR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),GR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,VR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,QR=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 KR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function YR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Bj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fj(e,t){let n=e;if(typeof n!="string"||!$R.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Bj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=ui(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{ia(!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 $j=["POST","PUT","PATCH","DELETE"];new Set($j);var XR=["GET",...$j];new Set(XR);var No=b.createContext(null);No.displayName="DataRouter";var ah=b.createContext(null);ah.displayName="DataRouterState";var WR=b.createContext(!1),Hj=b.createContext({isTransitioning:!1});Hj.displayName="ViewTransition";var JR=b.createContext(new Map);JR.displayName="Fetchers";var eO=b.createContext(null);eO.displayName="Await";var Fr=b.createContext(null);Fr.displayName="Navigation";var Tc=b.createContext(null);Tc.displayName="Location";var la=b.createContext({outlet:null,matches:[],isDataRoute:!1});la.displayName="Route";var fv=b.createContext(null);fv.displayName="RouteError";var qj="REACT_ROUTER_ERROR",tO="REDIRECT",nO="ROUTE_ERROR_RESPONSE";function rO(e){if(e.startsWith(`${qj}:${tO}:{`))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 aO(e){if(e.startsWith(`${qj}:${nO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new QR(t.status,t.statusText,t.data)}catch{}}function iO(e,{relative:t}={}){Vt(_o(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Fr),{hash:s,pathname:o,search:c}=Ac(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Oa([n,o])),a.createHref({pathname:f,search:c,hash:s})}function _o(){return b.useContext(Tc)!=null}function Er(){return Vt(_o(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Tc).location}var Zj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Gj(e){b.useContext(Fr).static||b.useLayoutEffect(e)}function Tn(){let{isDataRoute:e}=b.useContext(la);return e?xO():sO()}function sO(){Vt(_o(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(No),{basename:t,navigator:n}=b.useContext(Fr),{matches:a}=b.useContext(la),{pathname:s}=Er(),o=JSON.stringify(dv(a)),c=b.useRef(!1);return Gj(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(ia(c.current,Zj),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=rh(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Oa([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var lO=b.createContext(null);function oO(e){let t=b.useContext(la).outlet;return b.useMemo(()=>t&&b.createElement(lO.Provider,{value:e},t),[t,e])}function Vj(){let{matches:e}=b.useContext(la),t=e[e.length-1];return t?t.params:{}}function Ac(e,{relative:t}={}){let{matches:n}=b.useContext(la),{pathname:a}=Er(),s=JSON.stringify(dv(n));return b.useMemo(()=>rh(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function uO(e,t){return Qj(e,t)}function Qj(e,t,n){var E;Vt(_o(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Fr),{matches:s}=b.useContext(la),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||"";Yj(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=Er(),g;if(t){let C=typeof t=="string"?Co(t):t;Vt(m==="/"||((E=C.pathname)==null?void 0:E.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",w=x;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=Lj(e,{pathname:w});ia(h||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ia(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let k=mO(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Oa([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Oa([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&k?b.createElement(Tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function cO(){let e=bO(),t=KR(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 dO=b.createElement(cO,null),Kj=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=aO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(la.Provider,{value:this.props.routeContext},b.createElement(fv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(fO,{error:e},t):t}};Kj.contextType=WR;var Wp=new WeakMap;function fO({children:e,error:t}){let{basename:n}=b.useContext(Fr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=rO(t.digest);if(a){let s=Wp.get(t);if(s)throw s;let o=Fj(a.location,n);if(Bj&&!Wp.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 Wp.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function hO({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(la.Provider,{value:e},n)}function mO(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Vt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:x,errors:w}=a,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(p,g)=>{var x,w;m(p,{location:a.location,params:((w=(x=a.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:YR(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,x)=>{let w,S=!1,k=null,E=null;a&&(w=o&&g.route.id?o[g.route.id]:void 0,k=g.route.errorElement||dO,c&&(f<0&&x===0?(Yj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,E=null):f===x&&(S=!0,E=g.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,x+1)),N=()=>{let R;return w?R=k:S?R=E:g.route.Component?R=b.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=p,b.createElement(hO,{match:g,routeContext:{outlet:p,matches:C,isDataRoute:a!=null},children:R})};return a&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?b.createElement(Kj,{location:a.location,revalidation:a.revalidation,component:k,error:w,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):N()},null)}function hv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pO(e){let t=b.useContext(No);return Vt(t,hv(e)),t}function gO(e){let t=b.useContext(ah);return Vt(t,hv(e)),t}function yO(e){let t=b.useContext(la);return Vt(t,hv(e)),t}function mv(e){let t=yO(e),n=t.matches[t.matches.length-1];return Vt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vO(){return mv("useRouteId")}function bO(){var a;let e=b.useContext(fv),t=gO("useRouteError"),n=mv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function xO(){let{router:e}=pO("useNavigate"),t=mv("useNavigate"),n=b.useRef(!1);return Gj(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{ia(n.current,Zj),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var $S={};function Yj(e,t,n){!t&&!$S[e]&&($S[e]=!0,ia(!1,n))}b.memo(wO);function wO({routes:e,future:t,state:n,isStatic:a,onError:s}){return Qj(e,void 0,{state:n,isStatic:a,onError:s})}function or({to:e,replace:t,state:n,relative:a}){Vt(_o(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Fr);ia(!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(la),{pathname:c}=Er(),f=Tn(),m=rh(e,dv(o),c,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Pf(e){return oO(e.context)}function Dt(e){Vt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function SO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Vt(!_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:S}=n,k=b.useMemo(()=>{let E=ui(h,f);return E==null?null:{location:{pathname:E,search:p,hash:g,state:x,key:w,unstable_mask:S},navigationType:a}},[f,h,p,g,x,w,a,S]);return ia(k!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:b.createElement(Fr.Provider,{value:m},b.createElement(Tc.Provider,{children:t,value:k}))}function kO({children:e,location:t}){return uO(my(e),t)}function my(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,my(a.props.children,o));return}Vt(a.type===Dt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Vt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=my(a.props.children,o)),n.push(c)}),n}var _f="get",Tf="application/x-www-form-urlencoded";function ih(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jO(e){return ih(e)&&e.tagName.toLowerCase()==="button"}function EO(e){return ih(e)&&e.tagName.toLowerCase()==="form"}function CO(e){return ih(e)&&e.tagName.toLowerCase()==="input"}function NO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _O(e,t){return e.button===0&&(!t||t==="_self")&&!NO(e)}function py(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 TO(e,t){let n=py(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var sf=null;function AO(){if(sf===null)try{new FormData(document.createElement("form"),0),sf=!1}catch{sf=!0}return sf}var RO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Jp(e){return e!=null&&!RO.has(e)?(ia(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tf}"`),null):e}function OO(e,t){let n,a,s,o,c;if(EO(e)){let f=e.getAttribute("action");a=f?ui(f,t):null,n=e.getAttribute("method")||_f,s=Jp(e.getAttribute("enctype"))||Tf,o=new FormData(e)}else if(jO(e)||CO(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?ui(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||_f,s=Jp(e.getAttribute("formenctype"))||Jp(f.getAttribute("enctype"))||Tf,o=new FormData(f,e),!AO()){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(ih(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_f,a=null,s=Tf,c=e}return o&&s==="text/plain"&&(c=o,o=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function pv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function zO(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&&ui(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function MO(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 DO(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 IO(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await MO(o,n);return c.links?c.links():[]}return[]}));return BO(a.flat(1).filter(DO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function HS(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 LO(e,t,{includeHydrateFallback:n}={}){return PO(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 PO(e){return[...new Set(e)]}function UO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function BO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(UO(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function Xj(){let e=b.useContext(No);return pv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function FO(){let e=b.useContext(ah);return pv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var gv=b.createContext(void 0);gv.displayName="FrameworkContext";function Wj(){let e=b.useContext(gv);return pv(e,"You must render this element inside a <HydratedRouter> element"),e}function $O(e,t){let n=b.useContext(gv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,x=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let k=C=>{C.forEach(N=>{c(N.isIntersecting)})},E=new IntersectionObserver(k,{threshold:.5});return x.current&&E.observe(x.current),()=>{E.disconnect()}}},[e]),b.useEffect(()=>{if(a){let k=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(k)}}},[a]);let w=()=>{s(!0)},S=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,x,{}]:[o,x,{onFocus:Ru(f,w),onBlur:Ru(m,S),onMouseEnter:Ru(h,w),onMouseLeave:Ru(p,S),onTouchStart:Ru(g,w)}]:[!1,x,{}]}function Ru(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function HO({page:e,...t}){let{router:n}=Xj(),a=b.useMemo(()=>Lj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(ZO,{page:e,matches:a,...t}):null}function qO(e){let{manifest:t,routeModules:n}=Wj(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return IO(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function ZO({page:e,matches:t,...n}){let a=Er(),{future:s,manifest:o,routeModules:c}=Wj(),{basename:f}=Xj(),{loaderData:m,matches:h}=FO(),p=b.useMemo(()=>HS(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>HS(e,t,h,o,a,"assets"),[e,t,h,o,a]),x=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let k=new Set,E=!1;if(t.forEach(N=>{var z;let R=o.routes[N.route.id];!R||!R.hasLoader||(!p.some(L=>L.route.id===N.route.id)&&N.route.id in m&&((z=c[N.route.id])!=null&&z.shouldRevalidate)||R.hasClientLoader?E=!0:k.add(N.route.id))}),k.size===0)return[];let C=zO(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return E&&k.size>0&&C.searchParams.set("_routes",t.filter(N=>k.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),w=b.useMemo(()=>LO(g,o),[g,o]),S=qO(g);return b.createElement(b.Fragment,null,x.map(k=>b.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...n})),w.map(k=>b.createElement("link",{key:k,rel:"modulepreload",href:k,...n})),S.map(({key:k,link:E})=>b.createElement("link",{key:k,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function GO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var VO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{VO&&(window.__reactRouterVersion="7.13.1")}catch{}function QO({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=ER({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(SO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var Jj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...S},k){let{basename:E,navigator:C,unstable_useTransitions:N}=b.useContext(Fr),R=typeof p=="string"&&Jj.test(p),z=Fj(p,E);p=z.to;let L=iO(p,{relative:s}),O=Er(),B=null;if(f){let X=rh(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);E!=="/"&&(X.pathname=X.pathname==="/"?E:Oa([E,X.pathname])),B=C.createHref(X)}let[I,Q,D]=$O(a,S),Y=XO(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:N});function ae(X){t&&t(X),X.defaultPrevented||Y(X)}let be=!(z.isExternal||o),W=b.createElement("a",{...S,...D,href:(be?B:void 0)||z.absoluteURL||L,onClick:be?ae:t,ref:GO(k,Q),target:h,"data-discover":!R&&n==="render"?"true":void 0});return I&&!R?b.createElement(b.Fragment,null,W,b.createElement(HO,{page:L})):W});Rc.displayName="Link";var yv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},p){let g=Ac(c,{relative:h.relative}),x=Er(),w=b.useContext(ah),{navigator:S,basename:k}=b.useContext(Fr),E=w!=null&&nz(g)&&f===!0,C=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,N=x.pathname,R=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(N=N.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&k&&(R=ui(R,k)||R);const z=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=N===C||!s&&N.startsWith(C)&&N.charAt(z)==="/",O=R!=null&&(R===C||!s&&R.startsWith(C)&&R.charAt(C.length)==="/"),B={isActive:L,isPending:O,isTransitioning:E},I=L?t:void 0,Q;typeof a=="function"?Q=a(B):Q=[a,L?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(B):o;return b.createElement(Rc,{...h,"aria-current":I,className:Q,ref:p,style:D,to:c,viewTransition:f},typeof m=="function"?m(B):m)});yv.displayName="NavLink";var KO=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},S)=>{let{unstable_useTransitions:k}=b.useContext(Fr),E=ez(),C=tz(f,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&Jj.test(f),z=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let O=L.nativeEvent.submitter,B=(O==null?void 0:O.getAttribute("formmethod"))||c,I=()=>E(O||L.currentTarget,{fetcherKey:t,method:B,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&n!==!1?b.startTransition(()=>I()):I()};return b.createElement("form",{ref:S,method:N,action:C,onSubmit:a?m:z,...w,"data-discover":!R&&e==="render"?"true":void 0})});KO.displayName="Form";function YO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function eE(e){let t=b.useContext(No);return Vt(t,YO(e)),t}function XO(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=Tn(),g=Er(),x=Ac(e,{relative:c});return b.useCallback(w=>{if(_O(w,t)){w.preventDefault();let S=n!==void 0?n:lc(g)===lc(x),k=()=>p(e,{replace:S,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>k()):k()}},[g,p,x,n,a,s,t,e,o,c,f,m,h])}function sh(e){ia(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(py(e)),n=b.useRef(!1),a=Er(),s=b.useMemo(()=>TO(a.search,n.current?null:t.current),[a.search]),o=Tn(),c=b.useCallback((f,m)=>{const h=py(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var WO=0,JO=()=>`__${String(++WO)}__`;function ez(){let{router:e}=eE("useSubmit"),{basename:t}=b.useContext(Fr),n=vO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=OO(o,t);if(c.navigate===!1){let x=c.fetcherKey||JO();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 tz(e,{relative:t}={}){let{basename:n}=b.useContext(Fr),a=b.useContext(la);Vt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Ac(e||".",{relative:t})},c=Er();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:Oa([n,o.pathname])),lc(o)}function nz(e,{relative:t}={}){let n=b.useContext(Hj);Vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=eE("useViewTransitionState"),s=Ac(e,{relative:t});if(!n.isTransitioning)return!1;let o=ui(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=ui(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Lf(s.pathname,c)!=null||Lf(s.pathname,o)!=null}const rz="/api/v1";async function az(e,t){const n=await fetch(`${rz}/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 tE="/api/v1",vv="first-tree-hub:tokens";let gy=null;function Ou(e){gy=e}function An(e){if(!gy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(gy)}${e}`}function yy(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function lh(){const e=localStorage.getItem(vv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function vy(e){localStorage.setItem(vv,JSON.stringify(e))}function nE(){localStorage.removeItem(vv)}class Js extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let zu=null;async function iz(){const e=lh();return e!=null&&e.refreshToken?rE(e.refreshToken):null}async function rE(e){return zu||(zu=(async()=>{try{const t=await fetch(`${tE}/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 vy(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(`${tE}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=lh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await rE(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(nE(),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 Ce={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"})},bv="onboarding:joinPath",sz="onboarding:draft",by="onboarding:step1Confirmed";function aE(){return typeof window>"u"?!1:window.sessionStorage.getItem(by)==="1"}function lz(e){typeof window>"u"||(e?window.sessionStorage.setItem(by,"1"):window.sessionStorage.removeItem(by))}const xy="onboarding:agentUuid";function oz(){return typeof window>"u"?null:window.sessionStorage.getItem(xy)}function uz(e){typeof window>"u"||(e?window.sessionStorage.setItem(xy,e):window.sessionStorage.removeItem(xy))}function iE(e){typeof window>"u"||window.sessionStorage.setItem(bv,e)}function sE(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(bv);return e==="solo"||e==="invite"?e:null}function cz(){typeof window>"u"||window.sessionStorage.removeItem(bv)}function dz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function xv(e){return`${sz}:${e}`}function fz(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 hz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(xv(e));if(!t)return null;try{return fz(JSON.parse(t))}catch{return null}}function mz(e,t){typeof window>"u"||window.sessionStorage.setItem(xv(e),JSON.stringify(t))}function pz(e){typeof window>"u"||window.sessionStorage.removeItem(xv(e))}function gz(){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 lE=b.createContext(null),wy="first-tree-hub:selectedOrganizationId";function yz(){try{return localStorage.getItem(wy)}catch{return null}}function eg(e){try{e===null?localStorage.removeItem(wy):localStorage.setItem(wy,e)}catch{}}function vz({children:e}){const t=En(),[n,a]=b.useState(()=>!!lh()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const Q=yz();return Ou(Q),Q}),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),E=b.useCallback(()=>{nE(),eg(null),Ou(null),t.clear(),gz(),a(!1),o(null),f([]),h(null),g(null),w(null),k(!1)},[t]),C=b.useCallback(async()=>{var Q,D;try{const Y=await Ce.get("/me");o(Y.user??null);const ae=Y.memberships??[];f(ae);const be=((Q=Y.onboarding)==null?void 0:Q.step)??null;g(be),w(((D=Y.onboarding)==null?void 0:D.dismissedAt)??null),be==="completed"&&cz(),h(W=>{var te;const X=W&&ae.some(je=>je.organizationId===W)?W:null;if(X)return Ou(X),X;const Z=Y.defaultOrganizationId??((te=ae[0])==null?void 0:te.organizationId)??null;return eg(Z),Ou(Z),Z})}catch{}finally{k(!0)}},[]),N=b.useCallback(async(Q,D)=>{const Y=await az(Q,D);vy({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await C()},[C]),R=b.useCallback(async Q=>{vy(Q),a(!0),await C()},[C]),z=b.useCallback(async Q=>{eg(Q),Ou(Q),t.clear(),h(Q),await C()},[C,t]),L=b.useRef(null);b.useEffect(()=>{L.current=x},[x]);const O=b.useCallback(async()=>{const Q=L.current;w(new Date().toISOString());try{const D=await Ce.patch("/me/onboarding",{dismissed:!0});D!=null&&D.dismissedAt&&w(D.dismissedAt)}catch{w(Q)}},[]),B=b.useCallback(async()=>{const Q=L.current;w(null);try{await Ce.patch("/me/onboarding",{dismissed:!1})}catch{w(Q)}},[]);b.useEffect(()=>{n&&!s&&C()},[n,s,C]),b.useEffect(()=>{const Q=()=>E();return window.addEventListener("auth:logout",Q),()=>window.removeEventListener("auth:logout",Q)},[E]);const I=b.useMemo(()=>c.length===0?null:c.find(D=>D.organizationId===m)??c[0]??null,[c,m]);return l.jsx(lE.Provider,{value:{isAuthenticated:n,meLoaded:S,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:B,login:N,adoptTokens:R,selectOrganization:z,refreshMe:C,logout:E},children:e})}function yt(){const e=b.useContext(lE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const bz="modulepreload",xz=function(e){return"/"+e},qS={},wz=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=xz(h),h in qS)return;qS[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":bz,p||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),p)return new Promise((w,S)=>{x.addEventListener("load",w),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return s.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},Sz=b.lazy(()=>wz(()=>import("./index-BHNq2Nl1.js"),[]).then(e=>({default:e.LandingPage}))),ZS=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function kz(){const{isAuthenticated:e,meLoaded:t}=yt(),n=Er();return e?t?l.jsx(Pf,{}):l.jsx(ZS,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(ZS,{}),children:l.jsx(Sz,{})}):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 oE=(...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 jz=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 Ez=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 GS=e=>{const t=Ez(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 Cz={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 Nz=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 _z=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,...Cz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:oE("lucide",s),...!o&&!Nz(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(_z,{ref:o,iconNode:t,className:oE(`lucide-${jz(GS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=GS(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 Tz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wv=et("arrow-left",Tz);/**
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 Az=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],uE=et("arrow-right",Az);/**
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 Rz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],cE=et("arrow-up",Rz);/**
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 Oz=[["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"}]],zz=et("at-sign",Oz);/**
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 Mz=[["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"}]],Dz=et("bell",Mz);/**
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 Iz=[["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"}]],dE=et("bot",Iz);/**
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 Lz=[["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"}]],Pz=et("building-2",Lz);/**
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 Uz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=et("check",Uz);/**
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 Bz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sv=et("chevron-down",Bz);/**
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 Fz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fE=et("chevron-right",Fz);/**
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 $z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Hz=et("circle-check",$z);/**
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 qz=[["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"}]],Zz=et("circle-pause",qz);/**
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 Gz=[["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"}]],kv=et("copy",Gz);/**
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 Vz=[["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"}]],Qz=et("ellipsis",Vz);/**
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 Kz=[["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"}]],jv=et("external-link",Kz);/**
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 Yz=[["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"}]],Xz=et("eye-off",Yz);/**
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 Wz=[["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"}]],hE=et("eye",Wz);/**
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 Jz=[["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"}]],eM=et("folder-tree",Jz);/**
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 tM=[["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"}]],mE=et("github",tM);/**
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 nM=[["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"}]],rM=et("layout-dashboard",nM);/**
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 aM=[["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"}]],Sy=et("link-2",aM);/**
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 iM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],pE=et("loader-circle",iM);/**
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 sM=[["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"}]],Ev=et("lock",sM);/**
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 lM=[["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"}]],oM=et("log-out",lM);/**
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 uM=[["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"}]],Cv=et("message-square",uM);/**
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 cM=[["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"}]],dM=et("moon",cM);/**
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 fM=[["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"}]],hM=et("paperclip",fM);/**
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 mM=[["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"}]],Nv=et("pencil",mM);/**
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 pM=[["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"}]],gE=et("play",pM);/**
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 gM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xa=et("plus",gM);/**
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 yM=[["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"}]],vM=et("refresh-cw",yM);/**
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 bM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],oh=et("search",bM);/**
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 xM=[["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"}]],wM=et("sun",xM);/**
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 SM=[["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",SM);/**
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 kM=[["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",kM);/**
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 jM=[["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"}]],EM=et("undo-2",jM);/**
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 CM=[["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"}]],yE=et("user-plus",CM);/**
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 NM=[["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"}]],vE=et("user",NM);/**
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 _M=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],os=et("x",_M);/**
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 TM=[["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"}]],AM=et("zap",TM);function bE(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=bE(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function xE(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=bE(e))&&(a&&(a+=" "),a+=t);return a}const RM=(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},OM=(e,t)=>({classGroupId:e,validator:t}),wE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bf="-",VS=[],zM="arbitrary..",MM=e=>{const t=IM(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return DM(c);const f=c.split(Bf),m=f[0]===""&&f.length>1?1:0;return SE(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?RM(h,m):m:h||VS}return n[c]||VS}}},SE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=SE(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}},DM=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?zM+a:void 0})(),IM=e=>{const{theme:t,classGroups:n}=e;return LM(n,t)},LM=(e,t)=>{const n=wE();for(const a in e){const s=e[a];_v(s,n,a,t)}return n},_v=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];PM(c,t,n,a)}},PM=(e,t,n,a)=>{if(typeof e=="string"){UM(e,t,n);return}if(typeof e=="function"){BM(e,t,n,a);return}FM(e,t,n,a)},UM=(e,t,n)=>{const a=e===""?t:kE(t,e);a.classGroupId=n},BM=(e,t,n,a)=>{if($M(e)){_v(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(OM(n,e))},FM=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];_v(m,kE(t,f),n,a)}},kE=(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=wE(),n.nextPart.set(c,f)),n=f}return n},$M=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,HM=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)}}},ky="!",QS=":",qM=[],KS=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),ZM=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const p=s.length;for(let k=0;k<p;k++){const E=s[k];if(c===0&&f===0){if(E===QS){o.push(s.slice(m,k)),m=k+1;continue}if(E==="/"){h=k;continue}}E==="["?c++:E==="]"?c--:E==="("?f++:E===")"&&f--}const g=o.length===0?s:s.slice(m);let x=g,w=!1;g.endsWith(ky)?(x=g.slice(0,-1),w=!0):g.startsWith(ky)&&(x=g.slice(1),w=!0);const S=h&&h>m?h-m:void 0;return KS(o,w,x,S)};if(t){const s=t+QS,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):KS(qM,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},GM=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}},VM=e=>({cache:HM(e.cacheSize),parseClassName:ZM(e),sortModifiers:GM(e),...MM(e)}),QM=/\s+/,KM=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(QM);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:x,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:k}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let E=!!k,C=a(E?S.substring(0,k):S);if(!C){if(!E){m=p+(m.length>0?" "+m:m);continue}if(C=a(S),!C){m=p+(m.length>0?" "+m:m);continue}E=!1}const N=x.length===0?"":x.length===1?x[0]:o(x).join(":"),R=w?N+ky:N,z=R+C;if(c.indexOf(z)>-1)continue;c.push(z);const L=s(C,E);for(let O=0;O<L.length;++O){const B=L[O];c.push(R+B)}m=p+(m.length>0?" "+m:m)}return m},YM=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=jE(n))&&(s&&(s+=" "),s+=a);return s},jE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=jE(e[a]))&&(n&&(n+=" "),n+=t);return n},XM=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=VM(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=KM(m,n);return s(m,p),p};return o=c,(...m)=>o(YM(...m))},WM=[],_n=e=>{const t=n=>n[e]||WM;return t.isThemeGetter=!0,t},EE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,CE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,JM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,eD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tD=/\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$/,nD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$i=e=>JM.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),Hi=e=>!!e&&Number.isInteger(Number(e)),tg=e=>e.endsWith("%")&&nt(e.slice(0,-1)),ti=e=>eD.test(e),NE=()=>!0,iD=e=>tD.test(e)&&!nD.test(e),Tv=()=>!1,sD=e=>rD.test(e),lD=e=>aD.test(e),oD=e=>!Re(e)&&!Oe(e),uD=e=>hs(e,AE,Tv),Re=e=>EE.test(e),Ms=e=>hs(e,RE,iD),YS=e=>hs(e,yD,nt),cD=e=>hs(e,zE,NE),dD=e=>hs(e,OE,Tv),XS=e=>hs(e,_E,Tv),fD=e=>hs(e,TE,lD),lf=e=>hs(e,ME,sD),Oe=e=>CE.test(e),Du=e=>el(e,RE),hD=e=>el(e,OE),WS=e=>el(e,_E),mD=e=>el(e,AE),pD=e=>el(e,TE),of=e=>el(e,ME,!0),gD=e=>el(e,zE,!0),hs=(e,t,n)=>{const a=EE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},el=(e,t,n=!1)=>{const a=CE.exec(e);return a?a[1]?t(a[1]):n:!1},_E=e=>e==="position"||e==="percentage",TE=e=>e==="image"||e==="url",AE=e=>e==="length"||e==="size"||e==="bg-size",RE=e=>e==="length",yD=e=>e==="number",OE=e=>e==="family-name",zE=e=>e==="number"||e==="weight",ME=e=>e==="shadow",vD=()=>{const e=_n("color"),t=_n("font"),n=_n("text"),a=_n("font-weight"),s=_n("tracking"),o=_n("leading"),c=_n("breakpoint"),f=_n("container"),m=_n("spacing"),h=_n("radius"),p=_n("shadow"),g=_n("inset-shadow"),x=_n("text-shadow"),w=_n("drop-shadow"),S=_n("blur"),k=_n("perspective"),E=_n("aspect"),C=_n("ease"),N=_n("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"],L=()=>[...z(),Oe,Re],O=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],I=()=>[Oe,Re,m],Q=()=>[$i,"full","auto",...I()],D=()=>[Hi,"none","subgrid",Oe,Re],Y=()=>["auto",{span:["full",Hi,Oe,Re]},Hi,Oe,Re],ae=()=>[Hi,"auto",Oe,Re],be=()=>["auto","min","max","fr",Oe,Re],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...I()],te=()=>[$i,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],je=()=>[$i,"screen","full","dvw","lvw","svw","min","max","fit",...I()],Ae=()=>[$i,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],M=()=>[e,Oe,Re],P=()=>[...z(),WS,XS,{position:[Oe,Re]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",mD,uD,{size:[Oe,Re]}],G=()=>[tg,Du,Ms],q=()=>["","none","full",h,Oe,Re],re=()=>["",nt,Du,Ms],xe=()=>["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=()=>[nt,tg,WS,XS],De=()=>["","none",S,Oe,Re],Ue=()=>["none",nt,Oe,Re],ft=()=>["none",nt,Oe,Re],ut=()=>[nt,Oe,Re],ie=()=>[$i,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ti],breakpoint:[ti],color:[NE],container:[ti],"drop-shadow":[ti],ease:["in","out","in-out"],font:[oD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ti],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ti],shadow:[ti],spacing:["px",nt],text:[ti],"text-shadow":[ti],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$i,Re,Oe,E]}],container:["container"],columns:[{columns:[nt,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:L()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[Hi,"auto",Oe,Re]}],basis:[{basis:[$i,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,$i,"auto","initial","none",Re]}],grow:[{grow:["",nt,Oe,Re]}],shrink:[{shrink:["",nt,Oe,Re]}],order:[{order:[Hi,"first","last","none",Oe,Re]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":be()}],"auto-rows":[{"auto-rows":be()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],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:te()}],"inline-size":[{inline:["auto",...je()]}],"min-inline-size":[{"min-inline":["auto",...je()]}],"max-inline-size":[{"max-inline":["none",...je()]}],"block-size":[{block:["auto",...Ae()]}],"min-block-size":[{"min-block":["auto",...Ae()]}],"max-block-size":[{"max-block":["none",...Ae()]}],w:[{w:[f,"screen",...te()]}],"min-w":[{"min-w":[f,"screen","none",...te()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",n,Du,Ms]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,gD,cD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tg,Re]}],"font-family":[{font:[hD,dD,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":[nt,"none",Oe,YS]}],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:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",Oe,Ms]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[nt,"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:P()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hi,Oe,Re],radial:["",Oe,Re],conic:[Hi,Oe,Re]},pD,fD]}],"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:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"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:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,Oe,Re]}],"outline-w":[{outline:["",nt,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:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[nt,Ms]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",x,of,lf]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[nt,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":[nt]}],"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":[nt]}],"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:P()}],"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:De()}],brightness:[{brightness:[nt,Oe,Re]}],contrast:[{contrast:[nt,Oe,Re]}],"drop-shadow":[{"drop-shadow":["","none",w,of,lf]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",nt,Oe,Re]}],"hue-rotate":[{"hue-rotate":[nt,Oe,Re]}],invert:[{invert:["",nt,Oe,Re]}],saturate:[{saturate:[nt,Oe,Re]}],sepia:[{sepia:["",nt,Oe,Re]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,Re]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[nt,Oe,Re]}],"backdrop-contrast":[{"backdrop-contrast":[nt,Oe,Re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,Oe,Re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,Oe,Re]}],"backdrop-invert":[{"backdrop-invert":["",nt,Oe,Re]}],"backdrop-opacity":[{"backdrop-opacity":[nt,Oe,Re]}],"backdrop-saturate":[{"backdrop-saturate":[nt,Oe,Re]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,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:[nt,"initial",Oe,Re]}],ease:[{ease:["linear","initial",C,Oe,Re]}],delay:[{delay:[nt,Oe,Re]}],animate:[{animate:["none",N,Oe,Re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Oe,Re]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:ft()}],"scale-x":[{"scale-x":ft()}],"scale-y":[{"scale-y":ft()}],"scale-z":[{"scale-z":ft()}],"scale-3d":["scale-3d"],skew:[{skew:ut()}],"skew-x":[{"skew-x":ut()}],"skew-y":[{"skew-y":ut()}],transform:[{transform:[Oe,Re,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"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:[nt,Du,Ms,YS]}],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"]}},bD=XM(vD);function ze(...e){return bD(xE(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 DE(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function xD(e){return Ce.delete(`/clients/${encodeURIComponent(e)}`)}function Oc(){return Ce.get(An("/activity"))}function ci(){return Ce.get("/me/clients")}function uh(e){return Ce.get(`/clients/${e}`)}function wD(e){return Ce.post(`/clients/${e}/disconnect`)}function SD(){return Ce.post("/me/connect-tokens")}const JS=e=>["agent-sessions",e];function kD(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 jD(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 ED(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function IE(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 Ce.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function CD(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 Ce.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var e1=1,ND=.9,_D=.8,TD=.17,ng=.1,rg=.999,AD=.9999,RD=.99,OD=/[\\\/_+.#"@\[\(\{&]/,zD=/[\\\/_+.#"@\[\(\{&]/g,MD=/[\s-]/,LE=/[\s-]/g;function jy(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?e1:RD;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,x,w,S;h>=0;)g=jy(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=e1:OD.test(e.charAt(h-1))?(g*=_D,w=e.slice(s,h-1).match(zD),w&&s>0&&(g*=Math.pow(rg,w.length))):MD.test(e.charAt(h-1))?(g*=ND,S=e.slice(s,h-1).match(LE),S&&s>0&&(g*=Math.pow(rg,S.length))):(g*=TD,s>0&&(g*=Math.pow(rg,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=AD)),(g<ng&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(x=jy(e,t,n,a,h+1,o+2,c),x*ng>g&&(g=x*ng)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function t1(e){return e.toLowerCase().replace(LE," ")}function DD(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,jy(e,t,t1(e),t1(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 n1(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=n1(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():n1(e[s],null)}}}}function tl(...e){return b.useCallback(us(...e),e)}function ID(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 LD(e,t=[]){let n=[];function a(o,c){const f=b.createContext(c),m=n.length;n=[...n,c];const h=g=>{var C;const{scope:x,children:w,...S}=g,k=((C=x==null?void 0:x[e])==null?void 0:C[m])||f,E=b.useMemo(()=>S,Object.values(S));return l.jsx(k.Provider,{value:E,children:w})};h.displayName=o+"Provider";function p(g,x){var k;const w=((k=x==null?void 0:x[e])==null?void 0:k[m])||f,S=b.useContext(w);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(c=>b.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,PD(s,...t)]}function PD(...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:()=>{},UD=rv[" useId ".trim().toString()]||(()=>{}),BD=0;function li(e){const[t,n]=b.useState(UD());return uc(()=>{n(a=>a??String(BD++))},[e]),t?`radix-${t}`:""}var FD=rv[" useInsertionEffect ".trim().toString()]||uc;function $D({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=HD({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=qD(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 HD({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return FD(()=>{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 qD(e){return typeof e=="function"}var Av=bj();const ZD=nh(Av);function PE(e){const t=GD(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find(QD);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 GD(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=YD(s),f=KD(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 VD=Symbol("radix.slottable");function QD(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VD}function KD(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 YD(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 XD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fi=XD.reduce((e,t)=>{const n=PE(`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 WD(e,t){e&&Av.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 JD(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 e3="DismissableLayer",Ey="dismissableLayer.update",t3="dismissableLayer.pointerDownOutside",n3="dismissableLayer.focusOutside",r1,UE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BE=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(UE),[p,g]=b.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=b.useState({}),S=tl(t,B=>g(B)),k=Array.from(h.layers),[E]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=k.indexOf(E),N=p?k.indexOf(p):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,z=N>=C,L=i3(B=>{const I=B.target,Q=[...h.branches].some(D=>D.contains(I));!z||Q||(s==null||s(B),c==null||c(B),B.defaultPrevented||f==null||f())},x),O=s3(B=>{const I=B.target;[...h.branches].some(D=>D.contains(I))||(o==null||o(B),c==null||c(B),B.defaultPrevented||f==null||f())},x);return JD(B=>{N===h.layers.size-1&&(a==null||a(B),!B.defaultPrevented&&f&&(B.preventDefault(),f()))},x),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(r1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),a1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=r1)}},[p,x,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),a1())},[p,h]),b.useEffect(()=>{const B=()=>w({});return document.addEventListener(Ey,B),()=>document.removeEventListener(Ey,B)},[]),l.jsx(fi.div,{...m,ref:S,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,L.onPointerDownCapture)})});BE.displayName=e3;var r3="DismissableLayerBranch",a3=b.forwardRef((e,t)=>{const n=b.useContext(UE),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(fi.div,{...e,ref:s})});a3.displayName=r3;function i3(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(){FE(t3,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 s3(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&&FE(n3,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 a1(){const e=new CustomEvent(Ey);document.dispatchEvent(e)}function FE(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?WD(s,o):s.dispatchEvent(o)}var ag="focusScope.autoFocusOnMount",ig="focusScope.autoFocusOnUnmount",i1={bubbles:!1,cancelable:!0},l3="FocusScope",$E=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,k=>m(k)),w=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let k=function(R){if(w.paused||!f)return;const z=R.target;f.contains(z)?g.current=z:Gi(g.current,{select:!0})},E=function(R){if(w.paused||!f)return;const z=R.relatedTarget;z!==null&&(f.contains(z)||Gi(g.current,{select:!0}))},C=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&Gi(f)};document.addEventListener("focusin",k),document.addEventListener("focusout",E);const N=new MutationObserver(C);return f&&N.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",E),N.disconnect()}}},[a,f,w.paused]),b.useEffect(()=>{if(f){l1.add(w);const k=document.activeElement;if(!f.contains(k)){const C=new CustomEvent(ag,i1);f.addEventListener(ag,h),f.dispatchEvent(C),C.defaultPrevented||(o3(h3(HE(f)),{select:!0}),document.activeElement===k&&Gi(f))}return()=>{f.removeEventListener(ag,h),setTimeout(()=>{const C=new CustomEvent(ig,i1);f.addEventListener(ig,p),f.dispatchEvent(C),C.defaultPrevented||Gi(k??document.body,{select:!0}),f.removeEventListener(ig,p),l1.remove(w)},0)}}},[f,h,p,w]);const S=b.useCallback(k=>{if(!n&&!a||w.paused)return;const E=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,C=document.activeElement;if(E&&C){const N=k.currentTarget,[R,z]=u3(N);R&&z?!k.shiftKey&&C===z?(k.preventDefault(),n&&Gi(R,{select:!0})):k.shiftKey&&C===R&&(k.preventDefault(),n&&Gi(z,{select:!0})):C===N&&k.preventDefault()}},[n,a,w.paused]);return l.jsx(fi.div,{tabIndex:-1,...c,ref:x,onKeyDown:S})});$E.displayName=l3;function o3(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Gi(a,{select:t}),document.activeElement!==n)return}function u3(e){const t=HE(e),n=s1(t,e),a=s1(t.reverse(),e);return[n,a]}function HE(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 s1(e,t){for(const n of e)if(!c3(n,{upTo:t}))return n}function c3(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 d3(e){return e instanceof HTMLInputElement&&"select"in e}function Gi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&d3(e)&&t&&e.select()}}var l1=f3();function f3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=o1(e,t),e.unshift(t)},remove(t){var n;e=o1(e,t),(n=e[0])==null||n.resume()}}}function o1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function h3(e){return e.filter(t=>t.tagName!=="A")}var m3="Portal",qE=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?ZD.createPortal(l.jsx(fi.div,{...a,ref:t}),c):null});qE.displayName=m3;function p3(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var ch=e=>{const{present:t,children:n}=e,a=g3(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=tl(a.ref,y3(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};ch.displayName="Presence";function g3(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=p3(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 k=uf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(m("ANIMATION_END"),!s.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},x=w=>{w.target===t&&(o.current=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 y3(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 sg=0;function v3(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??u1()),document.body.insertAdjacentElement("beforeend",e[1]??u1()),sg++,()=>{sg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),sg--}},[])}function u1(){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 Ra=function(){return Ra=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},Ra.apply(this,arguments)};function ZE(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 b3(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",x3="with-scroll-bars-hidden",w3="--removed-body-scroll-bar-size";function lg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function S3(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 k3=typeof window<"u"?b.useLayoutEffect:b.useEffect,c1=new WeakMap;function j3(e,t){var n=S3(null,function(a){return e.forEach(function(s){return lg(s,a)})});return k3(function(){var a=c1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||lg(f,null)}),o.forEach(function(f){s.has(f)||lg(f,c)})}c1.set(n,e)},[e]),n}function E3(e){return e}function C3(e,t){t===void 0&&(t=E3);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 N3(e){e===void 0&&(e={});var t=C3(null);return t.options=Ra({async:!0,ssr:!1},e),t}var GE=function(e){var t=e.sideCar,n=ZE(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,Ra({},n))};GE.isSideCarExport=!0;function _3(e,t){return e.useMedium(t),GE}var VE=N3(),og=function(){},dh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:og,onWheelCapture:og,onTouchMoveCapture:og}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,x=e.sideCar,w=e.noRelative,S=e.noIsolation,k=e.inert,E=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,R=e.gapMode,z=ZE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=x,O=j3([n,t]),B=Ra(Ra({},z),s);return b.createElement(b.Fragment,null,p&&b.createElement(L,{sideCar:VE,removeScrollBar:h,shards:g,noRelative:w,noIsolation:S,inert:k,setCallbacks:o,allowPinchZoom:!!E,lockRef:n,gapMode:R}),c?b.cloneElement(b.Children.only(f),Ra(Ra({},B),{ref:O})):b.createElement(N,Ra({},B,{className:m,ref:O}),f))});dh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dh.classNames={fullWidth:Rf,zeroRight:Af};var T3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function A3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=T3();return t&&e.setAttribute("nonce",t),e}function R3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function O3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var z3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=A3())&&(R3(t,n),O3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},M3=function(){var e=z3();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},QE=function(){var e=M3(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},D3={left:0,top:0,right:0,gap:0},ug=function(e){return parseInt(e||"",10)||0},I3=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[ug(n),ug(a),ug(s)]},L3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return D3;var t=I3(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])}},P3=QE(),to="data-scroll-locked",U3=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
301
- .`.concat(x3,` {
302
- overflow: hidden `).concat(a,`;
303
- padding-right: `).concat(f,"px ").concat(a,`;
304
- }
305
- body[`).concat(to,`] {
306
- overflow: hidden `).concat(a,`;
307
- overscroll-behavior: contain;
308
- `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
309
- padding-left: `.concat(s,`px;
310
- padding-top: `).concat(o,`px;
311
- padding-right: `).concat(c,`px;
312
- margin-left:0;
313
- margin-top:0;
314
- margin-right: `).concat(f,"px ").concat(a,`;
315
- `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
316
- }
317
-
318
- .`).concat(Af,` {
319
- right: `).concat(f,"px ").concat(a,`;
320
- }
321
-
322
- .`).concat(Rf,` {
323
- margin-right: `).concat(f,"px ").concat(a,`;
324
- }
325
-
326
- .`).concat(Af," .").concat(Af,` {
327
- right: 0 `).concat(a,`;
328
- }
329
-
330
- .`).concat(Rf," .").concat(Rf,` {
331
- margin-right: 0 `).concat(a,`;
332
- }
333
-
334
- body[`).concat(to,`] {
335
- `).concat(w3,": ").concat(f,`px;
336
- }
337
- `)},d1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},B3=function(){b.useEffect(function(){return document.body.setAttribute(to,(d1()+1).toString()),function(){var e=d1()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},F3=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;B3();var o=b.useMemo(function(){return L3(s)},[s]);return b.createElement(P3,{styles:U3(o,!t,s,n?"":"!important")})},Cy=!1;if(typeof window<"u")try{var cf=Object.defineProperty({},"passive",{get:function(){return Cy=!0,!0}});window.addEventListener("test",cf,cf),window.removeEventListener("test",cf,cf)}catch{Cy=!1}var Bl=Cy?{passive:!1}:!1,$3=function(e){return e.tagName==="TEXTAREA"},KE=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$3(e)&&n[t]==="visible")},H3=function(e){return KE(e,"overflowY")},q3=function(e){return KE(e,"overflowX")},f1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=YE(e,a);if(s){var o=XE(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},Z3=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},G3=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},YE=function(e,t){return e==="v"?H3(t):q3(t)},XE=function(e,t){return e==="v"?Z3(t):G3(t)},V3=function(e,t){return e==="h"&&t==="rtl"?-1:1},Q3=function(e,t,n,a,s){var o=V3(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=XE(e,f),S=w[0],k=w[1],E=w[2],C=k-E-o*S;(S||C)&&YE(e,f)&&(g+=C,x+=S);var N=f.parentNode;f=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},df=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},h1=function(e){return[e.deltaX,e.deltaY]},m1=function(e){return e&&"current"in e?e.current:e},K3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Y3=function(e){return`
338
- .block-interactivity-`.concat(e,` {pointer-events: none;}
339
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
340
- `)},X3=0,Fl=[];function W3(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(X3++)[0],o=b.useState(QE)[0],c=b.useRef(e);b.useEffect(function(){c.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var k=b3([e.lockRef.current],(e.shards||[]).map(m1),!0).filter(Boolean);return k.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),k.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(k,E){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!c.current.allowPinchZoom;var C=df(k),N=n.current,R="deltaX"in k?k.deltaX:N[0]-C[0],z="deltaY"in k?k.deltaY:N[1]-C[1],L,O=k.target,B=Math.abs(R)>Math.abs(z)?"h":"v";if("touches"in k&&B==="h"&&O.type==="range")return!1;var I=window.getSelection(),Q=I&&I.anchorNode,D=Q?Q===O||Q.contains(O):!1;if(D)return!1;var Y=f1(B,O);if(!Y)return!0;if(Y?L=B:(L=B==="v"?"h":"v",Y=f1(B,O)),!Y)return!1;if(!a.current&&"changedTouches"in k&&(R||z)&&(a.current=L),!L)return!0;var ae=a.current||L;return Q3(ae,E,k,ae==="h"?R:z)},[]),m=b.useCallback(function(k){var E=k;if(!(!Fl.length||Fl[Fl.length-1]!==o)){var C="deltaY"in E?h1(E):df(E),N=t.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&K3(L.delta,C)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var R=(c.current.shards||[]).map(m1).filter(Boolean).filter(function(L){return L.contains(E.target)}),z=R.length>0?f(E,R[0]):!c.current.noIsolation;z&&E.cancelable&&E.preventDefault()}}},[]),h=b.useCallback(function(k,E,C,N){var R={name:k,delta:E,target:C,should:N,shadowParent:J3(C)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(z){return z!==R})},1)},[]),p=b.useCallback(function(k){n.current=df(k),a.current=void 0},[]),g=b.useCallback(function(k){h(k.type,h1(k),k.target,f(k,e.lockRef.current))},[]),x=b.useCallback(function(k){h(k.type,df(k),k.target,f(k,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(k){return k!==o}),document.removeEventListener("wheel",m,Bl),document.removeEventListener("touchmove",m,Bl),document.removeEventListener("touchstart",p,Bl)}},[]);var w=e.removeScrollBar,S=e.inert;return b.createElement(b.Fragment,null,S?b.createElement(o,{styles:Y3(s)}):null,w?b.createElement(F3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function J3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eI=_3(VE,W3);var WE=b.forwardRef(function(e,t){return b.createElement(dh,Ra({},e,{ref:t,sideCar:eI}))});WE.classNames=dh.classNames;var tI=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={},cg=0,JE=function(e){return e&&(e.host||JE(e.parentNode))},nI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=JE(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})},rI=function(e,t,n,a){var s=nI(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),S=w!==null&&w!=="false",k=($l.get(x)||0)+1,E=(o.get(x)||0)+1;$l.set(x,k),o.set(x,E),c.push(x),k===1&&S&&ff.set(x,!0),E===1&&x.setAttribute(n,"true"),S||x.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(t),f.clear(),cg++,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)}),cg--,cg||($l=new WeakMap,$l=new WeakMap,ff=new WeakMap,hf={})}},aI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=tI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),rI(a,s,n,"aria-hidden")):function(){return null}},fh="Dialog",[eC]=LD(fh),[iI,wa]=eC(fh),tC=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]=$D({prop:a,defaultProp:s??!1,onChange:o,caller:fh});return l.jsx(iI,{scope:t,triggerRef:f,contentRef:m,contentId:li(),titleId:li(),descriptionId:li(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};tC.displayName=fh;var nC="DialogTrigger",sI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(nC,n),o=tl(t,s.triggerRef);return l.jsx(fi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":zv(s.open),...a,ref:o,onClick:ss(e.onClick,s.onOpenToggle)})});sI.displayName=nC;var Rv="DialogPortal",[lI,rC]=eC(Rv,{forceMount:void 0}),aC=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=wa(Rv,t);return l.jsx(lI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(ch,{present:n||o.open,children:l.jsx(qE,{asChild:!0,container:s,children:c})}))})};aC.displayName=Rv;var Ff="DialogOverlay",iC=b.forwardRef((e,t)=>{const n=rC(Ff,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=wa(Ff,e.__scopeDialog);return o.modal?l.jsx(ch,{present:a||o.open,children:l.jsx(uI,{...s,ref:t})}):null});iC.displayName=Ff;var oI=PE("DialogOverlay.RemoveScroll"),uI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(Ff,n);return l.jsx(WE,{as:oI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(fi.div,{"data-state":zv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Ks="DialogContent",sC=b.forwardRef((e,t)=>{const n=rC(Ks,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=wa(Ks,e.__scopeDialog);return l.jsx(ch,{present:a||o.open,children:o.modal?l.jsx(cI,{...s,ref:t}):l.jsx(dI,{...s,ref:t})})});sC.displayName=Ks;var cI=b.forwardRef((e,t)=>{const n=wa(Ks,e.__scopeDialog),a=b.useRef(null),s=tl(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return aI(o)},[]),l.jsx(lC,{...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())})}),dI=b.forwardRef((e,t)=>{const n=wa(Ks,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(lC,{...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()}})}),lC=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=wa(Ks,n),m=b.useRef(null),h=tl(t,m);return v3(),l.jsxs(l.Fragment,{children:[l.jsx($E,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(BE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":zv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(fI,{titleId:f.titleId}),l.jsx(mI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Ov="DialogTitle",oC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(Ov,n);return l.jsx(fi.h2,{id:s.titleId,...a,ref:t})});oC.displayName=Ov;var uC="DialogDescription",cC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(uC,n);return l.jsx(fi.p,{id:s.descriptionId,...a,ref:t})});cC.displayName=uC;var dC="DialogClose",fC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(dC,n);return l.jsx(fi.button,{type:"button",...a,ref:t,onClick:ss(e.onClick,()=>s.onOpenChange(!1))})});fC.displayName=dC;function zv(e){return e?"open":"closed"}var hC="DialogTitleWarning",[RY,mC]=ID(hC,{contentName:Ks,titleName:Ov,docsSlug:"dialog"}),fI=({titleId:e})=>{const t=mC(hC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
341
-
342
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
343
-
344
- 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},hI="DialogDescriptionWarning",mI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mC(hI).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},pC=tC,gC=aC,yC=iC,vC=sC,pI=oC,gI=cC,yI=fC,vI=Symbol.for("react.lazy"),$f=rv[" use ".trim().toString()];function bI(e){return typeof e=="object"&&e!==null&&"then"in e}function bC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vI&&"_payload"in e&&bI(e._payload)}function xC(e){const t=wI(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;bC(o)&&typeof $f=="function"&&(o=$f(o._payload));const f=b.Children.toArray(o),m=f.find(kI);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 xI=xC("Slot");function wI(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(bC(s)&&typeof $f=="function"&&(s=$f(s._payload)),b.isValidElement(s)){const c=EI(s),f=jI(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 SI=Symbol("radix.slottable");function kI(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SI}function jI(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 EI(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 CI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hi=CI.reduce((e,t)=>{const n=xC(`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=""]',dg='[cmdk-group-items=""]',NI='[cmdk-group-heading=""]',wC='[cmdk-item=""]',p1=`${wC}:not([aria-disabled="true"])`,Ny="cmdk-item-select",Gl="data-value",_I=(e,t,n)=>DD(e,t,n),SC=b.createContext(void 0),zc=()=>b.useContext(SC),kC=b.createContext(void 0),Mv=()=>b.useContext(kC),jC=b.createContext(void 0),EC=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=CC(e),{label:m,children:h,value:p,onValueChange:g,filter:x,shouldFilter:w,loop:S,disablePointerSelection:k=!1,vimBindings:E=!0,...C}=e,N=li(),R=li(),z=li(),L=b.useRef(null),O=UI();Ys(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,B.emit()}},[p]),Ys(()=>{O(6,be)},[]);let B=b.useMemo(()=>({subscribe:F=>(c.current.add(F),()=>c.current.delete(F)),snapshot:()=>n.current,setState:(F,T,G)=>{var q,re,xe,we;if(!Object.is(n.current[F],T)){if(n.current[F]=T,F==="search")ae(),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(N))==null||q.focus()}if(O(7,()=>{var me;n.current.selectedItemId=(me=W())==null?void 0:me.id,B.emit()}),G||O(5,be),((re=f.current)==null?void 0:re.value)!==void 0){let me=T??"";(we=(xe=f.current).onValueChange)==null||we.call(xe,me);return}}B.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,Q(T,G)),O(2,()=>{D(),B.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,()=>{ae(),D(),n.current.value||Y(),B.emit()}),()=>{o.current.delete(F),a.current.delete(F),n.current.filtered.items.delete(F);let G=W();O(4,()=>{ae(),(G==null?void 0:G.getAttribute("id"))===F&&Y(),B.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:N,inputId:z,labelId:R,listInnerRef:L}),[]);function Q(F,T){var G,q;let re=(q=(G=f.current)==null?void 0:G.filter)!=null?q:_I;return F?re(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 re=s.current.get(q),xe=0;re.forEach(we=>{let me=F.get(we);xe=Math.max(me,xe)}),T.push([q,xe])});let G=L.current;X().sort((q,re)=>{var xe,we;let me=q.getAttribute("id"),De=re.getAttribute("id");return((xe=F.get(De))!=null?xe:0)-((we=F.get(me))!=null?we:0)}).forEach(q=>{let re=q.closest(dg);re?re.appendChild(q.parentElement===re?q:q.closest(`${dg} > *`)):G.appendChild(q.parentElement===G?q:q.closest(`${dg} > *`))}),T.sort((q,re)=>re[1]-q[1]).forEach(q=>{var re;let xe=(re=L.current)==null?void 0:re.querySelector(`${Iu}[${Gl}="${encodeURIComponent(q[0])}"]`);xe==null||xe.parentElement.appendChild(xe)})}function Y(){let F=X().find(G=>G.getAttribute("aria-disabled")!=="true"),T=F==null?void 0:F.getAttribute(Gl);B.setState("value",T||void 0)}function ae(){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 re=0;for(let xe of a.current){let we=(T=(F=o.current.get(xe))==null?void 0:F.value)!=null?T:"",me=(q=(G=o.current.get(xe))==null?void 0:G.keywords)!=null?q:[],De=Q(we,me);n.current.filtered.items.set(xe,De),De>0&&re++}for(let[xe,we]of s.current)for(let me of we)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(xe);break}n.current.filtered.count=re}function be(){var F,T,G;let q=W();q&&(((F=q.parentElement)==null?void 0:F.firstChild)===q&&((G=(T=q.closest(Iu))==null?void 0:T.querySelector(NI))==null||G.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function W(){var F;return(F=L.current)==null?void 0:F.querySelector(`${wC}[aria-selected="true"]`)}function X(){var F;return Array.from(((F=L.current)==null?void 0:F.querySelectorAll(p1))||[])}function Z(F){let T=X()[F];T&&B.setState("value",T.getAttribute(Gl))}function te(F){var T;let G=W(),q=X(),re=q.findIndex(we=>we===G),xe=q[re+F];(T=f.current)!=null&&T.loop&&(xe=re+F<0?q[q.length-1]:re+F===q.length?q[0]:q[re+F]),xe&&B.setState("value",xe.getAttribute(Gl))}function je(F){let T=W(),G=T==null?void 0:T.closest(Iu),q;for(;G&&!q;)G=F>0?LI(G,Iu):PI(G,Iu),q=G==null?void 0:G.querySelector(p1);q?B.setState("value",q.getAttribute(Gl)):te(F)}let Ae=()=>Z(X().length-1),M=F=>{F.preventDefault(),F.metaKey?Ae():F.altKey?je(1):te(1)},P=F=>{F.preventDefault(),F.metaKey?Z(0):F.altKey?je(-1):te(-1)};return b.createElement(hi.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":{E&&F.ctrlKey&&M(F);break}case"ArrowDown":{M(F);break}case"p":case"k":{E&&F.ctrlKey&&P(F);break}case"ArrowUp":{P(F);break}case"Home":{F.preventDefault(),Z(0);break}case"End":{F.preventDefault(),Ae();break}case"Enter":{F.preventDefault();let q=W();if(q){let re=new Event(Ny);q.dispatchEvent(re)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:FI},m),hh(e,F=>b.createElement(kC.Provider,{value:B},b.createElement(SC.Provider,{value:I},F))))}),TI=b.forwardRef((e,t)=>{var n,a;let s=li(),o=b.useRef(null),c=b.useContext(jC),f=zc(),m=CC(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=NC(s,o,[e.value,e.children,o],e.keywords),g=Mv(),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(Ny,S),()=>O.removeEventListener(Ny,S)},[w,e.onSelect,e.disabled]);function S(){var O,B;k(),(B=(O=m.current).onSelect)==null||B.call(O,p.current)}function k(){g.setState("value",p.current,!0)}if(!w)return null;let{disabled:E,value:C,onSelect:N,forceMount:R,keywords:z,...L}=e;return b.createElement(hi.div,{ref:us(o,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!x,"data-disabled":!!E,"data-selected":!!x,onPointerMove:E||f.getDisablePointerSelection()?void 0:k,onClick:E?void 0:S},e.children)}),AI=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=li(),f=b.useRef(null),m=b.useRef(null),h=li(),p=zc(),g=cs(w=>s||p.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ys(()=>p.group(c),[]),NC(c,f,[e.value,e.heading,m]);let x=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(hi.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),hh(e,w=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(jC.Provider,{value:x},w))))}),RI=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=cs(c=>!c.search);return!n&&!o?null:b.createElement(hi.div,{ref:us(s,t),...a,"cmdk-separator":"",role:"separator"})}),OI=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Mv(),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(hi.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)}})}),zI=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(hi.div,{ref:us(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},hh(e,h=>b.createElement("div",{ref:us(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),MI=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(pC,{open:n,onOpenChange:a},b.createElement(gC,{container:c},b.createElement(yC,{"cmdk-overlay":"",className:s}),b.createElement(vC,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(EC,{ref:t,...f}))))}),DI=b.forwardRef((e,t)=>cs(n=>n.filtered.count===0)?b.createElement(hi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),II=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(hi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},hh(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),Cr=Object.assign(EC,{List:zI,Item:TI,Input:OI,Group:AI,Separator:RI,Dialog:MI,Empty:DI,Loading:II});function LI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function PI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function CC(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=Mv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function NC(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 UI=()=>{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 BI(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function hh({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(BI(t),{ref:t.ref},n(t.props.children)):n(t)}var FI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Rn=pC,$I=gC,_C=b.forwardRef(({className:e,...t},n)=>l.jsx(yC,{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}));_C.displayName="DialogOverlay";const Cn=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs($I,{children:[l.jsx(_C,{}),l.jsxs(vC,{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(yI,{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"})]})]})]}));Cn.displayName="DialogContent";function Ln({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 On=b.forwardRef(({className:e,...t},n)=>l.jsx(pI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));On.displayName="DialogTitle";const Dv=b.forwardRef(({className:e,...t},n)=>l.jsx(gI,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));Dv.displayName="DialogDescription";const TC=b.forwardRef(({className:e,...t},n)=>l.jsx(Cr,{ref:n,className:ze("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));TC.displayName=Cr.displayName;function HI({open:e,onOpenChange:t,children:n}){return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsx(Cn,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(TC,{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 AC=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(oh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Cr.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})]}));AC.displayName=Cr.Input.displayName;const RC=b.forwardRef(({className:e,...t},n)=>l.jsx(Cr.List,{ref:n,className:ze("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));RC.displayName=Cr.List.displayName;const OC=b.forwardRef((e,t)=>l.jsx(Cr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));OC.displayName=Cr.Empty.displayName;const Of=b.forwardRef(({className:e,...t},n)=>l.jsx(Cr.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=Cr.Group.displayName;const _y=b.forwardRef(({className:e,...t},n)=>l.jsx(Cr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));_y.displayName=Cr.Separator.displayName;const zf=b.forwardRef(({className:e,...t},n)=>l.jsx(Cr.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=Cr.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 Ce.get(An(`/agents${n?`?${n}`:""}`))}function qI(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 Ce.get(An(`/agents/all${n?`?${n}`:""}`))}function Iv(){return Ce.get("/me/managed-agents")}function ZI(e){return Ce.get(`/agents/${encodeURIComponent(e)}`)}function GI(e){return Ce.post(An("/agents"),e)}function VI(e){return Ce.get(An(`/agents/names/${encodeURIComponent(e)}/availability`))}function Ty(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}`,t)}function QI(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function zC(e){return Ce.delete(`/agents/${encodeURIComponent(e)}`)}function MC(e){return Ce.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function DC(e){return Ce.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function KI(e){return Ce.post(`/agents/${encodeURIComponent(e)}/test`,{})}function mh(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Iv,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 Lv(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Iv,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 YI=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function XI({open:e,onOpenChange:t}){const n=Tn(),a=mh(),{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 IE(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(HI,{open:e,onOpenChange:t,children:[l.jsx(AC,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(RC,{children:[l.jsx(OC,{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(dE,{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(_y,{}),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(Cv,{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(_y,{}),l.jsx(Of,{heading:"Pages",children:YI.map(h=>l.jsxs(zf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(rM,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function WI(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function JI(){var a;const{user:e}=yt(),{data:t}=Ke({queryKey:["clients"],queryFn:ci,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=WI(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const e4=160;function t4(){const e=Tn(),{rows:t,firstHostname:n}=JI();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(n4,{}),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:e4,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 n4(){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 g1(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ce.get(An(`/notifications${n?`?${n}`:""}`))}function r4(e){return Ce.post(An(`/notifications/${e}/read`))}function a4(){return Ce.post(An("/notifications/read-all"))}const i4={agent_error:"Error",session_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale",agent_disconnected:"Disconnected",agent_connected:"Connected",agent_needs_decision:"Decision",session_completed:"Completed"};function s4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function l4({notification:e,onClick:t,clickable:n}){const a=(i4[e.type]??e.type).toString(),s=s4(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 o4(){var w;const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=Tn(),c=En(),{data:f}=Ke({queryKey:["notifications","bell"],queryFn:()=>g1({limit:8}),refetchInterval:1e4}),{data:m}=Ke({queryKey:["notifications","unread-count"],queryFn:()=>g1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,p=h>0,g=b.useCallback(async S=>{S.read||(r4(S.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),S.agentId&&S.chatId?o(`/?a=${S.agentId}&c=${S.chatId}`):S.agentId&&o(`/?a=${S.agentId}`)},[o,c]),x=b.useCallback(async()=>{a(null);try{await a4(),await c.invalidateQueries({queryKey:["notifications"]})}catch(S){a(S instanceof Error?S.message:"Failed to mark all as read")}},[c]);return l.jsxs("div",{className:"relative",children:[l.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[l.jsx(Dz,{className:"h-4 w-4"}),p&&l.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:x,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),l.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(S=>l.jsx(l4,{notification:S,clickable:!!S.agentId,onClick:()=>g(S)},S.id))})]})]})]})}function u4(){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 c4(){const[e,t]=b.useState(u4);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(wM,{className:"h-4 w-4"}):l.jsx(dM,{className:"h-4 w-4"})})}function d4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function y1({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?l.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{className:a,role:"img","aria-label":t,style:{width:s,height:s,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:l.jsx("span",{className:"text-subtitle font-semibold",children:d4(t)})})}const v1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,b1=xE,f4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return b1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const x=v1(p)||v1(g);return s[h][x]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,x]=p;return x===void 0||(h[g]=x),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:x,...w}=p;return Object.entries(w).every(S=>{let[k,E]=S;return Array.isArray(E)?E.includes({...o,...f}[k]):{...o,...f}[k]===E})?[...h,g,x]:h},[]);return b1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},h4=f4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ve=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?xI:"button";return l.jsx(c,{className:ze(h4({variant:t,size:n,className:e})),ref:o,...s})});ve.displayName="Button";const Ut=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:ze("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));Ut.displayName="Input";function m4({action:e,onClose:t}){const n=e!==null;return l.jsx(Rn,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(Cn,{children:[l.jsxs(Ln,{children:[l.jsx(On,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(Dv,{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(g4,{onDone:t}),e==="join"&&l.jsx(y4,{onDone:t})]})})}function p4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function g4({onDone:e}){const{adoptTokens:t}=yt(),n=Tn(),[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 Ce.post("/me/organizations",{name:p4(g),displayName:g});await t(x.tokens),e(),n("/",{replace:!0})}catch(x){c(x instanceof Error?x.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ut,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function y4({onDone:e}){const{adoptTokens:t}=yt(),n=Tn(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),x=/\/invite\/([^/?#]+)/.exec(g),w=(x==null?void 0:x[1])??g,S=await Ce.post("/me/organizations/join",{token:w});await t(S.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ut,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(ve,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function v4(){var L,O;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=yt(),o=Tn(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),x=b.useRef(null);b.useEffect(()=>{(async()=>{try{const B=await Ce.get("/me/organizations");f(B)}catch{}})()},[]),b.useEffect(()=>{const B=Q=>{m&&x.current&&!x.current.contains(Q.target)&&h(!1)},I=Q=>{m&&Q.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",B),window.addEventListener("keydown",I),()=>{window.removeEventListener("mousedown",B),window.removeEventListener("keydown",I)}},[m]);const w=(n==null?void 0:n.displayName)??"User",S=(n==null?void 0:n.username)??"",k=(n==null?void 0:n.avatarUrl)??null,E=c.find(B=>B.id===e)??null,C=(E==null?void 0:E.role)??(t==="admin"||t==="member"?t:null),N=async B=>{if(B===e){h(!1);return}try{await a(B),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(B=>!B),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:l.jsx(y1,{src:k,name:w,size:28})}),m&&l.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[l.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[l.jsx(y1,{src:k,name:w,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),S&&S!==w&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",S]})]})]}),c.length>0&&l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?l.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(L=c[0])==null?void 0:L.displayName}),l.jsx(x1,{role:((O=c[0])==null?void 0:O.role)??C})]}):l.jsx("div",{children:c.map(B=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void N(B.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:B.id===e?l.jsx(cr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.displayName}),l.jsx(x1,{role:B.role})]},B.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(xa,{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(yE,{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(oM,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(m4,{action:p,onClose:()=>g(null)})]})}function x1({role:e}){return e!=="admin"&&e!=="member"?null:l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const b4=[{to:"/",label:"Workspace",end:!0,kbd:"⌘1"},{to:"/context",label:"Context",end:!1,kbd:"⌘2"},{to:"/team",label:"Team",end:!1,kbd:"⌘3"},{to:"/settings",label:"Settings",end:!1,kbd:"⌘4"}];function x4(){const[e,t]=b.useState(!1),n=Er(),a=n.pathname==="/"||n.search.includes("a=");return b.useEffect(()=>{const s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"&&(o.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),l.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[l.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[l.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[l.jsx(Dc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(t4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:b4.map(s=>l.jsx(yv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>ze("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>l.jsxs("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:o?"var(--fg)":"var(--fg-3)",background:o?"var(--bg-hover)":"transparent"},children:[s.label,o&&l.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),l.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[l.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-2)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[l.jsx(oh,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"}),l.jsx("span",{className:"kbd",children:"⌘K"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(o4,{}),l.jsx(c4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(v4,{})]})]}),l.jsx(XI,{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 IC=b.createContext(null),w4=5e3;function S4({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(IC.Provider,{value:o,children:[e,l.jsx(k4,{toasts:t,onDismiss:a})]})}function Ic(){const e=b.useContext(IC);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function k4({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(j4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function j4({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??w4,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 de(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const x=p[g];x in f||(f[x]=h[x].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class no extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class LC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const PC={};function ds(e){return PC}function UC(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 Ay(e,t){return typeof t=="bigint"?t.toString():t}function ph(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Pv(e){return e==null}function Uv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function E4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const w1=Symbol("evaluating");function Et(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==w1)return a===void 0&&(a=w1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function 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 S1(e){return JSON.stringify(e)}function C4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const BC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const N4=ph(()=>{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 FC(e){return xo(e)?{...e}:Array.isArray(e)?[...e]:e}const _4=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 Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function T4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const A4={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 R4(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 O4(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 z4(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 M4(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 D4(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 I4(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 L4(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 Bv(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 $C=(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,Ay,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},HC=de("$ZodError",$C),qC=de("$ZodError",$C,{Parent:Error});function P4(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 U4(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 Fv=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 BC(f,s==null?void 0:s.callee),f}return c.value},$v=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 BC(f,s==null?void 0:s.callee),f}return c.value},gh=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??HC)(o.issues.map(c=>fs(c,s,ds())))}:{success:!0,data:o.value}},B4=gh(qC),yh=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}},F4=yh(qC),$4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Fv(e)(t,n,s)},H4=e=>(t,n,a)=>Fv(e)(t,n,a),q4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return $v(e)(t,n,s)},Z4=e=>async(t,n,a)=>$v(e)(t,n,a),G4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return gh(e)(t,n,s)},V4=e=>(t,n,a)=>gh(e)(t,n,a),Q4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return yh(e)(t,n,s)},K4=e=>async(t,n,a)=>yh(e)(t,n,a),Y4=/^[cC][^\s-]{8,}$/,X4=/^[0-9a-z]+$/,W4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,J4=/^[0-9a-vA-V]{20}$/,e5=/^[A-Za-z0-9]{27}$/,t5=/^[a-zA-Z0-9_-]{21}$/,n5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,r5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,k1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,a5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,i5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function s5(){return new RegExp(i5,"u")}const l5=/^(?:(?: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])$/,o5=/^(([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}|:))$/,u5=/^((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])$/,c5=/^(([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])$/,d5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ZC=/^[A-Za-z0-9_-]*$/,f5=/^\+[1-9]\d{6,14}$/,GC="(?:(?:\\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])))",h5=new RegExp(`^${GC}$`);function VC(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 m5(e){return new RegExp(`^${VC(e)}$`)}function p5(e){const t=VC({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(`^${GC}T(?:${a})$`)}const g5=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}$`)},y5=/^-?\d+$/,QC=/^-?\d+(?:\.\d+)?$/,v5=/^(?:true|false)$/i,b5=/^null$/i,x5=/^[^A-Z]*$/,w5=/^[^a-z]*$/,Nr=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),KC={number:"number",bigint:"bigint",object:"date"},YC=de("$ZodCheckLessThan",(e,t)=>{Nr.init(e,t);const n=KC[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})}}),XC=de("$ZodCheckGreaterThan",(e,t)=>{Nr.init(e,t);const n=KC[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})}}),S5=de("$ZodCheckMultipleOf",(e,t)=>{Nr.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):E4(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})}}),k5=de("$ZodCheckNumberFormat",(e,t)=>{var c;Nr.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]=A4[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=y5)}),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})}}),j5=de("$ZodCheckMaxLength",(e,t)=>{var n;Nr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(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=Bv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),E5=de("$ZodCheckMinLength",(e,t)=>{var n;Nr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(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=Bv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),C5=de("$ZodCheckLengthEquals",(e,t)=>{var n;Nr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(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=Bv(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})}}),vh=de("$ZodCheckStringFormat",(e,t)=>{var n,a;Nr.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=()=>{})}),N5=de("$ZodCheckRegex",(e,t)=>{vh.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})}}),_5=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=x5),vh.init(e,t)}),T5=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=w5),vh.init(e,t)}),A5=de("$ZodCheckIncludes",(e,t)=>{Nr.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})}}),R5=de("$ZodCheckStartsWith",(e,t)=>{Nr.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})}}),O5=de("$ZodCheckEndsWith",(e,t)=>{Nr.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})}}),z5=de("$ZodCheckOverwrite",(e,t)=>{Nr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class M5{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(`
345
- `).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(`
346
- `))}}const D5={major:4,minor:3,patch:6},Qt=de("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=D5;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,S=x._zod.check(f);if(S instanceof Promise&&(h==null?void 0:h.async)===!1)throw new no;if(g||S instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await S,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)}}Et(e,"~standard",()=>({validate:o=>{var c;try{const f=B4(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return F4(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}))}),Hv=de("$ZodString",(e,t)=>{var n;Qt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??g5(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Kt=de("$ZodStringFormat",(e,t)=>{vh.init(e,t),Hv.init(e,t)}),I5=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=r5),Kt.init(e,t)}),L5=de("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=k1(a))}else t.pattern??(t.pattern=k1());Kt.init(e,t)}),P5=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=a5),Kt.init(e,t)}),U5=de("$ZodURL",(e,t)=>{Kt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),B5=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=s5()),Kt.init(e,t)}),F5=de("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=t5),Kt.init(e,t)}),$5=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Y4),Kt.init(e,t)}),H5=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=X4),Kt.init(e,t)}),q5=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=W4),Kt.init(e,t)}),Z5=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=J4),Kt.init(e,t)}),G5=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=e5),Kt.init(e,t)}),V5=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=p5(t)),Kt.init(e,t)}),Q5=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=h5),Kt.init(e,t)}),K5=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=m5(t)),Kt.init(e,t)}),Y5=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=n5),Kt.init(e,t)}),X5=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=l5),Kt.init(e,t),e._zod.bag.format="ipv4"}),W5=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=o5),Kt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),J5=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=u5),Kt.init(e,t)}),eL=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=c5),Kt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,o]=a;if(!o)throw new Error;const c=Number(o);if(`${c}`!==o)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function WC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const tL=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=d5),Kt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{WC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function nL(e){if(!ZC.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return WC(n)}const rL=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ZC),Kt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{nL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),aL=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=f5),Kt.init(e,t)});function iL(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 sL=de("$ZodJWT",(e,t)=>{Kt.init(e,t),e._zod.check=n=>{iL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),JC=de("$ZodNumber",(e,t)=>{Qt.init(e,t),e._zod.pattern=e._zod.bag.pattern??QC,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}}),lL=de("$ZodNumberFormat",(e,t)=>{k5.init(e,t),JC.init(e,t)}),oL=de("$ZodBoolean",(e,t)=>{Qt.init(e,t),e._zod.pattern=v5,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}}),uL=de("$ZodNull",(e,t)=>{Qt.init(e,t),e._zod.pattern=b5,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}}),cL=de("$ZodUnknown",(e,t)=>{Qt.init(e,t),e._zod.parse=n=>n}),dL=de("$ZodNever",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function j1(e,t,n){e.issues.length&&t.issues.push(...Wl(n,e.issues)),t.value[n]=e.value}const fL=de("$ZodArray",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>j1(h,n,c))):j1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function 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 eN(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=T4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function tN(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 hL=de("$ZodObject",(e,t)=>{Qt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=ph(()=>eN(t));Et(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],S=w._zod.optout==="optional",k=w._zod.run({value:h[x],issues:[]},m);k instanceof Promise?p.push(k.then(E=>Hf(E,f,x,h,S))):Hf(k,f,x,h,S)}return o?tN(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),mL=de("$ZodObjectJIT",(e,t)=>{hL.init(e,t);const n=e._zod.parse,a=ph(()=>eN(t)),s=x=>{var R;const w=new M5(["shape","payload","ctx"]),S=a.value,k=z=>{const L=S1(z);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};w.write("const input = payload.value;");const E=Object.create(null);let C=0;for(const z of S.keys)E[z]=`key_${C++}`;w.write("const newResult = {};");for(const z of S.keys){const L=E[z],O=S1(z),B=x[z],I=((R=B==null?void 0:B._zod)==null?void 0:R.optout)==="optional";w.write(`const ${L} = ${k(z)};`),I?w.write(`
347
- if (${L}.issues.length) {
348
- if (${O} in input) {
349
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
350
- ...iss,
351
- path: iss.path ? [${O}, ...iss.path] : [${O}]
352
- })));
353
- }
354
- }
355
-
356
- if (${L}.value === undefined) {
357
- if (${O} in input) {
358
- newResult[${O}] = undefined;
359
- }
360
- } else {
361
- newResult[${O}] = ${L}.value;
362
- }
363
-
364
- `):w.write(`
365
- if (${L}.issues.length) {
366
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
367
- ...iss,
368
- path: iss.path ? [${O}, ...iss.path] : [${O}]
369
- })));
370
- }
371
-
372
- if (${L}.value === undefined) {
373
- if (${O} in input) {
374
- newResult[${O}] = undefined;
375
- }
376
- } else {
377
- newResult[${O}] = ${L}.value;
378
- }
379
-
380
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const N=w.compile();return(z,L)=>N(x,z,L)};let o;const c=dc,f=!PC.jitless,h=f&&N4.value,p=t.catchall;let g;e._zod.parse=(x,w)=>{g??(g=a.value);const S=x.value;return c(S)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),x=o(x,w),p?tN([],S,x,w,g,e):x):n(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),x)}});function E1(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 nN=de("$ZodUnion",(e,t)=>{Qt.init(e,t),Et(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Et(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Et(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Et(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=>Uv(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=>E1(m,s,e,o)):E1(f,s,e,o)}}),pL=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,nN.init(e,t);const n=e._zod.parse;Et(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=ph(()=>{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)}}),gL=de("$ZodIntersection",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([m,h])=>C1(n,m,h)):C1(n,o,c)}});function Ry(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=Ry(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=Ry(s,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function C1(e,t,n){const a=new Map;let s;for(const 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=Ry(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 yL=de("$ZodRecord",(e,t)=>{Qt.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"&&QC.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}}),vL=de("$ZodEnum",(e,t)=>{Qt.init(e,t);const n=UC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>_4.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}}),bL=de("$ZodLiteral",(e,t)=>{if(Qt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?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}}),xL=de("$ZodTransform",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new LC(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 N1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rN=de("$ZodOptional",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Et(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>N1(o,n.value)):N1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),wL=de("$ZodExactOptional",(e,t)=>{rN.init(e,t),Et(e._zod,"values",()=>t.innerType._zod.values),Et(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),SL=de("$ZodNullable",(e,t)=>{Qt.init(e,t),Et(e._zod,"optin",()=>t.innerType._zod.optin),Et(e._zod,"optout",()=>t.innerType._zod.optout),Et(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uv(n.source)}|null)$`):void 0}),Et(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)}),kL=de("$ZodDefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>_1(o,t)):_1(s,t)}});function _1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const jL=de("$ZodPrefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Et(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))}),EL=de("$ZodNonOptional",(e,t)=>{Qt.init(e,t),Et(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>T1(o,e)):T1(s,e)}});function T1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const CL=de("$ZodCatch",(e,t)=>{Qt.init(e,t),Et(e._zod,"optin",()=>t.innerType._zod.optin),Et(e._zod,"optout",()=>t.innerType._zod.optout),Et(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)}}),NL=de("$ZodPipe",(e,t)=>{Qt.init(e,t),Et(e._zod,"values",()=>t.in._zod.values),Et(e._zod,"optin",()=>t.in._zod.optin),Et(e._zod,"optout",()=>t.out._zod.optout),Et(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 _L=de("$ZodReadonly",(e,t)=>{Qt.init(e,t),Et(e._zod,"propValues",()=>t.innerType._zod.propValues),Et(e._zod,"values",()=>t.innerType._zod.values),Et(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Et(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(A1):A1(s)}});function A1(e){return e.value=Object.freeze(e.value),e}const TL=de("$ZodCustom",(e,t)=>{Nr.init(e,t),Qt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(o=>R1(o,n,a,e));R1(s,n,a,e)}});function R1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(fc(s))}}var O1;class AL{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 RL(){return new AL}(O1=globalThis).__zod_globalRegistry??(O1.__zod_globalRegistry=RL());const Yu=globalThis.__zod_globalRegistry;function OL(e,t){return new e({type:"string",...Ie(t)})}function zL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(t)})}function z1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(t)})}function ML(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(t)})}function DL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(t)})}function IL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(t)})}function LL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(t)})}function PL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(t)})}function UL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(t)})}function BL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(t)})}function FL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(t)})}function $L(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(t)})}function HL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(t)})}function qL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(t)})}function ZL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(t)})}function GL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(t)})}function VL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(t)})}function QL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(t)})}function KL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(t)})}function YL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(t)})}function XL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(t)})}function WL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(t)})}function JL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(t)})}function eP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(t)})}function tP(e,t){return new e({type:"string",format:"date",check:"string_format",...Ie(t)})}function nP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(t)})}function rP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ie(t)})}function aP(e,t){return new e({type:"number",checks:[],...Ie(t)})}function iP(e,t){return new e({type:"number",coerce:!0,checks:[],...Ie(t)})}function sP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(t)})}function lP(e,t){return new e({type:"boolean",...Ie(t)})}function oP(e,t){return new e({type:"null",...Ie(t)})}function uP(e){return new e({type:"unknown"})}function cP(e,t){return new e({type:"never",...Ie(t)})}function M1(e,t){return new YC({check:"less_than",...Ie(t),value:e,inclusive:!1})}function fg(e,t){return new YC({check:"less_than",...Ie(t),value:e,inclusive:!0})}function D1(e,t){return new XC({check:"greater_than",...Ie(t),value:e,inclusive:!1})}function hg(e,t){return new XC({check:"greater_than",...Ie(t),value:e,inclusive:!0})}function I1(e,t){return new S5({check:"multiple_of",...Ie(t),value:e})}function aN(e,t){return new j5({check:"max_length",...Ie(t),maximum:e})}function qf(e,t){return new E5({check:"min_length",...Ie(t),minimum:e})}function iN(e,t){return new C5({check:"length_equals",...Ie(t),length:e})}function dP(e,t){return new N5({check:"string_format",format:"regex",...Ie(t),pattern:e})}function fP(e){return new _5({check:"string_format",format:"lowercase",...Ie(e)})}function hP(e){return new T5({check:"string_format",format:"uppercase",...Ie(e)})}function mP(e,t){return new A5({check:"string_format",format:"includes",...Ie(t),includes:e})}function pP(e,t){return new R5({check:"string_format",format:"starts_with",...Ie(t),prefix:e})}function gP(e,t){return new O5({check:"string_format",format:"ends_with",...Ie(t),suffix:e})}function Ao(e){return new z5({check:"overwrite",tx:e})}function yP(e){return Ao(t=>t.normalize(e))}function vP(){return Ao(e=>e.trim())}function bP(){return Ao(e=>e.toLowerCase())}function xP(){return Ao(e=>e.toUpperCase())}function wP(){return Ao(e=>C4(e))}function SP(e,t,n){return new e({type:"array",element:t,...Ie(n)})}function kP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ie(n)})}function jP(e){const t=EP(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 EP(e,t){const n=new Nr({check:"custom",...Ie(t)});return n._zod.check=e,n}function sN(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 Sn(e,t,n={path:[],schemaPath:[]}){var p,g;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)c.schema=f;else{const x={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,x);else{const S=c.schema,k=t.processors[s.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);k(e,t,S,x)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),Sn(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 lN(e,t){var c,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const p of e.seen.entries()){const g=(c=e.metadataRegistry.get(p[0]))==null?void 0:c.id;if(g){const x=a.get(g);if(x&&x!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var k;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(k=e.external.registry.get(p[0]))==null?void 0:k.id,C=e.external.uri??(R=>R);if(E)return{ref:C(E)};const N=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(p[1]===n)return{ref:"#"};const w=`#/${g}/`,S=p[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:w+S}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:x,defId:w}=s(p);g.def={...g.schema},w&&(g.defId=w);const S=g.schema;for(const k in S)delete S[k];S.$ref=x};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
381
-
382
- 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 oN(e,t){var c,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,x={...g},w=p.ref;if(p.ref=null,w){a(w);const k=e.seen.get(w),E=k.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Object.assign(g,E),Object.assign(g,x),h._zod.parent===w)for(const N in g)N==="$ref"||N==="allOf"||N in x||delete g[N];if(E.$ref&&k.def)for(const N in g)N==="$ref"||N==="allOf"||N in k.def&&JSON.stringify(g[N])===JSON.stringify(k.def[N])&&delete g[N]}const S=h._zod.parent;if(S&&S!==w){a(S);const k=e.seen.get(S);if(k!=null&&k.schema.$ref&&(g.$ref=k.schema.$ref,k.def))for(const E in g)E==="$ref"||E==="allOf"||E in k.def&&JSON.stringify(g[E])===JSON.stringify(k.def[E])&&delete g[E]}e.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(o[p.defId]=p.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input: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 CP=(e,t={})=>n=>{const a=sN({...n,processors:t});return Sn(e,a),lN(a,e),oN(a,e)},Zf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=sN({...s??{},target:o,io:t,processors:n});return Sn(e,c),lN(c,e),oN(c,e)},NP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_P=(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=NP[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}))])}},TP=(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)},AP=(e,t,n,a)=>{n.type="boolean"},RP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},OP=(e,t,n,a)=>{n.not={}},zP=(e,t,n,a)=>{},MP=(e,t,n,a)=>{const s=e._zod.def,o=UC(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},DP=(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},IP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},LP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},PP=(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=Sn(o.element,t,{...a,path:[...a.path,"items"]})},UP=(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]=Sn(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=Sn(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},BP=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>Sn(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},FP=(e,t,n,a)=>{const s=e._zod.def,o=Sn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=Sn(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},$P=(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=Sn(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=Sn(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=Sn(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)}},HP=(e,t,n,a)=>{const s=e._zod.def,o=Sn(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"}]},qP=(e,t,n,a)=>{const s=e._zod.def;Sn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},ZP=(e,t,n,a)=>{const s=e._zod.def;Sn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},GP=(e,t,n,a)=>{const s=e._zod.def;Sn(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)))},VP=(e,t,n,a)=>{const s=e._zod.def;Sn(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},QP=(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;Sn(o,t,a);const c=t.seen.get(e);c.ref=o},KP=(e,t,n,a)=>{const s=e._zod.def;Sn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},uN=(e,t,n,a)=>{const s=e._zod.def;Sn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},YP=de("ZodISODateTime",(e,t)=>{V5.init(e,t),en.init(e,t)});function XP(e){return eP(YP,e)}const WP=de("ZodISODate",(e,t)=>{Q5.init(e,t),en.init(e,t)});function JP(e){return tP(WP,e)}const eU=de("ZodISOTime",(e,t)=>{K5.init(e,t),en.init(e,t)});function tU(e){return nP(eU,e)}const nU=de("ZodISODuration",(e,t)=>{Y5.init(e,t),en.init(e,t)});function rU(e){return rP(nU,e)}const aU=(e,t)=>{HC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>U4(e,n)},flatten:{value:n=>P4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ay,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ay,2)}},isEmpty:{get(){return e.issues.length===0}}})},oa=de("ZodError",aU,{Parent:Error}),iU=Fv(oa),sU=$v(oa),lU=gh(oa),oU=yh(oa),uU=$4(oa),cU=H4(oa),dU=q4(oa),fU=Z4(oa),hU=G4(oa),mU=V4(oa),pU=Q4(oa),gU=K4(oa),Yt=de("ZodType",(e,t)=>(Qt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zf(e,"input"),output:Zf(e,"output")}}),e.toJSONSchema=CP(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)=>iU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>lU(e,n,a),e.parseAsync=async(n,a)=>sU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>oU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>uU(e,n,a),e.decode=(n,a)=>cU(e,n,a),e.encodeAsync=async(n,a)=>dU(e,n,a),e.decodeAsync=async(n,a)=>fU(e,n,a),e.safeEncode=(n,a)=>hU(e,n,a),e.safeDecode=(n,a)=>mU(e,n,a),e.safeEncodeAsync=async(n,a)=>pU(e,n,a),e.safeDecodeAsync=async(n,a)=>gU(e,n,a),e.refine=(n,a)=>e.check(c6(n,a)),e.superRefine=n=>e.check(d6(n)),e.overwrite=n=>e.check(Ao(n)),e.optional=()=>U1(e),e.exactOptional=()=>XU(e),e.nullable=()=>B1(e),e.nullish=()=>U1(B1(e)),e.nonoptional=n=>r6(e,n),e.array=()=>gt(e),e.or=n=>bh([e,n]),e.and=n=>GU(e,n),e.transform=n=>zy(e,fN(n)),e.default=n=>e6(e,n),e.prefault=n=>n6(e,n),e.catch=n=>i6(e,n),e.pipe=n=>zy(e,n),e.readonly=()=>o6(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)),cN=de("_ZodString",(e,t)=>{Hv.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>_P(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(dP(...a)),e.includes=(...a)=>e.check(mP(...a)),e.startsWith=(...a)=>e.check(pP(...a)),e.endsWith=(...a)=>e.check(gP(...a)),e.min=(...a)=>e.check(qf(...a)),e.max=(...a)=>e.check(aN(...a)),e.length=(...a)=>e.check(iN(...a)),e.nonempty=(...a)=>e.check(qf(1,...a)),e.lowercase=a=>e.check(fP(a)),e.uppercase=a=>e.check(hP(a)),e.trim=()=>e.check(vP()),e.normalize=(...a)=>e.check(yP(...a)),e.toLowerCase=()=>e.check(bP()),e.toUpperCase=()=>e.check(xP()),e.slugify=()=>e.check(wP())}),yU=de("ZodString",(e,t)=>{Hv.init(e,t),cN.init(e,t),e.email=n=>e.check(zL(vU,n)),e.url=n=>e.check(PL(bU,n)),e.jwt=n=>e.check(JL(MU,n)),e.emoji=n=>e.check(UL(xU,n)),e.guid=n=>e.check(z1(L1,n)),e.uuid=n=>e.check(ML(gf,n)),e.uuidv4=n=>e.check(DL(gf,n)),e.uuidv6=n=>e.check(IL(gf,n)),e.uuidv7=n=>e.check(LL(gf,n)),e.nanoid=n=>e.check(BL(wU,n)),e.guid=n=>e.check(z1(L1,n)),e.cuid=n=>e.check(FL(SU,n)),e.cuid2=n=>e.check($L(kU,n)),e.ulid=n=>e.check(HL(jU,n)),e.base64=n=>e.check(YL(RU,n)),e.base64url=n=>e.check(XL(OU,n)),e.xid=n=>e.check(qL(EU,n)),e.ksuid=n=>e.check(ZL(CU,n)),e.ipv4=n=>e.check(GL(NU,n)),e.ipv6=n=>e.check(VL(_U,n)),e.cidrv4=n=>e.check(QL(TU,n)),e.cidrv6=n=>e.check(KL(AU,n)),e.e164=n=>e.check(WL(zU,n)),e.datetime=n=>e.check(XP(n)),e.date=n=>e.check(JP(n)),e.time=n=>e.check(tU(n)),e.duration=n=>e.check(rU(n))});function _(e){return OL(yU,e)}const en=de("ZodStringFormat",(e,t)=>{Kt.init(e,t),cN.init(e,t)}),vU=de("ZodEmail",(e,t)=>{P5.init(e,t),en.init(e,t)}),L1=de("ZodGUID",(e,t)=>{I5.init(e,t),en.init(e,t)}),gf=de("ZodUUID",(e,t)=>{L5.init(e,t),en.init(e,t)}),bU=de("ZodURL",(e,t)=>{U5.init(e,t),en.init(e,t)}),xU=de("ZodEmoji",(e,t)=>{B5.init(e,t),en.init(e,t)}),wU=de("ZodNanoID",(e,t)=>{F5.init(e,t),en.init(e,t)}),SU=de("ZodCUID",(e,t)=>{$5.init(e,t),en.init(e,t)}),kU=de("ZodCUID2",(e,t)=>{H5.init(e,t),en.init(e,t)}),jU=de("ZodULID",(e,t)=>{q5.init(e,t),en.init(e,t)}),EU=de("ZodXID",(e,t)=>{Z5.init(e,t),en.init(e,t)}),CU=de("ZodKSUID",(e,t)=>{G5.init(e,t),en.init(e,t)}),NU=de("ZodIPv4",(e,t)=>{X5.init(e,t),en.init(e,t)}),_U=de("ZodIPv6",(e,t)=>{W5.init(e,t),en.init(e,t)}),TU=de("ZodCIDRv4",(e,t)=>{J5.init(e,t),en.init(e,t)}),AU=de("ZodCIDRv6",(e,t)=>{eL.init(e,t),en.init(e,t)}),RU=de("ZodBase64",(e,t)=>{tL.init(e,t),en.init(e,t)}),OU=de("ZodBase64URL",(e,t)=>{rL.init(e,t),en.init(e,t)}),zU=de("ZodE164",(e,t)=>{aL.init(e,t),en.init(e,t)}),MU=de("ZodJWT",(e,t)=>{sL.init(e,t),en.init(e,t)}),qv=de("ZodNumber",(e,t)=>{JC.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>TP(e,a,s),e.gt=(a,s)=>e.check(D1(a,s)),e.gte=(a,s)=>e.check(hg(a,s)),e.min=(a,s)=>e.check(hg(a,s)),e.lt=(a,s)=>e.check(M1(a,s)),e.lte=(a,s)=>e.check(fg(a,s)),e.max=(a,s)=>e.check(fg(a,s)),e.int=a=>e.check(P1(a)),e.safe=a=>e.check(P1(a)),e.positive=a=>e.check(D1(0,a)),e.nonnegative=a=>e.check(hg(0,a)),e.negative=a=>e.check(M1(0,a)),e.nonpositive=a=>e.check(fg(0,a)),e.multipleOf=(a,s)=>e.check(I1(a,s)),e.step=(a,s)=>e.check(I1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function qe(e){return aP(qv,e)}const DU=de("ZodNumberFormat",(e,t)=>{lL.init(e,t),qv.init(e,t)});function P1(e){return sP(DU,e)}const IU=de("ZodBoolean",(e,t)=>{oL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AP(e,n,a)});function Zn(e){return lP(IU,e)}const LU=de("ZodNull",(e,t)=>{uL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RP(e,n,a)});function PU(e){return oP(LU,e)}const UU=de("ZodUnknown",(e,t)=>{cL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zP()});function Jt(){return uP(UU)}const BU=de("ZodNever",(e,t)=>{dL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OP(e,n,a)});function FU(e){return cP(BU,e)}const $U=de("ZodArray",(e,t)=>{fL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PP(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(aN(n,a)),e.length=(n,a)=>e.check(iN(n,a)),e.unwrap=()=>e.element});function gt(e,t){return SP($U,e,t)}const HU=de("ZodObject",(e,t)=>{mL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UP(e,n,a,s),Et(e,"shape",()=>t.shape),e.keyof=()=>$e(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Jt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Jt()}),e.strict=()=>e.clone({...e._zod.def,catchall:FU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>z4(e,n),e.safeExtend=n=>M4(e,n),e.merge=n=>D4(e,n),e.pick=n=>R4(e,n),e.omit=n=>O4(e,n),e.partial=(...n)=>I4(hN,e,n[0]),e.required=(...n)=>L4(mN,e,n[0])});function se(e,t){const n={type:"object",shape:e??{},...Ie(t)};return new HU(n)}const dN=de("ZodUnion",(e,t)=>{nN.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BP(e,n,a,s),e.options=t.options});function bh(e,t){return new dN({type:"union",options:e,...Ie(t)})}const qU=de("ZodDiscriminatedUnion",(e,t)=>{dN.init(e,t),pL.init(e,t)});function xh(e,t,n){return new qU({type:"union",options:t,discriminator:e,...Ie(n)})}const ZU=de("ZodIntersection",(e,t)=>{gL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FP(e,n,a,s)});function GU(e,t){return new ZU({type:"intersection",left:e,right:t})}const VU=de("ZodRecord",(e,t)=>{yL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>$P(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function on(e,t,n){return new VU({type:"record",keyType:e,valueType:t,...Ie(n)})}const Oy=de("ZodEnum",(e,t)=>{vL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>MP(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 Oy({...t,checks:[],...Ie(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new Oy({...t,checks:[],...Ie(s),entries:o})}});function $e(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Oy({type:"enum",entries:n,...Ie(t)})}const QU=de("ZodLiteral",(e,t)=>{bL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DP(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ln(e,t){return new QU({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const KU=de("ZodTransform",(e,t)=>{xL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LP(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new LC(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 fN(e){return new KU({type:"transform",transform:e})}const hN=de("ZodOptional",(e,t)=>{rN.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>uN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function U1(e){return new hN({type:"optional",innerType:e})}const YU=de("ZodExactOptional",(e,t)=>{wL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>uN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function XU(e){return new YU({type:"optional",innerType:e})}const WU=de("ZodNullable",(e,t)=>{SL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>HP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function B1(e){return new WU({type:"nullable",innerType:e})}const JU=de("ZodDefault",(e,t)=>{kL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>ZP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function e6(e,t){return new JU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():FC(t)}})}const t6=de("ZodPrefault",(e,t)=>{jL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>GP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function n6(e,t){return new t6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():FC(t)}})}const mN=de("ZodNonOptional",(e,t)=>{EL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>qP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function r6(e,t){return new mN({type:"nonoptional",innerType:e,...Ie(t)})}const a6=de("ZodCatch",(e,t)=>{CL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>VP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function i6(e,t){return new a6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const s6=de("ZodPipe",(e,t)=>{NL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>QP(e,n,a,s),e.in=t.in,e.out=t.out});function zy(e,t){return new s6({type:"pipe",in:e,out:t})}const l6=de("ZodReadonly",(e,t)=>{_L.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>KP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function o6(e){return new l6({type:"readonly",innerType:e})}const u6=de("ZodCustom",(e,t)=>{TL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IP(e,n)});function c6(e,t={}){return kP(u6,e,t)}function d6(e){return jP(e)}function f6(e,t){return zy(fN(e),t)}const Ls={custom:"custom"};function wh(e){return iP(qv,e)}const h6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function m6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function pN(e,t){const n=m6(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(h6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const p6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,F1="/";function gN(e){return!e||typeof e!="string"||e.length>256||!p6.test(e)?"/":e}const g6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},yN=$e(["feishu","slack","kael"]),vN=$e(["active","inactive"]);se({platform:yN,agentId:_().min(1),credentials:on(_(),Jt()),status:vN.default("active")});se({agentId:_().min(1).optional(),credentials:on(_(),Jt()).optional(),status:vN.optional()});se({id:qe(),platform:_(),agentId:_(),hasCredentials:Zn(),status:_(),createdAt:_(),updatedAt:_()});const y6=$e(["code","reverse_token","oauth","manual"]);se({appId:_().min(1),appSecret:_().min(1)});se({platform:yN,externalUserId:_().min(1),agentId:_().min(1),boundVia:y6.default("manual"),displayName:_().max(200).optional()});se({id:qe(),platform:_(),externalUserId:_(),agentId:_(),boundVia:_().nullable(),displayName:_().nullable(),createdAt:_()});se({feishuUserId:_().min(1),displayName:_().max(200).optional()});se({configId:qe(),platform:_(),agentId:_(),appId:_(),connected:Zn(),lastActiveAt:_().nullable()});const v6=32e3,Zv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,b6=/^[A-Z][A-Z0-9_]*$/,bN=se({append:_().max(v6).default("")}),x6=se({name:_().regex(Zv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("stdio"),command:_().min(1),args:gt(_()).optional()}),w6=se({name:_().regex(Zv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("http"),url:_().url(),headers:on(_(),_()).optional()}),S6=se({name:_().regex(Zv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("sse"),url:_().url(),headers:on(_(),_()).optional()}),xN=xh("transport",[x6,w6,S6]),wN=se({key:_().regex(b6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:_(),sensitive:Zn().default(!1)}),Gv=se({url:_().min(1),ref:_().min(1).optional(),localPath:_().min(1).optional()}),SN=se({prompt:bN.default({append:""}),model:_().default("opus"),mcpServers:gt(xN).default([]),env:gt(wN).default([]),gitRepos:gt(Gv).default([])}),k6=SN.extend({kind:ln("claude-code")}),j6=SN.extend({kind:ln("codex")}),E6=xh("kind",[k6,j6]),C6=(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))})},kN=f6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,E6).superRefine((e,t)=>{C6(e,t)}),N6=se({agentId:_(),version:qe().int().positive(),payload:kN,updatedAt:_(),updatedBy:_()}),jN=se({prompt:bN,model:_(),mcpServers:gt(xN),env:gt(wN),gitRepos:gt(Gv)}).partial();se({expectedVersion:qe().int().positive(),payload:jN});se({payload:jN});se({current:N6,next:kN,diff:gt(se({path:_(),op:$e(["add","remove","replace"]),before:Jt().optional(),after:Jt().optional()}))});const Gf="***";function Vf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const EN=$e(["online","offline"]),CN=$e(["idle","working","blocked","error"]);$e(["active","suspended","evicted"]);const _6=$e(["active","suspended"]);se({chatId:_().min(1),state:_6});se({runtimeState:CN});se({agentId:_().min(1),runtimeType:_().max(50),runtimeVersion:_().max(50).optional()});$e(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);se({agentId:_(),status:EN,connectedAt:_().nullable(),lastSeenAt:_(),clientId:_().nullable().optional(),runtimeType:_().nullable().optional(),runtimeVersion:_().nullable().optional(),runtimeState:CN.nullable().optional(),activeSessions:qe().int().nullable().optional(),totalSessions:qe().int().nullable().optional(),runtimeUpdatedAt:_().nullable().optional()});se({total:qe().int(),running:qe().int(),byState:se({idle:qe().int(),working:qe().int(),blocked:qe().int(),error:qe().int()}),clients:qe().int()});const Qf={CLAUDE_CODE:"claude-code",CODEX:"codex"},Sh=$e(["claude-code","codex"]),kh=$e(["human","personal_assistant","autonomous_agent"]),$1={PRIVATE:"private",ORGANIZATION:"organization"},Vv=$e(["private","organization"]),T6=$e(["admin-api","portal"]);$e(["active","suspended"]);const My=/^[a-z0-9][a-z0-9_-]{0,63}$/,Jl=64,A6=["admin","agent","first-tree","hub","me","null","system","undefined"],R6=new Set(A6);function Dy(e){return R6.has(e)}se({name:_().min(1).max(64).regex(My,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Dy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:kh,displayName:_().min(1).max(200).optional(),delegateMention:_().max(100).optional(),organizationId:_().min(1).max(100).optional(),source:T6.optional(),visibility:Vv.optional(),metadata:on(_(),Jt()).optional(),managerId:_().optional(),clientId:_().min(1).max(100).optional(),runtimeProvider:Sh.optional(),gitRepos:gt(Gv).optional()});se({type:kh.optional(),displayName:_().min(1).max(200).optional(),delegateMention:_().max(100).nullable().optional(),visibility:Vv.optional(),metadata:on(_(),Jt()).optional(),managerId:_().nullable().optional(),clientId:_().min(1).max(100).nullable().optional()});se({clientId:_().min(1).max(100),runtimeProvider:Sh,force:Zn().optional()});se({uuid:_(),name:_().nullable(),organizationId:_(),type:kh,displayName:_(),delegateMention:_().nullable(),inboxId:_(),status:_(),source:_().nullable().optional(),visibility:Vv,metadata:on(_(),Jt()),managerId:_().nullable(),clientId:_().nullable(),runtimeProvider:Sh,presenceStatus:EN.optional(),createdAt:_(),updatedAt:_()});se({repo:_().nullable(),branch:_().nullable()});se({type:ln("agent:pinned"),agentId:_(),name:_().nullable(),displayName:_(),agentType:kh,runtimeProvider:Sh});se({username:_().min(1),password:_().min(1)});se({accessToken:_(),refreshToken:_()});se({refreshToken:_().min(1)});se({token:_().min(1)});se({token:_(),expiresIn:qe(),command:_()});const O6=["issue","pull_request","discussion","commit"],z6=$e(O6),M6=se({source:ln("github"),entityType:z6,entityKey:_().min(1),entityUrl:_().url().optional()}),D6=se({source:ln("feishu"),externalChannelId:_().min(1)}),I6=xh("source",[M6,D6]),L6=bh([se({}).strict(),I6]),P6=$e(["direct","group","thread"]);se({type:P6,topic:_().max(500).optional(),participantIds:gt(_()).min(1),metadata:L6.optional()});const NN=se({agentId:_(),role:_(),mode:_(),joinedAt:_()});NN.extend({name:_().nullable(),displayName:_(),type:_()});const U6=se({id:_(),organizationId:_(),type:_(),topic:_().nullable(),lifecyclePolicy:_().nullable().optional(),metadata:on(_(),Jt()),createdAt:_(),updatedAt:_()});U6.extend({participants:gt(NN),title:_(),firstMessagePreview:_().nullable()});se({topic:_().trim().max(500).nullable()});se({agentId:_().min(1)});se({agentId:_().min(1)});const B6=$e(["connected","disconnected"]),F6=$e(["ok","expired"]);se({id:_(),userId:_().nullable(),status:B6,authState:F6,sdkVersion:_().max(50).nullable(),hostname:_().max(100).nullable(),os:_().max(50).nullable(),agentCount:qe().int().min(0),connectedAt:_().nullable(),lastSeenAt:_(),metadata:on(_(),Jt()).nullable()});const $6=se({wsInboxDeliver:Zn().default(!1)}).partial();se({clientId:_().min(1).max(100),hostname:_().max(100).optional(),os:_().max(50).optional(),sdkVersion:_().max(50).optional(),wireCapabilities:$6.optional()});se({clientId:_(),previousUserId:_().nullable(),unpinnedAgentCount:qe().int().nonnegative()});const H6=$e(["ok","missing","unauthenticated","error"]),q6=$e(["api_key","oauth","auth_json","none"]),Z6=se({state:H6,available:Zn(),authenticated:Zn(),sdkVersion:_().nullable().optional(),authMethod:q6,error:_().nullable().optional(),detectedAt:_()}),G6=on(_(),Z6);se({capabilities:G6});se({limit:wh().int().min(1).max(100).default(20),cursor:_().optional()});const V6=$e(["active","stale","unavailable"]),Q6=$e(["ok","warning","error"]),K6=se({label:_(),detail:_().nullable(),severity:Q6}),Y6=$e(["root","domain","subdomain","leaf"]),Qv=$e(["added","edited","removed"]),X6=$e(["parent","soft_link","markdown_link"]),W6=$e(["low","medium","high"]),J6=se({id:_(),path:_(),sourcePath:_().nullable(),title:_(),kind:Y6,owners:gt(_()),parentId:_().nullable(),preview:_().nullable(),relatedNodeIds:gt(_()),affectedContextArea:_(),changeType:Qv.nullable(),changedAtCommit:_().nullable()}),eB=se({source:_(),target:_(),kind:X6}),tB=se({path:_(),nodeId:_().nullable(),type:Qv,commit:_().nullable(),changedAt:_().nullable(),changedBy:_().nullable(),summary:_().nullable()}),nB=se({id:_(),nodeId:_().nullable(),path:_(),title:_(),changeType:Qv,affectedContextArea:_(),reason:_(),summary:_(),changedBy:_().nullable(),owners:gt(_()),relatedNodeIds:gt(_()),sourceCommit:_().nullable(),riskLevel:W6}),rB=se({addedCount:qe().int().nonnegative(),editedCount:qe().int().nonnegative(),removedCount:qe().int().nonnegative(),changedNodeCount:qe().int().nonnegative()});se({repo:_().nullable(),branch:_().nullable(),headCommit:_().nullable(),syncedAt:_().nullable(),snapshotStatus:V6,contextStatus:K6,summary:rB,updates:gt(nB),nodes:gt(J6),edges:gt(eB),changes:gt(tB)});const aB=["User","Organization"],iB=$e(aB),sB=["read","write","admin"],lB=$e(sB),oB=on(_(),lB),uB=gt(_());se({login:_().optional(),accessToken:_().optional(),accessTokenExpiresAt:_().datetime({offset:!0}).optional(),refreshToken:_().optional(),refreshTokenExpiresAt:_().datetime({offset:!0}).optional()});se({installationId:qe().int().positive()});se({installationId:qe().int().positive(),accountType:iB,accountLogin:_(),accountGithubId:qe().int().positive(),permissions:oB,events:uB,suspended:Zn(),manageUrl:_().url(),createdAt:_().datetime({offset:!0}),updatedAt:_().datetime({offset:!0})});const cB=["image/png","image/jpeg","image/gif","image/webp"],Kv=$e(cB);se({data:_().min(1),mimeType:Kv,filename:_().min(1),size:qe().int().nonnegative().optional(),imageId:_().uuid().optional()});se({imageId:_().uuid(),mimeType:Kv,filename:_().min(1),size:qe().int().nonnegative().optional()});se({type:ln("image_payload"),imageId:_().uuid(),chatId:_(),base64:_().min(1),mimeType:Kv,filename:_().min(1),size:qe().int().nonnegative().optional()});const Yv=$e(["hub_ui","cli","feishu","github","api"]),_N=$e(["text","markdown","card","reference","file","question","question_answer"]);se({format:_N.default("text"),content:Jt(),metadata:on(_(),Jt()).optional(),inReplyTo:_().optional(),replyToInbox:_().optional(),replyToChat:_().optional(),source:Yv.optional()});se({format:_N.default("text"),content:Jt(),metadata:on(_(),Jt()).optional(),replyToInbox:_().optional(),replyToChat:_().optional(),source:Yv.optional()});const dB=se({id:_(),chatId:_(),senderId:_(),format:_(),content:Jt(),metadata:on(_(),Jt()),replyToInbox:_().nullable(),replyToChat:_().nullable(),inReplyTo:_().nullable(),source:Yv.nullable(),createdAt:_()}),fB=se({senderId:_(),chatId:_(),replyToChat:_().nullable()}).nullable(),hB=$e(["full","mention_only"]),mB=se({id:_(),senderId:_(),format:_(),content:Jt(),metadata:on(_(),Jt()).default({}),createdAt:_()}),TN=dB.extend({configVersion:qe().int().positive(),recipientMode:hB.default("full"),inReplyToSnapshot:fB.default(null),precedingMessages:gt(mB).default([])});$e(["pending","delivered","acked","failed"]);const pB=se({id:qe(),inboxId:_(),messageId:_(),chatId:_().nullable(),status:_(),retryCount:qe(),createdAt:_(),deliveredAt:_().nullable(),ackedAt:_().nullable()});pB.extend({message:TN});se({limit:wh().int().min(1).max(50).default(10)});se({type:ln("inbox:deliver"),entryId:qe().int().nonnegative(),inboxId:_().min(1),chatId:_().nullable(),message:TN}).passthrough();se({type:ln("inbox:ack"),entryId:qe().int().nonnegative()});const gB=7;se({organizationId:_(),organizationName:_(),organizationDisplayName:_(),role:_(),expiresAt:_().nullable()});se({id:_(),organizationId:_(),token:_(),inviteUrl:_(),role:_(),createdAt:_(),expiresAt:_().nullable()});se({token:_().min(1)});se({}).optional();const yB=["all","unread","watching"],vB=$e(yB),AN=$e(["participant","watching"]);se({cursor:_().optional(),limit:wh().int().min(1).max(200).default(50),filter:vB.default("all")});const bB=se({agentId:_(),displayName:_(),type:_()}),xB=se({chatId:_(),type:_(),membershipKind:AN,title:_(),topic:_().nullable(),participants:gt(bB),participantCount:qe().int(),lastMessageAt:_().nullable(),lastMessagePreview:_().nullable(),unreadMentionCount:qe().int(),canReply:Zn()});se({rows:gt(xB),nextCursor:_().nullable()});se({participantIds:gt(_().min(1)).min(1),topic:_().trim().max(500).optional().nullable()});se({participantIds:gt(_().min(1)).min(1)});se({chatId:_(),lastReadAt:_(),unreadMentionCount:qe().int()});se({chatId:_(),membershipKind:AN.nullable()});se({type:ln("chat:message"),chatId:_()});$e(["connect","create_agent","completed"]);se({id:_(),name:_(),displayName:_(),role:$e(["admin","member"])});se({name:_().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:_().min(1).max(200)});se({dismissed:Zn().optional()});const wB=$e(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);se({event:wB,attrs:on(_(),bh([_(),qe(),Zn(),PU()])).optional()});se({id:_(),organizationId:_(),organizationName:_(),role:$e(["admin","member"]),agentId:_()});const SB={ADMIN:"admin",MEMBER:"member"},Xv=$e(["admin","member"]),kB=se({id:_(),userId:_(),organizationId:_(),agentId:_(),role:Xv,createdAt:_()});se({username:_().min(1).max(100),displayName:_().min(1).max(200),role:Xv.default("member")});se({role:Xv.optional(),displayName:_().min(1).max(200).optional()});kB.extend({username:_(),displayName:_(),password:_()});const jB=$e(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),RN=$e(["high","medium","low"]);se({id:_(),organizationId:_(),type:jB,severity:RN,agentId:_().nullable(),chatId:_().nullable(),message:_(),read:Zn(),createdAt:_()});se({limit:wh().int().min(1).max(100).default(20),cursor:_().optional(),severity:RN.optional(),read:$e(["true","false"]).transform(e=>e==="true").optional(),agentId:_().optional()});se({next:_().max(256).optional()});se({code:_().min(1),state:_().min(1),installation_id:_().regex(/^\d+$/).optional(),setup_action:$e(["install","update","request"]).optional()});se({githubId:_().min(1),login:_().min(1),email:_().email().optional(),displayName:_().optional(),next:_().max(256).optional(),installationId:_().regex(/^\d+$/).optional(),installationAccountType:$e(["User","Organization"]).optional(),installationAccountLogin:_().min(1).optional(),installationAccountGithubId:_().regex(/^\d+$/).optional()});const EB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function CB(e){return e.includes("://")?!1:EB.test(e)}const jh=_().min(1).superRefine((e,t)=>{if(CB(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}}),NB=se({repo:jh.optional(),branch:_().default("main")}),_B=se({repo:jh.nullish(),branch:_().min(1).nullish()}),TB=se({repo:_().optional(),branch:_().optional()}),AB=se({webhookSecretCipher:_().optional()}),RB=se({webhookSecret:_().min(1).nullish()}),OB=se({webhookSecretConfigured:Zn(),webhookUrl:_()}),zB=se({repos:gt(se({url:jh,defaultBranch:_().optional()})).default([])}),MB=se({repos:gt(se({url:jh,defaultBranch:_().min(1).optional()})).optional()}),DB=se({repos:gt(se({url:_(),defaultBranch:_().optional()}))}),IB={context_tree:{storage:NB,input:_B,output:TB,readPolicy:"member"},github_integration:{storage:AB,input:RB,output:OB,readPolicy:"admin"},source_repos:{storage:zB,input:MB,output:DB,readPolicy:"member"}},LB=Object.keys(IB);$e(LB);const ON=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;se({name:_().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=>!ON.test(e),"Name must not be a UUID format"),displayName:_().min(1).max(200),maxAgents:qe().int().min(0).default(0),maxMessagesPerMinute:qe().int().min(0).default(0),features:on(_(),Jt()).default({})});se({name:_().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=>!ON.test(e),"Name must not be a UUID format").optional(),displayName:_().min(1).max(200).optional(),maxAgents:qe().int().min(0).optional(),maxMessagesPerMinute:qe().int().min(0).optional(),features:on(_(),Jt()).optional()});se({id:_(),name:_(),displayName:_(),maxAgents:qe(),maxMessagesPerMinute:qe(),features:on(_(),Jt()),createdAt:_(),updatedAt:_()});const PB=se({workingCount:qe().int().nonnegative(),errorMask:Zn()}),UB=se({type:ln("pulse:tick"),organizationId:_(),agents:on(_(),gt(PB).length(32))}),BB=se({label:_().min(1),description:_(),preview:_().nullable().optional()}),FB=se({question:_().min(1),header:_().min(1).max(24),options:gt(BB).min(2).max(4),multiSelect:Zn()}),$B=$e(["html","markdown"]).nullable(),HB=se({correlationId:_().min(1),questions:gt(FB).min(1).max(4),previewFormat:$B,allowFreeText:Zn()}),qB=se({correlationId:_().min(1),answers:on(_().min(1),_())});se({answers:on(_().min(1),_())});$e(["pending","answered","superseded"]);const ZB=$e(["tool_call","error","assistant_text","thinking","turn_end"]),zN=se({toolUseId:_(),name:_(),args:Jt(),status:$e(["pending","ok","error"]),durationMs:qe().int().nonnegative().optional(),resultPreview:_().max(400).optional()}),MN=se({source:$e(["sdk","runtime","tool"]),message:_().max(2e3)}),DN=se({text:_().max(8e3)}),IN=se({}),LN=se({status:$e(["success","error"])}),GB=xh("kind",[se({kind:ln("tool_call"),payload:zN}),se({kind:ln("error"),payload:MN}),se({kind:ln("assistant_text"),payload:DN}),se({kind:ln("thinking"),payload:IN}),se({kind:ln("turn_end"),payload:LN})]);se({id:_(),agentId:_(),chatId:_(),seq:qe().int().positive(),kind:ZB,payload:bh([zN,MN,DN,IN,LN]),createdAt:_()});se({agentId:_(),chatId:_(),event:GB});se({agentId:_(),chatId:_()});se({type:ln("session:reconcile"),agentId:_().min(1),chatIds:gt(_().min(1)).max(500)});se({type:ln("session:reconcile:result"),agentId:_().min(1),staleChatIds:gt(_().min(1))});const VB=se({organizationId:_(),agentCount:qe(),chatCount:qe(),messageCount:qe()});se({totalAgents:qe(),totalChats:qe(),totalMessages:qe(),byOrganization:gt(VB)});const QB=$e(["active","suspended"]);se({id:_(),username:_(),displayName:_(),avatarUrl:_().nullable(),status:QB,createdAt:_(),updatedAt:_()});se({username:_().min(1).max(100),displayName:_().min(1).max(200),password:_().min(8).max(200)});se({displayName:_().min(1).max(200).optional(),password:_().min(8).max(200).optional()});se({type:ln("auth"),token:_().min(1)});const KB=se({wsInboxDeliver:Zn().default(!1)}).partial();se({type:ln("server:welcome"),serverCommandVersion:_().min(1),serverTimeMs:qe().int().nonnegative(),capabilities:KB.optional()}).passthrough();const PN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function YB(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 XB=2e3,WB=3e4;let Qi=null,hc=!1,Kf=0,Wu=null;const Iy=new Set;let Vi=null,Ps=0;function JB(e){for(const t of Iy)try{t(e)}catch{}if(Vi){if(e.type==="notification")Vi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Vi.invalidateQueries({queryKey:["activity"]}),Vi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Vi.invalidateQueries({queryKey:["me","chats"]}),t&&(Vi.invalidateQueries({queryKey:["chat-messages",t]}),Vi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function Wv(){const e=lh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Qi=s,s.onmessage=o=>{if(s===Qi)try{const c=JSON.parse(o.data);JB(c)}catch{}},s.onopen=()=>{s===Qi&&(Kf=0)},s.onclose=o=>{if(s===Qi&&(Qi=null,!(hc||Ps===0))){if(o.code===4001){iz().then(c=>{hc||Ps===0||(c?(Kf=0,Wv()):H1())});return}H1()}}}function H1(){Kf++;const e=Math.min(XB*2**(Kf-1),WB);Wu=setTimeout(()=>{Wu=null,!hc&&Ps>0&&Wv()},e)}function e9(){hc=!0,Wu&&(clearTimeout(Wu),Wu=null),Qi&&(Qi.close(1e3,"unmount"),Qi=null)}function UN(e){const{onMessage:t,enabled:n=!0}=e??{},a=En(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Vi=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return Iy.add(o),Ps++,Ps===1&&(hc=!1,Wv()),()=>{Iy.delete(o),Ps--,Ps===0&&e9()}},[n])}const t9=b.createContext({aggregated:PN,agents:{},receivedAtMs:null,stale:!0});function n9({children:e}){const[t,n]=b.useState({aggregated:PN,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());UN({onMessage:c=>{const f=UB.safeParse(c);f.success&&n({aggregated:YB(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(t9.Provider,{value:o,children:e})}function Eh(e){return Ce.get(`/agents/${e}/config`)}function Ch(e,t){return Ce.patch(`/agents/${e}/config`,t)}function r9(e,t){return Ce.post(`/agents/${e}/config/dry-run`,{payload:t})}function a9(e){return Ce.get(`/agents/${e}/client-status`)}function i9({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 s9({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 l9(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function o9({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const u9={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 ra({tone:e="neutral",className:t,style:n,...a}){const s=u9[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 Ly({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 Jv({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 c9(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function mc({state:e,className:t}){const n=e!==null&&c9(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 d9({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 f9(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(mg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(ve,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(mg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(ve,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(mg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:l.jsxs(ve,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[l.jsx(Uf,{className:"h-3 w-3"}),"Delete"]})})]}),l.jsx(h9,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(m9,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function mg(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 h9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsxs(On,{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(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ve,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function m9({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(Rn,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsxs(On,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Ut,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(fr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ve,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var p9="Label",BN=b.forwardRef((e,t)=>l.jsx(hi.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())}}));BN.displayName=p9;var g9=BN;const vt=b.forwardRef(({className:e,...t},n)=>l.jsx(g9,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));vt.displayName="Label";const kn=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}));kn.displayName="Panel";const ua=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}));ua.displayName="PanelHeader";const ca=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}));ca.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 y9={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 eb({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=y9[e],f=e==="deleted";return l.jsxs("div",{className:ze("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&l.jsx("span",{className:ze("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?l.jsxs(ve,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(EM,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(ve,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(Nv,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(ve,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(Uf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function v9(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(kn,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{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(eb,{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(Ev,{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(Xz,{className:"h-3.5 w-3.5"}):l.jsx(hE,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&l.jsx(b9,{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 b9({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.key)??""),[f,m]=b.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,p]=b.useState((n==null?void 0:n.sensitive)??!1),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),p((n==null?void 0:n.sensitive)??!1),x(null))},[e,n]);function w(S){if(S.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){x(`Another entry already uses key "${o}".`);return}let k=f;if(h&&(n!=null&&n.sensitive)&&!f&&(k=Gf),!h&&!n&&!f){x("Value is required for non-sensitive entries.");return}s({key:o,value:k,sensitive:h})}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(vt,{htmlFor:"env-key",children:"Key"}),l.jsx(Ut,{id:"env-key",value:o,onChange:S=>c(S.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&l.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"env-value",children:"Value"}),l.jsx(Ut,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:S=>m(S.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:h,onChange:S=>p(S.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function x9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(kn,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{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(eb,{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(w9,{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 w9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),x(null))},[e,n]);function w(S){S.preventDefault();const k=o.trim();if(!k){x("URL is required.");return}const E=h.trim()||Vf(k);if(E&&a.has(E)){x(`Another repo already occupies local path "${E}".`);return}const C={url:k,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(vt,{htmlFor:"git-url",children:"URL"}),l.jsx(Ut,{id:"git-url",value:o,onChange:S=>c(S.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Ut,{id:"git-ref",value:f,onChange:S=>m(S.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Ut,{id:"git-path",value:h,onChange:S=>p(S.target.value),placeholder:Vf(o)||"repo-name",className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function FN({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 $N(){return Ce.get(An("/members"))}function S9(e,t){return Ce.patch(An(`/members/${encodeURIComponent(e)}`),t)}function k9(e){return Ce.delete(An(`/members/${encodeURIComponent(e)}`))}function HN(){const{data:e}=Ke({queryKey:["members","name-map"],queryFn:$N,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 j9({agent:e,onSave:t}){const[n,a]=b.useState(!1),s=Lv(),o=HN(),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(kn,{children:[l.jsxs(ua,{children:[l.jsx(ca,{children:"Profile"}),e.status==="active"&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[l.jsx(Nv,{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(FN,{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(ra,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(ra,{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(ra,{tone:"outline",children:x},x))})]})]})]}),l.jsx(E9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function E9({agent:e,open:t,onOpenChange:n,onSave:a}){var z;const{memberId:s,role:o}=yt(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[x,w]=b.useState(!1),[S,k]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),k(null))},[t,e]);const E=e.type==="human",C=o==="admin"||e.managerId===s,N=Ke({queryKey:["agents-for-delegate"],queryFn:async()=>(await Mc({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&E});async function R(L){L.preventDefault(),k(null);const O=c.trim();if(!O){k("Display name is required.");return}w(!0);try{const B={displayName:O,delegateMention:m||null};p!==e.visibility&&(B.visibility=p),await a(B),n(!1)}catch(B){k(B instanceof Error?B.message:String(B))}finally{w(!1)}}return l.jsx(Rn,{open:t,onOpenChange:n,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:R,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{children:"Agent name"}),l.jsx(Ut,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Ut,{id:"id-display",value:c,onChange:L=>f(L.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:L=>g(L.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[l.jsx("option",{value:$1.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:$1.ORGANIZATION,children:"Organization — all members"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:C?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),E&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:L=>h(L.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None"}),(z=N.data)==null?void 0:z.map(L=>l.jsx("option",{value:L.uuid,children:L.displayName?`${L.displayName} (@${L.name??L.uuid})`:L.name?`@${L.name}`:L.uuid},L.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),S&&l.jsx("p",{className:"text-body text-destructive",children:S}),l.jsxs(fr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:x,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:x,children:x?"Saving…":"Save"})]})]})]})})}function C9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function N9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(kn,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{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(eb,{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(ra,{tone:C9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:_9(s.value)})]},s.key)})}),t&&l.jsx(T9,{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 _9(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 T9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,x]=b.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,S]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[k,E]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),x((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),S(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),E(null))},[e,n]);function C(N){if(N.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){E(`Another MCP server is already named "${f}".`);return}let R;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const z=g.trim().split(/\s+/).filter(L=>L.length>0);R={name:f,transport:"stdio",command:h.trim(),...z.length?{args:z}:{}}}else{const z=w.trim();try{new URL(z)}catch{E("URL is not valid.");return}R={name:f,transport:o,url:z}}s(R)}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(vt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:N=>c(N.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),l.jsx("option",{value:"http",children:"http"}),l.jsx("option",{value:"sse",children:"sse"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Ut,{id:"mcp-name",value:f,onChange:N=>m(N.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Ut,{id:"mcp-command",value:h,onChange:N=>p(N.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),l.jsx(Ut,{id:"mcp-args",value:g,onChange:N=>x(N.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Ut,{id:"mcp-url",value:w,onChange:N=>S(N.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(fr,{children:[l.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const A9=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],R9=[{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"}],O9={"claude-code":A9,codex:R9},z9={"claude-code":"Choose which Claude model powers this agent. Aliases (opus / sonnet / haiku) follow the CLI's latest-in-family mapping and may shift across releases. Applies to new sessions immediately; active sessions switch on their next message. Unset falls back to the operator's local ~/.claude/settings.json model preference, then the CLI default.",codex:"Pick a Codex model. Slugs come from the Codex CLI bundled with @openai/codex-sdk; ChatGPT-account auth currently only accepts gpt-5.5, while API-key auth accepts the wider set. Applies to new sessions immediately; active sessions switch on their next message. Unset lets the codex CLI choose a model that matches the user's auth mode."},M9={value:"",label:"(unset — inherits local)"};function D9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=O9[o],m=b.useMemo(()=>{const h=[M9,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(kn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Model",c&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),c&&l.jsx(ve,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Jn,{className:"space-y-2",children:[l.jsx(I9,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:z9[o]})]})]})}function I9({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[c,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(x=>x.value===t)??e[0],g=b.useCallback(()=>{const x=m.current;if(!x)return;const w=x.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const x=k=>{var C,N;const E=k.target;(C=m.current)!=null&&C.contains(E)||(N=h.current)!=null&&N.contains(E)||o(!1)},w=k=>{var E;k.key==="Escape"&&(o(!1),(E=m.current)==null||E.focus())},S=()=>g();return document.addEventListener("pointerdown",x),document.addEventListener("keydown",w),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(x=>!x),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(Sv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Av.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 L9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const P9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,U9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,B9={};function q1(e,t){return(B9.jsx?U9:P9).test(e)}const F9=/[ \t\n\f\r]/g;function $9(e){return typeof e=="object"?e.type==="text"?Z1(e.value):!1:Z1(e)}function Z1(e){return e.replace(F9,"")===""}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 qN(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 Py(e){return e.toLowerCase()}class _r{constructor(t,n){this.attribute=n,this.property=t}}_r.prototype.attribute="";_r.prototype.booleanish=!1;_r.prototype.boolean=!1;_r.prototype.commaOrSpaceSeparated=!1;_r.prototype.commaSeparated=!1;_r.prototype.defined=!1;_r.prototype.mustUseProperty=!1;_r.prototype.number=!1;_r.prototype.overloadedBoolean=!1;_r.prototype.property="";_r.prototype.spaceSeparated=!1;_r.prototype.space=void 0;let H9=0;const Je=rl(),wn=rl(),Uy=rl(),Se=rl(),Pt=rl(),ro=rl(),Lr=rl();function rl(){return 2**++H9}const By=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:wn,commaOrSpaceSeparated:Lr,commaSeparated:ro,number:Se,overloadedBoolean:Uy,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),pg=Object.keys(By);class tb extends _r{constructor(t,n,a,s){let o=-1;if(super(t,n),G1(this,"space",s),typeof a=="number")for(;++o<pg.length;){const c=pg[o];G1(this,pg[o],(a&By[c])===By[c])}}}tb.prototype.defined=!0;function G1(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 tb(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Py(a)]=a,n[Py(o.attribute)]=a}return new Lc(t,n,e.space)}const ZN=Ro({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Pt,ariaCurrent:null,ariaDescribedBy:Pt,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Pt,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Pt,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pt,ariaLevel:Se,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Pt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Pt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:wn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function GN(e,t){return t in e?e[t]:t}function VN(e,t){return GN(e,t.toLowerCase())}const q9=Ro({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ro,acceptCharset:Pt,accessKey:Pt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Pt,autoFocus:Je,autoPlay:Je,blocking:Pt,capture:null,charSet:null,checked:Je,cite:null,className:Pt,cols:Se,colSpan:null,content:null,contentEditable:wn,controls:Je,controlsList:Pt,coords:Se|ro,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:Uy,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Pt,height:Se,hidden:Uy,high:Se,href:null,hrefLang:null,htmlFor:Pt,httpEquiv:Pt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Pt,itemRef:Pt,itemScope:Je,itemType:Pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,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:Se,pattern:null,ping:Pt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Pt,required:Je,reversed:Je,rows:Se,rowSpan:Se,sandbox:Pt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:wn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,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:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:VN}),Z9=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:Lr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Lr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Lr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Lr,rev:Lr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Lr,requiredFeatures:Lr,requiredFonts:Lr,requiredFormats:Lr,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Lr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Lr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Lr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:GN}),QN=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()}}),KN=Ro({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:VN}),YN=Ro({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),G9={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"},V9=/[A-Z]/g,V1=/-[a-z]/g,Q9=/^data[-\w.:]+$/i;function K9(e,t){const n=Py(t);let a=t,s=_r;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q9.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(V1,X9);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!V1.test(o)){let c=o.replace(V9,Y9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=tb}return new s(a,t)}function Y9(e){return"-"+e.toLowerCase()}function X9(e){return e.charAt(1).toUpperCase()}const W9=qN([ZN,q9,QN,KN,YN],"html"),nb=qN([ZN,Z9,QN,KN,YN],"svg");function J9(e){return e.join(" ").trim()}var Hl={},gg,Q1;function eF(){if(Q1)return gg;Q1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
383
- `,h="/",p="*",g="",x="comment",w="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var N=1,R=1;function z(W){var X=W.match(t);X&&(N+=X.length);var Z=W.lastIndexOf(m);R=~Z?W.length-Z:R+W.length}function L(){var W={line:N,column:R};return function(X){return X.position=new O(W),Q(),X}}function O(W){this.start=W,this.end={line:N,column:R},this.source=C.source}O.prototype.content=E;function B(W){var X=new Error(C.source+":"+N+":"+R+": "+W);if(X.reason=W,X.filename=C.source,X.line=N,X.column=R,X.source=E,!C.silent)throw X}function I(W){var X=W.exec(E);if(X){var Z=X[0];return z(Z),E=E.slice(Z.length),X}}function Q(){I(n)}function D(W){var X;for(W=W||[];X=Y();)X!==!1&&W.push(X);return W}function Y(){var W=L();if(!(h!=E.charAt(0)||p!=E.charAt(1))){for(var X=2;g!=E.charAt(X)&&(p!=E.charAt(X)||h!=E.charAt(X+1));)++X;if(X+=2,g===E.charAt(X-1))return B("End of comment missing");var Z=E.slice(2,X-2);return R+=2,z(Z),E=E.slice(X),R+=2,W({type:x,comment:Z})}}function ae(){var W=L(),X=I(a);if(X){if(Y(),!I(s))return B("property missing ':'");var Z=I(o),te=W({type:w,property:k(X[0].replace(e,g)),value:Z?k(Z[0].replace(e,g)):g});return I(c),te}}function be(){var W=[];D(W);for(var X;X=ae();)X!==!1&&(W.push(X),D(W));return W}return Q(),be()}function k(E){return E?E.replace(f,g):g}return gg=S,gg}var K1;function tF(){if(K1)return Hl;K1=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={},Y1;function nF(){if(Y1)return Lu;Y1=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,X1;function rF(){if(X1)return Pu;X1=1;var e=Pu&&Pu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(tF()),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 aF=rF();const iF=nh(aF),XN=WN("end"),rb=WN("start");function WN(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 sF(e){const t=rb(e),n=XN(e);if(t&&n)return{start:t,end:n}}function ec(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?W1(e.position):"start"in e||"end"in e?W1(e):"line"in e||"column"in e?Fy(e):""}function Fy(e){return J1(e&&e.line)+":"+J1(e&&e.column)}function W1(e){return Fy(e&&e.start)+"-"+Fy(e&&e.end)}function J1(e){return e&&typeof e=="number"?e:1}class er extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(c=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=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 ab={}.hasOwnProperty,lF=new Map,oF=/[A-Z]/g,uF=new Set(["table","tbody","thead","tfoot","tr"]),cF=new Set(["td","th"]),JN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dF(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=bF(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=vF(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"?nb:W9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=e_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function e_(e,t,n){if(t.type==="element")return fF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return hF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return pF(e,t,n);if(t.type==="mdxjsEsm")return mF(e,t);if(t.type==="root")return gF(e,t,n);if(t.type==="text")return yF(e,t)}function fF(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=nb,e.schema=s),e.ancestors.push(t);const o=n_(e,t.tagName,!1),c=xF(e,t);let f=sb(e,t);return uF.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!$9(m):!0})),t_(e,c,o,t),ib(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function hF(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 mF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pc(e,t.position)}function pF(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=nb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:n_(e,t.name,!0),c=wF(e,t),f=sb(e,t);return t_(e,c,o,t),ib(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function gF(e,t,n){const a={};return ib(a,sb(e,t)),e.create(t,e.Fragment,a,n)}function yF(e,t){return t.value}function t_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function ib(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vF(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 bF(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=rb(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 xF(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&ab.call(t.properties,s)){const o=SF(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&cF.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 wF(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 sb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:lF;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=e_(e,o,c);f!==void 0&&n.push(f)}return n}function SF(e,t,n){const a=K9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?L9(n):J9(n)),a.property==="style"){let s=typeof n=="object"?n:kF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=jF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?G9[a.property]||a.property:a.attribute,n]}}function kF(e,t){try{return iF(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=JN+"#cannot-parse-style-attribute",s}}function n_(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,c;for(;++o<s.length;){const f=q1(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=q1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return ab.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=JN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function jF(e){const t={};let n;for(n in e)ab.call(e,n)&&(t[EF(n)]=e[n]);return t}function EF(e){let t=e.replace(oF,CF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CF(e){return"-"+e.toLowerCase()}const yg={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"]},NF={};function lb(e,t){const n=NF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return r_(e,a,s)}function r_(e,t,n){if(_F(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ek(e.children,t,n)}return Array.isArray(e)?ek(e,t,n):""}function ek(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=r_(e[s],t,n);return a.join("")}function _F(e){return!!(e&&typeof e=="object")}const tk=document.createElement("i");function ob(e){const t="&"+e+";";tk.innerHTML=t;const n=tk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Br(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 na(e,t){return e.length>0?(Br(e,e.length,0,t),e):t}const nk={}.hasOwnProperty;function a_(e){const t={};let n=-1;for(;++n<e.length;)TF(t,e[n]);return t}function TF(e,t){let n;for(n in t){const s=(nk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){nk.call(s,c)||(s[c]=[]);const f=o[c];AF(s[c],Array.isArray(f)?f:f?[f]:[])}}}function AF(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Br(e,0,0,a)}function i_(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 ba(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ur=gs(/[A-Za-z]/),Wn=gs(/[\dA-Za-z]/),RF=gs(/[#-'*+\--9=?A-Z^-~]/);function Yf(e){return e!==null&&(e<32||e===127)}const $y=gs(/\d/),OF=gs(/[\dA-Fa-f]/),zF=gs(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Nh=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 ot(m)?(e.enter(n),f(m)):t(m)}function f(m){return ot(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const MF={tokenize:DF};function DF(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 He(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const IF={tokenize:LF},rk={tokenize:PF};function LF(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&&N();const z=t.events.length;let L=z,O;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){O=t.events[L][1].end;break}C(a);let B=z;for(;B<t.events.length;)t.events[B][1].end={...O},B++;return Br(t.events,L+1,0,t.events.slice(z)),t.events.length=B,h(R)}return f(R)}function h(R){if(a===n.length){if(!s)return x(R);if(s.currentConstruct&&s.currentConstruct.concrete)return S(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rk,p,g)(R)}function p(R){return s&&N(),C(a),x(R)}function g(R){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,S(R)}function x(R){return t.containerState={},e.attempt(rk,w,S)(R)}function w(R){return a++,n.push([t.currentConstruct,t.containerState]),x(R)}function S(R){if(R===null){s&&N(),C(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),k(R)}function k(R){if(R===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(R);return}return He(R)?(e.consume(R),E(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(R),k)}function E(R,z){const L=t.sliceStream(R);if(z&&L.push(null),R.previous=o,o&&(o.next=R),o=R,s.defineSkip(R.start),s.write(L),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 B=t.events.length;let I=B,Q,D;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(Q){D=t.events[I][1].end;break}Q=!0}for(C(a),O=B;O<t.events.length;)t.events[O][1].end={...D},O++;Br(t.events,I+1,0,t.events.slice(B)),t.events.length=O}}function C(R){let z=n.length;for(;z-- >R;){const L=n[z];t.containerState=L[1],L[0].exit.call(t,e)}n.length=R}function N(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function PF(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||It(e)||Xs(e))return 1;if(Nh(e))return 2}function _h(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 Hy={name:"attention",resolveAll:UF,tokenize:BF};function UF(e,t){let n=-1,a,s,o,c,f,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},x={...e[n][1].start};ak(g,-m),ak(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=na(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=na(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=na(h,_h(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=na(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=na(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Br(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 BF(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 ak(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const FF={name:"autolink",tokenize:$F};function $F(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):RF(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 S=w===45?x:g;return e.consume(w),S}return n(w)}}const Pc={partial:!0,tokenize:HF};function HF(e,t,n){return a;function a(o){return ot(o)?xt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||He(o)?t(o):n(o)}}const s_={continuation:{tokenize:ZF},exit:GF,name:"blockQuote",tokenize:qF};function qF(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 ot(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function ZF(e,t,n){const a=this;return s;function s(c){return ot(c)?xt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(s_,t,n)(c)}}function GF(e){e.exit("blockQuote")}const l_={name:"characterEscape",tokenize:VF};function VF(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 zF(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const o_={name:"characterReference",tokenize:QF};function QF(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=OF,p):(e.enter("characterReferenceValue"),o=7,c=$y,p(g))}function p(g){if(g===59&&s){const x=e.exit("characterReferenceValue");return c===Wn&&!ob(a.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<o?(e.consume(g),p):n(g)}}const ik={partial:!0,tokenize:YF},sk={concrete:!0,name:"codeFenced",tokenize:KF};function KF(e,t,n){const a=this,s={partial:!0,tokenize:L};let o=0,c=0,f;return m;function m(O){return h(O)}function h(O){const B=a.events[a.events.length-1];return o=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[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"),ot(O)?xt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||He(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(ik,k,z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):ot(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||He(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?n(O):(e.consume(O),S)}function k(O){return e.attempt(s,z,E)(O)}function E(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return o>0&&ot(O)?xt(e,N,"linePrefix",o+1)(O):N(O)}function N(O){return O===null||He(O)?e.check(ik,k,z)(O):(e.enter("codeFlowValue"),R(O))}function R(O){return O===null||He(O)?(e.exit("codeFlowValue"),N(O)):(e.consume(O),R)}function z(O){return e.exit("codeFenced"),t(O)}function L(O,B,I){let Q=0;return D;function D(X){return O.enter("lineEnding"),O.consume(X),O.exit("lineEnding"),Y}function Y(X){return O.enter("codeFencedFence"),ot(X)?xt(O,ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):ae(X)}function ae(X){return X===f?(O.enter("codeFencedFenceSequence"),be(X)):I(X)}function be(X){return X===f?(Q++,O.consume(X),be):Q>=c?(O.exit("codeFencedFenceSequence"),ot(X)?xt(O,W,"whitespace")(X):W(X)):I(X)}function W(X){return X===null||He(X)?(O.exit("codeFencedFence"),B(X)):I(X)}}}function YF(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 vg={name:"codeIndented",tokenize:WF},XF={partial:!0,tokenize:JF};function WF(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):He(h)?e.attempt(XF,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||He(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function JF(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):He(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):He(c)?s(c):n(c)}}const e$={name:"codeText",previous:n$,resolve:t$,tokenize:r$};function t$(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 r$(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)):He(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||He(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 a${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 u_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new a$(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,i$(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 Br(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function i$(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let p,g,x=-1,w=n,S=0,k=0;const E=[k];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(p=a.sliceStream(w),w.next||p.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=n;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(k=x+1,E.push(k),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),x=E.length;x--;){const C=f.slice(E[x],E[x+1]),N=o.pop();m.push([N,N+C.length-1]),e.splice(N,2,C)}for(m.reverse(),x=-1;++x<m.length;)h[S+m[x][0]]=S+m[x][1],S+=m[x][1]-m[x][0]-1;return h}const s$={resolve:o$,tokenize:u$},l$={partial:!0,tokenize:c$};function o$(e){return u_(e),e}function u$(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):He(f)?e.check(l$,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 c$(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||He(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 c_(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"}),k(C))}function x(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),x(C)):C===null||C===60||He(C)?n(C):(e.consume(C),C===92?S:w)}function S(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function k(C){return!p&&(C===null||C===41||It(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):p<h&&C===40?(e.consume(C),p++,k):C===41?(e.consume(C),p--,k):C===null||C===32||C===40||Yf(C)?n(C):(e.consume(C),C===92?E:k)}function E(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function d_(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):He(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||He(w)||f++>999?(e.exit("chunkString"),p(w)):(e.consume(w),m||(m=!ot(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function f_(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):He(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||He(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 He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):ot(s)?xt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const d$={name:"definition",tokenize:h$},f$={partial:!0,tokenize:m$};function h$(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return d_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=ba(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return It(w)?tc(e,h)(w):h(w)}function h(w){return c_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(f$,g,g)(w)}function g(w){return ot(w)?xt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||He(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function m$(e,t,n){return a;function a(f){return It(f)?tc(e,s)(f):n(f)}function s(f){return f_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ot(f)?xt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||He(f)?t(f):n(f)}}const p$={name:"hardBreakEscape",tokenize:g$};function g$(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const y$={name:"headingAtx",resolve:v$,tokenize:b$};function v$(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"},Br(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function b$(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||It(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||He(p)?(e.exit("atxHeading"),t(p)):ot(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||It(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const x$=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lk=["pre","script","style","textarea"],w$={concrete:!0,name:"htmlFlow",resolveTo:j$,tokenize:E$},S$={partial:!0,tokenize:N$},k$={partial:!0,tokenize:C$};function j$(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 E$(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,k):T===63?(e.consume(T),s=3,a.interrupt?t:M):ur(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function x(T){return T===45?(e.consume(T),s=2,w):T===91?(e.consume(T),s=5,f=0,S):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 S(T){const G="CDATA[";return T===G.charCodeAt(f++)?(e.consume(T),f===G.length?a.interrupt?t:ae:S):n(T)}function k(T){return ur(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function E(T){if(T===null||T===47||T===62||It(T)){const G=T===47,q=c.toLowerCase();return!G&&!o&&lk.includes(q)?(s=1,a.interrupt?t(T):ae(T)):x$.includes(c.toLowerCase())?(s=6,G?(e.consume(T),C):a.interrupt?t(T):ae(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?N(T):R(T))}return T===45||Wn(T)?(e.consume(T),c+=String.fromCharCode(T),E):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:ae):n(T)}function N(T){return ot(T)?(e.consume(T),N):D(T)}function R(T){return T===47?(e.consume(T),D):T===58||T===95||ur(T)?(e.consume(T),z):ot(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):L(T)}function L(T){return T===61?(e.consume(T),O):ot(T)?(e.consume(T),L):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,B):ot(T)?(e.consume(T),O):I(T)}function B(T){return T===m?(e.consume(T),m=null,Q):T===null||He(T)?n(T):(e.consume(T),B)}function I(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||It(T)?L(T):(e.consume(T),I)}function Q(T){return T===47||T===62||ot(T)?R(T):n(T)}function D(T){return T===62?(e.consume(T),Y):n(T)}function Y(T){return T===null||He(T)?ae(T):ot(T)?(e.consume(T),Y):n(T)}function ae(T){return T===45&&s===2?(e.consume(T),Z):T===60&&s===1?(e.consume(T),te):T===62&&s===4?(e.consume(T),P):T===63&&s===3?(e.consume(T),M):T===93&&s===5?(e.consume(T),Ae):He(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(S$,F,be)(T)):T===null||He(T)?(e.exit("htmlFlowData"),be(T)):(e.consume(T),ae)}function be(T){return e.check(k$,W,F)(T)}function W(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),X}function X(T){return T===null||He(T)?be(T):(e.enter("htmlFlowData"),ae(T))}function Z(T){return T===45?(e.consume(T),M):ae(T)}function te(T){return T===47?(e.consume(T),c="",je):ae(T)}function je(T){if(T===62){const G=c.toLowerCase();return lk.includes(G)?(e.consume(T),P):ae(T)}return ur(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),je):ae(T)}function Ae(T){return T===93?(e.consume(T),M):ae(T)}function M(T){return T===62?(e.consume(T),P):T===45&&s===2?(e.consume(T),M):ae(T)}function P(T){return T===null||He(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),P)}function F(T){return e.exit("htmlFlow"),t(T)}}function C$(e,t,n){const a=this;return s;function s(c){return He(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 N$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Pc,t,n)}}const _$={name:"htmlText",tokenize:T$};function T$(e,t,n){const a=this;let s,o,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),L):M===63?(e.consume(M),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,S):ur(M)?(e.consume(M),N):n(M)}function p(M){return M===45?(e.consume(M),w):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),x):He(M)?(c=g,te(M)):(e.consume(M),g)}function x(M){return M===45?(e.consume(M),w):g(M)}function w(M){return M===62?Z(M):M===45?x(M):g(M)}function S(M){const P="CDATA[";return M===P.charCodeAt(o++)?(e.consume(M),o===P.length?k:S):n(M)}function k(M){return M===null?n(M):M===93?(e.consume(M),E):He(M)?(c=k,te(M)):(e.consume(M),k)}function E(M){return M===93?(e.consume(M),C):k(M)}function C(M){return M===62?Z(M):M===93?(e.consume(M),C):k(M)}function N(M){return M===null||M===62?Z(M):He(M)?(c=N,te(M)):(e.consume(M),N)}function R(M){return M===null?n(M):M===63?(e.consume(M),z):He(M)?(c=R,te(M)):(e.consume(M),R)}function z(M){return M===62?Z(M):R(M)}function L(M){return ur(M)?(e.consume(M),O):n(M)}function O(M){return M===45||Wn(M)?(e.consume(M),O):B(M)}function B(M){return He(M)?(c=B,te(M)):ot(M)?(e.consume(M),B):Z(M)}function I(M){return M===45||Wn(M)?(e.consume(M),I):M===47||M===62||It(M)?Q(M):n(M)}function Q(M){return M===47?(e.consume(M),Z):M===58||M===95||ur(M)?(e.consume(M),D):He(M)?(c=Q,te(M)):ot(M)?(e.consume(M),Q):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),ae):He(M)?(c=Y,te(M)):ot(M)?(e.consume(M),Y):Q(M)}function ae(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,be):He(M)?(c=ae,te(M)):ot(M)?(e.consume(M),ae):(e.consume(M),W)}function be(M){return M===s?(e.consume(M),s=void 0,X):M===null?n(M):He(M)?(c=be,te(M)):(e.consume(M),be)}function W(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||It(M)?Q(M):(e.consume(M),W)}function X(M){return M===47||M===62||It(M)?Q(M):n(M)}function Z(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function te(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),je}function je(M){return ot(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 ub={name:"labelEnd",resolveAll:z$,resolveTo:M$,tokenize:D$},A$={tokenize:I$},R$={tokenize:L$},O$={tokenize:P$};function z$(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&&Br(e,0,e.length,n),e}function M$(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=na(f,e.slice(o+1,o+a+3)),f=na(f,[["enter",p,t]]),f=na(f,_h(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=na(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=na(f,e.slice(c+1)),f=na(f,[["exit",m,t]]),Br(e,o,e.length,f),e}function D$(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(ba(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(A$,p,c?p:g)(x):x===91?e.attempt(R$,p,c?h:g)(x):c?p(x):g(x)}function h(x){return e.attempt(O$,p,g)(x)}function p(x){return t(x)}function g(x){return o._balanced=!0,n(x)}}function I$(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return It(g)?tc(e,o)(g):o(g)}function o(g){return g===41?p(g):c_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return It(g)?tc(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?f_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return It(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 L$(e,t,n){const a=this;return s;function s(f){return d_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(ba(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function P$(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 U$={name:"labelStartImage",resolveAll:ub.resolveAll,tokenize:B$};function B$(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 F$={name:"labelStartLink",resolveAll:ub.resolveAll,tokenize:$$};function $$(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 bg={name:"lineEnding",tokenize:H$};function H$(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:q$};function q$(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||He(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),ot(h)?xt(e,f,"whitespace")(h):f(h))}}const xr={continuation:{tokenize:Q$},exit:Y$,name:"list",tokenize:V$},Z$={partial:!0,tokenize:X$},G$={partial:!0,tokenize:K$};function V$(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const S=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:$y(w)){if(a.containerState.type||(a.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(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 $y(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(Z$,x,g))}function p(w){return a.containerState.initialBlankLine=!0,o++,x(w)}function g(w){return ot(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 Q$(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||!ot(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(G$,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 K$(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 Y$(e){e.exit(this.containerState.type)}function X$(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!ot(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const ok={name:"setextUnderline",resolveTo:W$,tokenize:J$};function W$(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 J$(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"),ot(h)?xt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||He(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const e8={tokenize:t8};function t8(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(s$,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:m_()},r8=h_("string"),a8=h_("text");function h_(e){return{resolveAll:m_(e==="text"?i8: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 m_(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 i8(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 s8={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:s_},l8={91:d$},o8={[-2]:vg,[-1]:vg,32:vg},u8={35:y$,42:Mf,45:[ok,Mf],60:w$,61:ok,95:Mf,96:sk,126:sk},c8={38:o_,92:l_},d8={[-5]:bg,[-4]:bg,[-3]:bg,33:U$,38:o_,42:Hy,60:[FF,_$],91:F$,92:[p$,l_],93:ub,95:Hy,96:e$},f8={null:[Hy,n8]},h8={null:[42,95]},m8={null:[]},p8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:h8,contentInitial:l8,disable:m8,document:s8,flow:u8,flowInitial:o8,insideSpan:f8,string:c8,text:d8},Symbol.toStringTag,{value:"Module"}));function g8(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:B(L),check:B(O),consume:N,enter:R,exit:z,interrupt:B(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(Y){return c=na(c,Y),E(),c[c.length-1]!==null?[]:(I(t,0),h.events=_h(o,h.events,h),h.events)}function x(Y,ae){return v8(w(Y),ae)}function w(Y){return y8(c,Y)}function S(){const{_bufferIndex:Y,_index:ae,line:be,column:W,offset:X}=a;return{_bufferIndex:Y,_index:ae,line:be,column:W,offset:X}}function k(Y){s[Y.line]=Y.column,D()}function E(){let Y;for(;a._index<c.length;){const ae=c[a._index];if(typeof ae=="string")for(Y=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Y&&a._bufferIndex<ae.length;)C(ae.charCodeAt(a._bufferIndex));else C(ae)}}function C(Y){p=p(Y)}function N(Y){He(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,ae){const be=ae||{};return be.type=Y,be.start=S(),h.events.push(["enter",be,h]),f.push(be),be}function z(Y){const ae=f.pop();return ae.end=S(),h.events.push(["exit",ae,h]),ae}function L(Y,ae){I(Y,ae.from)}function O(Y,ae){ae.restore()}function B(Y,ae){return be;function be(W,X,Z){let te,je,Ae,M;return Array.isArray(W)?F(W):"tokenize"in W?F([W]):P(W);function P(re){return xe;function xe(we){const me=we!==null&&re[we],De=we!==null&&re.null,Ue=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(De)?De:De?[De]:[]];return F(Ue)(we)}}function F(re){return te=re,je=0,re.length===0?Z:T(re[je])}function T(re){return xe;function xe(we){return M=Q(),Ae=re,re.partial||(h.currentConstruct=re),re.name&&h.parser.constructs.disable.null.includes(re.name)?q():re.tokenize.call(ae?Object.assign(Object.create(h),ae):h,m,G,q)(we)}}function G(re){return Y(Ae,M),X}function q(re){return M.restore(),++je<te.length?T(te[je]):Z}}}function I(Y,ae){Y.resolveAll&&!o.includes(Y)&&o.push(Y),Y.resolve&&Br(h.events,ae,h.events.length-ae,Y.resolve(h.events.slice(ae),h)),Y.resolveTo&&(h.events=Y.resolveTo(h.events,h))}function Q(){const Y=S(),ae=h.previous,be=h.currentConstruct,W=h.events.length,X=Array.from(f);return{from:W,restore:Z};function Z(){a=Y,h.previous=ae,h.currentConstruct=be,h.events.length=W,f=X,D()}}function D(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function y8(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 v8(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=`
384
- `;break}case-3:{c=`\r
385
- `;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 b8(e){const a={constructs:a_([p8,...(e||{}).extensions||[]]),content:s(MF),defined:[],document:s(IF),flow:s(e8),lazy:{},string:s(r8),text:s(a8)};return a;function s(o){return c;function c(f){return g8(a,o,f)}}}function x8(e){for(;!u_(e););return e}const uk=/[\0\t\n\r]/g;function w8(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,x,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(uk.lastIndex=g,h=uk.exec(o),x=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(x),!h){t=o.slice(g);break}if(w===10&&g===x&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<x&&(m.push(o.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=x+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const S8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function k8(e){return e.replace(S8,j8)}function j8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return i_(n.slice(o?2:1),o?16:10)}return ob(n)||e}const p_={}.hasOwnProperty;function E8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),C8(n)(x8(b8(n).document().write(w8()(e,t,!0))))}function C8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o($t),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:o(le),blockQuote:o(De),characterEscape:Q,characterReference:Q,codeFenced:o(Ue),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ue,c),codeText:o(ft,c),codeTextData:Q,data:Q,codeFlowValue:Q,definition:o(ut),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(ie),hardBreakEscape:o(ge),hardBreakTrailing:o(ge),htmlFlow:o(Le,c),htmlFlowData:Q,htmlText:o(Le,c),htmlTextData:Q,image:o(zt),label:c,link:o($t),listItem:o(hr),listItemValue:x,listOrdered:o(Pn,g),listUnordered:o(Pn),paragraph:o(pi),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(le),strong:o(gi),thematicBreak:o(da)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:me,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:re,characterReference:xe,codeFenced:m(E),codeFencedFence:k,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:m(C),codeText:m(X),codeTextData:D,data:D,definition:m(),definitionDestinationString:z,definitionLabelString:N,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(ae),hardBreakTrailing:m(ae),htmlFlow:m(be),htmlFlowData:D,htmlText:m(W),htmlTextData:D,image:m(te),label:Ae,labelText:je,lineEnding:Y,link:m(Z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:G,resourceDestinationString:M,resourceTitleString:P,resource:F,setextHeading:m(I),setextHeadingLineSequence:B,setextHeadingText:O,strong:m(),thematicBreak:m()}};g_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(ue){let ye={type:"root",children:[]};const Fe={stack:[ye],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Ve=[];let at=-1;for(;++at<ue.length;)if(ue[at][1].type==="listOrdered"||ue[at][1].type==="listUnordered")if(ue[at][0]==="enter")Ve.push(at);else{const cn=Ve.pop();at=s(ue,cn,at)}for(at=-1;++at<ue.length;){const cn=t[ue[at][0]];p_.call(cn,ue[at][1].type)&&cn[ue[at][1].type].call(Object.assign({sliceSerialize:ue[at][2].sliceSerialize},Fe),ue[at][1])}if(Fe.tokenStack.length>0){const cn=Fe.tokenStack[Fe.tokenStack.length-1];(cn[1]||ck).call(Fe,void 0,cn[0])}for(ye.position={start:qi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:qi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},at=-1;++at<t.transforms.length;)ye=t.transforms[at](ye)||ye;return ye}function s(ue,ye,Fe){let Ve=ye-1,at=-1,cn=!1,tr,Ht,Lt,Tt;for(;++Ve<=Fe;){const it=ue[Ve];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?at++:at--,Tt=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(tr&&!Tt&&!at&&!Lt&&(Lt=Ve),Tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Tt=void 0}if(!at&&it[0]==="enter"&&it[1].type==="listItemPrefix"||at===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(tr){let nr=Ve;for(Ht=void 0;nr--;){const zn=ue[nr];if(zn[1].type==="lineEnding"||zn[1].type==="lineEndingBlank"){if(zn[0]==="exit")continue;Ht&&(ue[Ht][1].type="lineEndingBlank",cn=!0),zn[1].type="lineEnding",Ht=nr}else if(!(zn[1].type==="linePrefix"||zn[1].type==="blockQuotePrefix"||zn[1].type==="blockQuotePrefixWhitespace"||zn[1].type==="blockQuoteMarker"||zn[1].type==="listItemIndent"))break}Lt&&(!Ht||Lt<Ht)&&(tr._spread=!0),tr.end=Object.assign({},Ht?ue[Ht][1].start:it[1].end),ue.splice(Ht||Ve,0,["exit",tr,it[2]]),Ve++,Fe++}if(it[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};tr=nr,ue.splice(Ve,0,["enter",nr,it[2]]),Ve++,Fe++,Lt=void 0,Tt=!0}}}return ue[ye][1]._spread=cn,Fe}function o(ue,ye){return Fe;function Fe(Ve){f.call(this,ue(Ve),Ve),ye&&ye.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ue,ye,Fe){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ye,Fe||void 0]),ue.position={start:qi(ye.start),end:void 0}}function m(ue){return ye;function ye(Fe){ue&&ue.call(this,Fe),h.call(this,Fe)}}function h(ue,ye){const Fe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==ue.type&&(ye?ye.call(this,ue,Ve[0]):(Ve[1]||ck).call(this,ue,Ve[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ec({start:ue.start,end:ue.end})+"): it’s not open");Fe.position.end=qi(ue.end)}function p(){return lb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ue}function S(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ue}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/(\r?\n|\r)$/g,"")}function N(ue){const ye=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.identifier=ba(this.sliceSerialize(ue)).toLowerCase()}function R(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function z(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function L(ue){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Fe=this.sliceSerialize(ue).length;ye.depth=Fe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function B(ue){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(ue){const Fe=this.stack[this.stack.length-1].children;let Ve=Fe[Fe.length-1];(!Ve||Ve.type!=="text")&&(Ve=un(),Ve.position={start:qi(ue.start),end:void 0},Fe.push(Ve)),this.stack.push(Ve)}function D(ue){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ue),ye.position.end=qi(ue.end)}function Y(ue){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=ye.children[ye.children.length-1];Fe.position.end=qi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(Q.call(this,ue),D.call(this,ue))}function ae(){this.data.atHardBreak=!0}function be(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function W(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function X(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function Z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function te(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function je(ue){const ye=this.sliceSerialize(ue),Fe=this.stack[this.stack.length-2];Fe.label=k8(ye),Fe.identifier=ba(ye).toLowerCase()}function Ae(){const ue=this.stack[this.stack.length-1],ye=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Ve=ue.children;Fe.children=Ve}else Fe.alt=ye}function M(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function P(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function F(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function G(ue){const ye=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.identifier=ba(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function q(ue){this.data.characterReferenceType=ue.type}function re(ue){const ye=this.sliceSerialize(ue),Fe=this.data.characterReferenceType;let Ve;Fe?(Ve=i_(ye,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=ob(ye);const at=this.stack[this.stack.length-1];at.value+=Ve}function xe(ue){const ye=this.stack.pop();ye.position.end=qi(ue.end)}function we(ue){D.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ue)}function me(ue){D.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ue)}function De(){return{type:"blockquote",children:[]}}function Ue(){return{type:"code",lang:null,meta:null,value:""}}function ft(){return{type:"inlineCode",value:""}}function ut(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function le(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function Le(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function $t(){return{type:"link",title:null,url:"",children:[]}}function Pn(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function hr(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function pi(){return{type:"paragraph",children:[]}}function gi(){return{type:"strong",children:[]}}function un(){return{type:"text",value:""}}function da(){return{type:"thematicBreak"}}}function qi(e){return{line:e.line,column:e.column,offset:e.offset}}function g_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?g_(e,a):N8(e,a)}}function N8(e,t){let n;for(n in t)if(p_.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function ck(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+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 _8(e){const t=this;t.parser=n;function n(a){return E8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function T8(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 A8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
386
- `}]}function R8(e,t){const n=t.value?t.value+`
387
- `:"",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 O8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function z8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=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 D8(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 I8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function y_(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 L8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return y_(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 P8(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 U8(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 B8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return y_(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 F8(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 $8(e,t,n){const a=e.all(t),s=n?H8(n):v_(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:`
388
- `}),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:`
389
- `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function H8(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=v_(n[a])}return t}function v_(e){const t=e.spread;return t??e.children.length>1}function q8(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const c=a[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function Z8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function V8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q8(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=rb(t.children[1]),m=XN(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 K8(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),h.push(S)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function Y8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const dk=9,fk=32;function X8(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(hk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(hk(t.slice(s),s>0,!1)),o.join("")}function hk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===dk||o===fk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===dk||o===fk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function W8(e,t){const n={type:"text",value:X8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function J8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const eH={blockquote:T8,break:A8,code:R8,delete:O8,emphasis:z8,footnoteReference:M8,heading:D8,html:I8,imageReference:L8,image:P8,inlineCode:U8,linkReference:B8,link:F8,listItem:$8,list:q8,paragraph:Z8,root:G8,strong:V8,table:Q8,tableCell:Y8,tableRow:K8,text:W8,thematicBreak:J8,toml:vf,yaml:vf,definition:vf,footnoteDefinition:vf};function vf(){}const b_=-1,Th=0,nc=1,Xf=2,cb=3,db=4,fb=5,hb=6,x_=7,w_=8,mk=typeof self=="object"?self:globalThis,tH=(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 Th:case b_: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 cb:return n(new Date(c),s);case db:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case fb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case hb:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case x_:{const{name:f,message:m}=c;return n(new mk[f](m),s)}case w_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new mk[o](c),s)};return a},pk=e=>tH(new Map,e)(0),ql="",{toString:nH}={},{keys:rH}=Object,Bu=e=>{const t=typeof e;if(t!=="object"||!e)return[Th,t];const n=nH.call(e).slice(8,-1);switch(n){case"Array":return[nc,ql];case"Object":return[Xf,ql];case"Date":return[cb,ql];case"RegExp":return[db,ql];case"Map":return[fb,ql];case"Set":return[hb,ql];case"DataView":return[nc,n]}return n.includes("Array")?[nc,n]:n.includes("Error")?[x_,n]:[Xf,n]},bf=([e,t])=>e===Th&&(t==="function"||t==="symbol"),aH=(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 Th:{let p=c;switch(m){case"bigint":f=w_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([b_],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 rH(c))(e||!bf(Bu(c[x])))&&p.push([o(x),o(c[x])]);return g}case cb:return s([f,c.toISOString()],c);case db:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case fb:{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 hb:{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},gk=(e,{json:t,lossy:n}={})=>{const a=[];return aH(!(t||n),!!t,new Map,a)(e),a},Wf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pk(gk(e,t)):structuredClone(e):(e,t)=>pk(gk(e,t));function iH(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 sH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||iH,a=e.options.footnoteBackLabel||sH,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 S=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++w<=k;){S.length>0&&S.push({type:"text",value:" "});let N=typeof n=="string"?n:n(m,w);typeof N=="string"&&(N={type:"text",value:N}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const E=p[p.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const N=E.children[E.children.length-1];N&&N.type==="text"?N.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else p.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(p,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Wf(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
390
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
391
- `}]}}const Ah=(function(e){if(e==null)return dH;if(typeof e=="function")return Rh(e);if(typeof e=="object")return Array.isArray(e)?oH(e):uH(e);if(typeof e=="string")return cH(e);throw new Error("Expected function, string, or object as test")});function oH(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ah(e[n]);return Rh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function uH(e){const t=e;return Rh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function cH(e){return Rh(t);function t(n){return n&&n.type===e}}function Rh(e){return t;function t(n,a,s){return!!(fH(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function dH(){return!0}function fH(e){return e!==null&&typeof e=="object"&&"type"in e}const S_=[],hH=!0,qy=!1,mH="skip";function k_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Ah(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=S_,S,k,E;if((!t||o(m,h,p[p.length-1]||void 0))&&(w=pH(n(m,p)),w[0]===qy))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==mH)for(k=(a?C.children.length:-1)+c,E=p.concat(C);k>-1&&k<C.children.length;){const N=C.children[k];if(S=f(N,k,E)(),S[0]===qy)return S;k=typeof S[1]=="number"?S[1]:k+c}}return w}}}function pH(e){return Array.isArray(e)?e:typeof e=="number"?[hH,e]:e==null?S_:[e]}function mb(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),k_(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 Zy={}.hasOwnProperty,gH={};function yH(e,t){const n=t||gH,a=new Map,s=new Map,o=new Map,c={...eH,...n.handlers},f={all:h,applyData:bH,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:vH,wrap:wH};return mb(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(Zy.call(f.handlers,x)&&w)return w(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in p){const{children:k,...E}=p,C=Wf(E);return C.children=f.all(p),C}return Wf(p)}return(f.options.unknownHandler||xH)(f,p,g)}function h(p){const g=[];if("children"in p){const x=p.children;let w=-1;for(;++w<x.length;){const S=f.one(x[w],p);if(S){if(w&&x[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=yk(S.value)),!Array.isArray(S)&&S.type==="element")){const k=S.children[0];k&&k.type==="text"&&(k.value=yk(k.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function vH(e,t){e.position&&(t.position=sF(e))}function bH(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 xH(e,t){const n=t.data||{},a="value"in t&&!(Zy.call(n,"hProperties")||Zy.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 wH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
392
- `});++a<e.length;)a&&n.push({type:"text",value:`
393
- `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
394
- `}),n}function yk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vk(e,t){const n=yH(e,t),a=n.one(e,void 0),s=lH(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
395
- `},s),o}function SH(e,t){return e&&"run"in e?async function(n,a){const s=vk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return vk(n,{file:a,...e||t})}}function bk(e){if(e)throw e}var xg,xk;function kH(){if(xk)return xg;xk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var x;for(x in h);return typeof x>"u"||e.call(h,x)},c=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return xg=function m(){var h,p,g,x,w,S,k=arguments[0],E=1,C=arguments.length,N=!1;for(typeof k=="boolean"&&(N=k,k=arguments[1]||{},E=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});E<C;++E)if(h=arguments[E],h!=null)for(p in h)g=f(k,p),x=f(h,p),k!==x&&(N&&x&&(o(x)||(w=s(x)))?(w?(w=!1,S=g&&s(g)?g:[]):S=g&&o(g)?g:{},c(k,{name:p,newValue:m(N,S,x)})):typeof x<"u"&&c(k,{name:p,newValue:x}));return k},xg}var jH=kH();const wg=nh(jH);function Gy(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 EH(){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?CH(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 CH(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 Na={basename:NH,dirname:_H,extname:TH,join:AH,sep:"/"};function NH(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 _H(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 TH(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 AH(...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?".":RH(n)}function RH(e){Uc(e);const t=e.codePointAt(0)===47;let n=OH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function OH(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 zH={cwd:MH};function MH(){return"/"}function Vy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function DH(e){if(typeof e=="string")e=new URL(e);else if(!Vy(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 IH(e)}function IH(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 Sg=["history","path","basename","stem","extname","dirname"];class j_{constructor(t){let n;t?Vy(t)?n={path:t}:typeof t=="string"||LH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":zH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Sg.length;){const o=Sg[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)Sg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Na.basename(this.path):void 0}set basename(t){jg(t,"basename"),kg(t,"basename"),this.path=Na.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Na.dirname(this.path):void 0}set dirname(t){wk(this.basename,"dirname"),this.path=Na.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Na.extname(this.path):void 0}set extname(t){if(kg(t,"extname"),wk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Na.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Vy(t)&&(t=DH(t)),jg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Na.basename(this.path,this.extname):void 0}set stem(t){jg(t,"stem"),kg(t,"stem"),this.path=Na.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 kg(e,t){if(e&&e.includes(Na.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Na.sep+"`")}function jg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function LH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PH=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),UH={}.hasOwnProperty;class pb extends PH{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=EH()}copy(){const t=new pb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(wg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ng("data",this.frozen),this.namespace[t]=n,this):UH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ng("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 Eg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Eg("process",this.parser||this.Parser),Cg("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,S=a.stringify(w,x);$H(S)?x.value=S:x.result=S,h(p,x)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Eg("processSync",this.parser||this.Parser),Cg("processSync",this.compiler||this.Compiler),this.process(t,s),kk("processSync","process",n),a;function s(o,c){n=!0,bk(o),a=c}}run(t,n,a){Sk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=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),kk("runSync","run",a),s;function o(c,f){bk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=xf(n),s=this.compiler||this.Compiler;return Cg("stringify",s),Sk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Ng("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=wg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,x=-1;for(;++g<a.length;)if(a[g][0]===h){x=g;break}if(x===-1)a.push([h,...p]);else if(p.length>0){let[w,...S]=p;const k=a[x][1];Gy(k)&&Gy(w)&&(w=wg(!0,k,w)),a[x]=[h,w,...S]}}}}const BH=new pb().freeze();function Eg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ng(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sk(e){if(!Gy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xf(e){return FH(e)?e:new j_(e)}function FH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function $H(e){return typeof e=="string"||HH(e)}function HH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jk=[],Ek={allowDangerousHtml:!0},ZH=/^(https?|ircs?|mailto|xmpp)$/i,GH=[{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 VH(e){const t=QH(e),n=KH(e);return YH(t.runSync(t.parse(n),n),e)}function QH(e){const t=e.rehypePlugins||jk,n=e.remarkPlugins||jk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ek}:Ek;return BH().use(_8).use(n).use(SH,a).use(t)}function KH(e){const t=e.children||"",n=new j_;return typeof t=="string"&&(n.value=t),n}function YH(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||XH;for(const p of GH)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+qH+p.id,void 0);return mb(e,h),dF(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 yg)if(Object.hasOwn(yg,w)&&Object.hasOwn(p.properties,w)){const S=p.properties[w],k=yg[w];(k===null||k.includes(p.tagName))&&(p.properties[w]=m(String(S||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(p,g,x)),w&&x&&typeof g=="number")return f&&p.children?x.children.splice(g,1,...p.children):x.children.splice(g,1),g}}}function XH(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||ZH.test(e.slice(0,t))?e:""}function WH(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function E_(e,t,n){const s=Ah((n||{}).ignore||[]),o=JH(t);let c=-1;for(;++c<o.length;)k_(e,"text",f);function f(h,p){let g=-1,x;for(;++g<p.length;){const w=p[g],S=x?x.children:void 0;if(s(w,S?S.indexOf(w):void 0,x))return;x=w}if(x)return m(h,p)}function m(h,p){const g=p[p.length-1],x=o[c][0],w=o[c][1];let S=0;const E=g.children.indexOf(h);let C=!1,N=[];x.lastIndex=0;let R=x.exec(h.value);for(;R;){const z=R.index,L={index:R.index,input:R.input,stack:[...p,h]};let O=w(...R,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?x.lastIndex=z+1:(S!==z&&N.push({type:"text",value:h.value.slice(S,z)}),Array.isArray(O)?N.push(...O):O&&N.push(O),S=z+R[0].length,C=!0),!x.global)break;R=x.exec(h.value)}return C?(S<h.value.length&&N.push({type:"text",value:h.value.slice(S)}),g.children.splice(E,1,...N)):N=[h],E+N.length}}function JH(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]),tq(s[1])])}return t}function eq(e){return typeof e=="string"?new RegExp(WH(e),"g"):e}function tq(e){return typeof e=="function"?e:function(){return e}}function nq(e){E_(e,[/\r?\n|\r/g,rq])}function rq(){return{type:"break"}}function aq(){return function(e){nq(e)}}function Ck(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const _g="phrasing",Tg=["autolink","link","image","label"];function iq(){return{transforms:[fq],enter:{literalAutolink:lq,literalAutolinkEmail:Ag,literalAutolinkHttp:Ag,literalAutolinkWww:Ag},exit:{literalAutolink:dq,literalAutolinkEmail:cq,literalAutolinkHttp:oq,literalAutolinkWww:uq}}}function sq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_g,notInConstruct:Tg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_g,notInConstruct:Tg},{character:":",before:"[ps]",after:"\\/",inConstruct:_g,notInConstruct:Tg}]}}function lq(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ag(e){this.config.enter.autolinkProtocol.call(this,e)}function oq(e){this.config.exit.autolinkProtocol.call(this,e)}function uq(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 cq(e){this.config.exit.autolinkEmail.call(this,e)}function dq(e){this.exit(e)}function fq(e){E_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,hq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),mq]],{ignore:["link","linkReference"]})}function hq(e,t,n,a,s){let o="";if(!C_(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!pq(n)))return!1;const c=gq(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 mq(e,t,n,a){return!C_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function pq(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 gq(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=Ck(e,"(");let o=Ck(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function C_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xs(n)||Nh(n))&&(!t||n!==47)}N_.peek=Eq;function yq(){this.buffer()}function vq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bq(){this.buffer()}function xq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function wq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Sq(e){this.exit(e)}function kq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jq(e){this.exit(e)}function Eq(){return"["}function N_(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 Cq(){return{enter:{gfmFootnoteCallString:yq,gfmFootnoteCall:vq,gfmFootnoteDefinitionLabelString:bq,gfmFootnoteDefinition:xq},exit:{gfmFootnoteCallString:wq,gfmFootnoteCall:Sq,gfmFootnoteDefinitionLabelString:kq,gfmFootnoteDefinition:jq}}}function Nq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:N_},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?`
396
- `:" ")+o.indentLines(o.containerFlow(a,f.current()),t?__:_q))),h(),m}}function _q(e,t,n){return t===0?e:__(e,t,n)}function __(e,t,n){return(n?"":" ")+e}const Tq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];T_.peek=Mq;function Aq(){return{canContainEols:["delete"],enter:{strikethrough:Oq},exit:{strikethrough:zq}}}function Rq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Tq}],handlers:{delete:T_}}}function Oq(e){this.enter({type:"delete",children:[]},e)}function zq(e){this.exit(e)}function T_(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),o(),c}function Mq(){return"~"}function Dq(e){return e.length}function Iq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||Dq,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const k=[],E=[];let C=-1;for(e[p].length>h&&(h=e[p].length);++C<e[p].length;){const N=Lq(e[p][C]);if(n.alignDelimiters!==!1){const R=s(N);E[C]=R,(m[C]===void 0||R>m[C])&&(m[C]=R)}k.push(N)}c[p]=k,f[p]=E}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Nk(a[g]);else{const k=Nk(a);for(;++g<h;)o[g]=k}g=-1;const x=[],w=[];for(;++g<h;){const k=o[g];let E="",C="";k===99?(E=":",C=":"):k===108?E=":":k===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,m[g]-E.length-C.length);const R=E+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=E.length+N+C.length,N>m[g]&&(m[g]=N),w[g]=N),x[g]=R}c.splice(1,0,x),f.splice(1,0,w),p=-1;const S=[];for(;++p<c.length;){const k=c[p],E=f[p];g=-1;const C=[];for(;++g<h;){const N=k[g]||"";let R="",z="";if(n.alignDelimiters!==!1){const L=m[g]-(E[g]||0),O=o[g];O===114?R=" ".repeat(L):O===99?L%2?(R=" ".repeat(L/2+.5),z=" ".repeat(L/2-.5)):(R=" ".repeat(L/2),z=R):z=" ".repeat(L)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(R),C.push(N),n.alignDelimiters!==!1&&C.push(z),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}S.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
397
- `)}function Lq(e){return e==null?"":String(e)}function Nk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Pq(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()),Uq);return s(),c}function Uq(e,t,n){return">"+(n?"":" ")+e}function Bq(e,t){return _k(e,t.inConstruct,!0)&&!_k(e,t.notInConstruct,!1)}function _k(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Tk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
398
- `&&Bq(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
399
- `}function Fq(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 $q(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 Hq(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 qq(e,t,n,a){const s=Hq(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if($q(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(o,Zq);return g(),x}const f=n.createTracker(a),m=s.repeat(Math.max(Fq(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:`
400
- `,encode:["`"],...f.current()})),g()}return p+=f.move(`
401
- `),o&&(p+=f.move(o+`
402
- `)),p+=f.move(m),h(),p}function Zq(e,t,n){return(n?"":" ")+e}function gb(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 Gq(e,t,n,a){const s=gb(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?" ":`
403
- `,...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 Vq(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}}A_.peek=Qq;function A_(e,t,n,a){const s=Vq(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 Qq(e,t,n){return n.options.emphasis||"*"}function Kq(e,t){let n=!1;return mb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,qy}),!!((!e.depth||e.depth<3)&&lb(e)&&(t.options.setext||n))}function Yq(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(Kq(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
404
- `,after:`
405
- `});return g(),p(),x+`
406
- `+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
407
- `))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
408
- `,...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}R_.peek=Xq;function R_(e){return e.value||""}function Xq(){return"<"}O_.peek=Wq;function O_(e,t,n,a){const s=gb(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 Wq(){return"!"}z_.peek=Jq;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 Jq(){return"!"}M_.peek=e7;function M_(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 D_(e,t){const n=lb(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))}I_.peek=t7;function I_(e,t,n,a){const s=gb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(D_(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 t7(e,t,n){return D_(e,n)?"<":"["}L_.peek=n7;function L_(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 yb(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 r7(e){const t=yb(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 a7(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 P_(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 i7(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?a7(n):yb(n);const f=e.ordered?c==="."?")":".":r7(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),P_(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 s7(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 l7(e,t,n,a){const s=s7(n);let o=n.bulletCurrent||yb(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 o7(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const u7=Ah(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function c7(e,t,n,a){return(e.children.some(function(c){return u7(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function d7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}U_.peek=f7;function U_(e,t,n,a){const s=d7(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 f7(e,t,n){return n.options.strong||"*"}function h7(e,t,n,a){return n.safe(e.value,a)}function m7(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 p7(e,t,n){const a=(P_(n)+(n.options.ruleSpaces?" ":"")).repeat(m7(n));return n.options.ruleSpaces?a.slice(0,-1):a}const B_={blockquote:Pq,break:Tk,code:qq,definition:Gq,emphasis:A_,hardBreak:Tk,heading:Yq,html:R_,image:O_,imageReference:z_,inlineCode:M_,link:I_,linkReference:L_,list:i7,listItem:l7,paragraph:o7,root:c7,strong:U_,text:h7,thematicBreak:p7};function g7(){return{enter:{table:y7,tableData:Ak,tableHeader:Ak,tableRow:b7},exit:{codeText:x7,table:v7,tableData:Rg,tableHeader:Rg,tableRow:Rg}}}function y7(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 v7(e){this.exit(e),this.data.inTable=void 0}function b7(e){this.enter({type:"tableRow",children:[]},e)}function Rg(e){this.exit(e)}function Ak(e){this.enter({type:"tableCell",children:[]},e)}function x7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,w7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function w7(e,t){return t==="|"?t:e}function S7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
409
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,S,k,E){return h(p(w,k,E),w.align)}function f(w,S,k,E){const C=g(w,k,E),N=h([C]);return N.slice(0,N.indexOf(`
410
- `))}function m(w,S,k,E){const C=k.enter("tableCell"),N=k.enter("phrasing"),R=k.containerPhrasing(w,{...E,before:o,after:o});return N(),C(),R}function h(w,S){return Iq(w,{align:S,alignDelimiters:a,padding:n,stringLength:s})}function p(w,S,k){const E=w.children;let C=-1;const N=[],R=S.enter("table");for(;++C<E.length;)N[C]=g(E[C],S,k);return R(),N}function g(w,S,k){const E=w.children;let C=-1;const N=[],R=S.enter("tableRow");for(;++C<E.length;)N[C]=m(E[C],w,S,k);return R(),N}function x(w,S,k){let E=B_.inlineCode(w,S,k);return k.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function k7(){return{exit:{taskListCheckValueChecked:Rk,taskListCheckValueUnchecked:Rk,paragraph:E7}}}function j7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:C7}}}function Rk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function E7(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 C7(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=B_.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 N7(){return[iq(),Cq(),Aq(),g7(),k7()]}function _7(e){return{extensions:[sq(),Nq(e),Rq(),S7(e),j7()]}}const T7={tokenize:D7,partial:!0},F_={tokenize:I7,partial:!0},$_={tokenize:L7,partial:!0},H_={tokenize:P7,partial:!0},A7={tokenize:U7,partial:!0},q_={name:"wwwAutolink",tokenize:z7,previous:G_},Z_={name:"protocolAutolink",tokenize:M7,previous:V_},mi={name:"emailAutolink",tokenize:O7,previous:Q_},za={};function R7(){return{text:za}}let Ds=48;for(;Ds<123;)za[Ds]=mi,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);za[43]=mi;za[45]=mi;za[46]=mi;za[95]=mi;za[72]=[mi,Z_];za[104]=[mi,Z_];za[87]=[mi,q_];za[119]=[mi,q_];function O7(e,t,n){const a=this;let s,o;return c;function c(g){return!Qy(g)||!Q_.call(a,a.previous)||vb(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Qy(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(A7,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 z7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!G_.call(a,a.previous)||vb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(T7,e.attempt(F_,e.attempt($_,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function M7(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&V_.call(a,a.previous)&&!vb(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)||It(g)||Xs(g)||Nh(g)?n(g):e.attempt(F_,e.attempt($_,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function D7(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 I7(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(H_,m,f)(h):h===null||It(h)||Xs(h)||h!==45&&Nh(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 L7(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(H_,t,o)(c):c===null||It(c)||Xs(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function P7(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||It(f)||Xs(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||It(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 U7(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Wn(o)?n(o):t(o)}}function G_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||It(e)}function V_(e){return!ur(e)}function Q_(e){return!(e===47||Qy(e))}function Qy(e){return e===43||e===45||e===46||e===95||Wn(e)}function vb(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 B7={tokenize:Q7,partial:!0};function F7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Z7,continuation:{tokenize:G7},exit:V7}},text:{91:{name:"gfmFootnoteCall",tokenize:q7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$7,resolveTo:H7}}}}function $7(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=ba(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 H7(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 q7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||It(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return s.includes(ba(a.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return It(g)||(c=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function Z7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(S)}function p(S){if(c>999||S===93&&!f||S===null||S===91||It(S))return n(S);if(S===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=ba(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return It(S)||(f=!0),c++,e.consume(S),S===92?g:p}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,p):p(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(o)||s.push(o),xt(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function G7(e,t,n){return e.check(Pc,t,e.attempt(B7,t,n))}function V7(e){e.exit("gfmFootnoteDefinition")}function Q7(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 K7(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&&Br(x,x.length,0,_h(w,c.slice(h+1,m),f)),Br(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),Br(c,h-1,m-h+3,x),m=h+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,p=this.events;let g=0;return x;function x(S){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const k=So(h);if(S===126)return g>1?m(S):(c.consume(S),g++,w);if(g<2&&!n)return m(S);const E=c.exit("strikethroughSequenceTemporary"),C=So(S);return E._open=!C||C===2&&!!k,E._close=!k||k===2&&!!C,f(S)}}}class Y7{constructor(){this.map=[]}add(t,n,a){X7(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 X7(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 W7(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 J7(){return{flow:{null:{name:"table",tokenize:eZ,resolveAll:tZ}}}}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 W=a.events[Y][1].type;if(W==="lineEnding"||W==="linePrefix")Y--;else break}const ae=Y>-1?a.events[Y][1].type:null,be=ae==="tableHead"||ae==="tableRow"?O:m;return be===O&&a.parser.lazy[a.now().line]?n(D):be(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):He(D)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):n(D):ot(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||It(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?x:g)}function x(D){return D===92||D===124?(e.consume(D),g):g(D)}function w(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(D):(e.enter("tableDelimiterRow"),c=!1,ot(D)?xt(e,S,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?E(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),k):L(D)}function k(D){return ot(D)?xt(e,E,"whitespace")(D):E(D)}function E(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(o+=1,C(D)):D===null||He(D)?z(D):L(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),N(D)):L(D)}function N(D){return D===45?(e.consume(D),N):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(D))}function R(D){return ot(D)?xt(e,z,"whitespace")(D):z(D)}function z(D){return D===124?S(D):D===null||He(D)?!c||s!==o?L(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):L(D)}function L(D){return n(D)}function O(D){return e.enter("tableRow"),B(D)}function B(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),B):D===null||He(D)?(e.exit("tableRow"),t(D)):ot(D)?xt(e,B,"whitespace")(D):(e.enter("data"),I(D))}function I(D){return D===null||D===124||It(D)?(e.exit("data"),B(D)):(e.consume(D),D===92?Q:I)}function Q(D){return D===92||D===124?(e.consume(D),I):I(D)}}function tZ(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 Y7;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(Ok(x,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",p,t]])),s=S.type==="tableDelimiterRow"?2:p?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g)),o=c,c=[o[1],n,0,0])):S.type==="tableHead"?(f=!0,m=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=wf(x,t,o,s,n,g)):c[1]!==0&&(g=wf(x,t,c,s,n,g)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Ok(x,t,m,h,p),x.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=W7(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 S=n[2]+1,k=n[3]-n[2]-1;e.add(S,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Ql(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Ok(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:aZ};function rZ(){return{text:{91:nZ}}}function aZ(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return It(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return He(m)?t(m):ot(m)?e.check({tokenize:iZ},t,n)(m):n(m)}}function iZ(e,t,n){return xt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function sZ(e){return a_([R7(),F7(),K7(e),J7(),rZ()])}const lZ={};function oZ(e){const t=this,n=e||lZ,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(sZ(n)),o.push(N7()),c.push(_7(n))}function Oh({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(VH,{remarkPlugins:[oZ,aq],children:e})})}function uZ({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(kn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["System prompt append",m&&l.jsx(cZ,{})]}),!o&&!s&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(Nv,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Jn,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(ve,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):l.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?l.jsx(Oh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function cZ(){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 K_={"claude-code":"Claude Code",codex:"Codex"},dZ=[Qf.CLAUDE_CODE,Qf.CODEX];function fZ({open:e,onOpenChange:t,agent:n}){const a=En(),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:ci,enabled:e}).data??[],S=kR({queries:w.map(I=>({queryKey:["client-capabilities",I.id],queryFn:()=>uh(I.id),enabled:e}))}),k=b.useMemo(()=>{const I=new Map;return S.forEach((Q,D)=>{const Y=w[D];if(!Y)return;const ae=Q.data;ae!=null&&ae.capabilities&&I.set(Y.id,ae.capabilities)}),I},[S,w]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const E=c?k.get(c)??null:null,C=(E==null?void 0:E[m])??null,N=!C||C.state==="missing"||C.state==="error",R=!!c&&(c!==s||m!==o)&&(!N||p),z=m!==o,L=c!==s,O=bt({mutationFn:()=>{if(!c)throw new Error("clientId required");return QI(n.uuid,{clientId:c,runtimeProvider:m,force:N&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),B=O.error instanceof Js||O.error instanceof Error?O.error.message:null;return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{className:"max-w-lg",children:[l.jsx(Ln,{children:l.jsx(On,{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:mZ(s,w,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{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:hZ(I)},I.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:dZ.map(I=>{const Q=(E==null?void 0:E[I])??null,D=!!Q&&Q.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:K_[I]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:gZ(Q,I)})]})]},I)})})]}),(L||z)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),z&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),N&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange: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."})]}),B&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:B})]}),l.jsxs(fr,{children:[l.jsx(ve,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),l.jsx(ve,{onClick:()=>O.mutate(),disabled:!R||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function hZ(e){return`${e.hostname??e.id} · ${e.status}`}function mZ(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${K_[n]}`}const pZ={"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 gZ(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. ${pZ[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const yZ={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function vZ(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:yZ[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&l.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[l.jsx(cr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),l.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&l.jsx(ve,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),l.jsx(ve,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(ve,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(pE,{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 bZ(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const xZ={"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 wZ(e){const t=xZ[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(SZ,{name:t.name,caption:t.caption,locked:!0}),l.jsx(kZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function SZ({name:e,caption:t,locked:n}){return l.jsxs(kn,{children:[l.jsx(ua,{children:l.jsxs(ca,{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(Ev,{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(gE,{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 kZ(e){const t=!!e.computerLabel;return l.jsxs(kn,{children:[l.jsxs(ua,{children:[l.jsx(ca,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[l.jsx(Sy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&l.jsxs(ve,{size:"xs",variant:"outline",onClick:e.onRebind,children:[l.jsx(Sy,{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 jZ(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 EZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function CZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Og(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function zk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:CZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function zg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=EZ(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:zk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:zk(f)}}),remove:a=>t(s=>{const c=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:c}})}}function NZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Og(e.payload.mcpServers,"mcp"),env:Og(e.payload.env,"env"),git:Og(e.payload.gitRepos,"git")}}function _Z(e){const[t,n]=b.useState(null);b.useEffect(()=>{e&&t===null&&n(NZ(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((Q,D)=>D.status==="unchanged"?Q:Q+1,0),L=z(a.mcp),O=z(a.env),B=z(a.git);return c&&R.push("prompt"),f&&R.push("model"),L>0&&R.push("mcp"),O>0&&R.push("env"),B>0&&R.push("git"),{anyDirty:R.length>0,dirtySections:R,counts:{prompt:c?1:0,model:f?1:0,mcp:L,env:O,git:B}}},[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]),S=b.useMemo(()=>zg("mcp",h),[h]),k=b.useMemo(()=>zg("env",h),[h]),E=b.useMemo(()=>zg("git",h),[h]),C=b.useCallback(()=>{n(null)},[]),N=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,L=m.counts.env>0,O=m.counts.git>0;return z&&(R.mcpServers=t.mcp.filter(B=>B.status!=="deleted").map(B=>B.value)),L&&(R.env=t.env.filter(B=>B.status!=="deleted").map(B=>{const I=B.value;return I.sensitive&&I.value===Gf?{key:I.key,value:Gf,sensitive:!0}:I})),O&&(R.gitRepos=t.git.filter(B=>B.status!=="deleted").map(B=>B.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:S.add,updateMcp:S.update,deleteMcp:S.remove,undoDeleteMcp:S.undo,addEnv:k.add,updateEnv:k.update,deleteEnv:k.remove,undoDeleteEnv:k.undo,addGit:E.add,updateGit:E.update,deleteGit:E.remove,undoDeleteGit:E.undo,resetAll:C,buildPayloadPatch:N}}const Yn={overview:"ad-overview",setup:"ad-setup",prompt:rc("prompt"),tools:rc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function TZ(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 AZ(){var Tt,it,nr,zn,il,fa,ha,Ma,Vn,Da,Sa,qt;const t=Vj().uuid??"",n=Tn(),a=En(),s=Ke({queryKey:["agent",t],queryFn:()=>ZI(t),enabled:!!t}),o=Ke({queryKey:["agent-config",t],queryFn:()=>Eh(t),enabled:!!t&&((Tt=s.data)==null?void 0:Tt.type)!=="human"}),c=Ke({queryKey:["agent-client-status",t],queryFn:()=>a9(t),enabled:!!t&&((it=s.data)==null?void 0:it.type)!=="human"}),f=Ke({queryKey:["agent-sessions-active",t],queryFn:()=>IE(t,{state:"active"}),enabled:!!t&&((nr=s.data)==null?void 0:nr.type)!=="human"}),m=Ke({queryKey:["clients"],queryFn:ci,enabled:!!t&&((zn=s.data)==null?void 0:zn.type)!=="human",refetchInterval:3e4}),h=_Z(o.data),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),E=bt({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const Ee=h.buildPayloadPatch();return Ch(t,{expectedVersion:o.data.version,payload:Ee})},onSuccess:Ee=>{a.setQueryData(["agent-config",t],Ee),g(null),w(null),k(!0)},onError:Ee=>{if(k(!1),Ee instanceof Js&&Ee.status===409){w("Someone else saved a newer version while you were editing."),g(null);return}g(Ee instanceof Error?Ee.message:String(Ee))}});b.useEffect(()=>{if(!S)return;const Ee=setTimeout(()=>k(!1),2500);return()=>clearTimeout(Ee)},[S]),b.useEffect(()=>{h.summary.anyDirty&&k(!1)},[h.summary.anyDirty]);const C=b.useCallback(()=>{w(null),g(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),N=b.useCallback(Ee=>{const tt=document.getElementById(Ee);tt&&tt.scrollIntoView({behavior:"smooth",block:"start"})},[]),R=bt({mutationFn:Ee=>Ty(t,Ee),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),z=bt({mutationFn:()=>MC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),L=bt({mutationFn:()=>DC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),O=bt({mutationFn:()=>zC(t),onSuccess:()=>n("/team")}),B=bt({mutationFn:()=>KI(t)}),[I,Q]=b.useState(!1),[D,Y]=b.useState(""),[ae,be]=b.useState(null),[W,X]=b.useState(!1),Z=Ke({queryKey:["clients"],queryFn:ci,enabled:I}),te=bt({mutationFn:Ee=>Ty(t,{clientId:Ee}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),Q(!1),Y(""),be(null)},onError:Ee=>be(Ee instanceof Error?Ee.message:String(Ee))}),[je,Ae]=b.useState(!1),[M,P]=b.useState(null),F=bt({mutationFn:()=>r9(t,h.buildPayloadPatch()),onSuccess:Ee=>{const tt=Ee.diff.length?Ee.diff.map(pn=>`${pn.op} ${pn.path}`).join(`
411
- `):"(no changes)";P(tt)},onError:Ee=>P(`Dry run failed: ${Ee instanceof Error?Ee.message:String(Ee)}`)});b.useEffect(()=>{if(!h.summary.anyDirty)return;const Ee=tt=>{tt.preventDefault(),tt.returnValue=""};return window.addEventListener("beforeunload",Ee),()=>window.removeEventListener("beforeunload",Ee)},[h.summary.anyDirty]);const T=((il=s.data)==null?void 0:il.type)==="human",G=b.useMemo(()=>TZ(T),[T]),q=b.useRef(null),[re,xe]=b.useState(!1);b.useEffect(()=>{if(T)return;const Ee=q.current;if(!Ee||typeof IntersectionObserver>"u")return;const tt=new IntersectionObserver(pn=>{const Tr=pn[0];Tr&&xe(!Tr.isIntersecting&&Tr.boundingClientRect.top<0)},{threshold:0});return tt.observe(Ee),()=>tt.disconnect()},[T]);const[we,me]=b.useState(Yn.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const Ee=[];for(const tt of G){const pn=document.getElementById(tt.anchor);if(!pn)continue;const Tr=new IntersectionObserver(yi=>{for(const ys of yi)ys.isIntersecting&&me(tt.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Tr.observe(pn),Ee.push(Tr)}return()=>{for(const tt of Ee)tt.disconnect()}},[G]);const De=b.useMemo(()=>{const Ee=new Set;for(const tt of h.summary.dirtySections)tt==="prompt"&&Ee.add(Yn.prompt),tt==="model"&&Ee.add(Yn.setup),tt==="mcp"&&Ee.add(Yn.tools),(tt==="env"||tt==="git")&&Ee.add(Yn.advanced);return Ee},[h.summary.dirtySections]);if(s.isLoading)return l.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:l.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",s.error instanceof Error?s.error.message:"Unknown error"]});const Ue=s.data;if(!Ue)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const ft=Ue.type==="human",ut=c.data,ie=((fa=f.data)==null?void 0:fa.length)??0,le=!ft&&!(ut!=null&&ut.clientId),ge=!ft&&ut?!ut.online&&!!ut.clientId:!1,Le=Ue,zt=Le.runtimeState??null,$t=Le.runtimeType??null,Pn=Le.totalSessions??null,hr=Ue.uuid.slice(0,8),pi=jZ({activeSessions:ie,isUnclaimed:le,isOffline:ge}),gi=h.draft.mcp.filter(Ee=>Ee.status!=="deleted"),un=h.draft.env.filter(Ee=>Ee.status!=="deleted"),da=h.draft.git.filter(Ee=>Ee.status!=="deleted"),ue=Ee=>new Set(gi.filter(tt=>tt.key!==Ee).map(tt=>tt.value.name.toLowerCase())),ye=Ee=>new Set(un.filter(tt=>tt.key!==Ee).map(tt=>tt.value.key)),Fe=Ee=>new Set(da.filter(tt=>tt.key!==Ee).map(tt=>{const{value:pn}=tt;return pn.localPath?pn.localPath:((pn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ve={sessions:Pn??"—",active:ie,runtime:$t??(ft?"human":"—"),model:((Ma=(ha=o.data)==null?void 0:ha.payload.model)==null?void 0:Ma.trim())||"—"},at=(ut==null?void 0:ut.clientId)??null,cn=at?((Vn=m.data)==null?void 0:Vn.find(Ee=>Ee.id===at))??null:null,tr=at?(cn==null?void 0:cn.hostname)??at:null,Ht=Ue.runtimeProvider??"claude-code",Lt=Ht==="codex"?"Codex":"Claude Code";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[l.jsx(Jv,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),G.map(Ee=>l.jsxs("div",{children:[Ee.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(RZ,{label:Ee.label,active:we===Ee.anchor,danger:Ee.danger??!1,dirty:De.has(Ee.anchor),onClick:()=>N(Ee.anchor)})]},Ee.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(i9,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(s9,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(l9,{}),l.jsx(o9,{mono:!0,children:Ue.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:Ue.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Ue.name??hr]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(ra,{tone:Ue.type==="autonomous_agent"?"accent":"neutral",children:Ue.type}),Ue.visibility&&l.jsx(ra,{tone:Ue.visibility==="organization"?"accent":"outline",children:Ue.visibility}),(ut==null?void 0:ut.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",oc(ut.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(mc,{state:zt}),l.jsxs(ve,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ue.uuid}`),children:[l.jsx(Cv,{className:"h-3 w-3"})," Open chat"]}),!ft&&Ue.status==="active"&&l.jsxs(ve,{variant:"outline",size:"xs",onClick:()=>{B.reset(),B.mutate()},disabled:B.isPending,children:[l.jsx(gE,{className:"h-3 w-3"}),B.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}}),!ft&&l.jsx(d9,{runtimeLabel:Lt,computerLabel:tr,visible:re}),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:[(B.data||B.error)&&l.jsx(LZ,{result:B.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>B.reset()}),l.jsx(Fu,{anchorId:Yn.overview,title:"Profile",right:l.jsxs(ve,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Ue.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(Sy,{className:"h-3 w-3"}),"Manage bindings"]}),children:l.jsx(j9,{agent:Ue,onSave:async Ee=>{await R.mutateAsync(Ee)}})}),!ft&&l.jsxs(l.Fragment,{children:[l.jsxs(Fu,{anchorId:Yn.setup,title:"Setup",caption:((Da=o.data)==null?void 0:Da.version)!=null?l.jsxs("span",{className:"mono",children:["config v",o.data.version,h.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[o.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),o.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(o.error)]}),o.data&&l.jsx(wZ,{runtimeProvider:Ht,computerLabel:tr,canBindComputer:le&&Ue.status==="active",bindComputerPending:te.isPending,onBindComputer:()=>Q(!0),onRebind:Ue.clientId?()=>X(!0):void 0,modelSlot:l.jsx(D9,{value:h.draft.model,baseline:((Sa=o.data)==null?void 0:Sa.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Ue.status!=="active",provider:Ht})})]}),l.jsx(Fu,{anchorId:Yn.prompt,title:"Prompt",children:o.data?l.jsx(uZ,{value:h.draft.promptAppend,baseline:((qt=o.data)==null?void 0:qt.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Ue.status!=="active"}):null}),l.jsx(Fu,{anchorId:Yn.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?l.jsx(N9,{items:h.draft.mcp,otherNames:ue,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Ue.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(v9,{items:h.draft.env,otherKeys:ye,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Ue.status!=="active"})}),l.jsx("div",{id:rc("git"),children:l.jsx(x9,{items:h.draft.git,otherPaths:Fe,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Ue.status!=="active"})}),M&&l.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:M}),h.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>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(bZ,{}),l.jsx(f9,{agent:Ue,suspendPending:z.isPending,reactivatePending:L.isPending,deletePending:O.isPending,onSuspend:()=>z.mutate(),onReactivate:()=>L.mutate(),onDelete:()=>O.mutate()})]}),!ft&&l.jsx(vZ,{summary:h.summary,saveHint:pi,conflictMessage:x,errorMessage:p,saving:E.isPending,justSaved:S,onSave:()=>E.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:Ee=>N(rc(Ee))})]}),l.jsx(OZ,{open:je,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(Rn,{open:I,onOpenChange:Ee=>{Q(Ee),Ee||(Y(""),be(null),te.reset())},children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(zZ,{clients:Z.data??[],selected:D,onSelect:Y}),ae&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ae})]}),l.jsxs(fr,{children:[l.jsx(ve,{variant:"outline",onClick:()=>Q(!1),children:"Cancel"}),l.jsx(ve,{disabled:!D||te.isPending,onClick:()=>{be(null),te.mutate(D)},children:te.isPending?"Binding…":"Bind"})]})]})}),l.jsx(fZ,{open:W,onOpenChange:X,agent:Ue})]})}function RZ({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 OZ(e){return l.jsx(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function zZ({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?l.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",l.jsx("code",{className:"mono text-label",children:"first-tree-hub client connect <url>"})," on the computer that should run this agent, then reopen this dialog."]}):l.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const o=s.id===t,c=s.status==="online"||s.status==="active";return l.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>n(s.id),className:ze("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[l.jsx("span",{className:ze("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),l.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const MZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},DZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},IZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function LZ({result:e,onDismiss:t}){const n=DZ[e.status],a=IZ[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(ra,{tone:a,children:MZ[e.status]}),e.responseTime!=null&&l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[l.jsx("div",{children:s.runtimeState&&l.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?l.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):l.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&l.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&l.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),l.jsx(ve,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function PZ(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 UZ(){return this.eachAfter(PZ)}function BZ(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function FZ(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 $Z(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 HZ(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function qZ(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,s=a&&a.length;--s>=0;)n+=a[s].value;t.value=n})}function ZZ(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function GZ(e){for(var t=this,n=VZ(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 VZ(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 QZ(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function KZ(){return Array.from(this)}function YZ(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function XZ(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*WZ(){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 Y_(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=tG)):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(X_)}function JZ(){return Y_(this).eachBefore(nG)}function eG(e){return e.children}function tG(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 X_(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=Y_.prototype={constructor:ko,count:UZ,each:BZ,eachAfter:$Z,eachBefore:FZ,find:HZ,sum:qZ,sort:ZZ,path:GZ,ancestors:QZ,descendants:KZ,leaves:YZ,links:XZ,copy:JZ,[Symbol.iterator]:WZ};function Mg(e){return e==null?null:rG(e)}function rG(e){if(typeof e!="function")throw new Error;return e}var aG={depth:-1},Mk={},Dg={};function iG(e){return e.id}function sG(e){return e.parentId}function lG(){var e=iG,t=sG,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,p,g,x,w,S,k,E=new Map;if(n!=null){const C=o.map((z,L)=>oG(n(z,L,s))),N=C.map(Dk),R=new Set(C).add("");for(const z of N)R.has(z)||(R.add(z),C.push(z),N.push(Dk(z)),o.push(Dg));c=(z,L)=>C[L],f=(z,L)=>N[L]}for(p=0,m=o.length;p<m;++p)h=o[p],w=o[p]=new ko(h),(S=c(h,p,s))!=null&&(S+="")&&(k=w.id=S,E.set(k,E.has(k)?Mk:w)),(S=f(h,p,s))!=null&&(S+="")&&(w.parent=S);for(p=0;p<m;++p)if(w=o[p],S=w.parent){if(x=E.get(S),!x)throw new Error("missing: "+S);if(x===Mk)throw new Error("ambiguous: "+S);x.children?x.children.push(w):x.children=[w],w.parent=x}else{if(g)throw new Error("multiple roots");g=w}if(!g)throw new Error("no root");if(n!=null){for(;g.data===Dg&&g.children.length===1;)g=g.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Dg);--C)w.data=null}if(g.parent=aG,g.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(X_),g.parent=null,m>0)throw new Error("cycle");return g}return a.id=function(s){return arguments.length?(e=Mg(s),a):e},a.parentId=function(s){return arguments.length?(t=Mg(s),a):t},a.path=function(s){return arguments.length?(n=Mg(s),a):n},a}function oG(e){e=`${e}`;let t=e.length;return Ky(e,t-1)&&!Ky(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Dk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Ky(e,t););return e.slice(0,t)}function Ky(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function uG(e,t){return e.parent===t.parent?1:2}function Ig(e){var t=e.children;return t?t[0]:e.t}function Lg(e){var t=e.children;return t?t[t.length-1]:e.t}function cG(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 dG(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 fG(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 hG(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 mG(){var e=uG,t=1,n=1,a=null;function s(h){var p=hG(h);if(p.eachAfter(o),p.parent.m=-p.z,p.eachBefore(c),a)h.eachBefore(m);else{var g=h,x=h,w=h;h.eachBefore(function(N){N.x<g.x&&(g=N),N.x>x.x&&(x=N),N.depth>w.depth&&(w=N)});var S=g===x?1:e(g,x)/2,k=S-g.x,E=t/(x.x+S+k),C=n/(w.depth||1);h.eachBefore(function(N){N.x=(N.x+k)*E,N.y=N.depth*C})}return h}function o(h){var p=h.children,g=h.parent.children,x=h.i?g[h.i-1]:null;if(p){dG(h);var w=(p[0].z+p[p.length-1].z)/2;x?(h.z=x.z+e(h._,x._),h.m=h.z-w):h.z=w}else x&&(h.z=x.z+e(h._,x._));h.parent.A=f(h,x,h.parent.A||g[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,p,g){if(p){for(var x=h,w=h,S=p,k=x.parent.children[0],E=x.m,C=w.m,N=S.m,R=k.m,z;S=Lg(S),x=Ig(x),S&&x;)k=Ig(k),w=Lg(w),w.a=h,z=S.z+N-x.z-E+e(S._,x._),z>0&&(cG(fG(S,h,g),h,z),E+=z,C+=z),N+=S.m,E+=x.m,R+=k.m,C+=w.m;S&&!Lg(w)&&(w.t=S,w.m+=N-C),x&&!Ig(k)&&(k.t=x,k.m+=E-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 pG(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ce.get(yy(e,`/context-tree/snapshot${n}`))}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 W_=[{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 gG({previewSnapshot:e}={}){const{organizationId:t}=yt(),[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 pG(t,n)},enabled:!m&&!!t}),p=e??h.data,g=b.useMemo(()=>p?p.updates.find(S=>S.id===s)??p.updates[0]??null:null,[s,p]),x=b.useMemo(()=>p&&g!=null&&g.nodeId?p.nodes.find(S=>S.id===g.nodeId)??null:null,[g,p]),w=c??(g==null?void 0:g.nodeId)??(x==null?void 0:x.id)??null;return b.useEffect(()=>{var S;p&&(s&&p.updates.some(k=>k.id===s)||o(((S=p.updates[0])==null?void 0:S.id)??null))},[s,p]),l.jsxs("div",{className:"-m-6",children:[l.jsx(al,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),l.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[!m&&h.isLoading?l.jsx(EG,{}):null,!m&&h.error?l.jsx(CG,{message:h.error instanceof Error?h.error.message:"Failed to load"}):null,p&&(m||!h.isLoading)?l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:p.snapshotStatus==="unavailable"?l.jsx(eT,{snapshot:p}):l.jsxs(l.Fragment,{children:[l.jsx(yG,{snapshot:p,window:n,onWindowChange:a}),l.jsx(vG,{snapshot:p,selectedUpdate:g,selectedUpdateNode:x,selectedOverviewNodeId:w,onSelectUpdate:S=>{o(S.id),f(S.nodeId)},onSelectOverviewNode:f})]})}):null]})]})}function yG({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?l.jsx(Hz,{size:18}):l.jsx(To,{size:18}),s=PG(t),o=e.contextStatus.label,c=BG(e);return l.jsx(kn,{children:l.jsx(Jn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)",minWidth:0},children:[l.jsx("span",{style:{color:UG(e.contextStatus.severity),flex:"0 0 auto"},children:a}),l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{className:"flex flex-wrap items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"text-subtitle font-semibold",style:{color:"var(--fg)"},children:o}),c?l.jsx("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:c}):null]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.contextStatus.detail??"Agents have a synced team context snapshot available."})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(Sf,{value:e.summary.changedNodeCount,label:`updates in the ${s}`}),l.jsx(Sf,{value:e.summary.addedCount,label:"added",tone:"added"}),l.jsx(Sf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),l.jsx(Sf,{value:e.summary.removedCount,label:"removed",tone:"removed"})]}),l.jsxs("fieldset",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:[l.jsx("legend",{className:"sr-only",children:"Context update window"}),W_.map(f=>l.jsx(ve,{variant:f.value===t?"default":"outline",size:"xs",onClick:()=>n(f.value),children:f.label},f.value))]})]})]})})})}function vG({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=f=>{o(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-4)",alignItems:"stretch"},children:[l.jsxs(kn,{className:"flex h-full flex-col",children:[l.jsx(ua,{children:l.jsxs("div",{className:"flex flex-col",children:[l.jsx(ca,{children:"Context Updates"}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:[e.updates.length," team context changes agents may use"]})]})}),l.jsx(Jn,{className:"flex-1",children:e.updates.length===0?l.jsx(tT,{}):l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)",height:"min(52vh, 30rem)",overflow:"auto",paddingRight:"var(--sp-0_5)"},children:e.updates.map(f=>l.jsx(bG,{update:f,selected:f.id===(t==null?void 0:t.id),onClick:()=>s(f)},f.id))})})]}),l.jsx(xG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(wG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function bG({update:e,selected:t,onClick:n}){return l.jsxs("button",{type:"button",onClick:n,className:"w-full text-left transition-colors",style:{border:"var(--hairline) solid var(--border)",borderColor:t?"var(--accent)":"var(--border)",borderRadius:"var(--radius-panel)",background:t?"var(--bg-sunken)":"var(--bg)",padding:"var(--sp-2_5)"},children:[l.jsx("div",{className:"flex items-start justify-between",style:{gap:"var(--sp-2)"},children:l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(J_,{type:e.changeType}),l.jsx("span",{className:"text-body font-semibold",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:qG(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",rT(e.path)]})]})}),l.jsxs("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-3)",gap:"var(--sp-2)",marginTop:"var(--sp-2)"},children:[l.jsx("span",{children:YG(e.owners)}),e.relatedNodeIds.length>0?l.jsx("span",{children:XG(e.relatedNodeIds.length)}):null]})]})}function xG({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?KG(e.owners):"No owner",h=o&&o.length>0?o.map(g=>g.title||g.path||"root"):[],p=e?WG(e.path)||rT(e.path):"root";return l.jsxs(kn,{className:"flex h-full flex-col",children:[l.jsxs(ua,{children:[l.jsxs("div",{children:[l.jsx(ca,{children:"Selected Change"}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Summary and source context"})]}),e?l.jsx(J_,{type:e.changeType}):null]}),l.jsx(Jn,{className:"flex-1",children:e?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[ZG(e)," · ",$G(e.changeType)," · ",p]}),l.jsx("div",{className:"text-label font-mono",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:l.jsx(kG,{value:GG(e),impact:HG(e)})}),l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:l.jsx(jG,{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(tT,{})})]})}function wG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const[a,s]=b.useState(()=>new Set),o=b.useMemo(()=>LG(e.nodes),[e.nodes]),c=b.useMemo(()=>AG(e.nodes,t,o,a),[t,e.nodes,o,a]),f=b.useCallback(k=>{k==null||k.scrollIntoView({block:"nearest",inline:"nearest"})},[]),m=b.useCallback(k=>{s(E=>{const C=new Set(E);return C.has(k)?C.delete(k):C.add(k),C})},[]),h=Math.max(760,...c.map(k=>k.x+280)),p=Math.max(280,...c.map(k=>k.y+48)),g=p+24,x=560,w=g>x,S=MG(e.nodes,t);return l.jsxs(kn,{children:[l.jsx(ua,{children:l.jsxs("div",{children:[l.jsxs(ca,{children:[l.jsx(eM,{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(eT,{snapshot:e}):l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-1_5)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1_5)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"Selected"}),l.jsx("span",{children:S??"No update selected"})]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx($u,{color:"var(--accent)",label:"Selected path"}),l.jsx($u,{color:"var(--ok)",label:"Added"}),l.jsx($u,{color:"var(--warn)",label:"Edited"}),l.jsx($u,{color:"var(--danger)",label:"Removed"}),l.jsx($u,{color:"var(--bg-raised)",label:"Quiet"})]})]}),l.jsx("div",{style:{overflow:w?"auto":"hidden",maxHeight:w?`${x}px`:void 0,minHeight:`${Math.min(g,x)}px`},children:l.jsxs("svg",{viewBox:`0 0 ${h} ${p}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${g}px`},children:[c.map(k=>k.parent?l.jsx("line",{x1:k.parent.x,y1:k.parent.y,x2:k.x,y2:k.y,stroke:k.selectedPath&&k.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:k.muted?.34:k.selectedPath?.72:.56,strokeWidth:k.selectedPath&&k.parent.selectedPath?1.6:1},`edge:${k.id}`):null),c.map(k=>{const E=k.isSummary||k.sourceNodeId!==null,C=()=>{k.isSummary&&k.parentId?m(k.parentId):k.sourceNodeId&&n(k.sourceNodeId)};return l.jsx("foreignObject",{x:k.x-10,y:k.y-15,width:h-k.x-8,height:30,children:l.jsxs("button",{ref:k.selected?f:void 0,type:"button",disabled:!E,"aria-expanded":k.isSummary?k.isExpanded:void 0,onClick:C,className:"flex w-full items-center text-left text-label transition-colors",style:{background:"transparent",color:k.muted?"var(--fg-3)":"var(--fg)",cursor:E?"pointer":"default",gap:"var(--sp-2)",opacity:k.muted?.66:1,padding:"0 var(--sp-1)"},onMouseEnter:N=>{E&&(N.currentTarget.style.background="var(--bg-sunken)")},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[k.isSummary?l.jsx(fE,{size:12,style:{color:"var(--fg-4)",flex:"0 0 auto",transform:k.isExpanded?"rotate(90deg)":void 0,transition:"transform 120ms"}}):l.jsx("span",{"aria-hidden":"true",style:{width:k.selected?"var(--sp-4)":"var(--sp-3)",height:k.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:JG(k),border:`${k.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${k.selected?"var(--accent)":eV(k)}`,flex:"0 0 auto"}}),l.jsx("span",{className:k.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.title}),k.updateCount>0&&!k.isSummary?l.jsx("span",{className:"font-semibold",style:{background:"var(--accent-bg)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",flex:"0 0 auto",padding:"0 var(--sp-1)"},children:k.updateCount}):null]})},k.id)})]})})]})})]})}function $u({color:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{"aria-hidden":"true",style:{background:e,border:"var(--hairline) solid var(--border-strong)",borderRadius:"50%",height:"var(--sp-2)",width:"var(--sp-2)"}}),l.jsx("span",{children:t})]})}function 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?zh(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function SG({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?zh(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 J_({type:e}){return l.jsx(SG,{label:FG(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 jG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:o,onTogglePreview:c}){const f=[{label:"Owner",value:a},...n.length>0?[{label:"Linked",value:n.join(", ")}]:[],{label:"Source",value:e,mono:!0},{label:"Commit",value:t,mono:!0}];return l.jsxs("div",{children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Reference"}),l.jsx("dl",{className:"grid grid-cols-1 md:grid-cols-2",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-2)"},children:f.map(m=>l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"4rem minmax(0,1fr)",gap:"var(--sp-2)"},children:[l.jsx("dt",{className:"text-label font-semibold",style:{color:"var(--fg-3)"},children:m.label}),l.jsx("dd",{className:`text-label ${m.mono?"font-mono":"font-medium"}`,style:{color:"var(--fg-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.value})]},m.label))}),l.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-3)"},children:[l.jsx(ve,{variant:"outline",size:"xs",onClick:c,children:o?"Hide source":"Preview source"}),l.jsxs(ve,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[l.jsx(kv,{size:14}),"Copy path"]})]}),o?l.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",marginTop:"var(--sp-3)",paddingTop:"var(--sp-3)"},children:s?l.jsx(Oh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function EG(){return l.jsx(kn,{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(vM,{size:17}),"Loading team context..."]})})})}function CG({message:e}){return l.jsx(kn,{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 eT({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?NG(e.repo):null;return l.jsx(kn,{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 NG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function tT(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const _G=1,TG=3;function AG(e,t,n,a){const s=RG(e,t,n,a);if(s.length===0)return[];const o=lG().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=mG().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 RG(e,t,n,a){const s=new Map(e.map(S=>[S.id,S])),o=e.filter(S=>!S.parentId||s.has(S.parentId)).sort((S,k)=>S.path.localeCompare(k.path));if(o.length===0)return[];const c=OG(o),f=zG(t,s),m=new Set,h=new Map;for(const S of o){const k=nT(S,s,h),E=n.get(S.id)??0;(k<=_G||f.has(S.id)||E>0&&k<=TG)&&DG(S.id,s,m)}const p=new Set(m);for(const S of a)if(p.has(S))for(const k of c.get(S)??[])p.add(k.id);const g=f.size>0,x=o.filter(S=>p.has(S.id)).map(S=>{const k=n.get(S.id)??0,E=f.has(S.id);return{id:S.id,parentId:S.parentId&&p.has(S.parentId)?S.parentId:null,sourceNodeId:S.id,title:S.title,path:S.path,changeType:S.changeType,updateCount:k,isSummary:!1,isExpanded:!1,selected:t===S.id,selectedPath:E,muted:g&&!E&&k===0}}),w=[];for(const S of o){if(!p.has(S.id))continue;const k=(c.get(S.id)??[]).filter(N=>!m.has(N.id));if(k.length===0)continue;const E=a.has(S.id),C=k.filter(N=>(n.get(N.id)??0)>0).length;w.push({id:`summary:${S.id}`,parentId:S.id,sourceNodeId:null,title:E?`Hide ${k.length} quiet area${k.length===1?"":"s"}`:IG(k.length,C),path:`${S.path}/~summary`,changeType:null,updateCount:C,isSummary:!0,isExpanded:E,selected:!1,selectedPath:f.has(S.id),muted:g&&!f.has(S.id)})}return[...x,...w]}function OG(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 zG(e,t){const n=new Set;let a=e?t.get(e):void 0;for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0;return n}function MG(e,t){const n=new Map(e.map(o=>[o.id,o])),a=[];let s=t?n.get(t):void 0;for(;s;)a.unshift(s.title),s=s.parentId?n.get(s.parentId):void 0;return a.length>0?a.join(" / "):null}function DG(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function nT(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?nT(s,t,n)+1:0;return n.set(e.id,o),o}function IG(e,t){return t>0?`${e} hidden · ${t} updated`:`${e} hidden quiet area${e===1?"":"s"}`}function LG(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 PG(e){var t;return((t=W_.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function UG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function BG(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 FG(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function $G(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function HG(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 qG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function ZG(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function GG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=QG(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function VG(e){return e.summary.replace(/^updated:\s*/i,"")}function QG(e){const t=VG(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 KG(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function YG(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function XG(e){return`${e} linked context${e===1?"":"s"}`}function WG(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(aT).join(" / ")}function rT(e){return e.split("/").filter(Boolean).map(aT).join(" / ")||"root"}function aT(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function zh(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function JG(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType?zh(e.changeType):e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}function eV(e){return e.changeType?zh(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 iT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));iT.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 tV=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));tV.displayName="CardFooter";function nV(){const{token:e}=Vj(),t=Tn(),{isAuthenticated:n,adoptTokens:a}=yt(),[s,o]=b.useState(null),[c,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const E=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!E.ok){f("This invitation is no longer valid");return}o(await E.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const E=await Ce.get("/me/organizations"),C=await Ce.get("/me"),N=E.find(R=>R.id===C.member.organizationId);g((N==null?void 0:N.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(Ik,{message:"Bad invitation URL"});if(c)return l.jsx(Ik,{message:"This invitation is no longer valid"});if(!s)return l.jsx(rV,{});const x=async()=>{h(!0);try{const E=await Ce.post("/me/organizations/join",{token:e});await a(E.tokens),iE("invite"),t("/",{replace:!0})}catch(E){f(E instanceof Error?E.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,S=n&&p&&p!==s.organizationDisplayName,k=aV(s.expiresAt);return l.jsx(bb,{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:[S&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[l.jsx(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(ve,{className:"w-full",disabled:m,onClick:x,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(ve,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:w,children:[l.jsx(mE,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),k&&l.jsx("p",{className:"text-center text-label",style:{color:k.urgent?"var(--destructive)":"var(--fg-3)"},children:k.text}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function bb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function rV(){return l.jsx(bb,{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 Ik({message:e}){return l.jsx(bb,{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(ve,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Rc,{to:"/",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function 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 iV(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=gN(s);return o===F1&&s!==F1?null:o}function sV(){const{isAuthenticated:e}=yt(),t=Er(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=iV(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?l.jsx(or,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(wv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:l.jsxs(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(ve,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(mE,{className:"h-4 w-4"}),"Continue with GitHub"]})}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[l.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),l.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),l.jsx(ve,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(AM,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function lV(){const e=Tn(),{adoptTokens:t}=yt(),[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=gN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&iE(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 aa=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}));aa.displayName="DenseTableRow";const Wt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:ze("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Wt.displayName="DenseTableHead";const rt=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}));rt.displayName="DenseTableCell";const oV=1500;function uV({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),oV))},x=t!==void 0?Math.max(1,Math.round(t/60)):null,w=l.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?l.jsxs(l.Fragment,{children:[e,x!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",x,"m"]})]}):"Generating token…"}),S=l.jsxs(ve,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(kv,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,S]}):l.jsxs(l.Fragment,{children:[w,S]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[l.jsx(cV,{}),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 cV(){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 dV=3e3,fV=1200;function hV({open:e,onOpenChange:t}){const n=En(),{user:a}=yt(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),x=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),x.current=new Set;return}let w=!1;const S=(n.getQueryData(["clients"])??[]).map(k=>k.id);return x.current=new Set(S),(async()=>{try{const k=await SD();if(w)return;f(k),o("waiting")}catch(k){if(w)return;h(k instanceof Error?k.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const S=setInterval(async()=>{try{const k=await n.fetchQuery({queryKey:["clients"],queryFn:ci}),E=x.current,C=k.find(N=>!E.has(N.id)&&N.status==="connected"&&N.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},dV);return()=>clearInterval(S)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},fV);return()=>clearTimeout(w)},[s,t,n]),l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsxs(Ln,{children:[l.jsx(On,{children:"Connect computer"}),l.jsx(Dv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(uV,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(ve,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function mV({embedded:e=!1}={}){const t=En(),n=mh(),[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:ci,refetchInterval:1e4}),{data:S}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),k=bt({mutationFn:wD,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),E=bt({mutationFn:xD,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 B of(S==null?void 0:S.agents)??[]){if(!B.clientId)continue;const I=O.get(B.clientId)??[];I.push(B),O.set(B.clientId,I)}return O},[S==null?void 0:S.agents]),N=O=>C.get(O)??[],R=(w??[]).filter(O=>O.status==="connected").length,z=(w??[]).reduce((O,B)=>O+B.agentCount,0),L=(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",L>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[L," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(ve,{size:"xs",onClick:()=>x(!0),children:[l.jsx(xa,{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(hV,{open:g,onOpenChange:x}),f&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),N(f.id).length>0&&l.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:N(f.id).map(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(ve,{variant:"outline",size:"sm",onClick:()=>{m(null),p(null)},children:"Cancel"}),l.jsx(ve,{variant:"destructive",size:"sm",onClick:()=>E.mutate(f.id),disabled:E.isPending,children:E.isPending?"Retiring…":"Retire"})]})]})}),o&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:o.hostname??o.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:N(o.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):N(o.id).map(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(ve,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),l.jsx(ve,{variant:"destructive",size:"sm",onClick:()=>k.mutate(o.id),disabled:k.isPending,children:k.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?l.jsx(kn,{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(kn,{children:[l.jsxs(Ly,{children:["Registered · ",w.length]}),l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Wt,{style:{width:16}}),l.jsx(Wt,{children:"Hostname"}),l.jsx(Wt,{children:"OS"}),l.jsx(Wt,{children:"SDK"}),l.jsx(Wt,{children:"Agents"}),l.jsx(Wt,{children:"Connected"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{"aria-hidden":!0})]})}),l.jsx(bc,{children:w.map(O=>{const B=!a.has(O.id),I=N(O.id);return l.jsx(wV,{client:O,boundAgents:I,isExpanded:B,agentName:n,onToggle:()=>s(Q=>{const D=new Set(Q);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 pV={"claude-code":"Claude Code",codex:"Codex"},gV=[Qf.CLAUDE_CODE,Qf.CODEX],Lk={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},yV={"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 vV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ke({queryKey:["client-capabilities",e],queryFn:()=>uh(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(Jv,{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:gV.map(o=>l.jsx(bV,{provider:o,entry:s?s[o]??null:null},o))})]})}function bV({provider:e,entry:t}){const n=pV[e];if(!t)return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",Lk[e]]})]});switch(t.state){case"ok":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",yV[e]]})]});case"missing":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",Lk[e]]})]});case"error":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function xV(){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 wV({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(aa,{interactive:!0,selected:n,onClick:s,children:[l.jsx(rt,{style:{width:16},children:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?l.jsx(Sv,{className:"h-3.5 w-3.5"}):l.jsx(fE,{className:"h-3.5 w-3.5"})})}),l.jsx(rt,{className:"font-medium",children:e.hostname??"—"}),l.jsx(rt,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(rt,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(rt,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(rt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?oc(e.connectedAt):"—"}),l.jsx(rt,{children:p?l.jsx(xV,{}):l.jsx(mc,{state:g})}),l.jsx(rt,{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(rt,{}),l.jsxs(rt,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(vV,{clientId:e.id,enabled:n}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(Jv,{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 SV(){return l.jsx(mV,{embedded:!0})}async function kV(e){try{return await Ce.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof Js&&t.status===404)return null;throw t}}async function jV(e){const{installUrl:t}=await Ce.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 EV({isFirst:e=!1}){const{organizationId:t}=yt(),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(CV,{organizationId:t}):l.jsx(NV,{data:n.data})})}function CV({organizationId:e}){const t=bt({mutationFn:()=>{if(!e)throw new Error("No organization selected");return jV(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(jv,{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 NV({data:e}){const t=e.accountType==="Organization"?Pz:vE,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx(_V,{}),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(jv,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function _V(){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(Zz,{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 TV(){const{role:e}=yt();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(EV,{isFirst:!0})})]})}function AV(){return Ce.get(An("/adapter-mappings"))}function RV(e){return Ce.post(An("/adapter-mappings"),e)}function OV(e){return Ce.delete(`/adapter-mappings/${e}`)}function zV(){return Ce.get(An("/adapters/status"))}function MV(){return Ce.get(An("/adapters"))}function DV(e){return Ce.post(An("/adapters"),e)}function IV(e,t){return Ce.patch(`/adapters/${e}`,t)}function LV(e){return Ce.delete(`/adapters/${e}`)}const PV=Object.values(g6),Pk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function Uk(e){const[t,n]=b.useState(Pk),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...Pk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=UV(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(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{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:PV.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(vt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Ut,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Ut,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(vt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(vt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(vt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(vt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ut,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(vt,{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(vt,{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(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function UV(e){if(e.platform==="feishu")return!e.feishuAppId&&!e.feishuAppSecret||!e.feishuAppId||!e.feishuAppSecret?null:{app_id:e.feishuAppId,app_secret:e.feishuAppSecret};if(e.platform==="kael")return!e.kaelUserId&&!e.kaelProjectId||!e.kaelUserId||!e.kaelProjectId?null:{kaelUserId:e.kaelUserId,kaelProjectId:e.kaelProjectId};const t=e.credentialsJson.trim();return t?JSON.parse(t):null}function BV(){var T;const e=Tn(),t=En(),[n,a]=sh(),s=n.get("agent"),o=mh(),c=Ke({queryKey:["adapters"],queryFn:MV}),f=Ke({queryKey:["adapter-mappings"],queryFn:AV}),m=Ke({queryKey:["adapter-statuses"],queryFn:zV,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]),S=x.reduce((G,q)=>{var re;return G+((re=g.get(q.id))!=null&&re.connected?1:0)},0),k=x.length-S,E=c.isLoading||f.isLoading,[C,N]=b.useState(null),[R,z]=b.useState(""),[L,O]=b.useState(null),[B,I]=b.useState(null),[Q,D]=b.useState(null),[Y,ae]=b.useState(null),be=bt({mutationFn:G=>DV({platform:G.platform,agentId:G.agentId,credentials:G.credentials,status:G.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),W=bt({mutationFn:G=>{const q={status:G.status};return G.credentials&&(q.credentials=G.credentials),IV(G.id,q)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),X=bt({mutationFn:LV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),Z=bt({mutationFn:G=>RV({platform:G.platform,externalUserId:G.externalUserId,agentId:G.agentId,boundVia:"manual",displayName:G.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),I(null)}}),te=bt({mutationFn:OV,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function je(G){if(s){G==="bot"?O({agentId:s,editingId:null}):I({agentId:s});return}z(""),N({kind:G})}function Ae(){!C||!R||(C.kind==="bot"?O({agentId:R,editingId:null}):I({agentId:R}),N(null))}function M(G){if(L){if(G.kind==="bot-create")be.mutate({agentId:L.agentId,platform:G.draft.platform,status:G.draft.status,credentials:G.draft.credentials});else if(G.kind==="bot-update"){if(!L.editingId)return;W.mutate({id:L.editingId,status:G.status,credentials:G.credentials})}}}function P(G){!B||G.kind!=="user-create"||Z.mutate({agentId:B.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(kn,{className:"mb-3.5",children:[l.jsxs(Ly,{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})," ",S," 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})," ",k," offline"]})]}),l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>je("bot"),children:[l.jsx(xa,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",x.length]}),E?l.jsx(kf,{children:"Loading…"}):x.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{children:"Connection"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(bc,{children:x.map(G=>{var re;const q=((re=g.get(G.id))==null?void 0:re.connected)??!1;return l.jsxs(aa,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(rt,{children:l.jsx("span",{className:"mono font-medium",children:o(G.agentId)})}),l.jsx(rt,{children:l.jsx(ra,{children:G.platform})}),l.jsx(rt,{children:l.jsx(ra,{tone:G.status==="active"?"accent":"outline",children:G.status})}),l.jsx(rt,{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(rt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsxs(rt,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:xe=>xe.stopPropagation(),children:[l.jsx(ve,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:G.agentId,editingId:G.id,initialPlatform:FV(G.platform),initialStatus:$V(G.status)}),children:"Edit"}),l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(G.id),disabled:X.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(kn,{children:[l.jsxs(Ly,{right:l.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>je("user"),children:[l.jsx(xa,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),E?l.jsx(kf,{children:"Loading…"}):w.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"External user ID"}),l.jsx(Wt,{children:"Display name"}),l.jsx(Wt,{children:"Bound via"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:32}})]})}),l.jsx(bc,{children:w.map(G=>l.jsxs(aa,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(rt,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(G.agentId)})}),l.jsx(rt,{children:l.jsx(ra,{children:G.platform})}),l.jsx(rt,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:G.externalUserId})}),l.jsx(rt,{style:{color:"var(--fg-2)"},children:G.displayName??"—"}),l.jsx(rt,{children:l.jsx(ra,{tone:"outline",children:G.boundVia??"—"})}),l.jsx(rt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsx(rt,{onClick:q=>q.stopPropagation(),children:l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ae(G.id),disabled:te.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(HV,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:p,agentId:R,onAgentChange:z,onCancel:()=>N(null),onConfirm:Ae}),l.jsx(Uk,{open:L!=null,kind:"bot",editingId:(L==null?void 0:L.editingId)??null,initialPlatform:L==null?void 0:L.initialPlatform,initialStatus:L==null?void 0:L.initialStatus,agentLabel:L?o(L.agentId):"",pending:be.isPending||W.isPending,errorMessage:(be.error??W.error)instanceof Error?(be.error??W.error).message:null,onOpenChange:G=>{G||(O(null),be.reset(),W.reset())},onSubmit:M}),l.jsx(Uk,{open:B!=null,kind:"user",editingId:null,agentLabel:B?o(B.agentId):"",pending:Z.isPending,errorMessage:Z.error instanceof Error?Z.error.message:null,onOpenChange:G=>{G||(I(null),Z.reset())},onSubmit:P}),l.jsx(Bk,{open:Q!=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:X.isPending,onConfirm:()=>{Q!=null&&(X.mutate(Q),D(null))}}),l.jsx(Bk,{open:Y!=null,onOpenChange:G=>!G&&ae(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:te.isPending,onConfirm:()=>{Y!=null&&(te.mutate(Y),ae(null))}})]})}function FV(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function $V(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 HV(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(Rn,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(ve,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(ve,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Bk(e){return l.jsx(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(ve,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ve,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function qV({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(BV,{})})]})}function ZV(){return l.jsx(qV,{embedded:!0})}function GV(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=yt(),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(VV,{}),isFirst:!0,children:s?l.jsx(ve,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):l.jsx(ve,{type:"button",size:"sm",variant:"outline",onClick:()=>void n(),disabled:!o,title:o?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function VV(){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 QV(){const{role:e}=yt(),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(yv,{to:e,className:({isActive:n})=>ze("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>l.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:l.jsx("span",{className:"flex-1 truncate",children:t})})})}function Yy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Jl)}const Pg=200;function KV(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 YV(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Jl)}function sT(e){return e==="claude-code"||e==="codex"?e:null}function XV(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=sT(a);if(o)return o}return null}function WV(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function JV(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 eQ({open:e,onOpenChange:t,onCreated:n}){const a=En(),{refreshMe:s,organizationId:o}=yt(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[x,w]=b.useState("organization"),[S,k]=b.useState("claude-code"),[E,C]=b.useState(!1),[N,R]=b.useState([]),[z,L]=b.useState(!1),[O,B]=b.useState(null),[I,Q]=b.useState(null),[D,Y]=b.useState(null),[ae,be]=b.useState(null),[W,X]=b.useState(null),[Z,te]=b.useState(null),[je,Ae]=b.useState(!1),[M,P]=b.useState({}),[F,T]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),w("organization"),k("claude-code"),C(!1),R([]),L(!1),B(null),Q(null),Y(null),be(null),X(null),te(null),Ae(!1),P({}),T({status:"idle"}))},[e]),b.useEffect(()=>{p||h(Yy(c))},[c,p]);const G=b.useRef(0);b.useEffect(()=>{if(!e||!m){T({status:"idle"});return}if(!My.test(m)){T({status:"bad",reason:"invalid"});return}if(Dy(m)){T({status:"bad",reason:"reserved"});return}const le=++G.current;T({status:"checking"});const ge=window.setTimeout(()=>{VI(m).then(Le=>{le===G.current&&(Le.available?T({status:"ok"}):T({status:"bad",reason:Le.reason}))}).catch(()=>{le===G.current&&T({status:"idle"})})},300);return()=>window.clearTimeout(ge)},[m,e]),b.useEffect(()=>{if(!e)return;let le=!1;const ge=async()=>{try{const zt=await ci();if(le)return;const $t=zt.filter(Pn=>Pn.status==="connected").sort((Pn,hr)=>hr.lastSeenAt.localeCompare(Pn.lastSeenAt));R($t),L(!0)}catch{le||L(!0)}};ge();const Le=window.setInterval(ge,3e3);return()=>{le=!0,window.clearInterval(Le)}},[e]),b.useEffect(()=>{if(N.length===0){B(null);return}B(le=>{var ge;return le&&N.some(Le=>Le.id===le)?le:((ge=N[0])==null?void 0:ge.id)??null})},[N]),b.useEffect(()=>{if(!O){Q(null),Y(null);return}let le=!1;const ge=async()=>{try{const zt=await uh(O);if(le)return;Q(zt.capabilities),Y(O)}catch{}};ge();const Le=window.setInterval(ge,3e3);return()=>{le=!0,window.clearInterval(Le)}},[O]),b.useEffect(()=>{if(!e||N.length>0)return;if(ae&&Z&&Z>Date.now()){const ge=Math.max(Z-Date.now(),0),Le=window.setTimeout(()=>{be(null),te(null)},ge);return()=>window.clearTimeout(Le)}ae&&(be(null),X(null),te(null));let le=!1;return(async()=>{try{const ge=await Ce.post("/me/connect-tokens",{});if(le)return;be(ge.token),X(ge.command),te(Date.now()+ge.expiresIn*1e3)}catch{}})(),()=>{le=!0}},[e,N.length,ae,Z]);const q=O&&D===O?I:null,re=b.useMemo(()=>{if(!q)return[];const le=[];for(const[ge,Le]of Object.entries(q)){if(Le.state!=="ok")continue;const zt=sT(ge);zt&&le.push(zt)}return le},[q]);b.useEffect(()=>{q&&k(le=>{var ge;return((ge=q[le])==null?void 0:ge.state)==="ok"?le:XV(q)??le})},[q]);const xe=bt({mutationFn:async le=>{const ge=c.trim()||m.trim()||"Untitled assistant";return GI({name:m||void 0,type:"personal_assistant",displayName:ge,clientId:le.clientId,runtimeProvider:S,visibility:x,...o?{organizationId:o}:{}})},onSuccess:le=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(le,S)}}),we=b.useMemo(()=>{const le=xe.error;if(!le)return{};if(le instanceof Js){const ge=KV(le.issues);return Object.keys(ge).length>0?ge:le.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:le.message}}return le instanceof Error?{_root:le.message}:{}},[xe.error]),me=F.status==="bad"?JV(F.reason):void 0,De={...me?{name:me}:{},...we,...M};function Ue(){const le={};return m?m.length>Jl?le.name=`Agent name must be at most ${Jl} characters (got ${m.length}).`:My.test(m)?Dy(m)&&(le.name="That agent name is reserved — pick a different one."):le.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(le.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Pg&&(le.displayName=`Display name must be at most ${Pg} characters (got ${c.length}).`),le}function ft(le){le.preventDefault();const ge=Ue();P(ge),!(Object.keys(ge).length>0)&&F.status!=="bad"&&O&&(re.length===0||!re.includes(S)||xe.mutate({clientId:O}))}const ut=F.status==="bad",ie=c.trim().length>0&&!ut&&!xe.isPending&&!!O&&re.length>0&&re.includes(S);return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{className:"max-w-lg",children:[l.jsx(Ln,{children:l.jsx(On,{children:"New Agent"})}),l.jsxs("form",{onSubmit:ft,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Ut,{id:"new-agent-display-name",value:c,onChange:le=>{f(le.target.value),M.displayName&&P(ge=>({...ge,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Pg,"aria-invalid":De.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),l.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),De.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:De.displayName}),!E&&(c.trim()||m)&&l.jsxs("div",{className:"flex items-baseline gap-2 text-caption text-muted-foreground",children:[m?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"font-mono",children:["@",m]}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("span",{children:"permanent"})]}):l.jsx("span",{className:"italic",children:"No @handle from this display name"}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("button",{type:"button",onClick:()=>C(!0),className:"text-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Edit"})]}),!E&&De.name&&l.jsx("p",{className:"text-caption text-destructive",children:De.name})]}),E&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(vt,{htmlFor:"new-agent-name",children:"Agent name"}),l.jsx("button",{type:"button",onClick:()=>C(!1),className:"text-caption text-muted-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Done"})]}),l.jsxs("div",{className:"flex items-stretch",children:[l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),l.jsx(Ut,{id:"new-agent-name",value:m,autoFocus:!0,onChange:le=>{const ge=YV(le.target.value);h(ge),g(!0),M.name&&P(Le=>({...Le,name:void 0}))},onBlur:le=>{const ge=Yy(le.target.value);ge!==m&&h(ge)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Jl,"aria-invalid":De.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),l.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",Jl," characters. Permanent after creation."]}),m&&!De.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."]}),De.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:De.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:x==="organization"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="organization",onChange:()=>w("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent. (default)"})]})]}),l.jsxs("label",{className:x==="private"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="private",onChange:()=>w("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed."})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(vt,{children:"Where it runs"}),z?N.length===0?l.jsx(tQ,{command:W,copied:je,onCopy:async()=>{W&&(await navigator.clipboard.writeText(W),Ae(!0),window.setTimeout(()=>Ae(!1),1500))}}):N.length===1?l.jsx(nQ,{client:N[0]}):l.jsx("div",{className:"space-y-2",children:N.map(le=>{const ge=O===le.id;return l.jsxs("label",{className:ge?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"picked-client",checked:ge,onChange:()=>B(le.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:le.hostname??le.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[le.os??"unknown OS"," · last seen ",new Date(le.lastSeenAt).toLocaleString()]})]})]},le.id)})}):l.jsx("p",{className:"text-caption text-muted-foreground",children:"Detecting connected computers…"}),O&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),q===null?l.jsx("p",{className:"text-caption text-muted-foreground",children:"Detecting installed runtimes…"}):re.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:re.map(le=>{const ge=S===le;return l.jsxs("label",{className:ge?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:ge,onChange:()=>k(le)}),l.jsx("span",{className:"text-body",children:WV(le)})]},le)})})]}),De.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:De.clientId})]}),De._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:De._root}),l.jsx(fr,{children:l.jsx(ve,{type:"submit",disabled:!ie,children:xe.isPending?"Creating…":"Create"})})]})]})})}function tQ({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 nQ({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 lT({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 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 aQ(){const{organizationId:e}=yt(),[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 Ce.get(yy(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 Ce.post(yy(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(iT,{children:["Anyone with this link can join your team as a member. Links expire after ",gB," 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(ve,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(ve,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),l.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${rQ(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const xb=[{key:"name",label:"Name",width:260},{key:"delegate",label:"Delegate",width:160},{key:"manager",label:"Manager",width:160},{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 iQ({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(aa,{children:xb.map(c=>l.jsx(Wt,{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(sQ,{group:c,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},c.key))]})}function sQ({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(oQ,{group:e,open:c,onToggle:()=>f(m=>!m)}),c&&e.rows.length===0&&e.emptyMessage&&l.jsx(aa,{children:l.jsx(rt,{colSpan:xb.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(uQ,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(dQ,{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 lQ(e){switch(e){case"humans":return vE;case"shared":return dE;case"private":case"other-private":return Ev;default:return null}}function oQ({group:e,open:t,onToggle:n}){const a=lQ(e.key),s=l.jsxs("span",{className:"inline-flex items-center",style:{gap:"var(--sp-2)"},children:[e.collapsible&&l.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,color:"var(--fg-4)"},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(ra,{tone:"outline",children:e.count})]});return l.jsx(aa,{children:l.jsx("td",{colSpan:xb.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,padding:0,cursor:"pointer",color:"inherit"},children:s}):s})})}function uQ({row:e,actions:t,isLast:n}){return l.jsxs(aa,{children:[l.jsx(rt,{style:jr(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(oT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(rt,{style:jr(n),children:l.jsx(cQ,{row:e})}),l.jsx(rt,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(rt,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(rt,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(rt,{className:"mono text-caption",style:jr(n,{color:"var(--fg-4)"}),children:DE(e.createdAt)}),l.jsx(rt,{style:jr(n,{padding:0,textAlign:"right"}),children:l.jsx(uT,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function cQ({row:e}){if(!e.delegate&&!e.canEditDelegate)return l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"—"});const t=e.delegate?l.jsx(FN,{name:e.delegate.name,displayName:e.delegate.displayName}):l.jsx("span",{style:{color:"var(--accent-dim)"},children:"Set delegate →"}),n=e.delegate?e.canEditDelegate?"Change delegate":void 0:"Set delegate";return e.canEditDelegate?l.jsx("button",{type:"button",onClick:e.onEditDelegate,className:"text-label hover:underline",style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"inherit",textAlign:"left"},title:n,children:t}):l.jsx("span",{className:"text-label",title:n,children:t})}function dQ({row:e,runtime:t,clientHost:n,actions:a,onClick:s,isLast:o}){const{agent:c,managerLabel:f,isOwnedBySelf:m}=e;return l.jsxs(aa,{interactive:!0,onClick:s,children:[l.jsx(rt,{style:jr(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(oT,{displayName:c.displayName,handle:c.name?`@${c.name}`:null})}),l.jsx(rt,{className:"text-label",style:jr(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(rt,{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(rt,{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(rt,{style:jr(o),children:l.jsx(mc,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(rt,{className:"mono text-caption",style:jr(o,{color:"var(--fg-4)"}),children:DE(c.createdAt)}),l.jsx(rt,{style:jr(o,{padding:0,textAlign:"right"}),onClick:h=>h.stopPropagation(),children:l.jsx(uT,{actions:a,ariaLabel:`Actions for ${c.displayName}`})})]})}function oT({displayName:e,handle:t,selfTag:n}){return l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:e,children:[e,n&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function uT({actions:e,ariaLabel:t}){const[n,a]=b.useState(!1),[s,o]=b.useState("down"),c=b.useRef(null),f=b.useRef(null);return b.useEffect(()=>{if(!n)return;const m=p=>{c.current&&!c.current.contains(p.target)&&a(!1)},h=p=>{p.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[n]),b.useEffect(()=>{if(!n||!f.current)return;const m=32,h=8,p=f.current.getBoundingClientRect(),g=window.innerHeight-p.bottom,x=e.length*m+h;o(g>=x?"down":"up")},[n,e.length]),e.length===0?null:l.jsxs("div",{ref:c,className:"relative inline-flex",children:[l.jsx("button",{ref:f,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":n,onClick:m=>{m.stopPropagation(),a(h=>!h)},className:"inline-flex items-center justify-center",style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(Qz,{className:"h-3.5 w-3.5"})}),n&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",style:{minWidth:180,borderColor:"var(--border)",...s==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(m=>l.jsx("button",{type:"button",role:"menuitem",disabled:m.disabled,onClick:h=>{h.stopPropagation(),a(!1),m.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:m.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:m.disabled?"not-allowed":"pointer"},children:m.label},m.key))})]})}const Fk=100,$k=100;async function fQ(e){const t=[];let n;for(let a=0;a<$k;a++){const s=await e(n?{limit:Fk,cursor:n}:{limit:Fk});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${$k} pages; server cursor pagination may be broken`)}function hQ(){const{role:e,memberId:t}=yt(),n=e==="admin",a=Tn(),s=En(),o=HN(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState("all"),[E,C]=b.useState(""),N=Ke({queryKey:["members"],queryFn:$N}),R=Ke({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>fQ(q=>n?qI(q):Mc(q))}),{data:z}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),L=b.useMemo(()=>{const q=new Map;for(const re of(z==null?void 0:z.agents)??[])q.set(re.agentId,re);return q},[z==null?void 0:z.agents]),{data:O}=Ke({queryKey:["clients","team-page"],queryFn:ci,staleTime:3e4}),B=b.useMemo(()=>{const q=new Map;for(const re of O??[])re.hostname&&q.set(re.id,re.hostname);return q},[O]),I=b.useMemo(()=>N.data??[],[N.data]),Q=b.useMemo(()=>R.data??[],[R.data]),D=b.useMemo(()=>{const q=new Map;for(const re of Q)q.set(re.uuid,re);return q},[Q]),Y=b.useMemo(()=>Q.filter(q=>q.type!=="human"),[Q]),ae=b.useMemo(()=>Y.filter(q=>q.visibility==="organization"),[Y]),be=b.useMemo(()=>Y.filter(q=>q.visibility==="private"&&q.managerId===t),[Y,t]),W=b.useMemo(()=>Y.filter(q=>q.visibility==="private"&&q.managerId!==t),[Y,t]),X=bt({mutationFn:async q=>S9(q.id,q.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),Z=bt({mutationFn:k9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),te=bt({mutationFn:zC,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),je=bt({mutationFn:MC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),Ae=bt({mutationFn:DC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),M=bt({mutationFn:async q=>Ty(q.humanAgentId,{delegateMention:q.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),P=E.trim().toLowerCase(),F=b.useMemo(()=>gQ({filter:S,search:P,isAdmin:n,selfMemberId:t,members:I,sharedAgents:ae,yourPrivateAgents:be,otherPrivateAgents:W,resolveMember:o,agentByUuid:D,openDelegate:(q,re)=>{var xe;return w({humanAgentId:q,humanDisplayName:re,currentDelegate:((xe=D.get(q))==null?void 0:xe.delegateMention)??null})}}),[S,P,n,t,I,ae,be,W,o,D]);function T(q){const re=[];return n&&re.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:q.id,username:q.username,displayName:q.displayName,role:q.role})}),n&&!q.isSelf&&re.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)}}),re}function G(q){const{agent:re,isOwnedBySelf:xe}=q,we=n||xe,me=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(re.uuid)}`)}];return we&&(re.status==="suspended"?me.push({key:"reactivate",label:"Reactivate",onSelect:()=>Ae.mutate(re.uuid)}):me.push({key:"suspend",label:"Suspend",onSelect:()=>je.mutate(re.uuid)}),me.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${re.displayName}? This cannot be undone.`)&&te.mutate(re.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(ve,{size:"xs",onClick:()=>h(!0),children:[l.jsx(xa,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(ve,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(yE,{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(pQ,{filter:S,onFilter:k,query:E,onQuery:C,counts:{humans:I.length,shared:ae.length,private:be.length}}),R.isLoading||N.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):R.error||N.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",mQ(R.error??N.error)]}):l.jsx(iQ,{groups:F,runtimeMap:L,clientHostMap:B,onAgentClick:q=>a(`/agents/${encodeURIComponent(q)}`),getHumanActions:T,getAgentActions:G})]}),l.jsx(Rn,{open:c,onOpenChange:f,children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{children:"Invite link"})}),l.jsx(aQ,{})]})}),l.jsx(eQ,{open:m,onOpenChange:h,onCreated:(q,re)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(bQ,{target:p,isAdmin:n,isSaving:X.isPending,onClose:()=>g(null),onSave:async q=>{p&&(await X.mutateAsync({id:p.id,patch:q}),g(null))}}),l.jsx(xQ,{target:x,candidates:yQ(Q),isSaving:M.isPending,onClose:()=>w(null),onSave:async q=>{x&&(await M.mutateAsync({humanAgentId:x.humanAgentId,delegateMention:q}),w(null))}})]})}function mQ(e){return e instanceof Error?e.message:String(e)}function pQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"humans",label:"Humans",count:s.humans},{key:"shared",label:"Shared agents",count:s.shared},{key:"private",label:"Your private",count:s.private}];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(lT,{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(oh,{"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(Ut,{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 gQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,sharedAgents:c,yourPrivateAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=I=>{const Q=h.get(I);if(!(Q!=null&&Q.delegateMention))return null;const D=h.get(Q.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),S=t==="all"||t==="humans",k=t==="all"||t==="shared",E=t==="all"||t==="private",C=a&&t==="all",N=o.filter(x).map(I=>{const Q=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:Q,delegate:g(I.agentId),canEditDelegate:Q||a,onEditDelegate:()=>p(I.agentId,I.displayName)}}).sort((I,Q)=>Number(Q.isSelf)-Number(I.isSelf)),R=I=>({kind:"agent",agent:I,managerLabel:I.managerId?e.resolveMember(I.managerId):null,isOwnedBySelf:I.managerId===s}),z=c.filter(w).map(R),L=f.filter(w).map(R),O=m.filter(w).map(R),B=[];return S&&B.push({key:"humans",title:"Humans",count:N.length,rows:N,emptyMessage:n?"No humans match this search.":void 0}),k&&B.push({key:"shared",title:"Shared agents",count:z.length,rows:z,emptyMessage:n?"No shared agents match this search.":"No shared agents yet."}),E&&B.push({key:"private",title:"Your private agents",count:L.length,rows:L,emptyMessage:n?"No private agents match this search.":"No private agents — pick Private in the create dialog to keep one to yourself."}),C&&O.length>0&&B.push({key:"other-private",title:"Other members' private agents",count:O.length,rows:O,collapsible:!0}),B}function yQ(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const vQ=Object.values(SB);function bQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(c(e.displayName),m(e.role),p(null))},[e]);async function g(w){if(w.preventDefault(),!e)return;const S={};if(o.trim()&&o!==e.displayName&&(S.displayName=o.trim()),t&&f!==e.role&&(S.role=f),Object.keys(S).length===0){a();return}try{await s(S)}catch(k){p(k instanceof Error?k.message:String(k))}}const x=e!==null;return l.jsx(Rn,{open:x,onOpenChange:w=>w?void 0:a(),children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{children:"Username"}),l.jsx(Ut,{value:e.username,disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Ut,{id:"edit-member-display",value:o,onChange:w=>c(w.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(vt,{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(ve,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function xQ({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(Rn,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(Cn,{children:[l.jsx(Ln,{children:l.jsx(On,{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(vt,{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(ve,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ve,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Mh(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function wb(e){return Ce.get(Mh(e,"context_tree"))}function cT(e,t){return Ce.put(Mh(e,"context_tree"),t)}function dT(e){return Ce.get(Mh(e,"source_repos"))}function fT(e,t){return Ce.put(Mh(e,"source_repos"),t)}function Xy({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(wQ,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:x,style:{...w,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:S=>a==null?void 0:a(S.target.value),type:c,placeholder:f,pattern:p,className:x,style:w}),m]})]})}function wQ(){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 hT({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(pE,{className:"h-4 w-4 animate-spin"}):l.jsx(cr,{className:"h-4 w-4"})})}function SQ({isFirst:e=!1}){const{organizationId:t}=yt(),n=En(),a=Ke({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?wb(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=bt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return cT(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(Xy,{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(Xy,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(hT,{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 kQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=yt(),a=n==="admin",s=En(),o=Ke({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?dT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=bt({mutationFn:async p=>{var w;if(!t)throw new Error("organization not loaded");const x=(((w=o.data)==null?void 0:w.repos)??[]).filter(S=>S.url!==p);return fT(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 EQ(e){return Ce.get(`/orgs/${encodeURIComponent(e)}`)}function CQ(e,t){return Ce.patch(`/orgs/${encodeURIComponent(e)}`,t)}function NQ({isFirst:e=!1}){const{organizationId:t}=yt(),n=En(),a=Ke({queryKey:["organization",t],queryFn:()=>t?EQ(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=bt({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):CQ(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(Xy,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(hT,{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 _Q(){const{role:e}=yt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(NQ,{isFirst:!0}),t&&l.jsx(SQ,{}),l.jsx(kQ,{isFirst:!t})]})}function TQ(){const{role:e}=yt();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(_Q,{})})]})}function eh(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter);const n=t.toString();return Ce.get(An(`/chats${n?`?${n}`:""}`))}function AQ(e){return Ce.post(An("/chats"),e)}function RQ(e){return Ce.post(`/chats/${encodeURIComponent(e)}/read`)}function mT(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function OQ(e){return Ce.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const th="draft";function zQ(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 MQ(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function DQ({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=b.useState("all"),[o,c]=b.useState(""),[f,m]=b.useState([]),[h,p]=b.useState(!1),[g,x]=b.useState(null),{data:w,isLoading:S}=Ke({queryKey:["me","chats",a],queryFn:()=>eh({filter:a}),refetchInterval:15e3}),k=()=>{f.length>0&&m([]),x(null)},E=(w==null?void 0:w.rows)??[],C=b.useMemo(()=>[...E,...f],[E,f]),N=b.useMemo(()=>{const I=o.trim().toLowerCase();return I?C.filter(Q=>Q.title.toLowerCase().includes(I)||(Q.lastMessagePreview??"").toLowerCase().includes(I)?!0:Q.participants.map(be=>be.displayName.toLowerCase()).join(" ").includes(I)):C},[C,o]),R=async()=>{if(h)return;const I=w==null?void 0:w.nextCursor;if(I){p(!0),x(null);try{const Q=await eh({filter:a,cursor:I});m(D=>[...D,...Q.rows]),L(Q.nextCursor)}catch(Q){x(Q instanceof Error?Q.message:"Failed to load more")}finally{p(!1)}}},[z,L]=b.useState(null),O=(w==null?void 0:w.nextCursor)??null;b.useEffect(()=>{L(O)},[O]);const B=b.useMemo(()=>C.reduce((I,Q)=>I+(Q.unreadMentionCount>0?1:0),0),[C]);return l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===th?"var(--bg-active)":"transparent",color:e===th?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[l.jsx(xa,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),l.jsxs("div",{className:"flex items-center",style:{gap:8},children:[l.jsx("div",{className:"flex gap-1 shrink-0",children:B>0&&l.jsx(lT,{active:a==="unread",count:B,onClick:()=>{s(a==="unread"?"all":"unread"),k()},children:"unread"})}),l.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[l.jsx(oh,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx("input",{value:o,onChange:I=>c(I.target.value),placeholder:"Search…",className:"w-full outline-none text-caption",style:{padding:"var(--sp-0_5) var(--sp-1) var(--sp-0_5) var(--sp-5)",background:"transparent",border:"none",color:"var(--fg-2)"}})]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[S&&N.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!S&&N.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:o?"No matches":l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:0},children:"No conversations yet."}),l.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),N.map(I=>{const Q=e===I.chatId,D=MQ(I),Y=D&&D!==I.title?D:"",ae=I.unreadMentionCount>0;return l.jsx("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>t(I.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:Q?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${Q?"var(--accent)":"transparent"}`},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[ae&&l.jsx("span",{"aria-label":`${I.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),l.jsx("span",{className:"truncate text-subtitle",style:{color:ae?"var(--fg)":"var(--fg-2)",fontWeight:ae?700:500,flex:1,minWidth:0},children:I.title}),I.lastMessageAt&&l.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:zQ(I.lastMessageAt)})]}),l.jsx("div",{className:"truncate text-body",style:{color:ae?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:Y||"—"})]})},I.chatId)}),z&&N.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:R,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 pT(e){return Ce.get(`/chats/${encodeURIComponent(e)}`)}function IQ(e,t){return Ce.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function jo(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function LQ(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function PQ(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 Sb(e){return Ce.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function UQ(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 Ce.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}function kb(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 BQ(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function jb({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}),BQ(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function FQ(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 $Q(e,t){if(!t)return[...e].sort((a,s)=>(a.displayName??a.name??"").localeCompare(s.displayName??s.name??"")).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:o.startsWith(t)?c=1:o.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function HQ(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 gT({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:FQ(e,t),[e,t,s]),p=b.useMemo(()=>h?$Q(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{c(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const x=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&p.length>0&&!x;function S(){m((h==null?void 0:h.triggerIndex)??null)}function k(C){if(!h)return;const N=HQ(e,h,t,C);N&&a(N)}return{trigger:w?h:null,results:w?p:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(N=>p.length===0?0:(N+1)%p.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(N=>p.length===0?0:(N-1+p.length)%p.length),!0;if(C.key==="Enter"||C.key==="Tab"){const N=p[o]??p[0];return N?(C.preventDefault(),k(N),!0):!1}return C.key==="Escape"?(C.preventDefault(),S(),!0):!1},pick:k,dismiss:S}}function yT({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=kb(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(jb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function qQ({onCreated:e}){const t=En(),{agentId:n}=yt(),a=Lv(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(!1),E=b.useRef(null),C=b.useRef(!1),N=b.useRef(null),{data:R}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),z=b.useMemo(()=>{const W=(R==null?void 0:R.agents)??[],X=[];for(const Z of W){if(n&&Z.agentId===n)continue;const te=a(Z.agentId);!te||!te.name||X.push({agentId:Z.agentId,name:te.name,displayName:te.displayName})}return X},[R,a,n]);b.useEffect(()=>{if(C.current||s.length>0||z.length===0)return;const W=GQ(z,(R==null?void 0:R.agents)??[]);W&&(o([W]),C.current=!0)},[z,R,s.length]);const L=b.useMemo(()=>{const W=z.map(X=>({agentId:X.agentId,name:X.name}));return pN(c,W)},[c,z]),O=gT({value:c,cursor:m,candidates:z,disabled:x,onSelect:W=>{f(W.text),h(W.cursor),requestAnimationFrame(()=>{const X=E.current;X&&(X.focus(),X.setSelectionRange(W.cursor,W.cursor))})}});b.useEffect(()=>{L.length!==0&&o(W=>{const X=new Set(W);let Z=!1;for(const te of L)X.has(te)||(X.add(te),Z=!0);return Z?[...X]:W})},[L]),b.useEffect(()=>{if(!S)return;const W=X=>{N.current&&(N.current.contains(X.target)||k(!1))};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[S]);const B=bt({mutationFn:async({participantIds:W,text:X})=>{const Z=await AQ({participantIds:W}),te=X.trim();return te.length>0&&await jo(Z.chatId,te),Z.chatId},onSuccess:W=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(W)},onError:W=>{g(W instanceof Error?W.message:"Failed to create chat")}}),I=b.useMemo(()=>!(x||B.isPending||s.length===0||c.trim().length===0||s.length>=2&&L.length===0),[x,B.isPending,s.length,c,L.length]),Q=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&L.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,L.length]),D=async()=>{if(!I)return;const W=Array.from(new Set([...s,...L]));g(null),w(!0);try{await B.mutateAsync({participantIds:W,text:c})}finally{w(!1)}},Y=W=>{o(X=>X.filter(Z=>Z!==W))},ae=W=>{o(X=>X.includes(W)?X:[...X,W]),k(!1)},be=b.useMemo(()=>z.filter(W=>!s.includes(W.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(ZQ,{chips:s,candidates:z,chipCandidates:be,pickerOpen:S,setPickerOpen:k,pickerContainerRef:N,onAdd:ae,onRemove:Y}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(yT,{trigger:O.trigger,results:O.results,highlightIndex:O.highlightIndex,anchorRef:E,onPick:O.pick}),l.jsx("textarea",{ref:E,value:c,onChange:W=>{f(W.target.value),h(W.target.selectionStart??W.target.value.length)},onSelect:W=>{h(W.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:W=>{O.handleKey(W)||W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),D())},disabled:x||B.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}}),s.length>=2&&L.length===0&&c.trim().length>0&&l.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void D(),disabled:!I,title:Q??"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(cE,{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 ZQ({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(xa,{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=kb(n);return n.map(h=>l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>c(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(jb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function GQ(e,t){var o;const n=new Set(e.map(c=>c.agentId)),a=[...t].filter(c=>n.has(c.agentId)&&c.runtimeUpdatedAt).sort((c,f)=>(f.runtimeUpdatedAt??"").localeCompare(c.runtimeUpdatedAt??""))[0];if(a)return a.agentId;const s=t.find(c=>n.has(c.agentId)&&c.type==="personal_assistant");return s?s.agentId:((o=e[0])==null?void 0:o.agentId)??null}const VQ="first-tree-hub-images",QQ=1,Eo="images";let jf=null;function vT(){return jf||(jf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(VQ,QQ);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 KQ(e){const t=await vT();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 YQ(e){const t=await vT();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 XQ(e,t,n){return Ce.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:bT,setPrototypeOf:Hk,isFrozen:WQ,getPrototypeOf:JQ,getOwnPropertyDescriptor:eK}=Object;let{freeze:dr,seal:sa,create:Kl}=Object,{apply:Wy,construct:Jy}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});sa||(sa=function(t){return t});Wy||(Wy=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];return t.apply(n,s)});Jy||(Jy=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const qu=jn(Array.prototype.forEach),tK=jn(Array.prototype.lastIndexOf),qk=jn(Array.prototype.pop),Zu=jn(Array.prototype.push),nK=jn(Array.prototype.splice),sr=Array.isArray,Xu=jn(String.prototype.toLowerCase),Ug=jn(String.prototype.toString),Zk=jn(String.prototype.match),Zl=jn(String.prototype.replace),Gk=jn(String.prototype.indexOf),rK=jn(String.prototype.trim),aK=jn(Number.prototype.toString),iK=jn(Boolean.prototype.toString),Vk=typeof BigInt>"u"?null:jn(BigInt.prototype.toString),Qk=typeof Symbol>"u"?null:jn(Symbol.prototype.toString),rn=jn(Object.prototype.hasOwnProperty),Gu=jn(Object.prototype.toString),qn=jn(RegExp.prototype.test),Ef=sK(TypeError);function jn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return Wy(e,t,a)}}function sK(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Jy(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xu;if(Hk&&Hk(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&&(WQ(t)||(t[a]=o),s=o)}e[s]=!0}return e}function lK(e){for(let t=0;t<e.length;t++)rn(e,t)||(e[t]=null);return e}function wr(e){const t=Kl(null);for(const[n,a]of bT(e))rn(e,n)&&(sr(a)?t[n]=lK(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=wr(a):t[n]=a);return t}function oK(e){switch(typeof e){case"string":return e;case"number":return aK(e);case"boolean":return iK(e);case"bigint":return Vk?Vk(e):"0";case"symbol":return Qk?Qk(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=eK(e,t);if(a){if(a.get)return jn(a.get);if(typeof a.value=="function")return jn(a.value)}e=JQ(e)}function n(){return null}return n}function uK(e){try{return qn(e,""),!0}catch{return!1}}const Kk=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"]),Bg=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"]),Fg=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"]),cK=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"]),$g=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"]),dK=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yk=dr(["#text"]),Xk=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"]),Hg=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"]),Wk=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"]),fK=sa(/\{\{[\w\W]*|[\w\W]*\}\}/gm),hK=sa(/<%[\w\W]*|[\w\W]*%>/gm),mK=sa(/\$\{[\w\W]*/gm),pK=sa(/^data-[\-\w.\u00B7-\uFFFF]+$/),gK=sa(/^aria-[\-\w]+$/),xT=sa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yK=sa(/^(?:\w+script|data):/i),vK=sa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wT=sa(/^html$/i),bK=sa(/^[a-z][.\w]*(-[.\w]+)+$/i);var Jk=Object.freeze({__proto__:null,ARIA_ATTR:gK,ATTR_WHITESPACE:vK,CUSTOM_ELEMENT:bK,DATA_ATTR:pK,DOCTYPE_NAME:wT,ERB_EXPR:hK,IS_ALLOWED_URI:xT,IS_SCRIPT_OR_DATA:yK,MUSTACHE_EXPR:fK,TMPLIT_EXPR:mK});const Vu={element:1,text:3,progressingInstruction:7,comment:8,document:9},xK=function(){return typeof window>"u"?null:window},wK=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}},ej=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ST(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xK();const t=Pe=>ST(Pe);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,S=m.prototype,k=Yl(S,"cloneNode"),E=Yl(S,"remove"),C=Yl(S,"nextSibling"),N=Yl(S,"childNodes"),R=Yl(S,"parentNode");if(typeof c=="function"){const Pe=n.createElement("template");Pe.content&&Pe.content.ownerDocument&&(n=Pe.content.ownerDocument)}let z,L="";const{implementation:O,createNodeIterator:B,createDocumentFragment:I,getElementsByTagName:Q}=n,{importNode:D}=a;let Y=ej();t.isSupported=typeof bT=="function"&&typeof R=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ae,ERB_EXPR:be,TMPLIT_EXPR:W,DATA_ATTR:X,ARIA_ATTR:Z,IS_SCRIPT_OR_DATA:te,ATTR_WHITESPACE:je,CUSTOM_ELEMENT:Ae}=Jk;let{IS_ALLOWED_URI:M}=Jk,P=null;const F=We({},[...Kk,...Bg,...Fg,...$g,...Yk]);let T=null;const G=We({},[...Xk,...Hg,...Wk,...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}})),re=null,xe=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,De=!0,Ue=!1,ft=!0,ut=!1,ie=!0,le=!1,ge=!1,Le=!1,zt=!1,$t=!1,Pn=!1,hr=!0,pi=!1;const gi="user-content-";let un=!0,da=!1,ue={},ye=null;const Fe=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const at=We({},["audio","video","img","source","image","track"]);let cn=null;const tr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ht="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let it=Tt,nr=!1,zn=null;const il=We({},[Ht,Lt,Tt],Ug);let fa=We({},["mi","mo","mn","ms","mtext"]),ha=We({},["annotation-xml"]);const Ma=We({},["title","style","font","a","script"]);let Vn=null;const Da=["application/xhtml+xml","text/html"],Sa="text/html";let qt=null,Ee=null;const tt=n.createElement("form"),pn=function($){return $ instanceof RegExp||$ instanceof Function},Tr=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ee&&Ee===$)return;(!$||typeof $!="object")&&($={}),$=wr($),Vn=Da.indexOf($.PARSER_MEDIA_TYPE)===-1?Sa:$.PARSER_MEDIA_TYPE,qt=Vn==="application/xhtml+xml"?Ug:Xu,P=rn($,"ALLOWED_TAGS")&&sr($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,qt):F,T=rn($,"ALLOWED_ATTR")&&sr($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,qt):G,zn=rn($,"ALLOWED_NAMESPACES")&&sr($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Ug):il,cn=rn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)?We(wr(tr),$.ADD_URI_SAFE_ATTR,qt):tr,Ve=rn($,"ADD_DATA_URI_TAGS")&&sr($.ADD_DATA_URI_TAGS)?We(wr(at),$.ADD_DATA_URI_TAGS,qt):at,ye=rn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,qt):Fe,re=rn($,"FORBID_TAGS")&&sr($.FORBID_TAGS)?We({},$.FORBID_TAGS,qt):wr({}),xe=rn($,"FORBID_ATTR")&&sr($.FORBID_ATTR)?We({},$.FORBID_ATTR,qt):wr({}),ue=rn($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?wr($.USE_PROFILES):$.USE_PROFILES:!1,me=$.ALLOW_ARIA_ATTR!==!1,De=$.ALLOW_DATA_ATTR!==!1,Ue=$.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ut=$.SAFE_FOR_TEMPLATES||!1,ie=$.SAFE_FOR_XML!==!1,le=$.WHOLE_DOCUMENT||!1,zt=$.RETURN_DOM||!1,$t=$.RETURN_DOM_FRAGMENT||!1,Pn=$.RETURN_TRUSTED_TYPE||!1,Le=$.FORCE_BODY||!1,hr=$.SANITIZE_DOM!==!1,pi=$.SANITIZE_NAMED_PROPS||!1,un=$.KEEP_CONTENT!==!1,da=$.IN_PLACE||!1,M=uK($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:xT,it=typeof $.NAMESPACE=="string"?$.NAMESPACE:Tt,fa=rn($,"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"]),ha=rn($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?wr($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const pe=rn($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?wr($.CUSTOM_ELEMENT_HANDLING):Kl(null);if(q=Kl(null),rn(pe,"tagNameCheck")&&pn(pe.tagNameCheck)&&(q.tagNameCheck=pe.tagNameCheck),rn(pe,"attributeNameCheck")&&pn(pe.attributeNameCheck)&&(q.attributeNameCheck=pe.attributeNameCheck),rn(pe,"allowCustomizedBuiltInElements")&&typeof pe.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=pe.allowCustomizedBuiltInElements),ut&&(De=!1),$t&&(zt=!0),ue&&(P=We({},Yk),T=Kl(null),ue.html===!0&&(We(P,Kk),We(T,Xk)),ue.svg===!0&&(We(P,Bg),We(T,Hg),We(T,Cf)),ue.svgFilters===!0&&(We(P,Fg),We(T,Hg),We(T,Cf)),ue.mathMl===!0&&(We(P,$g),We(T,Wk),We(T,Cf))),we.tagCheck=null,we.attributeCheck=null,rn($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?we.tagCheck=$.ADD_TAGS:sr($.ADD_TAGS)&&(P===F&&(P=wr(P)),We(P,$.ADD_TAGS,qt))),rn($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?we.attributeCheck=$.ADD_ATTR:sr($.ADD_ATTR)&&(T===G&&(T=wr(T)),We(T,$.ADD_ATTR,qt))),rn($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)&&We(cn,$.ADD_URI_SAFE_ATTR,qt),rn($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)&&(ye===Fe&&(ye=wr(ye)),We(ye,$.FORBID_CONTENTS,qt)),rn($,"ADD_FORBID_CONTENTS")&&sr($.ADD_FORBID_CONTENTS)&&(ye===Fe&&(ye=wr(ye)),We(ye,$.ADD_FORBID_CONTENTS,qt)),un&&(P["#text"]=!0),le&&We(P,["html","head","body"]),P.table&&(We(P,["tbody"]),delete re.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,L=z.createHTML("")}else z===void 0&&(z=wK(w,s)),z!==null&&typeof L=="string"&&(L=z.createHTML(""));dr&&dr($),Ee=$},yi=We({},[...Bg,...Fg,...cK]),ys=We({},[...$g,...dK]),$c=function($){let pe=R($);(!pe||!pe.tagName)&&(pe={namespaceURI:it,tagName:"template"});const Ne=Xu($.tagName),wt=Xu(pe.tagName);return zn[$.namespaceURI]?$.namespaceURI===Lt?pe.namespaceURI===Tt?Ne==="svg":pe.namespaceURI===Ht?Ne==="svg"&&(wt==="annotation-xml"||fa[wt]):!!yi[Ne]:$.namespaceURI===Ht?pe.namespaceURI===Tt?Ne==="math":pe.namespaceURI===Lt?Ne==="math"&&ha[wt]:!!ys[Ne]:$.namespaceURI===Tt?pe.namespaceURI===Lt&&!ha[wt]||pe.namespaceURI===Ht&&!fa[wt]?!1:!ys[Ne]&&(Ma[Ne]||!yi[Ne]):!!(Vn==="application/xhtml+xml"&&zn[$.namespaceURI]):!1},rr=function($){Zu(t.removed,{element:$});try{R($).removeChild($)}catch{E($)}},ma=function($,pe){try{Zu(t.removed,{attribute:pe.getAttributeNode($),from:pe})}catch{Zu(t.removed,{attribute:null,from:pe})}if(pe.removeAttribute($),$==="is")if(zt||$t)try{rr(pe)}catch{}else try{pe.setAttribute($,"")}catch{}},Lo=function($){let pe=null,Ne=null;if(Le)$="<remove></remove>"+$;else{const Xt=Zk($,/^[\r\n\t ]+/);Ne=Xt&&Xt[0]}Vn==="application/xhtml+xml"&&it===Tt&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const wt=z?z.createHTML($):$;if(it===Tt)try{pe=new x().parseFromString(wt,Vn)}catch{}if(!pe||!pe.documentElement){pe=O.createDocument(it,"template",null);try{pe.documentElement.innerHTML=nr?L:wt}catch{}}const ht=pe.body||pe.documentElement;return $&&Ne&&ht.insertBefore(n.createTextNode(Ne),ht.childNodes[0]||null),it===Tt?Q.call(pe,le?"html":"body")[0]:le?pe.documentElement:ht},Po=function($){return B.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},$r=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")},dn=function($){return typeof f=="function"&&$ instanceof f};function Zt(Pe,$,pe){qu(Pe,Ne=>{Ne.call(t,$,pe,Ee)})}const Ia=function($){let pe=null;if(Zt(Y.beforeSanitizeElements,$,null),$r($))return rr($),!0;const Ne=qt($.nodeName);if(Zt(Y.uponSanitizeElement,$,{tagName:Ne,allowedTags:P}),ie&&$.hasChildNodes()&&!dn($.firstElementChild)&&qn(/<[/\w!]/g,$.innerHTML)&&qn(/<[/\w!]/g,$.textContent)||ie&&$.namespaceURI===Tt&&Ne==="style"&&dn($.firstElementChild)||$.nodeType===Vu.progressingInstruction||ie&&$.nodeType===Vu.comment&&qn(/<[/\w]/g,$.data))return rr($),!0;if(re[Ne]||!(we.tagCheck instanceof Function&&we.tagCheck(Ne))&&!P[Ne]){if(!re[Ne]&&Hc(Ne)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ne)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ne)))return!1;if(un&&!ye[Ne]){const wt=R($)||$.parentNode,ht=N($)||$.childNodes;if(ht&&wt){const Xt=ht.length;for(let Un=Xt-1;Un>=0;--Un){const gn=k(ht[Un],!0);wt.insertBefore(gn,C($))}}}return rr($),!0}return $ instanceof m&&!$c($)||(Ne==="noscript"||Ne==="noembed"||Ne==="noframes")&&qn(/<\/no(script|embed|frames)/i,$.innerHTML)?(rr($),!0):(ut&&$.nodeType===Vu.text&&(pe=$.textContent,qu([ae,be,W],wt=>{pe=Zl(pe,wt," ")}),$.textContent!==pe&&(Zu(t.removed,{element:$.cloneNode()}),$.textContent=pe)),Zt(Y.afterSanitizeElements,$,null),!1)},sl=function($,pe,Ne){if(xe[pe]||hr&&(pe==="id"||pe==="name")&&(Ne in n||Ne in tt))return!1;const wt=T[pe]||we.attributeCheck instanceof Function&&we.attributeCheck(pe,$);if(!(De&&!xe[pe]&&qn(X,pe))){if(!(me&&qn(Z,pe))){if(!wt||xe[pe]){if(!(Hc($)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,$)||q.tagNameCheck instanceof Function&&q.tagNameCheck($))&&(q.attributeNameCheck instanceof RegExp&&qn(q.attributeNameCheck,pe)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(pe,$))||pe==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ne)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ne))))return!1}else if(!cn[pe]){if(!qn(M,Zl(Ne,je,""))){if(!((pe==="src"||pe==="xlink:href"||pe==="href")&&$!=="script"&&Gk(Ne,"data:")===0&&Ve[$])){if(!(Ue&&!qn(te,Zl(Ne,je,"")))){if(Ne)return!1}}}}}}return!0},Ih=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Hc=function($){return!Ih[Xu($)]&&qn(Ae,$)},Uo=function($){Zt(Y.beforeSanitizeAttributes,$,null);const{attributes:pe}=$;if(!pe||$r($))return;const Ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let wt=pe.length;for(;wt--;){const ht=pe[wt],{name:Xt,namespaceURI:Un,value:gn}=ht,Mn=qt(Xt),Bo=gn;let fn=Xt==="value"?Bo:rK(Bo);if(Ne.attrName=Mn,Ne.attrValue=fn,Ne.keepAttr=!0,Ne.forceKeepAttr=void 0,Zt(Y.uponSanitizeAttribute,$,Ne),fn=Ne.attrValue,pi&&(Mn==="id"||Mn==="name")&&Gk(fn,gi)!==0&&(ma(Xt,$),fn=gi+fn),ie&&qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,fn)){ma(Xt,$);continue}if(Mn==="attributename"&&Zk(fn,"href")){ma(Xt,$);continue}if(Ne.forceKeepAttr)continue;if(!Ne.keepAttr){ma(Xt,$);continue}if(!ft&&qn(/\/>/i,fn)){ma(Xt,$);continue}ut&&qu([ae,be,W],qc=>{fn=Zl(fn,qc," ")});const Fo=qt($.nodeName);if(!sl(Fo,Mn,fn)){ma(Xt,$);continue}if(z&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Un)switch(w.getAttributeType(Fo,Mn)){case"TrustedHTML":{fn=z.createHTML(fn);break}case"TrustedScriptURL":{fn=z.createScriptURL(fn);break}}if(fn!==Bo)try{Un?$.setAttributeNS(Un,Xt,fn):$.setAttribute(Xt,fn),$r($)?rr($):qk(t.removed)}catch{ma(Xt,$)}}Zt(Y.afterSanitizeAttributes,$,null)},vi=function($){let pe=null;const Ne=Po($);for(Zt(Y.beforeSanitizeShadowDOM,$,null);pe=Ne.nextNode();)Zt(Y.uponSanitizeShadowNode,pe,null),Ia(pe),Uo(pe),pe.content instanceof o&&vi(pe.content);Zt(Y.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Pe){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pe=null,Ne=null,wt=null,ht=null;if(nr=!Pe,nr&&(Pe="<!-->"),typeof Pe!="string"&&!dn(Pe)&&(Pe=oK(Pe),typeof Pe!="string"))throw Ef("dirty is not a string, aborting");if(!t.isSupported)return Pe;if(ge||Tr($),t.removed=[],typeof Pe=="string"&&(da=!1),da){const gn=Pe.nodeName;if(typeof gn=="string"){const Mn=qt(gn);if(!P[Mn]||re[Mn])throw Ef("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof f)pe=Lo("<!---->"),Ne=pe.ownerDocument.importNode(Pe,!0),Ne.nodeType===Vu.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?pe=Ne:pe.appendChild(Ne);else{if(!zt&&!ut&&!le&&Pe.indexOf("<")===-1)return z&&Pn?z.createHTML(Pe):Pe;if(pe=Lo(Pe),!pe)return zt?null:Pn?L:""}pe&&Le&&rr(pe.firstChild);const Xt=Po(da?Pe:pe);for(;wt=Xt.nextNode();)Ia(wt),Uo(wt),wt.content instanceof o&&vi(wt.content);if(da)return Pe;if(zt){if(ut){pe.normalize();let gn=pe.innerHTML;qu([ae,be,W],Mn=>{gn=Zl(gn,Mn," ")}),pe.innerHTML=gn}if($t)for(ht=I.call(pe.ownerDocument);pe.firstChild;)ht.appendChild(pe.firstChild);else ht=pe;return(T.shadowroot||T.shadowrootmode)&&(ht=D.call(a,ht,!0)),ht}let Un=le?pe.outerHTML:pe.innerHTML;return le&&P["!doctype"]&&pe.ownerDocument&&pe.ownerDocument.doctype&&pe.ownerDocument.doctype.name&&qn(wT,pe.ownerDocument.doctype.name)&&(Un="<!DOCTYPE "+pe.ownerDocument.doctype.name+`>
412
- `+Un),ut&&qu([ae,be,W],gn=>{Un=Zl(Un,gn," ")}),z&&Pn?z.createHTML(Un):Un},t.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tr(Pe),ge=!0},t.clearConfig=function(){Ee=null,ge=!1},t.isValidAttribute=function(Pe,$,pe){Ee||Tr({});const Ne=qt(Pe),wt=qt($);return sl(Ne,wt,pe)},t.addHook=function(Pe,$){typeof $=="function"&&Zu(Y[Pe],$)},t.removeHook=function(Pe,$){if($!==void 0){const pe=tK(Y[Pe],$);return pe===-1?void 0:nK(Y[Pe],pe,1)[0]}return qk(Y[Pe])},t.removeHooks=function(Pe){Y[Pe]=[]},t.removeAllHooks=function(){Y=ej()},t}var SK=ST();function kK({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:SK.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(Oh,{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 tj(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 jK({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const E={};for(const C of n.questions)E[C.question]=Qu();return E});b.useEffect(()=>{if(!a)return;const E={};for(const C of n.questions){const N=a.answers[C.question];if(!N){E[C.question]=Qu();continue}const R=new Set(C.options.map(O=>O.label)),z=C.multiSelect?N.split(/,\s*/u):[N],L=z.filter(O=>R.has(O));L.length===z.length&&L.length>0?E[C.question]={picked:L,freeText:""}:E[C.question]={picked:[eo],freeText:N}}h(E)},[a,n.questions]);const p=En(),[g,x]=b.useState(null),w=bt({mutationFn:async E=>XQ(e,n.correlationId,E),onSuccess:()=>{x(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:E=>{x(E instanceof Error?E.message:String(E))}}),S=b.useCallback(()=>{x(null);const E={};for(const C of n.questions){const N=m[C.question]??Qu(),R=tj(C,N);if(R===null){x(`Please answer "${C.question}" before submitting.`);return}E[C.question]=R}w.mutate(E)},[n.questions,m,w]),k=b.useMemo(()=>n.questions.every(E=>{const C=m[E.question]??Qu();return tj(E,C)!==null}),[n.questions,m]);return l.jsxs("div",{className:ze("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(E=>l.jsx(EK,{question:E,previewFormat:n.previewFormat,selection:m[E.question]??Qu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:C=>h(N=>({...N,[E.question]:C}))},E.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(ve,{type:"button",disabled:!k||w.isPending,onClick:S,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function EK({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(kK,{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 CK(e){return HB.safeParse(e).success}function kT(e){return qB.safeParse(e).success}function NK(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=nj(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=nj(s.payload);return o?a.get(o)===s.seq:!0})}function nj(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 _K(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function rj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function TK({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function AK({event:e}){const t=kD(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?rj(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:["(",rj(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:["· ",_K(t.durationMs)]}):null]})]})}function RK({event:e,agentNameFn:t,agentId:n}){const a=ED(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(Dh,{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 OK({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 zK({event:e}){const t=jD(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 Dh({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 MK({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(Dh,{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(TK,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&DK(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"&&IK(e.content)?l.jsx(LK,{content:e.content}):e.format==="text"?l.jsx(Oh,{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 DK(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 IK(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 LK({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return YQ(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 PK({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(Dh,{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(jK,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function UK({msg:e,agentNameFn:t}){const n=kT(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(Dh,{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 BK({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(jv,{className:"h-3.5 w-3.5"})}):null}function aj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var ut;const o=En(),c=mh(),f=Lv(),{agentId:m}=yt(),[h,p]=b.useState(""),[g,x]=b.useState(0),[w,S]=b.useState([]),[k,E]=b.useState(!1),[C,N]=b.useState(null),R=b.useRef(null),z=b.useRef(null),L=b.useRef(null),O=b.useRef(!1),B=b.useRef(new Set);b.useEffect(()=>{O.current=!1},[t]);const{data:I}=Ke({queryKey:["chat-messages",t],queryFn:()=>UQ(t,{limit:50}),refetchInterval:5e3}),{data:Q}=Ke({queryKey:["session-events",e,t],queryFn:()=>CD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:D}=Ke({queryKey:["chat-detail",t],queryFn:()=>pT(t),enabled:!!t}),{data:Y}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),ae=bt({mutationFn:ie=>jo(t,ie),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:JS(e)})}}),be=b.useCallback(ie=>{const ge=ie.filter($t=>$t.type.startsWith("image/"));if(ge.length===0)return;const Le=ge.find($t=>$t.size>5242880);if(Le){N(`Image too large (${(Le.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const zt=ge.map($t=>({id:crypto.randomUUID(),file:$t,previewUrl:URL.createObjectURL($t)}));S($t=>[...$t,...zt]),N(null)},[]),W=b.useCallback(ie=>{S(le=>{const ge=le.find(Le=>Le.id===ie);return ge&&URL.revokeObjectURL(ge.previewUrl),le.filter(Le=>Le.id!==ie)})},[]),X=async()=>{const ie=h.trim(),le=w;if(!(!ie&&le.length===0)&&!k&&!(me&&De.length===0)){if(Ue.length>0)try{await mT(t,{participantIds:Ue}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(ge){N(ge instanceof Error?ge.message:"Failed to add participants");return}if(le.length>0){E(!0),N(null);try{for(const ge of le){const Le=await PQ(ge.file),zt=crypto.randomUUID();await KQ({imageId:zt,base64:Le,mimeType:ge.file.type}),await LQ(t,{data:Le,mimeType:ge.file.type,filename:ge.file.name,size:ge.file.size,imageId:zt}),URL.revokeObjectURL(ge.previewUrl)}S([]),ie&&await jo(t,ie),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:JS(e)})}catch(ge){N(ge instanceof Error?ge.message:"Failed to send image")}finally{E(!1)}return}ae.mutate(ie)}},[Z,te]=b.useState(!1),[je,Ae]=b.useState(""),M=b.useRef(null);b.useEffect(()=>{var ie;Z&&((ie=M.current)==null||ie.focus())},[Z]);const P=bt({mutationFn:ie=>IQ(t,ie),onSuccess:()=>{te(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),F=()=>{const ie=je.trim();P.mutate(ie.length>0?ie:null)},T=b.useMemo(()=>{const ie=(I==null?void 0:I.items)??[],le=NK((Q==null?void 0:Q.items)??[]),ge=[...ie.map(Le=>({kind:"message",at:Le.createdAt,key:`m-${Le.id}`,data:Le})),...le.map(Le=>({kind:"event",at:Le.createdAt,key:`e-${Le.id}`,data:Le}))];return ge.sort((Le,zt)=>Le.at.localeCompare(zt.at)),ge},[I,Q]),G=b.useMemo(()=>{const ie=new Map;for(const le of(I==null?void 0:I.items)??[])le.format==="question_answer"&&kT(le.content)&&ie.set(le.content.correlationId,le.content);return ie},[I]),q=T.length;b.useEffect(()=>{var ie;q>0&&((ie=L.current)==null||ie.scrollIntoView({behavior:"smooth"}))},[q]);const re=c(e),xe=b.useMemo(()=>{var ie;return new Set(((ie=D==null?void 0:D.participants)==null?void 0:ie.map(le=>le.agentId))??[])},[D==null?void 0:D.participants]),we=b.useMemo(()=>{const ie=new Set;for(const ge of(D==null?void 0:D.participants)??[])ie.add(ge.agentId);for(const ge of(Y==null?void 0:Y.agents)??[])ie.add(ge.agentId);ie.size===0&&ie.add(e);const le=[];for(const ge of ie){if(ge===m)continue;const Le=f(ge);!Le||!Le.name||le.push({agentId:ge,name:Le.name,displayName:Le.displayName})}return le},[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 ie=D.participants.some(le=>le.agentId===m);return D.type==="direct"&&!ie&&D.participants.length>=2},[D,m]);b.useEffect(()=>{if(n||B.current.has(t)||!I||!Q||!D||T.length>0||h.length>0||me||re===e)return;const ie=`Hi ${re}! What can you help with?`;p(ie),x(ie.length),B.current.add(t),requestAnimationFrame(()=>{const le=z.current;le&&(le.focus(),le.setSelectionRange(ie.length,ie.length))})},[t,e,I,Q,D,T.length,h.length,re,me,n]);const De=b.useMemo(()=>{const ie=we.map(le=>({agentId:le.agentId,name:le.name}));return pN(h,ie)},[h,we]),Ue=b.useMemo(()=>xe.size===0?[]:De.filter(ie=>!xe.has(ie)),[De,xe]),ft=gT({value:h,cursor:g,candidates:we,disabled:ae.isPending||k,onSelect:ie=>{p(ie.text),x(ie.cursor),requestAnimationFrame(()=>{const le=z.current;le&&(le.focus(),le.setSelectionRange(ie.cursor,ie.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:je,onChange:ie=>Ae(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?(ie.preventDefault(),F()):ie.key==="Escape"&&(ie.preventDefault(),te(!1))},disabled:P.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:P.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>te(!1),disabled:P.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)??""),te(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(D==null?void 0:D.title)??"…"}),l.jsx(BK,{metadata:D==null?void 0:D.metadata})]}),l.jsx(FK,{chatId:t,participantIds:((ut=D==null?void 0:D.participants)==null?void 0:ut.map(ie=>ie.agentId))??[e],candidates:we,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:l.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[q===0&&l.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[l.jsx(Cv,{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:T.map(ie=>{if(ie.kind==="event"){const ge=ie.data;switch(ge.kind){case"tool_call":return l.jsx(AK,{event:ge},ie.key);case"assistant_text":return l.jsx(RK,{event:ge,agentId:e,agentNameFn:c},ie.key);case"thinking":return l.jsx(OK,{event:ge},ie.key);case"error":return l.jsx(zK,{event:ge},ie.key);default:return null}}const le=ie.data;if(le.format==="question"&&CK(le.content)){const ge=G.get(le.content.correlationId)??null,Le=ge?"answered":"pending";return l.jsx(PK,{msg:le,chatId:t,content:le.content,answer:ge,status:Le,agentNameFn:c},ie.key)}return le.format==="question_answer"?l.jsx(UK,{msg:le,agentNameFn:c},ie.key):l.jsx(MK,{msg:le,myAgentId:m,agentNameFn:c},ie.key)})}),l.jsx("div",{ref:L})]})}),l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:l.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[l.jsx(hE,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&l.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&l.jsx(ve,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:ie=>ie.preventDefault(),onDrop:ie=>{ie.preventDefault(),be(Array.from(ie.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(ie=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:ie.previewUrl,alt:ie.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>W(ie.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"})})]},ie.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(yT,{trigger:ft.trigger,results:ft.results,highlightIndex:ft.highlightIndex,anchorRef:z,onPick:ft.pick}),l.jsx("textarea",{ref:z,value:h,onChange:ie=>{p(ie.target.value),x(ie.target.selectionStart??ie.target.value.length)},onSelect:ie=>{x(ie.currentTarget.selectionStart??h.length)},onFocus:()=>{me&&(O.current||h.length>0||we.length===0||(O.current=!0,p("@"),x(1),requestAnimationFrame(()=>{const ie=z.current;ie&&ie.setSelectionRange(1,1)})))},onPaste:ie=>{const le=Array.from(ie.clipboardData.files);le.length>0&&(ie.preventDefault(),be(le))},placeholder:me?"Type @ to pick a recipient, then your message":`Message @${re} · / for commands · @ to mention`,rows:2,onKeyDown:ie=>{ft.handleKey(ie)||ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),X())},disabled:ae.isPending||k,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}})]}),l.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[l.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[l.jsx("button",{type:"button",onClick:()=>{const ie=z.current;if(!ie)return;const le=ie.selectionStart??h.length,ge=ie.selectionEnd??le,Le=`${h.slice(0,le)}@${h.slice(ge)}`;p(Le),x(le+1),requestAnimationFrame(()=>{ie.focus(),ie.setSelectionRange(le+1,le+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(zz,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var ie;return(ie=R.current)==null?void 0:ie.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(hM,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:ie=>{ie.target.files&&(be(Array.from(ie.target.files)),ie.target.value="")}})]}),l.jsxs("span",{className:"flex items-center",style:{gap:8},children:[k&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:X,disabled:ae.isPending||k||!h.trim()&&w.length===0||me&&De.length===0,title:me&&De.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",(ae.isPending||k||!h.trim()&&w.length===0||me&&De.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(cE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(ae.isError||C)&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:C??(ae.error instanceof Error?ae.error.message:"Failed to send")})]})})})]})}function FK({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=bt({mutationFn:g=>mT(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(xa,{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=kb(p);return p.map(x=>l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:x.name?`@${x.name}`:void 0,onClick:()=>h.mutate(x.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(jb,{candidate:x,ambiguous:g})},x.agentId))})()})]})]})}function ij(e,t){return e?e.find(n=>n.chatId===t)??null:null}function $K(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 HK({chatId:e}){const t=En(),{agentId:n}=yt(),a=b.useRef(new Map),{data:s}=Ke({queryKey:["chat-detail",e],queryFn:()=>pT(e),enabled:!!e}),{data:o}=Ke({queryKey:["me","chats","all"],queryFn:()=>eh({filter:"all"}),refetchInterval:3e4}),{data:c}=Ke({queryKey:["me","chats","watching"],queryFn:()=>eh({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>ij(o==null?void 0:o.rows,e)??ij(c==null?void 0:c.rows,e)??null,[o,c,e]),m=b.useMemo(()=>f?f.participants.map(k=>({agentId:k.agentId,type:k.type})):s?s.participants.map(k=>({agentId:k.agentId,type:void 0})):[],[f,s]),h=b.useMemo(()=>$K(m,n),[m,n]),g=bt({mutationFn:()=>RQ(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=bt({mutationFn:()=>OQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),S=(f==null?void 0:f.membershipKind)==="watching";return h?S?l.jsx(aj,{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(aj,{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 qK(){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 di(e,t){try{await Ce.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function ZK({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(null),E=b.useRef(null);b.useEffect(()=>{(async()=>{try{const z=await Ce.get("/me/organizations");a(z)}catch(z){k(z instanceof Error?z.message:"Failed to load your team")}finally{w(!0)}})()},[]),b.useEffect(()=>{var L;const z=((L=n.find(O=>O.id===e))==null?void 0:L.displayName)??"";o(z),f(z)},[n,e]),b.useEffect(()=>{const z=E.current;if(!z||!c)return;z.focus();const L=z.value.length;z.setSelectionRange(L,L)},[c]);const C=s.trim(),N=C.length>0&&!m&&x&&!S,R=b.useCallback(async z=>{if(z==null||z.preventDefault(),!(!N||!e)){g(null);try{C!==c.trim()&&(h(!0),await Ce.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),di("team_renamed")),t()}catch(L){g(L instanceof Error?L.message:"Failed to rename team")}finally{h(!1)}}},[N,e,C,c,t]);return l.jsxs("form",{onSubmit: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:E,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:z=>o(z.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:z=>{z.currentTarget.style.borderColor="var(--accent)"},onBlur:z=>{z.currentTarget.style.borderColor="var(--border)"}})]}),p||S?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p??`Couldn't load your team — ${S}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(ve,{type:"submit",disabled:!N,children:[l.jsx("span",{children:"Continue"}),l.jsx(uE,{className:"h-4 w-4"})]})})]})}function Eb(){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 GK=3e4,VK=1e3,QK=3e3;function KK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function YK({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var xe;const s=Tn(),o=dz(e,t),c=hz(o),f=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=f?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,p]=b.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[g,x]=b.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,S]=b.useState(null),[k,E]=b.useState(null),[C,N]=b.useState(null),[R,z]=b.useState(()=>f),[L,O]=b.useState(()=>m),[B,I]=b.useState([]),[Q,D]=b.useState("form"),[Y,ae]=b.useState(null),be=b.useRef(null),W=b.useRef(null),X=b.useRef(null),Z=b.useRef(0);b.useEffect(()=>()=>{W.current&&(W.current.cancelled=!0)},[]),b.useEffect(()=>{mz(o,{displayName:h,selectedRuntime:g,connectToken:R,connectTokenExpiresAt:L})},[o,h,g,R,L]),b.useEffect(()=>{(async()=>{try{const we=await Ce.get("/me/organizations");I(we)}catch{}})()},[]),b.useEffect(()=>{if(Q!=="form")return;let we=!1;const me=async()=>{const Ue=++Z.current;try{const ft=await ci();if(we||Ue!==Z.current)return;const ie=ft.filter(le=>le.status==="connected").sort((le,ge)=>ge.lastSeenAt.localeCompare(le.lastSeenAt))[0]??null;if(S(le=>(le==null?void 0:le.id)===(ie==null?void 0:ie.id)?le:ie),ie){X.current!==ie.id&&(X.current=null,N(null),E(null));try{const le=await uh(ie.id);if(we||Ue!==Z.current)return;X.current=ie.id,N(ie.id),E(le.capabilities)}catch{}}else X.current=null,N(null),E(null)}catch{}};me();const De=setInterval(me,QK);return()=>{we=!0,clearInterval(De)}},[Q]),b.useEffect(()=>{if(w)return;if(R&&L&&L>Date.now()){const me=Math.max(L-Date.now(),0),De=window.setTimeout(()=>{z(null),O(null)},me);return()=>window.clearTimeout(De)}R&&(z(null),O(null));let we=!1;return(async()=>{try{const me=await Ce.post("/me/connect-tokens",{});we||(z(me.token),O(Date.now()+me.expiresIn*1e3))}catch(me){we||ae(me instanceof Error?me.message:"Failed to generate connect token")}})(),()=>{we=!0}},[w,R,L]);const te=w&&C===w.id?k:null;b.useEffect(()=>{x(we=>{var De;if(!te)return we;const me=XK(te);return we&&me&&Object.keys(te).includes(we)&&((De=te[we])==null?void 0:De.state)==="ok"?we:me})},[te]);const je=te?Object.entries(te).filter(([,we])=>we.state==="ok").map(([we])=>we):[],Ae=((xe=B.find(we=>we.id===e))==null?void 0:xe.displayName)??"",M=h.trim(),P=M||"your agent",F=R?`npm install -g @agent-team-foundation/first-tree-hub
413
- first-tree-hub connect ${R}`:null,T=b.useCallback(async we=>{W.current&&(W.current.cancelled=!0);const me={cancelled:!1};W.current=me;const De=Date.now();for(;!me.cancelled;){let Ue=!1;try{const ft=await Ce.get(`/agents/${encodeURIComponent(we)}/client-status`);if(me.cancelled)return;Ue=ft.online===!0}catch{if(me.cancelled)return}if(Ue){pz(o);try{await a()}catch{}if(me.cancelled)return;s("/",{replace:!0});return}if(Date.now()-De>GK){me.cancelled||D("timeout");return}await new Promise(ft=>setTimeout(ft,VK))}},[o,a,s]),G=!!(M&&w&&g&&je.includes(g)&&Q==="form"),q=b.useCallback(async()=>{if(!w||!g||!M)return;ae(null),D("creating");const we=Yy(M);let me;try{me=(await Ce.post(An("/agents"),{type:"personal_assistant",displayName:M,...we?{name:we}:{},clientId:w.id,runtimeProvider:g,...e?{organizationId:e}:{}})).uuid,be.current=me,uz(me),di("agent_created",{runtimeProvider:g})}catch(De){ae(De instanceof Error?De.message:"Failed to create agent"),D("form");return}await T(me)},[M,w,g,T,e]),re=b.useCallback(async()=>{const we=be.current;we&&(ae(null),D("creating"),await T(we))},[T]);return Q==="creating"?l.jsx(aY,{nameOrFallback:P}):Q==="timeout"?l.jsx(iY,{nameOrFallback:P,hostname:(w==null?void 0:w.hostname)??null,error:Y,onRetry:re}):l.jsx(WK,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:p,trimmedName:M,connectedClient:w,cliCommand:F,capabilitiesLoaded:te!==null,okRuntimes:je,selectedRuntime:g,setSelectedRuntime:x,error:Y,canCreate:G,onCreate:q})}function XK(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 WK({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,error:g,canCreate:x,onCreate:w}){const S=b.useRef(null),k=e==="invite"&&t,E=f&&m.length===0&&!!o,C=s?o?E?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return b.useEffect(()=>{var N;s||(N=S.current)==null||N.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:k?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — it'll run on a computer you connect."]}):l.jsx(l.Fragment,{children:"Set up your first agent — it'll run on a computer you connect."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Eb,{}),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:S,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:N=>a(N.target.value),placeholder:"e.g. Buddy, Helper",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:N=>{N.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:N=>{N.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(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(nY,{hostname:o.hostname??o.id}),l.jsx(tY,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(JK,{command:c}),l.jsx(eY,{})]})]}):null]})})]}),g&&l.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g}),s&&l.jsxs("div",{style:{marginTop:x?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!x&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),x&&l.jsxs(ve,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:N=>{N.currentTarget.style.transform="scale(1.01)",N.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:N=>{N.currentTarget.style.transform="scale(1)",N.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(uE,{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 JK({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
414
- `):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),l.jsxs(ve,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(kv,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function eY(){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(rY,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function tY({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)"}})}),KK(s)]},s)})]})]})}function nY({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 rY(){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 aY({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(sY,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function iY({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return l.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):l.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[l.jsx("p",{children:"This usually means:"}),l.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[l.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),l.jsxs("li",{children:["The connection to ",s," dropped"]})]}),l.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",l.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),l.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:l.jsx(ve,{onClick:a,children:"Try again"})})]})}function sY(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(qg,{delayMs:0}),l.jsx(qg,{delayMs:160}),l.jsx(qg,{delayMs:320})]})}function qg({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 jT(){return(await Ce.get("/me/github/repos")).repos}const ET="https://github.com/agent-team-foundation/first-tree";function CT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Cb(e,t){const n=CT(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: ${ET}`].join(`
415
- `)}function lY(e){const t=CT(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: ${ET}`].join(`
416
- `)}function oY(){const{role:e}=yt();return e==="admin"?l.jsx(pY,{}):l.jsx(uY,{})}function uY(){var f,m;const{organizationId:e}=yt(),[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([wb(e),dT(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(dY,{});if(t.kind==="error")return l.jsx(cY,{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(fY,{treeUrl:o,teamRepos:c}):o?l.jsx(hY,{treeUrl:o}):l.jsx(mY,{})}function cY({message:e,onRetry:t}){return l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),l.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:l.jsx(ve,{type:"button",onClick:t,children:"Try again"})})]})}function dY(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function fY({treeUrl:e,teamRepos:t}){var k;const n=Tn(),{dismissOnboarding:a}=yt(),{addToast:s}=Ic(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(()=>t.map(E=>E.url)),g=h.length>0,x=b.useCallback(E=>{p(C=>C.includes(E)?C.filter(N=>N!==E):[...C,E])},[]),w=b.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const E=await Nb(),C=await Eh(E.uuid);await Ch(E.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(z=>({url:z}))}});const N=await Sb(E.uuid),R=Cb(h,e);try{await jo(N.id,R)}catch{}di("tree_chat_started",{agentUuid:E.uuid,chatId:N.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(N.id)}`,{replace:!1})}catch(E){m(E instanceof Error?E.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),S=b.useCallback(()=>{di("tree_intro_dismissed",{joinPath:"invite"}),a(),s(_b(n))},[a,s,n]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(ev,{label:"Tree",value:e}),t.length===1?l.jsx(ev,{label:"Source repo",value:((k=t[0])==null?void 0:k.url)??""}):l.jsxs("fieldset",{disabled:o,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(E=>{const C=h.includes(E.url);return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:C?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:o?"not-allowed":"pointer",color:C?"var(--fg)":"var(--fg-2)",fontWeight:C?600:400},children:[l.jsx("input",{type:"checkbox",value:E.url,checked:C,onChange:()=>x(E.url),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:C?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:C?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:E.url})]},E.url)})]}),f?l.jsx(Tb,{children:f}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!g||o,onClick:()=>void w(),children:o?"Starting…":"Confirm"}),l.jsx(ve,{type:"button",variant:"outline",onClick:S,disabled:o,children:"I'll do it later"})]})]})]})}function hY({treeUrl:e}){const t=Tn(),{dismissOnboarding:n}=yt(),{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([]),S=x.length>0,k=b.useCallback(N=>{w(R=>R.includes(N)?R.filter(z=>z!==N):[...R,N])},[]);b.useEffect(()=>{let N=!1;return(async()=>{try{const R=await jT();if(N)return;h(R)}catch(R){N||g(R instanceof Error?R.message:"Failed to list GitHub repositories")}})(),()=>{N=!0}},[]);const E=b.useCallback(async()=>{if(x.length!==0){o(!0),f(null);try{const N=await Nb(),R=await Eh(N.uuid);await Ch(N.uuid,{expectedVersion:R.version,payload:{gitRepos:x.map(O=>({url:O}))}});const z=await Sb(N.uuid),L=Cb(x,e);try{await jo(z.id,L)}catch{}di("tree_chat_started",{agentUuid:N.uuid,chatId:z.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(z.id)}`,{replace:!1})}catch(N){f(N instanceof Error?N.message:"Failed to start the chat"),o(!1)}}},[x,e,t,n]),C=b.useCallback(()=>{di("tree_intro_dismissed",{joinPath:"invite"}),n(),a(_b(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(Eb,{}),l.jsx(ls,{number:"01",state:"complete",children:l.jsx(ev,{label:"Tree",value:e})}),l.jsx(ls,{number:"02",state:S?"complete":"active",children:l.jsx(NT,{disabled:s,repos:m,error:p,selectedRepoUrls:x,onToggle:k})}),l.jsxs(ls,{number:"03",state:S?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:S?"var(--fg)":"var(--fg-4)",fontWeight:S?600:500},children:"Let your agent join the tree"}),S?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?l.jsx(Tb,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!S||s,onClick:()=>void E(),children:s?"Starting…":"Continue"}),l.jsx(ve,{type:"button",variant:"outline",onClick:C,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function mY(){const{dismissOnboarding:e}=yt(),{addToast:t}=Ic(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,di("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 pY(){const e=Tn(),{dismissOnboarding:t,organizationId:n}=yt(),{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([]),[S,k]=b.useState(null),[E,C]=b.useState(null),N=b.useCallback(D=>{w(Y=>Y.includes(D)?Y.filter(ae=>ae!==D):[...Y,D])},[]);b.useEffect(()=>{let D=!1;return(async()=>{try{const Y=await jT();if(D)return;k(Y)}catch(Y){D||C(Y instanceof Error?Y.message:"Failed to list GitHub repositories")}})(),()=>{D=!0}},[]),b.useEffect(()=>{if(!n)return;let D=!1;return(async()=>{try{const Y=await wb(n);if(D)return;Y.repo&&(g(Y.repo),h(ae=>ae??"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}})(),L=b.useCallback(()=>{di("tree_intro_dismissed"),t(),a(_b(e))},[t,a,e]),O=b.useCallback(async()=>{if(x.length!==0&&m&&!(m==="existing"&&!z)){f(null),o(!0);try{const D=await Nb(),Y=await Eh(D.uuid),ae=x.map(X=>({url:X}));if(await Ch(D.uuid,{expectedVersion:Y.version,payload:{gitRepos:ae}}),n)try{await fT(n,{repos:ae})}catch(X){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",X)}if(m==="existing"&&n)try{await cT(n,{repo:R})}catch(X){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",X),a({title:"Tree binding wasn't saved to Hub yet",description:"Your agent will still proceed. You can re-bind from Team Settings later."})}const be=await Sb(D.uuid),W=m==="existing"?Cb(x,R):lY(x);try{await jo(be.id,W)}catch{}di("tree_chat_started",{agentUuid:D.uuid,chatId:be.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(be.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]),B=x.length>0,I=B&&m!==null&&!s&&(m==="new"||z),Q=!!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(Eb,{}),l.jsx(ls,{number:"01",state:B?"complete":"active",children:l.jsx(NT,{disabled:s,repos:S,error:E,selectedRepoUrls:x,onToggle:N})}),l.jsxs(ls,{number:"02",state:Q?"complete":B?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:B?"var(--fg)":"var(--fg-4)",fontWeight:B?600:500},children:"Bind or create the tree"}),B?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:Q?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:Q?"var(--fg)":"var(--fg-4)",fontWeight:Q?600:500},children:"Let your agent build it"}),Q?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(Tb,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ve,{type:"button",disabled:!I,onClick:()=>void O(),children:s?"Starting…":"Continue"}),l.jsx(ve,{type:"button",variant:"outline",onClick:L,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function Nb(){const e=oz(),t=await Iv(),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 _b(e){return{title:"Setup hidden",description:"Resume any time in Settings → Onboarding. Your agent isn't bound to a source repo yet — add one in Agent settings when ready.",action:{label:"Open settings",onClick:()=>e("/settings/onboarding")}}}function ev({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),l.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function Tb({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 NT({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const o=l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?l.jsx("div",{children:o}):n?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsx(ve,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),l.jsx(gY,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function gY({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(Sv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([p,g],x)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:x>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(w=>{const S=f.has(w.cloneUrl),k=w.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":S,onClick:()=>n(w.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:S?"var(--accent-bg)":"transparent",color:S?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-1)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:S?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:S?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:S?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:k}),w.private&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},w.cloneUrl)})]},p))})]})}function 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 vY(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=yt(),[o,c]=sh(),f=o.get("step"),[m]=b.useState(()=>sE()),[h,p]=b.useState(()=>aE()),g=b.useCallback(k=>{lz(k),p(k)},[]),x=s==="admin",w=b.useMemo(()=>f==="team"&&x?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&x?"step1":"step2",[f,e,h,m,x]),S=b.useCallback(()=>{g(!0);const k=new URLSearchParams(o);k.delete("step"),c(k,{replace:!0})},[g,o,c]);return l.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:l.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?l.jsx(ZK,{organizationId:n,onContinue:S}):w==="step2"?l.jsx(YK,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(oY,{})})})}function bY({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=yt();return e===th?l.jsx(qQ,{onCreated:t}):e?l.jsx(HK,{chatId:e}):n!==null&&!a?l.jsx(vY,{}):l.jsx(qK,{})}const xY={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function wY(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=yt(),{addToast:a}=Ic(),s=Tn(),[o,c]=sh(),f=o.get("c"),m=o.get("step"),h=aE(),g=sE()==="invite",x=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const w=e==="completed",S=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},k={1:Zg(1,x,e),2:Zg(2,x,e),3:Zg(3,x,e)},E=C=>{if(C!==3)return;const N=new URLSearchParams(o);N.delete("c"),N.set("step","tree"),c(N,{replace:!1})};return l.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[l.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((C,N)=>{const R=k[C],z=[1,2,3][N+1],L=z?sj(R)&&sj(k[z]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(SY,{index:C,state:R,label:xY[C],onClick:C===3&&R==="active"?()=>E(C):void 0}),z?l.jsx(jY,{solid:L}):null]},C)})}),l.jsx("button",{type:"button",onClick:S,disabled:!w,title:w?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:w?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:w?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:w?1:.5},onMouseEnter:C=>{w&&(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:"✕"})]})}function Zg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function sj(e){return e==="active"||e==="completed"}function SY({index:e,state:t,label:n,onClick:a}){const s=!!a,o=kY(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 kY(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 jY({solid:e}){return l.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}function EY(){const[e,t]=sh(),n=e.get("c"),a=e.get("a");UN(),b.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=b.useCallback(c=>{t({c})},[t]),o=b.useCallback(()=>{t({c:th})},[t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(DQ,{selectedChatId:n,onSelectChat:s,onNewChat:o}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx(wY,{}),l.jsx(bY,{selectedChatId:n,onSelectChat:s})]})]})}const CY=new vR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function NY(){return l.jsx(bR,{client:CY,children:l.jsx(vz,{children:l.jsx(S4,{children:l.jsx(QO,{children:l.jsxs(kO,{children:[l.jsx(Dt,{path:"/login",element:l.jsx(sV,{})}),l.jsx(Dt,{path:"/signup",element:l.jsx(or,{to:"/login",replace:!0})}),l.jsx(Dt,{path:"/auth/github/complete",element:l.jsx(lV,{})}),l.jsx(Dt,{path:"/invite/:token",element:l.jsx(nV,{})}),null,l.jsx(Dt,{element:l.jsx(kz,{}),children:l.jsxs(Dt,{element:l.jsx(n9,{children:l.jsx(x4,{})}),children:[l.jsx(Dt,{index:!0,element:l.jsx(EY,{})}),l.jsx(Dt,{path:"context",element:l.jsx(gG,{})}),l.jsx(Dt,{path:"agents/:uuid",element:l.jsx(AZ,{})}),l.jsx(Dt,{path:"team",element:l.jsx(hQ,{})}),l.jsxs(Dt,{path:"settings",element:l.jsx(QV,{}),children:[l.jsx(Dt,{index:!0,element:l.jsx(or,{to:"computers",replace:!0})}),l.jsx(Dt,{path:"team",element:l.jsx(TQ,{})}),l.jsx(Dt,{path:"computers",element:l.jsx(SV,{})}),l.jsx(Dt,{path:"github",element:l.jsx(TV,{})}),l.jsx(Dt,{path:"integrations",element:l.jsx(ZV,{})}),l.jsx(Dt,{path:"onboarding",element:l.jsx(GV,{})}),l.jsx(Dt,{path:"setup",element:l.jsx(or,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(Dt,{path:"agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"clients",element:l.jsx(or,{to:"/settings/computers",replace:!0})}),l.jsx(Dt,{path:"integrations",element:l.jsx(or,{to:"/settings/integrations",replace:!0})}),l.jsx(Dt,{path:"team/members",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/invite",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(Dt,{path:"team/settings",element:l.jsx(or,{to:"/settings/team",replace:!0})}),l.jsx(Dt,{path:"admin",element:l.jsx(_Y,{})})]})})]})})})})})}function _Y(){const e=Er();return e.hash==="#bindings"?l.jsx(or,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(or,{to:`/team${e.hash}`,replace:!0})}const _T=document.getElementById("root");if(!_T)throw new Error("Root element not found");G2.createRoot(_T).render(l.jsx(b.StrictMode,{children:l.jsx(NY,{})}));export{uE as A,Dc as F,Rc as L,et as c,l as j,b as r};