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

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,391 +0,0 @@
1
- var dS=e=>{throw TypeError(e)};var Fp=(e,t,n)=>t.has(e)||dS("Cannot "+n);var U=(e,t,n)=>(Fp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ne=(e,t,n)=>t.has(e)?dS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),be=(e,t,n,a)=>(Fp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),qe=(e,t,n)=>(Fp(e,t,"access private method"),n);var lf=(e,t,n,a)=>({set _(s){be(e,t,s,n)},get _(){return U(e,t,a)}});function x2(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 u=Object.getOwnPropertyDescriptor(a,s);u&&Object.defineProperty(e,s,u.get?u:{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 u of s)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function a(s){if(s.ep)return;s.ep=!0;const u=n(s);fetch(s.href,u)}})();function ah(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $p={exports:{}},Ru={};/**
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 fS;function w2(){if(fS)return Ru;fS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,u){var c=null;if(u!==void 0&&(c=""+u),s.key!==void 0&&(c=""+s.key),"key"in s){u={};for(var f in s)f!=="key"&&(u[f]=s[f])}else u=s;return s=u.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:u}}return Ru.Fragment=t,Ru.jsx=n,Ru.jsxs=n,Ru}var hS;function S2(){return hS||(hS=1,$p.exports=w2()),$p.exports}var o=S2(),qp={exports:{}},Ve={};/**
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 mS;function k2(){if(mS)return Ve;mS=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"),u=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"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function w(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function E(L,F,_){this.props=L,this.context=F,this.refs=C,this.updater=_||k}E.prototype.isReactComponent={},E.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,F,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function T(){}T.prototype=E.prototype;function O(L,F,_){this.props=L,this.context=F,this.refs=C,this.updater=_||k}var D=O.prototype=new T;D.constructor=O,j(D,E.prototype),D.isPureReactComponent=!0;var P=Array.isArray;function z(){}var B={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function V(L,F,_){var Z=_.ref;return{$$typeof:e,type:L,key:F,ref:Z!==void 0?Z:null,props:_}}function I(L,F){return V(L.type,F,L.props)}function X(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function se(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(_){return F[_]})}var Se=/\/+/g;function Y(L,F){return typeof L=="object"&&L!==null&&L.key!=null?se(""+L.key):F.toString(36)}function ee(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(z,z):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function H(L,F,_,Z,K){var ue=typeof L;(ue==="undefined"||ue==="boolean")&&(L=null);var we=!1;if(L===null)we=!0;else switch(ue){case"bigint":case"string":case"number":we=!0;break;case"object":switch(L.$$typeof){case e:case t:we=!0;break;case g:return we=L._init,H(we(L._payload),F,_,Z,K)}}if(we)return K=K(L),we=Z===""?"."+Y(L,0):Z,P(K)?(_="",we!=null&&(_=we.replace(Se,"$&/")+"/"),H(K,F,_,"",function(Ge){return Ge})):K!=null&&(X(K)&&(K=I(K,_+(K.key==null||L&&L.key===K.key?"":(""+K.key).replace(Se,"$&/")+"/")+we)),F.push(K)),1;we=0;var ve=Z===""?".":Z+":";if(P(L))for(var me=0;me<L.length;me++)Z=L[me],ue=ve+Y(Z,me),we+=H(Z,F,_,ue,K);else if(me=w(L),typeof me=="function")for(L=me.call(L),me=0;!(Z=L.next()).done;)Z=Z.value,ue=ve+Y(Z,me++),we+=H(Z,F,_,ue,K);else if(ue==="object"){if(typeof L.then=="function")return H(ee(L),F,_,Z,K);throw F=String(L),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return we}function re(L,F,_){if(L==null)return L;var Z=[],K=0;return H(L,Z,"","",function(ue){return F.call(_,ue,K++)}),Z}function xe(L){if(L._status===-1){var F=L._result;F=F(),F.then(function(_){(L._status===0||L._status===-1)&&(L._status=1,L._result=_)},function(_){(L._status===0||L._status===-1)&&(L._status=2,L._result=_)}),L._status===-1&&(L._status=0,L._result=F)}if(L._status===1)return L._result.default;throw L._result}var ze=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},R={map:re,forEach:function(L,F,_){re(L,function(){F.apply(this,arguments)},_)},count:function(L){var F=0;return re(L,function(){F++}),F},toArray:function(L){return re(L,function(F){return F})||[]},only:function(L){if(!X(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ve.Activity=p,Ve.Children=R,Ve.Component=E,Ve.Fragment=n,Ve.Profiler=s,Ve.PureComponent=O,Ve.StrictMode=a,Ve.Suspense=m,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(L){return B.H.useMemoCache(L)}},Ve.cache=function(L){return function(){return L.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(L,F,_){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var Z=j({},L.props),K=L.key;if(F!=null)for(ue in F.key!==void 0&&(K=""+F.key),F)!M.call(F,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&F.ref===void 0||(Z[ue]=F[ue]);var ue=arguments.length-2;if(ue===1)Z.children=_;else if(1<ue){for(var we=Array(ue),ve=0;ve<ue;ve++)we[ve]=arguments[ve+2];Z.children=we}return V(L.type,K,Z)},Ve.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Ve.createElement=function(L,F,_){var Z,K={},ue=null;if(F!=null)for(Z in F.key!==void 0&&(ue=""+F.key),F)M.call(F,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(K[Z]=F[Z]);var we=arguments.length-2;if(we===1)K.children=_;else if(1<we){for(var ve=Array(we),me=0;me<we;me++)ve[me]=arguments[me+2];K.children=ve}if(L&&L.defaultProps)for(Z in we=L.defaultProps,we)K[Z]===void 0&&(K[Z]=we[Z]);return V(L,ue,K)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(L){return{$$typeof:f,render:L}},Ve.isValidElement=X,Ve.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:xe}},Ve.memo=function(L,F){return{$$typeof:h,type:L,compare:F===void 0?null:F}},Ve.startTransition=function(L){var F=B.T,_={};B.T=_;try{var Z=L(),K=B.S;K!==null&&K(_,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(z,ze)}catch(ue){ze(ue)}finally{F!==null&&_.types!==null&&(F.types=_.types),B.T=F}},Ve.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Ve.use=function(L){return B.H.use(L)},Ve.useActionState=function(L,F,_){return B.H.useActionState(L,F,_)},Ve.useCallback=function(L,F){return B.H.useCallback(L,F)},Ve.useContext=function(L){return B.H.useContext(L)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(L,F){return B.H.useDeferredValue(L,F)},Ve.useEffect=function(L,F){return B.H.useEffect(L,F)},Ve.useEffectEvent=function(L){return B.H.useEffectEvent(L)},Ve.useId=function(){return B.H.useId()},Ve.useImperativeHandle=function(L,F,_){return B.H.useImperativeHandle(L,F,_)},Ve.useInsertionEffect=function(L,F){return B.H.useInsertionEffect(L,F)},Ve.useLayoutEffect=function(L,F){return B.H.useLayoutEffect(L,F)},Ve.useMemo=function(L,F){return B.H.useMemo(L,F)},Ve.useOptimistic=function(L,F){return B.H.useOptimistic(L,F)},Ve.useReducer=function(L,F,_){return B.H.useReducer(L,F,_)},Ve.useRef=function(L){return B.H.useRef(L)},Ve.useState=function(L){return B.H.useState(L)},Ve.useSyncExternalStore=function(L,F,_){return B.H.useSyncExternalStore(L,F,_)},Ve.useTransition=function(){return B.H.useTransition()},Ve.version="19.2.4",Ve}var pS;function Xy(){return pS||(pS=1,qp.exports=k2()),qp.exports}var x=Xy();const j2=ah(x),Wy=x2({__proto__:null,default:j2},[x]);var Hp={exports:{}},Ou={},Zp={exports:{}},Gp={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var gS;function E2(){return gS||(gS=1,(function(e){function t(H,re){var xe=H.length;H.push(re);e:for(;0<xe;){var ze=xe-1>>>1,R=H[ze];if(0<s(R,re))H[ze]=re,H[xe]=R,xe=ze;else break e}}function n(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var re=H[0],xe=H.pop();if(xe!==re){H[0]=xe;e:for(var ze=0,R=H.length,L=R>>>1;ze<L;){var F=2*(ze+1)-1,_=H[F],Z=F+1,K=H[Z];if(0>s(_,xe))Z<R&&0>s(K,_)?(H[ze]=K,H[Z]=xe,ze=Z):(H[ze]=_,H[F]=xe,ze=F);else if(Z<R&&0>s(K,xe))H[ze]=K,H[Z]=xe,ze=Z;else break e}}return re}function s(H,re){var xe=H.sortIndex-re.sortIndex;return xe!==0?xe:H.id-re.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],g=1,p=null,b=3,w=!1,k=!1,j=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function D(H){for(var re=n(h);re!==null;){if(re.callback===null)a(h);else if(re.startTime<=H)a(h),re.sortIndex=re.expirationTime,t(m,re);else break;re=n(h)}}function P(H){if(j=!1,D(H),!k)if(n(m)!==null)k=!0,z||(z=!0,se());else{var re=n(h);re!==null&&ee(P,re.startTime-H)}}var z=!1,B=-1,M=5,V=-1;function I(){return C?!0:!(e.unstable_now()-V<M)}function X(){if(C=!1,z){var H=e.unstable_now();V=H;var re=!0;try{e:{k=!1,j&&(j=!1,T(B),B=-1),w=!0;var xe=b;try{t:{for(D(H),p=n(m);p!==null&&!(p.expirationTime>H&&I());){var ze=p.callback;if(typeof ze=="function"){p.callback=null,b=p.priorityLevel;var R=ze(p.expirationTime<=H);if(H=e.unstable_now(),typeof R=="function"){p.callback=R,D(H),re=!0;break t}p===n(m)&&a(m),D(H)}else a(m);p=n(m)}if(p!==null)re=!0;else{var L=n(h);L!==null&&ee(P,L.startTime-H),re=!1}}break e}finally{p=null,b=xe,w=!1}re=void 0}}finally{re?se():z=!1}}}var se;if(typeof O=="function")se=function(){O(X)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,Y=Se.port2;Se.port1.onmessage=X,se=function(){Y.postMessage(null)}}else se=function(){E(X,0)};function ee(H,re){B=E(function(){H(e.unstable_now())},re)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var re=3;break;default:re=b}var xe=b;b=re;try{return H()}finally{b=xe}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(H,re){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var xe=b;b=H;try{return re()}finally{b=xe}},e.unstable_scheduleCallback=function(H,re,xe){var ze=e.unstable_now();switch(typeof xe=="object"&&xe!==null?(xe=xe.delay,xe=typeof xe=="number"&&0<xe?ze+xe:ze):xe=ze,H){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=xe+R,H={id:g++,callback:re,priorityLevel:H,startTime:xe,expirationTime:R,sortIndex:-1},xe>ze?(H.sortIndex=xe,t(h,H),n(m)===null&&H===n(h)&&(j?(T(B),B=-1):j=!0,ee(P,xe-ze))):(H.sortIndex=R,t(m,H),k||w||(k=!0,z||(z=!0,se()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var re=b;return function(){var xe=b;b=re;try{return H.apply(this,arguments)}finally{b=xe}}}})(Gp)),Gp}var yS;function C2(){return yS||(yS=1,Zp.exports=E2()),Zp.exports}var Vp={exports:{}},Gn={};/**
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 vS;function N2(){if(vS)return Gn;vS=1;var e=Xy();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function u(m,h,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Gn.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return u(m,h,null,g)},Gn.flushSync=function(m){var h=c.T,g=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=g,a.d.f()}},Gn.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))},Gn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Gn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,p=f(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:w}):g==="script"&&a.d.X(m,{crossOrigin:p,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Gn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Gn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,p=f(g,h.crossOrigin);a.d.L(m,g,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Gn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Gn.requestFormReset=function(m){a.d.r(m)},Gn.unstable_batchedUpdates=function(m,h){return m(h)},Gn.useFormState=function(m,h,g){return c.H.useFormState(m,h,g)},Gn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Gn.version="19.2.4",Gn}var bS;function pj(){if(bS)return Vp.exports;bS=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=N2(),Vp.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var xS;function _2(){if(xS)return Ou;xS=1;var e=C2(),t=Xy(),n=pj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}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 u(r){var i=r,l=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(l=i.return),r=i.return;while(r)}return i.tag===3?l: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(u(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=u(r),i===null)throw Error(a(188));return i!==r?null:r}for(var l=r,d=i;;){var y=l.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){l=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===l)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(l.return!==d.return)l=y,d=v;else{for(var S=!1,A=y.child;A;){if(A===l){S=!0,l=y,d=v;break}if(A===d){S=!0,d=y,l=v;break}A=A.sibling}if(!S){for(A=v.child;A;){if(A===l){S=!0,l=v,d=y;break}if(A===d){S=!0,d=v,l=y;break}A=A.sibling}if(!S)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),O=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function se(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var Se=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Se?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case P:return"Suspense";case z:return"SuspenseList";case V:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case O:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case D: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:Y(r.type)||"Memo";case M:i=r._payload,r=r._init;try{return Y(r(i))}catch{}}return null}var ee=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},ze=[],R=-1;function L(r){return{current:r}}function F(r){0>R||(r.current=ze[R],ze[R]=null,R--)}function _(r,i){R++,ze[R]=r.current,r.current=i}var Z=L(null),K=L(null),ue=L(null),we=L(null);function ve(r,i){switch(_(ue,i),_(K,r),_(Z,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Dw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Dw(i),r=Mw(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(Z),_(Z,r)}function me(){F(Z),F(K),F(ue)}function Ge(r){r.memoizedState!==null&&_(we,r);var i=Z.current,l=Mw(i,r.type);i!==l&&(_(K,r),_(Z,l))}function Be(r){K.current===r&&(F(Z),F(K)),we.current===r&&(F(we),Nu._currentValue=xe)}var bt,yt;function ae(r){if(bt===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);bt=i&&i[1]||"",yt=-1<l.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+bt+r+yt}var je=!1;function Me(r,i){if(!r||je)return"";je=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ie){var te=ie}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(ie){te=ie}r.call(fe.prototype)}}else{try{throw Error()}catch(ie){te=ie}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.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(),S=v[0],A=v[1];if(S&&A){var q=S.split(`
44
- `),J=A.split(`
45
- `);for(y=d=0;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;for(;y<J.length&&!J[y].includes("DetermineComponentFrameRoot");)y++;if(d===q.length||y===J.length)for(d=q.length-1,y=J.length-1;1<=d&&0<=y&&q[d]!==J[y];)y--;for(;1<=d&&0<=y;d--,y--)if(q[d]!==J[y]){if(d!==1||y!==1)do if(d--,y--,0>y||q[d]!==J[y]){var oe=`
46
- `+q[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=y);break}}}finally{je=!1,Error.prepareStackTrace=l}return(l=r?r.displayName||r.name:"")?ae(l):""}function Ye(r,i){switch(r.tag){case 26:case 27:case 5:return ae(r.type);case 16:return ae("Lazy");case 13:return r.child!==i&&i!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return Me(r.type,!1);case 11:return Me(r.type.render,!1);case 1:return Me(r.type,!0);case 31:return ae("Activity");default:return""}}function mn(r){try{var i="",l=null;do i+=Ye(r,l),l=r,r=r.return;while(r);return i}catch(d){return`
47
- Error generating stack: `+d.message+`
48
- `+d.stack}}var en=Object.prototype.hasOwnProperty,Cr=e.unstable_scheduleCallback,Br=e.unstable_cancelCallback,hi=e.unstable_shouldYield,mi=e.unstable_requestPaint,on=e.unstable_now,oa=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Ze=e.unstable_LowPriority,nt=e.unstable_IdlePriority,un=e.log,er=e.unstable_setDisableYieldValue,qt=null,Lt=null;function At(r){if(typeof un=="function"&&er(r),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(qt,r)}catch{}}var rt=Math.clz32?Math.clz32:al,tr=Math.log,On=Math.LN2;function al(r){return r>>>=0,r===0?32:31-(tr(r)/On|0)|0}var ua=256,ca=262144,za=4194304;function Zn(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,l){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,S=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Zn(d):(S&=A,S!==0?y=Zn(S):l||(l=A&~r,l!==0&&(y=Zn(l))))):(A=d&~v,A!==0?y=Zn(A):S!==0?y=Zn(S):l||(l=d&~r,l!==0&&(y=Zn(l)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,l=i&-i,v>=l||v===32&&(l&4194048)!==0)?i:y}function wa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Ht(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 ke(){var r=za;return za<<=1,(za&62914560)===0&&(za=4194304),r}function et(r){for(var i=[],l=0;31>l;l++)i.push(r);return i}function pn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Nr(r,i,l,d,y,v){var S=r.pendingLanes;r.pendingLanes=l,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=l,r.entangledLanes&=l,r.errorRecoveryDisabledLanes&=l,r.shellSuspendCounter=0;var A=r.entanglements,q=r.expirationTimes,J=r.hiddenUpdates;for(l=S&~l;0<l;){var oe=31-rt(l),fe=1<<oe;A[oe]=0,q[oe]=-1;var te=J[oe];if(te!==null)for(J[oe]=null,oe=0;oe<te.length;oe++){var ie=te[oe];ie!==null&&(ie.lane&=-536870913)}l&=~fe}d!==0&&pi(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(S&~i))}function pi(r,i,l){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-rt(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|l&261930}function ps(r,i){var l=r.entangledLanes|=i;for(r=r.entanglements;l;){var d=31-rt(l),y=1<<d;y&i|r[d]&i&&(r[d]|=i),l&=~y}}function Zc(r,i){var l=i&-i;return l=(l&42)!==0?1:nr(l),(l&(r.suspendedLanes|i))!==0?0:l}function nr(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 da(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Uo(){var r=re.p;return r!==0?r:(r=window.event,r===void 0?32:aS(r.type))}function Bo(r,i){var l=re.p;try{return re.p=r,i()}finally{re.p=l}}var Fr=Math.random().toString(36).slice(2),cn="__reactFiber$"+Fr,Zt="__reactProps$"+Fr,Ma="__reactContainer$"+Fr,il="__reactEvents$"+Fr,zh="__reactListeners$"+Fr,Gc="__reactHandles$"+Fr,Fo="__reactResources$"+Fr,gi="__reactMarker$"+Fr;function Ie(r){delete r[cn],delete r[Zt],delete r[il],delete r[zh],delete r[Gc]}function $(r){var i=r[cn];if(i)return i;for(var l=r.parentNode;l;){if(i=l[Ma]||l[cn]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(r=$w(r);r!==null;){if(l=r[cn])return l;r=$w(r)}return i}r=l,l=r.parentNode}return null}function he(r){if(r=r[cn]||r[Ma]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ce(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function xt(r){var i=r[Fo];return i||(i=r[Fo]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function dt(r){r[gi]=!0}var Wt=new Set,Pn={};function gn(r,i){zn(r,i),zn(r+"Capture",i)}function zn(r,i){for(Pn[r]=i,r=0;r<i.length;r++)Wt.add(i[r])}var $o=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),dn={},qo={};function Vc(r){return en.call(qo,r)?!0:en.call(dn,r)?!1:$o.test(r)?qo[r]=!0:(dn[r]=!0,!1)}function Qc(r,i,l){if(Vc(i))if(l===null)r.removeAttribute(i);else{switch(typeof l){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,""+l)}}function Kc(r,i,l){if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+l)}}function Ia(r,i,l,d){if(d===null)r.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(l);return}r.setAttributeNS(i,l,""+d)}}function $r(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Cb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function hT(r,i,l){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(S){l=""+S,v.call(this,S)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(S){l=""+S},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Dh(r){if(!r._valueTracker){var i=Cb(r)?"checked":"value";r._valueTracker=hT(r,i,""+r[i])}}function Nb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return r&&(d=Cb(r)?r.checked?"true":"false":r.value),r=d,r!==l?(i.setValue(r),!0):!1}function Yc(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 mT=/[\n"\\]/g;function qr(r){return r.replace(mT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Mh(r,i,l,d,y,v,S,A){r.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?r.type=S:r.removeAttribute("type"),i!=null?S==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+$r(i)):r.value!==""+$r(i)&&(r.value=""+$r(i)):S!=="submit"&&S!=="reset"||r.removeAttribute("value"),i!=null?Ih(r,S,$r(i)):l!=null?Ih(r,S,$r(l)):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=""+$r(A):r.removeAttribute("name")}function _b(r,i,l,d,y,v,S,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Dh(r);return}l=l!=null?""+$r(l):"",i=i!=null?""+$r(i):l,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,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.name=S),Dh(r)}function Ih(r,i,l){i==="number"&&Yc(r.ownerDocument)===r||r.defaultValue===""+l||(r.defaultValue=""+l)}function sl(r,i,l,d){if(r=r.options,i){i={};for(var y=0;y<l.length;y++)i["$"+l[y]]=!0;for(l=0;l<r.length;l++)y=i.hasOwnProperty("$"+r[l].value),r[l].selected!==y&&(r[l].selected=y),y&&d&&(r[l].defaultSelected=!0)}else{for(l=""+$r(l),i=null,y=0;y<r.length;y++){if(r[y].value===l){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Tb(r,i,l){if(i!=null&&(i=""+$r(i),i!==r.value&&(r.value=i),l==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=l!=null?""+$r(l):""}function Ab(r,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(a(92));if(ee(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=$r(i),r.defaultValue=l,d=r.textContent,d===l&&d!==""&&d!==null&&(r.value=d),Dh(r)}function ll(r,i){if(i){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=i;return}}r.textContent=i}var pT=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 Rb(r,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,l):typeof l!="number"||l===0||pT.has(i)?i==="float"?r.cssFloat=l:r[i]=(""+l).trim():r[i]=l+"px"}function Ob(r,i,l){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,l!=null){for(var d in l)!l.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)&&l[y]!==d&&Rb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Rb(r,v,i[v])}function Lh(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gT=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"]]),yT=/^[\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 Xc(r){return yT.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function La(){}var Ph=null;function Uh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ol=null,ul=null;function zb(r){var i=he(r);if(i&&(r=i.stateNode)){var l=r[Zt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Mh(r,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+qr(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==r&&d.form===r.form){var y=d[Zt]||null;if(!y)throw Error(a(90));Mh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===r.form&&Nb(d)}break e;case"textarea":Tb(r,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&sl(r,!!l.multiple,i,!1)}}}var Bh=!1;function Db(r,i,l){if(Bh)return r(i,l);Bh=!0;try{var d=r(i);return d}finally{if(Bh=!1,(ol!==null||ul!==null)&&(Pd(),ol&&(i=ol,r=ul,ul=ol=null,zb(i),r)))for(i=0;i<r.length;i++)zb(r[i])}}function Ho(r,i){var l=r.stateNode;if(l===null)return null;var d=l[Zt]||null;if(d===null)return null;l=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(l&&typeof l!="function")throw Error(a(231,i,typeof l));return l}var Pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fh=!1;if(Pa)try{var Zo={};Object.defineProperty(Zo,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",Zo,Zo),window.removeEventListener("test",Zo,Zo)}catch{Fh=!1}var yi=null,$h=null,Wc=null;function Mb(){if(Wc)return Wc;var r,i=$h,l=i.length,d,y="value"in yi?yi.value:yi.textContent,v=y.length;for(r=0;r<l&&i[r]===y[r];r++);var S=l-r;for(d=1;d<=S&&i[l-d]===y[v-d];d++);return Wc=y.slice(r,1<d?1-d:void 0)}function Jc(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 ed(){return!0}function Ib(){return!1}function dr(r){function i(l,d,y,v,S){this._reactName=l,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(l=r[A],this[A]=l?l(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?ed:Ib,this.isPropagationStopped=Ib,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ed)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ed)},persist:function(){},isPersistent:ed}),i}var gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=dr(gs),Go=p({},gs,{view:0,detail:0}),vT=dr(Go),qh,Hh,Vo,nd=p({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Vo&&(Vo&&r.type==="mousemove"?(qh=r.screenX-Vo.screenX,Hh=r.screenY-Vo.screenY):Hh=qh=0,Vo=r),qh)},movementY:function(r){return"movementY"in r?r.movementY:Hh}}),Lb=dr(nd),bT=p({},nd,{dataTransfer:0}),xT=dr(bT),wT=p({},Go,{relatedTarget:0}),Zh=dr(wT),ST=p({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),kT=dr(ST),jT=p({},gs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),ET=dr(jT),CT=p({},gs,{data:0}),Pb=dr(CT),NT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_T={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"},TT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function AT(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=TT[r])?!!i[r]:!1}function Gh(){return AT}var RT=p({},Go,{key:function(r){if(r.key){var i=NT[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Jc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?_T[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gh,charCode:function(r){return r.type==="keypress"?Jc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Jc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),OT=dr(RT),zT=p({},nd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ub=dr(zT),DT=p({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gh}),MT=dr(DT),IT=p({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),LT=dr(IT),PT=p({},nd,{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}),UT=dr(PT),BT=p({},gs,{newState:0,oldState:0}),FT=dr(BT),$T=[9,13,27,32],Vh=Pa&&"CompositionEvent"in window,Qo=null;Pa&&"documentMode"in document&&(Qo=document.documentMode);var qT=Pa&&"TextEvent"in window&&!Qo,Bb=Pa&&(!Vh||Qo&&8<Qo&&11>=Qo),Fb=" ",$b=!1;function qb(r,i){switch(r){case"keyup":return $T.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var cl=!1;function HT(r,i){switch(r){case"compositionend":return Hb(i);case"keypress":return i.which!==32?null:($b=!0,Fb);case"textInput":return r=i.data,r===Fb&&$b?null:r;default:return null}}function ZT(r,i){if(cl)return r==="compositionend"||!Vh&&qb(r,i)?(r=Mb(),Wc=$h=yi=null,cl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Bb&&i.locale!=="ko"?null:i.data;default:return null}}var GT={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 Zb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!GT[r.type]:i==="textarea"}function Gb(r,i,l,d){ol?ul?ul.push(d):ul=[d]:ol=d,i=Zd(i,"onChange"),0<i.length&&(l=new td("onChange","change",null,l,d),r.push({event:l,listeners:i}))}var Ko=null,Yo=null;function VT(r){_w(r,0)}function rd(r){var i=Ce(r);if(Nb(i))return r}function Vb(r,i){if(r==="change")return i}var Qb=!1;if(Pa){var Qh;if(Pa){var Kh="oninput"in document;if(!Kh){var Kb=document.createElement("div");Kb.setAttribute("oninput","return;"),Kh=typeof Kb.oninput=="function"}Qh=Kh}else Qh=!1;Qb=Qh&&(!document.documentMode||9<document.documentMode)}function Yb(){Ko&&(Ko.detachEvent("onpropertychange",Xb),Yo=Ko=null)}function Xb(r){if(r.propertyName==="value"&&rd(Yo)){var i=[];Gb(i,Yo,r,Uh(r)),Db(VT,i)}}function QT(r,i,l){r==="focusin"?(Yb(),Ko=i,Yo=l,Ko.attachEvent("onpropertychange",Xb)):r==="focusout"&&Yb()}function KT(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return rd(Yo)}function YT(r,i){if(r==="click")return rd(i)}function XT(r,i){if(r==="input"||r==="change")return rd(i)}function WT(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var _r=typeof Object.is=="function"?Object.is:WT;function Xo(r,i){if(_r(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var l=Object.keys(r),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var y=l[d];if(!en.call(i,y)||!_r(r[y],i[y]))return!1}return!0}function Wb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Jb(r,i){var l=Wb(r);r=0;for(var d;l;){if(l.nodeType===3){if(d=r+l.textContent.length,r<=i&&d>=i)return{node:l,offset:i-r};r=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Wb(l)}}function ex(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?ex(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function tx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Yc(r.document);i instanceof r.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)r=i.contentWindow;else break;i=Yc(r.document)}return i}function Yh(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var JT=Pa&&"documentMode"in document&&11>=document.documentMode,dl=null,Xh=null,Wo=null,Wh=!1;function nx(r,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Wh||dl==null||dl!==Yc(d)||(d=dl,"selectionStart"in d&&Yh(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}),Wo&&Xo(Wo,d)||(Wo=d,d=Zd(Xh,"onSelect"),0<d.length&&(i=new td("onSelect","select",null,i,l),r.push({event:i,listeners:d}),i.target=dl)))}function ys(r,i){var l={};return l[r.toLowerCase()]=i.toLowerCase(),l["Webkit"+r]="webkit"+i,l["Moz"+r]="moz"+i,l}var fl={animationend:ys("Animation","AnimationEnd"),animationiteration:ys("Animation","AnimationIteration"),animationstart:ys("Animation","AnimationStart"),transitionrun:ys("Transition","TransitionRun"),transitionstart:ys("Transition","TransitionStart"),transitioncancel:ys("Transition","TransitionCancel"),transitionend:ys("Transition","TransitionEnd")},Jh={},rx={};Pa&&(rx=document.createElement("div").style,"AnimationEvent"in window||(delete fl.animationend.animation,delete fl.animationiteration.animation,delete fl.animationstart.animation),"TransitionEvent"in window||delete fl.transitionend.transition);function vs(r){if(Jh[r])return Jh[r];if(!fl[r])return r;var i=fl[r],l;for(l in i)if(i.hasOwnProperty(l)&&l in rx)return Jh[r]=i[l];return r}var ax=vs("animationend"),ix=vs("animationiteration"),sx=vs("animationstart"),eA=vs("transitionrun"),tA=vs("transitionstart"),nA=vs("transitioncancel"),lx=vs("transitionend"),ox=new Map,em="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");em.push("scrollEnd");function fa(r,i){ox.set(r,i),gn(i,[r])}var ad=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)},Hr=[],hl=0,tm=0;function id(){for(var r=hl,i=tm=hl=0;i<r;){var l=Hr[i];Hr[i++]=null;var d=Hr[i];Hr[i++]=null;var y=Hr[i];Hr[i++]=null;var v=Hr[i];if(Hr[i++]=null,d!==null&&y!==null){var S=d.pending;S===null?y.next=y:(y.next=S.next,S.next=y),d.pending=y}v!==0&&ux(l,y,v)}}function sd(r,i,l,d){Hr[hl++]=r,Hr[hl++]=i,Hr[hl++]=l,Hr[hl++]=d,tm|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function nm(r,i,l,d){return sd(r,i,l,d),ld(r)}function bs(r,i){return sd(r,null,null,i),ld(r)}function ux(r,i,l){r.lanes|=l;var d=r.alternate;d!==null&&(d.lanes|=l);for(var y=!1,v=r.return;v!==null;)v.childLanes|=l,d=v.alternate,d!==null&&(d.childLanes|=l),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-rt(l),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=l|536870912),v):null}function ld(r){if(50<xu)throw xu=0,dp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var ml={};function rA(r,i,l,d){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=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 Tr(r,i,l,d){return new rA(r,i,l,d)}function rm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ua(r,i){var l=r.alternate;return l===null?(l=Tr(r.tag,i,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=i,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&65011712,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,i=r.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l.refCleanup=r.refCleanup,l}function cx(r,i){r.flags&=65011714;var l=r.alternate;return l===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=l.childLanes,r.lanes=l.lanes,r.child=l.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=l.memoizedProps,r.memoizedState=l.memoizedState,r.updateQueue=l.updateQueue,r.type=l.type,i=l.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function od(r,i,l,d,y,v){var S=0;if(d=r,typeof r=="function")rm(r)&&(S=1);else if(typeof r=="string")S=o2(r,l,Z.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case V:return r=Tr(31,l,i,y),r.elementType=V,r.lanes=v,r;case j:return xs(l.children,y,v,i);case C:S=8,y|=24;break;case E:return r=Tr(12,l,i,y|2),r.elementType=E,r.lanes=v,r;case P:return r=Tr(13,l,i,y),r.elementType=P,r.lanes=v,r;case z:return r=Tr(19,l,i,y),r.elementType=z,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:S=10;break e;case T:S=9;break e;case D:S=11;break e;case B:S=14;break e;case M:S=16,d=null;break e}S=29,l=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Tr(S,l,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function xs(r,i,l,d){return r=Tr(7,r,d,i),r.lanes=l,r}function am(r,i,l){return r=Tr(6,r,null,i),r.lanes=l,r}function dx(r){var i=Tr(18,null,null,0);return i.stateNode=r,i}function im(r,i,l){return i=Tr(4,r.children!==null?r.children:[],r.key,i),i.lanes=l,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var fx=new WeakMap;function Zr(r,i){if(typeof r=="object"&&r!==null){var l=fx.get(r);return l!==void 0?l:(i={value:r,source:i,stack:mn(i)},fx.set(r,i),i)}return{value:r,source:i,stack:mn(i)}}var pl=[],gl=0,ud=null,Jo=0,Gr=[],Vr=0,vi=null,Sa=1,ka="";function Ba(r,i){pl[gl++]=Jo,pl[gl++]=ud,ud=r,Jo=i}function hx(r,i,l){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,vi=r;var d=Sa;r=ka;var y=32-rt(d)-1;d&=~(1<<y),l+=1;var v=32-rt(i)+y;if(30<v){var S=y-y%5;v=(d&(1<<S)-1).toString(32),d>>=S,y-=S,Sa=1<<32-rt(i)+y|l<<y|d,ka=v+r}else Sa=1<<v|l<<y|d,ka=r}function sm(r){r.return!==null&&(Ba(r,1),hx(r,1,0))}function lm(r){for(;r===ud;)ud=pl[--gl],pl[gl]=null,Jo=pl[--gl],pl[gl]=null;for(;r===vi;)vi=Gr[--Vr],Gr[Vr]=null,ka=Gr[--Vr],Gr[Vr]=null,Sa=Gr[--Vr],Gr[Vr]=null}function mx(r,i){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,Sa=i.id,ka=i.overflow,vi=r}var Un=null,Bt=null,ft=!1,bi=null,Qr=!1,om=Error(a(519));function xi(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eu(Zr(i,r)),om}function px(r){var i=r.stateNode,l=r.type,d=r.memoizedProps;switch(i[cn]=r,i[Zt]=d,l){case"dialog":it("cancel",i),it("close",i);break;case"iframe":case"object":case"embed":it("load",i);break;case"video":case"audio":for(l=0;l<Su.length;l++)it(Su[l],i);break;case"source":it("error",i);break;case"img":case"image":case"link":it("error",i),it("load",i);break;case"details":it("toggle",i);break;case"input":it("invalid",i),_b(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":it("invalid",i);break;case"textarea":it("invalid",i),Ab(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||Ow(i.textContent,l)?(d.popover!=null&&(it("beforetoggle",i),it("toggle",i)),d.onScroll!=null&&it("scroll",i),d.onScrollEnd!=null&&it("scrollend",i),d.onClick!=null&&(i.onclick=La),i=!0):i=!1,i||xi(r,!0)}function gx(r){for(Un=r.return;Un;)switch(Un.tag){case 5:case 31:case 13:Qr=!1;return;case 27:case 3:Qr=!0;return;default:Un=Un.return}}function yl(r){if(r!==Un)return!1;if(!ft)return gx(r),ft=!0,!1;var i=r.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=r.type,l=!(l!=="form"&&l!=="button")||Cp(r.type,r.memoizedProps)),l=!l),l&&Bt&&xi(r),gx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Fw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=Fw(r)}else i===27?(i=Bt,Di(r.type)?(r=Rp,Rp=null,Bt=r):Bt=i):Bt=Un?Yr(r.stateNode.nextSibling):null;return!0}function ws(){Bt=Un=null,ft=!1}function um(){var r=bi;return r!==null&&(pr===null?pr=r:pr.push.apply(pr,r),bi=null),r}function eu(r){bi===null?bi=[r]:bi.push(r)}var cm=L(null),Ss=null,Fa=null;function wi(r,i,l){_(cm,i._currentValue),i._currentValue=l}function $a(r){r._currentValue=cm.current,F(cm)}function dm(r,i,l){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===l)break;r=r.return}}function fm(r,i,l,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var S=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var q=0;q<i.length;q++)if(A.context===i[q]){v.lanes|=l,A=v.alternate,A!==null&&(A.lanes|=l),dm(v.return,l,r),d||(S=null);break e}v=A.next}}else if(y.tag===18){if(S=y.return,S===null)throw Error(a(341));S.lanes|=l,v=S.alternate,v!==null&&(v.lanes|=l),dm(S,l,r),S=null}else S=y.child;if(S!==null)S.return=y;else for(S=y;S!==null;){if(S===r){S=null;break}if(y=S.sibling,y!==null){y.return=S.return,S=y;break}S=S.return}y=S}}function vl(r,i,l,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 S=y.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var A=y.type;_r(y.pendingProps.value,S.value)||(r!==null?r.push(A):r=[A])}}else if(y===we.current){if(S=y.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Nu):r=[Nu])}y=y.return}r!==null&&fm(i,r,l,d),i.flags|=262144}function cd(r){for(r=r.firstContext;r!==null;){if(!_r(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function ks(r){Ss=r,Fa=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return yx(Ss,r)}function dd(r,i){return Ss===null&&ks(r),yx(r,i)}function yx(r,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Fa===null){if(r===null)throw Error(a(308));Fa=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Fa=Fa.next=i;return l}var aA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(l,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(l){return l()})}},iA=e.unstable_scheduleCallback,sA=e.unstable_NormalPriority,yn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hm(){return{controller:new aA,data:new Map,refCount:0}}function tu(r){r.refCount--,r.refCount===0&&iA(sA,function(){r.controller.abort()})}var nu=null,mm=0,bl=0,xl=null;function lA(r,i){if(nu===null){var l=nu=[];mm=0,bl=yp(),xl={status:"pending",value:void 0,then:function(d){l.push(d)}}}return mm++,i.then(vx,vx),i}function vx(){if(--mm===0&&nu!==null){xl!==null&&(xl.status="fulfilled");var r=nu;nu=null,bl=0,xl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function oA(r,i){var l=[],d={status:"pending",value:null,reason:null,then:function(y){l.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<l.length;y++)(0,l[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<l.length;y++)(0,l[y])(void 0)}),d}var bx=H.S;H.S=function(r,i){nw=on(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&lA(r,i),bx!==null&&bx(r,i)};var js=L(null);function pm(){var r=js.current;return r!==null?r:Dt.pooledCache}function fd(r,i){i===null?_(js,js.current):_(js,i.pool)}function xx(){var r=pm();return r===null?null:{parent:yn._currentValue,pool:r}}var wl=Error(a(460)),gm=Error(a(474)),hd=Error(a(542)),md={then:function(){}};function wx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Sx(r,i,l){switch(l=r[l],l===void 0?r.push(i):l!==i&&(i.then(La,La),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,jx(r),r;default:if(typeof i.status=="string")i.then(La,La);else{if(r=Dt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(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,jx(r),r}throw Cs=i,wl}}function Es(r){try{var i=r._init;return i(r._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Cs=l,wl):l}}var Cs=null;function kx(){if(Cs===null)throw Error(a(459));var r=Cs;return Cs=null,r}function jx(r){if(r===wl||r===hd)throw Error(a(483))}var Sl=null,ru=0;function pd(r){var i=ru;return ru+=1,Sl===null&&(Sl=[]),Sx(Sl,r,i)}function au(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function gd(r,i){throw i.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Ex(r){function i(Q,G){if(r){var W=Q.deletions;W===null?(Q.deletions=[G],Q.flags|=16):W.push(G)}}function l(Q,G){if(!r)return null;for(;G!==null;)i(Q,G),G=G.sibling;return null}function d(Q){for(var G=new Map;Q!==null;)Q.key!==null?G.set(Q.key,Q):G.set(Q.index,Q),Q=Q.sibling;return G}function y(Q,G){return Q=Ua(Q,G),Q.index=0,Q.sibling=null,Q}function v(Q,G,W){return Q.index=W,r?(W=Q.alternate,W!==null?(W=W.index,W<G?(Q.flags|=67108866,G):W):(Q.flags|=67108866,G)):(Q.flags|=1048576,G)}function S(Q){return r&&Q.alternate===null&&(Q.flags|=67108866),Q}function A(Q,G,W,de){return G===null||G.tag!==6?(G=am(W,Q.mode,de),G.return=Q,G):(G=y(G,W),G.return=Q,G)}function q(Q,G,W,de){var Le=W.type;return Le===j?oe(Q,G,W.props.children,de,W.key):G!==null&&(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===M&&Es(Le)===G.type)?(G=y(G,W.props),au(G,W),G.return=Q,G):(G=od(W.type,W.key,W.props,null,Q.mode,de),au(G,W),G.return=Q,G)}function J(Q,G,W,de){return G===null||G.tag!==4||G.stateNode.containerInfo!==W.containerInfo||G.stateNode.implementation!==W.implementation?(G=im(W,Q.mode,de),G.return=Q,G):(G=y(G,W.children||[]),G.return=Q,G)}function oe(Q,G,W,de,Le){return G===null||G.tag!==7?(G=xs(W,Q.mode,de,Le),G.return=Q,G):(G=y(G,W),G.return=Q,G)}function fe(Q,G,W){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=am(""+G,Q.mode,W),G.return=Q,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return W=od(G.type,G.key,G.props,null,Q.mode,W),au(W,G),W.return=Q,W;case k:return G=im(G,Q.mode,W),G.return=Q,G;case M:return G=Es(G),fe(Q,G,W)}if(ee(G)||se(G))return G=xs(G,Q.mode,W,null),G.return=Q,G;if(typeof G.then=="function")return fe(Q,pd(G),W);if(G.$$typeof===O)return fe(Q,dd(Q,G),W);gd(Q,G)}return null}function te(Q,G,W,de){var Le=G!==null?G.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Le!==null?null:A(Q,G,""+W,de);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return W.key===Le?q(Q,G,W,de):null;case k:return W.key===Le?J(Q,G,W,de):null;case M:return W=Es(W),te(Q,G,W,de)}if(ee(W)||se(W))return Le!==null?null:oe(Q,G,W,de,null);if(typeof W.then=="function")return te(Q,G,pd(W),de);if(W.$$typeof===O)return te(Q,G,dd(Q,W),de);gd(Q,W)}return null}function ie(Q,G,W,de,Le){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Q=Q.get(W)||null,A(G,Q,""+de,Le);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return Q=Q.get(de.key===null?W:de.key)||null,q(G,Q,de,Le);case k:return Q=Q.get(de.key===null?W:de.key)||null,J(G,Q,de,Le);case M:return de=Es(de),ie(Q,G,W,de,Le)}if(ee(de)||se(de))return Q=Q.get(W)||null,oe(G,Q,de,Le,null);if(typeof de.then=="function")return ie(Q,G,W,pd(de),Le);if(de.$$typeof===O)return ie(Q,G,W,dd(G,de),Le);gd(G,de)}return null}function _e(Q,G,W,de){for(var Le=null,wt=null,Oe=G,Xe=G=0,ct=null;Oe!==null&&Xe<W.length;Xe++){Oe.index>Xe?(ct=Oe,Oe=null):ct=Oe.sibling;var St=te(Q,Oe,W[Xe],de);if(St===null){Oe===null&&(Oe=ct);break}r&&Oe&&St.alternate===null&&i(Q,Oe),G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St,Oe=ct}if(Xe===W.length)return l(Q,Oe),ft&&Ba(Q,Xe),Le;if(Oe===null){for(;Xe<W.length;Xe++)Oe=fe(Q,W[Xe],de),Oe!==null&&(G=v(Oe,G,Xe),wt===null?Le=Oe:wt.sibling=Oe,wt=Oe);return ft&&Ba(Q,Xe),Le}for(Oe=d(Oe);Xe<W.length;Xe++)ct=ie(Oe,Q,Xe,W[Xe],de),ct!==null&&(r&&ct.alternate!==null&&Oe.delete(ct.key===null?Xe:ct.key),G=v(ct,G,Xe),wt===null?Le=ct:wt.sibling=ct,wt=ct);return r&&Oe.forEach(function(Ui){return i(Q,Ui)}),ft&&Ba(Q,Xe),Le}function $e(Q,G,W,de){if(W==null)throw Error(a(151));for(var Le=null,wt=null,Oe=G,Xe=G=0,ct=null,St=W.next();Oe!==null&&!St.done;Xe++,St=W.next()){Oe.index>Xe?(ct=Oe,Oe=null):ct=Oe.sibling;var Ui=te(Q,Oe,St.value,de);if(Ui===null){Oe===null&&(Oe=ct);break}r&&Oe&&Ui.alternate===null&&i(Q,Oe),G=v(Ui,G,Xe),wt===null?Le=Ui:wt.sibling=Ui,wt=Ui,Oe=ct}if(St.done)return l(Q,Oe),ft&&Ba(Q,Xe),Le;if(Oe===null){for(;!St.done;Xe++,St=W.next())St=fe(Q,St.value,de),St!==null&&(G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St);return ft&&Ba(Q,Xe),Le}for(Oe=d(Oe);!St.done;Xe++,St=W.next())St=ie(Oe,Q,Xe,St.value,de),St!==null&&(r&&St.alternate!==null&&Oe.delete(St.key===null?Xe:St.key),G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St);return r&&Oe.forEach(function(b2){return i(Q,b2)}),ft&&Ba(Q,Xe),Le}function zt(Q,G,W,de){if(typeof W=="object"&&W!==null&&W.type===j&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case w:e:{for(var Le=W.key;G!==null;){if(G.key===Le){if(Le=W.type,Le===j){if(G.tag===7){l(Q,G.sibling),de=y(G,W.props.children),de.return=Q,Q=de;break e}}else if(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===M&&Es(Le)===G.type){l(Q,G.sibling),de=y(G,W.props),au(de,W),de.return=Q,Q=de;break e}l(Q,G);break}else i(Q,G);G=G.sibling}W.type===j?(de=xs(W.props.children,Q.mode,de,W.key),de.return=Q,Q=de):(de=od(W.type,W.key,W.props,null,Q.mode,de),au(de,W),de.return=Q,Q=de)}return S(Q);case k:e:{for(Le=W.key;G!==null;){if(G.key===Le)if(G.tag===4&&G.stateNode.containerInfo===W.containerInfo&&G.stateNode.implementation===W.implementation){l(Q,G.sibling),de=y(G,W.children||[]),de.return=Q,Q=de;break e}else{l(Q,G);break}else i(Q,G);G=G.sibling}de=im(W,Q.mode,de),de.return=Q,Q=de}return S(Q);case M:return W=Es(W),zt(Q,G,W,de)}if(ee(W))return _e(Q,G,W,de);if(se(W)){if(Le=se(W),typeof Le!="function")throw Error(a(150));return W=Le.call(W),$e(Q,G,W,de)}if(typeof W.then=="function")return zt(Q,G,pd(W),de);if(W.$$typeof===O)return zt(Q,G,dd(Q,W),de);gd(Q,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,G!==null&&G.tag===6?(l(Q,G.sibling),de=y(G,W),de.return=Q,Q=de):(l(Q,G),de=am(W,Q.mode,de),de.return=Q,Q=de),S(Q)):l(Q,G)}return function(Q,G,W,de){try{ru=0;var Le=zt(Q,G,W,de);return Sl=null,Le}catch(Oe){if(Oe===wl||Oe===hd)throw Oe;var wt=Tr(29,Oe,null,Q.mode);return wt.lanes=de,wt.return=Q,wt}finally{}}}var Ns=Ex(!0),Cx=Ex(!1),Si=!1;function ym(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vm(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ki(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ji(r,i,l){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=ld(r),ux(r,null,l),i}return sd(r,d,i,l),ld(r)}function iu(r,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,ps(r,l)}}function bm(r,i){var l=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var y=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var S={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?y=v=S:v=v.next=S,l=l.next}while(l!==null);v===null?y=v=i:v=v.next=i}else y=v=i;l={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=i:r.next=i,l.lastBaseUpdate=i}var xm=!1;function su(){if(xm){var r=xl;if(r!==null)throw r}}function lu(r,i,l,d){xm=!1;var y=r.updateQueue;Si=!1;var v=y.firstBaseUpdate,S=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var q=A,J=q.next;q.next=null,S===null?v=J:S.next=J,S=q;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,A=oe.lastBaseUpdate,A!==S&&(A===null?oe.firstBaseUpdate=J:A.next=J,oe.lastBaseUpdate=q))}if(v!==null){var fe=y.baseState;S=0,oe=J=q=null,A=v;do{var te=A.lane&-536870913,ie=te!==A.lane;if(ie?(ut&te)===te:(d&te)===te){te!==0&&te===bl&&(xm=!0),oe!==null&&(oe=oe.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var _e=r,$e=A;te=i;var zt=l;switch($e.tag){case 1:if(_e=$e.payload,typeof _e=="function"){fe=_e.call(zt,fe,te);break e}fe=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=$e.payload,te=typeof _e=="function"?_e.call(zt,fe,te):_e,te==null)break e;fe=p({},fe,te);break e;case 2:Si=!0}}te=A.callback,te!==null&&(r.flags|=64,ie&&(r.flags|=8192),ie=y.callbacks,ie===null?y.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},oe===null?(J=oe=ie,q=fe):oe=oe.next=ie,S|=te;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;ie=A,A=ie.next,ie.next=null,y.lastBaseUpdate=ie,y.shared.pending=null}}while(!0);oe===null&&(q=fe),y.baseState=q,y.firstBaseUpdate=J,y.lastBaseUpdate=oe,v===null&&(y.shared.lanes=0),Ti|=S,r.lanes=S,r.memoizedState=fe}}function Nx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function _x(r,i){var l=r.callbacks;if(l!==null)for(r.callbacks=null,r=0;r<l.length;r++)Nx(l[r],i)}var kl=L(null),yd=L(0);function Tx(r,i){r=Xa,_(yd,r),_(kl,i),Xa=r|i.baseLanes}function wm(){_(yd,Xa),_(kl,kl.current)}function Sm(){Xa=yd.current,F(kl),F(yd)}var Ar=L(null),Kr=null;function Ei(r){var i=r.alternate;_(fn,fn.current&1),_(Ar,r),Kr===null&&(i===null||kl.current!==null||i.memoizedState!==null)&&(Kr=r)}function km(r){_(fn,fn.current),_(Ar,r),Kr===null&&(Kr=r)}function Ax(r){r.tag===22?(_(fn,fn.current),_(Ar,r),Kr===null&&(Kr=r)):Ci()}function Ci(){_(fn,fn.current),_(Ar,Ar.current)}function Rr(r){F(Ar),Kr===r&&(Kr=null),F(fn)}var fn=L(0);function vd(r){for(var i=r;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Tp(l)||Ap(l)))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,Ke=null,Rt=null,vn=null,bd=!1,jl=!1,_s=!1,xd=0,ou=0,El=null,uA=0;function tn(){throw Error(a(321))}function jm(r,i){if(i===null)return!1;for(var l=0;l<i.length&&l<r.length;l++)if(!_r(r[l],i[l]))return!1;return!0}function Em(r,i,l,d,y,v){return qa=v,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=r===null||r.memoizedState===null?h0:Bm,_s=!1,v=l(d,y),_s=!1,jl&&(v=Ox(i,l,d,y)),Rx(r),v}function Rx(r){H.H=du;var i=Rt!==null&&Rt.next!==null;if(qa=0,vn=Rt=Ke=null,bd=!1,ou=0,El=null,i)throw Error(a(300));r===null||bn||(r=r.dependencies,r!==null&&cd(r)&&(bn=!0))}function Ox(r,i,l,d){Ke=r;var y=0;do{if(jl&&(El=null),ou=0,jl=!1,25<=y)throw Error(a(301));if(y+=1,vn=Rt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}H.H=m0,v=i(l,d)}while(jl);return v}function cA(){var r=H.H,i=r.useState()[0];return i=typeof i.then=="function"?uu(i):i,r=r.useState()[0],(Rt!==null?Rt.memoizedState:null)!==r&&(Ke.flags|=1024),i}function Cm(){var r=xd!==0;return xd=0,r}function Nm(r,i,l){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~l}function _m(r){if(bd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}bd=!1}qa=0,vn=Rt=Ke=null,jl=!1,ou=xd=0,El=null}function rr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Ke.memoizedState=vn=r:vn=vn.next=r,vn}function hn(){if(Rt===null){var r=Ke.alternate;r=r!==null?r.memoizedState:null}else r=Rt.next;var i=vn===null?Ke.memoizedState:vn.next;if(i!==null)vn=i,Rt=r;else{if(r===null)throw Ke.alternate===null?Error(a(467)):Error(a(310));Rt=r,r={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},vn===null?Ke.memoizedState=vn=r:vn=vn.next=r}return vn}function wd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uu(r){var i=ou;return ou+=1,El===null&&(El=[]),r=Sx(El,r,i),i=Ke,(vn===null?i.memoizedState:vn.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?h0:Bm),r}function Sd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return uu(r);if(r.$$typeof===O)return Bn(r)}throw Error(a(438,String(r)))}function Tm(r){var i=null,l=Ke.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=wd(),Ke.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(r),d=0;d<r;d++)l[d]=I;return i.index++,l}function Ha(r,i){return typeof i=="function"?i(r):i}function kd(r){var i=hn();return Am(i,Rt,r)}function Am(r,i,l){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var S=y.next;y.next=v.next,v.next=S}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=S=null,q=null,J=i,oe=!1;do{var fe=J.lane&-536870913;if(fe!==J.lane?(ut&fe)===fe:(qa&fe)===fe){var te=J.revertLane;if(te===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),fe===bl&&(oe=!0);else if((qa&te)===te){J=J.next,te===bl&&(oe=!0);continue}else fe={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},q===null?(A=q=fe,S=v):q=q.next=fe,Ke.lanes|=te,Ti|=te;fe=J.action,_s&&l(v,fe),v=J.hasEagerState?J.eagerState:l(v,fe)}else te={lane:fe,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},q===null?(A=q=te,S=v):q=q.next=te,Ke.lanes|=fe,Ti|=fe;J=J.next}while(J!==null&&J!==i);if(q===null?S=v:q.next=A,!_r(v,r.memoizedState)&&(bn=!0,oe&&(l=xl,l!==null)))throw l;r.memoizedState=v,r.baseState=S,r.baseQueue=q,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Rm(r){var i=hn(),l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var d=l.dispatch,y=l.pending,v=i.memoizedState;if(y!==null){l.pending=null;var S=y=y.next;do v=r(v,S.action),S=S.next;while(S!==y);_r(v,i.memoizedState)||(bn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),l.lastRenderedState=v}return[v,d]}function zx(r,i,l){var d=Ke,y=hn(),v=ft;if(v){if(l===void 0)throw Error(a(407));l=l()}else l=i();var S=!_r((Rt||y).memoizedState,l);if(S&&(y.memoizedState=l,bn=!0),y=y.queue,Dm(Ix.bind(null,d,y,r),[r]),y.getSnapshot!==i||S||vn!==null&&vn.memoizedState.tag&1){if(d.flags|=2048,Cl(9,{destroy:void 0},Mx.bind(null,d,y,l,i),null),Dt===null)throw Error(a(349));v||(qa&127)!==0||Dx(d,i,l)}return l}function Dx(r,i,l){r.flags|=16384,r={getSnapshot:i,value:l},i=Ke.updateQueue,i===null?(i=wd(),Ke.updateQueue=i,i.stores=[r]):(l=i.stores,l===null?i.stores=[r]:l.push(r))}function Mx(r,i,l,d){i.value=l,i.getSnapshot=d,Lx(i)&&Px(r)}function Ix(r,i,l){return l(function(){Lx(i)&&Px(r)})}function Lx(r){var i=r.getSnapshot;r=r.value;try{var l=i();return!_r(r,l)}catch{return!0}}function Px(r){var i=bs(r,2);i!==null&&gr(i,r,2)}function Om(r){var i=rr();if(typeof r=="function"){var l=r;if(r=l(),_s){At(!0);try{l()}finally{At(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:r},i}function Ux(r,i,l,d){return r.baseState=l,Am(r,Rt,typeof d=="function"?d:Ha)}function dA(r,i,l,d,y){if(Cd(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(S){v.listeners.push(S)}};H.T!==null?l(!0):v.isTransition=!1,d(v),l=i.pending,l===null?(v.next=i.pending=v,Bx(i,v)):(v.next=l.next,i.pending=l.next=v)}}function Bx(r,i){var l=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=H.T,S={};H.T=S;try{var A=l(y,d),q=H.S;q!==null&&q(S,A),Fx(r,i,A)}catch(J){zm(r,i,J)}finally{v!==null&&S.types!==null&&(v.types=S.types),H.T=v}}else try{v=l(y,d),Fx(r,i,v)}catch(J){zm(r,i,J)}}function Fx(r,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){$x(r,i,d)},function(d){return zm(r,i,d)}):$x(r,i,l)}function $x(r,i,l){i.status="fulfilled",i.value=l,qx(i),r.state=l,i=r.pending,i!==null&&(l=i.next,l===i?r.pending=null:(l=l.next,i.next=l,Bx(r,l)))}function zm(r,i,l){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,qx(i),i=i.next;while(i!==d)}r.action=null}function qx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Hx(r,i){return i}function Zx(r,i){if(ft){var l=Dt.formState;if(l!==null){e:{var d=Ke;if(ft){if(Bt){t:{for(var y=Bt,v=Qr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Yr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Bt=Yr(y.nextSibling),d=y.data==="F!";break e}}xi(d)}d=!1}d&&(i=l[0])}}return l=rr(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hx,lastRenderedState:i},l.queue=d,l=c0.bind(null,Ke,d),d.dispatch=l,d=Om(!1),v=Um.bind(null,Ke,!1,d.queue),d=rr(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,l=dA.bind(null,Ke,y,v,l),y.dispatch=l,d.memoizedState=r,[i,l,!1]}function Gx(r){var i=hn();return Vx(i,Rt,r)}function Vx(r,i,l){if(i=Am(r,i,Hx)[0],r=kd(Ha)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=uu(i)}catch(S){throw S===wl?hd:S}else d=i;i=hn();var y=i.queue,v=y.dispatch;return l!==i.memoizedState&&(Ke.flags|=2048,Cl(9,{destroy:void 0},fA.bind(null,y,l),null)),[d,v,r]}function fA(r,i){r.action=i}function Qx(r){var i=hn(),l=Rt;if(l!==null)return Vx(i,l,r);hn(),i=i.memoizedState,l=hn();var d=l.queue.dispatch;return l.memoizedState=r,[i,d,!1]}function Cl(r,i,l,d){return r={tag:r,create:l,deps:d,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=wd(),Ke.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=r.next=r:(d=l.next,l.next=r,r.next=d,i.lastEffect=r),r}function Kx(){return hn().memoizedState}function jd(r,i,l,d){var y=rr();Ke.flags|=r,y.memoizedState=Cl(1|i,{destroy:void 0},l,d===void 0?null:d)}function Ed(r,i,l,d){var y=hn();d=d===void 0?null:d;var v=y.memoizedState.inst;Rt!==null&&d!==null&&jm(d,Rt.memoizedState.deps)?y.memoizedState=Cl(i,v,l,d):(Ke.flags|=r,y.memoizedState=Cl(1|i,v,l,d))}function Yx(r,i){jd(8390656,8,r,i)}function Dm(r,i){Ed(2048,8,r,i)}function hA(r){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=wd(),Ke.updateQueue=i,i.events=[r];else{var l=i.events;l===null?i.events=[r]:l.push(r)}}function Xx(r){var i=hn().memoizedState;return hA({ref:i,nextImpl:r}),function(){if((jt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Wx(r,i){return Ed(4,2,r,i)}function Jx(r,i){return Ed(4,4,r,i)}function e0(r,i){if(typeof i=="function"){r=r();var l=i(r);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function t0(r,i,l){l=l!=null?l.concat([r]):null,Ed(4,4,e0.bind(null,i,r),l)}function Mm(){}function n0(r,i){var l=hn();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&jm(i,d[1])?d[0]:(l.memoizedState=[r,i],r)}function r0(r,i){var l=hn();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&jm(i,d[1]))return d[0];if(d=r(),_s){At(!0);try{r()}finally{At(!1)}}return l.memoizedState=[d,i],d}function Im(r,i,l){return l===void 0||(qa&1073741824)!==0&&(ut&261930)===0?r.memoizedState=i:(r.memoizedState=l,r=aw(),Ke.lanes|=r,Ti|=r,l)}function a0(r,i,l,d){return _r(l,i)?l:kl.current!==null?(r=Im(r,l,d),_r(r,i)||(bn=!0),r):(qa&42)===0||(qa&1073741824)!==0&&(ut&261930)===0?(bn=!0,r.memoizedState=l):(r=aw(),Ke.lanes|=r,Ti|=r,i)}function i0(r,i,l,d,y){var v=re.p;re.p=v!==0&&8>v?v:8;var S=H.T,A={};H.T=A,Um(r,!1,i,l);try{var q=y(),J=H.S;if(J!==null&&J(A,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var oe=oA(q,d);cu(r,i,oe,Dr(r))}else cu(r,i,d,Dr(r))}catch(fe){cu(r,i,{then:function(){},status:"rejected",reason:fe},Dr())}finally{re.p=v,S!==null&&A.types!==null&&(S.types=A.types),H.T=S}}function mA(){}function Lm(r,i,l,d){if(r.tag!==5)throw Error(a(476));var y=s0(r).queue;i0(r,y,i,xe,l===null?mA:function(){return l0(r),l(d)})}function s0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:xe},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:l},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function l0(r){var i=s0(r);i.next===null&&(i=r.alternate.memoizedState),cu(r,i.next.queue,{},Dr())}function Pm(){return Bn(Nu)}function o0(){return hn().memoizedState}function u0(){return hn().memoizedState}function pA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var l=Dr();r=ki(l);var d=ji(i,r,l);d!==null&&(gr(d,i,l),iu(d,i,l)),i={cache:hm()},r.payload=i;return}i=i.return}}function gA(r,i,l){var d=Dr();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Cd(r)?d0(i,l):(l=nm(r,i,l,d),l!==null&&(gr(l,r,d),f0(l,i,d)))}function c0(r,i,l){var d=Dr();cu(r,i,l,d)}function cu(r,i,l,d){var y={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Cd(r))d0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,A=v(S,l);if(y.hasEagerState=!0,y.eagerState=A,_r(A,S))return sd(r,i,y,0),Dt===null&&id(),!1}catch{}finally{}if(l=nm(r,i,y,d),l!==null)return gr(l,r,d),f0(l,i,d),!0}return!1}function Um(r,i,l,d){if(d={lane:2,revertLane:yp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Cd(r)){if(i)throw Error(a(479))}else i=nm(r,l,d,2),i!==null&&gr(i,r,2)}function Cd(r){var i=r.alternate;return r===Ke||i!==null&&i===Ke}function d0(r,i){jl=bd=!0;var l=r.pending;l===null?i.next=i:(i.next=l.next,l.next=i),r.pending=i}function f0(r,i,l){if((l&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,ps(r,l)}}var du={readContext:Bn,use:Sd,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};du.useEffectEvent=tn;var h0={readContext:Bn,use:Sd,useCallback:function(r,i){return rr().memoizedState=[r,i===void 0?null:i],r},useContext:Bn,useEffect:Yx,useImperativeHandle:function(r,i,l){l=l!=null?l.concat([r]):null,jd(4194308,4,e0.bind(null,i,r),l)},useLayoutEffect:function(r,i){return jd(4194308,4,r,i)},useInsertionEffect:function(r,i){jd(4,2,r,i)},useMemo:function(r,i){var l=rr();i=i===void 0?null:i;var d=r();if(_s){At(!0);try{r()}finally{At(!1)}}return l.memoizedState=[d,i],d},useReducer:function(r,i,l){var d=rr();if(l!==void 0){var y=l(i);if(_s){At(!0);try{l(i)}finally{At(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=gA.bind(null,Ke,r),[d.memoizedState,r]},useRef:function(r){var i=rr();return r={current:r},i.memoizedState=r},useState:function(r){r=Om(r);var i=r.queue,l=c0.bind(null,Ke,i);return i.dispatch=l,[r.memoizedState,l]},useDebugValue:Mm,useDeferredValue:function(r,i){var l=rr();return Im(l,r,i)},useTransition:function(){var r=Om(!1);return r=i0.bind(null,Ke,r.queue,!0,!1),rr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,l){var d=Ke,y=rr();if(ft){if(l===void 0)throw Error(a(407));l=l()}else{if(l=i(),Dt===null)throw Error(a(349));(ut&127)!==0||Dx(d,i,l)}y.memoizedState=l;var v={value:l,getSnapshot:i};return y.queue=v,Yx(Ix.bind(null,d,v,r),[r]),d.flags|=2048,Cl(9,{destroy:void 0},Mx.bind(null,d,v,l,i),null),l},useId:function(){var r=rr(),i=Dt.identifierPrefix;if(ft){var l=ka,d=Sa;l=(d&~(1<<32-rt(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=xd++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=uA++,i="_"+i+"r_"+l.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Pm,useFormState:Zx,useActionState:Zx,useOptimistic:function(r){var i=rr();i.memoizedState=i.baseState=r;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Um.bind(null,Ke,!0,l),l.dispatch=i,[r,i]},useMemoCache:Tm,useCacheRefresh:function(){return rr().memoizedState=pA.bind(null,Ke)},useEffectEvent:function(r){var i=rr(),l={impl:r};return i.memoizedState=l,function(){if((jt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},Bm={readContext:Bn,use:Sd,useCallback:n0,useContext:Bn,useEffect:Dm,useImperativeHandle:t0,useInsertionEffect:Wx,useLayoutEffect:Jx,useMemo:r0,useReducer:kd,useRef:Kx,useState:function(){return kd(Ha)},useDebugValue:Mm,useDeferredValue:function(r,i){var l=hn();return a0(l,Rt.memoizedState,r,i)},useTransition:function(){var r=kd(Ha)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:uu(r),i]},useSyncExternalStore:zx,useId:o0,useHostTransitionStatus:Pm,useFormState:Gx,useActionState:Gx,useOptimistic:function(r,i){var l=hn();return Ux(l,Rt,r,i)},useMemoCache:Tm,useCacheRefresh:u0};Bm.useEffectEvent=Xx;var m0={readContext:Bn,use:Sd,useCallback:n0,useContext:Bn,useEffect:Dm,useImperativeHandle:t0,useInsertionEffect:Wx,useLayoutEffect:Jx,useMemo:r0,useReducer:Rm,useRef:Kx,useState:function(){return Rm(Ha)},useDebugValue:Mm,useDeferredValue:function(r,i){var l=hn();return Rt===null?Im(l,r,i):a0(l,Rt.memoizedState,r,i)},useTransition:function(){var r=Rm(Ha)[0],i=hn().memoizedState;return[typeof r=="boolean"?r:uu(r),i]},useSyncExternalStore:zx,useId:o0,useHostTransitionStatus:Pm,useFormState:Qx,useActionState:Qx,useOptimistic:function(r,i){var l=hn();return Rt!==null?Ux(l,Rt,r,i):(l.baseState=r,[r,l.queue.dispatch])},useMemoCache:Tm,useCacheRefresh:u0};m0.useEffectEvent=Xx;function Fm(r,i,l,d){i=r.memoizedState,l=l(d,i),l=l==null?i:p({},i,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var $m={enqueueSetState:function(r,i,l){r=r._reactInternals;var d=Dr(),y=ki(d);y.payload=i,l!=null&&(y.callback=l),i=ji(r,y,d),i!==null&&(gr(i,r,d),iu(i,r,d))},enqueueReplaceState:function(r,i,l){r=r._reactInternals;var d=Dr(),y=ki(d);y.tag=1,y.payload=i,l!=null&&(y.callback=l),i=ji(r,y,d),i!==null&&(gr(i,r,d),iu(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var l=Dr(),d=ki(l);d.tag=2,i!=null&&(d.callback=i),i=ji(r,d,l),i!==null&&(gr(i,r,l),iu(i,r,l))}};function p0(r,i,l,d,y,v,S){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!Xo(l,d)||!Xo(y,v):!0}function g0(r,i,l,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==r&&$m.enqueueReplaceState(i,i.state,null)}function Ts(r,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(r=r.defaultProps){l===i&&(l=p({},l));for(var y in r)l[y]===void 0&&(l[y]=r[y])}return l}function y0(r){ad(r)}function v0(r){console.error(r)}function b0(r){ad(r)}function Nd(r,i){try{var l=r.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function x0(r,i,l){try{var d=r.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function qm(r,i,l){return l=ki(l),l.tag=3,l.payload={element:null},l.callback=function(){Nd(r,i)},l}function w0(r){return r=ki(r),r.tag=3,r}function S0(r,i,l,d){var y=l.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){x0(i,l,d)}}var S=l.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(r.callback=function(){x0(i,l,d),typeof y!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function yA(r,i,l,d,y){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&vl(i,l,y,!0),l=Ar.current,l!==null){switch(l.tag){case 31:case 13:return Kr===null?Ud():l.alternate===null&&nn===0&&(nn=3),l.flags&=-257,l.flags|=65536,l.lanes=y,d===md?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),mp(r,d,y)),!1;case 22:return l.flags|=65536,d===md?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),mp(r,d,y)),!1}throw Error(a(435,l.tag))}return mp(r,d,y),Ud(),!1}if(ft)return i=Ar.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==om&&(r=Error(a(422),{cause:d}),eu(Zr(r,l)))):(d!==om&&(i=Error(a(423),{cause:d}),eu(Zr(i,l))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Zr(d,l),y=qm(r.stateNode,d,y),bm(r,y),nn!==4&&(nn=2)),!1;var v=Error(a(520),{cause:d});if(v=Zr(v,l),bu===null?bu=[v]:bu.push(v),nn!==4&&(nn=2),i===null)return!0;d=Zr(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,r=y&-y,l.lanes|=r,r=qm(l.stateNode,d,r),bm(l,r),!1;case 1:if(i=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ai===null||!Ai.has(v))))return l.flags|=65536,y&=-y,l.lanes|=y,y=w0(y),S0(y,r,l,d),bm(l,y),!1}l=l.return}while(l!==null);return!1}var Hm=Error(a(461)),bn=!1;function Fn(r,i,l,d){i.child=r===null?Cx(i,null,l,d):Ns(i,r.child,l,d)}function k0(r,i,l,d,y){l=l.render;var v=i.ref;if("ref"in d){var S={};for(var A in d)A!=="ref"&&(S[A]=d[A])}else S=d;return ks(i),d=Em(r,i,l,S,v,y),A=Cm(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(ft&&A&&sm(i),i.flags|=1,Fn(r,i,d,y),i.child)}function j0(r,i,l,d,y){if(r===null){var v=l.type;return typeof v=="function"&&!rm(v)&&v.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=v,E0(r,i,v,d,y)):(r=od(l.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!Wm(r,y)){var S=v.memoizedProps;if(l=l.compare,l=l!==null?l:Xo,l(S,d)&&r.ref===i.ref)return Za(r,i,y)}return i.flags|=1,r=Ua(v,d),r.ref=i.ref,r.return=i,i.child=r}function E0(r,i,l,d,y){if(r!==null){var v=r.memoizedProps;if(Xo(v,d)&&r.ref===i.ref)if(bn=!1,i.pendingProps=d=v,Wm(r,y))(r.flags&131072)!==0&&(bn=!0);else return i.lanes=r.lanes,Za(r,i,y)}return Zm(r,i,l,d,y)}function C0(r,i,l,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|l:l,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 N0(r,i,v,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&fd(i,v!==null?v.cachePool:null),v!==null?Tx(i,v):wm(),Ax(i);else return d=i.lanes=536870912,N0(r,i,v!==null?v.baseLanes|l:l,l,d)}else v!==null?(fd(i,v.cachePool),Tx(i,v),Ci(),i.memoizedState=null):(r!==null&&fd(i,null),wm(),Ci());return Fn(r,i,y,l),i.child}function fu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function N0(r,i,l,d,y){var v=pm();return v=v===null?null:{parent:yn._currentValue,pool:v},i.memoizedState={baseLanes:l,cachePool:v},r!==null&&fd(i,null),wm(),Ax(i),r!==null&&vl(r,i,d,!0),i.childLanes=y,null}function _d(r,i){return i=Ad({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function _0(r,i,l){return Ns(i,r.child,null,l),r=_d(i,i.pendingProps),r.flags|=2,Rr(i),i.memoizedState=null,r}function vA(r,i,l){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ft){if(d.mode==="hidden")return r=_d(i,d),i.lanes=536870912,fu(null,r);if(km(i),(r=Bt)?(r=Bw(r,Qr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},l=dx(r),l.return=i,i.child=l,Un=i,Bt=null)):r=null,r===null)throw xi(i);return i.lanes=536870912,null}return _d(i,d)}var v=r.memoizedState;if(v!==null){var S=v.dehydrated;if(km(i),y)if(i.flags&256)i.flags&=-257,i=_0(r,i,l);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(bn||vl(r,i,l,!1),y=(l&r.childLanes)!==0,bn||y){if(d=Dt,d!==null&&(S=Zc(d,l),S!==0&&S!==v.retryLane))throw v.retryLane=S,bs(r,S),gr(d,r,S),Hm;Ud(),i=_0(r,i,l)}else r=v.treeContext,Bt=Yr(S.nextSibling),Un=i,ft=!0,bi=null,Qr=!1,r!==null&&mx(i,r),i=_d(i,d),i.flags|=4096;return i}return r=Ua(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Td(r,i){var l=i.ref;if(l===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(r===null||r.ref!==l)&&(i.flags|=4194816)}}function Zm(r,i,l,d,y){return ks(i),l=Em(r,i,l,d,void 0,y),d=Cm(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(ft&&d&&sm(i),i.flags|=1,Fn(r,i,l,y),i.child)}function T0(r,i,l,d,y,v){return ks(i),i.updateQueue=null,l=Ox(i,d,l,y),Rx(r),d=Cm(),r!==null&&!bn?(Nm(r,i,v),Za(r,i,v)):(ft&&d&&sm(i),i.flags|=1,Fn(r,i,l,v),i.child)}function A0(r,i,l,d,y){if(ks(i),i.stateNode===null){var v=ml,S=l.contextType;typeof S=="object"&&S!==null&&(v=Bn(S)),v=new l(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=$m,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},ym(i),S=l.contextType,v.context=typeof S=="object"&&S!==null?Bn(S):ml,v.state=i.memoizedState,S=l.getDerivedStateFromProps,typeof S=="function"&&(Fm(i,l,S,d),v.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&$m.enqueueReplaceState(v,v.state,null),lu(i,d,v,y),su(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,q=Ts(l,A);v.props=q;var J=v.context,oe=l.contextType;S=ml,typeof oe=="object"&&oe!==null&&(S=Bn(oe));var fe=l.getDerivedStateFromProps;oe=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||J!==S)&&g0(i,v,d,S),Si=!1;var te=i.memoizedState;v.state=te,lu(i,d,v,y),su(),J=i.memoizedState,A||te!==J||Si?(typeof fe=="function"&&(Fm(i,l,fe,d),J=i.memoizedState),(q=Si||p0(i,l,q,d,te,J,S))?(oe||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=J),v.props=d,v.state=J,v.context=S,d=q):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,vm(r,i),S=i.memoizedProps,oe=Ts(l,S),v.props=oe,fe=i.pendingProps,te=v.context,J=l.contextType,q=ml,typeof J=="object"&&J!==null&&(q=Bn(J)),A=l.getDerivedStateFromProps,(J=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==fe||te!==q)&&g0(i,v,d,q),Si=!1,te=i.memoizedState,v.state=te,lu(i,d,v,y),su();var ie=i.memoizedState;S!==fe||te!==ie||Si||r!==null&&r.dependencies!==null&&cd(r.dependencies)?(typeof A=="function"&&(Fm(i,l,A,d),ie=i.memoizedState),(oe=Si||p0(i,l,oe,d,te,ie,q)||r!==null&&r.dependencies!==null&&cd(r.dependencies))?(J||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,ie,q),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,ie,q)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&te===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&te===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ie),v.props=d,v.state=ie,v.context=q,d=oe):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&te===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&te===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Td(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Ns(i,r.child,null,y),i.child=Ns(i,null,l,y)):Fn(r,i,l,y),i.memoizedState=v.state,r=i.child):r=Za(r,i,y),r}function R0(r,i,l,d){return ws(),i.flags|=256,Fn(r,i,l,d),i.child}var Gm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vm(r){return{baseLanes:r,cachePool:xx()}}function Qm(r,i,l){return r=r!==null?r.childLanes&~l:0,i&&(r|=zr),r}function O0(r,i,l){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=r!==null&&r.memoizedState===null?!1:(fn.current&2)!==0),S&&(y=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,r===null){if(ft){if(y?Ei(i):Ci(),(r=Bt)?(r=Bw(r,Qr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},l=dx(r),l.return=i,i.child=l,Un=i,Bt=null)):r=null,r===null)throw xi(i);return Ap(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(Ci(),y=i.mode,A=Ad({mode:"hidden",children:A},y),d=xs(d,y,l,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=Vm(l),d.childLanes=Qm(r,S,l),i.memoizedState=Gm,fu(null,d)):(Ei(i),Km(i,A))}var q=r.memoizedState;if(q!==null&&(A=q.dehydrated,A!==null)){if(v)i.flags&256?(Ei(i),i.flags&=-257,i=Ym(r,i,l)):i.memoizedState!==null?(Ci(),i.child=r.child,i.flags|=128,i=null):(Ci(),A=d.fallback,y=i.mode,d=Ad({mode:"visible",children:d.children},y),A=xs(A,y,l,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,Ns(i,r.child,null,l),d=i.child,d.memoizedState=Vm(l),d.childLanes=Qm(r,S,l),i.memoizedState=Gm,i=fu(null,d));else if(Ei(i),Ap(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var J=S.dgst;S=J,d=Error(a(419)),d.stack="",d.digest=S,eu({value:d,source:null,stack:null}),i=Ym(r,i,l)}else if(bn||vl(r,i,l,!1),S=(l&r.childLanes)!==0,bn||S){if(S=Dt,S!==null&&(d=Zc(S,l),d!==0&&d!==q.retryLane))throw q.retryLane=d,bs(r,d),gr(S,r,d),Hm;Tp(A)||Ud(),i=Ym(r,i,l)}else Tp(A)?(i.flags|=192,i.child=r.child,i=null):(r=q.treeContext,Bt=Yr(A.nextSibling),Un=i,ft=!0,bi=null,Qr=!1,r!==null&&mx(i,r),i=Km(i,d.children),i.flags|=4096);return i}return y?(Ci(),A=d.fallback,y=i.mode,q=r.child,J=q.sibling,d=Ua(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&65011712,J!==null?A=Ua(J,A):(A=xs(A,y,l,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,fu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=Vm(l):(y=A.cachePool,y!==null?(q=yn._currentValue,y=y.parent!==q?{parent:q,pool:q}:y):y=xx(),A={baseLanes:A.baseLanes|l,cachePool:y}),d.memoizedState=A,d.childLanes=Qm(r,S,l),i.memoizedState=Gm,fu(r.child,d)):(Ei(i),l=r.child,r=l.sibling,l=Ua(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,r!==null&&(S=i.deletions,S===null?(i.deletions=[r],i.flags|=16):S.push(r)),i.child=l,i.memoizedState=null,l)}function Km(r,i){return i=Ad({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Ad(r,i){return r=Tr(22,r,null,i),r.lanes=0,r}function Ym(r,i,l){return Ns(i,r.child,null,l),r=Km(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function z0(r,i,l){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),dm(r.return,i,l)}function Xm(r,i,l,d,y,v){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:y,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=l,S.tailMode=y,S.treeForkCount=v)}function D0(r,i,l){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var S=fn.current,A=(S&2)!==0;if(A?(S=S&1|2,i.flags|=128):S&=1,_(fn,S),Fn(r,i,d,l),d=ft?Jo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&z0(r,l,i);else if(r.tag===19)z0(r,l,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(l=i.child,y=null;l!==null;)r=l.alternate,r!==null&&vd(r)===null&&(y=l),l=l.sibling;l=y,l===null?(y=i.child,i.child=null):(y=l.sibling,l.sibling=null),Xm(i,!1,y,l,v,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&vd(r)===null){i.child=y;break}r=y.sibling,y.sibling=l,l=y,y=r}Xm(i,!0,l,null,v,d);break;case"together":Xm(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Za(r,i,l){if(r!==null&&(i.dependencies=r.dependencies),Ti|=i.lanes,(l&i.childLanes)===0)if(r!==null){if(vl(r,i,l,!1),(l&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,l=Ua(r,r.pendingProps),i.child=l,l.return=i;r.sibling!==null;)r=r.sibling,l=l.sibling=Ua(r,r.pendingProps),l.return=i;l.sibling=null}return i.child}function Wm(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&cd(r)))}function bA(r,i,l){switch(i.tag){case 3:ve(i,i.stateNode.containerInfo),wi(i,yn,r.memoizedState.cache),ws();break;case 27:case 5:Ge(i);break;case 4:ve(i,i.stateNode.containerInfo);break;case 10:wi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,km(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ei(i),i.flags|=128,null):(l&i.child.childLanes)!==0?O0(r,i,l):(Ei(i),r=Za(r,i,l),r!==null?r.sibling:null);Ei(i);break;case 19:var y=(r.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(vl(r,i,l,!1),d=(l&i.childLanes)!==0),y){if(d)return D0(r,i,l);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),_(fn,fn.current),d)break;return null;case 22:return i.lanes=0,C0(r,i,l,i.pendingProps);case 24:wi(i,yn,r.memoizedState.cache)}return Za(r,i,l)}function M0(r,i,l){if(r!==null)if(r.memoizedProps!==i.pendingProps)bn=!0;else{if(!Wm(r,l)&&(i.flags&128)===0)return bn=!1,bA(r,i,l);bn=(r.flags&131072)!==0}else bn=!1,ft&&(i.flags&1048576)!==0&&hx(i,Jo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Es(i.elementType),i.type=r,typeof r=="function")rm(r)?(d=Ts(r,d),i.tag=1,i=A0(null,i,r,d,l)):(i.tag=0,i=Zm(null,i,r,d,l));else{if(r!=null){var y=r.$$typeof;if(y===D){i.tag=11,i=k0(null,i,r,d,l);break e}else if(y===B){i.tag=14,i=j0(null,i,r,d,l);break e}}throw i=Y(r)||r,Error(a(306,i,""))}}return i;case 0:return Zm(r,i,i.type,i.pendingProps,l);case 1:return d=i.type,y=Ts(d,i.pendingProps),A0(r,i,d,y,l);case 3:e:{if(ve(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,vm(r,i),lu(i,d,null,l);var S=i.memoizedState;if(d=S.cache,wi(i,yn,d),d!==v.cache&&fm(i,[yn],l,!0),su(),d=S.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=R0(r,i,d,l);break e}else if(d!==y){y=Zr(Error(a(424)),i),eu(y),i=R0(r,i,d,l);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=Yr(r.firstChild),Un=i,ft=!0,bi=null,Qr=!0,l=Cx(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ws(),d===y){i=Za(r,i,l);break e}Fn(r,i,d,l)}i=i.child}return i;case 26:return Td(r,i),r===null?(l=Gw(i.type,null,i.pendingProps,null))?i.memoizedState=l:ft||(l=i.type,r=i.pendingProps,d=Gd(ue.current).createElement(l),d[cn]=i,d[Zt]=r,$n(d,l,r),dt(d),i.stateNode=d):i.memoizedState=Gw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ge(i),r===null&&ft&&(d=i.stateNode=qw(i.type,i.pendingProps,ue.current),Un=i,Qr=!0,y=Bt,Di(i.type)?(Rp=y,Bt=Yr(d.firstChild)):Bt=y),Fn(r,i,i.pendingProps.children,l),Td(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ft&&((y=d=Bt)&&(d=KA(d,i.type,i.pendingProps,Qr),d!==null?(i.stateNode=d,Un=i,Bt=Yr(d.firstChild),Qr=!1,y=!0):y=!1),y||xi(i)),Ge(i),y=i.type,v=i.pendingProps,S=r!==null?r.memoizedProps:null,d=v.children,Cp(y,v)?d=null:S!==null&&Cp(y,S)&&(i.flags|=32),i.memoizedState!==null&&(y=Em(r,i,cA,null,null,l),Nu._currentValue=y),Td(r,i),Fn(r,i,d,l),i.child;case 6:return r===null&&ft&&((r=l=Bt)&&(l=YA(l,i.pendingProps,Qr),l!==null?(i.stateNode=l,Un=i,Bt=null,r=!0):r=!1),r||xi(i)),null;case 13:return O0(r,i,l);case 4:return ve(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ns(i,null,d,l):Fn(r,i,d,l),i.child;case 11:return k0(r,i,i.type,i.pendingProps,l);case 7:return Fn(r,i,i.pendingProps,l),i.child;case 8:return Fn(r,i,i.pendingProps.children,l),i.child;case 12:return Fn(r,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,wi(i,i.type,d.value),Fn(r,i,d.children,l),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,ks(i),y=Bn(y),d=d(y),i.flags|=1,Fn(r,i,d,l),i.child;case 14:return j0(r,i,i.type,i.pendingProps,l);case 15:return E0(r,i,i.type,i.pendingProps,l);case 19:return D0(r,i,l);case 31:return vA(r,i,l);case 22:return C0(r,i,l,i.pendingProps);case 24:return ks(i),d=Bn(yn),r===null?(y=pm(),y===null&&(y=Dt,v=hm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=l),y=v),i.memoizedState={parent:d,cache:y},ym(i),wi(i,yn,y)):((r.lanes&l)!==0&&(vm(r,i),lu(i,null,null,l),su()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),wi(i,yn,d)):(d=v.cache,wi(i,yn,d),d!==y.cache&&fm(i,[yn],l,!0))),Fn(r,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ga(r){r.flags|=4}function Jm(r,i,l,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(ow())r.flags|=8192;else throw Cs=md,gm}else r.flags&=-16777217}function I0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!Xw(i))if(ow())r.flags|=8192;else throw Cs=md,gm}function Rd(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?ke():536870912,r.lanes|=i,Al|=i)}function hu(r,i){if(!ft)switch(r.tailMode){case"hidden":i=r.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.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,l=0,d=0;if(i)for(var y=r.child;y!==null;)l|=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;)l|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=l,i}function xA(r,i,l){var d=i.pendingProps;switch(lm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(i),null;case 1:return Ft(i),null;case 3:return l=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),$a(yn),me(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(r===null||r.child===null)&&(yl(i)?Ga(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,um())),Ft(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ga(i),v!==null?(Ft(i),I0(i,v)):(Ft(i),Jm(i,y,null,d,l))):v?v!==r.memoizedState?(Ga(i),Ft(i),I0(i,v)):(Ft(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ga(i),Ft(i),Jm(i,y,r,d,l)),null;case 27:if(Be(i),l=ue.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}r=Z.current,yl(i)?px(i):(r=qw(y,d,l),i.stateNode=r,Ga(i))}return Ft(i),null;case 5:if(Be(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}if(v=Z.current,yl(i))px(i);else{var S=Gd(ue.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?S.createElement(y,{is:d.is}):S.createElement(y)}}v[cn]=i,v[Zt]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=v;e:switch($n(v,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ga(i)}}return Ft(i),Jm(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,l),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ga(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ue.current,yl(i)){if(r=i.stateNode,l=i.memoizedProps,d=null,y=Un,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[cn]=i,r=!!(r.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||Ow(r.nodeValue,l)),r||xi(i,!0)}else r=Gd(r).createTextNode(d),r[cn]=i,i.stateNode=r}return Ft(i),null;case 31:if(l=i.memoizedState,r===null||r.memoizedState!==null){if(d=yl(i),l!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[cn]=i}else ws(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),r=!1}else l=um(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=l),r=!0;if(!r)return i.flags&256?(Rr(i),i):(Rr(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=yl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[cn]=i}else ws(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),y=!1}else y=um(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Rr(i),i):(Rr(i),null)}return Rr(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,r=r!==null&&r.memoizedState!==null,l&&(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)),l!==r&&l&&(i.child.flags|=8192),Rd(i,i.updateQueue),Ft(i),null);case 4:return me(),r===null&&wp(i.stateNode.containerInfo),Ft(i),null;case 10:return $a(i.type),Ft(i),null;case 19:if(F(fn),d=i.memoizedState,d===null)return Ft(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)hu(d,!1);else{if(nn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=vd(r),v!==null){for(i.flags|=128,hu(d,!1),r=v.updateQueue,i.updateQueue=r,Rd(i,r),i.subtreeFlags=0,r=l,l=i.child;l!==null;)cx(l,r),l=l.sibling;return _(fn,fn.current&1|2),ft&&Ba(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&on()>Id&&(i.flags|=128,y=!0,hu(d,!1),i.lanes=4194304)}else{if(!y)if(r=vd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,Rd(i,r),hu(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ft)return Ft(i),null}else 2*on()-d.renderingStartTime>Id&&l!==536870912&&(i.flags|=128,y=!0,hu(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=on(),r.sibling=null,l=fn.current,_(fn,y?l&1|2:l&1),ft&&Ba(i,d.treeForkCount),r):(Ft(i),null);case 22:case 23:return Rr(i),Sm(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(Ft(i),i.subtreeFlags&6&&(i.flags|=8192)):Ft(i),l=i.updateQueue,l!==null&&Rd(i,l.retryQueue),l=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),r!==null&&F(js),null;case 24:return l=null,r!==null&&(l=r.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),$a(yn),Ft(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function wA(r,i){switch(lm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return $a(yn),me(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Be(i),null;case 31:if(i.memoizedState!==null){if(Rr(i),i.alternate===null)throw Error(a(340));ws()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Rr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));ws()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return F(fn),null;case 4:return me(),null;case 10:return $a(i.type),null;case 22:case 23:return Rr(i),Sm(),r!==null&&F(js),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return $a(yn),null;case 25:return null;default:return null}}function L0(r,i){switch(lm(i),i.tag){case 3:$a(yn),me();break;case 26:case 27:case 5:Be(i);break;case 4:me();break;case 31:i.memoizedState!==null&&Rr(i);break;case 13:Rr(i);break;case 19:F(fn);break;case 10:$a(i.type);break;case 22:case 23:Rr(i),Sm(),r!==null&&F(js);break;case 24:$a(yn)}}function mu(r,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var y=d.next;l=y;do{if((l.tag&r)===r){d=void 0;var v=l.create,S=l.inst;d=v(),S.destroy=d}l=l.next}while(l!==y)}}catch(A){Tt(i,i.return,A)}}function Ni(r,i,l){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 S=d.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,y=i;var q=l,J=A;try{J()}catch(oe){Tt(y,q,oe)}}}d=d.next}while(d!==v)}}catch(oe){Tt(i,i.return,oe)}}function P0(r){var i=r.updateQueue;if(i!==null){var l=r.stateNode;try{_x(i,l)}catch(d){Tt(r,r.return,d)}}}function U0(r,i,l){l.props=Ts(r.type,r.memoizedProps),l.state=r.memoizedState;try{l.componentWillUnmount()}catch(d){Tt(r,i,d)}}function pu(r,i){try{var l=r.ref;if(l!==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 l=="function"?r.refCleanup=l(d):l.current=d}}catch(y){Tt(r,i,y)}}function ja(r,i){var l=r.ref,d=r.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(y){Tt(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(y){Tt(r,i,y)}else l.current=null}function B0(r){var i=r.type,l=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(y){Tt(r,r.return,y)}}function ep(r,i,l){try{var d=r.stateNode;qA(d,r.type,l,i),d[Zt]=i}catch(y){Tt(r,r.return,y)}}function F0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Di(r.type)||r.tag===4}function tp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||F0(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Di(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function np(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(r,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(r),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=La));else if(d!==4&&(d===27&&Di(r.type)&&(l=r.stateNode,i=null),r=r.child,r!==null))for(np(r,i,l),r=r.sibling;r!==null;)np(r,i,l),r=r.sibling}function Od(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?l.insertBefore(r,i):l.appendChild(r);else if(d!==4&&(d===27&&Di(r.type)&&(l=r.stateNode),r=r.child,r!==null))for(Od(r,i,l),r=r.sibling;r!==null;)Od(r,i,l),r=r.sibling}function $0(r){var i=r.stateNode,l=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);$n(i,d,l),i[cn]=r,i[Zt]=l}catch(v){Tt(r,r.return,v)}}var Va=!1,xn=!1,rp=!1,q0=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function SA(r,i){if(r=r.containerInfo,jp=Jd,r=tx(r),Yh(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var S=0,A=-1,q=-1,J=0,oe=0,fe=r,te=null;t:for(;;){for(var ie;fe!==l||y!==0&&fe.nodeType!==3||(A=S+y),fe!==v||d!==0&&fe.nodeType!==3||(q=S+d),fe.nodeType===3&&(S+=fe.nodeValue.length),(ie=fe.firstChild)!==null;)te=fe,fe=ie;for(;;){if(fe===r)break t;if(te===l&&++J===y&&(A=S),te===v&&++oe===d&&(q=S),(ie=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=ie}l=A===-1||q===-1?null:{start:A,end:q}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ep={focusedElem:r,selectionRange:l},Jd=!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(l=0;l<r.length;l++)y=r[l],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,l=i,y=v.memoizedProps,v=v.memoizedState,d=l.stateNode;try{var _e=Ts(l.type,y);r=d.getSnapshotBeforeUpdate(_e,v),d.__reactInternalSnapshotBeforeUpdate=r}catch($e){Tt(l,l.return,$e)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,l=r.nodeType,l===9)_p(r);else if(l===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":_p(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,Dn=r;break}Dn=i.return}}function H0(r,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Ka(r,l),d&4&&mu(5,l);break;case 1:if(Ka(r,l),d&4)if(r=l.stateNode,i===null)try{r.componentDidMount()}catch(S){Tt(l,l.return,S)}else{var y=Ts(l.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(S){Tt(l,l.return,S)}}d&64&&P0(l),d&512&&pu(l,l.return);break;case 3:if(Ka(r,l),d&64&&(r=l.updateQueue,r!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{_x(r,i)}catch(S){Tt(l,l.return,S)}}break;case 27:i===null&&d&4&&$0(l);case 26:case 5:Ka(r,l),i===null&&d&4&&B0(l),d&512&&pu(l,l.return);break;case 12:Ka(r,l);break;case 31:Ka(r,l),d&4&&V0(r,l);break;case 13:Ka(r,l),d&4&&Q0(r,l),d&64&&(r=l.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(l=RA.bind(null,l),XA(r,l))));break;case 22:if(d=l.memoizedState!==null||Va,!d){i=i!==null&&i.memoizedState!==null||xn,y=Va;var v=xn;Va=d,(xn=i)&&!v?Ya(r,l,(l.subtreeFlags&8772)!==0):Ka(r,l),Va=y,xn=v}break;case 30:break;default:Ka(r,l)}}function Z0(r){var i=r.alternate;i!==null&&(r.alternate=null,Z0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Ie(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,fr=!1;function Qa(r,i,l){for(l=l.child;l!==null;)G0(r,i,l),l=l.sibling}function G0(r,i,l){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(qt,l)}catch{}switch(l.tag){case 26:xn||ja(l,i),Qa(r,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:xn||ja(l,i);var d=Gt,y=fr;Di(l.type)&&(Gt=l.stateNode,fr=!1),Qa(r,i,l),ju(l.stateNode),Gt=d,fr=y;break;case 5:xn||ja(l,i);case 6:if(d=Gt,y=fr,Gt=null,Qa(r,i,l),Gt=d,fr=y,Gt!==null)if(fr)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(l.stateNode)}catch(v){Tt(l,i,v)}else try{Gt.removeChild(l.stateNode)}catch(v){Tt(l,i,v)}break;case 18:Gt!==null&&(fr?(r=Gt,Pw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,l.stateNode),Pl(r)):Pw(Gt,l.stateNode));break;case 4:d=Gt,y=fr,Gt=l.stateNode.containerInfo,fr=!0,Qa(r,i,l),Gt=d,fr=y;break;case 0:case 11:case 14:case 15:Ni(2,l,i),xn||Ni(4,l,i),Qa(r,i,l);break;case 1:xn||(ja(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&U0(l,i,d)),Qa(r,i,l);break;case 21:Qa(r,i,l);break;case 22:xn=(d=xn)||l.memoizedState!==null,Qa(r,i,l),xn=d;break;default:Qa(r,i,l)}}function V0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Pl(r)}catch(l){Tt(i,i.return,l)}}}function Q0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Pl(r)}catch(l){Tt(i,i.return,l)}}function kA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new q0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new q0),i;default:throw Error(a(435,r.tag))}}function zd(r,i){var l=kA(r);i.forEach(function(d){if(!l.has(d)){l.add(d);var y=OA.bind(null,r,d);d.then(y,y)}})}function hr(r,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var y=l[d],v=r,S=i,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(Di(A.type)){Gt=A.stateNode,fr=!1;break e}break;case 5:Gt=A.stateNode,fr=!1;break e;case 3:case 4:Gt=A.stateNode.containerInfo,fr=!0;break e}A=A.return}if(Gt===null)throw Error(a(160));G0(v,S,y),Gt=null,fr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)K0(i,r),i=i.sibling}var ha=null;function K0(r,i){var l=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:hr(i,r),mr(r),d&4&&(Ni(3,r,r.return),mu(3,r),Ni(5,r,r.return));break;case 1:hr(i,r),mr(r),d&512&&(xn||l===null||ja(l,l.return)),d&64&&Va&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(l=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var y=ha;if(hr(i,r),mr(r),d&512&&(xn||l===null||ja(l,l.return)),d&4){var v=l!==null?l.memoizedState:null;if(d=r.memoizedState,l===null)if(d===null)if(r.stateNode===null){e:{d=r.type,l=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[gi]||v[cn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),$n(v,d,l),v[cn]=r,dt(v),d=v;break e;case"link":var S=Kw("link","href",y).get(d+(l.href||""));if(S){for(var A=0;A<S.length;A++)if(v=S[A],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){S.splice(A,1);break t}}v=y.createElement(d),$n(v,d,l),y.head.appendChild(v);break;case"meta":if(S=Kw("meta","content",y).get(d+(l.content||""))){for(A=0;A<S.length;A++)if(v=S[A],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){S.splice(A,1);break t}}v=y.createElement(d),$n(v,d,l),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[cn]=r,dt(v),d=v}r.stateNode=d}else Yw(y,r.type,r.stateNode);else r.stateNode=Qw(y,d,r.memoizedProps);else v!==d?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,d===null?Yw(y,r.type,r.stateNode):Qw(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ep(r,r.memoizedProps,l.memoizedProps)}break;case 27:hr(i,r),mr(r),d&512&&(xn||l===null||ja(l,l.return)),l!==null&&d&4&&ep(r,r.memoizedProps,l.memoizedProps);break;case 5:if(hr(i,r),mr(r),d&512&&(xn||l===null||ja(l,l.return)),r.flags&32){y=r.stateNode;try{ll(y,"")}catch(_e){Tt(r,r.return,_e)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ep(r,y,l!==null?l.memoizedProps:y)),d&1024&&(rp=!0);break;case 6:if(hr(i,r),mr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,l=r.stateNode;try{l.nodeValue=d}catch(_e){Tt(r,r.return,_e)}}break;case 3:if(Kd=null,y=ha,ha=Vd(i.containerInfo),hr(i,r),ha=y,mr(r),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Pl(i.containerInfo)}catch(_e){Tt(r,r.return,_e)}rp&&(rp=!1,Y0(r));break;case 4:d=ha,ha=Vd(r.stateNode.containerInfo),hr(i,r),mr(r),ha=d;break;case 12:hr(i,r),mr(r);break;case 31:hr(i,r),mr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,zd(r,d)));break;case 13:hr(i,r),mr(r),r.child.flags&8192&&r.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Md=on()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,zd(r,d)));break;case 22:y=r.memoizedState!==null;var q=l!==null&&l.memoizedState!==null,J=Va,oe=xn;if(Va=J||y,xn=oe||q,hr(i,r),xn=oe,Va=J,mr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(l===null||q||Va||xn||As(r)),l=null,i=r;;){if(i.tag===5||i.tag===26){if(l===null){q=l=i;try{if(v=q.stateNode,y)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=q.stateNode;var fe=q.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(_e){Tt(q,q.return,_e)}}}else if(i.tag===6){if(l===null){q=i;try{q.stateNode.nodeValue=y?"":q.memoizedProps}catch(_e){Tt(q,q.return,_e)}}}else if(i.tag===18){if(l===null){q=i;try{var ie=q.stateNode;y?Uw(ie,!0):Uw(q.stateNode,!1)}catch(_e){Tt(q,q.return,_e)}}}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;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,zd(r,l))));break;case 19:hr(i,r),mr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,zd(r,d)));break;case 30:break;case 21:break;default:hr(i,r),mr(r)}}function mr(r){var i=r.flags;if(i&2){try{for(var l,d=r.return;d!==null;){if(F0(d)){l=d;break}d=d.return}if(l==null)throw Error(a(160));switch(l.tag){case 27:var y=l.stateNode,v=tp(r);Od(r,v,y);break;case 5:var S=l.stateNode;l.flags&32&&(ll(S,""),l.flags&=-33);var A=tp(r);Od(r,A,S);break;case 3:case 4:var q=l.stateNode.containerInfo,J=tp(r);np(r,J,q);break;default:throw Error(a(161))}}catch(oe){Tt(r,r.return,oe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function Y0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;Y0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ka(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)H0(r,i.alternate,i),i=i.sibling}function As(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ni(4,i,i.return),As(i);break;case 1:ja(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&U0(i,i.return,l),As(i);break;case 27:ju(i.stateNode);case 26:case 5:ja(i,i.return),As(i);break;case 22:i.memoizedState===null&&As(i);break;case 30:As(i);break;default:As(i)}r=r.sibling}}function Ya(r,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:Ya(y,v,l),mu(4,v);break;case 1:if(Ya(y,v,l),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(J){Tt(d,d.return,J)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var q=y.shared.hiddenCallbacks;if(q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<q.length;y++)Nx(q[y],A)}catch(J){Tt(d,d.return,J)}}l&&S&64&&P0(v),pu(v,v.return);break;case 27:$0(v);case 26:case 5:Ya(y,v,l),l&&d===null&&S&4&&B0(v),pu(v,v.return);break;case 12:Ya(y,v,l);break;case 31:Ya(y,v,l),l&&S&4&&V0(y,v);break;case 13:Ya(y,v,l),l&&S&4&&Q0(y,v);break;case 22:v.memoizedState===null&&Ya(y,v,l),pu(v,v.return);break;case 30:break;default:Ya(y,v,l)}i=i.sibling}}function ap(r,i){var l=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==l&&(r!=null&&r.refCount++,l!=null&&tu(l))}function ip(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&tu(r))}function ma(r,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)X0(r,i,l,d),i=i.sibling}function X0(r,i,l,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:ma(r,i,l,d),y&2048&&mu(9,i);break;case 1:ma(r,i,l,d);break;case 3:ma(r,i,l,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&tu(r)));break;case 12:if(y&2048){ma(r,i,l,d),r=i.stateNode;try{var v=i.memoizedProps,S=v.id,A=v.onPostCommit;typeof A=="function"&&A(S,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(q){Tt(i,i.return,q)}}else ma(r,i,l,d);break;case 31:ma(r,i,l,d);break;case 13:ma(r,i,l,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?ma(r,i,l,d):gu(r,i):v._visibility&2?ma(r,i,l,d):(v._visibility|=2,Nl(r,i,l,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&ap(S,i);break;case 24:ma(r,i,l,d),y&2048&&ip(i.alternate,i);break;default:ma(r,i,l,d)}}function Nl(r,i,l,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,S=i,A=l,q=d,J=S.flags;switch(S.tag){case 0:case 11:case 15:Nl(v,S,A,q,y),mu(8,S);break;case 23:break;case 22:var oe=S.stateNode;S.memoizedState!==null?oe._visibility&2?Nl(v,S,A,q,y):gu(v,S):(oe._visibility|=2,Nl(v,S,A,q,y)),y&&J&2048&&ap(S.alternate,S);break;case 24:Nl(v,S,A,q,y),y&&J&2048&&ip(S.alternate,S);break;default:Nl(v,S,A,q,y)}i=i.sibling}}function gu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=r,d=i,y=d.flags;switch(d.tag){case 22:gu(l,d),y&2048&&ap(d.alternate,d);break;case 24:gu(l,d),y&2048&&ip(d.alternate,d);break;default:gu(l,d)}i=i.sibling}}var yu=8192;function _l(r,i,l){if(r.subtreeFlags&yu)for(r=r.child;r!==null;)W0(r,i,l),r=r.sibling}function W0(r,i,l){switch(r.tag){case 26:_l(r,i,l),r.flags&yu&&r.memoizedState!==null&&u2(l,ha,r.memoizedState,r.memoizedProps);break;case 5:_l(r,i,l);break;case 3:case 4:var d=ha;ha=Vd(r.stateNode.containerInfo),_l(r,i,l),ha=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=yu,yu=16777216,_l(r,i,l),yu=d):_l(r,i,l));break;default:_l(r,i,l)}}function J0(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 vu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Dn=d,tw(d,r)}J0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)ew(r),r=r.sibling}function ew(r){switch(r.tag){case 0:case 11:case 15:vu(r),r.flags&2048&&Ni(9,r,r.return);break;case 3:vu(r);break;case 12:vu(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Dd(r)):vu(r);break;default:vu(r)}}function Dd(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Dn=d,tw(d,r)}J0(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),Dd(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Dd(i));break;default:Dd(i)}r=r.sibling}}function tw(r,i){for(;Dn!==null;){var l=Dn;switch(l.tag){case 0:case 11:case 15:Ni(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:tu(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,Dn=d;else e:for(l=r;Dn!==null;){d=Dn;var y=d.sibling,v=d.return;if(Z0(d),d===l){Dn=null;break e}if(y!==null){y.return=v,Dn=y;break e}Dn=v}}}var jA={getCacheForType:function(r){var i=Bn(yn),l=i.data.get(r);return l===void 0&&(l=r(),i.data.set(r,l)),l},cacheSignal:function(){return Bn(yn).controller.signal}},EA=typeof WeakMap=="function"?WeakMap:Map,jt=0,Dt=null,at=null,ut=0,_t=0,Or=null,_i=!1,Tl=!1,sp=!1,Xa=0,nn=0,Ti=0,Rs=0,lp=0,zr=0,Al=0,bu=null,pr=null,op=!1,Md=0,nw=0,Id=1/0,Ld=null,Ai=null,Nn=0,Ri=null,Rl=null,Wa=0,up=0,cp=null,rw=null,xu=0,dp=null;function Dr(){return(jt&2)!==0&&ut!==0?ut&-ut:H.T!==null?yp():Uo()}function aw(){if(zr===0)if((ut&536870912)===0||ft){var r=ca;ca<<=1,(ca&3932160)===0&&(ca=262144),zr=r}else zr=536870912;return r=Ar.current,r!==null&&(r.flags|=32),zr}function gr(r,i,l){(r===Dt&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(Ol(r,0),Oi(r,ut,zr,!1)),pn(r,l),((jt&2)===0||r!==Dt)&&(r===Dt&&((jt&2)===0&&(Rs|=l),nn===4&&Oi(r,ut,zr,!1)),Ea(r))}function iw(r,i,l){if((jt&6)!==0)throw Error(a(327));var d=!l&&(i&127)===0&&(i&r.expiredLanes)===0||wa(r,i),y=d?_A(r,i):hp(r,i,!0),v=d;do{if(y===0){Tl&&!d&&Oi(r,i,0,!1);break}else{if(l=r.current.alternate,v&&!CA(l)){y=hp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var S=0;else S=r.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var A=r;y=bu;var q=A.current.memoizedState.isDehydrated;if(q&&(Ol(A,S).flags|=256),S=hp(A,S,!1),S!==2){if(sp&&!q){A.errorRecoveryDisabledLanes|=v,Rs|=v,y=4;break e}v=pr,pr=y,v!==null&&(pr===null?pr=v:pr.push.apply(pr,v))}y=S}if(v=!1,y!==2)continue}}if(y===1){Ol(r,0),Oi(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Oi(d,i,zr,!_i);break e;case 2:pr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Md+300-on(),10<y)){if(Oi(d,i,zr,!_i),Da(d,0,!0)!==0)break e;Wa=i,d.timeoutHandle=Iw(sw.bind(null,d,l,pr,Ld,op,i,zr,Rs,Al,_i,v,"Throttled",-0,0),y);break e}sw(d,l,pr,Ld,op,i,zr,Rs,Al,_i,v,null,-0,0)}}break}while(!0);Ea(r)}function sw(r,i,l,d,y,v,S,A,q,J,oe,fe,te,ie){if(r.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},W0(i,v,fe);var _e=(v&62914560)===v?Md-on():(v&4194048)===v?nw-on():0;if(_e=c2(fe,_e),_e!==null){Wa=v,r.cancelPendingCommit=_e(mw.bind(null,r,i,v,l,d,y,S,A,q,oe,fe,null,te,ie)),Oi(r,v,S,!J);return}}mw(r,i,v,l,d,y,S,A,q)}function CA(r){for(var i=r;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var y=l[d],v=y.getSnapshot;y=y.value;try{if(!_r(v(),y))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Oi(r,i,l,d){i&=~lp,i&=~Rs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-rt(y),S=1<<v;d[v]=-1,y&=~S}l!==0&&pi(r,l,i)}function Pd(){return(jt&6)===0?(wu(0),!1):!0}function fp(){if(at!==null){if(_t===0)var r=at.return;else r=at,Fa=Ss=null,_m(r),Sl=null,ru=0,r=at;for(;r!==null;)L0(r.alternate,r),r=r.return;at=null}}function Ol(r,i){var l=r.timeoutHandle;l!==-1&&(r.timeoutHandle=-1,GA(l)),l=r.cancelPendingCommit,l!==null&&(r.cancelPendingCommit=null,l()),Wa=0,fp(),Dt=r,at=l=Ua(r.current,null),ut=i,_t=0,Or=null,_i=!1,Tl=wa(r,i),sp=!1,Al=zr=lp=Rs=Ti=nn=0,pr=bu=null,op=!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-rt(d),v=1<<y;i|=r[y],d&=~v}return Xa=i,id(),l}function lw(r,i){Ke=null,H.H=du,i===wl||i===hd?(i=kx(),_t=3):i===gm?(i=kx(),_t=4):_t=i===Hm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Or=i,at===null&&(nn=1,Nd(r,Zr(i,r.current)))}function ow(){var r=Ar.current;return r===null?!0:(ut&4194048)===ut?Kr===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Kr:!1}function uw(){var r=H.H;return H.H=du,r===null?du:r}function cw(){var r=H.A;return H.A=jA,r}function Ud(){nn=4,_i||(ut&4194048)!==ut&&Ar.current!==null||(Tl=!0),(Ti&134217727)===0&&(Rs&134217727)===0||Dt===null||Oi(Dt,ut,zr,!1)}function hp(r,i,l){var d=jt;jt|=2;var y=uw(),v=cw();(Dt!==r||ut!==i)&&(Ld=null,Ol(r,i)),i=!1;var S=nn;e:do try{if(_t!==0&&at!==null){var A=at,q=Or;switch(_t){case 8:fp(),S=6;break e;case 3:case 2:case 9:case 6:Ar.current===null&&(i=!0);var J=_t;if(_t=0,Or=null,zl(r,A,q,J),l&&Tl){S=0;break e}break;default:J=_t,_t=0,Or=null,zl(r,A,q,J)}}NA(),S=nn;break}catch(oe){lw(r,oe)}while(!0);return i&&r.shellSuspendCounter++,Fa=Ss=null,jt=d,H.H=y,H.A=v,at===null&&(Dt=null,ut=0,id()),S}function NA(){for(;at!==null;)dw(at)}function _A(r,i){var l=jt;jt|=2;var d=uw(),y=cw();Dt!==r||ut!==i?(Ld=null,Id=on()+500,Ol(r,i)):Tl=wa(r,i);e:do try{if(_t!==0&&at!==null){i=at;var v=Or;t:switch(_t){case 1:_t=0,Or=null,zl(r,i,v,1);break;case 2:case 9:if(wx(v)){_t=0,Or=null,fw(i);break}i=function(){_t!==2&&_t!==9||Dt!==r||(_t=7),Ea(r)},v.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:wx(v)?(_t=0,Or=null,fw(i)):(_t=0,Or=null,zl(r,i,v,7));break;case 5:var S=null;switch(at.tag){case 26:S=at.memoizedState;case 5:case 27:var A=at;if(S?Xw(S):A.stateNode.complete){_t=0,Or=null;var q=A.sibling;if(q!==null)at=q;else{var J=A.return;J!==null?(at=J,Bd(J)):at=null}break t}}_t=0,Or=null,zl(r,i,v,5);break;case 6:_t=0,Or=null,zl(r,i,v,6);break;case 8:fp(),nn=6;break e;default:throw Error(a(462))}}TA();break}catch(oe){lw(r,oe)}while(!0);return Fa=Ss=null,H.H=d,H.A=y,jt=l,at!==null?0:(Dt=null,ut=0,id(),nn)}function TA(){for(;at!==null&&!hi();)dw(at)}function dw(r){var i=M0(r.alternate,r,Xa);r.memoizedProps=r.pendingProps,i===null?Bd(r):at=i}function fw(r){var i=r,l=i.alternate;switch(i.tag){case 15:case 0:i=T0(l,i,i.pendingProps,i.type,void 0,ut);break;case 11:i=T0(l,i,i.pendingProps,i.type.render,i.ref,ut);break;case 5:_m(i);default:L0(l,i),i=at=cx(i,Xa),i=M0(l,i,Xa)}r.memoizedProps=r.pendingProps,i===null?Bd(r):at=i}function zl(r,i,l,d){Fa=Ss=null,_m(i),Sl=null,ru=0;var y=i.return;try{if(yA(r,y,i,l,ut)){nn=1,Nd(r,Zr(l,r.current)),at=null;return}}catch(v){if(y!==null)throw at=y,v;nn=1,Nd(r,Zr(l,r.current)),at=null;return}i.flags&32768?(ft||d===1?r=!0:Tl||(ut&536870912)!==0?r=!1:(_i=r=!0,(d===2||d===9||d===3||d===6)&&(d=Ar.current,d!==null&&d.tag===13&&(d.flags|=16384))),hw(i,r)):Bd(i)}function Bd(r){var i=r;do{if((i.flags&32768)!==0){hw(i,_i);return}r=i.return;var l=xA(i.alternate,i,Xa);if(l!==null){at=l;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);nn===0&&(nn=5)}function hw(r,i){do{var l=wA(r.alternate,r);if(l!==null){l.flags&=32767,at=l;return}if(l=r.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=l}while(r!==null);nn=6,at=null}function mw(r,i,l,d,y,v,S,A,q){r.cancelPendingCommit=null;do Fd();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|=tm,Nr(r,l,v,S,A,q),r===Dt&&(at=Dt=null,ut=0),Rl=i,Ri=r,Wa=l,up=v,cp=y,rw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,zA(Ue,function(){return bw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=H.T,H.T=null,y=re.p,re.p=2,S=jt,jt|=4;try{SA(r,i,l)}finally{jt=S,re.p=y,H.T=d}}Nn=1,pw(),gw(),yw()}}function pw(){if(Nn===1){Nn=0;var r=Ri,i=Rl,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=H.T,H.T=null;var d=re.p;re.p=2;var y=jt;jt|=4;try{K0(i,r);var v=Ep,S=tx(r.containerInfo),A=v.focusedElem,q=v.selectionRange;if(S!==A&&A&&A.ownerDocument&&ex(A.ownerDocument.documentElement,A)){if(q!==null&&Yh(A)){var J=q.start,oe=q.end;if(oe===void 0&&(oe=J),"selectionStart"in A)A.selectionStart=J,A.selectionEnd=Math.min(oe,A.value.length);else{var fe=A.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var ie=te.getSelection(),_e=A.textContent.length,$e=Math.min(q.start,_e),zt=q.end===void 0?$e:Math.min(q.end,_e);!ie.extend&&$e>zt&&(S=zt,zt=$e,$e=S);var Q=Jb(A,$e),G=Jb(A,zt);if(Q&&G&&(ie.rangeCount!==1||ie.anchorNode!==Q.node||ie.anchorOffset!==Q.offset||ie.focusNode!==G.node||ie.focusOffset!==G.offset)){var W=fe.createRange();W.setStart(Q.node,Q.offset),ie.removeAllRanges(),$e>zt?(ie.addRange(W),ie.extend(G.node,G.offset)):(W.setEnd(G.node,G.offset),ie.addRange(W))}}}}for(fe=[],ie=A;ie=ie.parentNode;)ie.nodeType===1&&fe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var de=fe[A];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Jd=!!jp,Ep=jp=null}finally{jt=y,re.p=d,H.T=l}}r.current=i,Nn=2}}function gw(){if(Nn===2){Nn=0;var r=Ri,i=Rl,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=H.T,H.T=null;var d=re.p;re.p=2;var y=jt;jt|=4;try{H0(r,i.alternate,i)}finally{jt=y,re.p=d,H.T=l}}Nn=3}}function yw(){if(Nn===4||Nn===3){Nn=0,mi();var r=Ri,i=Rl,l=Wa,d=rw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Nn=5:(Nn=0,Rl=Ri=null,vw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Ai=null),da(l),i=i.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(qt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=H.T,y=re.p,re.p=2,H.T=null;try{for(var v=r.onRecoverableError,S=0;S<d.length;S++){var A=d[S];v(A.value,{componentStack:A.stack})}}finally{H.T=i,re.p=y}}(Wa&3)!==0&&Fd(),Ea(r),y=r.pendingLanes,(l&261930)!==0&&(y&42)!==0?r===dp?xu++:(xu=0,dp=r):xu=0,wu(0)}}function vw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,tu(i)))}function Fd(){return pw(),gw(),yw(),bw()}function bw(){if(Nn!==5)return!1;var r=Ri,i=up;up=0;var l=da(Wa),d=H.T,y=re.p;try{re.p=32>l?32:l,H.T=null,l=cp,cp=null;var v=Ri,S=Wa;if(Nn=0,Rl=Ri=null,Wa=0,(jt&6)!==0)throw Error(a(331));var A=jt;if(jt|=4,ew(v.current),X0(v,v.current,S,l),jt=A,wu(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(qt,v)}catch{}return!0}finally{re.p=y,H.T=d,vw(r,i)}}function xw(r,i,l){i=Zr(l,i),i=qm(r.stateNode,i,2),r=ji(r,i,2),r!==null&&(pn(r,2),Ea(r))}function Tt(r,i,l){if(r.tag===3)xw(r,r,l);else for(;i!==null;){if(i.tag===3){xw(i,r,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ai===null||!Ai.has(d))){r=Zr(l,r),l=w0(2),d=ji(i,l,2),d!==null&&(S0(l,d,i,r),pn(d,2),Ea(d));break}}i=i.return}}function mp(r,i,l){var d=r.pingCache;if(d===null){d=r.pingCache=new EA;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(l)||(sp=!0,y.add(l),r=AA.bind(null,r,i,l),i.then(r,r))}function AA(r,i,l){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&l,r.warmLanes&=~l,Dt===r&&(ut&l)===l&&(nn===4||nn===3&&(ut&62914560)===ut&&300>on()-Md?(jt&2)===0&&Ol(r,0):lp|=l,Al===ut&&(Al=0)),Ea(r)}function ww(r,i){i===0&&(i=ke()),r=bs(r,i),r!==null&&(pn(r,i),Ea(r))}function RA(r){var i=r.memoizedState,l=0;i!==null&&(l=i.retryLane),ww(r,l)}function OA(r,i){var l=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(l=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),ww(r,l)}function zA(r,i){return Cr(r,i)}var $d=null,Dl=null,pp=!1,qd=!1,gp=!1,zi=0;function Ea(r){r!==Dl&&r.next===null&&(Dl===null?$d=Dl=r:Dl=Dl.next=r),qd=!0,pp||(pp=!0,MA())}function wu(r,i){if(!gp&&qd){gp=!0;do for(var l=!1,d=$d;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var S=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-rt(42|r)+1)-1,v&=y&~(S&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,Ew(d,v))}else v=ut,v=Da(d,d===Dt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||wa(d,v)||(l=!0,Ew(d,v));d=d.next}while(l);gp=!1}}function DA(){Sw()}function Sw(){qd=pp=!1;var r=0;zi!==0&&ZA()&&(r=zi);for(var i=on(),l=null,d=$d;d!==null;){var y=d.next,v=kw(d,i);v===0?(d.next=null,l===null?$d=y:l.next=y,y===null&&(Dl=l)):(l=d,(r!==0||(v&3)!==0)&&(qd=!0)),d=y}Nn!==0&&Nn!==5||wu(r),zi!==0&&(zi=0)}function kw(r,i){for(var l=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var S=31-rt(v),A=1<<S,q=y[S];q===-1?((A&l)===0||(A&d)!==0)&&(y[S]=Ht(A,i)):q<=i&&(r.expiredLanes|=A),v&=~A}if(i=Dt,l=ut,l=Da(r,r===i?l:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,l===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Br(d),r.callbackNode=null,r.callbackPriority=0;if((l&3)===0||wa(r,l)){if(i=l&-l,i===r.callbackPriority)return i;switch(d!==null&&Br(d),da(l)){case 2:case 8:l=ge;break;case 32:l=Ue;break;case 268435456:l=nt;break;default:l=Ue}return d=jw.bind(null,r),l=Cr(l,d),r.callbackPriority=i,r.callbackNode=l,i}return d!==null&&d!==null&&Br(d),r.callbackPriority=2,r.callbackNode=null,2}function jw(r,i){if(Nn!==0&&Nn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var l=r.callbackNode;if(Fd()&&r.callbackNode!==l)return null;var d=ut;return d=Da(r,r===Dt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(iw(r,d,i),kw(r,on()),r.callbackNode!=null&&r.callbackNode===l?jw.bind(null,r):null)}function Ew(r,i){if(Fd())return null;iw(r,i,!0)}function MA(){VA(function(){(jt&6)!==0?Cr(le,DA):Sw()})}function yp(){if(zi===0){var r=bl;r===0&&(r=ua,ua<<=1,(ua&261888)===0&&(ua=256)),zi=r}return zi}function Cw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Xc(""+r)}function Nw(r,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,r.id&&l.setAttribute("form",r.id),i.parentNode.insertBefore(l,i),r=new FormData(r),l.parentNode.removeChild(l),r}function IA(r,i,l,d,y){if(i==="submit"&&l&&l.stateNode===y){var v=Cw((y[Zt]||null).action),S=d.submitter;S&&(i=(i=S[Zt]||null)?Cw(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var A=new td("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(zi!==0){var q=S?Nw(y,S):new FormData(y);Lm(l,{pending:!0,data:q,method:y.method,action:v},null,q)}}else typeof v=="function"&&(A.preventDefault(),q=S?Nw(y,S):new FormData(y),Lm(l,{pending:!0,data:q,method:y.method,action:v},v,q))},currentTarget:y}]})}}for(var vp=0;vp<em.length;vp++){var bp=em[vp],LA=bp.toLowerCase(),PA=bp[0].toUpperCase()+bp.slice(1);fa(LA,"on"+PA)}fa(ax,"onAnimationEnd"),fa(ix,"onAnimationIteration"),fa(sx,"onAnimationStart"),fa("dblclick","onDoubleClick"),fa("focusin","onFocus"),fa("focusout","onBlur"),fa(eA,"onTransitionRun"),fa(tA,"onTransitionStart"),fa(nA,"onTransitionCancel"),fa(lx,"onTransitionEnd"),zn("onMouseEnter",["mouseout","mouseover"]),zn("onMouseLeave",["mouseout","mouseover"]),zn("onPointerEnter",["pointerout","pointerover"]),zn("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 Su="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(" "),UA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Su));function _w(r,i){i=(i&4)!==0;for(var l=0;l<r.length;l++){var d=r[l],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var A=d[S],q=A.instance,J=A.currentTarget;if(A=A.listener,q!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=J;try{v(y)}catch(oe){ad(oe)}y.currentTarget=null,v=q}else for(S=0;S<d.length;S++){if(A=d[S],q=A.instance,J=A.currentTarget,A=A.listener,q!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=J;try{v(y)}catch(oe){ad(oe)}y.currentTarget=null,v=q}}}}function it(r,i){var l=i[il];l===void 0&&(l=i[il]=new Set);var d=r+"__bubble";l.has(d)||(Tw(i,r,2,!1),l.add(d))}function xp(r,i,l){var d=0;i&&(d|=4),Tw(l,r,d,i)}var Hd="_reactListening"+Math.random().toString(36).slice(2);function wp(r){if(!r[Hd]){r[Hd]=!0,Wt.forEach(function(l){l!=="selectionchange"&&(UA.has(l)||xp(l,!1,r),xp(l,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Hd]||(i[Hd]=!0,xp("selectionchange",!1,i))}}function Tw(r,i,l,d){switch(aS(i)){case 2:var y=h2;break;case 8:y=m2;break;default:y=Ip}l=y.bind(null,i,l,r),y=void 0,!Fh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,l,{capture:!0,passive:y}):r.addEventListener(i,l,!0):y!==void 0?r.addEventListener(i,l,{passive:y}):r.addEventListener(i,l,!1)}function Sp(r,i,l,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var A=d.stateNode.containerInfo;if(A===y)break;if(S===4)for(S=d.return;S!==null;){var q=S.tag;if((q===3||q===4)&&S.stateNode.containerInfo===y)return;S=S.return}for(;A!==null;){if(S=$(A),S===null)return;if(q=S.tag,q===5||q===6||q===26||q===27){d=v=S;continue e}A=A.parentNode}}d=d.return}Db(function(){var J=v,oe=Uh(l),fe=[];e:{var te=ox.get(r);if(te!==void 0){var ie=td,_e=r;switch(r){case"keypress":if(Jc(l)===0)break e;case"keydown":case"keyup":ie=OT;break;case"focusin":_e="focus",ie=Zh;break;case"focusout":_e="blur",ie=Zh;break;case"beforeblur":case"afterblur":ie=Zh;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Lb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=xT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=MT;break;case ax:case ix:case sx:ie=kT;break;case lx:ie=LT;break;case"scroll":case"scrollend":ie=vT;break;case"wheel":ie=UT;break;case"copy":case"cut":case"paste":ie=ET;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Ub;break;case"toggle":case"beforetoggle":ie=FT}var $e=(i&4)!==0,zt=!$e&&(r==="scroll"||r==="scrollend"),Q=$e?te!==null?te+"Capture":null:te;$e=[];for(var G=J,W;G!==null;){var de=G;if(W=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||W===null||Q===null||(de=Ho(G,Q),de!=null&&$e.push(ku(G,de,W))),zt)break;G=G.return}0<$e.length&&(te=new ie(te,_e,null,l,oe),fe.push({event:te,listeners:$e}))}}if((i&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",te&&l!==Ph&&(_e=l.relatedTarget||l.fromElement)&&($(_e)||_e[Ma]))break e;if((ie||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(_e=l.relatedTarget||l.toElement,ie=J,_e=_e?$(_e):null,_e!==null&&(zt=u(_e),$e=_e.tag,_e!==zt||$e!==5&&$e!==27&&$e!==6)&&(_e=null)):(ie=null,_e=J),ie!==_e)){if($e=Lb,de="onMouseLeave",Q="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&($e=Ub,de="onPointerLeave",Q="onPointerEnter",G="pointer"),zt=ie==null?te:Ce(ie),W=_e==null?te:Ce(_e),te=new $e(de,G+"leave",ie,l,oe),te.target=zt,te.relatedTarget=W,de=null,$(oe)===J&&($e=new $e(Q,G+"enter",_e,l,oe),$e.target=W,$e.relatedTarget=zt,de=$e),zt=de,ie&&_e)t:{for($e=BA,Q=ie,G=_e,W=0,de=Q;de;de=$e(de))W++;de=0;for(var Le=G;Le;Le=$e(Le))de++;for(;0<W-de;)Q=$e(Q),W--;for(;0<de-W;)G=$e(G),de--;for(;W--;){if(Q===G||G!==null&&Q===G.alternate){$e=Q;break t}Q=$e(Q),G=$e(G)}$e=null}else $e=null;ie!==null&&Aw(fe,te,ie,$e,!1),_e!==null&&zt!==null&&Aw(fe,zt,_e,$e,!0)}}e:{if(te=J?Ce(J):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var wt=Vb;else if(Zb(te))if(Qb)wt=XT;else{wt=KT;var Oe=QT}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&Lh(J.elementType)&&(wt=Vb):wt=YT;if(wt&&(wt=wt(r,J))){Gb(fe,wt,l,oe);break e}Oe&&Oe(r,te,J),r==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&Ih(te,"number",te.value)}switch(Oe=J?Ce(J):window,r){case"focusin":(Zb(Oe)||Oe.contentEditable==="true")&&(dl=Oe,Xh=J,Wo=null);break;case"focusout":Wo=Xh=dl=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,nx(fe,l,oe);break;case"selectionchange":if(JT)break;case"keydown":case"keyup":nx(fe,l,oe)}var Xe;if(Vh)e:{switch(r){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else cl?qb(r,l)&&(ct="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(ct="onCompositionStart");ct&&(Bb&&l.locale!=="ko"&&(cl||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&cl&&(Xe=Mb()):(yi=oe,$h="value"in yi?yi.value:yi.textContent,cl=!0)),Oe=Zd(J,ct),0<Oe.length&&(ct=new Pb(ct,r,null,l,oe),fe.push({event:ct,listeners:Oe}),Xe?ct.data=Xe:(Xe=Hb(l),Xe!==null&&(ct.data=Xe)))),(Xe=qT?HT(r,l):ZT(r,l))&&(ct=Zd(J,"onBeforeInput"),0<ct.length&&(Oe=new Pb("onBeforeInput","beforeinput",null,l,oe),fe.push({event:Oe,listeners:ct}),Oe.data=Xe)),IA(fe,r,J,l,oe)}_w(fe,i)})}function ku(r,i,l){return{instance:r,listener:i,currentTarget:l}}function Zd(r,i){for(var l=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=Ho(r,l),y!=null&&d.unshift(ku(r,y,v)),y=Ho(r,i),y!=null&&d.push(ku(r,y,v))),r.tag===3)return d;r=r.return}return[]}function BA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Aw(r,i,l,d,y){for(var v=i._reactName,S=[];l!==null&&l!==d;){var A=l,q=A.alternate,J=A.stateNode;if(A=A.tag,q!==null&&q===d)break;A!==5&&A!==26&&A!==27||J===null||(q=J,y?(J=Ho(l,v),J!=null&&S.unshift(ku(l,J,q))):y||(J=Ho(l,v),J!=null&&S.push(ku(l,J,q)))),l=l.return}S.length!==0&&r.push({event:i,listeners:S})}var FA=/\r\n?/g,$A=/\u0000|\uFFFD/g;function Rw(r){return(typeof r=="string"?r:""+r).replace(FA,`
49
- `).replace($A,"")}function Ow(r,i){return i=Rw(i),Rw(r)===i}function Ot(r,i,l,d,y,v){switch(l){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ll(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ll(r,""+d);break;case"className":Kc(r,"class",d);break;case"tabIndex":Kc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Kc(r,l,d);break;case"style":Ob(r,d,v);break;case"data":if(i!=="object"){Kc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){r.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Xc(""+d),r.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(i!=="input"&&Ot(r,i,"name",y.name,y,null),Ot(r,i,"formEncType",y.formEncType,y,null),Ot(r,i,"formMethod",y.formMethod,y,null),Ot(r,i,"formTarget",y.formTarget,y,null)):(Ot(r,i,"encType",y.encType,y,null),Ot(r,i,"method",y.method,y,null),Ot(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Xc(""+d),r.setAttribute(l,d);break;case"onClick":d!=null&&(r.onclick=La);break;case"onScroll":d!=null&&it("scroll",r);break;case"onScrollEnd":d!=null&&it("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=l}}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}l=Xc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""+d):r.removeAttribute(l);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(l,""):r.removeAttribute(l);break;case"capture":case"download":d===!0?r.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,d):r.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(l,d):r.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(l):r.setAttribute(l,d);break;case"popover":it("beforetoggle",r),it("toggle",r),Qc(r,"popover",d);break;case"xlinkActuate":Ia(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ia(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ia(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ia(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ia(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ia(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Qc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=gT.get(l)||l,Qc(r,l,d))}}function kp(r,i,l,d,y,v){switch(l){case"style":Ob(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=l}}break;case"children":typeof d=="string"?ll(r,d):(typeof d=="number"||typeof d=="bigint")&&ll(r,""+d);break;case"onScroll":d!=null&&it("scroll",r);break;case"onScrollEnd":d!=null&&it("scrollend",r);break;case"onClick":d!=null&&(r.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pn.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(y=l.endsWith("Capture"),i=l.slice(2,y?l.length-7:void 0),v=r[Zt]||null,v=v!=null?v[l]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(l in r?r[l]=null:r.hasAttribute(l)&&r.removeAttribute(l)),r.addEventListener(i,d,y);break e}l in r?r[l]=d:d===!0?r.setAttribute(l,""):Qc(r,l,d)}}}function $n(r,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",r),it("load",r);var d=!1,y=!1,v;for(v in l)if(l.hasOwnProperty(v)){var S=l[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,v,S,l,null)}}y&&Ot(r,i,"srcSet",l.srcSet,l,null),d&&Ot(r,i,"src",l.src,l,null);return;case"input":it("invalid",r);var A=v=S=y=null,q=null,J=null;for(d in l)if(l.hasOwnProperty(d)){var oe=l[d];if(oe!=null)switch(d){case"name":y=oe;break;case"type":S=oe;break;case"checked":q=oe;break;case"defaultChecked":J=oe;break;case"value":v=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:Ot(r,i,d,oe,l,null)}}_b(r,v,A,q,J,S,y,!1);return;case"select":it("invalid",r),d=S=v=null;for(y in l)if(l.hasOwnProperty(y)&&(A=l[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":S=A;break;case"multiple":d=A;default:Ot(r,i,y,A,l,null)}i=v,l=S,r.multiple=!!d,i!=null?sl(r,!!d,i,!1):l!=null&&sl(r,!!d,l,!0);return;case"textarea":it("invalid",r),v=y=d=null;for(S in l)if(l.hasOwnProperty(S)&&(A=l[S],A!=null))switch(S){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Ot(r,i,S,A,l,null)}Ab(r,d,y,v);return;case"option":for(q in l)if(l.hasOwnProperty(q)&&(d=l[q],d!=null))switch(q){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Ot(r,i,q,d,l,null)}return;case"dialog":it("beforetoggle",r),it("toggle",r),it("cancel",r),it("close",r);break;case"iframe":case"object":it("load",r);break;case"video":case"audio":for(d=0;d<Su.length;d++)it(Su[d],r);break;case"image":it("error",r),it("load",r);break;case"details":it("toggle",r);break;case"embed":case"source":case"link":it("error",r),it("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in l)if(l.hasOwnProperty(J)&&(d=l[J],d!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,J,d,l,null)}return;default:if(Lh(i)){for(oe in l)l.hasOwnProperty(oe)&&(d=l[oe],d!==void 0&&kp(r,i,oe,d,l,void 0));return}}for(A in l)l.hasOwnProperty(A)&&(d=l[A],d!=null&&Ot(r,i,A,d,l,null))}function qA(r,i,l,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,S=null,A=null,q=null,J=null,oe=null;for(ie in l){var fe=l[ie];if(l.hasOwnProperty(ie)&&fe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":q=fe;default:d.hasOwnProperty(ie)||Ot(r,i,ie,null,d,fe)}}for(var te in d){var ie=d[te];if(fe=l[te],d.hasOwnProperty(te)&&(ie!=null||fe!=null))switch(te){case"type":v=ie;break;case"name":y=ie;break;case"checked":J=ie;break;case"defaultChecked":oe=ie;break;case"value":S=ie;break;case"defaultValue":A=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,i));break;default:ie!==fe&&Ot(r,i,te,ie,d,fe)}}Mh(r,S,A,q,J,oe,v,y);return;case"select":ie=S=A=te=null;for(v in l)if(q=l[v],l.hasOwnProperty(v)&&q!=null)switch(v){case"value":break;case"multiple":ie=q;default:d.hasOwnProperty(v)||Ot(r,i,v,null,d,q)}for(y in d)if(v=d[y],q=l[y],d.hasOwnProperty(y)&&(v!=null||q!=null))switch(y){case"value":te=v;break;case"defaultValue":A=v;break;case"multiple":S=v;default:v!==q&&Ot(r,i,y,v,d,q)}i=A,l=S,d=ie,te!=null?sl(r,!!l,te,!1):!!d!=!!l&&(i!=null?sl(r,!!l,i,!0):sl(r,!!l,l?[]:"",!1));return;case"textarea":ie=te=null;for(A in l)if(y=l[A],l.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ot(r,i,A,null,d,y)}for(S in d)if(y=d[S],v=l[S],d.hasOwnProperty(S)&&(y!=null||v!=null))switch(S){case"value":te=y;break;case"defaultValue":ie=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Ot(r,i,S,y,d,v)}Tb(r,te,ie);return;case"option":for(var _e in l)if(te=l[_e],l.hasOwnProperty(_e)&&te!=null&&!d.hasOwnProperty(_e))switch(_e){case"selected":r.selected=!1;break;default:Ot(r,i,_e,null,d,te)}for(q in d)if(te=d[q],ie=l[q],d.hasOwnProperty(q)&&te!==ie&&(te!=null||ie!=null))switch(q){case"selected":r.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Ot(r,i,q,te,d,ie)}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 $e in l)te=l[$e],l.hasOwnProperty($e)&&te!=null&&!d.hasOwnProperty($e)&&Ot(r,i,$e,null,d,te);for(J in d)if(te=d[J],ie=l[J],d.hasOwnProperty(J)&&te!==ie&&(te!=null||ie!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,i));break;default:Ot(r,i,J,te,d,ie)}return;default:if(Lh(i)){for(var zt in l)te=l[zt],l.hasOwnProperty(zt)&&te!==void 0&&!d.hasOwnProperty(zt)&&kp(r,i,zt,void 0,d,te);for(oe in d)te=d[oe],ie=l[oe],!d.hasOwnProperty(oe)||te===ie||te===void 0&&ie===void 0||kp(r,i,oe,te,d,ie);return}}for(var Q in l)te=l[Q],l.hasOwnProperty(Q)&&te!=null&&!d.hasOwnProperty(Q)&&Ot(r,i,Q,null,d,te);for(fe in d)te=d[fe],ie=l[fe],!d.hasOwnProperty(fe)||te===ie||te==null&&ie==null||Ot(r,i,fe,te,d,ie)}function zw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function HA(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var y=l[d],v=y.transferSize,S=y.initiatorType,A=y.duration;if(v&&A&&zw(S)){for(S=0,A=y.responseEnd,d+=1;d<l.length;d++){var q=l[d],J=q.startTime;if(J>A)break;var oe=q.transferSize,fe=q.initiatorType;oe&&zw(fe)&&(q=q.responseEnd,S+=oe*(q<A?1:(A-J)/(q-J)))}if(--d,i+=8*(v+S)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var jp=null,Ep=null;function Gd(r){return r.nodeType===9?r:r.ownerDocument}function Dw(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 Mw(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 Cp(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Np=null;function ZA(){var r=window.event;return r&&r.type==="popstate"?r===Np?!1:(Np=r,!0):(Np=null,!1)}var Iw=typeof setTimeout=="function"?setTimeout:void 0,GA=typeof clearTimeout=="function"?clearTimeout:void 0,Lw=typeof Promise=="function"?Promise:void 0,VA=typeof queueMicrotask=="function"?queueMicrotask:typeof Lw<"u"?function(r){return Lw.resolve(null).then(r).catch(QA)}:Iw;function QA(r){setTimeout(function(){throw r})}function Di(r){return r==="head"}function Pw(r,i){var l=i,d=0;do{var y=l.nextSibling;if(r.removeChild(l),y&&y.nodeType===8)if(l=y.data,l==="/$"||l==="/&"){if(d===0){r.removeChild(y),Pl(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")ju(r.ownerDocument.documentElement);else if(l==="head"){l=r.ownerDocument.head,ju(l);for(var v=l.firstChild;v;){var S=v.nextSibling,A=v.nodeName;v[gi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=S}}else l==="body"&&ju(r.ownerDocument.body);l=y}while(l);Pl(i)}function Uw(r,i){var l=r;r=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(r===0)break;r--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||r++;l=d}while(l)}function _p(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":_p(l),Ie(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}r.removeChild(l)}}function KA(r,i,l,d){for(;r.nodeType===1;){var y=l;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[gi])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Yr(r.nextSibling),r===null)break}return null}function YA(r,i,l){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!l||(r=Yr(r.nextSibling),r===null))return null;return r}function Bw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Yr(r.nextSibling),r===null))return null;return r}function Tp(r){return r.data==="$?"||r.data==="$~"}function Ap(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function XA(r,i){var l=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Yr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Rp=null;function Fw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"||l==="/&"){if(i===0)return Yr(r.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}r=r.nextSibling}return null}function $w(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return r;i--}else l!=="/$"&&l!=="/&"||i++}r=r.previousSibling}return null}function qw(r,i,l){switch(i=Gd(l),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 ju(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ie(r)}var Xr=new Map,Hw=new Set;function Vd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ja=re.d;re.d={f:WA,r:JA,D:e2,C:t2,L:n2,m:r2,X:i2,S:a2,M:s2};function WA(){var r=Ja.f(),i=Pd();return r||i}function JA(r){var i=he(r);i!==null&&i.tag===5&&i.type==="form"?l0(i):Ja.r(r)}var Ml=typeof document>"u"?null:document;function Zw(r,i,l){var d=Ml;if(d&&typeof i=="string"&&i){var y=qr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof l=="string"&&(y+='[crossorigin="'+l+'"]'),Hw.has(y)||(Hw.add(y),r={rel:r,crossOrigin:l,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),$n(i,"link",r),dt(i),d.head.appendChild(i)))}}function e2(r){Ja.D(r),Zw("dns-prefetch",r,null)}function t2(r,i){Ja.C(r,i),Zw("preconnect",r,i)}function n2(r,i,l){Ja.L(r,i,l);var d=Ml;if(d&&r&&i){var y='link[rel="preload"][as="'+qr(i)+'"]';i==="image"&&l&&l.imageSrcSet?(y+='[imagesrcset="'+qr(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(y+='[imagesizes="'+qr(l.imageSizes)+'"]')):y+='[href="'+qr(r)+'"]';var v=y;switch(i){case"style":v=Il(r);break;case"script":v=Ll(r)}Xr.has(v)||(r=p({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:r,as:i},l),Xr.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(Eu(v))||i==="script"&&d.querySelector(Cu(v))||(i=d.createElement("link"),$n(i,"link",r),dt(i),d.head.appendChild(i)))}}function r2(r,i){Ja.m(r,i);var l=Ml;if(l&&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=Ll(r)}if(!Xr.has(v)&&(r=p({rel:"modulepreload",href:r},i),Xr.set(v,r),l.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Cu(v)))return}d=l.createElement("link"),$n(d,"link",r),dt(d),l.head.appendChild(d)}}}function a2(r,i,l){Ja.S(r,i,l);var d=Ml;if(d&&r){var y=xt(d).hoistableStyles,v=Il(r);i=i||"default";var S=y.get(v);if(!S){var A={loading:0,preload:null};if(S=d.querySelector(Eu(v)))A.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":i},l),(l=Xr.get(v))&&Op(r,l);var q=S=d.createElement("link");dt(q),$n(q,"link",r),q._p=new Promise(function(J,oe){q.onload=J,q.onerror=oe}),q.addEventListener("load",function(){A.loading|=1}),q.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Qd(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:A},y.set(v,S)}}}function i2(r,i){Ja.X(r,i);var l=Ml;if(l&&r){var d=xt(l).hoistableScripts,y=Ll(r),v=d.get(y);v||(v=l.querySelector(Cu(y)),v||(r=p({src:r,async:!0},i),(i=Xr.get(y))&&zp(r,i),v=l.createElement("script"),dt(v),$n(v,"link",r),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function s2(r,i){Ja.M(r,i);var l=Ml;if(l&&r){var d=xt(l).hoistableScripts,y=Ll(r),v=d.get(y);v||(v=l.querySelector(Cu(y)),v||(r=p({src:r,async:!0,type:"module"},i),(i=Xr.get(y))&&zp(r,i),v=l.createElement("script"),dt(v),$n(v,"link",r),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function Gw(r,i,l,d){var y=(y=ue.current)?Vd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=Il(l.href),l=xt(y).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){r=Il(l.href);var v=xt(y).hoistableStyles,S=v.get(r);if(S||(y=y.ownerDocument||y,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,S),(v=y.querySelector(Eu(r)))&&!v._p&&(S.instance=v,S.state.loading=5),Xr.has(r)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Xr.set(r,l),v||l2(y,r,l,S.state))),i&&d===null)throw Error(a(528,""));return S}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ll(l),l=xt(y).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Il(r){return'href="'+qr(r)+'"'}function Eu(r){return'link[rel="stylesheet"]['+r+"]"}function Vw(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function l2(r,i,l,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}),$n(i,"link",l),dt(i),r.head.appendChild(i))}function Ll(r){return'[src="'+qr(r)+'"]'}function Cu(r){return"script[async]"+r}function Qw(r,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+qr(l.href)+'"]');if(d)return i.instance=d,dt(d),d;var y=p({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),dt(d),$n(d,"style",y),Qd(d,l.precedence,r),i.instance=d;case"stylesheet":y=Il(l.href);var v=r.querySelector(Eu(y));if(v)return i.state.loading|=4,i.instance=v,dt(v),v;d=Vw(l),(y=Xr.get(y))&&Op(d,y),v=(r.ownerDocument||r).createElement("link"),dt(v);var S=v;return S._p=new Promise(function(A,q){S.onload=A,S.onerror=q}),$n(v,"link",d),i.state.loading|=4,Qd(v,l.precedence,r),i.instance=v;case"script":return v=Ll(l.src),(y=r.querySelector(Cu(v)))?(i.instance=y,dt(y),y):(d=l,(y=Xr.get(v))&&(d=p({},l),zp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),dt(y),$n(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,Qd(d,l.precedence,r));return i.instance}function Qd(r,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,S=0;S<d.length;S++){var A=d[S];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(r,i.firstChild))}function Op(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function zp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Kd=null;function Kw(r,i,l){if(Kd===null){var d=new Map,y=Kd=new Map;y.set(l,d)}else y=Kd,d=y.get(l),d||(d=new Map,y.set(l,d));if(d.has(r))return d;for(d.set(r,null),l=l.getElementsByTagName(r),y=0;y<l.length;y++){var v=l[y];if(!(v[gi]||v[cn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=r+S;var A=d.get(S);A?A.push(v):d.set(S,[v])}}return d}function Yw(r,i,l){r=r.ownerDocument||r,r.head.insertBefore(l,i==="title"?r.querySelector("head > title"):null)}function o2(r,i,l){if(l===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 Xw(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function u2(r,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var y=Il(d.href),v=i.querySelector(Eu(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Yd.bind(r),i.then(r,r)),l.state.loading|=4,l.instance=v,dt(v);return}v=i.ownerDocument||i,d=Vw(d),(y=Xr.get(y))&&Op(d,y),v=v.createElement("link"),dt(v);var S=v;S._p=new Promise(function(A,q){S.onload=A,S.onerror=q}),$n(v,"link",d),l.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(r.count++,l=Yd.bind(r),i.addEventListener("load",l),i.addEventListener("error",l))}}var Dp=0;function c2(r,i){return r.stylesheets&&r.count===0&&Wd(r,r.stylesheets),0<r.count||0<r.imgCount?function(l){var d=setTimeout(function(){if(r.stylesheets&&Wd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Dp===0&&(Dp=62500*HA());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Wd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Dp?50:800)+i);return r.unsuspend=l,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Yd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Xd=null;function Wd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Xd=new Map,i.forEach(d2,r),Xd=null,Yd.call(r))}function d2(r,i){if(!(i.state.loading&4)){var l=Xd.get(r);if(l)var d=l.get(null);else{l=new Map,Xd.set(r,l);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var S=y[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(l.set(S.dataset.precedence,S),d=S)}d&&l.set(null,d)}y=i.instance,S=y.getAttribute("data-precedence"),v=l.get(S)||d,v===d&&l.set(null,y),l.set(S,y),this.count++,d=Yd.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 Nu={$$typeof:O,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function f2(r,i,l,d,y,v,S,A,q){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=et(0),this.hiddenUpdates=et(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function Ww(r,i,l,d,y,v,S,A,q,J,oe,fe){return r=new f2(r,i,l,S,q,J,oe,fe,A),i=1,v===!0&&(i|=24),v=Tr(3,null,null,i),r.current=v,v.stateNode=r,i=hm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:l,cache:i},ym(v),r}function Jw(r){return r?(r=ml,r):ml}function eS(r,i,l,d,y,v){y=Jw(y),d.context===null?d.context=y:d.pendingContext=y,d=ki(i),d.payload={element:l},v=v===void 0?null:v,v!==null&&(d.callback=v),l=ji(r,d,i),l!==null&&(gr(l,r,i),iu(l,r,i))}function tS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<i?l:i}}function Mp(r,i){tS(r,i),(r=r.alternate)&&tS(r,i)}function nS(r){if(r.tag===13||r.tag===31){var i=bs(r,67108864);i!==null&&gr(i,r,67108864),Mp(r,67108864)}}function rS(r){if(r.tag===13||r.tag===31){var i=Dr();i=nr(i);var l=bs(r,i);l!==null&&gr(l,r,i),Mp(r,i)}}var Jd=!0;function h2(r,i,l,d){var y=H.T;H.T=null;var v=re.p;try{re.p=2,Ip(r,i,l,d)}finally{re.p=v,H.T=y}}function m2(r,i,l,d){var y=H.T;H.T=null;var v=re.p;try{re.p=8,Ip(r,i,l,d)}finally{re.p=v,H.T=y}}function Ip(r,i,l,d){if(Jd){var y=Lp(d);if(y===null)Sp(r,i,d,ef,l),iS(r,d);else if(g2(y,r,i,l,d))d.stopPropagation();else if(iS(r,d),i&4&&-1<p2.indexOf(r)){for(;y!==null;){var v=he(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Zn(v.pendingLanes);if(S!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var q=1<<31-rt(S);A.entanglements[1]|=q,S&=~q}Ea(v),(jt&6)===0&&(Id=on()+500,wu(0))}}break;case 31:case 13:A=bs(v,2),A!==null&&gr(A,v,2),Pd(),Mp(v,2)}if(v=Lp(d),v===null&&Sp(r,i,d,ef,l),v===y)break;y=v}y!==null&&d.stopPropagation()}else Sp(r,i,d,null,l)}}function Lp(r){return r=Uh(r),Pp(r)}var ef=null;function Pp(r){if(ef=null,r=$(r),r!==null){var i=u(r);if(i===null)r=null;else{var l=i.tag;if(l===13){if(r=c(i),r!==null)return r;r=null}else if(l===31){if(r=f(i),r!==null)return r;r=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return ef=r,null}function aS(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(oa()){case le:return 2;case ge:return 8;case Ue:case Ze:return 32;case nt:return 268435456;default:return 32}default:return 32}}var Up=!1,Mi=null,Ii=null,Li=null,_u=new Map,Tu=new Map,Pi=[],p2="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 iS(r,i){switch(r){case"focusin":case"focusout":Mi=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":_u.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tu.delete(i.pointerId)}}function Au(r,i,l,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=he(i),i!==null&&nS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function g2(r,i,l,d,y){switch(i){case"focusin":return Mi=Au(Mi,r,i,l,d,y),!0;case"dragenter":return Ii=Au(Ii,r,i,l,d,y),!0;case"mouseover":return Li=Au(Li,r,i,l,d,y),!0;case"pointerover":var v=y.pointerId;return _u.set(v,Au(_u.get(v)||null,r,i,l,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Tu.set(v,Au(Tu.get(v)||null,r,i,l,d,y)),!0}return!1}function sS(r){var i=$(r.target);if(i!==null){var l=u(i);if(l!==null){if(i=l.tag,i===13){if(i=c(l),i!==null){r.blockedOn=i,Bo(r.priority,function(){rS(l)});return}}else if(i===31){if(i=f(l),i!==null){r.blockedOn=i,Bo(r.priority,function(){rS(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function tf(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var l=Lp(r.nativeEvent);if(l===null){l=r.nativeEvent;var d=new l.constructor(l.type,l);Ph=d,l.target.dispatchEvent(d),Ph=null}else return i=he(l),i!==null&&nS(i),r.blockedOn=l,!1;i.shift()}return!0}function lS(r,i,l){tf(r)&&l.delete(i)}function y2(){Up=!1,Mi!==null&&tf(Mi)&&(Mi=null),Ii!==null&&tf(Ii)&&(Ii=null),Li!==null&&tf(Li)&&(Li=null),_u.forEach(lS),Tu.forEach(lS)}function nf(r,i){r.blockedOn===i&&(r.blockedOn=null,Up||(Up=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,y2)))}var rf=null;function oS(r){rf!==r&&(rf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){rf===r&&(rf=null);for(var i=0;i<r.length;i+=3){var l=r[i],d=r[i+1],y=r[i+2];if(typeof d!="function"){if(Pp(d||l)===null)continue;break}var v=he(l);v!==null&&(r.splice(i,3),i-=3,Lm(v,{pending:!0,data:y,method:l.method,action:d},d,y))}}))}function Pl(r){function i(q){return nf(q,r)}Mi!==null&&nf(Mi,r),Ii!==null&&nf(Ii,r),Li!==null&&nf(Li,r),_u.forEach(i),Tu.forEach(i);for(var l=0;l<Pi.length;l++){var d=Pi[l];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Pi.length&&(l=Pi[0],l.blockedOn===null);)sS(l),l.blockedOn===null&&Pi.shift();if(l=(r.ownerDocument||r).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var y=l[d],v=l[d+1],S=y[Zt]||null;if(typeof v=="function")S||oS(l);else if(S){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,S=v[Zt]||null)A=S.formAction;else if(Pp(y)!==null)continue}else A=S.action;typeof A=="function"?l[d+1]=A:(l.splice(d,3),d-=3),oS(l)}}}function uS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return y=S})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(l,20)}function l(){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(l,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Bp(r){this._internalRoot=r}af.prototype.render=Bp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var l=i.current,d=Dr();eS(l,d,r,i,null,null)},af.prototype.unmount=Bp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;eS(r.current,2,null,r,null,null),Pd(),i[Ma]=null}};function af(r){this._internalRoot=r}af.prototype.unstable_scheduleHydration=function(r){if(r){var i=Uo();r={blockedOn:null,target:r,priority:i};for(var l=0;l<Pi.length&&i!==0&&i<Pi[l].priority;l++);Pi.splice(l,0,r),l===0&&sS(r)}};var cS=t.version;if(cS!=="19.2.4")throw Error(a(527,cS,"19.2.4"));re.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var v2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sf.isDisabled&&sf.supportsFiber)try{qt=sf.inject(v2),Lt=sf}catch{}}return Ou.createRoot=function(r,i){if(!s(r))throw Error(a(299));var l=!1,d="",y=y0,v=v0,S=b0;return i!=null&&(i.unstable_strictMode===!0&&(l=!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&&(S=i.onRecoverableError)),i=Ww(r,1,!1,null,null,l,d,null,y,v,S,uS),r[Ma]=i.current,wp(r),new Bp(i)},Ou.hydrateRoot=function(r,i,l){if(!s(r))throw Error(a(299));var d=!1,y="",v=y0,S=v0,A=b0,q=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(A=l.onRecoverableError),l.formState!==void 0&&(q=l.formState)),i=Ww(r,1,!0,i,l??null,d,y,q,v,S,A,uS),i.context=Jw(null),l=i.current,d=Dr(),d=nr(d),y=ki(d),y.callback=null,ji(l,y,d),l=d,i.current.lanes=l,pn(i,l),Ea(i),r[Ma]=i.current,wp(r),new af(i)},Ou.version="19.2.4",Ou}var wS;function T2(){if(wS)return Hp.exports;wS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hp.exports=_2(),Hp.exports}var A2=T2(),Xs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ls,Vi,ro,rj,R2=(rj=class extends Xs{constructor(){super();Ne(this,Ls);Ne(this,Vi);Ne(this,ro);be(this,ro,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Vi)||this.setEventListener(U(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Vi))==null||t.call(this),be(this,Vi,void 0))}setEventListener(t){var n;be(this,ro,t),(n=U(this,Vi))==null||n.call(this),be(this,Vi,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){U(this,Ls)!==t&&(be(this,Ls,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof U(this,Ls)=="boolean"?U(this,Ls):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ls=new WeakMap,Vi=new WeakMap,ro=new WeakMap,rj),Jy=new R2,O2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qi,Yy,aj,z2=(aj=class{constructor(){Ne(this,Qi,O2);Ne(this,Yy,!1)}setTimeoutProvider(e){be(this,Qi,e)}setTimeout(e,t){return U(this,Qi).setTimeout(e,t)}clearTimeout(e){U(this,Qi).clearTimeout(e)}setInterval(e,t){return U(this,Qi).setInterval(e,t)}clearInterval(e){U(this,Qi).clearInterval(e)}},Qi=new WeakMap,Yy=new WeakMap,aj),Ds=new z2;function D2(e){setTimeout(e,0)}var M2=typeof window>"u"||"Deno"in globalThis;function Kn(){}function I2(e,t){return typeof e=="function"?e(t):e}function qg(e){return typeof e=="number"&&e>=0&&e!==1/0}function gj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function rs(e,t){return typeof e=="function"?e(t):e}function ea(e,t){return typeof e=="function"?e(t):e}function SS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:u,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==ev(c,t.options))return!1}else if(!ic(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||u&&!u(t))}function kS(e,t){const{exact:n,status:a,predicate:s,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(n){if(Gs(t.options.mutationKey)!==Gs(u))return!1}else if(!ic(t.options.mutationKey,u))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function ev(e,t){return((t==null?void 0:t.queryKeyHashFn)||Gs)(e)}function Gs(e){return JSON.stringify(e,(t,n)=>Hg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function ic(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ic(e[n],t[n])):!1}var L2=Object.prototype.hasOwnProperty;function tv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=jS(e)&&jS(t);if(!a&&!(Hg(e)&&Hg(t)))return t;const u=(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 g=0;g<f;g++){const p=a?g:c[g],b=e[p],w=t[p];if(b===w){m[p]=b,(a?g<u:L2.call(e,p))&&h++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){m[p]=w;continue}const k=tv(b,w,n+1);m[p]=k,k===b&&h++}return u===f&&h===u?e:m}function sc(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 jS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hg(e){if(!ES(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ES(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ES(e){return Object.prototype.toString.call(e)==="[object Object]"}function P2(e){return new Promise(t=>{Ds.setTimeout(t,e)})}function Zg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?tv(e,t):t}function U2(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function B2(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var nv=Symbol();function yj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===nv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rv(e,t){return typeof e=="function"?e(...t):!!e}function F2(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 lc=(()=>{let e=()=>M2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gg(){let e,t;const n=new Promise((s,u)=>{e=s,t=u});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 $2=D2;function q2(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=$2;const u=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)=>{u(()=>{f(...m)})},schedule:u,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var sn=q2(),ao,Ki,io,ij,H2=(ij=class extends Xs{constructor(){super();Ne(this,ao,!0);Ne(this,Ki);Ne(this,io);be(this,io,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){U(this,Ki)||this.setEventListener(U(this,io))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Ki))==null||t.call(this),be(this,Ki,void 0))}setEventListener(t){var n;be(this,io,t),(n=U(this,Ki))==null||n.call(this),be(this,Ki,t(this.setOnline.bind(this)))}setOnline(t){U(this,ao)!==t&&(be(this,ao,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return U(this,ao)}},ao=new WeakMap,Ki=new WeakMap,io=new WeakMap,ij),Uf=new H2;function Z2(e){return Math.min(1e3*2**e,3e4)}function vj(e){return(e??"online")==="online"?Uf.isOnline():!0}var Vg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bj(e){let t=!1,n=0,a;const s=Gg(),u=()=>s.status!=="pending",c=j=>{var C;if(!u()){const E=new Vg(j);b(E),(C=e.onCancel)==null||C.call(e,E)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>Jy.isFocused()&&(e.networkMode==="always"||Uf.isOnline())&&e.canRun(),g=()=>vj(e.networkMode)&&e.canRun(),p=j=>{u()||(a==null||a(),s.resolve(j))},b=j=>{u()||(a==null||a(),s.reject(j))},w=()=>new Promise(j=>{var C;a=E=>{(u()||h())&&j(E)},(C=e.onPause)==null||C.call(e)}).then(()=>{var j;a=void 0,u()||(j=e.onContinue)==null||j.call(e)}),k=()=>{if(u())return;let j;const C=n===0?e.initialPromise:void 0;try{j=C??e.fn()}catch(E){j=Promise.reject(E)}Promise.resolve(j).then(p).catch(E=>{var z;if(u())return;const T=e.retry??(lc.isServer()?0:3),O=e.retryDelay??Z2,D=typeof O=="function"?O(n,E):O,P=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,E);if(t||!P){b(E);return}n++,(z=e.onFail)==null||z.call(e,n,E),P2(D).then(()=>h()?void 0:w()).then(()=>{t?b(E):k()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:g,start:()=>(g()?k():w().then(k),s)}}var Ps,sj,xj=(sj=class{constructor(){Ne(this,Ps)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qg(this.gcTime)&&be(this,Ps,Ds.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lc.isServer()?1/0:300*1e3))}clearGcTimeout(){U(this,Ps)&&(Ds.clearTimeout(U(this,Ps)),be(this,Ps,void 0))}},Ps=new WeakMap,sj),Us,so,Wr,Bs,Mn,wc,Fs,Lr,wj,ti,lj,G2=(lj=class extends xj{constructor(t){super();Ne(this,Lr);Ne(this,Us);Ne(this,so);Ne(this,Wr);Ne(this,Bs);Ne(this,Mn);Ne(this,wc);Ne(this,Fs);be(this,Fs,!1),be(this,wc,t.defaultOptions),this.setOptions(t.options),this.observers=[],be(this,Bs,t.client),be(this,Wr,U(this,Bs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,be(this,Us,NS(this.options)),this.state=t.state??U(this,Us),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=U(this,Mn))==null?void 0:t.promise}setOptions(t){if(this.options={...U(this,wc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=NS(this.options);n.data!==void 0&&(this.setState(CS(n.data,n.dataUpdatedAt)),be(this,Us,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,Wr).remove(this)}setData(t,n){const a=Zg(this.state.data,t,this.options);return qe(this,Lr,ti).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){qe(this,Lr,ti).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=U(this,Mn))==null?void 0:a.promise;return(s=U(this,Mn))==null||s.cancel(t),n?n.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return U(this,Us)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ea(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>rs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!gj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Mn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Mn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),U(this,Wr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(U(this,Mn)&&(U(this,Fs)||qe(this,Lr,wj).call(this)?U(this,Mn).cancel({revert:!0}):U(this,Mn).cancelRetry()),this.scheduleGc()),U(this,Wr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qe(this,Lr,ti).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,g,p,b,w,k,j,C,E,T,O;if(this.state.fetchStatus!=="idle"&&((m=U(this,Mn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,Mn))return U(this,Mn).continueRetry(),U(this,Mn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const D=this.observers.find(P=>P.options.queryFn);D&&this.setOptions(D.options)}const a=new AbortController,s=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(be(this,Fs,!0),a.signal)})},u=()=>{const D=yj(this.options,n),z=(()=>{const B={client:U(this,Bs),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return be(this,Fs,!1),this.options.persister?this.options.persister(D,z,this):D(z)},f=(()=>{const D={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:U(this,Bs),state:this.state,fetchFn:u};return s(D),D})();(h=this.options.behavior)==null||h.onFetch(f,this),be(this,so,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=f.fetchOptions)==null?void 0:g.meta))&&qe(this,Lr,ti).call(this,{type:"fetch",meta:(p=f.fetchOptions)==null?void 0:p.meta}),be(this,Mn,bj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:D=>{D instanceof Vg&&D.revert&&this.setState({...U(this,so),fetchStatus:"idle"}),a.abort()},onFail:(D,P)=>{qe(this,Lr,ti).call(this,{type:"failed",failureCount:D,error:P})},onPause:()=>{qe(this,Lr,ti).call(this,{type:"pause"})},onContinue:()=>{qe(this,Lr,ti).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const D=await U(this,Mn).start();if(D===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(D),(w=(b=U(this,Wr).config).onSuccess)==null||w.call(b,D,this),(j=(k=U(this,Wr).config).onSettled)==null||j.call(k,D,this.state.error,this),D}catch(D){if(D instanceof Vg){if(D.silent)return U(this,Mn).promise;if(D.revert){if(this.state.data===void 0)throw D;return this.state.data}}throw qe(this,Lr,ti).call(this,{type:"error",error:D}),(E=(C=U(this,Wr).config).onError)==null||E.call(C,D,this),(O=(T=U(this,Wr).config).onSettled)==null||O.call(T,this.state.data,D,this),D}finally{this.scheduleGc()}}},Us=new WeakMap,so=new WeakMap,Wr=new WeakMap,Bs=new WeakMap,Mn=new WeakMap,wc=new WeakMap,Fs=new WeakMap,Lr=new WeakSet,wj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ti=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Sj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...CS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return be(this,so,t.manual?s:void 0),s;case"error":const u=t.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,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,Wr).notify({query:this,type:"updated",action:t})})},lj);function Sj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function CS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function NS(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 br,ht,Sc,sr,$s,lo,ni,Yi,kc,oo,uo,qs,Hs,Xi,co,Nt,Yu,Qg,Kg,Yg,Xg,Wg,Jg,ey,kj,oj,av=(oj=class extends Xs{constructor(t,n){super();Ne(this,Nt);Ne(this,br);Ne(this,ht);Ne(this,Sc);Ne(this,sr);Ne(this,$s);Ne(this,lo);Ne(this,ni);Ne(this,Yi);Ne(this,kc);Ne(this,oo);Ne(this,uo);Ne(this,qs);Ne(this,Hs);Ne(this,Xi);Ne(this,co,new Set);this.options=n,be(this,br,t),be(this,Yi,null),be(this,ni,Gg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,ht).addObserver(this),_S(U(this,ht),this.options)?qe(this,Nt,Yu).call(this):this.updateResult(),qe(this,Nt,Xg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ty(U(this,ht),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ty(U(this,ht),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,qe(this,Nt,Wg).call(this),qe(this,Nt,Jg).call(this),U(this,ht).removeObserver(this)}setOptions(t){const n=this.options,a=U(this,ht);if(this.options=U(this,br).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ea(this.options.enabled,U(this,ht))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");qe(this,Nt,ey).call(this),U(this,ht).setOptions(this.options),n._defaulted&&!sc(this.options,n)&&U(this,br).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,ht),observer:this});const s=this.hasListeners();s&&TS(U(this,ht),a,this.options,n)&&qe(this,Nt,Yu).call(this),this.updateResult(),s&&(U(this,ht)!==a||ea(this.options.enabled,U(this,ht))!==ea(n.enabled,U(this,ht))||rs(this.options.staleTime,U(this,ht))!==rs(n.staleTime,U(this,ht)))&&qe(this,Nt,Qg).call(this);const u=qe(this,Nt,Kg).call(this);s&&(U(this,ht)!==a||ea(this.options.enabled,U(this,ht))!==ea(n.enabled,U(this,ht))||u!==U(this,Xi))&&qe(this,Nt,Yg).call(this,u)}getOptimisticResult(t){const n=U(this,br).getQueryCache().build(U(this,br),t),a=this.createResult(n,t);return Q2(this,a)&&(be(this,sr,a),be(this,lo,this.options),be(this,$s,U(this,ht).state)),a}getCurrentResult(){return U(this,sr)}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,ni).status==="pending"&&U(this,ni).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){U(this,co).add(t)}getCurrentQuery(){return U(this,ht)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=U(this,br).defaultQueryOptions(t),a=U(this,br).getQueryCache().build(U(this,br),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return qe(this,Nt,Yu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,sr)))}createResult(t,n){var V;const a=U(this,ht),s=this.options,u=U(this,sr),c=U(this,$s),f=U(this,lo),h=t!==a?t.state:U(this,Sc),{state:g}=t;let p={...g},b=!1,w;if(n._optimisticResults){const I=this.hasListeners(),X=!I&&_S(t,n),se=I&&TS(t,a,n,s);(X||se)&&(p={...p,...Sj(g.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:k,errorUpdatedAt:j,status:C}=p;w=p.data;let E=!1;if(n.placeholderData!==void 0&&w===void 0&&C==="pending"){let I;u!=null&&u.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(I=u.data,E=!0):I=typeof n.placeholderData=="function"?n.placeholderData((V=U(this,uo))==null?void 0:V.state.data,U(this,uo)):n.placeholderData,I!==void 0&&(C="success",w=Zg(u==null?void 0:u.data,I,n),b=!0)}if(n.select&&w!==void 0&&!E)if(u&&w===(c==null?void 0:c.data)&&n.select===U(this,kc))w=U(this,oo);else try{be(this,kc,n.select),w=n.select(w),w=Zg(u==null?void 0:u.data,w,n),be(this,oo,w),be(this,Yi,null)}catch(I){be(this,Yi,I)}U(this,Yi)&&(k=U(this,Yi),w=U(this,oo),j=Date.now(),C="error");const T=p.fetchStatus==="fetching",O=C==="pending",D=C==="error",P=O&&T,z=w!==void 0,M={status:C,fetchStatus:p.fetchStatus,isPending:O,isSuccess:C==="success",isError:D,isInitialLoading:P,isLoading:P,data:w,dataUpdatedAt:p.dataUpdatedAt,error:k,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:T,isRefetching:T&&!O,isLoadingError:D&&!z,isPaused:p.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:D&&z,isStale:iv(t,n),refetch:this.refetch,promise:U(this,ni),isEnabled:ea(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=M.data!==void 0,X=M.status==="error"&&!I,se=ee=>{X?ee.reject(M.error):I&&ee.resolve(M.data)},Se=()=>{const ee=be(this,ni,M.promise=Gg());se(ee)},Y=U(this,ni);switch(Y.status){case"pending":t.queryHash===a.queryHash&&se(Y);break;case"fulfilled":(X||M.data!==Y.value)&&Se();break;case"rejected":(!X||M.error!==Y.reason)&&Se();break}}return M}updateResult(){const t=U(this,sr),n=this.createResult(U(this,ht),this.options);if(be(this,$s,U(this,ht).state),be(this,lo,this.options),U(this,$s).data!==void 0&&be(this,uo,U(this,ht)),sc(n,t))return;be(this,sr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,u=typeof s=="function"?s():s;if(u==="all"||!u&&!U(this,co).size)return!0;const c=new Set(u??U(this,co));return this.options.throwOnError&&c.add("error"),Object.keys(U(this,sr)).some(f=>{const m=f;return U(this,sr)[m]!==t[m]&&c.has(m)})};qe(this,Nt,kj).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&qe(this,Nt,Xg).call(this)}},br=new WeakMap,ht=new WeakMap,Sc=new WeakMap,sr=new WeakMap,$s=new WeakMap,lo=new WeakMap,ni=new WeakMap,Yi=new WeakMap,kc=new WeakMap,oo=new WeakMap,uo=new WeakMap,qs=new WeakMap,Hs=new WeakMap,Xi=new WeakMap,co=new WeakMap,Nt=new WeakSet,Yu=function(t){qe(this,Nt,ey).call(this);let n=U(this,ht).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Kn)),n},Qg=function(){qe(this,Nt,Wg).call(this);const t=rs(this.options.staleTime,U(this,ht));if(lc.isServer()||U(this,sr).isStale||!qg(t))return;const a=gj(U(this,sr).dataUpdatedAt,t)+1;be(this,qs,Ds.setTimeout(()=>{U(this,sr).isStale||this.updateResult()},a))},Kg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,ht)):this.options.refetchInterval)??!1},Yg=function(t){qe(this,Nt,Jg).call(this),be(this,Xi,t),!(lc.isServer()||ea(this.options.enabled,U(this,ht))===!1||!qg(U(this,Xi))||U(this,Xi)===0)&&be(this,Hs,Ds.setInterval(()=>{(this.options.refetchIntervalInBackground||Jy.isFocused())&&qe(this,Nt,Yu).call(this)},U(this,Xi)))},Xg=function(){qe(this,Nt,Qg).call(this),qe(this,Nt,Yg).call(this,qe(this,Nt,Kg).call(this))},Wg=function(){U(this,qs)&&(Ds.clearTimeout(U(this,qs)),be(this,qs,void 0))},Jg=function(){U(this,Hs)&&(Ds.clearInterval(U(this,Hs)),be(this,Hs,void 0))},ey=function(){const t=U(this,br).getQueryCache().build(U(this,br),this.options);if(t===U(this,ht))return;const n=U(this,ht);be(this,ht,t),be(this,Sc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},kj=function(t){sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(U(this,sr))}),U(this,br).getQueryCache().notify({query:U(this,ht),type:"observerResultsUpdated"})})},oj);function V2(e,t){return ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _S(e,t){return V2(e,t)||e.state.data!==void 0&&ty(e,t,t.refetchOnMount)}function ty(e,t,n){if(ea(t.enabled,e)!==!1&&rs(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&iv(e,t)}return!1}function TS(e,t,n,a){return(e!==t||ea(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&iv(e,n)}function iv(e,t){return ea(t.enabled,e)!==!1&&e.isStaleByTime(rs(t.staleTime,e))}function Q2(e,t){return!sc(e.getCurrentResult(),t)}function AS(e){return{onFetch:(t,n)=>{var g,p,b,w,k;const a=t.options,s=(b=(p=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:p.fetchMore)==null?void 0:b.direction,u=((w=t.state.data)==null?void 0:w.pages)||[],c=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const C=O=>{F2(O,()=>t.signal,()=>j=!0)},E=yj(t.options,t.fetchOptions),T=async(O,D,P)=>{if(j)return Promise.reject();if(D==null&&O.pages.length)return Promise.resolve(O);const B=(()=>{const X={client:t.client,queryKey:t.queryKey,pageParam:D,direction:P?"backward":"forward",meta:t.options.meta};return C(X),X})(),M=await E(B),{maxPages:V}=t.options,I=P?B2:U2;return{pages:I(O.pages,M,V),pageParams:I(O.pageParams,D,V)}};if(s&&u.length){const O=s==="backward",D=O?K2:RS,P={pages:u,pageParams:c},z=D(a,P);f=await T(P,z,O)}else{const O=e??u.length;do{const D=m===0?c[0]??a.initialPageParam:RS(a,f);if(m>0&&D==null)break;f=await T(f,D),m++}while(m<O)}return f};t.options.persister?t.fetchFn=()=>{var j,C;return(C=(j=t.options).persister)==null?void 0:C.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function RS(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 K2(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 jc,Na,Vn,Zs,_a,qi,uj,Y2=(uj=class extends xj{constructor(t){super();Ne(this,_a);Ne(this,jc);Ne(this,Na);Ne(this,Vn);Ne(this,Zs);be(this,jc,t.client),this.mutationId=t.mutationId,be(this,Vn,t.mutationCache),be(this,Na,[]),this.state=t.state||jj(),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,Na).includes(t)||(U(this,Na).push(t),this.clearGcTimeout(),U(this,Vn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){be(this,Na,U(this,Na).filter(n=>n!==t)),this.scheduleGc(),U(this,Vn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,Na).length||(this.state.status==="pending"?this.scheduleGc():U(this,Vn).remove(this))}continue(){var t;return((t=U(this,Zs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,g,p,b,w,k,j,C,E,T,O,D,P,z,B;const n=()=>{qe(this,_a,qi).call(this,{type:"continue"})},a={client:U(this,jc),meta:this.options.meta,mutationKey:this.options.mutationKey};be(this,Zs,bj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(M,V)=>{qe(this,_a,qi).call(this,{type:"failed",failureCount:M,error:V})},onPause:()=>{qe(this,_a,qi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,Vn).canRun(this)}));const s=this.state.status==="pending",u=!U(this,Zs).canStart();try{if(s)n();else{qe(this,_a,qi).call(this,{type:"pending",variables:t,isPaused:u}),U(this,Vn).config.onMutate&&await U(this,Vn).config.onMutate(t,this,a);const V=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));V!==this.state.context&&qe(this,_a,qi).call(this,{type:"pending",context:V,variables:t,isPaused:u})}const M=await U(this,Zs).start();return await((h=(m=U(this,Vn).config).onSuccess)==null?void 0:h.call(m,M,t,this.state.context,this,a)),await((p=(g=this.options).onSuccess)==null?void 0:p.call(g,M,t,this.state.context,a)),await((w=(b=U(this,Vn).config).onSettled)==null?void 0:w.call(b,M,null,this.state.variables,this.state.context,this,a)),await((j=(k=this.options).onSettled)==null?void 0:j.call(k,M,null,t,this.state.context,a)),qe(this,_a,qi).call(this,{type:"success",data:M}),M}catch(M){try{await((E=(C=U(this,Vn).config).onError)==null?void 0:E.call(C,M,t,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await((O=(T=this.options).onError)==null?void 0:O.call(T,M,t,this.state.context,a))}catch(V){Promise.reject(V)}try{await((P=(D=U(this,Vn).config).onSettled)==null?void 0:P.call(D,void 0,M,this.state.variables,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await((B=(z=this.options).onSettled)==null?void 0:B.call(z,void 0,M,t,this.state.context,a))}catch(V){Promise.reject(V)}throw qe(this,_a,qi).call(this,{type:"error",error:M}),M}finally{U(this,Vn).runNext(this)}}},jc=new WeakMap,Na=new WeakMap,Vn=new WeakMap,Zs=new WeakMap,_a=new WeakSet,qi=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,Na).forEach(a=>{a.onMutationUpdate(t)}),U(this,Vn).notify({mutation:this,type:"updated",action:t})})},uj);function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ri,pa,Ec,cj,X2=(cj=class extends Xs{constructor(t={}){super();Ne(this,ri);Ne(this,pa);Ne(this,Ec);this.config=t,be(this,ri,new Set),be(this,pa,new Map),be(this,Ec,0)}build(t,n,a){const s=new Y2({client:t,mutationCache:this,mutationId:++lf(this,Ec)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){U(this,ri).add(t);const n=of(t);if(typeof n=="string"){const a=U(this,pa).get(n);a?a.push(t):U(this,pa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(U(this,ri).delete(t)){const n=of(t);if(typeof n=="string"){const a=U(this,pa).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,pa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=of(t);if(typeof n=="string"){const a=U(this,pa).get(n),s=a==null?void 0:a.find(u=>u.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=of(t);if(typeof n=="string"){const s=(a=U(this,pa).get(n))==null?void 0:a.find(u=>u!==t&&u.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sn.batch(()=>{U(this,ri).forEach(t=>{this.notify({type:"removed",mutation:t})}),U(this,ri).clear(),U(this,pa).clear()})}getAll(){return Array.from(U(this,ri))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>kS(n,a))}findAll(t={}){return this.getAll().filter(n=>kS(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(Kn))))}},ri=new WeakMap,pa=new WeakMap,Ec=new WeakMap,cj);function of(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ai,Wi,xr,ii,li,Af,ny,dj,W2=(dj=class extends Xs{constructor(n,a){super();Ne(this,li);Ne(this,ai);Ne(this,Wi);Ne(this,xr);Ne(this,ii);be(this,ai,n),this.setOptions(a),this.bindMethods(),qe(this,li,Af).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,ai).defaultMutationOptions(n),sc(this.options,a)||U(this,ai).getMutationCache().notify({type:"observerOptionsUpdated",mutation:U(this,xr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Gs(a.mutationKey)!==Gs(this.options.mutationKey)?this.reset():((s=U(this,xr))==null?void 0:s.state.status)==="pending"&&U(this,xr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=U(this,xr))==null||n.removeObserver(this)}onMutationUpdate(n){qe(this,li,Af).call(this),qe(this,li,ny).call(this,n)}getCurrentResult(){return U(this,Wi)}reset(){var n;(n=U(this,xr))==null||n.removeObserver(this),be(this,xr,void 0),qe(this,li,Af).call(this),qe(this,li,ny).call(this)}mutate(n,a){var s;return be(this,ii,a),(s=U(this,xr))==null||s.removeObserver(this),be(this,xr,U(this,ai).getMutationCache().build(U(this,ai),this.options)),U(this,xr).addObserver(this),U(this,xr).execute(n)}},ai=new WeakMap,Wi=new WeakMap,xr=new WeakMap,ii=new WeakMap,li=new WeakSet,Af=function(){var a;const n=((a=U(this,xr))==null?void 0:a.state)??jj();be(this,Wi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ny=function(n){sn.batch(()=>{var a,s,u,c,f,m,h,g;if(U(this,ii)&&this.hasListeners()){const p=U(this,Wi).variables,b=U(this,Wi).context,w={client:U(this,ai),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=U(this,ii)).onSuccess)==null||s.call(a,n.data,p,b,w)}catch(k){Promise.reject(k)}try{(c=(u=U(this,ii)).onSettled)==null||c.call(u,n.data,null,p,b,w)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=U(this,ii)).onError)==null||m.call(f,n.error,p,b,w)}catch(k){Promise.reject(k)}try{(g=(h=U(this,ii)).onSettled)==null||g.call(h,void 0,n.error,p,b,w)}catch(k){Promise.reject(k)}}}this.listeners.forEach(p=>{p(U(this,Wi))})})},dj);function OS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function J2(e,t,n){const a=e.slice(0);return a[t]=n,a}var fo,Ir,ho,mo,Jr,Ji,Cc,Nc,_c,Tc,Hn,ry,ay,iy,sy,ly,fj,eR=(fj=class extends Xs{constructor(t,n,a){super();Ne(this,Hn);Ne(this,fo);Ne(this,Ir);Ne(this,ho);Ne(this,mo);Ne(this,Jr);Ne(this,Ji);Ne(this,Cc);Ne(this,Nc);Ne(this,_c);Ne(this,Tc,[]);be(this,fo,t),be(this,mo,a),be(this,ho,[]),be(this,Jr,[]),be(this,Ir,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&U(this,Jr).forEach(t=>{t.subscribe(n=>{qe(this,Hn,sy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,U(this,Jr).forEach(t=>{t.destroy()})}setQueries(t,n){be(this,ho,t),be(this,mo,n),sn.batch(()=>{const a=U(this,Jr),s=qe(this,Hn,iy).call(this,U(this,ho));s.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const u=s.map(p=>p.observer),c=u.map(p=>p.getCurrentResult()),f=a.length!==u.length,m=u.some((p,b)=>p!==a[b]),h=f||m,g=h?!0:c.some((p,b)=>{const w=U(this,Ir)[b];return!w||!sc(p,w)});!h&&!g||(h&&(be(this,Tc,s),be(this,Jr,u)),be(this,Ir,c),this.hasListeners()&&(h&&(OS(a,u).forEach(p=>{p.destroy()}),OS(u,a).forEach(p=>{p.subscribe(b=>{qe(this,Hn,sy).call(this,p,b)})})),qe(this,Hn,ly).call(this)))})}getCurrentResult(){return U(this,Ir)}getQueries(){return U(this,Jr).map(t=>t.getCurrentQuery())}getObservers(){return U(this,Jr)}getOptimisticResult(t,n){const a=qe(this,Hn,iy).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),u=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>qe(this,Hn,ay).call(this,c??s,n,u),()=>qe(this,Hn,ry).call(this,s,a)]}},fo=new WeakMap,Ir=new WeakMap,ho=new WeakMap,mo=new WeakMap,Jr=new WeakMap,Ji=new WeakMap,Cc=new WeakMap,Nc=new WeakMap,_c=new WeakMap,Tc=new WeakMap,Hn=new WeakSet,ry=function(t,n){return n.map((a,s)=>{const u=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?u:a.observer.trackResult(u,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},ay=function(t,n,a){if(n){const s=U(this,_c),u=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!U(this,Ji)||U(this,Ir)!==U(this,Nc)||u||n!==U(this,Cc))&&(be(this,Cc,n),be(this,Nc,U(this,Ir)),a!==void 0&&be(this,_c,a),be(this,Ji,tv(U(this,Ji),n(t)))),U(this,Ji)}return t},iy=function(t){const n=new Map;U(this,Jr).forEach(s=>{const u=s.options.queryHash;if(!u)return;const c=n.get(u);c?c.push(s):n.set(u,[s])});const a=[];return t.forEach(s=>{var m;const u=U(this,fo).defaultQueryOptions(s),f=((m=n.get(u.queryHash))==null?void 0:m.shift())??new av(U(this,fo),u);a.push({defaultedQueryOptions:u,observer:f})}),a},sy=function(t,n){const a=U(this,Jr).indexOf(t);a!==-1&&(be(this,Ir,J2(U(this,Ir),a,n)),qe(this,Hn,ly).call(this))},ly=function(){var t;if(this.hasListeners()){const n=U(this,Ji),a=qe(this,Hn,ry).call(this,U(this,Ir),U(this,Tc)),s=qe(this,Hn,ay).call(this,a,(t=U(this,mo))==null?void 0:t.combine);n!==s&&sn.batch(()=>{this.listeners.forEach(u=>{u(U(this,Ir))})})}},fj),Ta,hj,tR=(hj=class extends Xs{constructor(t={}){super();Ne(this,Ta);this.config=t,be(this,Ta,new Map)}build(t,n,a){const s=n.queryKey,u=n.queryHash??ev(s,n);let c=this.get(u);return c||(c=new G2({client:t,queryKey:s,queryHash:u,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){U(this,Ta).has(t.queryHash)||(U(this,Ta).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=U(this,Ta).get(t.queryHash);n&&(t.destroy(),n===t&&U(this,Ta).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,Ta).get(t)}getAll(){return[...U(this,Ta).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>SS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>SS(t,a)):n}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ta=new WeakMap,hj),an,es,ts,po,go,ns,yo,vo,mj,nR=(mj=class{constructor(e={}){Ne(this,an);Ne(this,es);Ne(this,ts);Ne(this,po);Ne(this,go);Ne(this,ns);Ne(this,yo);Ne(this,vo);be(this,an,e.queryCache||new tR),be(this,es,e.mutationCache||new X2),be(this,ts,e.defaultOptions||{}),be(this,po,new Map),be(this,go,new Map),be(this,ns,0)}mount(){lf(this,ns)._++,U(this,ns)===1&&(be(this,yo,Jy.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,an).onFocus())})),be(this,vo,Uf.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,an).onOnline())})))}unmount(){var e,t;lf(this,ns)._--,U(this,ns)===0&&((e=U(this,yo))==null||e.call(this),be(this,yo,void 0),(t=U(this,vo))==null||t.call(this),be(this,vo,void 0))}isFetching(e){return U(this,an).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,es).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(rs(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),u=s==null?void 0:s.state.data,c=I2(t,u);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(Kn).catch(Kn)}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 u=s.fetch(void 0,n);return n.throwOnError||(u=u.catch(Kn)),s.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(a).then(Kn)}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(rs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kn).catch(Kn)}fetchInfiniteQuery(e){return e.behavior=AS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kn).catch(Kn)}ensureInfiniteQueryData(e){return e.behavior=AS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Uf.isOnline()?U(this,es).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,an)}getMutationCache(){return U(this,es)}getDefaultOptions(){return U(this,ts)}setDefaultOptions(e){be(this,ts,e)}setQueryDefaults(e,t){U(this,po).set(Gs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,po).values()],n={};return t.forEach(a=>{ic(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){U(this,go).set(Gs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(this,go).values()],n={};return t.forEach(a=>{ic(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...U(this,ts).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ev(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===nv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,ts).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,an).clear(),U(this,es).clear()}},an=new WeakMap,es=new WeakMap,ts=new WeakMap,po=new WeakMap,go=new WeakMap,ns=new WeakMap,yo=new WeakMap,vo=new WeakMap,mj),Ej=x.createContext(void 0),ln=e=>{const t=x.useContext(Ej);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},rR=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Ej.Provider,{value:e,children:t})),Cj=x.createContext(!1),Nj=()=>x.useContext(Cj);Cj.Provider;function aR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var iR=x.createContext(aR()),_j=()=>x.useContext(iR),Tj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?rv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Aj=e=>{x.useEffect(()=>{e.clearReset()},[e])},Rj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||rv(n,[e.error,a])),Oj=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,oy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,uy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lR({queries:e,...t},n){const a=ln(),s=Nj(),u=_j(),c=x.useMemo(()=>e.map(j=>{const C=a.defaultQueryOptions(j);return C._optimisticResults=s?"isRestoring":"optimistic",C}),[e,a,s]);c.forEach(j=>{Oj(j);const C=a.getQueryCache().get(j.queryHash);Tj(j,u,C)}),Aj(u);const[f]=x.useState(()=>new eR(a,c,t)),[m,h,g]=f.getOptimisticResult(c,t.combine),p=!s&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>p?f.subscribe(sn.batchCalls(j)):Kn,[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),x.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((j,C)=>oy(c[C],j))?m.flatMap((j,C)=>{const E=c[C];if(E&&oy(E,j)){const T=new av(a,E);return uy(E,T,u)}return[]}):[];if(w.length>0)throw Promise.all(w);const k=m.find((j,C)=>{const E=c[C];return E&&Rj({result:j,errorResetBoundary:u,throwOnError:E.throwOnError,query:a.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(k!=null&&k.error)throw k.error;return h(g())}function oR(e,t,n){var b,w,k,j;const a=Nj(),s=_j(),u=ln(),c=u.defaultQueryOptions(e);(w=(b=u.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,c);const f=u.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Oj(c),Tj(c,s,f),Aj(s);const m=!u.getQueryCache().get(c.queryHash),[h]=x.useState(()=>new t(u,c)),g=h.getOptimisticResult(c),p=!a&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(C=>{const E=p?h.subscribe(sn.batchCalls(C)):Kn;return h.updateResult(),E},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setOptions(c)},[c,h]),oy(c,g))throw uy(c,h,s);if(Rj({result:g,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw g.error;if((j=(k=u.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||j.call(k,c,g),c.experimental_prefetchInRender&&!lc.isServer()&&sR(g,a)){const C=m?uy(c,h,s):f==null?void 0:f.promise;C==null||C.catch(Kn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?g:h.trackResult(g)}function Qe(e,t){return oR(e,av)}function Et(e,t){const n=ln(),[a]=x.useState(()=>new W2(n,e));x.useEffect(()=>{a.setOptions(e)},[a,e]);const s=x.useSyncExternalStore(x.useCallback(c=>a.subscribe(sn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=x.useCallback((c,f)=>{a.mutate(c,f).catch(Kn)},[a]);if(s.error&&rv(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:u,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 zS="popstate";function DS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function uR(e={}){function t(a,s){var h;let u=(h=s.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=u||a.location;return cy("",{pathname:c,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:oc(s)}return dR(t,n,null,e)}function Vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function na(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 MS(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 cy(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?_o(t):t,state:n,key:t&&t.key||a||cR(),unstable_mask:s}}function oc({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 _o(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 dR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:u=!1}=a,c=s.history,f="POP",m=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function p(){f="POP";let C=g(),E=C==null?null:C-h;h=C,m&&m({action:f,location:j.location,delta:E})}function b(C,E){f="PUSH";let T=DS(C)?C:cy(j.location,C,E);h=g()+1;let O=MS(T,h),D=j.createHref(T.unstable_mask||T);try{c.pushState(O,"",D)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;s.location.assign(D)}u&&m&&m({action:f,location:j.location,delta:1})}function w(C,E){f="REPLACE";let T=DS(C)?C:cy(j.location,C,E);h=g();let O=MS(T,h),D=j.createHref(T.unstable_mask||T);c.replaceState(O,"",D),u&&m&&m({action:f,location:j.location,delta:0})}function k(C){return fR(C)}let j={get action(){return f},get location(){return e(s,c)},listen(C){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(zS,p),m=C,()=>{s.removeEventListener(zS,p),m=null}},createHref(C){return t(s,C)},createURL:k,encodeLocation(C){let E=k(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:b,replace:w,go(C){return c.go(C)}};return j}function fR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Vt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:oc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function zj(e,t,n="/"){return hR(e,t,n,!1)}function hR(e,t,n,a){let s=typeof t=="string"?_o(t):t,u=oi(s.pathname||"/",n);if(u==null)return null;let c=Dj(e);mR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=ER(u);f=kR(c[m],h,a)}return f}function Dj(e,t=[],n=[],a="",s=!1){let u=(c,f,m=s,h)=>{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&m)return;Vt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let p=Ra([a,g.relativePath]),b=n.concat(g);c.children&&c.children.length>0&&(Vt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Dj(c.children,t,b,p,m)),!(c.path==null&&!c.index)&&t.push({path:p,score:wR(p,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let h of Mj(c.path))u(c,f,!0,h)}),t}function Mj(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),u=n.replace(/\?$/,"");if(a.length===0)return s?[u,""]:[u];let c=Mj(a.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),s&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function mR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:SR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var pR=/^:[\w-]+$/,gR=3,yR=2,vR=1,bR=10,xR=-2,IS=e=>e==="*";function wR(e,t){let n=e.split("/"),a=n.length;return n.some(IS)&&(a+=xR),t&&(a+=yR),n.filter(s=>!IS(s)).reduce((s,u)=>s+(pR.test(u)?gR:u===""?vR:bR),a)}function SR(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 kR(e,t,n=!1){let{routesMeta:a}=e,s={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,g=u==="/"?t:t.slice(u.length)||"/",p=Bf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},g),b=m.route;if(!p&&h&&n&&!a[a.length-1].route.index&&(p=Bf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!p)return null;Object.assign(s,p.params),c.push({params:s,pathname:Ra([u,p.pathname]),pathnameBase:TR(Ra([u,p.pathnameBase])),route:b}),p.pathnameBase!=="/"&&(u=Ra([u,p.pathnameBase]))}return c}function Bf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=jR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let u=s[0],c=u.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:p},b)=>{if(g==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return p&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:u,pathnameBase:c,pattern:e}}function jR(e,t=!1,n=!0){na(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,g)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let p=g.charAt(h+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function ER(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return na(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function oi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var CR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function NR(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?_o(e):e,u;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?u=LS(n.substring(1),"/"):u=LS(n,t)):u=t,{pathname:u,search:AR(a),hash:RR(s)}}function LS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Qp(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _R(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function sv(e){let t=_R(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ih(e,t,n,a=!1){let s;typeof e=="string"?s=_o(e):(s={...e},Vt(!s.pathname||!s.pathname.includes("?"),Qp("?","pathname","search",s)),Vt(!s.pathname||!s.pathname.includes("#"),Qp("#","pathname","hash",s)),Vt(!s.search||!s.search.includes("#"),Qp("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,f;if(c==null)f=n;else{let p=t.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),p-=1;s.pathname=b.join("/")}f=p>=0?t[p]:"/"}let m=NR(s,f),h=c&&c!=="/"&&c.endsWith("/"),g=(u||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Ra=e=>e.join("/").replace(/\/\/+/g,"/"),TR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),AR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,RR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,OR=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 zR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function DR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ij=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Lj(e,t){let n=e;if(typeof n!="string"||!CR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Ij)try{let u=new URL(window.location.href),c=n.startsWith("//")?new URL(u.protocol+n):new URL(n),f=oi(c.pathname,t);c.origin===u.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{na(!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 Pj=["POST","PUT","PATCH","DELETE"];new Set(Pj);var MR=["GET",...Pj];new Set(MR);var To=x.createContext(null);To.displayName="DataRouter";var sh=x.createContext(null);sh.displayName="DataRouterState";var IR=x.createContext(!1),Uj=x.createContext({isTransitioning:!1});Uj.displayName="ViewTransition";var LR=x.createContext(new Map);LR.displayName="Fetchers";var PR=x.createContext(null);PR.displayName="Await";var Ur=x.createContext(null);Ur.displayName="Navigation";var Ac=x.createContext(null);Ac.displayName="Location";var aa=x.createContext({outlet:null,matches:[],isDataRoute:!1});aa.displayName="Route";var lv=x.createContext(null);lv.displayName="RouteError";var Bj="REACT_ROUTER_ERROR",UR="REDIRECT",BR="ROUTE_ERROR_RESPONSE";function FR(e){if(e.startsWith(`${Bj}:${UR}:{`))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 $R(e){if(e.startsWith(`${Bj}:${BR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new OR(t.status,t.statusText,t.data)}catch{}}function qR(e,{relative:t}={}){Vt(Ao(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=x.useContext(Ur),{hash:s,pathname:u,search:c}=Rc(e,{relative:t}),f=u;return n!=="/"&&(f=u==="/"?n:Ra([n,u])),a.createHref({pathname:f,search:c,hash:s})}function Ao(){return x.useContext(Ac)!=null}function Sr(){return Vt(Ao(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Ac).location}var Fj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $j(e){x.useContext(Ur).static||x.useLayoutEffect(e)}function Rn(){let{isDataRoute:e}=x.useContext(aa);return e?aO():HR()}function HR(){Vt(Ao(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(To),{basename:t,navigator:n}=x.useContext(Ur),{matches:a}=x.useContext(aa),{pathname:s}=Sr(),u=JSON.stringify(sv(a)),c=x.useRef(!1);return $j(()=>{c.current=!0}),x.useCallback((m,h={})=>{if(na(c.current,Fj),!c.current)return;if(typeof m=="number"){n.go(m);return}let g=ih(m,JSON.parse(u),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ra([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,u,s,e])}var ZR=x.createContext(null);function GR(e){let t=x.useContext(aa).outlet;return x.useMemo(()=>t&&x.createElement(ZR.Provider,{value:e},t),[t,e])}function qj(){let{matches:e}=x.useContext(aa),t=e[e.length-1];return t?t.params:{}}function Rc(e,{relative:t}={}){let{matches:n}=x.useContext(aa),{pathname:a}=Sr(),s=JSON.stringify(sv(n));return x.useMemo(()=>ih(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function VR(e,t){return Hj(e,t)}function Hj(e,t,n){var C;Vt(Ao(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(Ur),{matches:s}=x.useContext(aa),u=s[s.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",h=u&&u.route;{let E=h&&h.path||"";Gj(f,!h||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${E}">) 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="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let g=Sr(),p;if(t){let E=typeof t=="string"?_o(t):t;Vt(m==="/"||((C=E.pathname)==null?void 0:C.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 "${E.pathname}" was given in the \`location\` prop.`),p=E}else p=g;let b=p.pathname||"/",w=b;if(m!=="/"){let E=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let k=zj(e,{pathname:w});na(h||k!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),na(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=WR(k&&k.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Ra([m,a.encodeLocation?a.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:Ra([m,a.encodeLocation?a.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,n);return t&&j?x.createElement(Ac.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},j):j}function QR(){let e=rO(),t=zR(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},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:u},"ErrorBoundary")," or"," ",x.createElement("code",{style:u},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,c)}var KR=x.createElement(QR,null),Zj=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=$R(e.digest);n&&(e=n)}let t=e!==void 0?x.createElement(aa.Provider,{value:this.props.routeContext},x.createElement(lv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(YR,{error:e},t):t}};Zj.contextType=IR;var Kp=new WeakMap;function YR({children:e,error:t}){let{basename:n}=x.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=FR(t.digest);if(a){let s=Kp.get(t);if(s)throw s;let u=Lj(a.location,n);if(Ij&&!Kp.get(t))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw Kp.set(t,c),c}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function XR({routeContext:e,match:t,children:n}){let a=x.useContext(To);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(aa.Provider,{value:e},n)}function WR(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,u=a==null?void 0:a.errors;if(u!=null){let g=s.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);Vt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=g),p.route.id){let{loaderData:b,errors:w}=a,k=p.route.loader&&!b.hasOwnProperty(p.route.id)&&(!w||w[p.route.id]===void 0);if(p.route.lazy||k){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(g,p)=>{var b,w;m(g,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:DR(a.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,b)=>{let w,k=!1,j=null,C=null;a&&(w=u&&p.route.id?u[p.route.id]:void 0,j=p.route.errorElement||KR,c&&(f<0&&b===0?(Gj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):f===b&&(k=!0,C=p.route.hydrateFallbackElement||null)));let E=t.concat(s.slice(0,b+1)),T=()=>{let O;return w?O=j:k?O=C:p.route.Component?O=x.createElement(p.route.Component,null):p.route.element?O=p.route.element:O=g,x.createElement(XR,{match:p,routeContext:{outlet:g,matches:E,isDataRoute:a!=null},children:O})};return a&&(p.route.ErrorBoundary||p.route.errorElement||b===0)?x.createElement(Zj,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):T()},null)}function ov(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function JR(e){let t=x.useContext(To);return Vt(t,ov(e)),t}function eO(e){let t=x.useContext(sh);return Vt(t,ov(e)),t}function tO(e){let t=x.useContext(aa);return Vt(t,ov(e)),t}function uv(e){let t=tO(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 nO(){return uv("useRouteId")}function rO(){var a;let e=x.useContext(lv),t=eO("useRouteError"),n=uv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function aO(){let{router:e}=JR("useNavigate"),t=uv("useNavigate"),n=x.useRef(!1);return $j(()=>{n.current=!0}),x.useCallback(async(s,u={})=>{na(n.current,Fj),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...u}))},[e,t])}var PS={};function Gj(e,t,n){!t&&!PS[e]&&(PS[e]=!0,na(!1,n))}x.memo(iO);function iO({routes:e,future:t,state:n,isStatic:a,onError:s}){return Hj(e,void 0,{state:n,isStatic:a,onError:s})}function lr({to:e,replace:t,state:n,relative:a}){Vt(Ao(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=x.useContext(Ur);na(!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:u}=x.useContext(aa),{pathname:c}=Sr(),f=Rn(),m=ih(e,sv(u),c,a==="path"),h=JSON.stringify(m);return x.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Ff(e){return GR(e.context)}function Mt(e){Vt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function sO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Vt(!Ao(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:f,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[f,s,u,c]);typeof n=="string"&&(n=_o(n));let{pathname:h="/",search:g="",hash:p="",state:b=null,key:w="default",unstable_mask:k}=n,j=x.useMemo(()=>{let C=oi(h,f);return C==null?null:{location:{pathname:C,search:g,hash:p,state:b,key:w,unstable_mask:k},navigationType:a}},[f,h,g,p,b,w,a,k]);return na(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Ur.Provider,{value:m},x.createElement(Ac.Provider,{children:t,value:j}))}function lO({children:e,location:t}){return VR(dy(e),t)}function dy(e,t=[]){let n=[];return x.Children.forEach(e,(a,s)=>{if(!x.isValidElement(a))return;let u=[...t,s];if(a.type===x.Fragment){n.push.apply(n,dy(a.props.children,u));return}Vt(a.type===Mt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Vt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.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=dy(a.props.children,u)),n.push(c)}),n}var Rf="get",Of="application/x-www-form-urlencoded";function lh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function oO(e){return lh(e)&&e.tagName.toLowerCase()==="button"}function uO(e){return lh(e)&&e.tagName.toLowerCase()==="form"}function cO(e){return lh(e)&&e.tagName.toLowerCase()==="input"}function dO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fO(e,t){return e.button===0&&(!t||t==="_self")&&!dO(e)}function fy(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 hO(e,t){let n=fy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(u=>{n.append(s,u)})}),n}var uf=null;function mO(){if(uf===null)try{new FormData(document.createElement("form"),0),uf=!1}catch{uf=!0}return uf}var pO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yp(e){return e!=null&&!pO.has(e)?(na(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Of}"`),null):e}function gO(e,t){let n,a,s,u,c;if(uO(e)){let f=e.getAttribute("action");a=f?oi(f,t):null,n=e.getAttribute("method")||Rf,s=Yp(e.getAttribute("enctype"))||Of,u=new FormData(e)}else if(oO(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?oi(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Rf,s=Yp(e.getAttribute("formenctype"))||Yp(f.getAttribute("enctype"))||Of,u=new FormData(f,e),!mO()){let{name:h,type:g,value:p}=e;if(g==="image"){let b=h?`${h}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else h&&u.append(h,p)}}else{if(lh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Rf,a=null,s=Of,c=e}return u&&s==="text/plain"&&(c=u,u=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function cv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function yO(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&oi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function vO(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function bO(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 xO(e,t,n){let a=await Promise.all(e.map(async s=>{let u=t.routes[s.route.id];if(u){let c=await vO(u,n);return c.links?c.links():[]}return[]}));return jO(a.flat(1).filter(bO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function US(e,t,n,a,s,u){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var g;return n[h].pathname!==m.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return u==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):u==="data"?t.filter((m,h)=>{var p;let g=a.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function wO(e,t,{includeHydrateFallback:n}={}){return SO(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let u=[s.module];return s.clientActionModule&&(u=u.concat(s.clientActionModule)),s.clientLoaderModule&&(u=u.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(u=u.concat(s.hydrateFallbackModule)),s.imports&&(u=u.concat(s.imports)),u}).flat(1))}function SO(e){return[...new Set(e)]}function kO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function jO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let u=JSON.stringify(kO(s));return n.has(u)||(n.add(u),a.push({key:u,link:s})),a},[])}function Vj(){let e=x.useContext(To);return cv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function EO(){let e=x.useContext(sh);return cv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var dv=x.createContext(void 0);dv.displayName="FrameworkContext";function Qj(){let e=x.useContext(dv);return cv(e,"You must render this element inside a <HydratedRouter> element"),e}function CO(e,t){let n=x.useContext(dv),[a,s]=x.useState(!1),[u,c]=x.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:p}=t,b=x.useRef(null);x.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=E=>{E.forEach(T=>{c(T.isIntersecting)})},C=new IntersectionObserver(j,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[e]),x.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{s(!0)},k=()=>{s(!1),c(!1)};return n?e!=="intent"?[u,b,{}]:[u,b,{onFocus:zu(f,w),onBlur:zu(m,k),onMouseEnter:zu(h,w),onMouseLeave:zu(g,k),onTouchStart:zu(p,w)}]:[!1,b,{}]}function zu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function NO({page:e,...t}){let{router:n}=Vj(),a=x.useMemo(()=>zj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?x.createElement(TO,{page:e,matches:a,...t}):null}function _O(e){let{manifest:t,routeModules:n}=Qj(),[a,s]=x.useState([]);return x.useEffect(()=>{let u=!1;return xO(e,t,n).then(c=>{u||s(c)}),()=>{u=!0}},[e,t,n]),a}function TO({page:e,matches:t,...n}){let a=Sr(),{future:s,manifest:u,routeModules:c}=Qj(),{basename:f}=Vj(),{loaderData:m,matches:h}=EO(),g=x.useMemo(()=>US(e,t,h,u,a,"data"),[e,t,h,u,a]),p=x.useMemo(()=>US(e,t,h,u,a,"assets"),[e,t,h,u,a]),b=x.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,C=!1;if(t.forEach(T=>{var D;let O=u.routes[T.route.id];!O||!O.hasLoader||(!g.some(P=>P.route.id===T.route.id)&&T.route.id in m&&((D=c[T.route.id])!=null&&D.shouldRevalidate)||O.hasClientLoader?C=!0:j.add(T.route.id))}),j.size===0)return[];let E=yO(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return C&&j.size>0&&E.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[E.pathname+E.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,u,g,t,e,c]),w=x.useMemo(()=>wO(p,u),[p,u]),k=_O(p);return x.createElement(x.Fragment,null,b.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),w.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:C})=>x.createElement("link",{key:j,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function AO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var RO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{RO&&(window.__reactRouterVersion="7.13.1")}catch{}function OO({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=x.useRef();s.current==null&&(s.current=uR({window:a,v5Compat:!0}));let u=s.current,[c,f]=x.useState({action:u.action,location:u.location}),m=x.useCallback(h=>{n===!1?f(h):x.startTransition(()=>f(h))},[n]);return x.useLayoutEffect(()=>u.listen(m),[u,m]),x.createElement(sO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:n})}var Kj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Oc=x.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:h,to:g,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},j){let{basename:C,navigator:E,unstable_useTransitions:T}=x.useContext(Ur),O=typeof g=="string"&&Kj.test(g),D=Lj(g,C);g=D.to;let P=qR(g,{relative:s}),z=Sr(),B=null;if(f){let ee=ih(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);C!=="/"&&(ee.pathname=ee.pathname==="/"?C:Ra([C,ee.pathname])),B=E.createHref(ee)}let[M,V,I]=CO(a,k),X=MO(g,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:T});function se(ee){t&&t(ee),ee.defaultPrevented||X(ee)}let Se=!(D.isExternal||u),Y=x.createElement("a",{...k,...I,href:(Se?B:void 0)||D.absoluteURL||P,onClick:Se?se:t,ref:AO(j,V),target:h,"data-discover":!O&&n==="render"?"true":void 0});return M&&!O?x.createElement(x.Fragment,null,Y,x.createElement(NO,{page:P})):Y});Oc.displayName="Link";var fv=x.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:u,to:c,viewTransition:f,children:m,...h},g){let p=Rc(c,{relative:h.relative}),b=Sr(),w=x.useContext(sh),{navigator:k,basename:j}=x.useContext(Ur),C=w!=null&&BO(p)&&f===!0,E=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,T=b.pathname,O=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(T=T.toLowerCase(),O=O?O.toLowerCase():null,E=E.toLowerCase()),O&&j&&(O=oi(O,j)||O);const D=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let P=T===E||!s&&T.startsWith(E)&&T.charAt(D)==="/",z=O!=null&&(O===E||!s&&O.startsWith(E)&&O.charAt(E.length)==="/"),B={isActive:P,isPending:z,isTransitioning:C},M=P?t:void 0,V;typeof a=="function"?V=a(B):V=[a,P?"active":null,z?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let I=typeof u=="function"?u(B):u;return x.createElement(Oc,{...h,"aria-current":M,className:V,ref:g,style:I,to:c,viewTransition:f},typeof m=="function"?m(B):m)});fv.displayName="NavLink";var zO=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:u,method:c=Rf,action:f,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:j}=x.useContext(Ur),C=PO(),E=UO(f,{relative:h}),T=c.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&Kj.test(f),D=P=>{if(m&&m(P),P.defaultPrevented)return;P.preventDefault();let z=P.nativeEvent.submitter,B=(z==null?void 0:z.getAttribute("formmethod"))||c,M=()=>C(z||P.currentTarget,{fetcherKey:t,method:B,navigate:n,replace:s,state:u,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b});j&&n!==!1?x.startTransition(()=>M()):M()};return x.createElement("form",{ref:k,method:T,action:E,onSubmit:a?m:D,...w,"data-discover":!O&&e==="render"?"true":void 0})});zO.displayName="Form";function DO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yj(e){let t=x.useContext(To);return Vt(t,DO(e)),t}function MO(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let g=Rn(),p=Sr(),b=Rc(e,{relative:c});return x.useCallback(w=>{if(fO(w,t)){w.preventDefault();let k=n!==void 0?n:oc(p)===oc(b),j=()=>g(e,{replace:k,unstable_mask:a,state:s,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?x.startTransition(()=>j()):j()}},[p,g,b,n,a,s,t,e,u,c,f,m,h])}function oh(e){na(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(fy(e)),n=x.useRef(!1),a=Sr(),s=x.useMemo(()=>hO(a.search,n.current?null:t.current),[a.search]),u=Rn(),c=x.useCallback((f,m)=>{const h=fy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,u("?"+h,m)},[u,s]);return[s,c]}var IO=0,LO=()=>`__${String(++IO)}__`;function PO(){let{router:e}=Yj("useSubmit"),{basename:t}=x.useContext(Ur),n=nO(),a=e.fetch,s=e.navigate;return x.useCallback(async(u,c={})=>{let{action:f,method:m,encType:h,formData:g,body:p}=gO(u,t);if(c.navigate===!1){let b=c.fetcherKey||LO();await a(b,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function UO(e,{relative:t}={}){let{basename:n}=x.useContext(Ur),a=x.useContext(aa);Vt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),u={...Rc(e||".",{relative:t})},c=Sr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(g=>g==="")){f.delete("index"),m.filter(p=>p).forEach(p=>f.append("index",p));let g=f.toString();u.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(u.pathname=u.pathname==="/"?n:Ra([n,u.pathname])),oc(u)}function BO(e,{relative:t}={}){let n=x.useContext(Uj);Vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Yj("useViewTransitionState"),s=Rc(e,{relative:t});if(!n.isTransitioning)return!1;let u=oi(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=oi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Bf(s.pathname,c)!=null||Bf(s.pathname,u)!=null}const FO="/api/v1";async function $O(e,t){const n=await fetch(`${FO}/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 Xj="/api/v1",hv="first-tree-hub:tokens";let hy=null;function Du(e){hy=e}function Ln(e){if(!hy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(hy)}${e}`}function my(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function uh(){const e=localStorage.getItem(hv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function py(e){localStorage.setItem(hv,JSON.stringify(e))}function Wj(){localStorage.removeItem(hv)}class zc extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Mu=null;async function qO(){const e=uh();return e!=null&&e.refreshToken?Jj(e.refreshToken):null}async function Jj(e){return Mu||(Mu=(async()=>{try{const t=await fetch(`${Xj}/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 py(a),a}catch{return null}finally{Mu=null}})(),Mu)}async function Iu(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(`${Xj}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},u=uh();let c=await s(u==null?void 0:u.accessToken);if(c.status===401&&(u!=null&&u.refreshToken)){const f=await Jj(u.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(Wj(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const g=JSON.parse(f);m=g.error??f,Array.isArray(g.details)&&(h=g.details.filter(p=>typeof p=="object"&&p!==null&&Array.isArray(p.path)))}catch{m=f}throw new zc(c.status,m,h)}if(c.status!==204)return await c.json()}const Ee={get:e=>Iu(e),post:(e,t)=>Iu(e,{method:"POST",body:t}),patch:(e,t)=>Iu(e,{method:"PATCH",body:t}),put:(e,t)=>Iu(e,{method:"PUT",body:t}),delete:e=>Iu(e,{method:"DELETE"})},mv="onboarding:joinPath",HO="onboarding:draft",gy="onboarding:step1Confirmed";function eE(){return typeof window>"u"?!1:window.sessionStorage.getItem(gy)==="1"}function ZO(e){typeof window>"u"||(e?window.sessionStorage.setItem(gy,"1"):window.sessionStorage.removeItem(gy))}const yy="onboarding:agentUuid";function GO(){return typeof window>"u"?null:window.sessionStorage.getItem(yy)}function VO(e){typeof window>"u"||(e?window.sessionStorage.setItem(yy,e):window.sessionStorage.removeItem(yy))}function tE(e){typeof window>"u"||window.sessionStorage.setItem(mv,e)}function nE(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(mv);return e==="solo"||e==="invite"?e:null}function QO(){typeof window>"u"||window.sessionStorage.removeItem(mv)}function KO(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function pv(e){return`${HO}:${e}`}function YO(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 XO(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(pv(e));if(!t)return null;try{return YO(JSON.parse(t))}catch{return null}}function WO(e,t){typeof window>"u"||window.sessionStorage.setItem(pv(e),JSON.stringify(t))}function JO(e){typeof window>"u"||window.sessionStorage.removeItem(pv(e))}function ez(){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 rE=x.createContext(null),vy="first-tree-hub:selectedOrganizationId";function tz(){try{return localStorage.getItem(vy)}catch{return null}}function Xp(e){try{e===null?localStorage.removeItem(vy):localStorage.setItem(vy,e)}catch{}}function nz({children:e}){const t=ln(),[n,a]=x.useState(()=>!!uh()),[s,u]=x.useState(null),[c,f]=x.useState([]),[m,h]=x.useState(()=>{const V=tz();return Du(V),V}),[g,p]=x.useState(null),[b,w]=x.useState(null),[k,j]=x.useState(!1),C=x.useCallback(()=>{Wj(),Xp(null),Du(null),t.clear(),ez(),a(!1),u(null),f([]),h(null),p(null),w(null),j(!1)},[t]),E=x.useCallback(async()=>{var V,I;try{const X=await Ee.get("/me");u(X.user??null);const se=X.memberships??[];f(se);const Se=((V=X.onboarding)==null?void 0:V.step)??null;p(Se),w(((I=X.onboarding)==null?void 0:I.dismissedAt)??null),Se==="completed"&&QO(),h(Y=>{var re;const ee=Y&&se.some(xe=>xe.organizationId===Y)?Y:null;if(ee)return Du(ee),ee;const H=X.defaultOrganizationId??((re=se[0])==null?void 0:re.organizationId)??null;return Xp(H),Du(H),H})}catch{}finally{j(!0)}},[]),T=x.useCallback(async(V,I)=>{const X=await $O(V,I);py({accessToken:X.accessToken,refreshToken:X.refreshToken}),a(!0),await E()},[E]),O=x.useCallback(async V=>{py(V),a(!0),await E()},[E]),D=x.useCallback(async V=>{Xp(V),Du(V),t.clear(),h(V),await E()},[E,t]),P=x.useRef(null);x.useEffect(()=>{P.current=b},[b]);const z=x.useCallback(async()=>{const V=P.current;w(new Date().toISOString());try{const I=await Ee.patch("/me/onboarding",{dismissed:!0});I!=null&&I.dismissedAt&&w(I.dismissedAt)}catch{w(V)}},[]),B=x.useCallback(async()=>{const V=P.current;w(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{w(V)}},[]);x.useEffect(()=>{n&&!s&&E()},[n,s,E]),x.useEffect(()=>{const V=()=>C();return window.addEventListener("auth:logout",V),()=>window.removeEventListener("auth:logout",V)},[C]);const M=x.useMemo(()=>c.length===0?null:c.find(I=>I.organizationId===m)??c[0]??null,[c,m]);return o.jsx(rE.Provider,{value:{isAuthenticated:n,meLoaded:k,user:s,memberships:c,currentMembership:M,organizationId:(M==null?void 0:M.organizationId)??null,memberId:(M==null?void 0:M.id)??null,role:(M==null?void 0:M.role)??null,agentId:(M==null?void 0:M.agentId)??null,onboardingStep:g,onboardingDismissedAt:b,dismissOnboarding:z,restoreOnboarding:B,login:T,adoptTokens:O,selectOrganization:D,refreshMe:E,logout:C},children:e})}function ot(){const e=x.useContext(rE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const rz="modulepreload",az=function(e){return"/"+e},BS={},iz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const 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=az(h),h in BS)return;BS[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":rz,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(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"&&u(f.reason);return t().catch(u)})},sz=x.lazy(()=>iz(()=>import("./index-D5RJDuFw.js"),[]).then(e=>({default:e.LandingPage}))),FS=()=>o.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function lz(){const{isAuthenticated:e,meLoaded:t}=ot(),n=Sr();return e?t?o.jsx(Ff,{}):o.jsx(FS,{}):n.pathname==="/"?o.jsx(x.Suspense,{fallback:o.jsx(FS,{}),children:o.jsx(sz,{})}):o.jsx(lr,{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 aE=(...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 oz=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 uz=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 $S=e=>{const t=uz(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 dz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
91
- * @license lucide-react v0.577.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const fz=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:u,iconNode:c,...f},m)=>x.createElement("svg",{ref:m,...cz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:aE("lucide",s),...!u&&!dz(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,g])=>x.createElement(h,g)),...Array.isArray(u)?u:[u]]));/**
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 gt=(e,t)=>{const n=x.forwardRef(({className:a,...s},u)=>x.createElement(fz,{ref:u,iconNode:t,className:aE(`lucide-${oz($S(e))}`,`lucide-${e}`,a),...s}));return n.displayName=$S(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 hz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],gv=gt("arrow-left",hz);/**
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 mz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],iE=gt("arrow-right",mz);/**
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 pz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],sE=gt("arrow-up",pz);/**
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 gz=[["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"}]],yz=gt("at-sign",gz);/**
121
- * @license lucide-react v0.577.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const vz=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],bz=gt("bell",vz);/**
126
- * @license lucide-react v0.577.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const xz=[["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"}]],wz=gt("bot",xz);/**
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 Sz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wr=gt("check",Sz);/**
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 kz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],yv=gt("chevron-down",kz);/**
141
- * @license lucide-react v0.577.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const jz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ez=gt("chevron-right",jz);/**
146
- * @license lucide-react v0.577.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const Cz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nz=gt("circle-check",Cz);/**
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=[["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"}]],ch=gt("copy",_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 Tz=[["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"}]],Az=gt("eye-off",Tz);/**
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 Rz=[["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"}]],lE=gt("eye",Rz);/**
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 Oz=[["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"}]],zz=gt("folder-tree",Oz);/**
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 Dz=[["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"}]],oE=gt("github",Dz);/**
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 Mz=[["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"}]],Iz=gt("layout-dashboard",Mz);/**
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 Lz=[["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"}]],by=gt("link-2",Lz);/**
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 Pz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],uE=gt("loader-circle",Pz);/**
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 Uz=[["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"}]],cE=gt("lock",Uz);/**
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 Bz=[["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"}]],Fz=gt("log-out",Bz);/**
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 $z=[["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"}]],vv=gt("message-square",$z);/**
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 qz=[["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"}]],Hz=gt("moon",qz);/**
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 Zz=[["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"}]],Gz=gt("paperclip",Zz);/**
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 Vz=[["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"}]],dh=gt("pencil",Vz);/**
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 Qz=[["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"}]],dE=gt("play",Qz);/**
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 Kz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ba=gt("plus",Kz);/**
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 Yz=[["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"}]],Xz=gt("refresh-cw",Yz);/**
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 Wz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bv=gt("search",Wz);/**
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 Jz=[["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"}]],eD=gt("sun",Jz);/**
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 tD=[["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"}]],uc=gt("trash-2",tD);/**
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 nD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ws=gt("triangle-alert",nD);/**
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 rD=[["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"}]],aD=gt("undo-2",rD);/**
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 iD=[["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"}]],fE=gt("user-plus",iD);/**
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 sD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vs=gt("x",sD);/**
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 lD=[["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"}]],oD=gt("zap",lD);function hE(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=hE(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function mE(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=hE(e))&&(a&&(a+=" "),a+=t);return a}const uD=(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},cD=(e,t)=>({classGroupId:e,validator:t}),pE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$f="-",qS=[],dD="arbitrary..",fD=e=>{const t=mD(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return hD(c);const f=c.split($f),m=f[0]===""&&f.length>1?1:0;return gE(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?uD(h,m):m:h||qS}return n[c]||qS}}},gE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],u=n.nextPart.get(s);if(u){const h=gE(e,t+1,u);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join($f):e.slice(t).join($f),m=c.length;for(let h=0;h<m;h++){const g=c[h];if(g.validator(f))return g.classGroupId}},hD=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?dD+a:void 0})(),mD=e=>{const{theme:t,classGroups:n}=e;return pD(n,t)},pD=(e,t)=>{const n=pE();for(const a in e){const s=e[a];xv(s,n,a,t)}return n},xv=(e,t,n,a)=>{const s=e.length;for(let u=0;u<s;u++){const c=e[u];gD(c,t,n,a)}},gD=(e,t,n,a)=>{if(typeof e=="string"){yD(e,t,n);return}if(typeof e=="function"){vD(e,t,n,a);return}bD(e,t,n,a)},yD=(e,t,n)=>{const a=e===""?t:yE(t,e);a.classGroupId=n},vD=(e,t,n,a)=>{if(xD(e)){xv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(cD(n,e))},bD=(e,t,n,a)=>{const s=Object.entries(e),u=s.length;for(let c=0;c<u;c++){const[f,m]=s[c];xv(m,yE(t,f),n,a)}},yE=(e,t)=>{let n=e;const a=t.split($f),s=a.length;for(let u=0;u<s;u++){const c=a[u];let f=n.nextPart.get(c);f||(f=pE(),n.nextPart.set(c,f)),n=f}return n},xD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(u,c)=>{n[u]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(u){let c=n[u];if(c!==void 0)return c;if((c=a[u])!==void 0)return s(u,c),c},set(u,c){u in n?n[u]=c:s(u,c)}}},xy="!",HS=":",SD=[],ZS=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),kD=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const u=[];let c=0,f=0,m=0,h;const g=s.length;for(let j=0;j<g;j++){const C=s[j];if(c===0&&f===0){if(C===HS){u.push(s.slice(m,j)),m=j+1;continue}if(C==="/"){h=j;continue}}C==="["?c++:C==="]"?c--:C==="("?f++:C===")"&&f--}const p=u.length===0?s:s.slice(m);let b=p,w=!1;p.endsWith(xy)?(b=p.slice(0,-1),w=!0):p.startsWith(xy)&&(b=p.slice(1),w=!0);const k=h&&h>m?h-m:void 0;return ZS(u,w,b,k)};if(t){const s=t+HS,u=a;a=c=>c.startsWith(s)?u(c.slice(s.length)):ZS(SD,!1,c,void 0,!0)}if(n){const s=a;a=u=>n({className:u,parseClassName:s})}return a},jD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let u=0;u<n.length;u++){const c=n[u],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}},ED=e=>({cache:wD(e.cacheSize),parseClassName:kD(e),sortModifiers:jD(e),...fD(e)}),CD=/\s+/,ND=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:u}=t,c=[],f=e.trim().split(CD);let m="";for(let h=f.length-1;h>=0;h-=1){const g=f[h],{isExternal:p,modifiers:b,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:j}=n(g);if(p){m=g+(m.length>0?" "+m:m);continue}let C=!!j,E=a(C?k.substring(0,j):k);if(!E){if(!C){m=g+(m.length>0?" "+m:m);continue}if(E=a(k),!E){m=g+(m.length>0?" "+m:m);continue}C=!1}const T=b.length===0?"":b.length===1?b[0]:u(b).join(":"),O=w?T+xy:T,D=O+E;if(c.indexOf(D)>-1)continue;c.push(D);const P=s(E,C);for(let z=0;z<P.length;++z){const B=P[z];c.push(O+B)}m=g+(m.length>0?" "+m:m)}return m},_D=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=vE(n))&&(s&&(s+=" "),s+=a);return s},vE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=vE(e[a]))&&(n&&(n+=" "),n+=t);return n},TD=(e,...t)=>{let n,a,s,u;const c=m=>{const h=t.reduce((g,p)=>p(g),e());return n=ED(h),a=n.cache.get,s=n.cache.set,u=f,f(m)},f=m=>{const h=a(m);if(h)return h;const g=ND(m,n);return s(m,g),g};return u=c,(...m)=>u(_D(...m))},AD=[],_n=e=>{const t=n=>n[e]||AD;return t.isThemeGetter=!0,t},bE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,RD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,OD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zD=/\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$/,DD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ID=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bi=e=>RD.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),Fi=e=>!!e&&Number.isInteger(Number(e)),Wp=e=>e.endsWith("%")&&tt(e.slice(0,-1)),ei=e=>OD.test(e),wE=()=>!0,LD=e=>zD.test(e)&&!DD.test(e),wv=()=>!1,PD=e=>MD.test(e),UD=e=>ID.test(e),BD=e=>!Te(e)&&!Ae(e),FD=e=>ds(e,jE,wv),Te=e=>bE.test(e),Os=e=>ds(e,EE,LD),GS=e=>ds(e,KD,tt),$D=e=>ds(e,NE,wE),qD=e=>ds(e,CE,wv),VS=e=>ds(e,SE,wv),HD=e=>ds(e,kE,UD),cf=e=>ds(e,_E,PD),Ae=e=>xE.test(e),Lu=e=>Js(e,EE),ZD=e=>Js(e,CE),QS=e=>Js(e,SE),GD=e=>Js(e,jE),VD=e=>Js(e,kE),df=e=>Js(e,_E,!0),QD=e=>Js(e,NE,!0),ds=(e,t,n)=>{const a=bE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Js=(e,t,n=!1)=>{const a=xE.exec(e);return a?a[1]?t(a[1]):n:!1},SE=e=>e==="position"||e==="percentage",kE=e=>e==="image"||e==="url",jE=e=>e==="length"||e==="size"||e==="bg-size",EE=e=>e==="length",KD=e=>e==="number",CE=e=>e==="family-name",NE=e=>e==="number"||e==="weight",_E=e=>e==="shadow",YD=()=>{const e=_n("color"),t=_n("font"),n=_n("text"),a=_n("font-weight"),s=_n("tracking"),u=_n("leading"),c=_n("breakpoint"),f=_n("container"),m=_n("spacing"),h=_n("radius"),g=_n("shadow"),p=_n("inset-shadow"),b=_n("text-shadow"),w=_n("drop-shadow"),k=_n("blur"),j=_n("perspective"),C=_n("aspect"),E=_n("ease"),T=_n("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...D(),Ae,Te],z=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],M=()=>[Ae,Te,m],V=()=>[Bi,"full","auto",...M()],I=()=>[Fi,"none","subgrid",Ae,Te],X=()=>["auto",{span:["full",Fi,Ae,Te]},Fi,Ae,Te],se=()=>[Fi,"auto",Ae,Te],Se=()=>["auto","min","max","fr",Ae,Te],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...M()],re=()=>[Bi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],xe=()=>[Bi,"screen","full","dvw","lvw","svw","min","max","fit",...M()],ze=()=>[Bi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],R=()=>[e,Ae,Te],L=()=>[...D(),QS,VS,{position:[Ae,Te]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",GD,FD,{size:[Ae,Te]}],Z=()=>[Wp,Lu,Os],K=()=>["","none","full",h,Ae,Te],ue=()=>["",tt,Lu,Os],we=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[tt,Wp,QS,VS],Ge=()=>["","none",k,Ae,Te],Be=()=>["none",tt,Ae,Te],bt=()=>["none",tt,Ae,Te],yt=()=>[tt,Ae,Te],ae=()=>[Bi,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ei],breakpoint:[ei],color:[wE],container:[ei],"drop-shadow":[ei],ease:["in","out","in-out"],font:[BD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ei],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ei],shadow:[ei],spacing:["px",tt],text:[ei],"text-shadow":[ei],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bi,Te,Ae,C]}],container:["container"],columns:[{columns:[tt,Te,Ae,f]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{"inset-s":V(),start:V()}],end:[{"inset-e":V(),end:V()}],"inset-bs":[{"inset-bs":V()}],"inset-be":[{"inset-be":V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Fi,"auto",Ae,Te]}],basis:[{basis:[Bi,"full","auto",f,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Bi,"auto","initial","none",Te]}],grow:[{grow:["",tt,Ae,Te]}],shrink:[{shrink:["",tt,Ae,Te]}],order:[{order:[Fi,"first","last","none",Ae,Te]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Se()}],"auto-rows":[{"auto-rows":Se()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:re()}],"inline-size":[{inline:["auto",...xe()]}],"min-inline-size":[{"min-inline":["auto",...xe()]}],"max-inline-size":[{"max-inline":["none",...xe()]}],"block-size":[{block:["auto",...ze()]}],"min-block-size":[{"min-block":["auto",...ze()]}],"max-block-size":[{"max-block":["none",...ze()]}],w:[{w:[f,"screen",...re()]}],"min-w":[{"min-w":[f,"screen","none",...re()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...re()]}],h:[{h:["screen","lh",...re()]}],"min-h":[{"min-h":["screen","lh","none",...re()]}],"max-h":[{"max-h":["screen","lh",...re()]}],"font-size":[{text:["base",n,Lu,Os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,QD,$D]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wp,Te]}],"font-family":[{font:[ZD,qD,t]}],"font-features":[{"font-features":[Te]}],"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,Ae,Te]}],"line-clamp":[{"line-clamp":[tt,"none",Ae,GS]}],leading:[{leading:[u,...M()]}],"list-image":[{"list-image":["none",Ae,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",Ae,Os]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[tt,"auto",Ae,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Te]}],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",Ae,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fi,Ae,Te],radial:["",Ae,Te],conic:[Fi,Ae,Te]},VD,HD]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Ae,Te]}],"outline-w":[{outline:["",tt,Lu,Os]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",g,df,cf]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",p,df,cf]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[tt,Os]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",b,df,cf]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[tt,Ae,Te]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"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":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"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":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"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":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"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":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"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":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"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":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[Ae,Te]}],"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":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"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":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Te]}],filter:[{filter:["","none",Ae,Te]}],blur:[{blur:Ge()}],brightness:[{brightness:[tt,Ae,Te]}],contrast:[{contrast:[tt,Ae,Te]}],"drop-shadow":[{"drop-shadow":["","none",w,df,cf]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",tt,Ae,Te]}],"hue-rotate":[{"hue-rotate":[tt,Ae,Te]}],invert:[{invert:["",tt,Ae,Te]}],saturate:[{saturate:[tt,Ae,Te]}],sepia:[{sepia:["",tt,Ae,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Te]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[tt,Ae,Te]}],"backdrop-contrast":[{"backdrop-contrast":[tt,Ae,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,Ae,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,Ae,Te]}],"backdrop-invert":[{"backdrop-invert":["",tt,Ae,Te]}],"backdrop-opacity":[{"backdrop-opacity":[tt,Ae,Te]}],"backdrop-saturate":[{"backdrop-saturate":[tt,Ae,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,Ae,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",Ae,Te]}],ease:[{ease:["linear","initial",E,Ae,Te]}],delay:[{delay:[tt,Ae,Te]}],animate:[{animate:["none",T,Ae,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ae,Te]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:bt()}],"scale-x":[{"scale-x":bt()}],"scale-y":[{"scale-y":bt()}],"scale-z":[{"scale-z":bt()}],"scale-3d":["scale-3d"],skew:[{skew:yt()}],"skew-x":[{"skew-x":yt()}],"skew-y":[{"skew-y":yt()}],transform:[{transform:[Ae,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",Ae,Te]}],"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":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",Ae,Te]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[tt,Lu,Os,GS]}],stroke:[{stroke:["none",...R()]}],"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"]}},XD=TD(YD);function Re(...e){return XD(mE(e))}function cc(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 TE(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function WD(e){return Ee.delete(`/clients/${encodeURIComponent(e)}`)}function Dc(){return Ee.get(Ln("/activity"))}function ss(){return Ee.get("/me/clients")}function Sv(e){return Ee.get(`/clients/${e}`)}function JD(e){return Ee.post(`/clients/${e}/disconnect`)}function e3(){return Ee.post("/me/connect-tokens")}const KS=e=>["agent-sessions",e];function t3(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 n3(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 r3(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function AE(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Ee.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function a3(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Ee.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var YS=1,i3=.9,s3=.8,l3=.17,Jp=.1,eg=.999,o3=.9999,u3=.99,c3=/[\\\/_+.#"@\[\(\{&]/,d3=/[\\\/_+.#"@\[\(\{&]/g,f3=/[\s-]/,RE=/[\s-]/g;function wy(e,t,n,a,s,u,c){if(u===t.length)return s===e.length?YS:u3;var f=`${s},${u}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(u),h=n.indexOf(m,s),g=0,p,b,w,k;h>=0;)p=wy(e,t,n,a,h+1,u+1,c),p>g&&(h===s?p*=YS:c3.test(e.charAt(h-1))?(p*=s3,w=e.slice(s,h-1).match(d3),w&&s>0&&(p*=Math.pow(eg,w.length))):f3.test(e.charAt(h-1))?(p*=i3,k=e.slice(s,h-1).match(RE),k&&s>0&&(p*=Math.pow(eg,k.length))):(p*=l3,s>0&&(p*=Math.pow(eg,h-s))),e.charAt(h)!==t.charAt(u)&&(p*=o3)),(p<Jp&&n.charAt(h-1)===a.charAt(u+1)||a.charAt(u+1)===a.charAt(u)&&n.charAt(h-1)!==a.charAt(u))&&(b=wy(e,t,n,a,h+1,u+2,c),b*Jp>p&&(p=b*Jp)),p>g&&(g=p),h=n.indexOf(m,h+1);return c[f]=g,g}function XS(e){return e.toLowerCase().replace(RE," ")}function h3(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,wy(e,t,XS(e),XS(t),0,0,{})}function as(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function WS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ls(...e){return t=>{let n=!1;const a=e.map(s=>{const u=WS(s,t);return!n&&typeof u=="function"&&(n=!0),u});if(n)return()=>{for(let s=0;s<a.length;s++){const u=a[s];typeof u=="function"?u():WS(e[s],null)}}}}function el(...e){return x.useCallback(ls(...e),e)}function m3(e,t){const n=x.createContext(t),a=u=>{const{children:c,...f}=u,m=x.useMemo(()=>f,Object.values(f));return o.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(u){const c=x.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${u}\` must be used within \`${e}\``)}return[a,s]}function p3(e,t=[]){let n=[];function a(u,c){const f=x.createContext(c),m=n.length;n=[...n,c];const h=p=>{var E;const{scope:b,children:w,...k}=p,j=((E=b==null?void 0:b[e])==null?void 0:E[m])||f,C=x.useMemo(()=>k,Object.values(k));return o.jsx(j.Provider,{value:C,children:w})};h.displayName=u+"Provider";function g(p,b){var j;const w=((j=b==null?void 0:b[e])==null?void 0:j[m])||f,k=x.useContext(w);if(k)return k;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${u}\``)}return[h,g]}const s=()=>{const u=n.map(c=>x.createContext(c));return function(f){const m=(f==null?void 0:f[e])||u;return x.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,g3(s,...t)]}function g3(...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(u){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const p=m(u)[`__scope${h}`];return{...f,...p}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var dc=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},y3=Wy[" useId ".trim().toString()]||(()=>{}),v3=0;function si(e){const[t,n]=x.useState(y3());return dc(()=>{n(a=>a??String(v3++))},[e]),t?`radix-${t}`:""}var b3=Wy[" useInsertionEffect ".trim().toString()]||dc;function x3({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,u,c]=w3({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const g=x.useRef(e!==void 0);x.useEffect(()=>{const p=g.current;p!==f&&console.warn(`${a} is changing from ${p?"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.`),g.current=f},[f,a])}const h=x.useCallback(g=>{var p;if(f){const b=S3(g)?g(e):g;b!==e&&((p=c.current)==null||p.call(c,b))}else u(g)},[f,e,u,c]);return[m,h]}function w3({defaultProp:e,onChange:t}){const[n,a]=x.useState(e),s=x.useRef(n),u=x.useRef(t);return b3(()=>{u.current=t},[t]),x.useEffect(()=>{var c;s.current!==n&&((c=u.current)==null||c.call(u,n),s.current=n)},[n,s]),[n,a,u]}function S3(e){return typeof e=="function"}var kv=pj();const k3=ah(kv);function OE(e){const t=j3(e),n=x.forwardRef((a,s)=>{const{children:u,...c}=a,f=x.Children.toArray(u),m=f.find(C3);if(m){const h=m.props.children,g=f.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return o.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return o.jsx(t,{...c,ref:s,children:u})});return n.displayName=`${e}.Slot`,n}function j3(e){const t=x.forwardRef((n,a)=>{const{children:s,...u}=n;if(x.isValidElement(s)){const c=_3(s),f=N3(u,s.props);return s.type!==x.Fragment&&(f.ref=a?ls(a,c):c),x.cloneElement(s,f)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E3=Symbol("radix.slottable");function C3(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E3}function N3(e,t){const n={...t};for(const a in t){const s=e[a],u=t[a];/^on[A-Z]/.test(a)?s&&u?n[a]=(...f)=>{const m=u(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...u}:a==="className"&&(n[a]=[s,u].filter(Boolean).join(" "))}return{...e,...n}}function _3(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 T3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ci=T3.reduce((e,t)=>{const n=OE(`Primitive.${t}`),a=x.forwardRef((s,u)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function A3(e,t){e&&kv.flushSync(()=>e.dispatchEvent(t))}function fc(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function R3(e,t=globalThis==null?void 0:globalThis.document){const n=fc(e);x.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var O3="DismissableLayer",Sy="dismissableLayer.update",z3="dismissableLayer.pointerDownOutside",D3="dismissableLayer.focusOutside",JS,zE=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DE=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:u,onInteractOutside:c,onDismiss:f,...m}=e,h=x.useContext(zE),[g,p]=x.useState(null),b=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=x.useState({}),k=el(t,B=>p(B)),j=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=j.indexOf(C),T=g?j.indexOf(g):-1,O=h.layersWithOutsidePointerEventsDisabled.size>0,D=T>=E,P=L3(B=>{const M=B.target,V=[...h.branches].some(I=>I.contains(M));!D||V||(s==null||s(B),c==null||c(B),B.defaultPrevented||f==null||f())},b),z=P3(B=>{const M=B.target;[...h.branches].some(I=>I.contains(M))||(u==null||u(B),c==null||c(B),B.defaultPrevented||f==null||f())},b);return R3(B=>{T===h.layers.size-1&&(a==null||a(B),!B.defaultPrevented&&f&&(B.preventDefault(),f()))},b),x.useEffect(()=>{if(g)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(JS=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(g)),h.layers.add(g),e1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=JS)}},[g,b,n,h]),x.useEffect(()=>()=>{g&&(h.layers.delete(g),h.layersWithOutsidePointerEventsDisabled.delete(g),e1())},[g,h]),x.useEffect(()=>{const B=()=>w({});return document.addEventListener(Sy,B),()=>document.removeEventListener(Sy,B)},[]),o.jsx(ci.div,{...m,ref:k,style:{pointerEvents:O?D?"auto":"none":void 0,...e.style},onFocusCapture:as(e.onFocusCapture,z.onFocusCapture),onBlurCapture:as(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:as(e.onPointerDownCapture,P.onPointerDownCapture)})});DE.displayName=O3;var M3="DismissableLayerBranch",I3=x.forwardRef((e,t)=>{const n=x.useContext(zE),a=x.useRef(null),s=el(t,a);return x.useEffect(()=>{const u=a.current;if(u)return n.branches.add(u),()=>{n.branches.delete(u)}},[n.branches]),o.jsx(ci.div,{...e,ref:s})});I3.displayName=M3;function L3(e,t=globalThis==null?void 0:globalThis.document){const n=fc(e),a=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const u=f=>{if(f.target&&!a.current){let m=function(){ME(z3,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",u)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",u),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function P3(e,t=globalThis==null?void 0:globalThis.document){const n=fc(e),a=x.useRef(!1);return x.useEffect(()=>{const s=u=>{u.target&&!a.current&&ME(D3,n,{originalEvent:u},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function e1(){const e=new CustomEvent(Sy);document.dispatchEvent(e)}function ME(e,t,n,{discrete:a}){const s=n.originalEvent.target,u=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?A3(s,u):s.dispatchEvent(u)}var tg="focusScope.autoFocusOnMount",ng="focusScope.autoFocusOnUnmount",t1={bubbles:!1,cancelable:!0},U3="FocusScope",IE=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:u,...c}=e,[f,m]=x.useState(null),h=fc(s),g=fc(u),p=x.useRef(null),b=el(t,j=>m(j)),w=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let j=function(O){if(w.paused||!f)return;const D=O.target;f.contains(D)?p.current=D:Hi(p.current,{select:!0})},C=function(O){if(w.paused||!f)return;const D=O.relatedTarget;D!==null&&(f.contains(D)||Hi(p.current,{select:!0}))},E=function(O){if(document.activeElement===document.body)for(const P of O)P.removedNodes.length>0&&Hi(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",C);const T=new MutationObserver(E);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",C),T.disconnect()}}},[a,f,w.paused]),x.useEffect(()=>{if(f){r1.add(w);const j=document.activeElement;if(!f.contains(j)){const E=new CustomEvent(tg,t1);f.addEventListener(tg,h),f.dispatchEvent(E),E.defaultPrevented||(B3(Z3(LE(f)),{select:!0}),document.activeElement===j&&Hi(f))}return()=>{f.removeEventListener(tg,h),setTimeout(()=>{const E=new CustomEvent(ng,t1);f.addEventListener(ng,g),f.dispatchEvent(E),E.defaultPrevented||Hi(j??document.body,{select:!0}),f.removeEventListener(ng,g),r1.remove(w)},0)}}},[f,h,g,w]);const k=x.useCallback(j=>{if(!n&&!a||w.paused)return;const C=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,E=document.activeElement;if(C&&E){const T=j.currentTarget,[O,D]=F3(T);O&&D?!j.shiftKey&&E===D?(j.preventDefault(),n&&Hi(O,{select:!0})):j.shiftKey&&E===O&&(j.preventDefault(),n&&Hi(D,{select:!0})):E===T&&j.preventDefault()}},[n,a,w.paused]);return o.jsx(ci.div,{tabIndex:-1,...c,ref:b,onKeyDown:k})});IE.displayName=U3;function B3(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Hi(a,{select:t}),document.activeElement!==n)return}function F3(e){const t=LE(e),n=n1(t,e),a=n1(t.reverse(),e);return[n,a]}function LE(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 n1(e,t){for(const n of e)if(!$3(n,{upTo:t}))return n}function $3(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 q3(e){return e instanceof HTMLInputElement&&"select"in e}function Hi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&q3(e)&&t&&e.select()}}var r1=H3();function H3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=a1(e,t),e.unshift(t)},remove(t){var n;e=a1(e,t),(n=e[0])==null||n.resume()}}}function a1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function Z3(e){return e.filter(t=>t.tagName!=="A")}var G3="Portal",PE=x.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,u]=x.useState(!1);dc(()=>u(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?k3.createPortal(o.jsx(ci.div,{...a,ref:t}),c):null});PE.displayName=G3;function V3(e,t){return x.useReducer((n,a)=>t[n][a]??n,e)}var fh=e=>{const{present:t,children:n}=e,a=Q3(t),s=typeof n=="function"?n({present:a.isPresent}):x.Children.only(n),u=el(a.ref,K3(s));return typeof n=="function"||a.isPresent?x.cloneElement(s,{ref:u}):null};fh.displayName="Presence";function Q3(e){const[t,n]=x.useState(),a=x.useRef(null),s=x.useRef(e),u=x.useRef("none"),c=e?"mounted":"unmounted",[f,m]=V3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const h=ff(a.current);u.current=f==="mounted"?h:"none"},[f]),dc(()=>{const h=a.current,g=s.current;if(g!==e){const b=u.current,w=ff(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(g&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),dc(()=>{if(t){let h;const g=t.ownerDocument.defaultView??window,p=w=>{const j=ff(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",h=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=w=>{w.target===t&&(u.current=ff(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(h),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:x.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function ff(e){return(e==null?void 0:e.animationName)||"none"}function K3(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rg=0;function Y3(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??i1()),document.body.insertAdjacentElement("beforeend",e[1]??i1()),rg++,()=>{rg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),rg--}},[])}function i1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Aa=function(){return Aa=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(t[u]=n[u])}return t},Aa.apply(this,arguments)};function UE(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 X3(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,u;a<s;a++)(u||!(a in t))&&(u||(u=Array.prototype.slice.call(t,0,a)),u[a]=t[a]);return e.concat(u||Array.prototype.slice.call(t))}var zf="right-scroll-bar-position",Df="width-before-scroll-bar",W3="with-scroll-bars-hidden",J3="--removed-body-scroll-bar-size";function ag(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function eM(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var tM=typeof window<"u"?x.useLayoutEffect:x.useEffect,s1=new WeakMap;function nM(e,t){var n=eM(null,function(a){return e.forEach(function(s){return ag(s,a)})});return tM(function(){var a=s1.get(n);if(a){var s=new Set(a),u=new Set(e),c=n.current;s.forEach(function(f){u.has(f)||ag(f,null)}),u.forEach(function(f){s.has(f)||ag(f,c)})}s1.set(n,e)},[e]),n}function rM(e){return e}function aM(e,t){t===void 0&&(t=rM);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(u){var c=t(u,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(u){for(a=!0;n.length;){var c=n;n=[],c.forEach(u)}n={push:function(f){return u(f)},filter:function(){return n}}},assignMedium:function(u){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(u),c=n}var m=function(){var g=c;c=[],g.forEach(u)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(g){c.push(g),h()},filter:function(g){return c=c.filter(g),n}}}};return s}function iM(e){e===void 0&&(e={});var t=aM(null);return t.options=Aa({async:!0,ssr:!1},e),t}var BE=function(e){var t=e.sideCar,n=UE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return x.createElement(a,Aa({},n))};BE.isSideCarExport=!0;function sM(e,t){return e.useMedium(t),BE}var FE=iM(),ig=function(){},hh=x.forwardRef(function(e,t){var n=x.useRef(null),a=x.useState({onScrollCapture:ig,onWheelCapture:ig,onTouchMoveCapture:ig}),s=a[0],u=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,g=e.enabled,p=e.shards,b=e.sideCar,w=e.noRelative,k=e.noIsolation,j=e.inert,C=e.allowPinchZoom,E=e.as,T=E===void 0?"div":E,O=e.gapMode,D=UE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=b,z=nM([n,t]),B=Aa(Aa({},D),s);return x.createElement(x.Fragment,null,g&&x.createElement(P,{sideCar:FE,removeScrollBar:h,shards:p,noRelative:w,noIsolation:k,inert:j,setCallbacks:u,allowPinchZoom:!!C,lockRef:n,gapMode:O}),c?x.cloneElement(x.Children.only(f),Aa(Aa({},B),{ref:z})):x.createElement(T,Aa({},B,{className:m,ref:z}),f))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Df,zeroRight:zf};var lM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function oM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lM();return t&&e.setAttribute("nonce",t),e}function uM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cM(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var dM=function(){var e=0,t=null;return{add:function(n){e==0&&(t=oM())&&(uM(t,n),cM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},fM=function(){var e=dM();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},$E=function(){var e=fM(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},hM={left:0,top:0,right:0,gap:0},sg=function(e){return parseInt(e||"",10)||0},mM=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[sg(n),sg(a),sg(s)]},pM=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hM;var t=mM(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])}},gM=$E(),eo="data-scroll-locked",yM=function(e,t,n,a){var s=e.left,u=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
276
- .`.concat(W3,` {
277
- overflow: hidden `).concat(a,`;
278
- padding-right: `).concat(f,"px ").concat(a,`;
279
- }
280
- body[`).concat(eo,`] {
281
- overflow: hidden `).concat(a,`;
282
- overscroll-behavior: contain;
283
- `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
284
- padding-left: `.concat(s,`px;
285
- padding-top: `).concat(u,`px;
286
- padding-right: `).concat(c,`px;
287
- margin-left:0;
288
- margin-top:0;
289
- margin-right: `).concat(f,"px ").concat(a,`;
290
- `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
291
- }
292
-
293
- .`).concat(zf,` {
294
- right: `).concat(f,"px ").concat(a,`;
295
- }
296
-
297
- .`).concat(Df,` {
298
- margin-right: `).concat(f,"px ").concat(a,`;
299
- }
300
-
301
- .`).concat(zf," .").concat(zf,` {
302
- right: 0 `).concat(a,`;
303
- }
304
-
305
- .`).concat(Df," .").concat(Df,` {
306
- margin-right: 0 `).concat(a,`;
307
- }
308
-
309
- body[`).concat(eo,`] {
310
- `).concat(J3,": ").concat(f,`px;
311
- }
312
- `)},l1=function(){var e=parseInt(document.body.getAttribute(eo)||"0",10);return isFinite(e)?e:0},vM=function(){x.useEffect(function(){return document.body.setAttribute(eo,(l1()+1).toString()),function(){var e=l1()-1;e<=0?document.body.removeAttribute(eo):document.body.setAttribute(eo,e.toString())}},[])},bM=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;vM();var u=x.useMemo(function(){return pM(s)},[s]);return x.createElement(gM,{styles:yM(u,!t,s,n?"":"!important")})},ky=!1;if(typeof window<"u")try{var hf=Object.defineProperty({},"passive",{get:function(){return ky=!0,!0}});window.addEventListener("test",hf,hf),window.removeEventListener("test",hf,hf)}catch{ky=!1}var Ul=ky?{passive:!1}:!1,xM=function(e){return e.tagName==="TEXTAREA"},qE=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xM(e)&&n[t]==="visible")},wM=function(e){return qE(e,"overflowY")},SM=function(e){return qE(e,"overflowX")},o1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=HE(e,a);if(s){var u=ZE(e,a),c=u[1],f=u[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},kM=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},jM=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},HE=function(e,t){return e==="v"?wM(t):SM(t)},ZE=function(e,t){return e==="v"?kM(t):jM(t)},EM=function(e,t){return e==="h"&&t==="rtl"?-1:1},CM=function(e,t,n,a,s){var u=EM(e,window.getComputedStyle(t).direction),c=u*a,f=n.target,m=t.contains(f),h=!1,g=c>0,p=0,b=0;do{if(!f)break;var w=ZE(e,f),k=w[0],j=w[1],C=w[2],E=j-C-u*k;(k||E)&&HE(e,f)&&(p+=E,b+=k);var T=f.parentNode;f=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(g&&Math.abs(p)<1||!g&&Math.abs(b)<1)&&(h=!0),h},mf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},u1=function(e){return[e.deltaX,e.deltaY]},c1=function(e){return e&&"current"in e?e.current:e},NM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_M=function(e){return`
313
- .block-interactivity-`.concat(e,` {pointer-events: none;}
314
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
315
- `)},TM=0,Bl=[];function AM(e){var t=x.useRef([]),n=x.useRef([0,0]),a=x.useRef(),s=x.useState(TM++)[0],u=x.useState($E)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=X3([e.lockRef.current],(e.shards||[]).map(c1),!0).filter(Boolean);return j.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=x.useCallback(function(j,C){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var E=mf(j),T=n.current,O="deltaX"in j?j.deltaX:T[0]-E[0],D="deltaY"in j?j.deltaY:T[1]-E[1],P,z=j.target,B=Math.abs(O)>Math.abs(D)?"h":"v";if("touches"in j&&B==="h"&&z.type==="range")return!1;var M=window.getSelection(),V=M&&M.anchorNode,I=V?V===z||V.contains(z):!1;if(I)return!1;var X=o1(B,z);if(!X)return!0;if(X?P=B:(P=B==="v"?"h":"v",X=o1(B,z)),!X)return!1;if(!a.current&&"changedTouches"in j&&(O||D)&&(a.current=P),!P)return!0;var se=a.current||P;return CM(se,C,j,se==="h"?O:D)},[]),m=x.useCallback(function(j){var C=j;if(!(!Bl.length||Bl[Bl.length-1]!==u)){var E="deltaY"in C?u1(C):mf(C),T=t.current.filter(function(P){return P.name===C.type&&(P.target===C.target||C.target===P.shadowParent)&&NM(P.delta,E)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var O=(c.current.shards||[]).map(c1).filter(Boolean).filter(function(P){return P.contains(C.target)}),D=O.length>0?f(C,O[0]):!c.current.noIsolation;D&&C.cancelable&&C.preventDefault()}}},[]),h=x.useCallback(function(j,C,E,T){var O={name:j,delta:C,target:E,should:T,shadowParent:RM(E)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(D){return D!==O})},1)},[]),g=x.useCallback(function(j){n.current=mf(j),a.current=void 0},[]),p=x.useCallback(function(j){h(j.type,u1(j),j.target,f(j,e.lockRef.current))},[]),b=x.useCallback(function(j){h(j.type,mf(j),j.target,f(j,e.lockRef.current))},[]);x.useEffect(function(){return Bl.push(u),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Ul),document.addEventListener("touchmove",m,Ul),document.addEventListener("touchstart",g,Ul),function(){Bl=Bl.filter(function(j){return j!==u}),document.removeEventListener("wheel",m,Ul),document.removeEventListener("touchmove",m,Ul),document.removeEventListener("touchstart",g,Ul)}},[]);var w=e.removeScrollBar,k=e.inert;return x.createElement(x.Fragment,null,k?x.createElement(u,{styles:_M(s)}):null,w?x.createElement(bM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const OM=sM(FE,AM);var GE=x.forwardRef(function(e,t){return x.createElement(hh,Aa({},e,{ref:t,sideCar:OM}))});GE.classNames=hh.classNames;var zM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fl=new WeakMap,pf=new WeakMap,gf={},lg=0,VE=function(e){return e&&(e.host||VE(e.parentNode))},DM=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=VE(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})},MM=function(e,t,n,a){var s=DM(t,Array.isArray(e)?e:[e]);gf[n]||(gf[n]=new WeakMap);var u=gf[n],c=[],f=new Set,m=new Set(s),h=function(p){!p||f.has(p)||(f.add(p),h(p.parentNode))};s.forEach(h);var g=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(b){if(f.has(b))g(b);else try{var w=b.getAttribute(a),k=w!==null&&w!=="false",j=(Fl.get(b)||0)+1,C=(u.get(b)||0)+1;Fl.set(b,j),u.set(b,C),c.push(b),j===1&&k&&pf.set(b,!0),C===1&&b.setAttribute(n,"true"),k||b.setAttribute(a,"true")}catch(E){console.error("aria-hidden: cannot operate on ",b,E)}})};return g(t),f.clear(),lg++,function(){c.forEach(function(p){var b=Fl.get(p)-1,w=u.get(p)-1;Fl.set(p,b),u.set(p,w),b||(pf.has(p)||p.removeAttribute(a),pf.delete(p)),w||p.removeAttribute(n)}),lg--,lg||(Fl=new WeakMap,Fl=new WeakMap,pf=new WeakMap,gf={})}},IM=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=zM(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),MM(a,s,n,"aria-hidden")):function(){return null}},mh="Dialog",[QE]=p3(mh),[LM,xa]=QE(mh),KE=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:u,modal:c=!0}=e,f=x.useRef(null),m=x.useRef(null),[h,g]=x3({prop:a,defaultProp:s??!1,onChange:u,caller:mh});return o.jsx(LM,{scope:t,triggerRef:f,contentRef:m,contentId:si(),titleId:si(),descriptionId:si(),open:h,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(p=>!p),[g]),modal:c,children:n})};KE.displayName=mh;var YE="DialogTrigger",PM=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(YE,n),u=el(t,s.triggerRef);return o.jsx(ci.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Cv(s.open),...a,ref:u,onClick:as(e.onClick,s.onOpenToggle)})});PM.displayName=YE;var jv="DialogPortal",[UM,XE]=QE(jv,{forceMount:void 0}),WE=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,u=xa(jv,t);return o.jsx(UM,{scope:t,forceMount:n,children:x.Children.map(a,c=>o.jsx(fh,{present:n||u.open,children:o.jsx(PE,{asChild:!0,container:s,children:c})}))})};WE.displayName=jv;var qf="DialogOverlay",JE=x.forwardRef((e,t)=>{const n=XE(qf,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,u=xa(qf,e.__scopeDialog);return u.modal?o.jsx(fh,{present:a||u.open,children:o.jsx(FM,{...s,ref:t})}):null});JE.displayName=qf;var BM=OE("DialogOverlay.RemoveScroll"),FM=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(qf,n);return o.jsx(GE,{as:BM,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(ci.div,{"data-state":Cv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Qs="DialogContent",eC=x.forwardRef((e,t)=>{const n=XE(Qs,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,u=xa(Qs,e.__scopeDialog);return o.jsx(fh,{present:a||u.open,children:u.modal?o.jsx($M,{...s,ref:t}):o.jsx(qM,{...s,ref:t})})});eC.displayName=Qs;var $M=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(null),s=el(t,n.contentRef,a);return x.useEffect(()=>{const u=a.current;if(u)return IM(u)},[]),o.jsx(tC,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:as(e.onCloseAutoFocus,u=>{var c;u.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:as(e.onPointerDownOutside,u=>{const c=u.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&u.preventDefault()}),onFocusOutside:as(e.onFocusOutside,u=>u.preventDefault())})}),qM=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(!1),s=x.useRef(!1);return o.jsx(tC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,u),u.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),u.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:u=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,u),u.defaultPrevented||(a.current=!0,u.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=u.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.current&&u.preventDefault()}})}),tC=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:u,...c}=e,f=xa(Qs,n),m=x.useRef(null),h=el(t,m);return Y3(),o.jsxs(o.Fragment,{children:[o.jsx(IE,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:u,children:o.jsx(DE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Cv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(HM,{titleId:f.titleId}),o.jsx(GM,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Ev="DialogTitle",nC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Ev,n);return o.jsx(ci.h2,{id:s.titleId,...a,ref:t})});nC.displayName=Ev;var rC="DialogDescription",aC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(rC,n);return o.jsx(ci.p,{id:s.descriptionId,...a,ref:t})});aC.displayName=rC;var iC="DialogClose",sC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(iC,n);return o.jsx(ci.button,{type:"button",...a,ref:t,onClick:as(e.onClick,()=>s.onOpenChange(!1))})});sC.displayName=iC;function Cv(e){return e?"open":"closed"}var lC="DialogTitleWarning",[MK,oC]=m3(lC,{contentName:Qs,titleName:Ev,docsSlug:"dialog"}),HM=({titleId:e})=>{const t=oC(lC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
316
-
317
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
318
-
319
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ZM="DialogDescriptionWarning",GM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oC(ZM).contentName}}.`;return x.useEffect(()=>{var u;const s=(u=e.current)==null?void 0:u.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},uC=KE,cC=WE,dC=JE,fC=eC,VM=nC,QM=aC,KM=sC,YM=Symbol.for("react.lazy"),Hf=Wy[" use ".trim().toString()];function XM(e){return typeof e=="object"&&e!==null&&"then"in e}function hC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===YM&&"_payload"in e&&XM(e._payload)}function mC(e){const t=JM(e),n=x.forwardRef((a,s)=>{let{children:u,...c}=a;hC(u)&&typeof Hf=="function"&&(u=Hf(u._payload));const f=x.Children.toArray(u),m=f.find(tI);if(m){const h=m.props.children,g=f.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return o.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return o.jsx(t,{...c,ref:s,children:u})});return n.displayName=`${e}.Slot`,n}var WM=mC("Slot");function JM(e){const t=x.forwardRef((n,a)=>{let{children:s,...u}=n;if(hC(s)&&typeof Hf=="function"&&(s=Hf(s._payload)),x.isValidElement(s)){const c=rI(s),f=nI(u,s.props);return s.type!==x.Fragment&&(f.ref=a?ls(a,c):c),x.cloneElement(s,f)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eI=Symbol("radix.slottable");function tI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eI}function nI(e,t){const n={...t};for(const a in t){const s=e[a],u=t[a];/^on[A-Z]/.test(a)?s&&u?n[a]=(...f)=>{const m=u(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...u}:a==="className"&&(n[a]=[s,u].filter(Boolean).join(" "))}return{...e,...n}}function rI(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 aI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],di=aI.reduce((e,t)=>{const n=mC(`Primitive.${t}`),a=x.forwardRef((s,u)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Pu='[cmdk-group=""]',og='[cmdk-group-items=""]',iI='[cmdk-group-heading=""]',pC='[cmdk-item=""]',d1=`${pC}:not([aria-disabled="true"])`,jy="cmdk-item-select",Zl="data-value",sI=(e,t,n)=>h3(e,t,n),gC=x.createContext(void 0),Mc=()=>x.useContext(gC),yC=x.createContext(void 0),Nv=()=>x.useContext(yC),vC=x.createContext(void 0),bC=x.forwardRef((e,t)=>{let n=Gl(()=>{var F,_;return{search:"",value:(_=(F=e.value)!=null?F:e.defaultValue)!=null?_:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Gl(()=>new Set),s=Gl(()=>new Map),u=Gl(()=>new Map),c=Gl(()=>new Set),f=xC(e),{label:m,children:h,value:g,onValueChange:p,filter:b,shouldFilter:w,loop:k,disablePointerSelection:j=!1,vimBindings:C=!0,...E}=e,T=si(),O=si(),D=si(),P=x.useRef(null),z=yI();Ks(()=>{if(g!==void 0){let F=g.trim();n.current.value=F,B.emit()}},[g]),Ks(()=>{z(6,Se)},[]);let B=x.useMemo(()=>({subscribe:F=>(c.current.add(F),()=>c.current.delete(F)),snapshot:()=>n.current,setState:(F,_,Z)=>{var K,ue,we,ve;if(!Object.is(n.current[F],_)){if(n.current[F]=_,F==="search")se(),I(),z(1,X);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(D);me?me.focus():(K=document.getElementById(T))==null||K.focus()}if(z(7,()=>{var me;n.current.selectedItemId=(me=Y())==null?void 0:me.id,B.emit()}),Z||z(5,Se),((ue=f.current)==null?void 0:ue.value)!==void 0){let me=_??"";(ve=(we=f.current).onValueChange)==null||ve.call(we,me);return}}B.emit()}},emit:()=>{c.current.forEach(F=>F())}}),[]),M=x.useMemo(()=>({value:(F,_,Z)=>{var K;_!==((K=u.current.get(F))==null?void 0:K.value)&&(u.current.set(F,{value:_,keywords:Z}),n.current.filtered.items.set(F,V(_,Z)),z(2,()=>{I(),B.emit()}))},item:(F,_)=>(a.current.add(F),_&&(s.current.has(_)?s.current.get(_).add(F):s.current.set(_,new Set([F]))),z(3,()=>{se(),I(),n.current.value||X(),B.emit()}),()=>{u.current.delete(F),a.current.delete(F),n.current.filtered.items.delete(F);let Z=Y();z(4,()=>{se(),(Z==null?void 0:Z.getAttribute("id"))===F&&X(),B.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{u.current.delete(F),s.current.delete(F)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:T,inputId:D,labelId:O,listInnerRef:P}),[]);function V(F,_){var Z,K;let ue=(K=(Z=f.current)==null?void 0:Z.filter)!=null?K:sI;return F?ue(F,n.current.search,_):0}function I(){if(!n.current.search||f.current.shouldFilter===!1)return;let F=n.current.filtered.items,_=[];n.current.filtered.groups.forEach(K=>{let ue=s.current.get(K),we=0;ue.forEach(ve=>{let me=F.get(ve);we=Math.max(me,we)}),_.push([K,we])});let Z=P.current;ee().sort((K,ue)=>{var we,ve;let me=K.getAttribute("id"),Ge=ue.getAttribute("id");return((we=F.get(Ge))!=null?we:0)-((ve=F.get(me))!=null?ve:0)}).forEach(K=>{let ue=K.closest(og);ue?ue.appendChild(K.parentElement===ue?K:K.closest(`${og} > *`)):Z.appendChild(K.parentElement===Z?K:K.closest(`${og} > *`))}),_.sort((K,ue)=>ue[1]-K[1]).forEach(K=>{var ue;let we=(ue=P.current)==null?void 0:ue.querySelector(`${Pu}[${Zl}="${encodeURIComponent(K[0])}"]`);we==null||we.parentElement.appendChild(we)})}function X(){let F=ee().find(Z=>Z.getAttribute("aria-disabled")!=="true"),_=F==null?void 0:F.getAttribute(Zl);B.setState("value",_||void 0)}function se(){var F,_,Z,K;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let we of a.current){let ve=(_=(F=u.current.get(we))==null?void 0:F.value)!=null?_:"",me=(K=(Z=u.current.get(we))==null?void 0:Z.keywords)!=null?K:[],Ge=V(ve,me);n.current.filtered.items.set(we,Ge),Ge>0&&ue++}for(let[we,ve]of s.current)for(let me of ve)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(we);break}n.current.filtered.count=ue}function Se(){var F,_,Z;let K=Y();K&&(((F=K.parentElement)==null?void 0:F.firstChild)===K&&((Z=(_=K.closest(Pu))==null?void 0:_.querySelector(iI))==null||Z.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function Y(){var F;return(F=P.current)==null?void 0:F.querySelector(`${pC}[aria-selected="true"]`)}function ee(){var F;return Array.from(((F=P.current)==null?void 0:F.querySelectorAll(d1))||[])}function H(F){let _=ee()[F];_&&B.setState("value",_.getAttribute(Zl))}function re(F){var _;let Z=Y(),K=ee(),ue=K.findIndex(ve=>ve===Z),we=K[ue+F];(_=f.current)!=null&&_.loop&&(we=ue+F<0?K[K.length-1]:ue+F===K.length?K[0]:K[ue+F]),we&&B.setState("value",we.getAttribute(Zl))}function xe(F){let _=Y(),Z=_==null?void 0:_.closest(Pu),K;for(;Z&&!K;)Z=F>0?pI(Z,Pu):gI(Z,Pu),K=Z==null?void 0:Z.querySelector(d1);K?B.setState("value",K.getAttribute(Zl)):re(F)}let ze=()=>H(ee().length-1),R=F=>{F.preventDefault(),F.metaKey?ze():F.altKey?xe(1):re(1)},L=F=>{F.preventDefault(),F.metaKey?H(0):F.altKey?xe(-1):re(-1)};return x.createElement(di.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:F=>{var _;(_=E.onKeyDown)==null||_.call(E,F);let Z=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||Z))switch(F.key){case"n":case"j":{C&&F.ctrlKey&&R(F);break}case"ArrowDown":{R(F);break}case"p":case"k":{C&&F.ctrlKey&&L(F);break}case"ArrowUp":{L(F);break}case"Home":{F.preventDefault(),H(0);break}case"End":{F.preventDefault(),ze();break}case"Enter":{F.preventDefault();let K=Y();if(K){let ue=new Event(jy);K.dispatchEvent(ue)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:bI},m),ph(e,F=>x.createElement(yC.Provider,{value:B},x.createElement(gC.Provider,{value:M},F))))}),lI=x.forwardRef((e,t)=>{var n,a;let s=si(),u=x.useRef(null),c=x.useContext(vC),f=Mc(),m=xC(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ks(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let g=wC(s,u,[e.value,e.children,u],e.keywords),p=Nv(),b=os(z=>z.value&&z.value===g.current),w=os(z=>h||f.filter()===!1?!0:z.search?z.filtered.items.get(s)>0:!0);x.useEffect(()=>{let z=u.current;if(!(!z||e.disabled))return z.addEventListener(jy,k),()=>z.removeEventListener(jy,k)},[w,e.onSelect,e.disabled]);function k(){var z,B;j(),(B=(z=m.current).onSelect)==null||B.call(z,g.current)}function j(){p.setState("value",g.current,!0)}if(!w)return null;let{disabled:C,value:E,onSelect:T,forceMount:O,keywords:D,...P}=e;return x.createElement(di.div,{ref:ls(u,t),...P,id:s,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!b,"data-disabled":!!C,"data-selected":!!b,onPointerMove:C||f.getDisablePointerSelection()?void 0:j,onClick:C?void 0:k},e.children)}),oI=x.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...u}=e,c=si(),f=x.useRef(null),m=x.useRef(null),h=si(),g=Mc(),p=os(w=>s||g.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ks(()=>g.group(c),[]),wC(c,f,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:c,forceMount:s}),[s]);return x.createElement(di.div,{ref:ls(f,t),...u,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ph(e,w=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},x.createElement(vC.Provider,{value:b},w))))}),uI=x.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=x.useRef(null),u=os(c=>!c.search);return!n&&!u?null:x.createElement(di.div,{ref:ls(s,t),...a,"cmdk-separator":"",role:"separator"})}),cI=x.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,u=Nv(),c=os(h=>h.search),f=os(h=>h.selectedItemId),m=Mc();return x.useEffect(()=>{e.value!=null&&u.setState("search",e.value)},[e.value]),x.createElement(di.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||u.setState("search",h.target.value),n==null||n(h.target.value)}})}),dI=x.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,u=x.useRef(null),c=x.useRef(null),f=os(h=>h.selectedItemId),m=Mc();return x.useEffect(()=>{if(c.current&&u.current){let h=c.current,g=u.current,p,b=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let w=h.offsetHeight;g.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(p),b.unobserve(h)}}},[]),x.createElement(di.div,{ref:ls(u,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},ph(e,h=>x.createElement("div",{ref:ls(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),fI=x.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:u,container:c,...f}=e;return x.createElement(uC,{open:n,onOpenChange:a},x.createElement(cC,{container:c},x.createElement(dC,{"cmdk-overlay":"",className:s}),x.createElement(fC,{"aria-label":e.label,"cmdk-dialog":"",className:u},x.createElement(bC,{ref:t,...f}))))}),hI=x.forwardRef((e,t)=>os(n=>n.filtered.count===0)?x.createElement(di.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mI=x.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...u}=e;return x.createElement(di.div,{ref:t,...u,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ph(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),kr=Object.assign(bC,{List:dI,Item:lI,Input:cI,Group:oI,Separator:uI,Dialog:fI,Empty:hI,Loading:mI});function pI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function xC(e){let t=x.useRef(e);return Ks(()=>{t.current=e}),t}var Ks=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Gl(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function os(e){let t=Nv(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function wC(e,t,n,a=[]){let s=x.useRef(),u=Mc();return Ks(()=>{var c;let f=(()=>{var h;for(let g of n){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(h=g.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());u.value(e,f,m),(c=t.current)==null||c.setAttribute(Zl,f),s.current=f}),s}var yI=()=>{let[e,t]=x.useState(),n=Gl(()=>new Map);return Ks(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function vI(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ph({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(vI(t),{ref:t.ref},n(t.props.children)):n(t)}var bI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Tn=uC,xI=cC,SC=x.forwardRef(({className:e,...t},n)=>o.jsx(dC,{ref:n,className:Re("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}));SC.displayName="DialogOverlay";const jn=x.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(xI,{children:[o.jsx(SC,{}),o.jsxs(fC,{ref:a,className:Re("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,o.jsxs(KM,{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:[o.jsx(Vs,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));jn.displayName="DialogContent";function In({className:e,...t}){return o.jsx("div",{className:Re("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function ur({className:e,...t}){return o.jsx("div",{className:Re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const An=x.forwardRef(({className:e,...t},n)=>o.jsx(VM,{ref:n,className:Re("text-subtitle leading-none tracking-tight",e),...t}));An.displayName="DialogTitle";const _v=x.forwardRef(({className:e,...t},n)=>o.jsx(QM,{ref:n,className:Re("text-body text-muted-foreground",e),...t}));_v.displayName="DialogDescription";const kC=x.forwardRef(({className:e,...t},n)=>o.jsx(kr,{ref:n,className:Re("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));kC.displayName=kr.displayName;function wI({open:e,onOpenChange:t,children:n}){return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsx(jn,{className:"overflow-hidden p-0 shadow-lg",children:o.jsx(kC,{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 jC=x.forwardRef(({className:e,...t},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(bv,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(kr.Input,{ref:n,className:Re("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})]}));jC.displayName=kr.Input.displayName;const EC=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.List,{ref:n,className:Re("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));EC.displayName=kr.List.displayName;const CC=x.forwardRef((e,t)=>o.jsx(kr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));CC.displayName=kr.Empty.displayName;const Mf=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Group,{ref:n,className:Re("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}));Mf.displayName=kr.Group.displayName;const Ey=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Separator,{ref:n,className:Re("-mx-1 h-px bg-border",e),...t}));Ey.displayName=kr.Separator.displayName;const If=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Item,{ref:n,className:Re("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}));If.displayName=kr.Item.displayName;function Ic(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Ee.get(Ln(`/agents${n?`?${n}`:""}`))}function Tv(){return Ee.get("/me/managed-agents")}function SI(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function kI(e){return Ee.post(Ln("/agents"),e)}function jI(e){return Ee.get(Ln(`/agents/names/${encodeURIComponent(e)}/availability`))}function f1(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function EI(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function CI(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function NI(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function _I(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function TI(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function gh(){const{data:e}=Qe({queryKey:["agents","name-map"],queryFn:()=>Ic({limit:100}),staleTime:3e4}),{data:t}=Qe({queryKey:["managed-agents","name-map"],queryFn:Tv,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Av(){const{data:e}=Qe({queryKey:["agents","name-map"],queryFn:()=>Ic({limit:100}),staleTime:3e4}),{data:t}=Qe({queryKey:["managed-agents","name-map"],queryFn:Tv,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const AI=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function RI({open:e,onOpenChange:t}){const n=Rn(),a=gh(),{data:s}=Qe({queryKey:["activity"],queryFn:Dc,enabled:e,staleTime:3e4}),u=(s==null?void 0:s.agents)??[],f=Qe({queryKey:["palette-sessions",u.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const g of u)try{const p=await AE(g.agentId);for(const b of p)h.push({agentId:g.agentId,session:b})}catch{}return h},enabled:e&&u.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return o.jsxs(wI,{open:e,onOpenChange:t,children:[o.jsx(jC,{placeholder:"Jump to agent, chat, or page…"}),o.jsxs(EC,{children:[o.jsx(CC,{children:"No results"}),u.length>0&&o.jsx(Mf,{heading:"Agents",children:u.map(h=>{const g=a(h.agentId);return o.jsxs(If,{value:`agent ${g} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[o.jsx(wz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{className:"flex-1 truncate",children:g}),o.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Ey,{}),o.jsx(Mf,{heading:"Chats",children:f.map(({agentId:h,session:g})=>{const p=a(h);return o.jsxs(If,{value:`chat ${p} ${g.chatId}`,onSelect:()=>m(`/?a=${h}&c=${g.chatId}`),children:[o.jsx(vv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{className:"flex-1 truncate",children:p}),o.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:g.chatId.slice(0,8)})]},`${h}-${g.chatId}`)})})]}),o.jsx(Ey,{}),o.jsx(Mf,{heading:"Pages",children:AI.map(h=>o.jsxs(If,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[o.jsx(Iz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{children:h.label})]},h.path))})]})]})}function OI(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function zI(){var a;const{user:e}=ot(),{data:t}=Qe({queryKey:["clients"],queryFn:ss,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=OI(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const DI=160;function MI(){const e=Rn(),{rows:t,firstHostname:n}=zI();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 o.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:[o.jsx(II,{}),a?o.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[o.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):o.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[o.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:DI,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),o.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function II(){return o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),o.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 Lc(e){return o.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),o.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),o.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),o.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),o.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),o.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),o.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),o.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),o.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),o.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function h1(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ee.get(Ln(`/notifications${n?`?${n}`:""}`))}function LI(e){return Ee.post(Ln(`/notifications/${e}/read`))}function PI(){return Ee.post(Ln("/notifications/read-all"))}const UI={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 BI(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function FI({notification:e,onClick:t,clickable:n}){const a=(UI[e.type]??e.type).toString(),s=BI(e.severity),u=n??!0;return o.jsxs("button",{type:"button",onClick:t,className:Re("w-full text-left transition-colors text-body",u?"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=>{u&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[o.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),o.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:cc(e.createdAt)})]}),o.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function $I(){var w;const[e,t]=x.useState(!1),[n,a]=x.useState(null),s=x.useRef(null),u=Rn(),c=ln(),{data:f}=Qe({queryKey:["notifications","bell"],queryFn:()=>h1({limit:8}),refetchInterval:1e4}),{data:m}=Qe({queryKey:["notifications","unread-count"],queryFn:()=>h1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,g=h>0,p=x.useCallback(async k=>{k.read||(LI(k.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),k.agentId&&k.chatId?u(`/?a=${k.agentId}&c=${k.chatId}`):k.agentId&&u(`/?a=${k.agentId}`)},[u,c]),b=x.useCallback(async()=>{a(null);try{await PI(),await c.invalidateQueries({queryKey:["notifications"]})}catch(k){a(k instanceof Error?k.message:"Failed to mark all as read")}},[c]);return o.jsxs("div",{className:"relative",children:[o.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:[o.jsx(bz,{className:"h-4 w-4"}),g&&o.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&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),o.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:[o.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[o.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),g&&o.jsx("button",{type:"button",onClick:b,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&o.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}),o.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?o.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(k=>o.jsx(FI,{notification:k,clickable:!!k.agentId,onClick:()=>p(k)},k.id))})]})]})]})}function qI(){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 HI(){const[e,t]=x.useState(qI);return x.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),o.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"?o.jsx(eD,{className:"h-4 w-4"}):o.jsx(Hz,{className:"h-4 w-4"})})}function ZI(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function m1({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?o.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):o.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:o.jsx("span",{className:"text-subtitle font-semibold",children:ZI(t)})})}const p1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,g1=mE,GI=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return g1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:u}=t,c=Object.keys(s).map(h=>{const g=n==null?void 0:n[h],p=u==null?void 0:u[h];if(g===null)return null;const b=p1(g)||p1(p);return s[h][b]}),f=n&&Object.entries(n).reduce((h,g)=>{let[p,b]=g;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:b,...w}=g;return Object.entries(w).every(k=>{let[j,C]=k;return Array.isArray(C)?C.includes({...u,...f}[j]):{...u,...f}[j]===C})?[...h,p,b]:h},[]);return g1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},VI=GI("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"}}),pe=x.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},u)=>{const c=a?WM:"button";return o.jsx(c,{className:Re(VI({variant:t,size:n,className:e})),ref:u,...s})});pe.displayName="Button";const $t=x.forwardRef(({className:e,type:t,...n},a)=>o.jsx("input",{type:t,className:Re("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}));$t.displayName="Input";function QI({action:e,onClose:t}){const n=e!==null;return o.jsx(Tn,{open:n,onOpenChange:a=>!a&&t(),children:o.jsxs(jn,{children:[o.jsxs(In,{children:[o.jsx(An,{children:e==="join"?"Join a team":"Create a new team"}),o.jsx(_v,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&o.jsx(YI,{onDone:t}),e==="join"&&o.jsx(XI,{onDone:t})]})})}function KI(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function YI({onDone:e}){const{adoptTokens:t}=ot(),n=Rn(),[a,s]=x.useState(""),[u,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{g.preventDefault();const p=a.trim();if(p){m(!0),c(null);try{const b=await Ee.post("/me/organizations",{name:KI(p),displayName:p});await t(b.tokens),e(),n("/",{replace:!0})}catch(b){c(b instanceof Error?b.message:"Failed to create team")}finally{m(!1)}}};return o.jsxs("form",{className:"space-y-3",onSubmit:h,children:[u&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:u}),o.jsx($t,{id:"team-display-name","aria-label":"Team name",value:a,onChange:g=>s(g.target.value),placeholder:"Acme Robotics",autoFocus:!0}),o.jsx(pe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function XI({onDone:e}){const{adoptTokens:t}=ot(),n=Rn(),[a,s]=x.useState(""),[u,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{if(g.preventDefault(),!!a.trim()){m(!0),c(null);try{const p=a.trim(),b=/\/invite\/([^/?#]+)/.exec(p),w=(b==null?void 0:b[1])??p,k=await Ee.post("/me/organizations/join",{token:w});await t(k.tokens),e(),n("/",{replace:!0})}catch(p){c(p instanceof Error?p.message:"Failed to join team")}finally{m(!1)}}};return o.jsxs("form",{className:"space-y-3",onSubmit:h,children:[u&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:u}),o.jsx($t,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:g=>s(g.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),o.jsx(pe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function WI(){var P,z;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=ot(),u=Rn(),[c,f]=x.useState([]),[m,h]=x.useState(!1),[g,p]=x.useState(null),b=x.useRef(null);x.useEffect(()=>{(async()=>{try{const B=await Ee.get("/me/organizations");f(B)}catch{}})()},[]),x.useEffect(()=>{const B=V=>{m&&b.current&&!b.current.contains(V.target)&&h(!1)},M=V=>{m&&V.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",B),window.addEventListener("keydown",M),()=>{window.removeEventListener("mousedown",B),window.removeEventListener("keydown",M)}},[m]);const w=(n==null?void 0:n.displayName)??"User",k=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,C=c.find(B=>B.id===e)??null,E=(C==null?void 0:C.role)??(t==="admin"||t==="member"?t:null),T=async B=>{if(B===e){h(!1);return}try{await a(B),h(!1),u("/",{replace:!0})}catch{}},O=()=>{h(!1),p("create")},D=()=>{h(!1),p("join")};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:b,className:"relative","data-testid":"user-menu",children:[o.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:o.jsx(m1,{src:j,name:w,size:28})}),m&&o.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[o.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[o.jsx(m1,{src:j,name:w,size:32}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),k&&k!==w&&o.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",k]})]})]}),c.length>0&&o.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[o.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?o.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[o.jsx("span",{style:{width:14,display:"inline-flex"},children:o.jsx(wr,{className:"h-3.5 w-3.5"})}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:(P=c[0])==null?void 0:P.displayName}),o.jsx(y1,{role:((z=c[0])==null?void 0:z.role)??E})]}):o.jsx("div",{children:c.map(B=>o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void T(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:[o.jsx("span",{style:{width:14,display:"inline-flex"},children:B.id===e?o.jsx(wr,{className:"h-3.5 w-3.5"}):null}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.displayName}),o.jsx(y1,{role:B.role})]},B.id))})]}),o.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[o.jsxs("button",{type:"button",role:"menuitem",onClick:O,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[o.jsx(ba,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Create new team"})]}),o.jsxs("button",{type:"button",role:"menuitem",onClick:D,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:[o.jsx(fE,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Join with invite link"})]})]}),o.jsx("div",{className:"py-1",children:o.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:[o.jsx(Fz,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Sign out"})]})})]})]}),o.jsx(QI,{action:g,onClose:()=>p(null)})]})}function y1({role:e}){return e!=="admin"&&e!=="member"?null:o.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 JI=[{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 e4(){const[e,t]=x.useState(!1),n=Sr(),a=n.pathname==="/"||n.search.includes("a=");return x.useEffect(()=>{const s=u=>{(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),o.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[o.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:[o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[o.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[o.jsx(Lc,{width:16,height:18,style:{color:"var(--fg)"}}),o.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),o.jsx(MI,{})]}),o.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:JI.map(s=>o.jsx(fv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:u})=>Re("inline-flex items-center transition-colors",u?"":"hover:text-[var(--fg)]"),children:({isActive:u})=>o.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:u?"var(--fg)":"var(--fg-3)",background:u?"var(--bg-hover)":"transparent"},children:[s.label,u&&o.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),o.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[o.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:[o.jsx(bv,{className:"h-4 w-4"}),o.jsx("span",{children:"Jump to…"}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),o.jsx($I,{}),o.jsx(HI,{}),o.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),o.jsx(WI,{})]})]}),o.jsx(RI,{open:e,onOpenChange:t}),a?o.jsx(Ff,{}):o.jsx("main",{className:"flex-1 overflow-auto",children:o.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:o.jsx(Ff,{})})})]})}const NC=x.createContext(null),t4=5e3;function n4({children:e}){const[t,n]=x.useState([]),a=x.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),u={addToast:x.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return o.jsxs(NC.Provider,{value:u,children:[e,o.jsx(r4,{toasts:t,onDismiss:a})]})}function Pc(){const e=x.useContext(NC);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function r4({toasts:e,onDismiss:t}){return e.length===0?null:o.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=>o.jsx(a4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function a4({toast:e,onDismiss:t}){const n=x.useRef(t);return n.current=t,x.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??t4,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),o.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:[o.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[o.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?o.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?o.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]}),o.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:o.jsx(Vs,{className:"h-4 w-4"})})]})}function ce(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,g=Object.keys(h);for(let p=0;p<g.length;p++){const b=g[p];b in f||(f[b]=h[b].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class u extends s{}Object.defineProperty(u,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new u:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class to extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _C extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const TC={};function us(e){return TC}function AC(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 Cy(e,t){return typeof t=="bigint"?t.toString():t}function yh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Rv(e){return e==null}function Ov(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function i4(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 u=n>s?n:s,c=Number.parseInt(e.toFixed(u).replace(".","")),f=Number.parseInt(t.toFixed(u).replace(".",""));return c%f/10**u}const v1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==v1)return a===void 0&&(a=v1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function tl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fs(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function b1(e){return JSON.stringify(e)}function s4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const RC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const l4=yh(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function bo(e){if(hc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(hc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function OC(e){return bo(e)?{...e}:Array.isArray(e)?[...e]:e}const o4=new Set(["string","number","symbol"]);function xo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hs(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 De(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 u4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const c4={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 d4(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 u=fs(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=n.shape[f])}return tl(this,"shape",c),c},checks:[]});return hs(e,u)}function f4(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 u=fs(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return tl(this,"shape",c),c},checks:[]});return hs(e,u)}function h4(e,t){if(!bo(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const u=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(u,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=fs(e._zod.def,{get shape(){const u={...e._zod.def.shape,...t};return tl(this,"shape",u),u}});return hs(e,s)}function m4(e,t){if(!bo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return tl(this,"shape",a),a}});return hs(e,n)}function p4(e,t){const n=fs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return tl(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return hs(e,n)}function g4(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=fs(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return tl(this,"shape",m),m},checks:[]});return hs(t,c)}function y4(e,t,n){const a=fs(t._zod.def,{get shape(){const s=t._zod.def.shape,u={...s};if(n)for(const c in n){if(!(c in u))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(u[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)u[c]=new e({type:"nonoptional",innerType:s[c]});return tl(this,"shape",u),u}});return hs(t,a)}function Yl(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function Xl(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function yf(e){return typeof e=="string"?e:e==null?void 0:e.message}function cs(e,t,n){var s,u,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const g=yf((c=(u=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:u.error)==null?void 0:c.call(u,e))??yf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??yf((m=n.customError)==null?void 0:m.call(n,e))??yf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=g}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function zv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function mc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const zC=(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,Cy,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},DC=ce("$ZodError",zC),MC=ce("$ZodError",zC,{Parent:Error});function v4(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 b4(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const u of s.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>a({issues:c}));else if(u.code==="invalid_key")a({issues:u.issues});else if(u.code==="invalid_element")a({issues:u.issues});else if(u.path.length===0)n._errors.push(t(u));else{let c=n,f=0;for(;f<u.path.length;){const m=u.path[f];f===u.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(u))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Dv=e=>(t,n,a,s)=>{const u=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},u);if(c instanceof Promise)throw new to;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>cs(m,u,us())));throw RC(f,s==null?void 0:s.callee),f}return c.value},Mv=e=>async(t,n,a,s)=>{const u=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>cs(m,u,us())));throw RC(f,s==null?void 0:s.callee),f}return c.value},vh=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},u=t._zod.run({value:n,issues:[]},s);if(u instanceof Promise)throw new to;return u.issues.length?{success:!1,error:new(e??DC)(u.issues.map(c=>cs(c,s,us())))}:{success:!0,data:u.value}},x4=vh(MC),bh=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},s);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(c=>cs(c,s,us())))}:{success:!0,data:u.value}},w4=bh(MC),S4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Dv(e)(t,n,s)},k4=e=>(t,n,a)=>Dv(e)(t,n,a),j4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Mv(e)(t,n,s)},E4=e=>async(t,n,a)=>Mv(e)(t,n,a),C4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},N4=e=>(t,n,a)=>vh(e)(t,n,a),_4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return bh(e)(t,n,s)},T4=e=>async(t,n,a)=>bh(e)(t,n,a),A4=/^[cC][^\s-]{8,}$/,R4=/^[0-9a-z]+$/,O4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,z4=/^[0-9a-vA-V]{20}$/,D4=/^[A-Za-z0-9]{27}$/,M4=/^[a-zA-Z0-9_-]{21}$/,I4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,L4=/^([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})$/,x1=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)$/,P4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,U4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function B4(){return new RegExp(U4,"u")}const F4=/^(?:(?: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])$/,$4=/^(([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}|:))$/,q4=/^((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])$/,H4=/^(([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])$/,Z4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,IC=/^[A-Za-z0-9_-]*$/,G4=/^\+[1-9]\d{6,14}$/,LC="(?:(?:\\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])))",V4=new RegExp(`^${LC}$`);function PC(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 Q4(e){return new RegExp(`^${PC(e)}$`)}function K4(e){const t=PC({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(`^${LC}T(?:${a})$`)}const Y4=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}$`)},X4=/^-?\d+$/,UC=/^-?\d+(?:\.\d+)?$/,W4=/^(?:true|false)$/i,J4=/^null$/i,e5=/^[^A-Z]*$/,t5=/^[^a-z]*$/,jr=ce("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),BC={number:"number",bigint:"bigint",object:"date"},FC=ce("$ZodCheckLessThan",(e,t)=>{jr.init(e,t);const n=BC[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,u=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<u&&(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})}}),$C=ce("$ZodCheckGreaterThan",(e,t)=>{jr.init(e,t);const n=BC[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,u=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>u&&(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})}}),n5=ce("$ZodCheckMultipleOf",(e,t)=>{jr.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):i4(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})}}),r5=ce("$ZodCheckNumberFormat",(e,t)=>{var c;jr.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[s,u]=c4[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=u,n&&(m.pattern=X4)}),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>u&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!t.abort})}}),a5=ce("$ZodCheckMaxLength",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Rv(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=zv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),i5=ce("$ZodCheckMinLength",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Rv(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=zv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),s5=ce("$ZodCheckLengthEquals",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Rv(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,u=s.length;if(u===t.length)return;const c=zv(s),f=u>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),xh=ce("$ZodCheckStringFormat",(e,t)=>{var n,a;jr.init(e,t),e._zod.onattach.push(s=>{const u=s._zod.bag;u.format=t.format,t.pattern&&(u.patterns??(u.patterns=new Set),u.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=()=>{})}),l5=ce("$ZodCheckRegex",(e,t)=>{xh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),o5=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e5),xh.init(e,t)}),u5=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t5),xh.init(e,t)}),c5=ce("$ZodCheckIncludes",(e,t)=>{jr.init(e,t);const n=xo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const u=s._zod.bag;u.patterns??(u.patterns=new Set),u.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})}}),d5=ce("$ZodCheckStartsWith",(e,t)=>{jr.init(e,t);const n=new RegExp(`^${xo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),f5=ce("$ZodCheckEndsWith",(e,t)=>{jr.init(e,t);const n=new RegExp(`.*${xo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),h5=ce("$ZodCheckOverwrite",(e,t)=>{jr.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(`
320
- `).filter(c=>c),s=Math.min(...a.map(c=>c.length-c.trimStart().length)),u=a.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of u)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(u=>` ${u}`)];return new t(...n,s.join(`
321
- `))}}const p5={major:4,minor:3,patch:6},Qt=ce("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=p5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const u of a)for(const c of u._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 u=(f,m,h)=>{let g=Yl(f),p;for(const b of m){if(b._zod.def.when){if(!b._zod.def.when(f))continue}else if(g)continue;const w=f.issues.length,k=b._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new to;if(p||k instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await k,f.issues.length!==w&&(g||(g=Yl(f,w)))});else{if(f.issues.length===w)continue;g||(g=Yl(f,w))}}return p?p.then(()=>f):f},c=(f,m,h)=>{if(Yl(f))return f.aborted=!0,f;const g=u(m,a,h);if(g instanceof Promise){if(h.async===!1)throw new to;return g.then(p=>e._zod.parse(p,h))}return e._zod.parse(g,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const g=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return g instanceof Promise?g.then(p=>c(p,f,m)):c(g,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new to;return h.then(g=>u(g,a,m))}return u(h,a,m)}}Ct(e,"~standard",()=>({validate:u=>{var c;try{const f=x4(e,u);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return w4(e,u).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Iv=ce("$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()??Y4(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=ce("$ZodStringFormat",(e,t)=>{xh.init(e,t),Iv.init(e,t)}),g5=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=L4),Kt.init(e,t)}),y5=ce("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=x1(a))}else t.pattern??(t.pattern=x1());Kt.init(e,t)}),v5=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=P4),Kt.init(e,t)}),b5=ce("$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})}}}),x5=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=B4()),Kt.init(e,t)}),w5=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=M4),Kt.init(e,t)}),S5=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=A4),Kt.init(e,t)}),k5=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=R4),Kt.init(e,t)}),j5=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=O4),Kt.init(e,t)}),E5=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=z4),Kt.init(e,t)}),C5=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=D4),Kt.init(e,t)}),N5=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=K4(t)),Kt.init(e,t)}),_5=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=V4),Kt.init(e,t)}),T5=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Q4(t)),Kt.init(e,t)}),A5=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=I4),Kt.init(e,t)}),R5=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=F4),Kt.init(e,t),e._zod.bag.format="ipv4"}),O5=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$4),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})}}}),z5=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=q4),Kt.init(e,t)}),D5=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=H4),Kt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,u]=a;if(!u)throw new Error;const c=Number(u);if(`${c}`!==u)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 qC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const M5=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Z4),Kt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{qC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function I5(e){if(!IC.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return qC(n)}const L5=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=IC),Kt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{I5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),P5=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=G4),Kt.init(e,t)});function U5(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 B5=ce("$ZodJWT",(e,t)=>{Kt.init(e,t),e._zod.check=n=>{U5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),HC=ce("$ZodNumber",(e,t)=>{Qt.init(e,t),e._zod.pattern=e._zod.bag.pattern??UC,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 u=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,...u?{received:u}:{}}),n}}),F5=ce("$ZodNumberFormat",(e,t)=>{r5.init(e,t),HC.init(e,t)}),$5=ce("$ZodBoolean",(e,t)=>{Qt.init(e,t),e._zod.pattern=W4,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}}),q5=ce("$ZodNull",(e,t)=>{Qt.init(e,t),e._zod.pattern=J4,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}}),H5=ce("$ZodUnknown",(e,t)=>{Qt.init(e,t),e._zod.parse=n=>n}),Z5=ce("$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 w1(e,t,n){e.issues.length&&t.issues.push(...Xl(n,e.issues)),t.value[n]=e.value}const G5=ce("$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 u=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?u.push(m.then(h=>w1(h,n,c))):w1(m,n,c)}return u.length?Promise.all(u).then(()=>n):n}});function Zf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...Xl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function ZC(e){var a,s,u,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(u=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:u.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=u4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function GC(e,t,n,a,s,u){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,g=m.optout==="optional";for(const p in t){if(f.has(p))continue;if(h==="never"){c.push(p);continue}const b=m.run({value:t[p],issues:[]},a);b instanceof Promise?e.push(b.then(w=>Zf(w,n,p,t,g))):Zf(b,n,p,t,g)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:u}),e.length?Promise.all(e).then(()=>n):n}const V5=ce("$ZodObject",(e,t)=>{Qt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=yh(()=>ZC(t));Ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const g=f[h]._zod;if(g.values){m[h]??(m[h]=new Set);for(const p of g.values)m[h].add(p)}}return m});const s=hc,u=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 g=[],p=c.shape;for(const b of c.keys){const w=p[b],k=w._zod.optout==="optional",j=w._zod.run({value:h[b],issues:[]},m);j instanceof Promise?g.push(j.then(C=>Zf(C,f,b,h,k))):Zf(j,f,b,h,k)}return u?GC(g,h,f,m,a.value,e):g.length?Promise.all(g).then(()=>f):f}}),Q5=ce("$ZodObjectJIT",(e,t)=>{V5.init(e,t);const n=e._zod.parse,a=yh(()=>ZC(t)),s=b=>{var O;const w=new m5(["shape","payload","ctx"]),k=a.value,j=D=>{const P=b1(D);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};w.write("const input = payload.value;");const C=Object.create(null);let E=0;for(const D of k.keys)C[D]=`key_${E++}`;w.write("const newResult = {};");for(const D of k.keys){const P=C[D],z=b1(D),B=b[D],M=((O=B==null?void 0:B._zod)==null?void 0:O.optout)==="optional";w.write(`const ${P} = ${j(D)};`),M?w.write(`
322
- if (${P}.issues.length) {
323
- if (${z} in input) {
324
- payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
325
- ...iss,
326
- path: iss.path ? [${z}, ...iss.path] : [${z}]
327
- })));
328
- }
329
- }
330
-
331
- if (${P}.value === undefined) {
332
- if (${z} in input) {
333
- newResult[${z}] = undefined;
334
- }
335
- } else {
336
- newResult[${z}] = ${P}.value;
337
- }
338
-
339
- `):w.write(`
340
- if (${P}.issues.length) {
341
- payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
342
- ...iss,
343
- path: iss.path ? [${z}, ...iss.path] : [${z}]
344
- })));
345
- }
346
-
347
- if (${P}.value === undefined) {
348
- if (${z} in input) {
349
- newResult[${z}] = undefined;
350
- }
351
- } else {
352
- newResult[${z}] = ${P}.value;
353
- }
354
-
355
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const T=w.compile();return(D,P)=>T(b,D,P)};let u;const c=hc,f=!TC.jitless,h=f&&l4.value,g=t.catchall;let p;e._zod.parse=(b,w)=>{p??(p=a.value);const k=b.value;return c(k)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(u||(u=s(t.shape)),b=u(b,w),g?GC([],k,b,w,p,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),b)}});function S1(e,t,n,a){for(const u of e)if(u.issues.length===0)return t.value=u.value,t;const s=e.filter(u=>!Yl(u));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(u=>u.issues.map(c=>cs(c,a,us())))}),t)}const VC=ce("$ZodUnion",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ct(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ct(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ct(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(u=>u._zod.pattern);return new RegExp(`^(${s.map(u=>Ov(u.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,u)=>{if(n)return a(s,u);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},u);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=>S1(m,s,e,u)):S1(f,s,e,u)}}),K5=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,VC.init(e,t);const n=e._zod.parse;Ct(e._zod,"propValues",()=>{const s={};for(const u of t.options){const c=u._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const[f,m]of Object.entries(c)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=yh(()=>{var c;const s=t.options,u=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(u.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);u.set(h,f)}}return u});e._zod.parse=(s,u)=>{const c=s.value;if(!hc(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,u):t.unionFallback?n(s,u):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),Y5=ce("$ZodIntersection",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,u=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return u instanceof Promise||c instanceof Promise?Promise.all([u,c]).then(([m,h])=>k1(n,m,h)):k1(n,u,c)}});function Ny(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(bo(e)&&bo(t)){const n=Object.keys(t),a=Object.keys(e).filter(u=>n.indexOf(u)!==-1),s={...e,...t};for(const u of a){const c=Ny(e[u],t[u]);if(!c.valid)return{valid:!1,mergeErrorPath:[u,...c.mergeErrorPath]};s[u]=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],u=t[a],c=Ny(s,u);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function k1(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 u=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(u.length&&s&&e.issues.push({...s,keys:u}),Yl(e))return e;const c=Ny(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 X5=ce("$ZodRecord",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!bo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const u=[],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 g=t.valueType._zod.run({value:s[h],issues:[]},a);g instanceof Promise?u.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(h,p.issues)),n.value[h]=p.value})):(g.issues.length&&n.issues.push(...Xl(h,g.issues)),n.value[h]=g.value)}let m;for(const h in s)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"&&UC.test(f)&&m.issues.length){const p=t.keyType._zod.run({value:Number(f),issues:[]},a);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(m=p)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(p=>cs(p,a,us())),input:f,path:[f],inst:e});continue}const g=t.valueType._zod.run({value:s[f],issues:[]},a);g instanceof Promise?u.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(f,p.issues)),n.value[m.value]=p.value})):(g.issues.length&&n.issues.push(...Xl(f,g.issues)),n.value[m.value]=g.value)}}return u.length?Promise.all(u).then(()=>n):n}}),W5=ce("$ZodEnum",(e,t)=>{Qt.init(e,t);const n=AC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>o4.has(typeof s)).map(s=>typeof s=="string"?xo(s):s.toString()).join("|")})$`),e._zod.parse=(s,u)=>{const c=s.value;return a.has(c)||s.issues.push({code:"invalid_value",values:n,input:c,inst:e}),s}}),J5=ce("$ZodLiteral",(e,t)=>{if(Qt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?xo(a):a?xo(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const u=a.value;return n.has(u)||a.issues.push({code:"invalid_value",values:t.values,input:u,inst:e}),a}}),eL=ce("$ZodTransform",(e,t)=>{Qt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new _C(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new to;return n.value=s,n}});function j1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const QC=ce("$ZodOptional",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ov(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(u=>j1(u,n.value)):j1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),tL=ce("$ZodExactOptional",(e,t)=>{QC.init(e,t),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),nL=ce("$ZodNullable",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ov(n.source)}|null)$`):void 0}),Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),rL=ce("$ZodDefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(u=>E1(u,t)):E1(s,t)}});function E1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const aL=ce("$ZodPrefault",(e,t)=>{Qt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),iL=ce("$ZodNonOptional",(e,t)=>{Qt.init(e,t),Ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(u=>C1(u,e)):C1(s,e)}});function C1(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 sL=ce("$ZodCatch",(e,t)=>{Qt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(u=>(n.value=u.value,u.issues.length&&(n.value=t.catchValue({...n,error:{issues:u.issues.map(c=>cs(c,a,us()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(u=>cs(u,a,us()))},input:n.value}),n.issues=[]),n)}}),lL=ce("$ZodPipe",(e,t)=>{Qt.init(e,t),Ct(e._zod,"values",()=>t.in._zod.values),Ct(e._zod,"optin",()=>t.in._zod.optin),Ct(e._zod,"optout",()=>t.out._zod.optout),Ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const u=t.out._zod.run(n,a);return u instanceof Promise?u.then(c=>vf(c,t.in,a)):vf(u,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(u=>vf(u,t.out,a)):vf(s,t.out,a)}});function vf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const oL=ce("$ZodReadonly",(e,t)=>{Qt.init(e,t),Ct(e._zod,"propValues",()=>t.innerType._zod.propValues),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ct(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(N1):N1(s)}});function N1(e){return e.value=Object.freeze(e.value),e}const uL=ce("$ZodCustom",(e,t)=>{jr.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(u=>_1(u,n,a,e));_1(s,n,a,e)}});function _1(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(mc(s))}}var T1;class cL{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 dL(){return new cL}(T1=globalThis).__zod_globalRegistry??(T1.__zod_globalRegistry=dL());const Xu=globalThis.__zod_globalRegistry;function fL(e,t){return new e({type:"string",...De(t)})}function hL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function A1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function mL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function pL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}function gL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}function yL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}function vL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}function bL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}function xL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}function wL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}function SL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}function kL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}function jL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}function EL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}function CL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}function NL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}function _L(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}function TL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}function AL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}function RL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}function OL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}function zL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}function DL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}function ML(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}function IL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}function LL(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}function PL(e,t){return new e({type:"number",checks:[],...De(t)})}function UL(e,t){return new e({type:"number",coerce:!0,checks:[],...De(t)})}function BL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}function FL(e,t){return new e({type:"boolean",...De(t)})}function $L(e,t){return new e({type:"null",...De(t)})}function qL(e){return new e({type:"unknown"})}function HL(e,t){return new e({type:"never",...De(t)})}function R1(e,t){return new FC({check:"less_than",...De(t),value:e,inclusive:!1})}function ug(e,t){return new FC({check:"less_than",...De(t),value:e,inclusive:!0})}function O1(e,t){return new $C({check:"greater_than",...De(t),value:e,inclusive:!1})}function cg(e,t){return new $C({check:"greater_than",...De(t),value:e,inclusive:!0})}function z1(e,t){return new n5({check:"multiple_of",...De(t),value:e})}function KC(e,t){return new a5({check:"max_length",...De(t),maximum:e})}function Gf(e,t){return new i5({check:"min_length",...De(t),minimum:e})}function YC(e,t){return new s5({check:"length_equals",...De(t),length:e})}function ZL(e,t){return new l5({check:"string_format",format:"regex",...De(t),pattern:e})}function GL(e){return new o5({check:"string_format",format:"lowercase",...De(e)})}function VL(e){return new u5({check:"string_format",format:"uppercase",...De(e)})}function QL(e,t){return new c5({check:"string_format",format:"includes",...De(t),includes:e})}function KL(e,t){return new d5({check:"string_format",format:"starts_with",...De(t),prefix:e})}function YL(e,t){return new f5({check:"string_format",format:"ends_with",...De(t),suffix:e})}function Ro(e){return new h5({check:"overwrite",tx:e})}function XL(e){return Ro(t=>t.normalize(e))}function WL(){return Ro(e=>e.trim())}function JL(){return Ro(e=>e.toLowerCase())}function eP(){return Ro(e=>e.toUpperCase())}function tP(){return Ro(e=>s4(e))}function nP(e,t,n){return new e({type:"array",element:t,...De(n)})}function rP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}function aP(e){const t=iP(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(mc(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(mc(s))}},e(n.value,n)));return t}function iP(e,t){const n=new jr({check:"custom",...De(t)});return n._zod.check=e,n}function XC(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)??Xu,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function kn(e,t,n={path:[],schemaPath:[]}){var g,p;var a;const s=e._zod.def,u=t.seen.get(e);if(u)return u.count++,n.schemaPath.includes(e)&&(u.cycle=n.path),u.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(p=(g=e._zod).toJSONSchema)==null?void 0:p.call(g);if(f)c.schema=f;else{const b={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,b);else{const k=c.schema,j=t.processors[s.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);j(e,t,k,b)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),kn(w,t,b),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&ar(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 WC(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 g of e.seen.entries()){const p=(c=e.metadataRegistry.get(g[0]))==null?void 0:c.id;if(p){const b=a.get(p);if(b&&b!==g[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(p,g[0])}}const s=g=>{var j;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const C=(j=e.external.registry.get(g[0]))==null?void 0:j.id,E=e.external.uri??(O=>O);if(C)return{ref:E(C)};const T=g[1].defId??g[1].schema.id??`schema${e.counter++}`;return g[1].defId=T,{defId:T,ref:`${E("__shared")}#/${p}/${T}`}}if(g[1]===n)return{ref:"#"};const w=`#/${p}/`,k=g[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:w+k}},u=g=>{if(g[1].schema.$ref)return;const p=g[1],{ref:b,defId:w}=s(g);p.def={...p.schema},w&&(p.defId=w);const k=p.schema;for(const j in k)delete k[j];k.$ref=b};if(e.cycles==="throw")for(const g of e.seen.entries()){const p=g[1];if(p.cycle)throw new Error(`Cycle detected: #/${(f=p.cycle)==null?void 0:f.join("/")}/<root>
356
-
357
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of e.seen.entries()){const p=g[1];if(t===g[0]){u(g);continue}if(e.external){const w=(m=e.external.registry.get(g[0]))==null?void 0:m.id;if(t!==g[0]&&w){u(g);continue}}if((h=e.metadataRegistry.get(g[0]))==null?void 0:h.id){u(g);continue}if(p.cycle){u(g);continue}if(p.count>1&&e.reused==="ref"){u(g);continue}}}function JC(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 g=e.seen.get(h);if(g.ref===null)return;const p=g.def??g.schema,b={...p},w=g.ref;if(g.ref=null,w){a(w);const j=e.seen.get(w),C=j.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(C)):Object.assign(p,C),Object.assign(p,b),h._zod.parent===w)for(const T in p)T==="$ref"||T==="allOf"||T in b||delete p[T];if(C.$ref&&j.def)for(const T in p)T==="$ref"||T==="allOf"||T in j.def&&JSON.stringify(p[T])===JSON.stringify(j.def[T])&&delete p[T]}const k=h._zod.parent;if(k&&k!==w){a(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(p.$ref=j.schema.$ref,j.def))for(const C in p)C==="$ref"||C==="allOf"||C in j.def&&JSON.stringify(p[C])===JSON.stringify(j.def[C])&&delete p[C]}e.override({zodSchema:h,jsonSchema:p,path:g.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(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 u=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const g=h[1];g.def&&g.defId&&(u[g.defId]=g.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?s.$defs=u:s.definitions=u);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Vf(t,"input",e.processors),output:Vf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function ar(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 ar(a.element,n);if(a.type==="set")return ar(a.valueType,n);if(a.type==="lazy")return ar(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 ar(a.innerType,n);if(a.type==="intersection")return ar(a.left,n)||ar(a.right,n);if(a.type==="record"||a.type==="map")return ar(a.keyType,n)||ar(a.valueType,n);if(a.type==="pipe")return ar(a.in,n)||ar(a.out,n);if(a.type==="object"){for(const s in a.shape)if(ar(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(ar(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(ar(s,n))return!0;return!!(a.rest&&ar(a.rest,n))}return!1}const sP=(e,t={})=>n=>{const a=XC({...n,processors:t});return kn(e,a),WC(a,e),JC(a,e)},Vf=(e,t,n={})=>a=>{const{libraryOptions:s,target:u}=a??{},c=XC({...s??{},target:u,io:t,processors:n});return kn(e,c),WC(c,e),JC(c,e)},lP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:u,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof u=="number"&&(s.minLength=u),typeof c=="number"&&(s.maxLength=c),f&&(s.format=lP[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},uP=(e,t,n,a)=>{const s=n,{minimum:u,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:g}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=g,s.exclusiveMinimum=!0):s.exclusiveMinimum=g),typeof u=="number"&&(s.minimum=u,typeof g=="number"&&t.target!=="draft-04"&&(g>=u?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)},cP=(e,t,n,a)=>{n.type="boolean"},dP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},fP=(e,t,n,a)=>{n.not={}},hP=(e,t,n,a)=>{},mP=(e,t,n,a)=>{const s=e._zod.def,u=AC(s.entries);u.every(c=>typeof c=="number")&&(n.type="number"),u.every(c=>typeof c=="string")&&(n.type="string"),n.enum=u},pP=(e,t,n,a)=>{const s=e._zod.def,u=[];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");u.push(Number(c))}else u.push(c);if(u.length!==0)if(u.length===1){const c=u[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else u.every(c=>typeof c=="number")&&(n.type="number"),u.every(c=>typeof c=="string")&&(n.type="string"),u.every(c=>typeof c=="boolean")&&(n.type="boolean"),u.every(c=>c===null)&&(n.type="null"),n.enum=u},gP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vP=(e,t,n,a)=>{const s=n,u=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=kn(u.element,t,{...a,path:[...a.path,"items"]})},bP=(e,t,n,a)=>{var h;const s=n,u=e._zod.def;s.type="object",s.properties={};const c=u.shape;for(const g in c)s.properties[g]=kn(c[g],t,{...a,path:[...a.path,"properties",g]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(g=>{const p=u.shape[g]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=u.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:u.catchall?u.catchall&&(s.additionalProperties=kn(u.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},xP=(e,t,n,a)=>{const s=e._zod.def,u=s.inclusive===!1,c=s.options.map((f,m)=>kn(f,t,{...a,path:[...a.path,u?"oneOf":"anyOf",m]}));u?n.oneOf=c:n.anyOf=c},wP=(e,t,n,a)=>{const s=e._zod.def,u=kn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=kn(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(u)?u.allOf:[u],...f(c)?c.allOf:[c]];n.allOf=m},SP=(e,t,n,a)=>{const s=n,u=e._zod.def;s.type="object";const c=u.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(u.mode==="loose"&&m&&m.size>0){const g=kn(u.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const p of m)s.patternProperties[p.source]=g}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=kn(u.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=kn(u.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const g=[...h].filter(p=>typeof p=="string"||typeof p=="number");g.length>0&&(s.required=g)}},kP=(e,t,n,a)=>{const s=e._zod.def,u=kn(s.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[u,{type:"null"}]},jP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType},EP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},CP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},NP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},_P=(e,t,n,a)=>{const s=e._zod.def,u=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;kn(u,t,a);const c=t.seen.get(e);c.ref=u},TP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType,n.readOnly=!0},eN=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const u=t.seen.get(e);u.ref=s.innerType},AP=ce("ZodISODateTime",(e,t)=>{N5.init(e,t),Jt.init(e,t)});function RP(e){return DL(AP,e)}const OP=ce("ZodISODate",(e,t)=>{_5.init(e,t),Jt.init(e,t)});function zP(e){return ML(OP,e)}const DP=ce("ZodISOTime",(e,t)=>{T5.init(e,t),Jt.init(e,t)});function MP(e){return IL(DP,e)}const IP=ce("ZodISODuration",(e,t)=>{A5.init(e,t),Jt.init(e,t)});function LP(e){return LL(IP,e)}const PP=(e,t)=>{DC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>b4(e,n)},flatten:{value:n=>v4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Cy,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Cy,2)}},isEmpty:{get(){return e.issues.length===0}}})},ia=ce("ZodError",PP,{Parent:Error}),UP=Dv(ia),BP=Mv(ia),FP=vh(ia),$P=bh(ia),qP=S4(ia),HP=k4(ia),ZP=j4(ia),GP=E4(ia),VP=C4(ia),QP=N4(ia),KP=_4(ia),YP=T4(ia),Yt=ce("ZodType",(e,t)=>(Qt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Vf(e,"input"),output:Vf(e,"output")}}),e.toJSONSchema=sP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fs(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)=>hs(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>UP(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>FP(e,n,a),e.parseAsync=async(n,a)=>BP(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>$P(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>qP(e,n,a),e.decode=(n,a)=>HP(e,n,a),e.encodeAsync=async(n,a)=>ZP(e,n,a),e.decodeAsync=async(n,a)=>GP(e,n,a),e.safeEncode=(n,a)=>VP(e,n,a),e.safeDecode=(n,a)=>QP(e,n,a),e.safeEncodeAsync=async(n,a)=>KP(e,n,a),e.safeDecodeAsync=async(n,a)=>YP(e,n,a),e.refine=(n,a)=>e.check(HU(n,a)),e.superRefine=n=>e.check(ZU(n)),e.overwrite=n=>e.check(Ro(n)),e.optional=()=>I1(e),e.exactOptional=()=>RU(e),e.nullable=()=>L1(e),e.nullish=()=>I1(L1(e)),e.nonoptional=n=>LU(e,n),e.array=()=>pt(e),e.or=n=>Pv([e,n]),e.and=n=>CU(e,n),e.transform=n=>Ty(e,rN(n)),e.default=n=>DU(e,n),e.prefault=n=>IU(e,n),e.catch=n=>UU(e,n),e.pipe=n=>Ty(e,n),e.readonly=()=>$U(e),e.describe=n=>{const a=e.clone();return Xu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Xu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xu.get(e);const a=e.clone();return Xu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),tN=ce("_ZodString",(e,t)=>{Iv.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,u)=>oP(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(ZL(...a)),e.includes=(...a)=>e.check(QL(...a)),e.startsWith=(...a)=>e.check(KL(...a)),e.endsWith=(...a)=>e.check(YL(...a)),e.min=(...a)=>e.check(Gf(...a)),e.max=(...a)=>e.check(KC(...a)),e.length=(...a)=>e.check(YC(...a)),e.nonempty=(...a)=>e.check(Gf(1,...a)),e.lowercase=a=>e.check(GL(a)),e.uppercase=a=>e.check(VL(a)),e.trim=()=>e.check(WL()),e.normalize=(...a)=>e.check(XL(...a)),e.toLowerCase=()=>e.check(JL()),e.toUpperCase=()=>e.check(eP()),e.slugify=()=>e.check(tP())}),XP=ce("ZodString",(e,t)=>{Iv.init(e,t),tN.init(e,t),e.email=n=>e.check(hL(WP,n)),e.url=n=>e.check(vL(JP,n)),e.jwt=n=>e.check(zL(mU,n)),e.emoji=n=>e.check(bL(eU,n)),e.guid=n=>e.check(A1(D1,n)),e.uuid=n=>e.check(mL(bf,n)),e.uuidv4=n=>e.check(pL(bf,n)),e.uuidv6=n=>e.check(gL(bf,n)),e.uuidv7=n=>e.check(yL(bf,n)),e.nanoid=n=>e.check(xL(tU,n)),e.guid=n=>e.check(A1(D1,n)),e.cuid=n=>e.check(wL(nU,n)),e.cuid2=n=>e.check(SL(rU,n)),e.ulid=n=>e.check(kL(aU,n)),e.base64=n=>e.check(AL(dU,n)),e.base64url=n=>e.check(RL(fU,n)),e.xid=n=>e.check(jL(iU,n)),e.ksuid=n=>e.check(EL(sU,n)),e.ipv4=n=>e.check(CL(lU,n)),e.ipv6=n=>e.check(NL(oU,n)),e.cidrv4=n=>e.check(_L(uU,n)),e.cidrv6=n=>e.check(TL(cU,n)),e.e164=n=>e.check(OL(hU,n)),e.datetime=n=>e.check(RP(n)),e.date=n=>e.check(zP(n)),e.time=n=>e.check(MP(n)),e.duration=n=>e.check(LP(n))});function N(e){return fL(XP,e)}const Jt=ce("ZodStringFormat",(e,t)=>{Kt.init(e,t),tN.init(e,t)}),WP=ce("ZodEmail",(e,t)=>{v5.init(e,t),Jt.init(e,t)}),D1=ce("ZodGUID",(e,t)=>{g5.init(e,t),Jt.init(e,t)}),bf=ce("ZodUUID",(e,t)=>{y5.init(e,t),Jt.init(e,t)}),JP=ce("ZodURL",(e,t)=>{b5.init(e,t),Jt.init(e,t)}),eU=ce("ZodEmoji",(e,t)=>{x5.init(e,t),Jt.init(e,t)}),tU=ce("ZodNanoID",(e,t)=>{w5.init(e,t),Jt.init(e,t)}),nU=ce("ZodCUID",(e,t)=>{S5.init(e,t),Jt.init(e,t)}),rU=ce("ZodCUID2",(e,t)=>{k5.init(e,t),Jt.init(e,t)}),aU=ce("ZodULID",(e,t)=>{j5.init(e,t),Jt.init(e,t)}),iU=ce("ZodXID",(e,t)=>{E5.init(e,t),Jt.init(e,t)}),sU=ce("ZodKSUID",(e,t)=>{C5.init(e,t),Jt.init(e,t)}),lU=ce("ZodIPv4",(e,t)=>{R5.init(e,t),Jt.init(e,t)}),oU=ce("ZodIPv6",(e,t)=>{O5.init(e,t),Jt.init(e,t)}),uU=ce("ZodCIDRv4",(e,t)=>{z5.init(e,t),Jt.init(e,t)}),cU=ce("ZodCIDRv6",(e,t)=>{D5.init(e,t),Jt.init(e,t)}),dU=ce("ZodBase64",(e,t)=>{M5.init(e,t),Jt.init(e,t)}),fU=ce("ZodBase64URL",(e,t)=>{L5.init(e,t),Jt.init(e,t)}),hU=ce("ZodE164",(e,t)=>{P5.init(e,t),Jt.init(e,t)}),mU=ce("ZodJWT",(e,t)=>{B5.init(e,t),Jt.init(e,t)}),Lv=ce("ZodNumber",(e,t)=>{HC.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,u)=>uP(e,a,s),e.gt=(a,s)=>e.check(O1(a,s)),e.gte=(a,s)=>e.check(cg(a,s)),e.min=(a,s)=>e.check(cg(a,s)),e.lt=(a,s)=>e.check(R1(a,s)),e.lte=(a,s)=>e.check(ug(a,s)),e.max=(a,s)=>e.check(ug(a,s)),e.int=a=>e.check(M1(a)),e.safe=a=>e.check(M1(a)),e.positive=a=>e.check(O1(0,a)),e.nonnegative=a=>e.check(cg(0,a)),e.negative=a=>e.check(R1(0,a)),e.nonpositive=a=>e.check(ug(0,a)),e.multipleOf=(a,s)=>e.check(z1(a,s)),e.step=(a,s)=>e.check(z1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function He(e){return PL(Lv,e)}const pU=ce("ZodNumberFormat",(e,t)=>{F5.init(e,t),Lv.init(e,t)});function M1(e){return BL(pU,e)}const gU=ce("ZodBoolean",(e,t)=>{$5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>cP(e,n,a)});function Xn(e){return FL(gU,e)}const yU=ce("ZodNull",(e,t)=>{q5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>dP(e,n,a)});function vU(e){return $L(yU,e)}const bU=ce("ZodUnknown",(e,t)=>{H5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>hP()});function Ut(){return qL(bU)}const xU=ce("ZodNever",(e,t)=>{Z5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>fP(e,n,a)});function wU(e){return HL(xU,e)}const SU=ce("ZodArray",(e,t)=>{G5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>vP(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Gf(n,a)),e.nonempty=n=>e.check(Gf(1,n)),e.max=(n,a)=>e.check(KC(n,a)),e.length=(n,a)=>e.check(YC(n,a)),e.unwrap=()=>e.element});function pt(e,t){return nP(SU,e,t)}const kU=ce("ZodObject",(e,t)=>{Q5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>bP(e,n,a,s),Ct(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:wU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>h4(e,n),e.safeExtend=n=>m4(e,n),e.merge=n=>p4(e,n),e.pick=n=>d4(e,n),e.omit=n=>f4(e,n),e.partial=(...n)=>g4(aN,e,n[0]),e.required=(...n)=>y4(iN,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...De(t)};return new kU(n)}const nN=ce("ZodUnion",(e,t)=>{VC.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>xP(e,n,a,s),e.options=t.options});function Pv(e,t){return new nN({type:"union",options:e,...De(t)})}const jU=ce("ZodDiscriminatedUnion",(e,t)=>{nN.init(e,t),K5.init(e,t)});function Uv(e,t,n){return new jU({type:"union",options:t,discriminator:e,...De(n)})}const EU=ce("ZodIntersection",(e,t)=>{Y5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>wP(e,n,a,s)});function CU(e,t){return new EU({type:"intersection",left:e,right:t})}const NU=ce("ZodRecord",(e,t)=>{X5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SP(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function Xt(e,t,n){return new NU({type:"record",keyType:e,valueType:t,...De(n)})}const _y=ce("ZodEnum",(e,t)=>{W5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(a,s,u)=>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 u={};for(const c of a)if(n.has(c))u[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new _y({...t,checks:[],...De(s),entries:u})},e.exclude=(a,s)=>{const u={...t.entries};for(const c of a)if(n.has(c))delete u[c];else throw new Error(`Key ${c} not found in enum`);return new _y({...t,checks:[],...De(s),entries:u})}});function Pe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new _y({type:"enum",entries:n,...De(t)})}const _U=ce("ZodLiteral",(e,t)=>{J5.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>pP(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Sn(e,t){return new _U({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const TU=ce("ZodTransform",(e,t)=>{eL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>yP(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new _C(e.constructor.name);n.addIssue=u=>{if(typeof u=="string")n.issues.push(mc(u,n.value,t));else{const c=u;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(mc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(u=>(n.value=u,n)):(n.value=s,n)}});function rN(e){return new TU({type:"transform",transform:e})}const aN=ce("ZodOptional",(e,t)=>{QC.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function I1(e){return new aN({type:"optional",innerType:e})}const AU=ce("ZodExactOptional",(e,t)=>{tL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function RU(e){return new AU({type:"optional",innerType:e})}const OU=ce("ZodNullable",(e,t)=>{nL.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 L1(e){return new OU({type:"nullable",innerType:e})}const zU=ce("ZodDefault",(e,t)=>{rL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function DU(e,t){return new zU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():OC(t)}})}const MU=ce("ZodPrefault",(e,t)=>{aL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function IU(e,t){return new MU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():OC(t)}})}const iN=ce("ZodNonOptional",(e,t)=>{iL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function LU(e,t){return new iN({type:"nonoptional",innerType:e,...De(t)})}const PU=ce("ZodCatch",(e,t)=>{sL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function UU(e,t){return new PU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const BU=ce("ZodPipe",(e,t)=>{lL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_P(e,n,a,s),e.in=t.in,e.out=t.out});function Ty(e,t){return new BU({type:"pipe",in:e,out:t})}const FU=ce("ZodReadonly",(e,t)=>{oL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function $U(e){return new FU({type:"readonly",innerType:e})}const qU=ce("ZodCustom",(e,t)=>{uL.init(e,t),Yt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>gP(e,n)});function HU(e,t={}){return rP(qU,e,t)}function ZU(e){return aP(e)}function GU(e,t){return Ty(rN(e),t)}const Ms={custom:"custom"};function Uc(e){return UL(Lv,e)}const VU=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function QU(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function sN(e,t){const n=QU(e),a=new Map;for(const u of t)u.name&&a.set(u.name.toLowerCase(),u.agentId);if(a.size===0)return[];const s=new Set;for(const u of n.matchAll(VU)){const c=u[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const KU=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,P1="/";function lN(e){return!e||typeof e!="string"||e.length>256||!KU.test(e)?"/":e}const YU={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},oN=Pe(["feishu","slack","kael"]),uN=Pe(["active","inactive"]);ne({platform:oN,agentId:N().min(1),credentials:Xt(N(),Ut()),status:uN.default("active")});ne({agentId:N().min(1).optional(),credentials:Xt(N(),Ut()).optional(),status:uN.optional()});ne({id:He(),platform:N(),agentId:N(),hasCredentials:Xn(),status:N(),createdAt:N(),updatedAt:N()});const XU=Pe(["code","reverse_token","oauth","manual"]);ne({appId:N().min(1),appSecret:N().min(1)});ne({platform:oN,externalUserId:N().min(1),agentId:N().min(1),boundVia:XU.default("manual"),displayName:N().max(200).optional()});ne({id:He(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});ne({feishuUserId:N().min(1),displayName:N().max(200).optional()});ne({configId:He(),platform:N(),agentId:N(),appId:N(),connected:Xn(),lastActiveAt:N().nullable()});const WU=32e3,Bv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,JU=/^[A-Z][A-Z0-9_]*$/,cN=ne({append:N().max(WU).default("")}),e6=ne({name:N().regex(Bv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("stdio"),command:N().min(1),args:pt(N()).optional()}),t6=ne({name:N().regex(Bv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("http"),url:N().url(),headers:Xt(N(),N()).optional()}),n6=ne({name:N().regex(Bv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("sse"),url:N().url(),headers:Xt(N(),N()).optional()}),dN=Uv("transport",[e6,t6,n6]),fN=ne({key:N().regex(JU,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Xn().default(!1)}),Fv=ne({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).optional()}),hN=ne({prompt:cN.default({append:""}),model:N().default("opus"),mcpServers:pt(dN).default([]),env:pt(fN).default([]),gitRepos:pt(Fv).default([])}),r6=hN.extend({kind:Sn("claude-code")}),a6=hN.extend({kind:Sn("codex")}),i6=Uv("kind",[r6,a6]),s6=(e,t)=>{const n=new Set;e.mcpServers.forEach((u,c)=>{const f=u.name.toLowerCase();n.has(f)&&t.addIssue({code:Ms.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${u.name}"`}),n.add(f)});const a=new Set;e.env.forEach((u,c)=>{a.has(u.key)&&t.addIssue({code:Ms.custom,path:["env",c,"key"],message:`Duplicate env key "${u.key}"`}),a.add(u.key)});const s=new Set;e.gitRepos.forEach((u,c)=>{const f=u.localPath??Kf(u.url);f&&(s.has(f)&&t.addIssue({code:Ms.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},mN=GU(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,i6).superRefine((e,t)=>{s6(e,t)}),l6=ne({agentId:N(),version:He().int().positive(),payload:mN,updatedAt:N(),updatedBy:N()}),pN=ne({prompt:cN,model:N(),mcpServers:pt(dN),env:pt(fN),gitRepos:pt(Fv)}).partial();ne({expectedVersion:He().int().positive(),payload:pN});ne({payload:pN});ne({current:l6,next:mN,diff:pt(ne({path:N(),op:Pe(["add","remove","replace"]),before:Ut().optional(),after:Ut().optional()}))});const Qf="***";function Kf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const gN=Pe(["online","offline"]),yN=Pe(["idle","working","blocked","error"]);Pe(["active","suspended","evicted"]);const o6=Pe(["active","suspended"]);ne({chatId:N().min(1),state:o6});ne({runtimeState:yN});ne({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});Pe(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);ne({agentId:N(),status:gN,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:yN.nullable().optional(),activeSessions:He().int().nullable().optional(),totalSessions:He().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});ne({total:He().int(),running:He().int(),byState:ne({idle:He().int(),working:He().int(),blocked:He().int(),error:He().int()}),clients:He().int()});const Yf={CLAUDE_CODE:"claude-code",CODEX:"codex"},wh=Pe(["claude-code","codex"]),Sh=Pe(["human","personal_assistant","autonomous_agent"]),U1={PRIVATE:"private",ORGANIZATION:"organization"},$v=Pe(["private","organization"]),u6=Pe(["admin-api","portal"]);Pe(["active","suspended"]);const Ay=/^[a-z0-9][a-z0-9_-]{0,63}$/,Wl=64,c6=["admin","agent","first-tree","hub","me","null","system","undefined"],d6=new Set(c6);function Ry(e){return d6.has(e)}ne({name:N().min(1).max(64).regex(Ay,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Ry(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Sh,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:u6.optional(),visibility:$v.optional(),metadata:Xt(N(),Ut()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:wh.optional(),gitRepos:pt(Fv).optional()});ne({type:Sh.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:$v.optional(),metadata:Xt(N(),Ut()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional()});ne({clientId:N().min(1).max(100),runtimeProvider:wh,force:Xn().optional()});ne({uuid:N(),name:N().nullable(),organizationId:N(),type:Sh,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:$v,metadata:Xt(N(),Ut()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:wh,presenceStatus:gN.optional(),createdAt:N(),updatedAt:N()});ne({repo:N().nullable(),branch:N().nullable()});ne({type:Sn("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:Sh,runtimeProvider:wh});ne({username:N().min(1),password:N().min(1)});ne({accessToken:N(),refreshToken:N()});ne({refreshToken:N().min(1)});ne({token:N().min(1)});ne({token:N(),expiresIn:He(),command:N()});const f6=Pe(["direct","group","thread"]);ne({type:f6,topic:N().max(500).optional(),participantIds:pt(N()).min(1),metadata:Xt(N(),Ut()).optional()});const vN=ne({agentId:N(),role:N(),mode:N(),joinedAt:N()});vN.extend({name:N().nullable(),displayName:N(),type:N()});const h6=ne({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:Xt(N(),Ut()),createdAt:N(),updatedAt:N()});h6.extend({participants:pt(vN),title:N(),firstMessagePreview:N().nullable()});ne({topic:N().trim().max(500).nullable()});ne({agentId:N().min(1),mode:Pe(["full","mention_only"]).default("full")});ne({agentId:N().min(1)});const m6=Pe(["connected","disconnected"]),p6=Pe(["ok","expired"]);ne({id:N(),userId:N().nullable(),status:m6,authState:p6,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:He().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:Xt(N(),Ut()).nullable()});const g6=ne({wsInboxDeliver:Xn().default(!1)}).partial();ne({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:g6.optional()});ne({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:He().int().nonnegative()});const y6=Pe(["ok","missing","unauthenticated","error"]),v6=Pe(["api_key","oauth","auth_json","none"]),b6=ne({state:y6,available:Xn(),authenticated:Xn(),sdkVersion:N().nullable().optional(),authMethod:v6,error:N().nullable().optional(),detectedAt:N()}),x6=Xt(N(),b6);ne({capabilities:x6});ne({limit:Uc().int().min(1).max(100).default(20),cursor:N().optional()});const w6=Pe(["active","stale","unavailable"]),S6=Pe(["ok","warning","error"]),k6=ne({label:N(),detail:N().nullable(),severity:S6}),j6=Pe(["root","domain","subdomain","leaf"]),qv=Pe(["added","edited","removed"]),E6=Pe(["parent","soft_link","markdown_link"]),C6=Pe(["low","medium","high"]),N6=ne({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:j6,owners:pt(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:pt(N()),affectedContextArea:N(),changeType:qv.nullable(),changedAtCommit:N().nullable()}),_6=ne({source:N(),target:N(),kind:E6}),T6=ne({path:N(),nodeId:N().nullable(),type:qv,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),A6=ne({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:qv,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:pt(N()),relatedNodeIds:pt(N()),sourceCommit:N().nullable(),riskLevel:C6}),R6=ne({addedCount:He().int().nonnegative(),editedCount:He().int().nonnegative(),removedCount:He().int().nonnegative(),changedNodeCount:He().int().nonnegative()});ne({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:w6,contextStatus:k6,summary:R6,updates:pt(A6),nodes:pt(N6),edges:pt(_6),changes:pt(T6)});const O6=["image/png","image/jpeg","image/gif","image/webp"],Hv=Pe(O6);ne({data:N().min(1),mimeType:Hv,filename:N().min(1),size:He().int().nonnegative().optional(),imageId:N().uuid().optional()});ne({imageId:N().uuid(),mimeType:Hv,filename:N().min(1),size:He().int().nonnegative().optional()});ne({type:Sn("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:Hv,filename:N().min(1),size:He().int().nonnegative().optional()});const Zv=Pe(["hub_ui","cli","feishu","github","api"]),bN=Pe(["text","markdown","card","reference","file","task","question","question_answer"]);ne({format:bN.default("text"),content:Ut(),metadata:Xt(N(),Ut()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:Zv.optional()});ne({format:bN.default("text"),content:Ut(),metadata:Xt(N(),Ut()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:Zv.optional()});const z6=ne({id:N(),chatId:N(),senderId:N(),format:N(),content:Ut(),metadata:Xt(N(),Ut()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:Zv.nullable(),createdAt:N()}),D6=ne({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),M6=Pe(["full","mention_only"]),I6=ne({id:N(),senderId:N(),format:N(),content:Ut(),metadata:Xt(N(),Ut()).default({}),createdAt:N()}),xN=z6.extend({configVersion:He().int().positive(),recipientMode:M6.default("full"),inReplyToSnapshot:D6.default(null),precedingMessages:pt(I6).default([])});Pe(["pending","delivered","acked","failed"]);const L6=ne({id:He(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:He(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});L6.extend({message:xN});ne({limit:Uc().int().min(1).max(50).default(10)});ne({type:Sn("inbox:deliver"),entryId:He().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:xN}).passthrough();ne({type:Sn("inbox:ack"),entryId:He().int().nonnegative()});const P6=7;ne({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});ne({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});ne({token:N().min(1)});ne({}).optional();const U6=["all","unread","watching"],B6=Pe(U6),wN=Pe(["participant","watching"]);ne({cursor:N().optional(),limit:Uc().int().min(1).max(200).default(50),filter:B6.default("all")});const F6=ne({agentId:N(),displayName:N(),type:N()}),$6=ne({chatId:N(),type:N(),membershipKind:wN,title:N(),topic:N().nullable(),participants:pt(F6),participantCount:He().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:He().int(),canReply:Xn(),taskId:N().nullable(),taskStatus:N().nullable()});ne({rows:pt($6),nextCursor:N().nullable()});ne({participantIds:pt(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});ne({participantIds:pt(N().min(1)).min(1)});ne({chatId:N(),lastReadAt:N(),unreadMentionCount:He().int()});ne({chatId:N(),membershipKind:wN.nullable()});ne({type:Sn("chat:message"),chatId:N()});Pe(["connect","create_agent","completed"]);ne({id:N(),name:N(),displayName:N(),role:Pe(["admin","member"])});ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});ne({dismissed:Xn().optional()});const q6=Pe(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);ne({event:q6,attrs:Xt(N(),Pv([N(),He(),Xn(),vU()])).optional()});ne({id:N(),organizationId:N(),organizationName:N(),role:Pe(["admin","member"]),agentId:N()});const H6={ADMIN:"admin",MEMBER:"member"},Gv=Pe(["admin","member"]),Z6=ne({id:N(),userId:N(),organizationId:N(),agentId:N(),role:Gv,createdAt:N()});ne({username:N().min(1).max(100),displayName:N().min(1).max(200),role:Gv.default("member")});ne({role:Gv.optional(),displayName:N().min(1).max(200).optional()});Z6.extend({username:N(),displayName:N(),password:N()});const G6=Pe(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),SN=Pe(["high","medium","low"]);ne({id:N(),organizationId:N(),type:G6,severity:SN,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Xn(),createdAt:N()});ne({limit:Uc().int().min(1).max(100).default(20),cursor:N().optional(),severity:SN.optional(),read:Pe(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});ne({next:N().max(256).optional()});ne({code:N().min(1),state:N().min(1)});ne({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional()});const V6=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function Q6(e){return e.includes("://")?!1:V6.test(e)}const kh=N().min(1).superRefine((e,t)=>{if(Q6(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:Ms.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:Ms.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:Ms.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:Ms.custom,message:"Repo URL must not include credentials."});return}}),K6=ne({repo:kh.optional(),branch:N().default("main")}),Y6=ne({repo:kh.nullish(),branch:N().min(1).nullish()}),X6=ne({repo:N().optional(),branch:N().optional()}),W6=ne({webhookSecretCipher:N().optional()}),J6=ne({webhookSecret:N().min(1).nullish()}),eB=ne({webhookSecretConfigured:Xn(),webhookUrl:N()}),tB=ne({repos:pt(ne({url:kh,defaultBranch:N().optional()})).default([])}),nB=ne({repos:pt(ne({url:kh,defaultBranch:N().min(1).optional()})).optional()}),rB=ne({repos:pt(ne({url:N(),defaultBranch:N().optional()}))}),aB={context_tree:{storage:K6,input:Y6,output:X6,readPolicy:"member"},github_integration:{storage:W6,input:J6,output:eB,readPolicy:"admin"},source_repos:{storage:tB,input:nB,output:rB,readPolicy:"member"}},iB=Object.keys(aB);Pe(iB);const kN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!kN.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:He().int().min(0).default(0),maxMessagesPerMinute:He().int().min(0).default(0),features:Xt(N(),Ut()).default({})});ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!kN.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:He().int().min(0).optional(),maxMessagesPerMinute:He().int().min(0).optional(),features:Xt(N(),Ut()).optional()});ne({id:N(),name:N(),displayName:N(),maxAgents:He(),maxMessagesPerMinute:He(),features:Xt(N(),Ut()),createdAt:N(),updatedAt:N()});const sB=ne({workingCount:He().int().nonnegative(),errorMask:Xn()}),lB=ne({type:Sn("pulse:tick"),organizationId:N(),agents:Xt(N(),pt(sB).length(32))}),oB=ne({label:N().min(1),description:N(),preview:N().nullable().optional()}),uB=ne({question:N().min(1),header:N().min(1).max(24),options:pt(oB).min(2).max(4),multiSelect:Xn()}),cB=Pe(["html","markdown"]).nullable(),dB=ne({correlationId:N().min(1),questions:pt(uB).min(1).max(4),previewFormat:cB,allowFreeText:Xn()}),fB=ne({correlationId:N().min(1),answers:Xt(N().min(1),N())});ne({answers:Xt(N().min(1),N())});Pe(["pending","answered","superseded"]);const hB=Pe(["tool_call","error","assistant_text","thinking","turn_end"]),jN=ne({toolUseId:N(),name:N(),args:Ut(),status:Pe(["pending","ok","error"]),durationMs:He().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),EN=ne({source:Pe(["sdk","runtime","tool"]),message:N().max(2e3)}),CN=ne({text:N().max(8e3)}),NN=ne({}),_N=ne({status:Pe(["success","error"])}),mB=Uv("kind",[ne({kind:Sn("tool_call"),payload:jN}),ne({kind:Sn("error"),payload:EN}),ne({kind:Sn("assistant_text"),payload:CN}),ne({kind:Sn("thinking"),payload:NN}),ne({kind:Sn("turn_end"),payload:_N})]);ne({id:N(),agentId:N(),chatId:N(),seq:He().int().positive(),kind:hB,payload:Pv([jN,EN,CN,NN,_N]),createdAt:N()});ne({agentId:N(),chatId:N(),event:mB});ne({agentId:N(),chatId:N()});ne({type:Sn("session:reconcile"),agentId:N().min(1),chatIds:pt(N().min(1)).max(500)});ne({type:Sn("session:reconcile:result"),agentId:N().min(1),staleChatIds:pt(N().min(1))});const pB=ne({organizationId:N(),agentCount:He(),chatCount:He(),messageCount:He()});ne({totalAgents:He(),totalChats:He(),totalMessages:He(),byOrganization:pt(pB)});const pc=Pe(["pending","assigned","working","completed","failed","cancelled"]),B1=Pe(["agent","admin"]),gB=Pe(["assigned","status_changed","cancelled"]);ne({taskId:N(),event:gB,title:N(),body:N().default(""),status:pc,fromStatus:pc.optional(),originRef:N().nullable().optional()});const yB=ne({title:N().min(1).max(500),body:N().optional(),assigneeAgentId:N().optional(),originRef:N().max(500).optional(),metadata:Xt(N(),Ut()).optional()});yB.extend({organizationId:N().optional()});ne({status:Pe(["working","completed","failed"]),result:N().optional()});ne({assigneeAgentId:N().nullable().optional(),status:pc.optional(),result:N().optional()});ne({chatId:N().min(1)});const vB=ne({id:N(),organizationId:N(),title:N(),body:N(),status:pc,assigneeAgentId:N().nullable(),createdByType:B1,createdById:N(),originRef:N().nullable(),result:N().nullable(),metadata:Xt(N(),Ut()),createdAt:N(),updatedAt:N(),cancelledAt:N().nullable(),cancelledByType:B1.nullable(),cancelledById:N().nullable()}),bB=ne({taskId:N(),chatId:N(),linkedByAgentId:N().nullable(),linkedAt:N()});vB.extend({chats:pt(bB)});ne({status:pc.optional(),assigneeAgentId:N().optional(),originRef:N().optional(),limit:Uc().int().min(1).max(100).default(20),cursor:N().optional()});const xB=Pe(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);ne({taskId:N(),signal:xB,reason:N()});const wB=Pe(["active","suspended"]);ne({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:wB,createdAt:N(),updatedAt:N()});ne({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});ne({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});ne({type:Sn("auth"),token:N().min(1)});const SB=ne({wsInboxDeliver:Xn().default(!1)}).partial();ne({type:Sn("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:He().int().nonnegative(),capabilities:SB.optional()}).passthrough();const TN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function kB(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],u=t[a];!s||!u||(u.workingCount+=s.workingCount,u.errorMask=u.errorMask||s.errorMask)}return t}const jB=2e3,EB=3e4;let Gi=null,gc=!1,Xf=0,Ju=null;const Oy=new Set;let Zi=null,Is=0;function CB(e){for(const t of Oy)try{t(e)}catch{}if(Zi){if(e.type==="notification")Zi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Zi.invalidateQueries({queryKey:["activity"]}),Zi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Zi.invalidateQueries({queryKey:["me","chats"]}),t&&(Zi.invalidateQueries({queryKey:["chat-messages",t]}),Zi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function Vv(){const e=uh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Gi=s,s.onmessage=u=>{if(s===Gi)try{const c=JSON.parse(u.data);CB(c)}catch{}},s.onopen=()=>{s===Gi&&(Xf=0)},s.onclose=u=>{if(s===Gi&&(Gi=null,!(gc||Is===0))){if(u.code===4001){qO().then(c=>{gc||Is===0||(c?(Xf=0,Vv()):F1())});return}F1()}}}function F1(){Xf++;const e=Math.min(jB*2**(Xf-1),EB);Ju=setTimeout(()=>{Ju=null,!gc&&Is>0&&Vv()},e)}function NB(){gc=!0,Ju&&(clearTimeout(Ju),Ju=null),Gi&&(Gi.close(1e3,"unmount"),Gi=null)}function AN(e){const{onMessage:t,enabled:n=!0}=e??{},a=ln(),s=x.useRef(t);s.current=t,x.useEffect(()=>{Zi=a},[a]),x.useEffect(()=>{if(!n)return;const u=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return Oy.add(u),Is++,Is===1&&(gc=!1,Vv()),()=>{Oy.delete(u),Is--,Is===0&&NB()}},[n])}const _B=x.createContext({aggregated:TN,agents:{},receivedAtMs:null,stale:!0});function TB({children:e}){const[t,n]=x.useState({aggregated:TN,agents:{},receivedAtMs:null}),[a,s]=x.useState(()=>Date.now());AN({onMessage:c=>{const f=lB.safeParse(c);f.success&&n({aggregated:kB(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),x.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const u=x.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return o.jsx(_B.Provider,{value:u,children:e})}function jh(e){return Ee.get(`/agents/${e}/config`)}function Eh(e,t){return Ee.patch(`/agents/${e}/config`,t)}function AB(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function RB(e){return Ee.get(`/agents/${e}/client-status`)}function OB({className:e,style:t,...n}){return o.jsx("div",{className:Re("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function zB({onClick:e,children:t}){return o.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 DB(){return o.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function MB({children:e,mono:t}){return o.jsx("span",{className:Re("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const IB={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 ga({tone:e="neutral",className:t,style:n,...a}){const s=IB[e],u={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return o.jsx("span",{className:Re("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...u},...a})}function zy({children:e,right:t,className:n,style:a,...s}){return o.jsxs("div",{className:Re("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:[o.jsx("span",{children:e}),t]})}function Qv({className:e,style:t,...n}){return o.jsx("span",{className:Re("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function ec({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?o.jsxs("span",{className:Re("shrink-0",n),style:a,role:"img","aria-label":"working",children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),o.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"?o.jsx("span",{className:Re("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:o.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?o.jsx("span",{className:Re("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"?o.jsx("span",{className:Re("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):o.jsx("span",{className:Re("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function LB(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function yc({state:e,className:t}){const n=e!==null&&LB(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return o.jsxs("span",{className:Re("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[o.jsx(ec,{state:n,size:7}),n]})}function xf({label:e,value:t,accent:n}){return o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[o.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),o.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function PB({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?o.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:o.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[o.jsxs("span",{children:["Runs on ",o.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),o.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function UB(e){const{agent:t}=e,[n,a]=x.useState(!1),[s,u]=x.useState(!1),c=t.displayName||t.name||t.uuid;return o.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:[o.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[o.jsx(Ws,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),o.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),o.jsxs("div",{children:[t.status==="active"?o.jsx(dg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:o.jsx(pe,{variant:"outline",size:"xs",onClick:()=>u(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):o.jsx(dg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:o.jsx(pe,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),o.jsx(dg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:o.jsxs(pe,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[o.jsx(uc,{className:"h-3 w-3"}),"Delete"]})})]}),o.jsx(BB,{open:s,onOpenChange:u,label:c,onConfirm:()=>{u(!1),e.onSuspend()},pending:e.suspendPending}),o.jsx(FB,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function dg(e){return o.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:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),o.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),o.jsx("div",{children:e.action})]})}function BB({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsxs(An,{children:['Suspend "',n,'"?']})}),o.jsx("div",{className:"space-y-3",children:o.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."})}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),o.jsx(pe,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function FB({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[u,c]=x.useState("");function f(m){m.preventDefault(),u===n&&a()}return o.jsx(Tn,{open:e,onOpenChange:m=>{t(m),m||c("")},children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsxs(An,{children:['Delete "',n,'"?']})}),o.jsxs("form",{onSubmit:f,className:"space-y-4",children:[o.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",o.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),o.jsx($t,{value:u,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),o.jsx(pe,{type:"submit",variant:"destructive",disabled:u!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var $B="Label",RN=x.forwardRef((e,t)=>o.jsx(di.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));RN.displayName=$B;var qB=RN;const kt=x.forwardRef(({className:e,...t},n)=>o.jsx(qB,{ref:n,className:Re("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));kt.displayName="Label";const En=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Re("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));En.displayName="Panel";const sa=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Re("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}));sa.displayName="PanelHeader";const la=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Re("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));la.displayName="PanelTitle";const Wn=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Re(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Wn.displayName="PanelBody";const HB={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 Kv({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:u}){const c=HB[e],f=e==="deleted";return o.jsxs("div",{className:Re("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:[o.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&o.jsx("span",{className:Re("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!u&&(f?o.jsxs(pe,{size:"sm",variant:"ghost",onClick:a,children:[o.jsx(aD,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):o.jsxs("div",{className:"flex gap-1 shrink-0",children:[o.jsxs(pe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[o.jsx(dh,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"sr-only",children:"Edit"})]}),o.jsxs(pe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[o.jsx(uc,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function ZB(e){const[t,n]=x.useState(null),[a,s]=x.useState(()=>new Set),u=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 o.jsxs(En,{children:[o.jsxs(sa,{children:[o.jsxs(la,{children:["Environment variables (",c,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.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===Qf,g=m&&!h&&!!f.value.value,p=a.has(f.key);let b;return m?g&&p?b=f.value.value:b="••••••":b=f.value.value||o.jsx("em",{children:"(empty)"}),o.jsxs(Kv,{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:[o.jsx("span",{className:"font-mono font-medium",children:f.value.key}),o.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:b}),m&&o.jsx(cE,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&o.jsx("button",{type:"button",onClick:()=>g&&u(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?p?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":p?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:p?o.jsx(Az,{className:"h-3.5 w-3.5"}):o.jsx(lE,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&o.jsx(GB,{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 GB({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[u,c]=x.useState((n==null?void 0:n.key)??""),[f,m]=x.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,g]=x.useState((n==null?void 0:n.sensitive)??!1),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),g((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function w(k){if(k.preventDefault(),!u.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(u)){b(`Another entry already uses key "${u}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=Qf),!h&&!n&&!f){b("Value is required for non-sensitive entries.");return}s({key:u,value:j,sensitive:h})}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:n?"Edit environment variable":"Add environment variable"})}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"env-key",children:"Key"}),o.jsx($t,{id:"env-key",value:u,onChange:k=>c(k.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&o.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"env-value",children:"Value"}),o.jsx($t,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:k=>m(k.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),o.jsxs("label",{className:"flex items-center gap-2 text-body",children:[o.jsx("input",{type:"checkbox",checked:h,onChange:k=>g(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),p&&o.jsx("p",{className:"text-body text-destructive",children:p}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function VB(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return o.jsxs(En,{children:[o.jsxs(sa,{children:[o.jsxs(la,{children:["Git repositories (",a,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const u=s.value.localPath??Kf(s.value.url);return o.jsxs(Kv,{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:[o.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&o.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),o.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",u||"./"]})]},s.key)})}),t&&o.jsx(QB,{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 QB({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[u,c]=x.useState((n==null?void 0:n.url)??""),[f,m]=x.useState((n==null?void 0:n.ref)??""),[h,g]=x.useState((n==null?void 0:n.localPath)??""),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),g((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function w(k){k.preventDefault();const j=u.trim();if(!j){b("URL is required.");return}const C=h.trim()||Kf(j);if(C&&a.has(C)){b(`Another repo already occupies local path "${C}".`);return}const E={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(E)}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:n?"Edit Git repository":"Add Git repository"})}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-url",children:"URL"}),o.jsx($t,{id:"git-url",value:u,onChange:k=>c(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),o.jsx($t,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-path",children:"Local path (optional)"}),o.jsx($t,{id:"git-path",value:h,onChange:k=>g(k.target.value),placeholder:Kf(u)||"repo-name",className:"font-mono"}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),p&&o.jsx("p",{className:"text-body text-destructive",children:p}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function KB({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:u,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return o.jsx("span",{className:Re("mono text-label",u),style:{color:"var(--fg-4)",...c},title:f,children:s});const g=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),p=a==="accent"?"var(--accent-dim)":void 0,b=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?o.jsxs("span",{className:Re("inline-flex flex-col leading-tight",u),style:{gap:1,...c},title:g??void 0,children:[h&&o.jsx("span",{className:"text-body",style:{color:p},children:t}),m&&o.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]}):o.jsxs("span",{className:Re("inline-flex items-baseline gap-1.5",u),style:c,title:g??void 0,children:[h&&o.jsx("span",{style:{color:p},children:t}),m&&o.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]})}function Yv(){return Ee.get(Ln("/members"))}function YB(e,t){return Ee.patch(Ln(`/members/${encodeURIComponent(e)}`),t)}function XB(e){return Ee.delete(Ln(`/members/${encodeURIComponent(e)}`))}function ON(){const{data:e}=Qe({queryKey:["members","name-map"],queryFn:Yv,staleTime:3e4});return x.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function WB({agent:e,onSave:t}){const[n,a]=x.useState(!1),s=Av(),u=ON(),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(b=>typeof b=="string"):[],g=e.managerId?u(e.managerId):null,p=e.delegateMention?s(e.delegateMention):null;return o.jsxs(En,{children:[o.jsxs(sa,{children:[o.jsx(la,{children:"Profile"}),e.status==="active"&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[o.jsx(dh,{className:"h-3 w-3"})," Edit"]})]}),o.jsxs(Wn,{className:"text-body space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&o.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),o.jsxs("span",{className:"text-muted-foreground",children:["delegate ",o.jsx(KB,{name:p.name,displayName:p.displayName})]})]})]}),o.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[o.jsxs("span",{children:["owner ",o.jsx("span",{className:"text-foreground",children:g??"—"})]}),m&&o.jsxs("span",{children:["role ",o.jsx("span",{className:"text-foreground",children:m})]}),o.jsxs("span",{children:["type ",o.jsx(ga,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),o.jsxs("span",{children:["visibility"," ",o.jsx(ga,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&o.jsxs("span",{children:["domains"," ",o.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>o.jsx(ga,{tone:"outline",children:b},b))})]})]})]}),o.jsx(JB,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function JB({agent:e,open:t,onOpenChange:n,onSave:a}){var D;const{memberId:s,role:u}=ot(),[c,f]=x.useState(e.displayName),[m,h]=x.useState(e.delegateMention??""),[g,p]=x.useState(e.visibility),[b,w]=x.useState(!1),[k,j]=x.useState(null);x.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),p(e.visibility),j(null))},[t,e]);const C=e.type==="human",E=u==="admin"||e.managerId===s,T=Qe({queryKey:["agents-for-delegate"],queryFn:async()=>(await Ic({limit:100})).items.filter(z=>z.type==="personal_assistant"&&z.status==="active"),enabled:t&&C});async function O(P){P.preventDefault(),j(null);const z=c.trim();if(!z){j("Display name is required.");return}w(!0);try{const B={displayName:z,delegateMention:m||null};g!==e.visibility&&(B.visibility=g),await a(B),n(!1)}catch(B){j(B instanceof Error?B.message:String(B))}finally{w(!1)}}return o.jsx(Tn,{open:t,onOpenChange:n,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:"Edit Identity"})}),o.jsxs("form",{onSubmit:O,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Agent name"}),o.jsx($t,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-display",children:"Display Name"}),o.jsx($t,{id:"id-display",value:c,onChange:P=>f(P.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-visibility",children:"Visibility"}),o.jsxs("select",{id:"id-visibility",value:g,onChange:P=>p(P.target.value),disabled:!E,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:[o.jsx("option",{value:U1.PRIVATE,children:"Private — only the manager"}),o.jsx("option",{value:U1.ORGANIZATION,children:"Organization — all members"})]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:E?"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."})]}),C&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-delegate",children:"Delegate Mention"}),o.jsxs("select",{id:"id-delegate",value:m,onChange:P=>h(P.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"",children:"None"}),(D=T.data)==null?void 0:D.map(P=>o.jsx("option",{value:P.uuid,children:P.displayName?`${P.displayName} (@${P.name??P.uuid})`:P.name?`@${P.name}`:P.uuid},P.uuid))]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&o.jsx("p",{className:"text-body text-destructive",children:k}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function e9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function t9(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return o.jsxs(En,{children:[o.jsxs(sa,{children:[o.jsxs(la,{children:["MCP servers (",a,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.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 u=s.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(s.value.name);return o.jsxs(Kv,{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:[o.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),o.jsx("span",{className:"font-medium font-mono",children:s.value.name}),o.jsx(ga,{tone:e9(u),children:u}),o.jsx("span",{className:"text-caption text-muted-foreground truncate",children:n9(s.value)})]},s.key)})}),t&&o.jsx(r9,{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 n9(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 r9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[u,c]=x.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=x.useState((n==null?void 0:n.name)??""),[h,g]=x.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[p,b]=x.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,k]=x.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,C]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),g((n==null?void 0:n.transport)==="stdio"?n.command:""),b((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),C(null))},[e,n]);function E(T){if(T.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){C("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){C(`Another MCP server is already named "${f}".`);return}let O;if(u==="stdio"){if(!h.trim()){C("stdio transport requires a command.");return}const D=p.trim().split(/\s+/).filter(P=>P.length>0);O={name:f,transport:"stdio",command:h.trim(),...D.length?{args:D}:{}}}else{const D=w.trim();try{new URL(D)}catch{C("URL is not valid.");return}O={name:f,transport:u,url:D}}s(O)}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:n?"Edit MCP server":"Add MCP server"})}),o.jsxs("form",{onSubmit:E,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-transport",children:"Transport"}),o.jsxs("select",{id:"mcp-transport",value:u,onChange:T=>c(T.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:[o.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),o.jsx("option",{value:"http",children:"http"}),o.jsx("option",{value:"sse",children:"sse"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-name",children:"Name"}),o.jsx($t,{id:"mcp-name",value:f,onChange:T=>m(T.target.value),placeholder:"playwright",className:"font-mono"})]}),u==="stdio"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-command",children:"Command"}),o.jsx($t,{id:"mcp-command",value:h,onChange:T=>g(T.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),o.jsx($t,{id:"mcp-args",value:p,onChange:T=>b(T.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-url",children:"URL"}),o.jsx($t,{id:"mcp-url",value:w,onChange:T=>k(T.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&o.jsx("p",{className:"text-body text-destructive",children:j}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{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"}],i9=[{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"}],s9={"claude-code":a9,codex:i9},l9={"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."},o9={value:"",label:"(unset — inherits local)"};function u9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:u="claude-code"}){const c=e!==t,f=s9[u],m=x.useMemo(()=>{const h=[o9,...f];return e!==""&&!f.some(g=>g.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return o.jsxs(En,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[o.jsxs(sa,{children:[o.jsxs(la,{children:["Model",c&&o.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&&o.jsx(pe,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),o.jsxs(Wn,{className:"space-y-2",children:[o.jsx(c9,{items:m,value:e,onChange:n,disabled:s}),o.jsx("p",{className:"text-caption text-muted-foreground",children:l9[u]})]})]})}function c9({items:e,value:t,onChange:n,disabled:a}){const[s,u]=x.useState(!1),[c,f]=x.useState(null),m=x.useRef(null),h=x.useRef(null),g=e.find(b=>b.value===t)??e[0],p=x.useCallback(()=>{const b=m.current;if(!b)return;const w=b.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return x.useLayoutEffect(()=>{s&&p()},[s,p]),x.useEffect(()=>{if(!s)return;const b=j=>{var E,T;const C=j.target;(E=m.current)!=null&&E.contains(C)||(T=h.current)!=null&&T.contains(C)||u(!1)},w=j=>{var C;j.key==="Escape"&&(u(!1),(C=m.current)==null||C.focus())},k=()=>p();return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s,p]),o.jsxs("div",{className:"max-w-md",children:[o.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>u(b=>!b),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[o.jsx("span",{className:"truncate",style:{color:(g==null?void 0:g.value)===""?"var(--fg-3)":void 0},children:(g==null?void 0:g.label)??t}),o.jsx(yv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&kv.createPortal(o.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(b=>{const w=b.value===t;return o.jsxs("button",{type:"button",onClick:()=>{n(b.value),u(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:b.value===""?"var(--fg-3)":void 0},children:[o.jsx(wr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),o.jsx("span",{className:"flex-1 truncate",children:b.label}),b.hint&&o.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:b.hint})]},b.value||"__unset")})}),document.body)]})}function d9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const f9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m9={};function $1(e,t){return(m9.jsx?h9:f9).test(e)}const p9=/[ \t\n\f\r]/g;function g9(e){return typeof e=="object"?e.type==="text"?q1(e.value):!1:q1(e)}function q1(e){return e.replace(p9,"")===""}class Bc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Bc.prototype.normal={};Bc.prototype.property={};Bc.prototype.space=void 0;function zN(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Bc(n,a,t)}function Dy(e){return e.toLowerCase()}class Er{constructor(t,n){this.attribute=n,this.property=t}}Er.prototype.attribute="";Er.prototype.booleanish=!1;Er.prototype.boolean=!1;Er.prototype.commaOrSpaceSeparated=!1;Er.prototype.commaSeparated=!1;Er.prototype.defined=!1;Er.prototype.mustUseProperty=!1;Er.prototype.number=!1;Er.prototype.overloadedBoolean=!1;Er.prototype.property="";Er.prototype.spaceSeparated=!1;Er.prototype.space=void 0;let y9=0;const Je=nl(),wn=nl(),My=nl(),ye=nl(),Pt=nl(),no=nl(),Mr=nl();function nl(){return 2**++y9}const Iy=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:wn,commaOrSpaceSeparated:Mr,commaSeparated:no,number:ye,overloadedBoolean:My,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),fg=Object.keys(Iy);class Xv extends Er{constructor(t,n,a,s){let u=-1;if(super(t,n),H1(this,"space",s),typeof a=="number")for(;++u<fg.length;){const c=fg[u];H1(this,fg[u],(a&Iy[c])===Iy[c])}}}Xv.prototype.defined=!0;function H1(e,t,n){n&&(e[t]=n)}function Oo(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const u=new Xv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),t[a]=u,n[Dy(a)]=a,n[Dy(u.attribute)]=a}return new Bc(t,n,e.space)}const DN=Oo({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,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:ye,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Pt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Pt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:wn,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function MN(e,t){return t in e?e[t]:t}function IN(e,t){return MN(e,t.toLowerCase())}const v9=Oo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:no,acceptCharset:Pt,accessKey:Pt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Pt,autoFocus:Je,autoPlay:Je,blocking:Pt,capture:null,charSet:null,checked:Je,cite:null,className:Pt,cols:ye,colSpan:null,content:null,contentEditable:wn,controls:Je,controlsList:Pt,coords:ye|no,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:My,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Pt,height:ye,hidden:My,high:ye,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:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,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:ye,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:ye,rowSpan:ye,sandbox:Pt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:wn,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,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:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:IN}),b9=Oo({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:Mr,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,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:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:no,g2:no,glyphName:no,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,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:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mr,rev:Mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mr,requiredFeatures:Mr,requiredFonts:Mr,requiredFormats:Mr,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mr,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:MN}),LN=Oo({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()}}),PN=Oo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:IN}),UN=Oo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),x9={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"},w9=/[A-Z]/g,Z1=/-[a-z]/g,S9=/^data[-\w.:]+$/i;function k9(e,t){const n=Dy(t);let a=t,s=Er;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&S9.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Z1,E9);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Z1.test(u)){let c=u.replace(w9,j9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=Xv}return new s(a,t)}function j9(e){return"-"+e.toLowerCase()}function E9(e){return e.charAt(1).toUpperCase()}const C9=zN([DN,v9,LN,PN,UN],"html"),Wv=zN([DN,b9,LN,PN,UN],"svg");function N9(e){return e.join(" ").trim()}var $l={},hg,G1;function _9(){if(G1)return hg;G1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
358
- `,h="/",g="*",p="",b="comment",w="declaration";function k(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var T=1,O=1;function D(Y){var ee=Y.match(t);ee&&(T+=ee.length);var H=Y.lastIndexOf(m);O=~H?Y.length-H:O+Y.length}function P(){var Y={line:T,column:O};return function(ee){return ee.position=new z(Y),V(),ee}}function z(Y){this.start=Y,this.end={line:T,column:O},this.source=E.source}z.prototype.content=C;function B(Y){var ee=new Error(E.source+":"+T+":"+O+": "+Y);if(ee.reason=Y,ee.filename=E.source,ee.line=T,ee.column=O,ee.source=C,!E.silent)throw ee}function M(Y){var ee=Y.exec(C);if(ee){var H=ee[0];return D(H),C=C.slice(H.length),ee}}function V(){M(n)}function I(Y){var ee;for(Y=Y||[];ee=X();)ee!==!1&&Y.push(ee);return Y}function X(){var Y=P();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var ee=2;p!=C.charAt(ee)&&(g!=C.charAt(ee)||h!=C.charAt(ee+1));)++ee;if(ee+=2,p===C.charAt(ee-1))return B("End of comment missing");var H=C.slice(2,ee-2);return O+=2,D(H),C=C.slice(ee),O+=2,Y({type:b,comment:H})}}function se(){var Y=P(),ee=M(a);if(ee){if(X(),!M(s))return B("property missing ':'");var H=M(u),re=Y({type:w,property:j(ee[0].replace(e,p)),value:H?j(H[0].replace(e,p)):p});return M(c),re}}function Se(){var Y=[];I(Y);for(var ee;ee=se();)ee!==!1&&(Y.push(ee),I(Y));return Y}return V(),Se()}function j(C){return C?C.replace(f,p):p}return hg=k,hg}var V1;function T9(){if(V1)return $l;V1=1;var e=$l&&$l.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty($l,"__esModule",{value:!0}),$l.default=n;const t=e(_9());function n(a,s){let u=null;if(!a||typeof a!="string")return u;const c=(0,t.default)(a),f=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;f?s(h,g,m):g&&(u=u||{},u[h]=g)}),u}return $l}var Uu={},Q1;function A9(){if(Q1)return Uu;Q1=1,Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,u=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return Uu.camelCase=m,Uu}var Bu,K1;function R9(){if(K1)return Bu;K1=1;var e=Bu&&Bu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(T9()),n=A9();function a(s,u){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(c[(0,n.camelCase)(f,u)]=m)}),c}return a.default=a,Bu=a,Bu}var O9=R9();const z9=ah(O9),BN=FN("end"),Jv=FN("start");function FN(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 D9(e){const t=Jv(e),n=BN(e);if(t&&n)return{start:t,end:n}}function tc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Y1(e.position):"start"in e||"end"in e?Y1(e):"line"in e||"column"in e?Ly(e):""}function Ly(e){return X1(e&&e.line)+":"+X1(e&&e.column)}function Y1(e){return Ly(e&&e.start)+"-"+Ly(e&&e.end)}function X1(e){return e&&typeof e=="number"?e:1}class Jn extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",u={},c=!1;if(n&&("line"in n&&"column"in n?u={place:n}:"start"in n&&"end"in n?u={place:n}:"type"in n?u={ancestors:[n],place:n.position}:u={...n}),typeof t=="string"?s=t:!u.cause&&t&&(c=!0,s=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.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=tc(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jn.prototype.file="";Jn.prototype.name="";Jn.prototype.reason="";Jn.prototype.message="";Jn.prototype.stack="";Jn.prototype.column=void 0;Jn.prototype.line=void 0;Jn.prototype.ancestors=void 0;Jn.prototype.cause=void 0;Jn.prototype.fatal=void 0;Jn.prototype.place=void 0;Jn.prototype.ruleId=void 0;Jn.prototype.source=void 0;const eb={}.hasOwnProperty,M9=new Map,I9=/[A-Z]/g,L9=new Set(["table","tbody","thead","tfoot","tr"]),P9=new Set(["td","th"]),$N="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function U9(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=V9(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=G9(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"?Wv:C9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=qN(s,e,void 0);return u&&typeof u!="string"?u:s.create(e,s.Fragment,{children:u||void 0},void 0)}function qN(e,t,n){if(t.type==="element")return B9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return F9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return q9(e,t,n);if(t.type==="mdxjsEsm")return $9(e,t);if(t.type==="root")return H9(e,t,n);if(t.type==="text")return Z9(e,t)}function B9(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=Wv,e.schema=s),e.ancestors.push(t);const u=ZN(e,t.tagName,!1),c=Q9(e,t);let f=nb(e,t);return L9.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!g9(m):!0})),HN(e,c,u,t),tb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,u,c,n)}function F9(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)}vc(e,t.position)}function $9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vc(e,t.position)}function q9(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=Wv,e.schema=s),e.ancestors.push(t);const u=t.name===null?e.Fragment:ZN(e,t.name,!0),c=K9(e,t),f=nb(e,t);return HN(e,c,u,t),tb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,u,c,n)}function H9(e,t,n){const a={};return tb(a,nb(e,t)),e.create(t,e.Fragment,a,n)}function Z9(e,t){return t.value}function HN(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function tb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function G9(e,t,n){return a;function a(s,u,c,f){const h=Array.isArray(c.children)?n:t;return f?h(u,c,f):h(u,c)}}function V9(e,t){return n;function n(a,s,u,c){const f=Array.isArray(u.children),m=Jv(a);return t(s,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function Q9(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&eb.call(t.properties,s)){const u=Y9(e,s,t.properties[s]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&P9.has(t.tagName)?a=f:n[c]=f}}if(a){const u=n.style||(n.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function K9(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else vc(e,t.position);else{const s=a.name;let u;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,u=e.evaluater.evaluateExpression(f.expression)}else vc(e,t.position);else u=a.value===null?!0:a.value;n[s]=u}return n}function nb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:M9;for(;++a<t.children.length;){const u=t.children[a];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const f=qN(e,u,c);f!==void 0&&n.push(f)}return n}function Y9(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?d9(n):N9(n)),a.property==="style"){let s=typeof n=="object"?n:X9(e,String(n));return e.stylePropertyNameCase==="css"&&(s=W9(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?x9[a.property]||a.property:a.attribute,n]}}function X9(e,t){try{return z9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new Jn("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=$N+"#cannot-parse-style-attribute",s}}function ZN(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let u=-1,c;for(;++u<s.length;){const f=$1(s[u])?{type:"Identifier",name:s[u]}:{type:"Literal",value:s[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}a=c}else a=$1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return eb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);vc(e)}function vc(e,t){const n=new Jn("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=$N+"#cannot-handle-mdx-estrees-without-createevaluater",n}function W9(e){const t={};let n;for(n in e)eb.call(e,n)&&(t[J9(n)]=e[n]);return t}function J9(e){let t=e.replace(I9,eF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eF(e){return"-"+e.toLowerCase()}const mg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tF={};function rb(e,t){const n=tF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return GN(e,a,s)}function GN(e,t,n){if(nF(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 W1(e.children,t,n)}return Array.isArray(e)?W1(e,t,n):""}function W1(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=GN(e[s],t,n);return a.join("")}function nF(e){return!!(e&&typeof e=="object")}const J1=document.createElement("i");function ab(e){const t="&"+e+";";J1.innerHTML=t;const n=J1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pr(e,t,n,a){const s=e.length;let u=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);u<a.length;)c=a.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function ta(e,t){return e.length>0?(Pr(e,e.length,0,t),e):t}const ek={}.hasOwnProperty;function VN(e){const t={};let n=-1;for(;++n<e.length;)rF(t,e[n]);return t}function rF(e,t){let n;for(n in t){const s=(ek.call(e,n)?e[n]:void 0)||(e[n]={}),u=t[n];let c;if(u)for(c in u){ek.call(s,c)||(s[c]=[]);const f=u[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]);Pr(e,0,0,a)}function QN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function va(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const or=ms(/[A-Za-z]/),Yn=ms(/[\dA-Za-z]/),iF=ms(/[#-'*+\--9=?A-Z^-~]/);function Wf(e){return e!==null&&(e<32||e===127)}const Py=ms(/\d/),sF=ms(/[\dA-Fa-f]/),lF=ms(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const Ch=ms(new RegExp("\\p{P}|\\p{S}","u")),Ys=ms(/\s/);function ms(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const u=e.charCodeAt(n);let c="";if(u===37&&Yn(e.charCodeAt(n+1))&&Yn(e.charCodeAt(n+2)))s=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(n+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),s=1):c="�"}else c=String.fromCharCode(u);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 vt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return lt(m)?(e.enter(n),f(m)):t(m)}function f(m){return lt(m)&&u++<s?(e.consume(m),f):(e.exit(n),t(m))}}const oF={tokenize:uF};function uF(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"),vt(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const cF={tokenize:dF},tk={tokenize:fF};function dF(e){const t=this,n=[];let a=0,s,u,c;return f;function f(O){if(a<n.length){const D=n[a];return t.containerState=D[1],e.attempt(D[0].continuation,m,h)(O)}return h(O)}function m(O){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const D=t.events.length;let P=D,z;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){z=t.events[P][1].end;break}E(a);let B=D;for(;B<t.events.length;)t.events[B][1].end={...z},B++;return Pr(t.events,P+1,0,t.events.slice(D)),t.events.length=B,h(O)}return f(O)}function h(O){if(a===n.length){if(!s)return b(O);if(s.currentConstruct&&s.currentConstruct.concrete)return k(O);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(tk,g,p)(O)}function g(O){return s&&T(),E(a),b(O)}function p(O){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,k(O)}function b(O){return t.containerState={},e.attempt(tk,w,k)(O)}function w(O){return a++,n.push([t.currentConstruct,t.containerState]),b(O)}function k(O){if(O===null){s&&T(),E(0),e.consume(O);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:u}),j(O)}function j(O){if(O===null){C(e.exit("chunkFlow"),!0),E(0),e.consume(O);return}return Fe(O)?(e.consume(O),C(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(O),j)}function C(O,D){const P=t.sliceStream(O);if(D&&P.push(null),O.previous=u,u&&(u.next=O),u=O,s.defineSkip(O.start),s.write(P),t.parser.lazy[O.start.line]){let z=s.events.length;for(;z--;)if(s.events[z][1].start.offset<c&&(!s.events[z][1].end||s.events[z][1].end.offset>c))return;const B=t.events.length;let M=B,V,I;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(V){I=t.events[M][1].end;break}V=!0}for(E(a),z=B;z<t.events.length;)t.events[z][1].end={...I},z++;Pr(t.events,M+1,0,t.events.slice(B)),t.events.length=z}}function E(O){let D=n.length;for(;D-- >O;){const P=n[D];t.containerState=P[1],P[0].exit.call(t,e)}n.length=O}function T(){s.write([null]),u=void 0,s=void 0,t.containerState._closeFlow=void 0}}function fF(e,t,n){return vt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wo(e){if(e===null||It(e)||Ys(e))return 1;if(Ch(e))return 2}function Nh(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const u=e[s].resolveAll;u&&!a.includes(u)&&(t=u(t,n),a.push(u))}return t}const Uy={name:"attention",resolveAll:hF,tokenize:mF};function hF(e,t){let n=-1,a,s,u,c,f,m,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[a][1].end},b={...e[n][1].start};nk(p,-m),nk(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:p,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=ta(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ta(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",u,t]]),h=ta(h,Nh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ta(h,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=ta(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Pr(e,a-1,n-a+3,h),n=a+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function mF(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=wo(a);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),g=wo(m),p=!g||g===2&&s||n.includes(m),b=!s||s===2&&g||n.includes(a);return h._open=!!(u===42?p:p&&(s||!b)),h._close=!!(u===42?b:b&&(g||!p)),t(m)}}function nk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pF={name:"autolink",tokenize:gF};function gF(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"),u}function u(w){return or(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Yn(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||Yn(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||Wf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):iF(w)?(e.consume(w),h):n(w)}function g(w){return Yn(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),a=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):b(w)}function b(w){if((w===45||Yn(w))&&a++<63){const k=w===45?b:p;return e.consume(w),k}return n(w)}}const Fc={partial:!0,tokenize:yF};function yF(e,t,n){return a;function a(u){return lt(u)?vt(e,s,"linePrefix")(u):s(u)}function s(u){return u===null||Fe(u)?t(u):n(u)}}const KN={continuation:{tokenize:bF},exit:xF,name:"blockQuote",tokenize:vF};function vF(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"),u}return n(c)}function u(c){return lt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function bF(e,t,n){const a=this;return s;function s(c){return lt(c)?vt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(KN,t,n)(c)}}function xF(e){e.exit("blockQuote")}const YN={name:"characterEscape",tokenize:wF};function wF(e,t,n){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),s}function s(u){return lF(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(u)}}const XN={name:"characterReference",tokenize:SF};function SF(e,t,n){const a=this;let s=0,u,c;return f;function f(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),m}function m(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,c=Yn,g(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=sF,g):(e.enter("characterReferenceValue"),u=7,c=Py,g(p))}function g(p){if(p===59&&s){const b=e.exit("characterReferenceValue");return c===Yn&&!ab(a.sliceSerialize(b))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(p)&&s++<u?(e.consume(p),g):n(p)}}const rk={partial:!0,tokenize:jF},ak={concrete:!0,name:"codeFenced",tokenize:kF};function kF(e,t,n){const a=this,s={partial:!0,tokenize:P};let u=0,c=0,f;return m;function m(z){return h(z)}function h(z){const B=a.events[a.events.length-1];return u=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(z)}function g(z){return z===f?(c++,e.consume(z),g):c<3?n(z):(e.exit("codeFencedFenceSequence"),lt(z)?vt(e,p,"whitespace")(z):p(z))}function p(z){return z===null||Fe(z)?(e.exit("codeFencedFence"),a.interrupt?t(z):e.check(rk,j,D)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Fe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(z)):lt(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vt(e,w,"whitespace")(z)):z===96&&z===f?n(z):(e.consume(z),b)}function w(z){return z===null||Fe(z)?p(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||Fe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(z)):z===96&&z===f?n(z):(e.consume(z),k)}function j(z){return e.attempt(s,D,C)(z)}function C(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),E}function E(z){return u>0&&lt(z)?vt(e,T,"linePrefix",u+1)(z):T(z)}function T(z){return z===null||Fe(z)?e.check(rk,j,D)(z):(e.enter("codeFlowValue"),O(z))}function O(z){return z===null||Fe(z)?(e.exit("codeFlowValue"),T(z)):(e.consume(z),O)}function D(z){return e.exit("codeFenced"),t(z)}function P(z,B,M){let V=0;return I;function I(ee){return z.enter("lineEnding"),z.consume(ee),z.exit("lineEnding"),X}function X(ee){return z.enter("codeFencedFence"),lt(ee)?vt(z,se,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):se(ee)}function se(ee){return ee===f?(z.enter("codeFencedFenceSequence"),Se(ee)):M(ee)}function Se(ee){return ee===f?(V++,z.consume(ee),Se):V>=c?(z.exit("codeFencedFenceSequence"),lt(ee)?vt(z,Y,"whitespace")(ee):Y(ee)):M(ee)}function Y(ee){return ee===null||Fe(ee)?(z.exit("codeFencedFence"),B(ee)):M(ee)}}}function jF(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"),u)}function u(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const pg={name:"codeIndented",tokenize:CF},EF={partial:!0,tokenize:NF};function CF(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),vt(e,u,"linePrefix",5)(h)}function u(h){const g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Fe(h)?e.attempt(EF,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function NF(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):vt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Fe(c)?s(c):n(c)}}const _F={name:"codeText",previous:AF,resolve:TF,tokenize:RF};function TF(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 AF(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function RF(e,t,n){let a=0,s,u;return c;function c(p){return e.enter("codeText"),e.enter("codeTextSequence"),f(p)}function f(p){return p===96?(e.consume(p),a++,f):(e.exit("codeTextSequence"),m(p))}function m(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),m):p===96?(u=e.enter("codeTextSequence"),s=0,g(p)):Fe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||Fe(p)?(e.exit("codeTextData"),m(p)):(e.consume(p),h)}function g(p){return p===96?(e.consume(p),s++,g):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(u.type="codeTextData",h(p))}}class OF{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 u=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Fu(this.left,a),u.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),Fu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fu(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);Fu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fu(this.left,n.reverse())}}}function Fu(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 WN(e){const t={};let n=-1,a,s,u,c,f,m,h;const g=new OF(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(a=g.get(n),n&&a[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,zF(g,n)),n=t[n],h=!0);else if(a[1]._container){for(u=n,s=void 0;u--;)if(c=g.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...g.get(s)[1].start},f=g.slice(s,n),f.unshift(a),g.splice(s,n-s+1,f))}}return Pr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function zF(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const u=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let g,p,b=-1,w=n,k=0,j=0;const C=[j];for(;w;){for(;e.get(++s)[1]!==w;);u.push(s),w._tokenizer||(g=a.sliceStream(w),w.next||g.push(null),p&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,C.push(j),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):C.pop(),b=C.length;b--;){const E=f.slice(C[b],C[b+1]),T=u.pop();m.push([T,T+E.length-1]),e.splice(T,2,E)}for(m.reverse(),b=-1;++b<m.length;)h[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return h}const DF={resolve:IF,tokenize:LF},MF={partial:!0,tokenize:PF};function IF(e){return WN(e),e}function LF(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?u(f):Fe(f)?e.check(MF,c,u)(f):(e.consume(f),s)}function u(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 PF(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),vt(e,u,"linePrefix")}function u(c){if(c===null||Fe(c))return n(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function JN(e,t,n,a,s,u,c,f,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return p;function p(E){return E===60?(e.enter(a),e.enter(s),e.enter(u),e.consume(E),e.exit(u),b):E===null||E===32||E===41||Wf(E)?n(E):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(E))}function b(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(E))}function w(E){return E===62?(e.exit("chunkString"),e.exit(f),b(E)):E===null||E===60||Fe(E)?n(E):(e.consume(E),E===92?k:w)}function k(E){return E===60||E===62||E===92?(e.consume(E),w):w(E)}function j(E){return!g&&(E===null||E===41||It(E))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(E)):g<h&&E===40?(e.consume(E),g++,j):E===41?(e.consume(E),g--,j):E===null||E===32||E===40||Wf(E)?n(E):(e.consume(E),E===92?C:j)}function C(E){return E===40||E===41||E===92?(e.consume(E),j):j(E)}}function e_(e,t,n,a,s,u){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(u),g}function g(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(u),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):Fe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||Fe(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!lt(w)),w===92?b:p)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,p):p(w)}}function t_(e,t,n,a,s,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(s),e.consume(b),e.exit(s),c=b===40?41:b,m):n(b)}function m(b){return b===c?(e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):(e.enter(u),h(b))}function h(b){return b===c?(e.exit(u),m(c)):b===null?n(b):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),vt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||Fe(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?p:g)}function p(b){return b===c||b===92?(e.consume(b),g):g(b)}}function nc(e,t){let n;return a;function a(s){return Fe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):lt(s)?vt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const UF={name:"definition",tokenize:FF},BF={partial:!0,tokenize:$F};function FF(e,t,n){const a=this;let s;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return e_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return It(w)?nc(e,h)(w):h(w)}function h(w){return JN(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(BF,p,p)(w)}function p(w){return lt(w)?vt(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Fe(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function $F(e,t,n){return a;function a(f){return It(f)?nc(e,s)(f):n(f)}function s(f){return t_(e,u,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return lt(f)?vt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):n(f)}}const qF={name:"hardBreakEscape",tokenize:HF};function HF(e,t,n){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),s}function s(u){return Fe(u)?(e.exit("hardBreakEscape"),t(u)):n(u)}}const ZF={name:"headingAtx",resolve:GF,tokenize:VF};function GF(e,t){let n=e.length-2,a=3,s,u;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},u={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Pr(e,a,n-a+1,[["enter",s,t],["enter",u,t],["exit",u,t],["exit",s,t]])),e}function VF(e,t,n){let a=0;return s;function s(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&a++<6?(e.consume(g),c):g===null||It(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||Fe(g)?(e.exit("atxHeading"),t(g)):lt(g)?vt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||It(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const QF=["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"],ik=["pre","script","style","textarea"],KF={concrete:!0,name:"htmlFlow",resolveTo:WF,tokenize:JF},YF={partial:!0,tokenize:t$},XF={partial:!0,tokenize:e$};function WF(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 JF(e,t,n){const a=this;let s,u,c,f,m;return h;function h(_){return g(_)}function g(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),p}function p(_){return _===33?(e.consume(_),b):_===47?(e.consume(_),u=!0,j):_===63?(e.consume(_),s=3,a.interrupt?t:R):or(_)?(e.consume(_),c=String.fromCharCode(_),C):n(_)}function b(_){return _===45?(e.consume(_),s=2,w):_===91?(e.consume(_),s=5,f=0,k):or(_)?(e.consume(_),s=4,a.interrupt?t:R):n(_)}function w(_){return _===45?(e.consume(_),a.interrupt?t:R):n(_)}function k(_){const Z="CDATA[";return _===Z.charCodeAt(f++)?(e.consume(_),f===Z.length?a.interrupt?t:se:k):n(_)}function j(_){return or(_)?(e.consume(_),c=String.fromCharCode(_),C):n(_)}function C(_){if(_===null||_===47||_===62||It(_)){const Z=_===47,K=c.toLowerCase();return!Z&&!u&&ik.includes(K)?(s=1,a.interrupt?t(_):se(_)):QF.includes(c.toLowerCase())?(s=6,Z?(e.consume(_),E):a.interrupt?t(_):se(_)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(_):u?T(_):O(_))}return _===45||Yn(_)?(e.consume(_),c+=String.fromCharCode(_),C):n(_)}function E(_){return _===62?(e.consume(_),a.interrupt?t:se):n(_)}function T(_){return lt(_)?(e.consume(_),T):I(_)}function O(_){return _===47?(e.consume(_),I):_===58||_===95||or(_)?(e.consume(_),D):lt(_)?(e.consume(_),O):I(_)}function D(_){return _===45||_===46||_===58||_===95||Yn(_)?(e.consume(_),D):P(_)}function P(_){return _===61?(e.consume(_),z):lt(_)?(e.consume(_),P):O(_)}function z(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),m=_,B):lt(_)?(e.consume(_),z):M(_)}function B(_){return _===m?(e.consume(_),m=null,V):_===null||Fe(_)?n(_):(e.consume(_),B)}function M(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||It(_)?P(_):(e.consume(_),M)}function V(_){return _===47||_===62||lt(_)?O(_):n(_)}function I(_){return _===62?(e.consume(_),X):n(_)}function X(_){return _===null||Fe(_)?se(_):lt(_)?(e.consume(_),X):n(_)}function se(_){return _===45&&s===2?(e.consume(_),H):_===60&&s===1?(e.consume(_),re):_===62&&s===4?(e.consume(_),L):_===63&&s===3?(e.consume(_),R):_===93&&s===5?(e.consume(_),ze):Fe(_)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(YF,F,Se)(_)):_===null||Fe(_)?(e.exit("htmlFlowData"),Se(_)):(e.consume(_),se)}function Se(_){return e.check(XF,Y,F)(_)}function Y(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ee}function ee(_){return _===null||Fe(_)?Se(_):(e.enter("htmlFlowData"),se(_))}function H(_){return _===45?(e.consume(_),R):se(_)}function re(_){return _===47?(e.consume(_),c="",xe):se(_)}function xe(_){if(_===62){const Z=c.toLowerCase();return ik.includes(Z)?(e.consume(_),L):se(_)}return or(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),xe):se(_)}function ze(_){return _===93?(e.consume(_),R):se(_)}function R(_){return _===62?(e.consume(_),L):_===45&&s===2?(e.consume(_),R):se(_)}function L(_){return _===null||Fe(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),L)}function F(_){return e.exit("htmlFlow"),t(_)}}function e$(e,t,n){const a=this;return s;function s(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):n(c)}function u(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function t$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Fc,t,n)}}const n$={name:"htmlText",tokenize:r$};function r$(e,t,n){const a=this;let s,u,c;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),P):R===63?(e.consume(R),O):or(R)?(e.consume(R),M):n(R)}function h(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),u=0,k):or(R)?(e.consume(R),T):n(R)}function g(R){return R===45?(e.consume(R),w):n(R)}function p(R){return R===null?n(R):R===45?(e.consume(R),b):Fe(R)?(c=p,re(R)):(e.consume(R),p)}function b(R){return R===45?(e.consume(R),w):p(R)}function w(R){return R===62?H(R):R===45?b(R):p(R)}function k(R){const L="CDATA[";return R===L.charCodeAt(u++)?(e.consume(R),u===L.length?j:k):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),C):Fe(R)?(c=j,re(R)):(e.consume(R),j)}function C(R){return R===93?(e.consume(R),E):j(R)}function E(R){return R===62?H(R):R===93?(e.consume(R),E):j(R)}function T(R){return R===null||R===62?H(R):Fe(R)?(c=T,re(R)):(e.consume(R),T)}function O(R){return R===null?n(R):R===63?(e.consume(R),D):Fe(R)?(c=O,re(R)):(e.consume(R),O)}function D(R){return R===62?H(R):O(R)}function P(R){return or(R)?(e.consume(R),z):n(R)}function z(R){return R===45||Yn(R)?(e.consume(R),z):B(R)}function B(R){return Fe(R)?(c=B,re(R)):lt(R)?(e.consume(R),B):H(R)}function M(R){return R===45||Yn(R)?(e.consume(R),M):R===47||R===62||It(R)?V(R):n(R)}function V(R){return R===47?(e.consume(R),H):R===58||R===95||or(R)?(e.consume(R),I):Fe(R)?(c=V,re(R)):lt(R)?(e.consume(R),V):H(R)}function I(R){return R===45||R===46||R===58||R===95||Yn(R)?(e.consume(R),I):X(R)}function X(R){return R===61?(e.consume(R),se):Fe(R)?(c=X,re(R)):lt(R)?(e.consume(R),X):V(R)}function se(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,Se):Fe(R)?(c=se,re(R)):lt(R)?(e.consume(R),se):(e.consume(R),Y)}function Se(R){return R===s?(e.consume(R),s=void 0,ee):R===null?n(R):Fe(R)?(c=Se,re(R)):(e.consume(R),Se)}function Y(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||It(R)?V(R):(e.consume(R),Y)}function ee(R){return R===47||R===62||It(R)?V(R):n(R)}function H(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function re(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),xe}function xe(R){return lt(R)?vt(e,ze,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ze(R)}function ze(R){return e.enter("htmlTextData"),c(R)}}const ib={name:"labelEnd",resolveAll:l$,resolveTo:o$,tokenize:u$},a$={tokenize:c$},i$={tokenize:d$},s$={tokenize:f$};function l$(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&&Pr(e,0,e.length,n),e}function o$(e,t){let n=e.length,a=0,s,u,c,f;for(;n--;)if(s=e[n][1],u){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&&(u=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[u+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ta(f,e.slice(u+1,u+a+3)),f=ta(f,[["enter",g,t]]),f=ta(f,Nh(t.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),t)),f=ta(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=ta(f,e.slice(c+1)),f=ta(f,[["exit",m,t]]),Pr(e,u,e.length,f),e}function u$(e,t,n){const a=this;let s=a.events.length,u,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){u=a.events[s][1];break}return f;function f(b){return u?u._inactive?p(b):(c=a.parser.defined.includes(va(a.sliceSerialize({start:u.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):n(b)}function m(b){return b===40?e.attempt(a$,g,c?g:p)(b):b===91?e.attempt(i$,g,c?h:p)(b):c?g(b):p(b)}function h(b){return e.attempt(s$,g,p)(b)}function g(b){return t(b)}function p(b){return u._balanced=!0,n(b)}}function c$(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return It(p)?nc(e,u)(p):u(p)}function u(p){return p===41?g(p):JN(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function c(p){return It(p)?nc(e,m)(p):g(p)}function f(p){return n(p)}function m(p){return p===34||p===39||p===40?t_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function h(p){return It(p)?nc(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function d$(e,t,n){const a=this;return s;function s(f){return e_.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function f$(e,t,n){return a;function a(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),s}function s(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):n(u)}}const h$={name:"labelStartImage",resolveAll:ib.resolveAll,tokenize:m$};function m$(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(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 p$={name:"labelStartLink",resolveAll:ib.resolveAll,tokenize:g$};function g$(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"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const gg={name:"lineEnding",tokenize:y$};function y$(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),vt(e,t,"linePrefix")}}const Lf={name:"thematicBreak",tokenize:v$};function v$(e,t,n){let a=0,s;return u;function u(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),lt(h)?vt(e,f,"whitespace")(h):f(h))}}const yr={continuation:{tokenize:S$},exit:j$,name:"list",tokenize:w$},b$={partial:!0,tokenize:E$},x$={partial:!0,tokenize:k$};function w$(e,t,n){const a=this,s=a.events[a.events.length-1];let u=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const k=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:Py(w)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Lf,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 Py(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(Fc,a.interrupt?n:g,e.attempt(b$,b,p))}function g(w){return a.containerState.initialBlankLine=!0,u++,b(w)}function p(w){return lt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):n(w)}function b(w){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function S$(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Fc,s,u);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,vt(e,t,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!lt(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(x$,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,vt(e,e.attempt(yr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function k$(e,t,n){const a=this;return vt(e,s,"listItemIndent",a.containerState.size+1);function s(u){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(u):n(u)}}function j$(e){e.exit(this.containerState.type)}function E$(e,t,n){const a=this;return vt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(u){const c=a.events[a.events.length-1];return!lt(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):n(u)}}const sk={name:"setextUnderline",resolveTo:C$,tokenize:N$};function C$(e,t){let n=e.length,a,s,u;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),!u&&e[n][1].type==="definition"&&(u=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",u?(e.splice(s,0,["enter",c,t]),e.splice(u+1,0,["exit",e[a][1],t]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function N$(e,t,n){const a=this;let s;return u;function u(h){let g=a.events.length,p;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){p=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),lt(h)?vt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const _$={tokenize:T$};function T$(e){const t=this,n=e.attempt(Fc,a,e.attempt(this.parser.constructs.flowInitial,s,vt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(DF,s)),"linePrefix")));return n;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const A$={resolveAll:r_()},R$=n_("string"),O$=n_("text");function n_(e){return{resolveAll:r_(e==="text"?z$:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],u=n.attempt(s,c,f);return c;function c(g){return h(g)?u(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),m}function m(g){return h(g)?(n.exit("data"),u(g)):(n.consume(g),m)}function h(g){if(g===null)return!0;const p=s[g];let b=-1;if(p)for(;++b<p.length;){const w=p[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function r_(e){return t;function t(n,a){let s=-1,u;for(;++s<=n.length;)u===void 0?n[s]&&n[s][1].type==="data"&&(u=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==u+2&&(n[u][1].end=n[s-1][1].end,n.splice(u+2,s-u-2),s=u+2),u=void 0);return e?e(n,a):n}}function z$(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 u=s.length,c=-1,f=0,m;for(;u--;){const h=s[u];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){u++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:a.start._bufferIndex+c,_index:a.start._index+u,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 D$={42:yr,43:yr,45:yr,48:yr,49:yr,50:yr,51:yr,52:yr,53:yr,54:yr,55:yr,56:yr,57:yr,62:KN},M$={91:UF},I$={[-2]:pg,[-1]:pg,32:pg},L$={35:ZF,42:Lf,45:[sk,Lf],60:KF,61:sk,95:Lf,96:ak,126:ak},P$={38:XN,92:YN},U$={[-5]:gg,[-4]:gg,[-3]:gg,33:h$,38:XN,42:Uy,60:[pF,n$],91:p$,92:[qF,YN],93:ib,95:Uy,96:_F},B$={null:[Uy,A$]},F$={null:[42,95]},$$={null:[]},q$=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:F$,contentInitial:M$,disable:$$,document:D$,flow:L$,flowInitial:I$,insideSpan:B$,string:P$,text:U$},Symbol.toStringTag,{value:"Module"}));function H$(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={},u=[];let c=[],f=[];const m={attempt:B(P),check:B(z),consume:T,enter:O,exit:D,interrupt:B(z,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:p};let g=t.tokenize.call(h,m);return t.resolveAll&&u.push(t),h;function p(X){return c=ta(c,X),C(),c[c.length-1]!==null?[]:(M(t,0),h.events=Nh(u,h.events,h),h.events)}function b(X,se){return G$(w(X),se)}function w(X){return Z$(c,X)}function k(){const{_bufferIndex:X,_index:se,line:Se,column:Y,offset:ee}=a;return{_bufferIndex:X,_index:se,line:Se,column:Y,offset:ee}}function j(X){s[X.line]=X.column,I()}function C(){let X;for(;a._index<c.length;){const se=c[a._index];if(typeof se=="string")for(X=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===X&&a._bufferIndex<se.length;)E(se.charCodeAt(a._bufferIndex));else E(se)}}function E(X){g=g(X)}function T(X){Fe(X)?(a.line++,a.column=1,a.offset+=X===-3?2:1,I()):X!==-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=X}function O(X,se){const Se=se||{};return Se.type=X,Se.start=k(),h.events.push(["enter",Se,h]),f.push(Se),Se}function D(X){const se=f.pop();return se.end=k(),h.events.push(["exit",se,h]),se}function P(X,se){M(X,se.from)}function z(X,se){se.restore()}function B(X,se){return Se;function Se(Y,ee,H){let re,xe,ze,R;return Array.isArray(Y)?F(Y):"tokenize"in Y?F([Y]):L(Y);function L(ue){return we;function we(ve){const me=ve!==null&&ue[ve],Ge=ve!==null&&ue.null,Be=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return F(Be)(ve)}}function F(ue){return re=ue,xe=0,ue.length===0?H:_(ue[xe])}function _(ue){return we;function we(ve){return R=V(),ze=ue,ue.partial||(h.currentConstruct=ue),ue.name&&h.parser.constructs.disable.null.includes(ue.name)?K():ue.tokenize.call(se?Object.assign(Object.create(h),se):h,m,Z,K)(ve)}}function Z(ue){return X(ze,R),ee}function K(ue){return R.restore(),++xe<re.length?_(re[xe]):H}}}function M(X,se){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&Pr(h.events,se,h.events.length-se,X.resolve(h.events.slice(se),h)),X.resolveTo&&(h.events=X.resolveTo(h.events,h))}function V(){const X=k(),se=h.previous,Se=h.currentConstruct,Y=h.events.length,ee=Array.from(f);return{from:Y,restore:H};function H(){a=X,h.previous=se,h.currentConstruct=Se,h.events.length=Y,f=ee,I()}}function I(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function Z$(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,u=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,u)];else{if(c=e.slice(n,s),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[s].slice(0,u))}return c}function G$(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const u=e[n];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
359
- `;break}case-3:{c=`\r
360
- `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(u)}s=u===-2,a.push(c)}return a.join("")}function V$(e){const a={constructs:VN([q$,...(e||{}).extensions||[]]),content:s(oF),defined:[],document:s(cF),flow:s(_$),lazy:{},string:s(R$),text:s(O$)};return a;function s(u){return c;function c(f){return H$(a,u,f)}}}function Q$(e){for(;!WN(e););return e}const lk=/[\0\t\n\r]/g;function K$(){let e=1,t="",n=!0,a;return s;function s(u,c,f){const m=[];let h,g,p,b,w;for(u=t+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),p=0,t="",n&&(u.charCodeAt(0)===65279&&p++,n=void 0);p<u.length;){if(lk.lastIndex=p,h=lk.exec(u),b=h&&h.index!==void 0?h.index:u.length,w=u.charCodeAt(b),!h){t=u.slice(p);break}if(w===10&&p===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),p<b&&(m.push(u.slice(p,b)),e+=b-p),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}p=b+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const Y$=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function X$(e){return e.replace(Y$,W$)}function W$(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),u=s===120||s===88;return QN(n.slice(u?2:1),u?16:10)}return ab(n)||e}const a_={}.hasOwnProperty;function J$(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),e8(n)(Q$(V$(n).document().write(K$()(e,t,!0))))}function e8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(en),autolinkProtocol:V,autolinkEmail:V,atxHeading:u(je),blockQuote:u(Ge),characterEscape:V,characterReference:V,codeFenced:u(Be),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Be,c),codeText:u(bt,c),codeTextData:V,data:V,codeFlowValue:V,definition:u(yt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ae),hardBreakEscape:u(Me),hardBreakTrailing:u(Me),htmlFlow:u(Ye,c),htmlFlowData:V,htmlText:u(Ye,c),htmlTextData:V,image:u(mn),label:c,link:u(en),listItem:u(Br),listItemValue:b,listOrdered:u(Cr,p),listUnordered:u(Cr),paragraph:u(hi),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(je),strong:u(mi),thematicBreak:u(oa)},exit:{atxHeading:m(),atxHeadingSequence:P,autolink:m(),autolinkEmail:me,autolinkProtocol:ve,blockQuote:m(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:ue,characterReference:we,codeFenced:m(C),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:I,codeIndented:m(E),codeText:m(ee),codeTextData:I,data:I,definition:m(),definitionDestinationString:D,definitionLabelString:T,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(se),hardBreakTrailing:m(se),htmlFlow:m(Se),htmlFlowData:I,htmlText:m(Y),htmlTextData:I,image:m(re),label:ze,labelText:xe,lineEnding:X,link:m(H),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Z,resourceDestinationString:R,resourceTitleString:L,resource:F,setextHeading:m(M),setextHeadingLineSequence:B,setextHeadingText:z,strong:m(),thematicBreak:m()}};i_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(le){let ge={type:"root",children:[]};const Ue={stack:[ge],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Ze=[];let nt=-1;for(;++nt<le.length;)if(le[nt][1].type==="listOrdered"||le[nt][1].type==="listUnordered")if(le[nt][0]==="enter")Ze.push(nt);else{const un=Ze.pop();nt=s(le,un,nt)}for(nt=-1;++nt<le.length;){const un=t[le[nt][0]];a_.call(un,le[nt][1].type)&&un[le[nt][1].type].call(Object.assign({sliceSerialize:le[nt][2].sliceSerialize},Ue),le[nt][1])}if(Ue.tokenStack.length>0){const un=Ue.tokenStack[Ue.tokenStack.length-1];(un[1]||ok).call(Ue,void 0,un[0])}for(ge.position={start:$i(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:$i(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<t.transforms.length;)ge=t.transforms[nt](ge)||ge;return ge}function s(le,ge,Ue){let Ze=ge-1,nt=-1,un=!1,er,qt,Lt,At;for(;++Ze<=Ue;){const rt=le[Ze];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?nt++:nt--,At=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(er&&!At&&!nt&&!Lt&&(Lt=Ze),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!nt&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||nt===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(er){let tr=Ze;for(qt=void 0;tr--;){const On=le[tr];if(On[1].type==="lineEnding"||On[1].type==="lineEndingBlank"){if(On[0]==="exit")continue;qt&&(le[qt][1].type="lineEndingBlank",un=!0),On[1].type="lineEnding",qt=tr}else if(!(On[1].type==="linePrefix"||On[1].type==="blockQuotePrefix"||On[1].type==="blockQuotePrefixWhitespace"||On[1].type==="blockQuoteMarker"||On[1].type==="listItemIndent"))break}Lt&&(!qt||Lt<qt)&&(er._spread=!0),er.end=Object.assign({},qt?le[qt][1].start:rt[1].end),le.splice(qt||Ze,0,["exit",er,rt[2]]),Ze++,Ue++}if(rt[1].type==="listItemPrefix"){const tr={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};er=tr,le.splice(Ze,0,["enter",tr,rt[2]]),Ze++,Ue++,Lt=void 0,At=!0}}}return le[ge][1]._spread=un,Ue}function u(le,ge){return Ue;function Ue(Ze){f.call(this,le(Ze),Ze),ge&&ge.call(this,Ze)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(le,ge,Ue){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ge,Ue||void 0]),le.position={start:$i(ge.start),end:void 0}}function m(le){return ge;function ge(Ue){le&&le.call(this,Ue),h.call(this,Ue)}}function h(le,ge){const Ue=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==le.type&&(ge?ge.call(this,le,Ze[0]):(Ze[1]||ok).call(this,le,Ze[0]));else throw new Error("Cannot close `"+le.type+"` ("+tc({start:le.start,end:le.end})+"): it’s not open");Ue.position.end=$i(le.end)}function g(){return rb(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function w(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=le}function k(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le.replace(/(\r?\n|\r)$/g,"")}function T(le){const ge=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ge,Ue.identifier=va(this.sliceSerialize(le)).toLowerCase()}function O(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.title=le}function D(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.url=le}function P(le){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Ue=this.sliceSerialize(le).length;ge.depth=Ue}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function B(le){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function V(le){const Ue=this.stack[this.stack.length-1].children;let Ze=Ue[Ue.length-1];(!Ze||Ze.type!=="text")&&(Ze=on(),Ze.position={start:$i(le.start),end:void 0},Ue.push(Ze)),this.stack.push(Ze)}function I(le){const ge=this.stack.pop();ge.value+=this.sliceSerialize(le),ge.position.end=$i(le.end)}function X(le){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=ge.children[ge.children.length-1];Ue.position.end=$i(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(V.call(this,le),I.call(this,le))}function se(){this.data.atHardBreak=!0}function Se(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function Y(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function ee(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function H(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ge,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function re(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ge,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function xe(le){const ge=this.sliceSerialize(le),Ue=this.stack[this.stack.length-2];Ue.label=X$(ge),Ue.identifier=va(ge).toLowerCase()}function ze(){const le=this.stack[this.stack.length-1],ge=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Ze=le.children;Ue.children=Ze}else Ue.alt=ge}function R(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.url=le}function L(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.title=le}function F(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function Z(le){const ge=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ge,Ue.identifier=va(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function K(le){this.data.characterReferenceType=le.type}function ue(le){const ge=this.sliceSerialize(le),Ue=this.data.characterReferenceType;let Ze;Ue?(Ze=QN(ge,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=ab(ge);const nt=this.stack[this.stack.length-1];nt.value+=Ze}function we(le){const ge=this.stack.pop();ge.position.end=$i(le.end)}function ve(le){I.call(this,le);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(le)}function me(le){I.call(this,le);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(le)}function Ge(){return{type:"blockquote",children:[]}}function Be(){return{type:"code",lang:null,meta:null,value:""}}function bt(){return{type:"inlineCode",value:""}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ae(){return{type:"emphasis",children:[]}}function je(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function Ye(){return{type:"html",value:""}}function mn(){return{type:"image",title:null,url:"",alt:null}}function en(){return{type:"link",title:null,url:"",children:[]}}function Cr(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Br(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function hi(){return{type:"paragraph",children:[]}}function mi(){return{type:"strong",children:[]}}function on(){return{type:"text",value:""}}function oa(){return{type:"thematicBreak"}}}function $i(e){return{line:e.line,column:e.column,offset:e.offset}}function i_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?i_(e,a):t8(e,a)}}function t8(e,t){let n;for(n in t)if(a_.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 ok(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+tc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is still open")}function n8(e){const t=this;t.parser=n;function n(a){return J$(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function r8(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:`
361
- `}]}function i8(e,t){const n=t.value?t.value+`
362
- `:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let u={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}function s8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function l8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=zo(a.toLowerCase()),u=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=u+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 u8(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 c8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function s_(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),u=s[0];u&&u.type==="text"?u.value="["+u.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 d8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return s_(e,t);const s={src:zo(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const u={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,u),e.applyData(t,u)}function f8(e,t){const n={src:zo(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 h8(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 m8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return s_(e,t);const s={href:zo(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const u={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,u),e.applyData(t,u)}function p8(e,t){const n={href:zo(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 g8(e,t,n){const a=e.all(t),s=n?y8(n):l_(t),u={},c=[];if(typeof t.checked=="boolean"){const g=a[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const g=a[f];(s||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
363
- `}),g.type==="element"&&g.tagName==="p"&&!s?c.push(...g.children):c.push(g)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
364
- `});const h={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,h),e.applyData(t,h)}function y8(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=l_(n[a])}return t}function l_(e){const t=e.spread;return t??e.children.length>1}function v8(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 u={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,u),e.applyData(t,u)}function b8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function w8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function S8(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=Jv(t.children[1]),m=BN(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),s.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,u),e.applyData(t,u)}function k8(e,t,n){const a=n?n.children:void 0,u=(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 p=t.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:u,properties:b,children:[]};p&&(k.children=e.all(p),e.patch(p,k),k=e.applyData(p,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function j8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const uk=9,ck=32;function E8(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const u=[];for(;a;)u.push(dk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return u.push(dk(t.slice(s),s>0,!1)),u.join("")}function dk(e,t,n){let a=0,s=e.length;if(t){let u=e.codePointAt(a);for(;u===uk||u===ck;)a++,u=e.codePointAt(a)}if(n){let u=e.codePointAt(s-1);for(;u===uk||u===ck;)s--,u=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function C8(e,t){const n={type:"text",value:E8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function N8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const _8={blockquote:r8,break:a8,code:i8,delete:s8,emphasis:l8,footnoteReference:o8,heading:u8,html:c8,imageReference:d8,image:f8,inlineCode:h8,linkReference:m8,link:p8,listItem:g8,list:v8,paragraph:b8,root:x8,strong:w8,table:S8,tableCell:j8,tableRow:k8,text:C8,thematicBreak:N8,toml:wf,yaml:wf,definition:wf,footnoteDefinition:wf};function wf(){}const o_=-1,_h=0,rc=1,Jf=2,sb=3,lb=4,ob=5,ub=6,u_=7,c_=8,fk=typeof self=="object"?self:globalThis,T8=(e,t)=>{const n=(s,u)=>(e.set(u,s),s),a=s=>{if(e.has(s))return e.get(s);const[u,c]=t[s];switch(u){case _h:case o_:return n(c,s);case rc:{const f=n([],s);for(const m of c)f.push(a(m));return f}case Jf:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case sb:return n(new Date(c),s);case lb:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case ob:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case ub:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case u_:{const{name:f,message:m}=c;return n(new fk[f](m),s)}case c_: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 fk[u](c),s)};return a},hk=e=>T8(new Map,e)(0),ql="",{toString:A8}={},{keys:R8}=Object,$u=e=>{const t=typeof e;if(t!=="object"||!e)return[_h,t];const n=A8.call(e).slice(8,-1);switch(n){case"Array":return[rc,ql];case"Object":return[Jf,ql];case"Date":return[sb,ql];case"RegExp":return[lb,ql];case"Map":return[ob,ql];case"Set":return[ub,ql];case"DataView":return[rc,n]}return n.includes("Array")?[rc,n]:n.includes("Error")?[u_,n]:[Jf,n]},Sf=([e,t])=>e===_h&&(t==="function"||t==="symbol"),O8=(e,t,n,a)=>{const s=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},u=c=>{if(n.has(c))return n.get(c);let[f,m]=$u(c);switch(f){case _h:{let g=c;switch(m){case"bigint":f=c_,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return s([o_],c)}return s([f,g],c)}case rc:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),s([m,[...b]],c)}const g=[],p=s([f,g],c);for(const b of c)g.push(u(b));return p}case Jf:{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 u(c.toJSON());const g=[],p=s([f,g],c);for(const b of R8(c))(e||!Sf($u(c[b])))&&g.push([u(b),u(c[b])]);return p}case sb:return s([f,c.toISOString()],c);case lb:{const{source:g,flags:p}=c;return s([f,{source:g,flags:p}],c)}case ob:{const g=[],p=s([f,g],c);for(const[b,w]of c)(e||!(Sf($u(b))||Sf($u(w))))&&g.push([u(b),u(w)]);return p}case ub:{const g=[],p=s([f,g],c);for(const b of c)(e||!Sf($u(b)))&&g.push(u(b));return p}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return u},mk=(e,{json:t,lossy:n}={})=>{const a=[];return O8(!(t||n),!!t,new Map,a)(e),a},eh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?hk(mk(e,t)):structuredClone(e):(e,t)=>hk(mk(e,t));function z8(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 D8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function M8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||z8,a=e.options.footnoteBackLabel||D8,s=e.options.footnoteLabel||"Footnotes",u=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 g=e.all(h),p=String(h.identifier).toUpperCase(),b=zo(p.toLowerCase());let w=0;const k=[],j=e.footnoteCounts.get(p);for(;j!==void 0&&++w<=j;){k.length>0&&k.push({type:"text",value:" "});let T=typeof n=="string"?n:n(m,w);typeof T=="string"&&(T={type:"text",value:T}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const T=C.children[C.children.length-1];T&&T.type==="text"?T.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...k)}else g.push(...k);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,E),f.push(E)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...eh(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
365
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
366
- `}]}}const Th=(function(e){if(e==null)return U8;if(typeof e=="function")return Ah(e);if(typeof e=="object")return Array.isArray(e)?I8(e):L8(e);if(typeof e=="string")return P8(e);throw new Error("Expected function, string, or object as test")});function I8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Th(e[n]);return Ah(a);function a(...s){let u=-1;for(;++u<t.length;)if(t[u].apply(this,s))return!0;return!1}}function L8(e){const t=e;return Ah(n);function n(a){const s=a;let u;for(u in e)if(s[u]!==t[u])return!1;return!0}}function P8(e){return Ah(t);function t(n){return n&&n.type===e}}function Ah(e){return t;function t(n,a,s){return!!(B8(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function U8(){return!0}function B8(e){return e!==null&&typeof e=="object"&&"type"in e}const d_=[],F8=!0,By=!1,$8="skip";function f_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const u=Th(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,g){const p=m&&typeof m=="object"?m:{};if(typeof p.type=="string"){const w=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=d_,k,j,C;if((!t||u(m,h,g[g.length-1]||void 0))&&(w=q8(n(m,g)),w[0]===By))return w;if("children"in m&&m.children){const E=m;if(E.children&&w[0]!==$8)for(j=(a?E.children.length:-1)+c,C=g.concat(E);j>-1&&j<E.children.length;){const T=E.children[j];if(k=f(T,j,C)(),k[0]===By)return k;j=typeof k[1]=="number"?k[1]:j+c}}return w}}}function q8(e){return Array.isArray(e)?e:typeof e=="number"?[F8,e]:e==null?d_:[e]}function cb(e,t,n,a){let s,u,c;typeof t=="function"&&typeof n!="function"?(u=void 0,c=t,s=n):(u=t,c=n,s=a),f_(e,u,f,s);function f(m,h){const g=h[h.length-1],p=g?g.children.indexOf(m):void 0;return c(m,p,g)}}const Fy={}.hasOwnProperty,H8={};function Z8(e,t){const n=t||H8,a=new Map,s=new Map,u=new Map,c={..._8,...n.handlers},f={all:h,applyData:V8,definitionById:a,footnoteById:s,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:n,patch:G8,wrap:K8};return cb(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?a:s,b=String(g.identifier).toUpperCase();p.has(b)||p.set(b,g)}}),f;function m(g,p){const b=g.type,w=f.handlers[b];if(Fy.call(f.handlers,b)&&w)return w(f,g,p);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:j,...C}=g,E=eh(C);return E.children=f.all(g),E}return eh(g)}return(f.options.unknownHandler||Q8)(f,g,p)}function h(g){const p=[];if("children"in g){const b=g.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],g);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=pk(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=pk(j.value))}Array.isArray(k)?p.push(...k):p.push(k)}}}return p}}function G8(e,t){e.position&&(t.position=D9(e))}function V8(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,u=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"&&u&&Object.assign(n.properties,eh(u)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Q8(e,t){const n=t.data||{},a="value"in t&&!(Fy.call(n,"hProperties")||Fy.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 K8(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
367
- `});++a<e.length;)a&&n.push({type:"text",value:`
368
- `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
369
- `}),n}function pk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gk(e,t){const n=Z8(e,t),a=n.one(e,void 0),s=M8(n),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&u.children.push({type:"text",value:`
370
- `},s),u}function Y8(e,t){return e&&"run"in e?async function(n,a){const s=gk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return gk(n,{file:a,...e||t})}}function yk(e){if(e)throw e}var yg,vk;function X8(){if(vk)return yg;vk=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]"},u=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!p)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(a)return a(h,g).value}else return;return h[g]};return yg=function m(){var h,g,p,b,w,k,j=arguments[0],C=1,E=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<E;++C)if(h=arguments[C],h!=null)for(g in h)p=f(j,g),b=f(h,g),j!==b&&(T&&b&&(u(b)||(w=s(b)))?(w?(w=!1,k=p&&s(p)?p:[]):k=p&&u(p)?p:{},c(j,{name:g,newValue:m(T,k,b)})):typeof b<"u"&&c(j,{name:g,newValue:b}));return j},yg}var W8=X8();const vg=ah(W8);function $y(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 J8(){const e=[],t={run:n,use:a};return t;function n(...s){let u=-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 g=e[++u];let p=-1;if(m){c(m);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,g?eq(g,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 eq(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 g=h;if(f&&n)throw g;return s(g)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,s):m instanceof Error?s(m):u(m))}function s(c,...f){n||(n=!0,t(c,...f))}function u(c){s(null,c)}}const Ca={basename:tq,dirname:nq,extname:rq,join:aq,sep:"/"};function tq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');$c(e);let n=0,a=-1,s=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(u){n=s+1;break}}else a<0&&(u=!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(u){n=s+1;break}}else c<0&&(u=!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 nq(e){if($c(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 rq(e){$c(e);let t=e.length,n=-1,a=0,s=-1,u=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:u!==1&&(u=1):s>-1&&(u=-1)}return s<0||n<0||u===0||u===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function aq(...e){let t=-1,n;for(;++t<e.length;)$c(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iq(n)}function iq(e){$c(e);const t=e.codePointAt(0)===47;let n=sq(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function sq(e,t){let n="",a=0,s=-1,u=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||u===1))if(s!==c-1&&u===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,u=0;continue}}else if(n.length>0){n="",a=0,s=c,u=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,u=0}else f===46&&u>-1?u++:u=-1}return n}function $c(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lq={cwd:oq};function oq(){return"/"}function qy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uq(e){if(typeof e=="string")e=new URL(e);else if(!qy(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return cq(e)}function cq(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const bg=["history","path","basename","stem","extname","dirname"];class h_{constructor(t){let n;t?qy(t)?n={path:t}:typeof t=="string"||dq(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":lq.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<bg.length;){const u=bg[a];u in n&&n[u]!==void 0&&n[u]!==null&&(this[u]=u==="history"?[...n[u]]:n[u])}let s;for(s in n)bg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ca.basename(this.path):void 0}set basename(t){wg(t,"basename"),xg(t,"basename"),this.path=Ca.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ca.dirname(this.path):void 0}set dirname(t){bk(this.basename,"dirname"),this.path=Ca.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ca.extname(this.path):void 0}set extname(t){if(xg(t,"extname"),bk(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=Ca.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){qy(t)&&(t=uq(t)),wg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ca.basename(this.path,this.extname):void 0}set stem(t){wg(t,"stem"),xg(t,"stem"),this.path=Ca.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 Jn(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xg(e,t){if(e&&e.includes(Ca.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ca.sep+"`")}function wg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fq=(function(e){const a=this.constructor.prototype,s=a[e],u=function(){return s.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),hq={}.hasOwnProperty;class db extends fq{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=J8()}copy(){const t=new db;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(vg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jg("data",this.frozen),this.namespace[t]=n,this):hq.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=kf(t),a=this.parser||this.Parser;return Sg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Sg("process",this.parser||this.Parser),kg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(u,c){const f=kf(t),m=a.parse(f);a.run(m,f,function(g,p,b){if(g||!p||!b)return h(g);const w=p,k=a.stringify(w,b);gq(k)?b.value=k:b.result=k,h(g,b)});function h(g,p){g||!p?c(g):u?u(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),Sg("processSync",this.parser||this.Parser),kg("processSync",this.compiler||this.Compiler),this.process(t,s),wk("processSync","process",n),a;function s(u,c){n=!0,yk(u),a=c}}run(t,n,a){xk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=kf(n);s.run(t,m,h);function h(g,p,b){const w=p||t;g?f(g):c?c(w):a(void 0,w,b)}}}runSync(t,n){let a=!1,s;return this.run(t,n,u),wk("runSync","run",a),s;function u(c,f){yk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=kf(n),s=this.compiler||this.Compiler;return kg("stringify",s),xk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(jg("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...p]=h;m(g,p)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=vg(!0,s.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const p=h[g];u(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let p=-1,b=-1;for(;++p<a.length;)if(a[p][0]===h){b=p;break}if(b===-1)a.push([h,...g]);else if(g.length>0){let[w,...k]=g;const j=a[b][1];$y(j)&&$y(w)&&(w=vg(!0,j,w)),a[b]=[h,w,...k]}}}}const mq=new db().freeze();function Sg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xk(e){if(!$y(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function kf(e){return pq(e)?e:new h_(e)}function pq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gq(e){return typeof e=="string"||yq(e)}function yq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Sk=[],kk={allowDangerousHtml:!0},bq=/^(https?|ircs?|mailto|xmpp)$/i,xq=[{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 wq(e){const t=Sq(e),n=kq(e);return jq(t.runSync(t.parse(n),n),e)}function Sq(e){const t=e.rehypePlugins||Sk,n=e.remarkPlugins||Sk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kk}:kk;return mq().use(n8).use(n).use(Y8,a).use(t)}function kq(e){const t=e.children||"",n=new h_;return typeof t=="string"&&(n.value=t),n}function jq(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,u=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||Eq;for(const g of xq)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+vq+g.id,void 0);return cb(e,h),U9(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,p,b){if(g.type==="raw"&&b&&typeof p=="number")return c?b.children.splice(p,1):b.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let w;for(w in mg)if(Object.hasOwn(mg,w)&&Object.hasOwn(g.properties,w)){const k=g.properties[w],j=mg[w];(j===null||j.includes(g.tagName))&&(g.properties[w]=m(String(k||""),w,g))}}if(g.type==="element"){let w=n?!n.includes(g.tagName):u?u.includes(g.tagName):!1;if(!w&&a&&typeof p=="number"&&(w=!a(g,p,b)),w&&b&&typeof p=="number")return f&&g.children?b.children.splice(p,1,...g.children):b.children.splice(p,1),p}}}function Eq(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||bq.test(e.slice(0,t))?e:""}function Cq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function m_(e,t,n){const s=Th((n||{}).ignore||[]),u=Nq(t);let c=-1;for(;++c<u.length;)f_(e,"text",f);function f(h,g){let p=-1,b;for(;++p<g.length;){const w=g[p],k=b?b.children:void 0;if(s(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(h,g)}function m(h,g){const p=g[g.length-1],b=u[c][0],w=u[c][1];let k=0;const C=p.children.indexOf(h);let E=!1,T=[];b.lastIndex=0;let O=b.exec(h.value);for(;O;){const D=O.index,P={index:O.index,input:O.input,stack:[...g,h]};let z=w(...O,P);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=D+1:(k!==D&&T.push({type:"text",value:h.value.slice(k,D)}),Array.isArray(z)?T.push(...z):z&&T.push(z),k=D+O[0].length,E=!0),!b.global)break;O=b.exec(h.value)}return E?(k<h.value.length&&T.push({type:"text",value:h.value.slice(k)}),p.children.splice(C,1,...T)):T=[h],C+T.length}}function Nq(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([_q(s[0]),Tq(s[1])])}return t}function _q(e){return typeof e=="string"?new RegExp(Cq(e),"g"):e}function Tq(e){return typeof e=="function"?e:function(){return e}}function Aq(e){m_(e,[/\r?\n|\r/g,Rq])}function Rq(){return{type:"break"}}function Oq(){return function(e){Aq(e)}}function jk(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 Eg="phrasing",Cg=["autolink","link","image","label"];function zq(){return{transforms:[Bq],enter:{literalAutolink:Mq,literalAutolinkEmail:Ng,literalAutolinkHttp:Ng,literalAutolinkWww:Ng},exit:{literalAutolink:Uq,literalAutolinkEmail:Pq,literalAutolinkHttp:Iq,literalAutolinkWww:Lq}}}function Dq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Eg,notInConstruct:Cg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Eg,notInConstruct:Cg},{character:":",before:"[ps]",after:"\\/",inConstruct:Eg,notInConstruct:Cg}]}}function Mq(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ng(e){this.config.enter.autolinkProtocol.call(this,e)}function Iq(e){this.config.exit.autolinkProtocol.call(this,e)}function Lq(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 Pq(e){this.config.exit.autolinkEmail.call(this,e)}function Uq(e){this.exit(e)}function Bq(e){m_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Fq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),$q]],{ignore:["link","linkReference"]})}function Fq(e,t,n,a,s){let u="";if(!p_(s)||(/^w/i.test(t)&&(n=t+n,t="",u="http://"),!qq(n)))return!1;const c=Hq(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:u+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function $q(e,t,n,a){return!p_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function qq(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 Hq(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=jk(e,"(");let u=jk(e,")");for(;a!==-1&&s>u;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),u++;return[e,n]}function p_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ys(n)||Ch(n))&&(!t||n!==47)}g_.peek=Jq;function Zq(){this.buffer()}function Gq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Vq(){this.buffer()}function Qq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Kq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Yq(e){this.exit(e)}function Xq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Wq(e){this.exit(e)}function Jq(){return"["}function g_(e,t,n,a){const s=n.createTracker(a);let u=s.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return u+=s.move(n.safe(n.associationId(e),{after:"]",before:u})),f(),c(),u+=s.move("]"),u}function eH(){return{enter:{gfmFootnoteCallString:Zq,gfmFootnoteCall:Gq,gfmFootnoteDefinitionLabelString:Vq,gfmFootnoteDefinition:Qq},exit:{gfmFootnoteCallString:Kq,gfmFootnoteCall:Yq,gfmFootnoteDefinitionLabelString:Xq,gfmFootnoteDefinition:Wq}}}function tH(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:g_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,u,c){const f=u.createTracker(c);let m=f.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return m+=f.move(u.safe(u.associationId(a),{before:m,after:"]"})),g(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
371
- `:" ")+u.indentLines(u.containerFlow(a,f.current()),t?y_:nH))),h(),m}}function nH(e,t,n){return t===0?e:y_(e,t,n)}function y_(e,t,n){return(n?"":" ")+e}const rH=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];v_.peek=oH;function aH(){return{canContainEols:["delete"],enter:{strikethrough:sH},exit:{strikethrough:lH}}}function iH(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rH}],handlers:{delete:v_}}}function sH(e){this.enter({type:"delete",children:[]},e)}function lH(e){this.exit(e)}function v_(e,t,n,a){const s=n.createTracker(a),u=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),u(),c}function oH(){return"~"}function uH(e){return e.length}function cH(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||uH,u=[],c=[],f=[],m=[];let h=0,g=-1;for(;++g<e.length;){const j=[],C=[];let E=-1;for(e[g].length>h&&(h=e[g].length);++E<e[g].length;){const T=dH(e[g][E]);if(n.alignDelimiters!==!1){const O=s(T);C[E]=O,(m[E]===void 0||O>m[E])&&(m[E]=O)}j.push(T)}c[g]=j,f[g]=C}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<h;)u[p]=Ek(a[p]);else{const j=Ek(a);for(;++p<h;)u[p]=j}p=-1;const b=[],w=[];for(;++p<h;){const j=u[p];let C="",E="";j===99?(C=":",E=":"):j===108?C=":":j===114&&(E=":");let T=n.alignDelimiters===!1?1:Math.max(1,m[p]-C.length-E.length);const O=C+"-".repeat(T)+E;n.alignDelimiters!==!1&&(T=C.length+T+E.length,T>m[p]&&(m[p]=T),w[p]=T),b[p]=O}c.splice(1,0,b),f.splice(1,0,w),g=-1;const k=[];for(;++g<c.length;){const j=c[g],C=f[g];p=-1;const E=[];for(;++p<h;){const T=j[p]||"";let O="",D="";if(n.alignDelimiters!==!1){const P=m[p]-(C[p]||0),z=u[p];z===114?O=" ".repeat(P):z===99?P%2?(O=" ".repeat(P/2+.5),D=" ".repeat(P/2-.5)):(O=" ".repeat(P/2),D=O):D=" ".repeat(P)}n.delimiterStart!==!1&&!p&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||p)&&E.push(" "),n.alignDelimiters!==!1&&E.push(O),E.push(T),n.alignDelimiters!==!1&&E.push(D),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||p!==h-1)&&E.push("|")}k.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return k.join(`
372
- `)}function dH(e){return e==null?"":String(e)}function Ek(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function fH(e,t,n,a){const s=n.enter("blockquote"),u=n.createTracker(a);u.move("> "),u.shift(2);const c=n.indentLines(n.containerFlow(e,u.current()),hH);return s(),c}function hH(e,t,n){return">"+(n?"":" ")+e}function mH(e,t){return Ck(e,t.inConstruct,!0)&&!Ck(e,t.notInConstruct,!1)}function Ck(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 Nk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
373
- `&&mH(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
374
- `}function pH(e,t){const n=String(e);let a=n.indexOf(t),s=a,u=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++u>c&&(c=u):u=1,s=a+t.length,a=n.indexOf(t,s);return c}function gH(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 yH(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 vH(e,t,n,a){const s=yH(n),u=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(gH(e,n)){const p=n.enter("codeIndented"),b=n.indentLines(u,bH);return p(),b}const f=n.createTracker(a),m=s.repeat(Math.max(pH(u,s)+1,3)),h=n.enter("codeFenced");let g=f.move(m);if(e.lang){const p=n.enter(`codeFencedLang${c}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
375
- `,encode:["`"],...f.current()})),p()}return g+=f.move(`
376
- `),u&&(g+=f.move(u+`
377
- `)),g+=f.move(m),h(),g}function bH(e,t,n){return(n?"":" ")+e}function fb(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 xH(e,t,n,a){const s=fb(n),u=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?" ":`
378
- `,...m.current()}))),f(),e.title&&(f=n.enter(`title${u}`),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 wH(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 bc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function th(e,t,n){const a=wo(e),s=wo(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}b_.peek=SH;function b_(e,t,n,a){const s=wH(n),u=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),g=th(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=bc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=th(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+bc(p));const w=c.move(s);return u(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+m+w}function SH(e,t,n){return n.options.emphasis||"*"}function kH(e,t){let n=!1;return cb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,By}),!!((!e.depth||e.depth<3)&&rb(e)&&(t.options.setext||n))}function jH(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),u=n.createTracker(a);if(kH(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),b=n.containerPhrasing(e,{...u.current(),before:`
379
- `,after:`
380
- `});return p(),g(),b+`
381
- `+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
382
- `))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");u.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
383
- `,...u.current()});return/^[\t ]/.test(h)&&(h=bc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}x_.peek=EH;function x_(e){return e.value||""}function EH(){return"<"}w_.peek=CH;function w_(e,t,n,a){const s=fb(n),u=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${u}`),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 CH(){return"!"}S_.peek=NH;function S_(e,t,n,a){const s=e.referenceType,u=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 g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=g,u(),s==="full"||!h||h!==p?m+=f.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function NH(){return"!"}k_.peek=_H;function k_(e,t,n){let a=e.value||"",s="`",u=-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+" ");++u<n.unsafe.length;){const c=n.unsafe[u],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 _H(){return"`"}function j_(e,t){const n=rb(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))}E_.peek=TH;function E_(e,t,n,a){const s=fb(n),u=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(j_(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let p=c.move("<");return p+=c.move(n.containerPhrasing(e,{before:p,after:">",...c.current()})),p+=c.move(">"),f(),n.stack=g,p}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${u}`),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 TH(e,t,n){return j_(e,n)?"<":"["}C_.peek=AH;function C_(e,t,n,a){const s=e.referenceType,u=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 g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=g,u(),s==="full"||!h||h!==p?m+=f.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function AH(){return"["}function hb(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 RH(e){const t=hb(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 OH(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 N_(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 zH(e,t,n,a){const s=n.enter("list"),u=n.bulletCurrent;let c=e.ordered?OH(n):hb(n);const f=e.ordered?c==="."?")":".":RH(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),N_(n)===c&&g){let p=-1;for(;++p<e.children.length;){const b=e.children[p];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=u,s(),h}function DH(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 MH(e,t,n,a){const s=DH(n);let u=n.bulletCurrent||hb(n);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.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(u+" ".repeat(c-u.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),g);return m(),h;function g(p,b,w){return b?(w?"":" ".repeat(c))+p:(w?u:u+" ".repeat(c-u.length))+p}}function IH(e,t,n,a){const s=n.enter("paragraph"),u=n.enter("phrasing"),c=n.containerPhrasing(e,a);return u(),s(),c}const LH=Th(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function PH(e,t,n,a){return(e.children.some(function(c){return LH(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function UH(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}__.peek=BH;function __(e,t,n,a){const s=UH(n),u=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),g=th(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=bc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=th(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+bc(p));const w=c.move(s+s);return u(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+m+w}function BH(e,t,n){return n.options.strong||"*"}function FH(e,t,n,a){return n.safe(e.value,a)}function $H(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 qH(e,t,n){const a=(N_(n)+(n.options.ruleSpaces?" ":"")).repeat($H(n));return n.options.ruleSpaces?a.slice(0,-1):a}const T_={blockquote:fH,break:Nk,code:vH,definition:xH,emphasis:b_,hardBreak:Nk,heading:jH,html:x_,image:w_,imageReference:S_,inlineCode:k_,link:E_,linkReference:C_,list:zH,listItem:MH,paragraph:IH,root:PH,strong:__,text:FH,thematicBreak:qH};function HH(){return{enter:{table:ZH,tableData:_k,tableHeader:_k,tableRow:VH},exit:{codeText:QH,table:GH,tableData:_g,tableHeader:_g,tableRow:_g}}}function ZH(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 GH(e){this.exit(e),this.data.inTable=void 0}function VH(e){this.enter({type:"tableRow",children:[]},e)}function _g(e){this.exit(e)}function _k(e){this.enter({type:"tableCell",children:[]},e)}function QH(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KH));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KH(e,t){return t==="|"?t:e}function YH(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,u=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
384
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(w,k,j,C){return h(g(w,j,C),w.align)}function f(w,k,j,C){const E=p(w,j,C),T=h([E]);return T.slice(0,T.indexOf(`
385
- `))}function m(w,k,j,C){const E=j.enter("tableCell"),T=j.enter("phrasing"),O=j.containerPhrasing(w,{...C,before:u,after:u});return T(),E(),O}function h(w,k){return cH(w,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function g(w,k,j){const C=w.children;let E=-1;const T=[],O=k.enter("table");for(;++E<C.length;)T[E]=p(C[E],k,j);return O(),T}function p(w,k,j){const C=w.children;let E=-1;const T=[],O=k.enter("tableRow");for(;++E<C.length;)T[E]=m(C[E],w,k,j);return O(),T}function b(w,k,j){let C=T_.inlineCode(w,k,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function XH(){return{exit:{taskListCheckValueChecked:Tk,taskListCheckValueUnchecked:Tk,paragraph:JH}}}function WH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:e7}}}function Tk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function JH(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 u=-1,c;for(;++u<s.length;){const f=s[u];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 e7(e,t,n,a){const s=e.children[0],u=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);u&&f.move(c);let m=T_.listItem(e,t,n,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+c}}function t7(){return[zq(),eH(),aH(),HH(),XH()]}function n7(e){return{extensions:[Dq(),tH(e),iH(),YH(e),WH()]}}const r7={tokenize:u7,partial:!0},A_={tokenize:c7,partial:!0},R_={tokenize:d7,partial:!0},O_={tokenize:f7,partial:!0},a7={tokenize:h7,partial:!0},z_={name:"wwwAutolink",tokenize:l7,previous:M_},D_={name:"protocolAutolink",tokenize:o7,previous:I_},fi={name:"emailAutolink",tokenize:s7,previous:L_},Oa={};function i7(){return{text:Oa}}let zs=48;for(;zs<123;)Oa[zs]=fi,zs++,zs===58?zs=65:zs===91&&(zs=97);Oa[43]=fi;Oa[45]=fi;Oa[46]=fi;Oa[95]=fi;Oa[72]=[fi,D_];Oa[104]=[fi,D_];Oa[87]=[fi,z_];Oa[119]=[fi,z_];function s7(e,t,n){const a=this;let s,u;return c;function c(p){return!Hy(p)||!L_.call(a,a.previous)||mb(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(p))}function f(p){return Hy(p)?(e.consume(p),f):p===64?(e.consume(p),m):n(p)}function m(p){return p===46?e.check(a7,g,h)(p):p===45||p===95||Yn(p)?(u=!0,e.consume(p),m):g(p)}function h(p){return e.consume(p),s=!0,m}function g(p){return u&&s&&or(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function l7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!M_.call(a,a.previous)||mb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(r7,e.attempt(A_,e.attempt(R_,u),n),n)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function o7(e,t,n){const a=this;let s="",u=!1;return c;function c(p){return(p===72||p===104)&&I_.call(a,a.previous)&&!mb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),f):n(p)}function f(p){if(or(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),f;if(p===58){const b=s.toLowerCase();if(b==="http"||b==="https")return e.consume(p),m}return n(p)}function m(p){return p===47?(e.consume(p),u?h:(u=!0,m)):n(p)}function h(p){return p===null||Wf(p)||It(p)||Ys(p)||Ch(p)?n(p):e.attempt(A_,e.attempt(R_,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function u7(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),u):n(c)}function u(c){return c===null?n(c):t(c)}}function c7(e,t,n){let a,s,u;return c;function c(h){return h===46||h===95?e.check(O_,m,f)(h):h===null||It(h)||Ys(h)||h!==45&&Ch(h)?m(h):(u=!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||!u?n(h):t(h)}}function d7(e,t){let n=0,a=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&a<n?u(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(O_,t,u)(c):c===null||It(c)||Ys(c)?t(c):(e.consume(c),s)}function u(c){return c===41&&a++,e.consume(c),s}}function f7(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),u):f===93?(e.consume(f),s):f===60||f===null||It(f)||Ys(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||It(f)||Ys(f)?t(f):a(f)}function u(f){return or(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):or(f)?(e.consume(f),c):n(f)}}function h7(e,t,n){return a;function a(u){return e.consume(u),s}function s(u){return Yn(u)?n(u):t(u)}}function M_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||It(e)}function I_(e){return!or(e)}function L_(e){return!(e===47||Hy(e))}function Hy(e){return e===43||e===45||e===46||e===95||Yn(e)}function mb(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 m7={tokenize:S7,partial:!0};function p7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:b7,continuation:{tokenize:x7},exit:w7}},text:{91:{name:"gfmFootnoteCall",tokenize:v7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:g7,resolveTo:y7}}}}function g7(e,t,n){const a=this;let s=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return n(m);const h=va(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function y7(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 u={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function v7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u=0,c;return f;function f(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(u>999||p===93&&!c||p===null||p===91||It(p))return n(p);if(p===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return s.includes(va(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return It(p)||(c=!0),u++,e.consume(p),p===92?g:h}function g(p){return p===91||p===92||p===93?(e.consume(p),u++,h):h(p)}}function b7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(k)}function g(k){if(c>999||k===93&&!f||k===null||k===91||It(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return u=va(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return It(k)||(f=!0),c++,e.consume(k),k===92?p:g}function p(k){return k===91||k===92||k===93?(e.consume(k),c++,g):g(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(u)||s.push(u),vt(e,w,"gfmFootnoteDefinitionWhitespace")):n(k)}function w(k){return t(k)}}function x7(e,t,n){return e.check(Fc,t,e.attempt(m7,t,n))}function w7(e){e.exit("gfmFootnoteDefinition")}function S7(e,t,n){const a=this;return vt(e,s,"gfmFootnoteDefinitionIndent",5);function s(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):n(u)}}function k7(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,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 g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},p={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",g,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",p,f]],w=f.parser.constructs.insideSpan.null;w&&Pr(b,b.length,0,Nh(w,c.slice(h+1,m),f)),Pr(b,b.length,0,[["exit",p,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",g,f]]),Pr(c,h-1,m-h+3,b),m=h+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const h=this.previous,g=this.events;let p=0;return b;function b(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const j=wo(h);if(k===126)return p>1?m(k):(c.consume(k),p++,w);if(p<2&&!n)return m(k);const C=c.exit("strikethroughSequenceTemporary"),E=wo(k);return C._open=!E||E===2&&!!j,C._close=!j||j===2&&!!E,f(k)}}}class j7{constructor(){this.map=[]}add(t,n,a){E7(this,t,n,a)}consume(t){if(this.map.sort(function(u,c){return u[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 u of s)t.push(u);s=a.pop()}this.map.length=0}}function E7(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 C7(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 u=a.length-1;a[u]=a[u]==="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 N7(){return{flow:{null:{name:"table",tokenize:_7,resolveAll:T7}}}}function _7(e,t,n){const a=this;let s=0,u=0,c;return f;function f(I){let X=a.events.length-1;for(;X>-1;){const Y=a.events[X][1].type;if(Y==="lineEnding"||Y==="linePrefix")X--;else break}const se=X>-1?a.events[X][1].type:null,Se=se==="tableHead"||se==="tableRow"?z:m;return Se===z&&a.parser.lazy[a.now().line]?n(I):Se(I)}function m(I){return e.enter("tableHead"),e.enter("tableRow"),h(I)}function h(I){return I===124||(c=!0,u+=1),g(I)}function g(I){return I===null?n(I):Fe(I)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),w):n(I):lt(I)?vt(e,g,"whitespace")(I):(u+=1,c&&(c=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),p(I)))}function p(I){return I===null||I===124||It(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?b:p)}function b(I){return I===92||I===124?(e.consume(I),p):p(I)}function w(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,lt(I)?vt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):k(I))}function k(I){return I===45||I===58?C(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):P(I)}function j(I){return lt(I)?vt(e,C,"whitespace")(I):C(I)}function C(I){return I===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):I===45?(u+=1,E(I)):I===null||Fe(I)?D(I):P(I)}function E(I){return I===45?(e.enter("tableDelimiterFiller"),T(I)):P(I)}function T(I){return I===45?(e.consume(I),T):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(I))}function O(I){return lt(I)?vt(e,D,"whitespace")(I):D(I)}function D(I){return I===124?k(I):I===null||Fe(I)?!c||s!==u?P(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):P(I)}function P(I){return n(I)}function z(I){return e.enter("tableRow"),B(I)}function B(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),B):I===null||Fe(I)?(e.exit("tableRow"),t(I)):lt(I)?vt(e,B,"whitespace")(I):(e.enter("data"),M(I))}function M(I){return I===null||I===124||It(I)?(e.exit("data"),B(I)):(e.consume(I),I===92?V:M)}function V(I){return I===92||I===124?(e.consume(I),M):M(I)}}function T7(e,t){let n=-1,a=!0,s=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,g,p;const b=new j7;for(;++n<e.length;){const w=e[n],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Ak(b,t,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,p=void 0,u=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(n,0,[["enter",g,t]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],p=jf(b,t,u,s,void 0,p),u=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],p=jf(b,t,u,s,void 0,p)),u=c,c=[u[1],n,0,0])):k.type==="tableHead"?(f=!0,m=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=n,u[1]!==0?(c[0]=c[1],p=jf(b,t,u,s,n,p)):c[1]!==0&&(p=jf(b,t,c,s,n,p)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Ak(b,t,m,h,g),b.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=C7(t.events,n))}return e}function jf(e,t,n,a,s,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(u.end=Object.assign({},Vl(t.events,n[0])),e.add(n[0],0,[["exit",u,t]]));const m=Vl(t.events,n[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",u,t]]),n[2]!==0){const h=Vl(t.events,n[2]),g=Vl(t.events,n[3]),p={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const b=t.events[n[2]],w=t.events[n[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(u.end=Object.assign({},Vl(t.events,s)),e.add(s,0,[["exit",u,t]]),u=void 0),u}function Ak(e,t,n,a,s){const u=[],c=Vl(t.events,n);s&&(s.end=Object.assign({},c),u.push(["exit",s,t])),a.end=Object.assign({},c),u.push(["exit",a,t]),e.add(n+1,0,u)}function Vl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const A7={name:"tasklistCheck",tokenize:O7};function R7(){return{text:{91:A7}}}function O7(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"),u)}function u(m){return It(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return Fe(m)?t(m):lt(m)?e.check({tokenize:z7},t,n)(m):n(m)}}function z7(e,t,n){return vt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function D7(e){return VN([i7(),p7(),k7(e),N7(),R7()])}const M7={};function I7(e){const t=this,n=e||M7,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(D7(n)),u.push(t7()),c.push(n7(n))}function Rh({children:e,className:t}){return o.jsx("div",{className:Re("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:o.jsx(wq,{remarkPlugins:[I7,Oq],children:e})})}function L7({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[u,c]=x.useState(!1),f=x.useRef(null),m=e!==t;return x.useEffect(()=>{var h;u&&((h=f.current)==null||h.focus())},[u]),o.jsxs(En,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[o.jsxs(sa,{children:[o.jsxs(la,{children:["System prompt append",m&&o.jsx(P7,{})]}),!u&&!s&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[o.jsx(dh,{className:"h-3 w-3"})," Edit"]})]}),o.jsx(Wn,{children:u?o.jsxs("div",{className:"space-y-2",children:[o.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}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),o.jsx(pe,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),o.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."})]}):o.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?o.jsx(Rh,{children:e}):o.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function P7(){return o.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 P_={"claude-code":"Claude Code",codex:"Codex"},U7=[Yf.CLAUDE_CODE,Yf.CODEX];function B7({open:e,onOpenChange:t,agent:n}){const a=ln(),s=n.clientId,u=n.runtimeProvider,[c,f]=x.useState(s),[m,h]=x.useState(u),[g,p]=x.useState(!1),w=Qe({queryKey:["clients-rebind"],queryFn:ss,enabled:e}).data??[],k=lR({queries:w.map(M=>({queryKey:["client-capabilities",M.id],queryFn:()=>Sv(M.id),enabled:e}))}),j=x.useMemo(()=>{const M=new Map;return k.forEach((V,I)=>{const X=w[I];if(!X)return;const se=V.data;se!=null&&se.capabilities&&M.set(X.id,se.capabilities)}),M},[k,w]);x.useEffect(()=>{e||(f(s),h(u),p(!1))},[e,s,u]);const C=c?j.get(c)??null:null,E=(C==null?void 0:C[m])??null,T=!E||E.state==="missing"||E.state==="error",O=!!c&&(c!==s||m!==u)&&(!T||g),D=m!==u,P=c!==s,z=Et({mutationFn:()=>{if(!c)throw new Error("clientId required");return EI(n.uuid,{clientId:c,runtimeProvider:m,force:T&&g?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),B=z.error instanceof zc||z.error instanceof Error?z.error.message:null;return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(In,{children:o.jsx(An,{children:"Re-bind agent"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",o.jsx("span",{className:"mono",children:$7(s,w,u)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Computer"}),o.jsx("select",{value:c??"",onChange:M=>f(M.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(M=>o.jsx("option",{value:M.id,children:F7(M)},M.id))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Runtime"}),o.jsx("div",{className:"space-y-2",children:U7.map(M=>{const V=(C==null?void 0:C[M])??null,I=!!V&&V.state!=="missing",X=m===M;return o.jsxs("label",{className:X?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":I?"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:[o.jsx("input",{type:"radio",name:"rebind-runtime",checked:X,onChange:()=>h(M),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:P_[M]}),o.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:H7(V,M)})]})]},M)})})]}),(P||D)&&o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[o.jsxs("p",{children:[o.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),D&&o.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),T&&o.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[o.jsx("input",{type:"checkbox",checked:g,onChange:M=>p(M.target.checked),className:"mt-0.5"}),o.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&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:B})]}),o.jsxs(ur,{children:[o.jsx(pe,{variant:"outline",onClick:()=>t(!1),disabled:z.isPending,children:"Cancel"}),o.jsx(pe,{onClick:()=>z.mutate(),disabled:!O||z.isPending,children:z.isPending?"Re-binding…":"Re-bind"})]})]})})}function F7(e){return`${e.hostname??e.id} · ${e.status}`}function $7(e,t,n){const a=e?t.find(u=>u.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${P_[n]}`}const q7={"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 H7(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. ${q7[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const Z7={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function G7(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return o.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:o.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx(ec,{state:"blocked",size:8}),o.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),o.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),o.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>o.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:Z7[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&o.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[o.jsx(wr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&o.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&o.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),o.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&o.jsx(pe,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),o.jsx(pe,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),o.jsx(pe,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(uE,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function ac(e){return`agent-cfg-${e}`}function qu({anchorId:e,title:t,caption:n,right:a,children:s,className:u,sectionProps:c}){return o.jsxs("section",{id:e,className:Re("space-y-3",u),...c,children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&o.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),o.jsx("div",{className:"space-y-3",children:s})]})}function V7(){return o.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const Q7={"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 K7(e){const t=Q7[e.runtimeProvider];return o.jsxs("div",{className:"space-y-3",children:[o.jsx(Y7,{name:t.name,caption:t.caption,locked:!0}),o.jsx(X7,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function Y7({name:e,caption:t,locked:n}){return o.jsxs(En,{children:[o.jsx(sa,{children:o.jsxs(la,{children:["Where it runs",n&&o.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[o.jsx(cE,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),o.jsxs(Wn,{className:"space-y-1 text-body",children:[o.jsxs("div",{className:"inline-flex items-center gap-2",children:[o.jsx(dE,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),o.jsx("span",{className:"font-medium",children:e})]}),o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function X7(e){const t=!!e.computerLabel;return o.jsxs(En,{children:[o.jsxs(sa,{children:[o.jsx(la,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[o.jsx(by,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:e.onRebind,children:[o.jsx(by,{className:"h-3 w-3"}),"Re-bind"]})]}),o.jsx(Wn,{className:"text-body",children:t?o.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):o.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 W7(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 J7(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function eZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Tg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Rk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:eZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Ag(e,t){const n=e;return{add:a=>t(s=>{const u=s[e],c=new Set(u.map(h=>h.key)),f=J7(n,c),m=[...u,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Rk(m)}}),update:(a,s)=>t(u=>{const f=u[e].map(m=>m.key===a?{...m,value:s}:m);return{...u,[e]:Rk(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 tZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Tg(e.payload.mcpServers,"mcp"),env:Tg(e.payload.env,"env"),git:Tg(e.payload.gitRepos,"git")}}function nZ(e){const[t,n]=x.useState(null);x.useEffect(()=>{e&&t===null&&n(tZ(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",u=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,f=a.model!==u,m=x.useMemo(()=>{const O=[],D=M=>M.reduce((V,I)=>I.status==="unchanged"?V:V+1,0),P=D(a.mcp),z=D(a.env),B=D(a.git);return c&&O.push("prompt"),f&&O.push("model"),P>0&&O.push("mcp"),z>0&&O.push("env"),B>0&&O.push("git"),{anyDirty:O.length>0,dirtySections:O,counts:{prompt:c?1:0,model:f?1:0,mcp:P,env:z,git:B}}},[a,c,f]),h=x.useCallback(O=>{n(D=>D&&O(D))},[]),g=x.useCallback(O=>h(D=>({...D,promptAppend:O})),[h]),p=x.useCallback(()=>h(O=>({...O,promptAppend:s})),[h,s]),b=x.useCallback(O=>h(D=>({...D,model:O})),[h]),w=x.useCallback(()=>h(O=>({...O,model:u})),[h,u]),k=x.useMemo(()=>Ag("mcp",h),[h]),j=x.useMemo(()=>Ag("env",h),[h]),C=x.useMemo(()=>Ag("git",h),[h]),E=x.useCallback(()=>{n(null)},[]),T=x.useCallback(()=>{if(!t||!e)return{};const O={};c&&(O.prompt={append:t.promptAppend}),f&&(O.model=t.model);const D=m.counts.mcp>0,P=m.counts.env>0,z=m.counts.git>0;return D&&(O.mcpServers=t.mcp.filter(B=>B.status!=="deleted").map(B=>B.value)),P&&(O.env=t.env.filter(B=>B.status!=="deleted").map(B=>{const M=B.value;return M.sensitive&&M.value===Qf?{key:M.key,value:Qf,sensitive:!0}:M})),z&&(O.gitRepos=t.git.filter(B=>B.status!=="deleted").map(B=>B.value)),O},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:g,revertPrompt:p,setModel:b,revertModel:w,addMcp:k.add,updateMcp:k.update,deleteMcp:k.remove,undoDeleteMcp:k.undo,addEnv:j.add,updateEnv:j.update,deleteEnv:j.remove,undoDeleteEnv:j.undo,addGit:C.add,updateGit:C.update,deleteGit:C.remove,undoDeleteGit:C.undo,resetAll:E,buildPayloadPatch:T}}const Qn={overview:"ad-overview",setup:"ad-setup",prompt:ac("prompt"),tools:ac("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function rZ(e){const t=[{key:"overview",label:"Profile",anchor:Qn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Qn.setup},{key:"prompt",label:"Prompt",anchor:Qn.prompt},{key:"tools",label:"Tools",anchor:Qn.tools},{key:"advanced",label:"Advanced",anchor:Qn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Qn.danger,divider:!0,danger:!0}),t}function aZ(){var At,rt,tr,On,al,ua,ca,za,Zn,Da,wa,Ht;const t=qj().uuid??"",n=Rn(),a=ln(),s=Qe({queryKey:["agent",t],queryFn:()=>SI(t),enabled:!!t}),u=Qe({queryKey:["agent-config",t],queryFn:()=>jh(t),enabled:!!t&&((At=s.data)==null?void 0:At.type)!=="human"}),c=Qe({queryKey:["agent-client-status",t],queryFn:()=>RB(t),enabled:!!t&&((rt=s.data)==null?void 0:rt.type)!=="human"}),f=Qe({queryKey:["agent-sessions-active",t],queryFn:()=>AE(t,{state:"active"}),enabled:!!t&&((tr=s.data)==null?void 0:tr.type)!=="human"}),m=Qe({queryKey:["clients"],queryFn:ss,enabled:!!t&&((On=s.data)==null?void 0:On.type)!=="human",refetchInterval:3e4}),h=nZ(u.data),[g,p]=x.useState(null),[b,w]=x.useState(null),[k,j]=x.useState(!1),C=Et({mutationFn:async()=>{if(!u.data)throw new Error("config not loaded");const ke=h.buildPayloadPatch();return Eh(t,{expectedVersion:u.data.version,payload:ke})},onSuccess:ke=>{a.setQueryData(["agent-config",t],ke),p(null),w(null),j(!0)},onError:ke=>{if(j(!1),ke instanceof zc&&ke.status===409){w("Someone else saved a newer version while you were editing."),p(null);return}p(ke instanceof Error?ke.message:String(ke))}});x.useEffect(()=>{if(!k)return;const ke=setTimeout(()=>j(!1),2500);return()=>clearTimeout(ke)},[k]),x.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const E=x.useCallback(()=>{w(null),p(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),T=x.useCallback(ke=>{const et=document.getElementById(ke);et&&et.scrollIntoView({behavior:"smooth",block:"start"})},[]),O=Et({mutationFn:ke=>f1(t,ke),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),D=Et({mutationFn:()=>NI(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),P=Et({mutationFn:()=>_I(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),z=Et({mutationFn:()=>CI(t),onSuccess:()=>n("/team")}),B=Et({mutationFn:()=>TI(t)}),[M,V]=x.useState(!1),[I,X]=x.useState(""),[se,Se]=x.useState(null),[Y,ee]=x.useState(!1),H=Qe({queryKey:["clients"],queryFn:ss,enabled:M}),re=Et({mutationFn:ke=>f1(t,{clientId:ke}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),V(!1),X(""),Se(null)},onError:ke=>Se(ke instanceof Error?ke.message:String(ke))}),[xe,ze]=x.useState(!1),[R,L]=x.useState(null),F=Et({mutationFn:()=>AB(t,h.buildPayloadPatch()),onSuccess:ke=>{const et=ke.diff.length?ke.diff.map(pn=>`${pn.op} ${pn.path}`).join(`
386
- `):"(no changes)";L(et)},onError:ke=>L(`Dry run failed: ${ke instanceof Error?ke.message:String(ke)}`)});x.useEffect(()=>{if(!h.summary.anyDirty)return;const ke=et=>{et.preventDefault(),et.returnValue=""};return window.addEventListener("beforeunload",ke),()=>window.removeEventListener("beforeunload",ke)},[h.summary.anyDirty]);const _=((al=s.data)==null?void 0:al.type)==="human",Z=x.useMemo(()=>rZ(_),[_]),K=x.useRef(null),[ue,we]=x.useState(!1);x.useEffect(()=>{if(_)return;const ke=K.current;if(!ke||typeof IntersectionObserver>"u")return;const et=new IntersectionObserver(pn=>{const Nr=pn[0];Nr&&we(!Nr.isIntersecting&&Nr.boundingClientRect.top<0)},{threshold:0});return et.observe(ke),()=>et.disconnect()},[_]);const[ve,me]=x.useState(Qn.overview);x.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const ke=[];for(const et of Z){const pn=document.getElementById(et.anchor);if(!pn)continue;const Nr=new IntersectionObserver(pi=>{for(const ps of pi)ps.isIntersecting&&me(et.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Nr.observe(pn),ke.push(Nr)}return()=>{for(const et of ke)et.disconnect()}},[Z]);const Ge=x.useMemo(()=>{const ke=new Set;for(const et of h.summary.dirtySections)et==="prompt"&&ke.add(Qn.prompt),et==="model"&&ke.add(Qn.setup),et==="mcp"&&ke.add(Qn.tools),(et==="env"||et==="git")&&ke.add(Qn.advanced);return ke},[h.summary.dirtySections]);if(s.isLoading)return o.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:o.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return o.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 Be=s.data;if(!Be)return o.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const bt=Be.type==="human",yt=c.data,ae=((ua=f.data)==null?void 0:ua.length)??0,je=!bt&&!(yt!=null&&yt.clientId),Me=!bt&&yt?!yt.online&&!!yt.clientId:!1,Ye=Be,mn=Ye.runtimeState??null,en=Ye.runtimeType??null,Cr=Ye.totalSessions??null,Br=Be.uuid.slice(0,8),hi=W7({activeSessions:ae,isUnclaimed:je,isOffline:Me}),mi=h.draft.mcp.filter(ke=>ke.status!=="deleted"),on=h.draft.env.filter(ke=>ke.status!=="deleted"),oa=h.draft.git.filter(ke=>ke.status!=="deleted"),le=ke=>new Set(mi.filter(et=>et.key!==ke).map(et=>et.value.name.toLowerCase())),ge=ke=>new Set(on.filter(et=>et.key!==ke).map(et=>et.value.key)),Ue=ke=>new Set(oa.filter(et=>et.key!==ke).map(et=>{const{value:pn}=et;return pn.localPath?pn.localPath:((pn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ze={sessions:Cr??"—",active:ae,runtime:en??(bt?"human":"—"),model:((za=(ca=u.data)==null?void 0:ca.payload.model)==null?void 0:za.trim())||"—"},nt=(yt==null?void 0:yt.clientId)??null,un=nt?((Zn=m.data)==null?void 0:Zn.find(ke=>ke.id===nt))??null:null,er=nt?(un==null?void 0:un.hostname)??nt:null,qt=Be.runtimeProvider??"claude-code",Lt=qt==="codex"?"Codex":"Claude Code";return o.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[o.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:[o.jsx(Qv,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),Z.map(ke=>o.jsxs("div",{children:[ke.divider&&o.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),o.jsx(iZ,{label:ke.label,active:ve===ke.anchor,danger:ke.danger??!1,dirty:Ge.has(ke.anchor),onClick:()=>T(ke.anchor)})]},ke.key))]}),o.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[o.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[o.jsxs(OB,{style:{marginBottom:"var(--sp-2)"},children:[o.jsx(zB,{onClick:()=>n("/team"),children:"Agents"}),o.jsx(DB,{}),o.jsx(MB,{mono:!0,children:Be.name??Br})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.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:o.jsx(Lc,{width:18,height:20,style:{color:"var(--accent)"}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-title",title:`agt_${Br}`,children:Be.displayName}),o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Be.name??Br]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[o.jsx(ga,{tone:Be.type==="autonomous_agent"?"accent":"neutral",children:Be.type}),Be.visibility&&o.jsx(ga,{tone:Be.visibility==="organization"?"accent":"outline",children:Be.visibility}),(yt==null?void 0:yt.offlineSince)&&o.jsxs("span",{className:"mono",children:["offline since ",cc(yt.offlineSince)]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.jsx(yc,{state:mn}),o.jsxs(pe,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Be.uuid}`),children:[o.jsx(vv,{className:"h-3 w-3"})," Open chat"]}),!bt&&Be.status==="active"&&o.jsxs(pe,{variant:"outline",size:"xs",onClick:()=>{B.reset(),B.mutate()},disabled:B.isPending,children:[o.jsx(dE,{className:"h-3 w-3"}),B.isPending?"Testing…":"Test"]})]})]}),o.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[o.jsx(xf,{label:"sessions",value:Ze.sessions}),o.jsx(xf,{label:"active",value:Ze.active,accent:typeof Ze.active=="number"&&Ze.active>0?"var(--accent)":void 0}),o.jsx(xf,{label:"runtime",value:Ze.runtime}),o.jsx(xf,{label:"model",value:Ze.model})]})]}),o.jsx("div",{ref:K,"aria-hidden":!0,style:{height:0}}),!bt&&o.jsx(PB,{runtimeLabel:Lt,computerLabel:er,visible:ue}),o.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)&&o.jsx(dZ,{result:B.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>B.reset()}),o.jsx(qu,{anchorId:Qn.overview,title:"Profile",right:o.jsxs(pe,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Be.uuid}`),title:"Manage platform bindings in Integrations",children:[o.jsx(by,{className:"h-3 w-3"}),"Manage bindings"]}),children:o.jsx(WB,{agent:Be,onSave:async ke=>{await O.mutateAsync(ke)}})}),!bt&&o.jsxs(o.Fragment,{children:[o.jsxs(qu,{anchorId:Qn.setup,title:"Setup",caption:((Da=u.data)==null?void 0:Da.version)!=null?o.jsxs("span",{className:"mono",children:["config v",u.data.version,h.summary.anyDirty&&o.jsxs(o.Fragment,{children:[" · ",o.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[u.isLoading&&o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),u.error&&o.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(u.error)]}),u.data&&o.jsx(K7,{runtimeProvider:qt,computerLabel:er,canBindComputer:je&&Be.status==="active",bindComputerPending:re.isPending,onBindComputer:()=>V(!0),onRebind:Be.clientId?()=>ee(!0):void 0,modelSlot:o.jsx(u9,{value:h.draft.model,baseline:((wa=u.data)==null?void 0:wa.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Be.status!=="active",provider:qt})})]}),o.jsx(qu,{anchorId:Qn.prompt,title:"Prompt",children:u.data?o.jsx(L7,{value:h.draft.promptAppend,baseline:((Ht=u.data)==null?void 0:Ht.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Be.status!=="active"}):null}),o.jsx(qu,{anchorId:Qn.tools,title:"Tools",caption:"MCP servers available to this agent",children:u.data?o.jsx(t9,{items:h.draft.mcp,otherNames:le,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Be.status!=="active"}):null}),o.jsx(qu,{anchorId:Qn.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:u.data&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{id:ac("env"),children:o.jsx(ZB,{items:h.draft.env,otherKeys:ge,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Be.status!=="active"})}),o.jsx("div",{id:ac("git"),children:o.jsx(VB,{items:h.draft.git,otherPaths:Ue,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Be.status!=="active"})}),R&&o.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:R}),h.summary.anyDirty&&o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:o.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"})})]})})]}),o.jsx(V7,{}),o.jsx(UB,{agent:Be,suspendPending:D.isPending,reactivatePending:P.isPending,deletePending:z.isPending,onSuspend:()=>D.mutate(),onReactivate:()=>P.mutate(),onDelete:()=>z.mutate()})]}),!bt&&o.jsx(G7,{summary:h.summary,saveHint:hi,conflictMessage:b,errorMessage:g,saving:C.isPending,justSaved:k,onSave:()=>C.mutate(),onDiscard:()=>{h.summary.anyDirty&&ze(!0)},onReloadRemote:E,onJumpTo:ke=>T(ac(ke))})]}),o.jsx(sZ,{open:xe,onOpenChange:ze,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),p(null),w(null),ze(!1)}}),o.jsx(Tn,{open:M,onOpenChange:ke=>{V(ke),ke||(X(""),Se(null),re.reset())},children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:"Bind computer"})}),o.jsxs("div",{className:"space-y-4",children:[o.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."}),H.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):H.error?o.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",H.error instanceof Error?H.error.message:"Unknown"]}):o.jsx(lZ,{clients:H.data??[],selected:I,onSelect:X}),se&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:se})]}),o.jsxs(ur,{children:[o.jsx(pe,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),o.jsx(pe,{disabled:!I||re.isPending,onClick:()=>{Se(null),re.mutate(I)},children:re.isPending?"Binding…":"Bind"})]})]})}),o.jsx(B7,{open:Y,onOpenChange:ee,agent:Be})]})}function iZ({label:e,active:t,danger:n,dirty:a,onClick:s}){return o.jsx("button",{type:"button",onClick:s,className:Re("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:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"flex-1 truncate",children:e}),a&&o.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&&o.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 sZ(e){return o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:e.title})}),o.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function lZ({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?o.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"," ",o.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."]}):o.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 u=s.id===t,c=s.status==="online"||s.status==="active";return o.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:o.jsxs("button",{type:"button",onClick:()=>n(s.id),className:Re("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:u?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[o.jsx("span",{className:Re("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),o.jsxs("span",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),o.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}`:""]})]}),o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const oZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},uZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},cZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function dZ({result:e,onDismiss:t}){const n=uZ[e.status],a=cZ[e.status],s=e.connection;return o.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:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ga,{tone:a,children:oZ[e.status]}),e.responseTime!=null&&o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[o.jsx("div",{children:s.runtimeState&&o.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?o.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):o.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&o.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&o.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})]}),o.jsx(pe,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function fZ(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 hZ(){return this.eachAfter(fZ)}function mZ(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function pZ(e,t){for(var n=this,a=[n],s,u,c=-1;n=a.pop();)if(e.call(t,n,++c,this),s=n.children)for(u=s.length-1;u>=0;--u)a.push(s[u]);return this}function gZ(e,t){for(var n=this,a=[n],s=[],u,c,f,m=-1;n=a.pop();)if(s.push(n),u=n.children)for(c=0,f=u.length;c<f;++c)a.push(u[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function yZ(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function vZ(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 bZ(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function xZ(e){for(var t=this,n=wZ(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 wZ(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 SZ(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function kZ(){return Array.from(this)}function jZ(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function EZ(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*CZ(){var e=this,t,n=[e],a,s,u;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,u=a.length;s<u;++s)n.push(a[s]);while(n.length)}function U_(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=TZ)):t===void 0&&(t=_Z);for(var n=new So(e),a,s=[n],u,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(u=c[f]=new So(c[f])),u.parent=a,u.depth=a.depth+1;return n.eachBefore(B_)}function NZ(){return U_(this).eachBefore(AZ)}function _Z(e){return e.children}function TZ(e){return Array.isArray(e)?e[1]:null}function AZ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function B_(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function So(e){this.data=e,this.depth=this.height=0,this.parent=null}So.prototype=U_.prototype={constructor:So,count:hZ,each:mZ,eachAfter:gZ,eachBefore:pZ,find:yZ,sum:vZ,sort:bZ,path:xZ,ancestors:SZ,descendants:kZ,leaves:jZ,links:EZ,copy:NZ,[Symbol.iterator]:CZ};function Rg(e){return e==null?null:RZ(e)}function RZ(e){if(typeof e!="function")throw new Error;return e}var OZ={depth:-1},Ok={},Og={};function zZ(e){return e.id}function DZ(e){return e.parentId}function MZ(){var e=zZ,t=DZ,n;function a(s){var u=Array.from(s),c=e,f=t,m,h,g,p,b,w,k,j,C=new Map;if(n!=null){const E=u.map((D,P)=>IZ(n(D,P,s))),T=E.map(zk),O=new Set(E).add("");for(const D of T)O.has(D)||(O.add(D),E.push(D),T.push(zk(D)),u.push(Og));c=(D,P)=>E[P],f=(D,P)=>T[P]}for(g=0,m=u.length;g<m;++g)h=u[g],w=u[g]=new So(h),(k=c(h,g,s))!=null&&(k+="")&&(j=w.id=k,C.set(j,C.has(j)?Ok:w)),(k=f(h,g,s))!=null&&(k+="")&&(w.parent=k);for(g=0;g<m;++g)if(w=u[g],k=w.parent){if(b=C.get(k),!b)throw new Error("missing: "+k);if(b===Ok)throw new Error("ambiguous: "+k);b.children?b.children.push(w):b.children=[w],w.parent=b}else{if(p)throw new Error("multiple roots");p=w}if(!p)throw new Error("no root");if(n!=null){for(;p.data===Og&&p.children.length===1;)p=p.children[0],--m;for(let E=u.length-1;E>=0&&(w=u[E],w.data===Og);--E)w.data=null}if(p.parent=OZ,p.eachBefore(function(E){E.depth=E.parent.depth+1,--m}).eachBefore(B_),p.parent=null,m>0)throw new Error("cycle");return p}return a.id=function(s){return arguments.length?(e=Rg(s),a):e},a.parentId=function(s){return arguments.length?(t=Rg(s),a):t},a.path=function(s){return arguments.length?(n=Rg(s),a):n},a}function IZ(e){e=`${e}`;let t=e.length;return Zy(e,t-1)&&!Zy(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function zk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Zy(e,t););return e.slice(0,t)}function Zy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function LZ(e,t){return e.parent===t.parent?1:2}function zg(e){var t=e.children;return t?t[0]:e.t}function Dg(e){var t=e.children;return t?t[t.length-1]:e.t}function PZ(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 UZ(e){for(var t=0,n=0,a=e.children,s=a.length,u;--s>=0;)u=a[s],u.z+=t,u.m+=t,t+=u.s+(n+=u.c)}function BZ(e,t,n){return e.a.parent===t.parent?e.a:n}function Pf(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}Pf.prototype=Object.create(So.prototype);function FZ(e){for(var t=new Pf(e,0),n,a=[t],s,u,c,f;n=a.pop();)if(u=n._.children)for(n.children=new Array(f=u.length),c=f-1;c>=0;--c)a.push(s=n.children[c]=new Pf(u[c],c)),s.parent=n;return(t.parent=new Pf(null,0)).children=[t],t}function $Z(){var e=LZ,t=1,n=1,a=null;function s(h){var g=FZ(h);if(g.eachAfter(u),g.parent.m=-g.z,g.eachBefore(c),a)h.eachBefore(m);else{var p=h,b=h,w=h;h.eachBefore(function(T){T.x<p.x&&(p=T),T.x>b.x&&(b=T),T.depth>w.depth&&(w=T)});var k=p===b?1:e(p,b)/2,j=k-p.x,C=t/(b.x+k+j),E=n/(w.depth||1);h.eachBefore(function(T){T.x=(T.x+j)*C,T.y=T.depth*E})}return h}function u(h){var g=h.children,p=h.parent.children,b=h.i?p[h.i-1]:null;if(g){UZ(h);var w=(g[0].z+g[g.length-1].z)/2;b?(h.z=b.z+e(h._,b._),h.m=h.z-w):h.z=w}else b&&(h.z=b.z+e(h._,b._));h.parent.A=f(h,b,h.parent.A||p[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,g,p){if(g){for(var b=h,w=h,k=g,j=b.parent.children[0],C=b.m,E=w.m,T=k.m,O=j.m,D;k=Dg(k),b=zg(b),k&&b;)j=zg(j),w=Dg(w),w.a=h,D=k.z+T-b.z-C+e(k._,b._),D>0&&(PZ(BZ(k,h,p),h,D),C+=D,E+=D),T+=k.m,C+=b.m,O+=j.m,E+=w.m;k&&!Dg(w)&&(w.t=k,w.m+=T-E),b&&!zg(j)&&(j.t=b,j.m+=C-O,p=h)}return p}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function qZ(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(my(e,`/context-tree/snapshot${n}`))}function rl({title:e,subtitle:t,right:n,className:a,style:s,...u}){return o.jsxs("div",{className:Re("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...u,children:[o.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),o.jsx("div",{style:{flex:1}}),n]})}const F_=[{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 HZ(){const{organizationId:e}=ot(),[t,n]=x.useState("7d"),[a,s]=x.useState(null),[u,c]=x.useState(null),f=Qe({queryKey:["context-tree-snapshot",e,t],queryFn:()=>{if(!e)throw new Error("No organization selected");return qZ(e,t)},enabled:!!e}),m=f.data,h=x.useMemo(()=>m?m.updates.find(b=>b.id===a)??m.updates[0]??null:null,[a,m]),g=x.useMemo(()=>m&&h!=null&&h.nodeId?m.nodes.find(b=>b.id===h.nodeId)??null:null,[h,m]),p=u??(h==null?void 0:h.nodeId)??(g==null?void 0:g.id)??null;return x.useEffect(()=>{var b;m&&(a&&m.updates.some(w=>w.id===a)||s(((b=m.updates[0])==null?void 0:b.id)??null))},[a,m]),o.jsxs("div",{className:"-m-6",children:[o.jsx(rl,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),o.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[f.isLoading?o.jsx(JZ,{}):null,f.error?o.jsx(eG,{message:f.error instanceof Error?f.error.message:"Failed to load"}):null,m&&!f.isLoading?o.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:m.snapshotStatus==="unavailable"?o.jsx(q_,{snapshot:m}):o.jsxs(o.Fragment,{children:[o.jsx(ZZ,{snapshot:m,window:t,onWindowChange:n}),o.jsx(GZ,{snapshot:m,selectedUpdate:h,selectedUpdateNode:g,selectedOverviewNodeId:p,onSelectUpdate:b=>{s(b.id),c(b.nodeId)},onSelectOverviewNode:c})]})}):null]})]})}function ZZ({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?o.jsx(Nz,{size:18}):o.jsx(Ws,{size:18}),s=aG(t);return o.jsx(En,{children:o.jsx(Wn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:o.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)",minWidth:0},children:[o.jsx("span",{style:{color:iG(e.contextStatus.severity),flex:"0 0 auto"},children:a}),o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("div",{className:"flex flex-wrap items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("div",{className:"text-subtitle font-semibold",style:{color:"var(--fg)"},children:e.contextStatus.label}),e.branch||e.headCommit?o.jsxs("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:[e.branch??"unknown",e.headCommit?`@${e.headCommit.slice(0,7)}`:""]}):null]}),o.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."})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center justify-end",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx(Ef,{value:e.summary.changedNodeCount,label:`updates in the ${s}`}),o.jsx(Ef,{value:e.summary.addedCount,label:"added",tone:"added"}),o.jsx(Ef,{value:e.summary.editedCount,label:"edited",tone:"edited"}),o.jsx(Ef,{value:e.summary.removedCount,label:"removed",tone:"removed"})]}),o.jsxs("fieldset",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:[o.jsx("legend",{className:"sr-only",children:"Context update window"}),F_.map(u=>o.jsx(pe,{variant:u.value===t?"default":"outline",size:"xs",onClick:()=>n(u.value),children:u.label},u.value))]})]})]})})})}function GZ({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:u}){const c=f=>{u(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[o.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-4)",alignItems:"stretch"},children:[o.jsxs(En,{className:"flex h-full flex-col",children:[o.jsx(sa,{children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx(la,{children:"Context Updates"}),o.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:[e.updates.length," team context changes agents may use"]})]})}),o.jsx(Wn,{className:"flex-1",children:e.updates.length===0?o.jsx(H_,{}):o.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=>o.jsx(VZ,{update:f,selected:f.id===(t==null?void 0:t.id),onClick:()=>s(f)},f.id))})})]}),o.jsx(QZ,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),o.jsx(KZ,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function VZ({update:e,selected:t,onClick:n}){return o.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:[o.jsx("div",{className:"flex items-start justify-between",style:{gap:"var(--sp-2)"},children:o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx($_,{type:e.changeType}),o.jsx("span",{className:"text-body font-semibold",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:uG(e)})]}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",Z_(e.path)]})]})}),o.jsxs("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-3)",gap:"var(--sp-2)",marginTop:"var(--sp-2)"},children:[o.jsx("span",{children:pG(e.owners)}),e.relatedNodeIds.length>0?o.jsx("span",{children:gG(e.relatedNodeIds.length)}):null]})]})}function QZ({update:e,node:t,snapshot:n}){const[a,s]=x.useState(!1),u=t==null?void 0:t.relatedNodeIds.map(p=>n.nodes.find(b=>b.id===p)).filter(p=>!!p),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,f=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?mG(e.owners):"No owner",h=u&&u.length>0?u.map(p=>p.title||p.path||"root"):[],g=e?yG(e.path)||Z_(e.path):"root";return o.jsxs(En,{className:"flex h-full flex-col",children:[o.jsxs(sa,{children:[o.jsxs("div",{children:[o.jsx(la,{children:"Selected Change"}),o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Summary and source context"})]}),e?o.jsx($_,{type:e.changeType}):null]}),o.jsx(Wn,{className:"flex-1",children:e?o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[cG(e)," · ",lG(e.changeType)," · ",g]}),o.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})]}),o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:o.jsx(XZ,{value:dG(e),impact:oG(e)})}),o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:o.jsx(WZ,{commit:f,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(p=>!p)}})})]}):o.jsx(H_,{})})]})}function KZ({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=x.useMemo(()=>nG(e.nodes),[e.nodes]),s=x.useMemo(()=>rG(e.nodes),[e.nodes]),u=Math.max(920,...a.map(f=>f.x+300)),c=Math.max(340,a.length*34);return o.jsxs(En,{children:[o.jsx(sa,{children:o.jsxs("div",{children:[o.jsxs(la,{children:[o.jsx(zz,{size:17}),"Context Tree Overview"]}),o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Shows where recent context updates are concentrated across the team tree"})]})}),o.jsx(Wn,{children:a.length===0?o.jsx(q_,{snapshot:e}):o.jsx("div",{style:{overflow:"auto",maxHeight:"min(72vh, 52rem)"},children:o.jsxs("svg",{viewBox:`0 0 ${u} ${c}`,role:"img","aria-label":"Context Tree overview",style:{width:"100%",minWidth:"44rem"},children:[a.map(f=>f.parent?o.jsx("line",{x1:f.parent.x,y1:f.parent.y,x2:f.x,y2:f.y,stroke:"var(--border)",strokeWidth:1},`edge:${f.id}`):null),a.map(f=>{const m=f.id===t,h=s.get(f.id)??0;return o.jsx("foreignObject",{x:f.x-8,y:f.y-12,width:u-f.x+8,height:24,children:o.jsxs("button",{type:"button",onClick:()=>n(f.id),className:"flex w-full items-center text-left text-label",style:{color:"var(--fg)",gap:"var(--sp-2)"},children:[o.jsx("span",{"aria-hidden":"true",style:{width:m?"var(--sp-4)":"var(--sp-3)",height:m?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:vG(f.changeType,m),border:`${m?"var(--hairline-bold)":"var(--hairline)"} solid ${m?"var(--accent)":"var(--border-strong)"}`,flex:"0 0 auto"}}),o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),h>0?o.jsx("span",{style:{color:"var(--fg-3)",marginLeft:"auto",paddingRight:"var(--sp-2)"},children:h}):null]})},f.id)})]})})})]})}function Ef({value:e,label:t,tone:n}){return o.jsxs("span",{className:"inline-flex items-baseline text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[o.jsx("span",{className:"font-semibold",style:{color:n?V_(n):"var(--fg)"},children:e}),o.jsx("span",{children:t})]})}function YZ({label:e,tone:t,strong:n}){return o.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?V_(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 $_({type:e}){return o.jsx(YZ,{label:sG(e),tone:e})}function XZ({value:e,impact:t}){return o.jsxs("div",{style:{color:"var(--fg-2)"},children:[o.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Change summary"}),o.jsx("div",{className:"text-body",children:e}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:["Impact: ",t]})]})}function WZ({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:u,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 o.jsxs("div",{children:[o.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Reference"}),o.jsx("dl",{className:"grid grid-cols-1 md:grid-cols-2",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-2)"},children:f.map(m=>o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"4rem minmax(0,1fr)",gap:"var(--sp-2)"},children:[o.jsx("dt",{className:"text-label font-semibold",style:{color:"var(--fg-3)"},children:m.label}),o.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))}),o.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-3)"},children:[o.jsx(pe,{variant:"outline",size:"xs",onClick:c,children:u?"Hide source":"Preview source"}),o.jsxs(pe,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[o.jsx(ch,{size:14}),"Copy path"]})]}),u?o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",marginTop:"var(--sp-3)",paddingTop:"var(--sp-3)"},children:s?o.jsx(Rh,{children:s}):o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function JZ(){return o.jsx(En,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[o.jsx(Xz,{size:17}),"Loading team context..."]})})})}function eG({message:e}){return o.jsx(En,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[o.jsx(Ws,{size:17}),e]})})})}function q_({snapshot:e}){const t=e.repo?"Context Tree sync unavailable":"Connect Context Tree",n=e.repo?"Hub cannot read the team Context Tree yet. Agents and users will see context here after the server can sync the configured repo.":"Connect a Context Tree repo to show the team knowledge agents can use.",a=e.contextStatus.detail,s=e.repo?tG(e.repo):null;return o.jsx(En,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[o.jsx(Ws,{size:18,style:{color:"var(--warn)"}}),o.jsxs("div",{children:[o.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),o.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?o.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 tG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function H_(){return o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}function nG(e){const t=new Map(e.map(m=>[m.id,m])),n=e.filter(m=>!m.parentId||t.has(m.parentId)).sort((m,h)=>m.path.localeCompare(h.path));if(n.length===0)return[];const a=MZ().id(m=>m.id).parentId(m=>m.parentId)(n).sort((m,h)=>m.data.path.localeCompare(h.data.path)),u=$Z().nodeSize([34,96])(a).descendants(),c=Math.min(...u.map(m=>m.x));return u.map(m=>({...m.data,x:24+m.y,y:24+m.x-c,parent:null})).map((m,h,g)=>({...m,parent:m.parentId?g.find(p=>p.id===m.parentId)??null:null}))}function rG(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 aG(e){var t;return((t=F_.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function iG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function sG(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function lG(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function oG(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 uG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function cG(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function dG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=hG(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function fG(e){return e.summary.replace(/^updated:\s*/i,"")}function hG(e){const t=fG(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 mG(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function pG(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function gG(e){return`${e} linked context${e===1?"":"s"}`}function yG(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(G_).join(" / ")}function Z_(e){return e.split("/").filter(Boolean).map(G_).join(" / ")||"root"}function G_(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function V_(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function vG(e,t){return t?"var(--accent)":e==="added"?"var(--ok)":e==="edited"?"var(--warn)":e==="removed"?"var(--danger)":"var(--bg-raised)"}const Do=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));Do.displayName="Card";const Mo=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("flex flex-col space-y-1.5 p-6",e),...t}));Mo.displayName="CardHeader";const qc=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("text-subtitle leading-none",e),...t}));qc.displayName="CardTitle";const Q_=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("text-body text-muted-foreground",e),...t}));Q_.displayName="CardDescription";const Io=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("p-6 pt-0",e),...t}));Io.displayName="CardContent";const bG=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Re("flex items-center p-6 pt-0",e),...t}));bG.displayName="CardFooter";function xG(){const{token:e}=qj(),t=Rn(),{isAuthenticated:n,adoptTokens:a}=ot(),[s,u]=x.useState(null),[c,f]=x.useState(null),[m,h]=x.useState(!1),[g,p]=x.useState(null);if(x.useEffect(()=>{e&&(async()=>{try{const C=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!C.ok){f("This invitation is no longer valid");return}u(await C.json())}catch{f("Network error while loading invitation")}})()},[e]),x.useEffect(()=>{n&&(async()=>{try{const C=await Ee.get("/me/organizations"),E=await Ee.get("/me"),T=C.find(O=>O.id===E.member.organizationId);p((T==null?void 0:T.displayName)??null)}catch{}})()},[n]),!e)return o.jsx(Dk,{message:"Bad invitation URL"});if(c)return o.jsx(Dk,{message:"This invitation is no longer valid"});if(!s)return o.jsx(wG,{});const b=async()=>{h(!0);try{const C=await Ee.post("/me/organizations/join",{token:e});await a(C.tokens),tE("invite"),t("/",{replace:!0})}catch(C){f(C instanceof Error?C.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&g&&g!==s.organizationDisplayName,j=SG(s.expiresAt);return o.jsx(pb,{children:o.jsxs(Do,{className:"w-full max-w-sm",children:[o.jsx(Mo,{className:"text-center",children:o.jsxs(qc,{className:"text-title",children:["You're invited to join",o.jsx("br",{}),s.organizationDisplayName]})}),o.jsxs(Io,{className:"space-y-4",children:[k&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[o.jsx(Ws,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),o.jsxs("span",{children:["You'll switch from ",o.jsx("span",{className:"font-medium",children:g})," to"," ",o.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?o.jsx(pe,{className:"w-full",disabled:m,onClick:b,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):o.jsx(pe,{asChild:!0,className:"w-full",children:o.jsxs("a",{href:w,children:[o.jsx(oE,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&o.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.text}),o.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",o.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",o.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function pb({children:e}){return o.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[o.jsx("header",{className:"px-4 py-3",children:o.jsxs(Oc,{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:[o.jsx(gv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),o.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function wG(){return o.jsx(pb,{children:o.jsxs(Do,{className:"w-full max-w-sm",children:[o.jsxs(Mo,{className:"text-center",children:[o.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),o.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),o.jsxs(Io,{className:"space-y-4",children:[o.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),o.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function Dk({message:e}){return o.jsx(pb,{children:o.jsxs(Do,{className:"w-full max-w-sm",children:[o.jsxs(Mo,{className:"text-center",children:[o.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:o.jsx(Ws,{className:"h-6 w-6"})}),o.jsx(qc,{className:"text-title",children:e})]}),o.jsxs(Io,{className:"space-y-4",children:[o.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."}),o.jsx(pe,{asChild:!0,variant:"outline",className:"w-full",children:o.jsxs(Oc,{to:"/",children:[o.jsx(gv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function SG(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),u=Math.floor(s/24);return u>7?null:u>=1?{text:`Expires in ${u} ${u===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 kG(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}`,u=lN(s);return u===P1&&s!==P1?null:u}function jG(){const{isAuthenticated:e}=ot(),t=Sr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=kG(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,u="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?o.jsx(lr,{to:a,replace:!0}):o.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[o.jsx("header",{className:"px-4 py-3",children:o.jsxs(Oc,{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:[o.jsx(gv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),o.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:o.jsxs(Do,{className:"w-full max-w-sm",children:[o.jsxs(Mo,{className:"text-center",children:[o.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:o.jsx(Lc,{width:28,height:32})}),o.jsxs(qc,{className:"text-title",children:["First Tree ",o.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),o.jsxs(Io,{className:"space-y-4",children:[o.jsx(pe,{asChild:!0,className:"w-full",children:o.jsxs("a",{href:s,children:[o.jsx(oE,{className:"h-4 w-4"}),"Continue with GitHub"]})}),o.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",o.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",o.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[o.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),o.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),o.jsx(pe,{asChild:!0,variant:"outline",className:"w-full",children:o.jsxs("a",{href:u,children:[o.jsx(oD,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function EG(){const e=Rn(),{adoptTokens:t}=ot(),[n,a]=x.useState(null);return x.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,u=new URLSearchParams(s),c=u.get("access"),f=u.get("refresh"),m=lN(u.get("next")),h=u.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&tE(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const ko=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("table",{ref:a,className:Re("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));ko.displayName="DenseTable";const jo=x.forwardRef(({className:e,...t},n)=>o.jsx("thead",{ref:n,className:e,...t}));jo.displayName="DenseTableHeader";const Eo=x.forwardRef(({className:e,...t},n)=>o.jsx("tbody",{ref:n,className:e,...t}));Eo.displayName="DenseTableBody";const ya=x.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},u)=>o.jsx("tr",{ref:u,className:Re("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}));ya.displayName="DenseTableRow";const mt=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("th",{ref:a,className:Re("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}));mt.displayName="DenseTableHead";const st=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("td",{ref:a,className:Re("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));st.displayName="DenseTableCell";const CG=1500;function NG({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:u,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,g]=x.useState(!1),p=async()=>{e&&(await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),CG))},b=t!==void 0?Math.max(1,Math.round(t/60)):null,w=o.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?o.jsxs(o.Fragment,{children:[e,b!==null&&o.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",b,"m"]})]}):"Generating token…"}),k=o.jsxs(pe,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:!e,style:{alignSelf:"flex-start"},children:[h?o.jsx(wr,{className:"h-3.5 w-3.5"}):o.jsx(ch,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,k]}):o.jsxs(o.Fragment,{children:[w,k]}),f&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&o.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:[o.jsx(_G,{}),s]}),n==="success"&&u&&o.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:[o.jsx(wr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),o.jsx("span",{style:{minWidth:0},children:u})]}),n==="error"&&c&&o.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 _G(){return o.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 TG=3e3,AG=1200;function RG({open:e,onOpenChange:t}){const n=ln(),{user:a}=ot(),[s,u]=x.useState("loading"),[c,f]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),b=x.useRef(new Set);return x.useEffect(()=>{if(!e){u("loading"),f(null),h(null),p(null),b.current=new Set;return}let w=!1;const k=(n.getQueryData(["clients"])??[]).map(j=>j.id);return b.current=new Set(k),(async()=>{try{const j=await e3();if(w)return;f(j),u("waiting")}catch(j){if(w)return;h(j instanceof Error?j.message:"Failed to generate connect token"),u("error")}})(),()=>{w=!0}},[e,n]),x.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const k=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:ss}),C=b.current,E=j.find(T=>!C.has(T.id)&&T.status==="connected"&&T.userId===a.id);E&&(p(E.hostname??null),u("success"))}catch{}},TG);return()=>clearInterval(k)},[e,s,n,a]),x.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},AG);return()=>clearTimeout(w)},[s,t,n]),o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsxs(In,{children:[o.jsx(An,{children:"Connect computer"}),o.jsx(_v,{children:"Run this command on the machine you want to pair with this Hub."})]}),o.jsx(NG,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-semibold",children:g??"Computer"})," connected. Closing…"]}),errorContent:m}),o.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:o.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function OG({embedded:e=!1}={}){const t=ln(),n=gh(),[a,s]=x.useState(()=>new Set),[u,c]=x.useState(null),[f,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(!1),{data:w}=Qe({queryKey:["clients"],queryFn:ss,refetchInterval:1e4}),{data:k}=Qe({queryKey:["activity"],queryFn:Dc,refetchInterval:1e4}),j=Et({mutationFn:JD,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),C=Et({mutationFn:WD,onSuccess:()=>{m(null),g(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:z=>{z instanceof zc?g(z.message):g(z instanceof Error?z.message:String(z))}}),E=x.useMemo(()=>{const z=new Map;for(const B of(k==null?void 0:k.agents)??[]){if(!B.clientId)continue;const M=z.get(B.clientId)??[];M.push(B),z.set(B.clientId,M)}return z},[k==null?void 0:k.agents]),T=z=>E.get(z)??[],O=(w??[]).filter(z=>z.status==="connected").length,D=(w??[]).reduce((z,B)=>z+B.agentCount,0),P=(w??[]).filter(z=>z.authState!=="ok").length;return o.jsxs("div",{className:e?"":"-m-6",children:[o.jsx(rl,{title:"Computers",subtitle:w&&w.length>0?o.jsxs(o.Fragment,{children:[w.length," total · ",O," connected · ",D," agents bound",P>0&&o.jsxs(o.Fragment,{children:[" · ",o.jsxs("span",{style:{color:"var(--state-error)"},children:[P," need re-auth"]})]})]}):null,right:o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsxs(pe,{size:"xs",onClick:()=>b(!0),children:[o.jsx(ba,{className:"h-3 w-3"}),"Connect computer"]})})}),o.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[o.jsx(RG,{open:p,onOpenChange:b}),f&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:o.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:[o.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),o.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",o.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)."]}),T(f.id).length>0&&o.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:[o.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),o.jsx("ul",{className:"text-body space-y-0.5",children:T(f.id).map(z=>o.jsx("li",{className:"font-medium",children:n(z.agentId)},z.agentId))})]}),h&&o.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}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{variant:"outline",size:"sm",onClick:()=>{m(null),g(null)},children:"Cancel"}),o.jsx(pe,{variant:"destructive",size:"sm",onClick:()=>C.mutate(f.id),disabled:C.isPending,children:C.isPending?"Retiring…":"Retire"})]})]})}),u&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:o.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:[o.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),o.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",o.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:u.hostname??u.id.slice(0,8)})," ","and affect all bound agents:"]}),o.jsx("ul",{className:"mb-4 space-y-1",children:T(u.id).length===0?o.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):T(u.id).map(z=>o.jsxs("li",{className:"text-body flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",children:n(z.agentId)}),o.jsx(yc,{state:z.runtimeState})]},z.agentId))}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),o.jsx(pe,{variant:"destructive",size:"sm",onClick:()=>j.mutate(u.id),disabled:j.isPending,children:j.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?o.jsx(En,{children:o.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."})}):o.jsxs(En,{children:[o.jsxs(zy,{children:["Registered · ",w.length]}),o.jsxs(ko,{children:[o.jsx(jo,{children:o.jsxs(ya,{children:[o.jsx(mt,{style:{width:16}}),o.jsx(mt,{children:"Hostname"}),o.jsx(mt,{children:"OS"}),o.jsx(mt,{children:"SDK"}),o.jsx(mt,{children:"Agents"}),o.jsx(mt,{children:"Connected"}),o.jsx(mt,{children:"Status"}),o.jsx(mt,{"aria-hidden":!0})]})}),o.jsx(Eo,{children:w.map(z=>{const B=!a.has(z.id),M=T(z.id);return o.jsx(UG,{client:z,boundAgents:M,isExpanded:B,agentName:n,onToggle:()=>s(V=>{const I=new Set(V);return I.has(z.id)?I.delete(z.id):I.add(z.id),I}),onDisconnect:()=>c(z),onRetire:()=>{g(null),m(z)},onReconnect:()=>b(!0)},z.id)})})]})]})]})]})}const zG={"claude-code":"Claude Code",codex:"Codex"},DG=[Yf.CLAUDE_CODE,Yf.CODEX],Mk={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},MG={"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 IG({clientId:e,enabled:t}){const{data:n,isLoading:a}=Qe({queryKey:["client-capabilities",e],queryFn:()=>Sv(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return o.jsxs(o.Fragment,{children:[o.jsx(Qv,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):o.jsx("div",{className:"flex flex-col gap-1",children:DG.map(u=>o.jsx(LG,{provider:u,entry:s?s[u]??null:null},u))})]})}function LG({provider:e,entry:t}){const n=zG[e];if(!t)return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",Mk[e]]})]});switch(t.state){case"ok":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",MG[e]]})]});case"missing":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",Mk[e]]})]});case"error":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function PG(){return o.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[o.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}function UG({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:u,onRetire:c,onReconnect:f}){const h=e.status!=="connected",g=e.authState!=="ok",p=e.status==="connected"?"idle":"offline";return o.jsxs(o.Fragment,{children:[o.jsxs(ya,{interactive:!0,selected:n,onClick:s,children:[o.jsx(st,{style:{width:16},children:o.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?o.jsx(yv,{className:"h-3.5 w-3.5"}):o.jsx(Ez,{className:"h-3.5 w-3.5"})})}),o.jsx(st,{className:"font-medium",children:e.hostname??"—"}),o.jsx(st,{style:{color:"var(--fg-3)"},children:e.os??"—"}),o.jsx(st,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),o.jsx(st,{children:o.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),o.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?cc(e.connectedAt):"—"}),o.jsx(st,{children:g?o.jsx(PG,{}):o.jsx(yc,{state:p})}),o.jsx(st,{style:{width:1,whiteSpace:"nowrap"},children:o.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:g?"var(--state-error)":"var(--fg-2)"},onClick:b=>{b.stopPropagation(),f()},children:"Reconnect"}),o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:b=>{b.stopPropagation(),u()},children:"Disconnect"}),o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:b=>{b.stopPropagation(),c()},children:"Retire"})]})})]}),n&&o.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[o.jsx(st,{}),o.jsxs(st,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[o.jsx(IG,{clientId:e.id,enabled:n}),t.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs(Qv,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),o.jsx("div",{className:"flex flex-col gap-1",children:t.map(b=>o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(b.agentId)}),o.jsx(yc,{state:b.runtimeState}),b.activeSessions!==null&&o.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[b.activeSessions," / ",b.totalSessions??0," sessions"]})]},b.agentId))})]})]})]})]})}function BG(){return o.jsx(OG,{embedded:!0})}function Lo(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function gb(e){return Ee.get(Lo(e,"context_tree"))}function K_(e,t){return Ee.put(Lo(e,"context_tree"),t)}function FG(e){return Ee.get(Lo(e,"github_integration"))}function $G(e,t){return Ee.put(Lo(e,"github_integration"),t)}function Y_(e){return Ee.get(Lo(e,"source_repos"))}function X_(e,t){return Ee.put(Lo(e,"source_repos"),t)}function xc({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:u=!1,type:c="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:g}){const p=x.useId(),b=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${u?"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 o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[o.jsx("label",{htmlFor:p,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&o.jsx(qG,{})]}),t&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),o.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?o.jsx("input",{id:p,value:n,readOnly:!0,className:b,style:{...w,color:"var(--fg-2)"}}):o.jsx("input",{id:p,value:n,onChange:k=>a==null?void 0:a(k.target.value),type:c,placeholder:f,pattern:g,className:b,style:w}),m]})]})}function qG(){return o.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:[o.jsx(wr,{className:"h-3 w-3"}),"Saved"]})}function yb({pending:e,disabled:t=!1}){const n=e||t;return o.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?o.jsx(uE,{className:"h-4 w-4 animate-spin"}):o.jsx(wr,{className:"h-4 w-4"})})}function Hc({title:e,description:t,right:n,children:a,isFirst:s=!1}){return o.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&o.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),o.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function HG({isFirst:e=!1}){var E,T;const{organizationId:t}=ot(),n=ln(),a=Qe({queryKey:["org-setting",t,"github_integration"],queryFn:()=>t?FG(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,u]=x.useState(""),[c,f]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(!1),b=((E=a.data)==null?void 0:E.webhookUrl)??"",w=Et({mutationFn:()=>{if(!t)throw new Error("organization not loaded");const O=s.trim();return O.length===0&&!c?Promise.resolve(a.data):$G(t,{webhookSecret:O.length>0?O:null})},onSuccess:O=>{O&&(n.setQueryData(["org-setting",t,"github_integration"],O),u(""),f(!1),h(!0),setTimeout(()=>h(!1),2e3))}}),k=O=>{O.preventDefault(),w.mutate()},j=async()=>{b&&(await navigator.clipboard.writeText(b),p(!0),setTimeout(()=>p(!1),2e3))},C=((T=a.data)==null?void 0:T.webhookSecretConfigured)??!1;return o.jsx(Hc,{title:"GitHub webhook",description:"Routes GitHub issue and comment events to your team's agents.",isFirst:e,children:a.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):o.jsxs("form",{onSubmit:k,children:[b?o.jsx(xc,{label:"Webhook URL",hint:"Configure this URL in GitHub repo / org Settings → Webhooks. Never changes.",value:b,readOnly:!0,mono:!0,rightSlot:o.jsxs(pe,{type:"button",size:"sm",variant:"outline",onClick:j,children:[o.jsx(ch,{className:"h-3 w-3"}),g?"Copied":"Copy"]})}):o.jsx(ZG,{}),C&&!c?o.jsx(GG,{saved:m,onReplace:()=>{f(!0),u("")}}):o.jsx(xc,{label:"Webhook secret",hint:"Paste the value you used when configuring the GitHub webhook. Stored encrypted; never echoed back.",value:s,onChange:u,mono:!0,type:"password",placeholder:c?"Enter new secret":"(none)",saved:m,rightSlot:o.jsx(yb,{pending:w.isPending,disabled:!a.data})}),w.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:w.error.message})]})})}function ZG(){return o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook URL"}),o.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[o.jsx(Ws,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),o.jsx("span",{children:"The Hub's public URL is not configured. Please contact your site administrator to enable the GitHub webhook."})]})]})}function GG({saved:e,onReplace:t}){return o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook secret"}),e&&o.jsx("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:"✓ Saved"})]}),o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:"Configured. Replace to rotate; webhook signature verification will fail until GitHub is also updated."}),o.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[o.jsx("div",{className:"flex-1 mono text-body flex items-center",style:{padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-2)"},children:"••••••••"}),o.jsx(pe,{type:"button",size:"sm",variant:"outline",onClick:t,children:"Replace"})]})]})}function VG(){const{role:e}=ot();return e===null?o.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?o.jsx(lr,{to:"/settings/computers",replace:!0}):o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"GitHub",subtitle:"Webhook URL + secret for routing GitHub events to your agents"}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(HG,{isFirst:!0})})]})}function QG(){return Ee.get(Ln("/adapter-mappings"))}function KG(e){return Ee.post(Ln("/adapter-mappings"),e)}function YG(e){return Ee.delete(`/adapter-mappings/${e}`)}function XG(){return Ee.get(Ln("/adapters/status"))}function WG(){return Ee.get(Ln("/adapters"))}function JG(e){return Ee.post(Ln("/adapters"),e)}function eV(e,t){return Ee.patch(`/adapters/${e}`,t)}function tV(e){return Ee.delete(`/adapters/${e}`)}const nV=Object.values(YU),Ik={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function Lk(e){const[t,n]=x.useState(Ik),[a,s]=x.useState("");x.useEffect(()=>{e.open&&(n({...Ik,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function u(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=rV(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 o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:c})}),o.jsxs("form",{onSubmit:u,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-platform",children:"Platform"}),o.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:nV.map(f=>o.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-ext-id",children:"External user ID"}),o.jsx($t,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-name",children:"Display name (optional)"}),o.jsx($t,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):o.jsxs(o.Fragment,{children:[t.platform==="feishu"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx($t,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),o.jsx($t,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx($t,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx($t,{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&&o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),o.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&&o.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-status",children:"Status"}),o.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:[o.jsx("option",{value:"active",children:"active"}),o.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function rV(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 aV(){var _;const e=Rn(),t=ln(),[n,a]=oh(),s=n.get("agent"),u=gh(),c=Qe({queryKey:["adapters"],queryFn:WG}),f=Qe({queryKey:["adapter-mappings"],queryFn:QG}),m=Qe({queryKey:["adapter-statuses"],queryFn:XG,refetchInterval:15e3}),g=((_=Qe({queryKey:["agents","name-map"],queryFn:()=>Ic({limit:100}),staleTime:3e4}).data)==null?void 0:_.items)??[],p=x.useMemo(()=>{const Z=new Map;for(const K of m.data??[])Z.set(K.configId,K);return Z},[m.data]),b=x.useMemo(()=>{const Z=c.data??[];return s?Z.filter(K=>K.agentId===s):Z},[c.data,s]),w=x.useMemo(()=>{const Z=f.data??[];return s?Z.filter(K=>K.agentId===s):Z},[f.data,s]),k=b.reduce((Z,K)=>{var ue;return Z+((ue=p.get(K.id))!=null&&ue.connected?1:0)},0),j=b.length-k,C=c.isLoading||f.isLoading,[E,T]=x.useState(null),[O,D]=x.useState(""),[P,z]=x.useState(null),[B,M]=x.useState(null),[V,I]=x.useState(null),[X,se]=x.useState(null),Se=Et({mutationFn:Z=>JG({platform:Z.platform,agentId:Z.agentId,credentials:Z.credentials,status:Z.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),z(null)}}),Y=Et({mutationFn:Z=>{const K={status:Z.status};return Z.credentials&&(K.credentials=Z.credentials),eV(Z.id,K)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),z(null)}}),ee=Et({mutationFn:tV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),H=Et({mutationFn:Z=>KG({platform:Z.platform,externalUserId:Z.externalUserId,agentId:Z.agentId,boundVia:"manual",displayName:Z.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),M(null)}}),re=Et({mutationFn:YG,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function xe(Z){if(s){Z==="bot"?z({agentId:s,editingId:null}):M({agentId:s});return}D(""),T({kind:Z})}function ze(){!E||!O||(E.kind==="bot"?z({agentId:O,editingId:null}):M({agentId:O}),T(null))}function R(Z){if(P){if(Z.kind==="bot-create")Se.mutate({agentId:P.agentId,platform:Z.draft.platform,status:Z.draft.status,credentials:Z.draft.credentials});else if(Z.kind==="bot-update"){if(!P.editingId)return;Y.mutate({id:P.editingId,status:Z.status,credentials:Z.credentials})}}}function L(Z){!B||Z.kind!=="user-create"||H.mutate({agentId:B.agentId,platform:Z.draft.platform,externalUserId:Z.draft.externalUserId,displayName:Z.draft.displayName})}const F=s?g.find(Z=>Z.uuid===s):null;return o.jsxs(o.Fragment,{children:[o.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&&o.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[o.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),o.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,o.jsx("button",{type:"button",onClick:()=>{const Z=new URLSearchParams(n);Z.delete("agent"),a(Z,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:o.jsx(Vs,{className:"h-3 w-3"})})]})]}),o.jsxs(En,{className:"mb-3.5",children:[o.jsxs(zy,{right:o.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[o.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[o.jsx(ec,{state:"idle",size:6})," ",k," online"]}),o.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[o.jsx(ec,{state:"offline",size:6})," ",j," offline"]})]}),o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>xe("bot"),children:[o.jsx(ba,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",b.length]}),C?o.jsx(Cf,{children:"Loading…"}):b.length?o.jsxs(ko,{children:[o.jsx(jo,{children:o.jsxs(ya,{children:[o.jsx(mt,{children:"Agent"}),o.jsx(mt,{children:"Platform"}),o.jsx(mt,{children:"Status"}),o.jsx(mt,{children:"Connection"}),o.jsx(mt,{children:"Created"}),o.jsx(mt,{style:{width:96,textAlign:"right"}})]})}),o.jsx(Eo,{children:b.map(Z=>{var ue;const K=((ue=p.get(Z.id))==null?void 0:ue.connected)??!1;return o.jsxs(ya,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[o.jsx(st,{children:o.jsx("span",{className:"mono font-medium",children:u(Z.agentId)})}),o.jsx(st,{children:o.jsx(ga,{children:Z.platform})}),o.jsx(st,{children:o.jsx(ga,{tone:Z.status==="active"?"accent":"outline",children:Z.status})}),o.jsx(st,{children:o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[o.jsx(ec,{state:K?"idle":"offline",size:7}),o.jsx("span",{style:{color:"var(--fg-3)"},children:K?"Online":"Offline"})]})}),o.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:cc(Z.createdAt)}),o.jsxs(st,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:we=>we.stopPropagation(),children:[o.jsx(pe,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>z({agentId:Z.agentId,editingId:Z.id,initialPlatform:iV(Z.platform),initialStatus:sV(Z.status)}),children:"Edit"}),o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>I(Z.id),disabled:ee.isPending,title:"Delete",children:o.jsx(uc,{className:"h-3.5 w-3.5"})})]})]},Z.id)})})]}):o.jsx(Cf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),o.jsxs(En,{children:[o.jsxs(zy,{right:o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>xe("user"),children:[o.jsx(ba,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),C?o.jsx(Cf,{children:"Loading…"}):w.length?o.jsxs(ko,{children:[o.jsx(jo,{children:o.jsxs(ya,{children:[o.jsx(mt,{children:"Agent"}),o.jsx(mt,{children:"Platform"}),o.jsx(mt,{children:"External user ID"}),o.jsx(mt,{children:"Display name"}),o.jsx(mt,{children:"Bound via"}),o.jsx(mt,{children:"Created"}),o.jsx(mt,{style:{width:32}})]})}),o.jsx(Eo,{children:w.map(Z=>o.jsxs(ya,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[o.jsx(st,{children:o.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:u(Z.agentId)})}),o.jsx(st,{children:o.jsx(ga,{children:Z.platform})}),o.jsx(st,{children:o.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:Z.externalUserId})}),o.jsx(st,{style:{color:"var(--fg-2)"},children:Z.displayName??"—"}),o.jsx(st,{children:o.jsx(ga,{tone:"outline",children:Z.boundVia??"—"})}),o.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:cc(Z.createdAt)}),o.jsx(st,{onClick:K=>K.stopPropagation(),children:o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>se(Z.id),disabled:re.isPending,title:"Delete",children:o.jsx(uc,{className:"h-3.5 w-3.5"})})})]},Z.id))})]}):o.jsx(Cf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),o.jsx(lV,{open:E!=null,kind:(E==null?void 0:E.kind)??"bot",agents:g,agentId:O,onAgentChange:D,onCancel:()=>T(null),onConfirm:ze}),o.jsx(Lk,{open:P!=null,kind:"bot",editingId:(P==null?void 0:P.editingId)??null,initialPlatform:P==null?void 0:P.initialPlatform,initialStatus:P==null?void 0:P.initialStatus,agentLabel:P?u(P.agentId):"",pending:Se.isPending||Y.isPending,errorMessage:(Se.error??Y.error)instanceof Error?(Se.error??Y.error).message:null,onOpenChange:Z=>{Z||(z(null),Se.reset(),Y.reset())},onSubmit:R}),o.jsx(Lk,{open:B!=null,kind:"user",editingId:null,agentLabel:B?u(B.agentId):"",pending:H.isPending,errorMessage:H.error instanceof Error?H.error.message:null,onOpenChange:Z=>{Z||(M(null),H.reset())},onSubmit:L}),o.jsx(Pk,{open:V!=null,onOpenChange:Z=>!Z&&I(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:ee.isPending,onConfirm:()=>{V!=null&&(ee.mutate(V),I(null))}}),o.jsx(Pk,{open:X!=null,onOpenChange:Z=>!Z&&se(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:re.isPending,onConfirm:()=>{X!=null&&(re.mutate(X),se(null))}})]})}function iV(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function sV(e){return e==="inactive"?"inactive":"active"}function Cf({children:e}){return o.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function lV(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 o.jsx(Tn,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),o.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:[o.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>o.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),o.jsxs(ur,{children:[o.jsx(pe,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),o.jsx(pe,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Pk(e){return o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:e.title})}),o.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function oV({embedded:e=!1}={}){return o.jsxs("div",{className:e?"":"-m-6",children:[o.jsx(rl,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),o.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:o.jsx(aV,{})})]})}function uV(){return o.jsx(oV,{embedded:!0})}function cV(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=ot(),s=!!t,u=e==="completed";return o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Onboarding",subtitle:"Guided setup controls"}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(Hc,{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:o.jsx(dV,{}),isFirst:!0,children:s?o.jsx(pe,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):o.jsx(pe,{type:"button",size:"sm",variant:"outline",onClick:()=>void n(),disabled:!u,title:u?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function dV(){return o.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:[o.jsx(wr,{className:"h-3 w-3"}),"Active"]})}function fV(){const{role:e}=ot(),t=e==="admin";return o.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[o.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[o.jsx(Hu,{to:"/settings/team",label:"Team"}),o.jsx(Hu,{to:"/settings/computers",label:"Computers"}),t&&o.jsx(Hu,{to:"/settings/github",label:"GitHub"}),o.jsx(Hu,{to:"/settings/integrations",label:"Messaging"}),o.jsx(Hu,{to:"/settings/onboarding",label:"Onboarding"})]}),o.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:o.jsx(Ff,{})})]})}function Hu({to:e,label:t}){return o.jsx(fv,{to:e,className:({isActive:n})=>Re("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})=>o.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:o.jsx("span",{className:"flex-1 truncate",children:t})})})}function Gy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Wl)}const Mg=200;function hV(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 u=s;t[u]||(t[u]=a.message)}else t._root=a.message}return t}function mV(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Wl)}function pV(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 gV({open:e,onOpenChange:t,onCreated:n}){const a=ln(),{refreshMe:s,organizationId:u}=ot(),[c,f]=x.useState(""),[m,h]=x.useState(""),[g,p]=x.useState(!1),[b,w]=x.useState("claude-code"),[k,j]=x.useState("form"),[C,E]=x.useState([]),[T,O]=x.useState(null),[D,P]=x.useState(!1),[z,B]=x.useState({}),[M,V]=x.useState({status:"idle"});x.useEffect(()=>{e&&(f(""),h(""),p(!1),w("claude-code"),j("form"),E([]),O(null),P(!1),B({}),V({status:"idle"}))},[e]),x.useEffect(()=>{g||h(Gy(c))},[c,g]);const I=x.useRef(0);x.useEffect(()=>{if(!e||!m){V({status:"idle"});return}if(!Ay.test(m)){V({status:"bad",reason:"invalid"});return}if(Ry(m)){V({status:"bad",reason:"reserved"});return}const R=++I.current;V({status:"checking"});const L=window.setTimeout(()=>{jI(m).then(F=>{R===I.current&&(F.available?V({status:"ok"}):V({status:"bad",reason:F.reason}))}).catch(()=>{R===I.current&&V({status:"idle"})})},300);return()=>window.clearTimeout(L)},[m,e]);const X=Et({mutationFn:async R=>{const L=c.trim()||m.trim()||"Untitled assistant";return kI({name:m||void 0,type:"personal_assistant",displayName:L,clientId:R.clientId,runtimeProvider:b,...u?{organizationId:u}:{}})},onSuccess:R=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(R,b)}}),se=x.useMemo(()=>{const R=X.error;if(!R)return{};if(R instanceof zc){const L=hV(R.issues);return Object.keys(L).length>0?L:R.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:R.message}}return R instanceof Error?{_root:R.message}:{}},[X.error]),Se=M.status==="bad"?pV(M.reason):void 0,Y={...Se?{name:Se}:{},...se,...z};function ee(){const R={};return m?m.length>Wl?R.name=`Agent name must be at most ${Wl} characters (got ${m.length}).`:Ay.test(m)?Ry(m)&&(R.name="That agent name is reserved — pick a different one."):R.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(R.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Mg&&(R.displayName=`Display name must be at most ${Mg} characters (got ${c.length}).`),R}async function H(R){var F,_;R.preventDefault();const L=ee();if(B(L),!(Object.keys(L).length>0)&&M.status!=="bad"){P(!0);try{const K=(await ss()).filter(we=>we.status==="connected");if(K.length===0){X.mutate({clientId:void 0});return}if(K.length===1){X.mutate({clientId:(F=K[0])==null?void 0:F.id});return}const ue=[...K].sort((we,ve)=>ve.lastSeenAt.localeCompare(we.lastSeenAt));E(ue),O(((_=ue[0])==null?void 0:_.id)??null),j("pick-computer")}catch{X.mutate({clientId:void 0})}finally{P(!1)}}}function re(){T&&X.mutate({clientId:T})}const xe=M.status==="bad",ze=c.trim().length>0&&!xe&&!X.isPending&&!D;return k==="pick-computer"?o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(In,{children:o.jsx(An,{children:"Choose a computer"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-body text-muted-foreground",children:["Multiple computers are online. Pick where ",o.jsx("span",{className:"font-medium",children:c||m})," ","should run:"]}),o.jsx("div",{className:"space-y-2",children:C.map(R=>{const L=T===R.id;return o.jsxs("label",{className:L?"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:[o.jsx("input",{type:"radio",name:"target-computer",checked:L,onChange:()=>O(R.id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body font-medium truncate",children:R.hostname??R.id}),o.jsxs("div",{className:"text-caption text-muted-foreground",children:[R.os??"unknown OS"," · last seen ",new Date(R.lastSeenAt).toLocaleString()]})]})]},R.id)})}),Y.clientId&&o.jsx("p",{className:"text-body text-destructive",children:Y.clientId}),Y._root&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Y._root})]}),o.jsxs(ur,{children:[o.jsx(pe,{variant:"outline",onClick:()=>j("form"),disabled:X.isPending,children:"Back"}),o.jsx(pe,{onClick:re,disabled:!T||X.isPending,children:X.isPending?"Creating…":"Create"})]})]})}):o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(In,{children:o.jsx(An,{children:"New Agent"})}),o.jsxs("form",{onSubmit:H,className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"new-agent-display-name",children:"Display name"}),o.jsx($t,{id:"new-agent-display-name",value:c,onChange:R=>{f(R.target.value),z.displayName&&B(L=>({...L,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Mg,"aria-invalid":Y.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),o.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."}),Y.displayName&&o.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:Y.displayName})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"new-agent-name",children:"Agent name"}),o.jsxs("div",{className:"flex items-stretch",children:[o.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:"@"}),o.jsx($t,{id:"new-agent-name",value:m,onChange:R=>{const L=mV(R.target.value);h(L),p(!0),z.name&&B(F=>({...F,name:void 0}))},onBlur:R=>{const L=Gy(R.target.value);L!==m&&h(L)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Wl,"aria-invalid":Y.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),o.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",Wl," characters. Permanent after creation."]}),m&&!Y.name&&M.status!=="idle"&&o.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:M.status==="ok"?"var(--state-idle)":M.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[M.status==="checking"&&"Checking availability…",M.status==="ok"&&"Available."]}),Y.name&&o.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:Y.name})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Where it runs"}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:b==="claude-code"?"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:[o.jsx("input",{type:"radio",name:"runtime",checked:b==="claude-code",onChange:()=>w("claude-code"),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:"Claude Code"}),o.jsx("div",{className:"text-caption text-muted-foreground",children:"Anthropic's Claude Code on the bound computer. (default)"})]})]}),o.jsxs("label",{className:b==="codex"?"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:[o.jsx("input",{type:"radio",name:"runtime",checked:b==="codex",onChange:()=>w("codex"),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:"Codex"}),o.jsxs("div",{className:"text-caption text-muted-foreground",children:["OpenAI Codex CLI on the bound computer. Run ",o.jsx("code",{children:"codex login"})," on the host once."]})]})]})]})]}),Y._root&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Y._root}),o.jsx(ur,{children:o.jsx(pe,{type:"submit",disabled:!ze,children:D?"Checking computers…":X.isPending?"Creating…":"Create"})})]})]})})}function W_({children:e,count:t,right:n}){return o.jsxs("div",{className:"flex items-baseline justify-between",style:{padding:"var(--sp-1) var(--sp-1) var(--sp-2)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("h2",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t!==void 0&&o.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:t})]}),n]})}function yV(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 vV(){const{organizationId:e}=ot(),[t,n]=x.useState(null),[a,s]=x.useState(null),[u,c]=x.useState(!1),[f,m]=x.useState(!1);x.useEffect(()=>{e&&(async()=>{try{const g=await Ee.get(my(e,"/invitations"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const g=await Ee.post(my(e,"/invitations/rotate"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to rotate invite link")}finally{c(!1)}}};return o.jsxs(Do,{children:[o.jsxs(Mo,{children:[o.jsx(qc,{children:"Invite link"}),o.jsxs(Q_,{children:["Anyone with this link can join your team as a member. Links expire after ",P6," days; rotating revokes the old link instantly and resets the timer."]})]}),o.jsxs(Io,{className:"space-y-3",children:[a&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),o.jsx(pe,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),o.jsx(pe,{size:"sm",onClick:h,disabled:u,children:u?"Rotating…":"Rotate"})]}),o.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${yV(t.expiresAt)}`:" · no expiry"]})]}):o.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const bV=Object.values(H6);function xV(){const e=ln(),{memberId:t,role:n}=ot(),a=n==="admin",[s,u]=x.useState(null),{data:c,isLoading:f,error:m}=Qe({queryKey:["members"],queryFn:Yv}),h=Et({mutationFn:XB,onSuccess:()=>e.invalidateQueries({queryKey:["members"]})});function g(p){window.confirm("Delete this member? Their human agent will also be deactivated.")&&h.mutate(p)}return o.jsxs(o.Fragment,{children:[o.jsx("section",{children:f?o.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):m?o.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load members: ",m instanceof Error?m.message:"Unknown error"]}):(c==null?void 0:c.length)===0?o.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:a?"No members yet — share the Invite link to add teammates.":"No members yet."}):o.jsxs(ko,{className:"table-fixed",children:[o.jsx(jo,{children:o.jsxs(ya,{children:[o.jsx(mt,{style:{width:160},children:"Display name"}),o.jsx(mt,{style:{width:140},children:"Username"}),o.jsx(mt,{style:{width:120},children:"Role"}),o.jsx(mt,{style:{width:150},children:"Created"}),o.jsx(mt,{"aria-hidden":!0}),a&&o.jsx(mt,{style:{width:80,textAlign:"right"}})]})}),o.jsx(Eo,{children:c==null?void 0:c.map(p=>{const b=t===p.id;return o.jsxs(ya,{children:[o.jsxs(st,{children:[o.jsx("span",{className:"font-medium",children:p.displayName}),b&&o.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),o.jsx(st,{children:o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",p.username]})}),o.jsx(st,{className:"text-label",style:{color:"var(--fg-3)"},children:p.role==="admin"?"Admin":"Member"}),o.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:TE(p.createdAt)}),o.jsx(st,{"aria-hidden":!0}),a&&o.jsx(st,{style:{whiteSpace:"nowrap"},children:o.jsxs("div",{className:"flex gap-0.5 justify-end",children:[o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>u({id:p.id,username:p.username,displayName:p.displayName,role:p.role}),title:"Edit",children:o.jsx(dh,{className:"h-3.5 w-3.5"})}),!b&&o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(p.id),disabled:h.isPending,title:"Delete",style:{color:"var(--fg-4)"},children:o.jsx(uc,{className:"h-3.5 w-3.5"})})]})})]},p.id)})})]})}),o.jsx(wV,{target:s,onClose:()=>u(null),onSaved:()=>{u(null),e.invalidateQueries({queryKey:["members"]})}})]})}function wV({target:e,onClose:t,onSaved:n}){const[a,s]=x.useState(""),[u,c]=x.useState("member"),[f,m]=x.useState(null);x.useEffect(()=>{e&&(s(e.displayName),c(e.role),m(null))},[e]);const h=Et({mutationFn:async()=>{if(!e)throw new Error("No target");const b={};return a.trim()&&a!==e.displayName&&(b.displayName=a.trim()),u!==e.role&&(b.role=u),Object.keys(b).length===0?e:YB(e.id,b)},onSuccess:()=>{m(null),n()},onError:b=>{m(b instanceof Error?b.message:String(b))}});function g(b){b.preventDefault(),h.mutate()}const p=e!==null;return o.jsx(Tn,{open:p,onOpenChange:b=>b?void 0:t(),children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:"Edit Member"})}),e&&o.jsxs("form",{onSubmit:g,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Username"}),o.jsx($t,{value:e.username,disabled:!0,className:"font-mono"}),o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"edit-member-display",children:"Display Name"}),o.jsx($t,{id:"edit-member-display",value:a,onChange:b=>s(b.target.value),required:!0,maxLength:200})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"edit-member-role",children:"Role"}),o.jsx("select",{id:"edit-member-role",value:u,onChange:b=>c(b.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:bV.map(b=>o.jsx("option",{value:b,children:b},b))}),o.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."})]}),f&&o.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),o.jsxs(ur,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:t,disabled:h.isPending,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:h.isPending,children:h.isPending?"Saving…":"Save"})]})]})]})})}function SV(){var m;const{role:e}=ot(),t=e==="admin",[n,a]=x.useState(!1),{data:s}=Qe({queryKey:["members"],queryFn:Yv}),u=Qe({queryKey:["agents","team-page"],queryFn:()=>Ic({limit:100})}),c=(s==null?void 0:s.length)??0,f=(((m=u.data)==null?void 0:m.items)??[]).filter(h=>h.type!=="human").length;return o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Team",subtitle:`${c} ${c===1?"human":"humans"} and ${f} ${f===1?"agent":"agents"} working together`,right:t&&o.jsxs(pe,{size:"xs",variant:"ghost",onClick:()=>a(!0),children:[o.jsx(fE,{className:"h-3 w-3"}),"Invite link"]})}),o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-5)"},children:[o.jsx(kV,{}),o.jsx(jV,{data:u.data,isLoading:u.isLoading,error:u.error})]}),o.jsx(Tn,{open:n,onOpenChange:a,children:o.jsxs(jn,{children:[o.jsx(In,{children:o.jsx(An,{children:"Invite link"})}),o.jsx(vV,{})]})})]})}function kV(){return o.jsxs("section",{children:[o.jsx(W_,{children:"Humans"}),o.jsx(xV,{})]})}function jV({data:e,isLoading:t,error:n}){const a=Rn(),s=ln(),u=ON(),{memberId:c}=ot(),[f,m]=x.useState(!1),{data:h}=Qe({queryKey:["activity"],queryFn:Dc,refetchInterval:1e4}),g=x.useMemo(()=>{const w=new Map;for(const k of(h==null?void 0:h.agents)??[])w.set(k.agentId,k);return w},[h==null?void 0:h.agents]),p=x.useMemo(()=>{const w=((e==null?void 0:e.items)??[]).filter(C=>C.type!=="human");if(!c)return w;const k=[],j=[];for(const C of w)(C.managerId===c?k:j).push(C);return[...k,...j]},[e==null?void 0:e.items,c]);function b(w,k){m(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}return o.jsxs(o.Fragment,{children:[o.jsxs("section",{children:[o.jsx(W_,{right:o.jsxs(pe,{size:"xs",variant:"ghost",className:"normal-case tracking-normal",onClick:()=>m(!0),children:[o.jsx(ba,{className:"h-3 w-3"}),"New agent"]}),children:"Agents"}),t?o.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n?o.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load agents: ",n instanceof Error?n.message:"Unknown error"]}):p.length===0?o.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No agents yet — create one with “New agent”."}):o.jsxs(ko,{className:"table-fixed",children:[o.jsx(jo,{children:o.jsxs(ya,{children:[o.jsx(mt,{style:{width:160},children:"Display name"}),o.jsx(mt,{style:{width:140},children:"Agent name"}),o.jsx(mt,{style:{width:150},children:"Type"}),o.jsx(mt,{style:{width:160},children:"Managed by"}),o.jsx(mt,{style:{width:100},children:"Visibility"}),o.jsx(mt,{style:{width:110},children:"Status"}),o.jsx(mt,{style:{width:150},children:"Created"})]})}),o.jsx(Eo,{children:p.map(w=>{const k=g.get(w.uuid);return o.jsxs(ya,{interactive:!0,onClick:()=>a(`/agents/${encodeURIComponent(w.uuid)}`),children:[o.jsx(st,{children:o.jsx("span",{className:"font-medium",children:w.displayName})}),o.jsx(st,{children:w.name?o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",w.name]}):o.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:"—"})}),o.jsx(st,{className:"text-label",style:{color:"var(--fg-3)"},children:EV(w.type)}),o.jsxs(st,{className:"text-label",style:{color:"var(--fg-2)"},children:[w.managerId?u(w.managerId):"—",w.managerId&&w.managerId===c&&o.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),o.jsx(st,{className:"text-label",style:{color:"var(--fg-3)"},children:CV(w.visibility)}),o.jsx(st,{children:o.jsx(yc,{state:(k==null?void 0:k.runtimeState)??null})}),o.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:TE(w.createdAt)})]},w.uuid)})})]})]}),o.jsx(gV,{open:f,onOpenChange:m,onCreated:b})]})}function EV(e){return e==="autonomous_agent"?"Autonomous agent":e==="personal_assistant"?"Personal assistant":e}function CV(e){return e==="organization"?"Shared":e==="private"?"Private":e}function NV({isFirst:e=!1}){const{organizationId:t}=ot(),n=ln(),a=Qe({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?gb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,u]=x.useState(""),[c,f]=x.useState(""),[m,h]=x.useState(!1);x.useEffect(()=>{a.data&&(u(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const g=Et({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return K_(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:b=>{n.setQueryData(["org-setting",t,"context_tree"],b),h(!0),setTimeout(()=>h(!1),2e3)}}),p=b=>{b.preventDefault(),g.mutate()};return o.jsx(Hc,{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?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):o.jsxs("form",{onSubmit:p,children:[o.jsx(xc,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:u,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),o.jsx(xc,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:o.jsx(yb,{pending:g.isPending,disabled:!a.data})}),g.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:g.error.message})]})})}function _V({isFirst:e=!1}){var h;const{organizationId:t,role:n}=ot(),a=n==="admin",s=ln(),u=Qe({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?Y_(t):Promise.reject(new Error("no org")),enabled:!!t}),c=Et({mutationFn:async g=>{var w;if(!t)throw new Error("organization not loaded");const b=(((w=u.data)==null?void 0:w.repos)??[]).filter(k=>k.url!==g);return X_(t,{repos:b})},onSuccess:g=>{s.setQueryData(["org-setting",t,"source_repos"],g)}}),f=((h=u.data)==null?void 0:h.repos)??[],m=f.length>0?o.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return o.jsxs(Hc,{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:[u.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):u.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:u.error instanceof Error?u.error.message:"Failed to load setting"}):f.length===0?o.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."}):o.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(g=>o.jsx(TV,{url:g.url,defaultBranch:g.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(g.url)},g.url))}),c.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function TV({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return o.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:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&o.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&o.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:u=>{u.currentTarget.style.background="var(--surface-2)",u.currentTarget.style.color="var(--fg)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent",u.currentTarget.style.color="var(--fg-3)"},children:o.jsx(Vs,{className:"h-3.5 w-3.5"})})]})}function AV(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function RV(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function OV({isFirst:e=!1}){const{organizationId:t}=ot(),n=ln(),a=Qe({queryKey:["organization",t],queryFn:()=>t?AV(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,u]=x.useState(""),[c,f]=x.useState(!1);x.useEffect(()=>{a.data&&u(a.data.displayName)},[a.data]);const m=Et({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const g=s.trim();return!g||g===a.data.displayName?Promise.resolve(a.data):RV(t,{displayName:g})},onSuccess:g=>{n.setQueryData(["organization",t],g),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=g=>{g.preventDefault(),m.mutate()};return o.jsx(Hc,{title:"Identity",isFirst:e,children:a.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):o.jsxs("form",{onSubmit:h,children:[o.jsx(xc,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:u,saved:c,rightSlot:o.jsx(yb,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function zV(){const{role:e}=ot(),t=e==="admin";return o.jsxs("div",{children:[t&&o.jsx(OV,{isFirst:!0}),t&&o.jsx(NV,{}),o.jsx(_V,{isFirst:!t})]})}function DV(){const{role:e}=ot();if(e===null)return o.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 o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Team settings",subtitle:t}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(zV,{})})]})}function nh(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter);const n=t.toString();return Ee.get(Ln(`/chats${n?`?${n}`:""}`))}function MV(e){return Ee.post(Ln("/chats"),e)}function IV(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function J_(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function LV(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}function PV({active:e,count:t,warn:n,className:a,children:s,style:u,...c}){return o.jsxs("button",{type:"button",className:Re("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",...u},...c,children:[s,t!==void 0&&o.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}const rh="draft";function UV(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),u=c=>{var f;return((f=s.find(m=>m.type===c))==null?void 0:f.value)??""};return`${u("month")}/${u("day")} ${u("hour")}:${u("minute")}`}function BV(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function FV({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=x.useState("all"),[u,c]=x.useState(""),[f,m]=x.useState([]),[h,g]=x.useState(!1),[p,b]=x.useState(null),{data:w,isLoading:k}=Qe({queryKey:["me","chats",a],queryFn:()=>nh({filter:a}),refetchInterval:15e3}),j=()=>{f.length>0&&m([]),b(null)},C=(w==null?void 0:w.rows)??[],E=x.useMemo(()=>[...C,...f],[C,f]),T=x.useMemo(()=>{const M=u.trim().toLowerCase();return M?E.filter(V=>V.title.toLowerCase().includes(M)||(V.lastMessagePreview??"").toLowerCase().includes(M)?!0:V.participants.map(Se=>Se.displayName.toLowerCase()).join(" ").includes(M)):E},[E,u]),O=async()=>{if(h)return;const M=w==null?void 0:w.nextCursor;if(M){g(!0),b(null);try{const V=await nh({filter:a,cursor:M});m(I=>[...I,...V.rows]),P(V.nextCursor)}catch(V){b(V instanceof Error?V.message:"Failed to load more")}finally{g(!1)}}},[D,P]=x.useState(null),z=(w==null?void 0:w.nextCursor)??null;x.useEffect(()=>{P(z)},[z]);const B=x.useMemo(()=>E.reduce((M,V)=>M+(V.unreadMentionCount>0?1:0),0),[E]);return o.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[o.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:[o.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===rh?"var(--bg-active)":"transparent",color:e===rh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[o.jsx(ba,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),o.jsxs("div",{className:"flex items-center",style:{gap:8},children:[o.jsx("div",{className:"flex gap-1 shrink-0",children:B>0&&o.jsx(PV,{active:a==="unread",count:B,onClick:()=>{s(a==="unread"?"all":"unread"),j()},children:"unread"})}),o.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[o.jsx(bv,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),o.jsx("input",{value:u,onChange:M=>c(M.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)"}})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[k&&T.length===0&&o.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!k&&T.length===0&&o.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:u?"No matches":o.jsxs(o.Fragment,{children:[o.jsx("p",{style:{margin:0},children:"No conversations yet."}),o.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),T.map(M=>{const V=e===M.chatId,I=BV(M),X=I&&I!==M.title?I:"",se=M.unreadMentionCount>0;return o.jsx("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:o.jsxs("button",{type:"button",onClick:()=>t(M.chatId),className:Re("w-full text-left transition-colors flex flex-col","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",background:V?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${V?"var(--accent)":"transparent"}`},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[se&&o.jsx("span",{"aria-label":`${M.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),o.jsx("span",{className:"truncate text-subtitle",style:{color:se?"var(--fg)":"var(--fg-2)",fontWeight:se?700:500,flex:1,minWidth:0},children:M.title}),M.lastMessageAt&&o.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:UV(M.lastMessageAt)})]}),o.jsx("div",{className:"truncate text-body",style:{color:se?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:X||"—"})]})},M.chatId)}),D&&T.length>0&&o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[o.jsx("button",{type:"button",onClick:O,disabled:h,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:h?"default":"pointer",opacity:h?.6:1},children:h?"Loading…":"Load more"}),p&&o.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:p})]})]})]})}function eT(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function $V(e,t){return Ee.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function Co(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function qV(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function HV(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 u=s.indexOf(",");t(u>=0?s.slice(u+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function vb(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function ZV(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Ee.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}function bb(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 GV(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function xb({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium",children:e.displayName??n}),GV(e,t)&&o.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function VV(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 QV(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(),u=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:u.startsWith(t)?c=1:u.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 KV(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),u=e.slice(n),c=`@${a.name}`,f=u.length===0||!/\s/.test(u[0]??""),m=f?` ${u}`:u,h=`${s}${c}${m}`,g=s.length+c.length+(f?1:0);return{text:h,cursor:g}}function tT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[u,c]=x.useState(0),[f,m]=x.useState(null),h=x.useMemo(()=>s?null:VV(e,t),[e,t,s]),g=x.useMemo(()=>h?QV(n,h.query):[],[h,n]),p=h?`${h.triggerIndex}:${h.query}`:"";x.useEffect(()=>{c(0)},[p]),x.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const b=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&g.length>0&&!b;function k(){m((h==null?void 0:h.triggerIndex)??null)}function j(E){if(!h)return;const T=KV(e,h,t,E);T&&a(T)}return{trigger:w?h:null,results:w?g:[],highlightIndex:u,handleKey:E=>{if(!w||!h)return!1;if(E.key==="ArrowDown")return E.preventDefault(),c(T=>g.length===0?0:(T+1)%g.length),!0;if(E.key==="ArrowUp")return E.preventDefault(),c(T=>g.length===0?0:(T-1+g.length)%g.length),!0;if(E.key==="Enter"||E.key==="Tab"){const T=g[u]??g[0];return T?(E.preventDefault(),j(T),!0):!1}return E.key==="Escape"?(E.preventDefault(),k(),!0):!1},pick:j,dismiss:k}}function nT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const u=x.useRef(null);return x.useEffect(()=>{var m;const f=(m=u.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:o.jsx("div",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:Re("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=bb(t);return t.map((m,h)=>{const g=h===n;return o.jsx("button",{type:"button",role:"option","aria-selected":g,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:p=>{p.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:g?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:o.jsx(xb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function YV({onCreated:e}){const t=ln(),{agentId:n}=ot(),a=Av(),[s,u]=x.useState([]),[c,f]=x.useState(""),[m,h]=x.useState(0),[g,p]=x.useState(null),[b,w]=x.useState(!1),[k,j]=x.useState(!1),C=x.useRef(null),E=x.useRef(!1),T=x.useRef(null),{data:O}=Qe({queryKey:["activity"],queryFn:Dc,refetchInterval:15e3}),D=x.useMemo(()=>{const Y=(O==null?void 0:O.agents)??[],ee=[];for(const H of Y){if(n&&H.agentId===n)continue;const re=a(H.agentId);!re||!re.name||ee.push({agentId:H.agentId,name:re.name,displayName:re.displayName})}return ee},[O,a,n]);x.useEffect(()=>{if(E.current||s.length>0||D.length===0)return;const Y=WV(D,(O==null?void 0:O.agents)??[]);Y&&(u([Y]),E.current=!0)},[D,O,s.length]);const P=x.useMemo(()=>{const Y=D.map(ee=>({agentId:ee.agentId,name:ee.name}));return sN(c,Y)},[c,D]),z=tT({value:c,cursor:m,candidates:D,disabled:b,onSelect:Y=>{f(Y.text),h(Y.cursor),requestAnimationFrame(()=>{const ee=C.current;ee&&(ee.focus(),ee.setSelectionRange(Y.cursor,Y.cursor))})}});x.useEffect(()=>{P.length!==0&&u(Y=>{const ee=new Set(Y);let H=!1;for(const re of P)ee.has(re)||(ee.add(re),H=!0);return H?[...ee]:Y})},[P]),x.useEffect(()=>{if(!k)return;const Y=ee=>{T.current&&(T.current.contains(ee.target)||j(!1))};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[k]);const B=Et({mutationFn:async({participantIds:Y,text:ee})=>{const H=await MV({participantIds:Y}),re=ee.trim();return re.length>0&&await Co(H.chatId,re),H.chatId},onSuccess:Y=>{f(""),u([]),E.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(Y)},onError:Y=>{p(Y instanceof Error?Y.message:"Failed to create chat")}}),M=x.useMemo(()=>!(b||B.isPending||s.length===0||c.trim().length===0||s.length>=2&&P.length===0),[b,B.isPending,s.length,c,P.length]),V=x.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&P.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,P.length]),I=async()=>{if(!M)return;const Y=Array.from(new Set([...s,...P]));p(null),w(!0);try{await B.mutateAsync({participantIds:Y,text:c})}finally{w(!1)}},X=Y=>{u(ee=>ee.filter(H=>H!==Y))},se=Y=>{u(ee=>ee.includes(Y)?ee:[...ee,Y]),j(!1)},Se=x.useMemo(()=>D.filter(Y=>!s.includes(Y.agentId)),[D,s]);return o.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:o.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[o.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),o.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[o.jsx(XV,{chips:s,candidates:D,chipCandidates:Se,pickerOpen:k,setPickerOpen:j,pickerContainerRef:T,onAdd:se,onRemove:X}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(nT,{trigger:z.trigger,results:z.results,highlightIndex:z.highlightIndex,anchorRef:C,onPick:z.pick}),o.jsx("textarea",{ref:C,value:c,onChange:Y=>{f(Y.target.value),h(Y.target.selectionStart??Y.target.value.length)},onSelect:Y=>{h(Y.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:Y=>{z.handleKey(Y)||Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),I())},disabled:b||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&&P.length===0&&c.trim().length>0&&o.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,o.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),o.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:o.jsx("button",{type:"button",onClick:()=>void I(),disabled:!M,title:V??"Send (Enter)","aria-label":"Send",className:Re("inline-flex items-center justify-center transition-opacity",!M&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:o.jsx(sE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),g&&o.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:g})]})})})}function XV({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:u,onAdd:c,onRemove:f}){return o.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(p=>p.agentId===m),g=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return o.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:[o.jsx("span",{children:g}),o.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:o.jsx(Vs,{className:"h-3 w-3"})})]},m)}),o.jsxs("div",{ref:u,style:{position:"relative"},children:[o.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:o.jsx(ba,{className:"h-3 w-3"})}),a&&n.length>0&&o.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=bb(n);return n.map(h=>o.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:o.jsx(xb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function WV(e,t){var u;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:((u=e[0])==null?void 0:u.agentId)??null}const JV="first-tree-hub-images",eQ=1,No="images";let Nf=null;function rT(){return Nf||(Nf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(JV,eQ);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(No)||n.createObjectStore(No,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Nf)}async function tQ(e){const t=await rT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(No,"readwrite"),u=s.objectStore(No),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};u.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 nQ(e){const t=await rT();return t?new Promise(n=>{const u=t.transaction(No,"readonly").objectStore(No).get(e);u.onsuccess=()=>{const c=u.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},u.onerror=()=>n(null)}):null}function rQ(e,t,n){return Ee.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:aT,setPrototypeOf:Uk,isFrozen:aQ,getPrototypeOf:iQ,getOwnPropertyDescriptor:sQ}=Object;let{freeze:cr,seal:ra,create:Ql}=Object,{apply:Vy,construct:Qy}=typeof Reflect<"u"&&Reflect;cr||(cr=function(t){return t});ra||(ra=function(t){return t});Vy||(Vy=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];return t.apply(n,s)});Qy||(Qy=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 Zu=Cn(Array.prototype.forEach),lQ=Cn(Array.prototype.lastIndexOf),Bk=Cn(Array.prototype.pop),Gu=Cn(Array.prototype.push),oQ=Cn(Array.prototype.splice),ir=Array.isArray,Wu=Cn(String.prototype.toLowerCase),Ig=Cn(String.prototype.toString),Fk=Cn(String.prototype.match),Hl=Cn(String.prototype.replace),$k=Cn(String.prototype.indexOf),uQ=Cn(String.prototype.trim),cQ=Cn(Number.prototype.toString),dQ=Cn(Boolean.prototype.toString),qk=typeof BigInt>"u"?null:Cn(BigInt.prototype.toString),Hk=typeof Symbol>"u"?null:Cn(Symbol.prototype.toString),rn=Cn(Object.prototype.hasOwnProperty),Vu=Cn(Object.prototype.toString),qn=Cn(RegExp.prototype.test),_f=fQ(TypeError);function Cn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return Vy(e,t,a)}}function fQ(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Qy(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wu;if(Uk&&Uk(e,null),!ir(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const u=n(s);u!==s&&(aQ(t)||(t[a]=u),s=u)}e[s]=!0}return e}function hQ(e){for(let t=0;t<e.length;t++)rn(e,t)||(e[t]=null);return e}function vr(e){const t=Ql(null);for(const[n,a]of aT(e))rn(e,n)&&(ir(a)?t[n]=hQ(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=vr(a):t[n]=a);return t}function mQ(e){switch(typeof e){case"string":return e;case"number":return cQ(e);case"boolean":return dQ(e);case"bigint":return qk?qk(e):"0";case"symbol":return Hk?Hk(e):"Symbol()";case"undefined":return Vu(e);case"function":case"object":{if(e===null)return Vu(e);const t=e,n=Kl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Vu(a)}return Vu(e)}default:return Vu(e)}}function Kl(e,t){for(;e!==null;){const a=sQ(e,t);if(a){if(a.get)return Cn(a.get);if(typeof a.value=="function")return Cn(a.value)}e=iQ(e)}function n(){return null}return n}function pQ(e){try{return qn(e,""),!0}catch{return!1}}const Zk=cr(["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"]),Lg=cr(["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"]),Pg=cr(["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"]),gQ=cr(["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"]),Ug=cr(["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"]),yQ=cr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gk=cr(["#text"]),Vk=cr(["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"]),Bg=cr(["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"]),Qk=cr(["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"]),Tf=cr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),vQ=ra(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bQ=ra(/<%[\w\W]*|[\w\W]*%>/gm),xQ=ra(/\$\{[\w\W]*/gm),wQ=ra(/^data-[\-\w.\u00B7-\uFFFF]+$/),SQ=ra(/^aria-[\-\w]+$/),iT=ra(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kQ=ra(/^(?:\w+script|data):/i),jQ=ra(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sT=ra(/^html$/i),EQ=ra(/^[a-z][.\w]*(-[.\w]+)+$/i);var Kk=Object.freeze({__proto__:null,ARIA_ATTR:SQ,ATTR_WHITESPACE:jQ,CUSTOM_ELEMENT:EQ,DATA_ATTR:wQ,DOCTYPE_NAME:sT,ERB_EXPR:bQ,IS_ALLOWED_URI:iT,IS_SCRIPT_OR_DATA:kQ,MUSTACHE_EXPR:vQ,TMPLIT_EXPR:xQ});const Qu={element:1,text:3,progressingInstruction:7,comment:8,document:9},CQ=function(){return typeof window>"u"?null:window},NQ=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 u="dompurify"+(a?"#"+a:"");try{return t.createPolicy(u,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},Yk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:CQ();const t=Ie=>lT(Ie);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Qu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:u,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:h,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:b,trustedTypes:w}=e,k=m.prototype,j=Kl(k,"cloneNode"),C=Kl(k,"remove"),E=Kl(k,"nextSibling"),T=Kl(k,"childNodes"),O=Kl(k,"parentNode");if(typeof c=="function"){const Ie=n.createElement("template");Ie.content&&Ie.content.ownerDocument&&(n=Ie.content.ownerDocument)}let D,P="";const{implementation:z,createNodeIterator:B,createDocumentFragment:M,getElementsByTagName:V}=n,{importNode:I}=a;let X=Yk();t.isSupported=typeof aT=="function"&&typeof O=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:se,ERB_EXPR:Se,TMPLIT_EXPR:Y,DATA_ATTR:ee,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:re,ATTR_WHITESPACE:xe,CUSTOM_ELEMENT:ze}=Kk;let{IS_ALLOWED_URI:R}=Kk,L=null;const F=We({},[...Zk,...Lg,...Pg,...Ug,...Gk]);let _=null;const Z=We({},[...Vk,...Bg,...Qk,...Tf]);let K=Object.seal(Ql(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ue=null,we=null;const ve=Object.seal(Ql(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let me=!0,Ge=!0,Be=!1,bt=!0,yt=!1,ae=!0,je=!1,Me=!1,Ye=!1,mn=!1,en=!1,Cr=!1,Br=!0,hi=!1;const mi="user-content-";let on=!0,oa=!1,le={},ge=null;const Ue=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 Ze=null;const nt=We({},["audio","video","img","source","image","track"]);let un=null;const er=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let rt=At,tr=!1,On=null;const al=We({},[qt,Lt,At],Ig);let ua=We({},["mi","mo","mn","ms","mtext"]),ca=We({},["annotation-xml"]);const za=We({},["title","style","font","a","script"]);let Zn=null;const Da=["application/xhtml+xml","text/html"],wa="text/html";let Ht=null,ke=null;const et=n.createElement("form"),pn=function($){return $ instanceof RegExp||$ instanceof Function},Nr=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ke&&ke===$)return;(!$||typeof $!="object")&&($={}),$=vr($),Zn=Da.indexOf($.PARSER_MEDIA_TYPE)===-1?wa:$.PARSER_MEDIA_TYPE,Ht=Zn==="application/xhtml+xml"?Ig:Wu,L=rn($,"ALLOWED_TAGS")&&ir($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,Ht):F,_=rn($,"ALLOWED_ATTR")&&ir($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,Ht):Z,On=rn($,"ALLOWED_NAMESPACES")&&ir($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Ig):al,un=rn($,"ADD_URI_SAFE_ATTR")&&ir($.ADD_URI_SAFE_ATTR)?We(vr(er),$.ADD_URI_SAFE_ATTR,Ht):er,Ze=rn($,"ADD_DATA_URI_TAGS")&&ir($.ADD_DATA_URI_TAGS)?We(vr(nt),$.ADD_DATA_URI_TAGS,Ht):nt,ge=rn($,"FORBID_CONTENTS")&&ir($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,Ht):Ue,ue=rn($,"FORBID_TAGS")&&ir($.FORBID_TAGS)?We({},$.FORBID_TAGS,Ht):vr({}),we=rn($,"FORBID_ATTR")&&ir($.FORBID_ATTR)?We({},$.FORBID_ATTR,Ht):vr({}),le=rn($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?vr($.USE_PROFILES):$.USE_PROFILES:!1,me=$.ALLOW_ARIA_ATTR!==!1,Ge=$.ALLOW_DATA_ATTR!==!1,Be=$.ALLOW_UNKNOWN_PROTOCOLS||!1,bt=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=$.SAFE_FOR_TEMPLATES||!1,ae=$.SAFE_FOR_XML!==!1,je=$.WHOLE_DOCUMENT||!1,mn=$.RETURN_DOM||!1,en=$.RETURN_DOM_FRAGMENT||!1,Cr=$.RETURN_TRUSTED_TYPE||!1,Ye=$.FORCE_BODY||!1,Br=$.SANITIZE_DOM!==!1,hi=$.SANITIZE_NAMED_PROPS||!1,on=$.KEEP_CONTENT!==!1,oa=$.IN_PLACE||!1,R=pQ($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:iT,rt=typeof $.NAMESPACE=="string"?$.NAMESPACE:At,ua=rn($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?vr($.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),ca=rn($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?vr($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const he=rn($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?vr($.CUSTOM_ELEMENT_HANDLING):Ql(null);if(K=Ql(null),rn(he,"tagNameCheck")&&pn(he.tagNameCheck)&&(K.tagNameCheck=he.tagNameCheck),rn(he,"attributeNameCheck")&&pn(he.attributeNameCheck)&&(K.attributeNameCheck=he.attributeNameCheck),rn(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),yt&&(Ge=!1),en&&(mn=!0),le&&(L=We({},Gk),_=Ql(null),le.html===!0&&(We(L,Zk),We(_,Vk)),le.svg===!0&&(We(L,Lg),We(_,Bg),We(_,Tf)),le.svgFilters===!0&&(We(L,Pg),We(_,Bg),We(_,Tf)),le.mathMl===!0&&(We(L,Ug),We(_,Qk),We(_,Tf))),ve.tagCheck=null,ve.attributeCheck=null,rn($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?ve.tagCheck=$.ADD_TAGS:ir($.ADD_TAGS)&&(L===F&&(L=vr(L)),We(L,$.ADD_TAGS,Ht))),rn($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?ve.attributeCheck=$.ADD_ATTR:ir($.ADD_ATTR)&&(_===Z&&(_=vr(_)),We(_,$.ADD_ATTR,Ht))),rn($,"ADD_URI_SAFE_ATTR")&&ir($.ADD_URI_SAFE_ATTR)&&We(un,$.ADD_URI_SAFE_ATTR,Ht),rn($,"FORBID_CONTENTS")&&ir($.FORBID_CONTENTS)&&(ge===Ue&&(ge=vr(ge)),We(ge,$.FORBID_CONTENTS,Ht)),rn($,"ADD_FORBID_CONTENTS")&&ir($.ADD_FORBID_CONTENTS)&&(ge===Ue&&(ge=vr(ge)),We(ge,$.ADD_FORBID_CONTENTS,Ht)),on&&(L["#text"]=!0),je&&We(L,["html","head","body"]),L.table&&(We(L,["tbody"]),delete ue.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw _f('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _f('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');D=$.TRUSTED_TYPES_POLICY,P=D.createHTML("")}else D===void 0&&(D=NQ(w,s)),D!==null&&typeof P=="string"&&(P=D.createHTML(""));cr&&cr($),ke=$},pi=We({},[...Lg,...Pg,...gQ]),ps=We({},[...Ug,...yQ]),Zc=function($){let he=O($);(!he||!he.tagName)&&(he={namespaceURI:rt,tagName:"template"});const Ce=Wu($.tagName),xt=Wu(he.tagName);return On[$.namespaceURI]?$.namespaceURI===Lt?he.namespaceURI===At?Ce==="svg":he.namespaceURI===qt?Ce==="svg"&&(xt==="annotation-xml"||ua[xt]):!!pi[Ce]:$.namespaceURI===qt?he.namespaceURI===At?Ce==="math":he.namespaceURI===Lt?Ce==="math"&&ca[xt]:!!ps[Ce]:$.namespaceURI===At?he.namespaceURI===Lt&&!ca[xt]||he.namespaceURI===qt&&!ua[xt]?!1:!ps[Ce]&&(za[Ce]||!pi[Ce]):!!(Zn==="application/xhtml+xml"&&On[$.namespaceURI]):!1},nr=function($){Gu(t.removed,{element:$});try{O($).removeChild($)}catch{C($)}},da=function($,he){try{Gu(t.removed,{attribute:he.getAttributeNode($),from:he})}catch{Gu(t.removed,{attribute:null,from:he})}if(he.removeAttribute($),$==="is")if(mn||en)try{nr(he)}catch{}else try{he.setAttribute($,"")}catch{}},Uo=function($){let he=null,Ce=null;if(Ye)$="<remove></remove>"+$;else{const Wt=Fk($,/^[\r\n\t ]+/);Ce=Wt&&Wt[0]}Zn==="application/xhtml+xml"&&rt===At&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const xt=D?D.createHTML($):$;if(rt===At)try{he=new b().parseFromString(xt,Zn)}catch{}if(!he||!he.documentElement){he=z.createDocument(rt,"template",null);try{he.documentElement.innerHTML=tr?P:xt}catch{}}const dt=he.body||he.documentElement;return $&&Ce&&dt.insertBefore(n.createTextNode(Ce),dt.childNodes[0]||null),rt===At?V.call(he,je?"html":"body")[0]:je?he.documentElement:dt},Bo=function($){return B.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Fr=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof g)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},cn=function($){return typeof f=="function"&&$ instanceof f};function Zt(Ie,$,he){Zu(Ie,Ce=>{Ce.call(t,$,he,ke)})}const Ma=function($){let he=null;if(Zt(X.beforeSanitizeElements,$,null),Fr($))return nr($),!0;const Ce=Ht($.nodeName);if(Zt(X.uponSanitizeElement,$,{tagName:Ce,allowedTags:L}),ae&&$.hasChildNodes()&&!cn($.firstElementChild)&&qn(/<[/\w!]/g,$.innerHTML)&&qn(/<[/\w!]/g,$.textContent)||ae&&$.namespaceURI===At&&Ce==="style"&&cn($.firstElementChild)||$.nodeType===Qu.progressingInstruction||ae&&$.nodeType===Qu.comment&&qn(/<[/\w]/g,$.data))return nr($),!0;if(ue[Ce]||!(ve.tagCheck instanceof Function&&ve.tagCheck(Ce))&&!L[Ce]){if(!ue[Ce]&&Gc(Ce)&&(K.tagNameCheck instanceof RegExp&&qn(K.tagNameCheck,Ce)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Ce)))return!1;if(on&&!ge[Ce]){const xt=O($)||$.parentNode,dt=T($)||$.childNodes;if(dt&&xt){const Wt=dt.length;for(let Pn=Wt-1;Pn>=0;--Pn){const gn=j(dt[Pn],!0);xt.insertBefore(gn,E($))}}}return nr($),!0}return $ instanceof m&&!Zc($)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&qn(/<\/no(script|embed|frames)/i,$.innerHTML)?(nr($),!0):(yt&&$.nodeType===Qu.text&&(he=$.textContent,Zu([se,Se,Y],xt=>{he=Hl(he,xt," ")}),$.textContent!==he&&(Gu(t.removed,{element:$.cloneNode()}),$.textContent=he)),Zt(X.afterSanitizeElements,$,null),!1)},il=function($,he,Ce){if(we[he]||Br&&(he==="id"||he==="name")&&(Ce in n||Ce in et))return!1;const xt=_[he]||ve.attributeCheck instanceof Function&&ve.attributeCheck(he,$);if(!(Ge&&!we[he]&&qn(ee,he))){if(!(me&&qn(H,he))){if(!xt||we[he]){if(!(Gc($)&&(K.tagNameCheck instanceof RegExp&&qn(K.tagNameCheck,$)||K.tagNameCheck instanceof Function&&K.tagNameCheck($))&&(K.attributeNameCheck instanceof RegExp&&qn(K.attributeNameCheck,he)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(he,$))||he==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&qn(K.tagNameCheck,Ce)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Ce))))return!1}else if(!un[he]){if(!qn(R,Hl(Ce,xe,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&$!=="script"&&$k(Ce,"data:")===0&&Ze[$])){if(!(Be&&!qn(re,Hl(Ce,xe,"")))){if(Ce)return!1}}}}}}return!0},zh=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Gc=function($){return!zh[Wu($)]&&qn(ze,$)},Fo=function($){Zt(X.beforeSanitizeAttributes,$,null);const{attributes:he}=$;if(!he||Fr($))return;const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let xt=he.length;for(;xt--;){const dt=he[xt],{name:Wt,namespaceURI:Pn,value:gn}=dt,zn=Ht(Wt),$o=gn;let dn=Wt==="value"?$o:uQ($o);if(Ce.attrName=zn,Ce.attrValue=dn,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,Zt(X.uponSanitizeAttribute,$,Ce),dn=Ce.attrValue,hi&&(zn==="id"||zn==="name")&&$k(dn,mi)!==0&&(da(Wt,$),dn=mi+dn),ae&&qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,dn)){da(Wt,$);continue}if(zn==="attributename"&&Fk(dn,"href")){da(Wt,$);continue}if(Ce.forceKeepAttr)continue;if(!Ce.keepAttr){da(Wt,$);continue}if(!bt&&qn(/\/>/i,dn)){da(Wt,$);continue}yt&&Zu([se,Se,Y],Vc=>{dn=Hl(dn,Vc," ")});const qo=Ht($.nodeName);if(!il(qo,zn,dn)){da(Wt,$);continue}if(D&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Pn)switch(w.getAttributeType(qo,zn)){case"TrustedHTML":{dn=D.createHTML(dn);break}case"TrustedScriptURL":{dn=D.createScriptURL(dn);break}}if(dn!==$o)try{Pn?$.setAttributeNS(Pn,Wt,dn):$.setAttribute(Wt,dn),Fr($)?nr($):Bk(t.removed)}catch{da(Wt,$)}}Zt(X.afterSanitizeAttributes,$,null)},gi=function($){let he=null;const Ce=Bo($);for(Zt(X.beforeSanitizeShadowDOM,$,null);he=Ce.nextNode();)Zt(X.uponSanitizeShadowNode,he,null),Ma(he),Fo(he),he.content instanceof u&&gi(he.content);Zt(X.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Ie){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Ce=null,xt=null,dt=null;if(tr=!Ie,tr&&(Ie="<!-->"),typeof Ie!="string"&&!cn(Ie)&&(Ie=mQ(Ie),typeof Ie!="string"))throw _f("dirty is not a string, aborting");if(!t.isSupported)return Ie;if(Me||Nr($),t.removed=[],typeof Ie=="string"&&(oa=!1),oa){const gn=Ie.nodeName;if(typeof gn=="string"){const zn=Ht(gn);if(!L[zn]||ue[zn])throw _f("root node is forbidden and cannot be sanitized in-place")}}else if(Ie instanceof f)he=Uo("<!---->"),Ce=he.ownerDocument.importNode(Ie,!0),Ce.nodeType===Qu.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?he=Ce:he.appendChild(Ce);else{if(!mn&&!yt&&!je&&Ie.indexOf("<")===-1)return D&&Cr?D.createHTML(Ie):Ie;if(he=Uo(Ie),!he)return mn?null:Cr?P:""}he&&Ye&&nr(he.firstChild);const Wt=Bo(oa?Ie:he);for(;xt=Wt.nextNode();)Ma(xt),Fo(xt),xt.content instanceof u&&gi(xt.content);if(oa)return Ie;if(mn){if(yt){he.normalize();let gn=he.innerHTML;Zu([se,Se,Y],zn=>{gn=Hl(gn,zn," ")}),he.innerHTML=gn}if(en)for(dt=M.call(he.ownerDocument);he.firstChild;)dt.appendChild(he.firstChild);else dt=he;return(_.shadowroot||_.shadowrootmode)&&(dt=I.call(a,dt,!0)),dt}let Pn=je?he.outerHTML:he.innerHTML;return je&&L["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&qn(sT,he.ownerDocument.doctype.name)&&(Pn="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
387
- `+Pn),yt&&Zu([se,Se,Y],gn=>{Pn=Hl(Pn,gn," ")}),D&&Cr?D.createHTML(Pn):Pn},t.setConfig=function(){let Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nr(Ie),Me=!0},t.clearConfig=function(){ke=null,Me=!1},t.isValidAttribute=function(Ie,$,he){ke||Nr({});const Ce=Ht(Ie),xt=Ht($);return il(Ce,xt,he)},t.addHook=function(Ie,$){typeof $=="function"&&Gu(X[Ie],$)},t.removeHook=function(Ie,$){if($!==void 0){const he=lQ(X[Ie],$);return he===-1?void 0:oQ(X[Ie],he,1)[0]}return Bk(X[Ie])},t.removeHooks=function(Ie){X[Ie]=[]},t.removeAllHooks=function(){X=Yk()},t}var _Q=lT();function TQ({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:u}){const c=x.useMemo(()=>!e.preview||t!=="html"?null:_Q.sanitize(e.preview,{USE_PROFILES:{html:!0}}),[e.preview,t]);return o.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:u,className:Re("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?o.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"?o.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:o.jsx(Rh,{children:e.preview})}):null:null,o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?o.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const Jl="__free_text__";function Ku(){return{picked:[],freeText:""}}function Xk(e,t){if(t.picked.includes(Jl)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function AQ({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const u=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=x.useState(()=>{const C={};for(const E of n.questions)C[E.question]=Ku();return C});x.useEffect(()=>{if(!a)return;const C={};for(const E of n.questions){const T=a.answers[E.question];if(!T){C[E.question]=Ku();continue}const O=new Set(E.options.map(z=>z.label)),D=E.multiSelect?T.split(/,\s*/u):[T],P=D.filter(z=>O.has(z));P.length===D.length&&P.length>0?C[E.question]={picked:P,freeText:""}:C[E.question]={picked:[Jl],freeText:T}}h(C)},[a,n.questions]);const g=ln(),[p,b]=x.useState(null),w=Et({mutationFn:async C=>rQ(e,n.correlationId,C),onSuccess:()=>{b(null),g.invalidateQueries({queryKey:["chat-messages",e]})},onError:C=>{b(C instanceof Error?C.message:String(C))}}),k=x.useCallback(()=>{b(null);const C={};for(const E of n.questions){const T=m[E.question]??Ku(),O=Xk(E,T);if(O===null){b(`Please answer "${E.question}" before submitting.`);return}C[E.question]=O}w.mutate(C)},[n.questions,m,w]),j=x.useMemo(()=>n.questions.every(C=>{const E=m[C.question]??Ku();return Xk(C,E)!==null}),[n.questions,m]);return o.jsxs("div",{className:Re("rounded-[var(--radius-panel)] border flex flex-col",u?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:u?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:u?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),o.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(C=>o.jsx(RQ,{question:C,previewFormat:n.previewFormat,selection:m[C.question]??Ku(),allowFreeText:n.allowFreeText,disabled:!u,showAnsweredCheck:c||f,onChange:E=>h(T=>({...T,[C.question]:E}))},C.question))}),u?o.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[p?o.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:p}):null,o.jsx(pe,{type:"button",disabled:!j||w.isPending,onClick:k,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function RQ({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:u,onChange:c}){const f=x.useRef(null),m=n.picked.includes(Jl);x.useEffect(()=>{var g;m&&!s&&((g=f.current)==null||g.focus())},[m,s]);const h=x.useCallback(g=>{const p=n.picked.includes(g);let b;e.multiSelect?b=p?n.picked.filter(w=>w!==g):[...n.picked,g]:b=p?[]:[g],c({...n,picked:b})},[e.multiSelect,n,c]);return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(g=>o.jsx(TQ,{option:g,previewFormat:t,selected:n.picked.includes(g.label),disabled:s,showCheckmark:u,onToggle:()=>h(g.label)},g.label)),a?o.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(g=>g!==Jl):[...n.picked,Jl]:m?[]:[Jl],freeText:n.freeText}),className:Re("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:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),o.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?o.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:g=>c({...n,freeText:g.target.value}),onClick:g=>g.stopPropagation(),onKeyDown:g=>{g.key==="Enter"&&!g.metaKey&&!g.ctrlKey&&g.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function OQ(e){return dB.safeParse(e).success}function oT(e){return fB.safeParse(e).success}function zQ(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 u=Wk(s.payload);if(!u)continue;const c=a.get(u)??-1;s.seq>c&&a.set(u,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const u=Wk(s.payload);return u?a.get(u)===s.seq:!0})}function Wk(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Po(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 u;return((u=n.find(c=>c.type===s))==null?void 0:u.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function DQ(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function Jk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function MQ({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function IQ({event:e}){const t=t3(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)",u=n?"failed":a?"using":"used";return o.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?o.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}}):o.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),o.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?Jk(t.args):void 0,children:[o.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[u," ",o.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?o.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",Jk(t.args),")"]}):null,t.durationMs!==void 0&&!a?o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",DQ(t.durationMs)]}):null]})]})}function LQ({event:e,agentNameFn:t,agentId:n}){const a=r3(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[o.jsx(Oh,{name:s,isSelf:!1}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Po(e.createdAt)}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function PQ({event:e}){return o.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:[o.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}}),o.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Po(e.createdAt)})]})}function UQ({event:e}){const t=n3(e.payload),n=Po(e.createdAt);return o.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:[o.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),o.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Oh({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return o.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:o.jsx(Lc,{width:9,height:10,style:{color:"var(--accent)"}})})}function BQ({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:a,isSelf:s}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Po(e.createdAt)}),o.jsx("span",{style:{marginLeft:"auto"},children:o.jsx(MQ,{msg:e,myAgentId:t})})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&FQ(e.content)?o.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"&&$Q(e.content)?o.jsx(qQ,{content:e.content}):e.format==="text"?o.jsx(Rh,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):o.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 FQ(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 $Q(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 qQ({content:e}){const[t,n]=x.useState({kind:"loading"});return x.useEffect(()=>{let a=!1;return nQ(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"?o.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?o.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):o.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function HQ({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:u}){const c=u(e.senderId);return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:c,isSelf:!1}),o.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Po(e.createdAt)})]}),o.jsx(AQ,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function ZQ({msg:e,agentNameFn:t}){const n=oT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([u,c])=>`${u.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:a,isSelf:!0}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Po(e.createdAt)}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:s})]})]})}function ej({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var yt;const u=ln(),c=gh(),f=Av(),{agentId:m}=ot(),[h,g]=x.useState(""),[p,b]=x.useState(0),[w,k]=x.useState([]),[j,C]=x.useState(!1),[E,T]=x.useState(null),O=x.useRef(null),D=x.useRef(null),P=x.useRef(null),z=x.useRef(!1),B=x.useRef(new Set);x.useEffect(()=>{z.current=!1},[t]);const{data:M}=Qe({queryKey:["chat-messages",t],queryFn:()=>ZV(t,{limit:50}),refetchInterval:5e3}),{data:V}=Qe({queryKey:["session-events",e,t],queryFn:()=>a3(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:I}=Qe({queryKey:["chat-detail",t],queryFn:()=>eT(t),enabled:!!t}),{data:X}=Qe({queryKey:["activity"],queryFn:Dc,refetchInterval:15e3}),se=Et({mutationFn:ae=>Co(t,ae),onSuccess:()=>{g(""),u.invalidateQueries({queryKey:["chat-messages",t]}),u.invalidateQueries({queryKey:KS(e)})}}),Se=x.useCallback(ae=>{const Me=ae.filter(en=>en.type.startsWith("image/"));if(Me.length===0)return;const Ye=Me.find(en=>en.size>5242880);if(Ye){T(`Image too large (${(Ye.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const mn=Me.map(en=>({id:crypto.randomUUID(),file:en,previewUrl:URL.createObjectURL(en)}));k(en=>[...en,...mn]),T(null)},[]),Y=x.useCallback(ae=>{k(je=>{const Me=je.find(Ye=>Ye.id===ae);return Me&&URL.revokeObjectURL(Me.previewUrl),je.filter(Ye=>Ye.id!==ae)})},[]),ee=async()=>{const ae=h.trim(),je=w;if(!(!ae&&je.length===0)&&!j&&!(me&&Ge.length===0)){if(Be.length>0)try{await J_(t,{participantIds:Be}),await u.invalidateQueries({queryKey:["chat-detail",t]})}catch(Me){T(Me instanceof Error?Me.message:"Failed to add participants");return}if(je.length>0){C(!0),T(null);try{for(const Me of je){const Ye=await HV(Me.file),mn=crypto.randomUUID();await tQ({imageId:mn,base64:Ye,mimeType:Me.file.type}),await qV(t,{data:Ye,mimeType:Me.file.type,filename:Me.file.name,size:Me.file.size,imageId:mn}),URL.revokeObjectURL(Me.previewUrl)}k([]),ae&&await Co(t,ae),g(""),u.invalidateQueries({queryKey:["chat-messages",t]}),u.invalidateQueries({queryKey:KS(e)})}catch(Me){T(Me instanceof Error?Me.message:"Failed to send image")}finally{C(!1)}return}se.mutate(ae)}},[H,re]=x.useState(!1),[xe,ze]=x.useState(""),R=x.useRef(null);x.useEffect(()=>{var ae;H&&((ae=R.current)==null||ae.focus())},[H]);const L=Et({mutationFn:ae=>$V(t,ae),onSuccess:()=>{re(!1),u.invalidateQueries({queryKey:["chat-detail",t]}),u.invalidateQueries({queryKey:["agent-sessions",e]}),u.invalidateQueries({queryKey:["session",e,t]})}}),F=()=>{const ae=xe.trim();L.mutate(ae.length>0?ae:null)},_=x.useMemo(()=>{const ae=(M==null?void 0:M.items)??[],je=zQ((V==null?void 0:V.items)??[]),Me=[...ae.map(Ye=>({kind:"message",at:Ye.createdAt,key:`m-${Ye.id}`,data:Ye})),...je.map(Ye=>({kind:"event",at:Ye.createdAt,key:`e-${Ye.id}`,data:Ye}))];return Me.sort((Ye,mn)=>Ye.at.localeCompare(mn.at)),Me},[M,V]),Z=x.useMemo(()=>{const ae=new Map;for(const je of(M==null?void 0:M.items)??[])je.format==="question_answer"&&oT(je.content)&&ae.set(je.content.correlationId,je.content);return ae},[M]),K=_.length;x.useEffect(()=>{var ae;K>0&&((ae=P.current)==null||ae.scrollIntoView({behavior:"smooth"}))},[K]);const ue=c(e),we=x.useMemo(()=>{var ae;return new Set(((ae=I==null?void 0:I.participants)==null?void 0:ae.map(je=>je.agentId))??[])},[I==null?void 0:I.participants]),ve=x.useMemo(()=>{const ae=new Set;for(const Me of(I==null?void 0:I.participants)??[])ae.add(Me.agentId);for(const Me of(X==null?void 0:X.agents)??[])ae.add(Me.agentId);ae.size===0&&ae.add(e);const je=[];for(const Me of ae){if(Me===m)continue;const Ye=f(Me);!Ye||!Ye.name||je.push({agentId:Me,name:Ye.name,displayName:Ye.displayName})}return je},[I==null?void 0:I.participants,X==null?void 0:X.agents,e,f,m]),me=x.useMemo(()=>{if(!I)return!1;if(I.type==="group")return!0;const ae=I.participants.some(je=>je.agentId===m);return I.type==="direct"&&!ae&&I.participants.length>=2},[I,m]);x.useEffect(()=>{if(n||B.current.has(t)||!M||!V||!I||_.length>0||h.length>0||me||ue===e)return;const ae=`Hi ${ue}! What can you help with?`;g(ae),b(ae.length),B.current.add(t),requestAnimationFrame(()=>{const je=D.current;je&&(je.focus(),je.setSelectionRange(ae.length,ae.length))})},[t,e,M,V,I,_.length,h.length,ue,me,n]);const Ge=x.useMemo(()=>{const ae=ve.map(je=>({agentId:je.agentId,name:je.name}));return sN(h,ae)},[h,ve]),Be=x.useMemo(()=>we.size===0?[]:Ge.filter(ae=>!we.has(ae)),[Ge,we]),bt=tT({value:h,cursor:p,candidates:ve,disabled:se.isPending||j,onSelect:ae=>{g(ae.text),b(ae.cursor),requestAnimationFrame(()=>{const je=D.current;je&&(je.focus(),je.setSelectionRange(ae.cursor,ae.cursor))})}});return o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[o.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:o.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[o.jsx("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(I==null?void 0:I.title)??a??"…"}),o.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"})]}):H?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:R,value:xe,onChange:ae=>ze(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?(ae.preventDefault(),F()):ae.key==="Escape"&&(ae.preventDefault(),re(!1))},disabled:L.isPending,maxLength:500,placeholder:(I==null?void 0:I.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)"}}),o.jsx("button",{type:"button",onClick:F,disabled:L.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:o.jsx(wr,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>re(!1),disabled:L.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:o.jsx(Vs,{className:"h-3.5 w-3.5"})})]}):o.jsx("button",{type:"button",onClick:()=>{ze((I==null?void 0:I.topic)??""),re(!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:(I==null?void 0:I.title)??"…"})}),o.jsx(GQ,{chatId:t,participantIds:((yt=I==null?void 0:I.participants)==null?void 0:yt.map(ae=>ae.agentId))??[e],candidates:ve,agentIdentity:f,onAdded:()=>u.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:o.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[K===0&&o.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[o.jsx(vv,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),o.jsx("div",{className:"flex flex-col",style:{gap:4},children:_.map(ae=>{if(ae.kind==="event"){const Me=ae.data;switch(Me.kind){case"tool_call":return o.jsx(IQ,{event:Me},ae.key);case"assistant_text":return o.jsx(LQ,{event:Me,agentId:e,agentNameFn:c},ae.key);case"thinking":return o.jsx(PQ,{event:Me},ae.key);case"error":return o.jsx(UQ,{event:Me},ae.key);default:return null}}const je=ae.data;if(je.format==="question"&&OQ(je.content)){const Me=Z.get(je.content.correlationId)??null,Ye=Me?"answered":"pending";return o.jsx(HQ,{msg:je,chatId:t,content:je.content,answer:Me,status:Ye,agentNameFn:c},ae.key)}return je.format==="question_answer"?o.jsx(ZQ,{msg:je,agentNameFn:c},ae.key):o.jsx(BQ,{msg:je,myAgentId:m,agentNameFn:c},ae.key)})}),o.jsx("div",{ref:P})]})}),o.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:o.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?o.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:[o.jsx(lE,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&o.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&o.jsx(pe,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:ae=>ae.preventDefault(),onDrop:ae=>{ae.preventDefault(),Se(Array.from(ae.dataTransfer.files))},children:[w.length>0&&o.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:w.map(ae=>o.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[o.jsx("img",{src:ae.previewUrl,alt:ae.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),o.jsx("button",{type:"button",onClick:()=>Y(ae.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:o.jsx(Vs,{className:"h-2 w-2"})})]},ae.id))}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(nT,{trigger:bt.trigger,results:bt.results,highlightIndex:bt.highlightIndex,anchorRef:D,onPick:bt.pick}),o.jsx("textarea",{ref:D,value:h,onChange:ae=>{g(ae.target.value),b(ae.target.selectionStart??ae.target.value.length)},onSelect:ae=>{b(ae.currentTarget.selectionStart??h.length)},onFocus:()=>{me&&(z.current||h.length>0||ve.length===0||(z.current=!0,g("@"),b(1),requestAnimationFrame(()=>{const ae=D.current;ae&&ae.setSelectionRange(1,1)})))},onPaste:ae=>{const je=Array.from(ae.clipboardData.files);je.length>0&&(ae.preventDefault(),Se(je))},placeholder:me?"Type @ to pick a recipient, then your message":`Message @${ue} · / for commands · @ to mention`,rows:2,onKeyDown:ae=>{bt.handleKey(ae)||ae.key==="Enter"&&!ae.shiftKey&&(ae.preventDefault(),ee())},disabled:se.isPending||j,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}})]}),o.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[o.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[o.jsx("button",{type:"button",onClick:()=>{const ae=D.current;if(!ae)return;const je=ae.selectionStart??h.length,Me=ae.selectionEnd??je,Ye=`${h.slice(0,je)}@${h.slice(Me)}`;g(Ye),b(je+1),requestAnimationFrame(()=>{ae.focus(),ae.setSelectionRange(je+1,je+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:o.jsx(yz,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>{var ae;return(ae=O.current)==null?void 0:ae.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:o.jsx(Gz,{className:"h-3.5 w-3.5"})}),o.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:ae=>{ae.target.files&&(Se(Array.from(ae.target.files)),ae.target.value="")}})]}),o.jsxs("span",{className:"flex items-center",style:{gap:8},children:[j&&o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),o.jsx("button",{type:"button",onClick:ee,disabled:se.isPending||j||!h.trim()&&w.length===0||me&&Ge.length===0,title:me&&Ge.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:Re("inline-flex items-center justify-center transition-opacity",(se.isPending||j||!h.trim()&&w.length===0||me&&Ge.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:o.jsx(sE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(se.isError||E)&&o.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:E??(se.error instanceof Error?se.error.message:"Failed to send")})]})})})]})}function GQ({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:u=!1}){const[c,f]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!c)return;const p=b=>{m.current&&(m.current.contains(b.target)||f(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]);const h=Et({mutationFn:p=>J_(e,{participantIds:[p]}),onSuccess:()=>{f(!1),s()}}),g=x.useMemo(()=>n.filter(p=>!t.includes(p.agentId)),[n,t]);return o.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(p=>{const b=a(p),w=(b==null?void 0:b.displayName)??(b==null?void 0:b.name)??p.slice(0,8);return o.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},p)}),!u&&o.jsxs("div",{ref:m,style:{position:"relative"},children:[o.jsx("button",{type:"button",onClick:()=>f(!c),disabled:g.length===0||h.isPending,title:g.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:g.length===0?"var(--fg-4)":"var(--fg-3)",cursor:g.length===0?"not-allowed":"pointer"},children:o.jsx(ba,{className:"h-3 w-3"})}),c&&g.length>0&&o.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const p=bb(g);return g.map(b=>o.jsx("button",{type:"button",role:"option","aria-selected":"false",title:b.name?`@${b.name}`:void 0,onClick:()=>h.mutate(b.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:o.jsx(xb,{candidate:b,ambiguous:p})},b.agentId))})()})]})]})}function tj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function VQ(e,t){var s;const n=e.filter(u=>u.agentId!==t),a=n.find(u=>u.type!==void 0&&u.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function QQ({chatId:e}){const t=ln(),{agentId:n}=ot(),a=x.useRef(new Map),{data:s}=Qe({queryKey:["chat-detail",e],queryFn:()=>eT(e),enabled:!!e}),{data:u}=Qe({queryKey:["me","chats","all"],queryFn:()=>nh({filter:"all"}),refetchInterval:3e4}),{data:c}=Qe({queryKey:["me","chats","watching"],queryFn:()=>nh({filter:"watching"}),refetchInterval:3e4}),f=x.useMemo(()=>tj(u==null?void 0:u.rows,e)??tj(c==null?void 0:c.rows,e)??null,[u,c,e]),m=x.useMemo(()=>f?f.participants.map(j=>({agentId:j.agentId,type:j.type})):s?s.participants.map(j=>({agentId:j.agentId,type:void 0})):[],[f,s]),h=x.useMemo(()=>VQ(m,n),[m,n]),p=Et({mutationFn:()=>IV(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,b=(f==null?void 0:f.lastMessageAt)??"";x.useEffect(()=>{!f||a.current.get(e)===b||(a.current.set(e,b),p())},[e,f,b,p]);const w=Et({mutationFn:()=>LV(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),k=(f==null?void 0:f.membershipKind)==="watching";return h?k?o.jsx(ej,{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}}):o.jsx(ej,{agentId:h,chatId:e}):o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:o.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[o.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),o.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function KQ(){return o.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:o.jsxs("div",{className:"text-center max-w-sm",children:[o.jsx(Lc,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),o.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),o.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}async function ui(e,t){try{await Ee.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function YQ({organizationId:e,onContinue:t}){const[n,a]=x.useState([]),[s,u]=x.useState(""),[c,f]=x.useState(""),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,w]=x.useState(!1),[k,j]=x.useState(null),C=x.useRef(null);x.useEffect(()=>{(async()=>{try{const D=await Ee.get("/me/organizations");a(D)}catch(D){j(D instanceof Error?D.message:"Failed to load your team")}finally{w(!0)}})()},[]),x.useEffect(()=>{var P;const D=((P=n.find(z=>z.id===e))==null?void 0:P.displayName)??"";u(D),f(D)},[n,e]),x.useEffect(()=>{const D=C.current;if(!D||!c)return;D.focus();const P=D.value.length;D.setSelectionRange(P,P)},[c]);const E=s.trim(),T=E.length>0&&!m&&b&&!k,O=x.useCallback(async D=>{if(D==null||D.preventDefault(),!(!T||!e)){p(null);try{E!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:E}),ui("team_renamed")),t()}catch(P){p(P instanceof Error?P.message:"Failed to rename team")}finally{h(!1)}}},[T,e,E,c,t]);return o.jsxs("form",{onSubmit:O,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[o.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),o.jsx("input",{ref:C,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:D=>u(D.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:D=>{D.currentTarget.style.borderColor="var(--accent)"},onBlur:D=>{D.currentTarget.style.borderColor="var(--border)"}})]}),g||k?o.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g??`Couldn't load your team — ${k}. Refresh the page and try again.`}):null,o.jsx("div",{className:"flex justify-end",children:o.jsxs(pe,{type:"submit",disabled:!T,children:[o.jsx("span",{children:"Continue"}),o.jsx(iE,{className:"h-4 w-4"})]})})]})}function wb(){return o.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function is({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return o.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[o.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?o.jsx(wr,{className:"h-3 w-3"}):e}),o.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const XQ=3e4,WQ=1e3,JQ=3e3;function eK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function tK({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var we;const s=Rn(),u=KO(e,t),c=XO(u),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,g]=x.useState(()=>(c==null?void 0:c.displayName)??"Coder"),[p,b]=x.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,k]=x.useState(null),[j,C]=x.useState(null),[E,T]=x.useState(null),[O,D]=x.useState(()=>f),[P,z]=x.useState(()=>m),[B,M]=x.useState([]),[V,I]=x.useState("form"),[X,se]=x.useState(null),Se=x.useRef(null),Y=x.useRef(null),ee=x.useRef(null),H=x.useRef(0);x.useEffect(()=>()=>{Y.current&&(Y.current.cancelled=!0)},[]),x.useEffect(()=>{WO(u,{displayName:h,selectedRuntime:p,connectToken:O,connectTokenExpiresAt:P})},[u,h,p,O,P]),x.useEffect(()=>{(async()=>{try{const ve=await Ee.get("/me/organizations");M(ve)}catch{}})()},[]),x.useEffect(()=>{if(V!=="form")return;let ve=!1;const me=async()=>{const Be=++H.current;try{const bt=await ss();if(ve||Be!==H.current)return;const ae=bt.filter(je=>je.status==="connected").sort((je,Me)=>Me.lastSeenAt.localeCompare(je.lastSeenAt))[0]??null;if(k(je=>(je==null?void 0:je.id)===(ae==null?void 0:ae.id)?je:ae),ae){ee.current!==ae.id&&(ee.current=null,T(null),C(null));try{const je=await Sv(ae.id);if(ve||Be!==H.current)return;ee.current=ae.id,T(ae.id),C(je.capabilities)}catch{}}else ee.current=null,T(null),C(null)}catch{}};me();const Ge=setInterval(me,JQ);return()=>{ve=!0,clearInterval(Ge)}},[V]),x.useEffect(()=>{if(w)return;if(O&&P&&P>Date.now()){const me=Math.max(P-Date.now(),0),Ge=window.setTimeout(()=>{D(null),z(null)},me);return()=>window.clearTimeout(Ge)}O&&(D(null),z(null));let ve=!1;return(async()=>{try{const me=await Ee.post("/me/connect-tokens",{});ve||(D(me.token),z(Date.now()+me.expiresIn*1e3))}catch(me){ve||se(me instanceof Error?me.message:"Failed to generate connect token")}})(),()=>{ve=!0}},[w,O,P]);const re=w&&E===w.id?j:null;x.useEffect(()=>{b(ve=>{var Ge;if(!re)return ve;const me=nK(re);return ve&&me&&Object.keys(re).includes(ve)&&((Ge=re[ve])==null?void 0:Ge.state)==="ok"?ve:me})},[re]);const xe=re?Object.entries(re).filter(([,ve])=>ve.state==="ok").map(([ve])=>ve):[],ze=((we=B.find(ve=>ve.id===e))==null?void 0:we.displayName)??"",R=h.trim(),L=R||"your agent",F=O?`npm install -g @agent-team-foundation/first-tree-hub
388
- first-tree-hub connect ${O}`:null,_=x.useCallback(async ve=>{Y.current&&(Y.current.cancelled=!0);const me={cancelled:!1};Y.current=me;const Ge=Date.now();for(;!me.cancelled;){let Be=!1;try{const bt=await Ee.get(`/agents/${encodeURIComponent(ve)}/client-status`);if(me.cancelled)return;Be=bt.online===!0}catch{if(me.cancelled)return}if(Be){JO(u);try{await a()}catch{}if(me.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Ge>XQ){me.cancelled||I("timeout");return}await new Promise(bt=>setTimeout(bt,WQ))}},[u,a,s]),Z=!!(R&&w&&p&&xe.includes(p)&&V==="form"),K=x.useCallback(async()=>{if(!w||!p||!R)return;se(null),I("creating");const ve=Gy(R);let me;try{me=(await Ee.post(Ln("/agents"),{type:"personal_assistant",displayName:R,...ve?{name:ve}:{},clientId:w.id,runtimeProvider:p,...e?{organizationId:e}:{}})).uuid,Se.current=me,VO(me),ui("agent_created",{runtimeProvider:p})}catch(Ge){se(Ge instanceof Error?Ge.message:"Failed to create agent"),I("form");return}await _(me)},[R,w,p,_,e]),ue=x.useCallback(async()=>{const ve=Se.current;ve&&(se(null),I("creating"),await _(ve))},[_]);return V==="creating"?o.jsx(uK,{nameOrFallback:L}):V==="timeout"?o.jsx(cK,{nameOrFallback:L,hostname:(w==null?void 0:w.hostname)??null,error:X,onRetry:ue}):o.jsx(rK,{joinPath:n,teamName:ze,displayName:h,setDisplayName:g,trimmedName:R,connectedClient:w,cliCommand:F,capabilitiesLoaded:re!==null,okRuntimes:xe,selectedRuntime:p,setSelectedRuntime:b,error:X,canCreate:Z,onCreate:K})}function nK(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 rK({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:u,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:g,error:p,canCreate:b,onCreate:w}){const k=x.useRef(null),j=e==="invite"&&t,C=f&&m.length===0&&!!u,E=s?u?C?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return x.useEffect(()=>{var T;s||(T=k.current)==null||T.focus()},[s]),o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:j?o.jsxs(o.Fragment,{children:["You've joined"," ",o.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — a"," ",o.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"code agent"})," ","that helps with your code."]}):o.jsxs(o.Fragment,{children:["Set up your first agent — a"," ",o.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"code agent"})," ","that helps with your code."]})}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(wb,{}),o.jsx(is,{number:"01",state:s?"complete":"active",children:o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[o.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),o.jsx("input",{ref:k,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:T=>a(T.target.value),placeholder:"e.g. Code Reviewer",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:T=>{T.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:T=>{T.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),o.jsx(is,{number:"02",state:b?"complete":s?"active":"idle",children:o.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:u?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!u&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),u?o.jsxs(o.Fragment,{children:[o.jsx(lK,{hostname:u.hostname??u.id}),o.jsx(sK,{runtimes:m,selected:h,onSelect:g,capabilitiesLoaded:f})]}):o.jsxs(o.Fragment,{children:[o.jsx(aK,{command:c}),o.jsx(iK,{})]})]}):null]})})]}),p&&o.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p}),s&&o.jsxs("div",{style:{marginTop:b?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!b&&o.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:E}),b&&o.jsxs(pe,{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:T=>{T.currentTarget.style.transform="scale(1.01)",T.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:T=>{T.currentTarget.style.transform="scale(1)",T.currentTarget.style.boxShadow="var(--shadow-md)"},children:[o.jsxs("span",{children:["Create ",s]}),o.jsx(iE,{className:"h-4 w-4"})]}),o.jsx("p",{className:"text-caption",style:{margin:b?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function aK({command:e}){const[t,n]=x.useState(!1),s=(e?e.split(`
389
- `):[]).find(m=>m.startsWith("first-tree-hub"))??"",u="first-tree-hub connect ",c=s.startsWith(u)?`${u}${s.slice(u.length,u.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 o.jsx("div",{style:{marginTop:"var(--sp-2)"},children:o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[o.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…"}),o.jsxs(pe,{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?o.jsx(wr,{className:"h-3.5 w-3.5"}):o.jsx(ch,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function iK(){return o.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:[o.jsx(oK,{}),o.jsx("span",{children:"Waiting for your computer…"})]})}function sK({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?o.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…"}):o.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),o.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[o.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,u)=>{const c=t===s;return o.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 ${u*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[o.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),o.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&&o.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),eK(s)]},s)})]})]})}function lK({hostname:e}){return o.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:[o.jsx(wr,{className:"h-3.5 w-3.5"}),o.jsxs("span",{children:[o.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function oK(){return o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function uK({nameOrFallback:e}){return o.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[o.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),o.jsx(dK,{}),o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function cK({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return o.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[o.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?o.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}):o.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[o.jsx("p",{children:"This usually means:"}),o.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[o.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),o.jsxs("li",{children:["The connection to ",s," dropped"]})]}),o.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",o.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),o.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:o.jsx(pe,{onClick:a,children:"Try again"})})]})}function dK(){return o.jsxs("span",{className:"flex items-center",style:{gap:6},children:[o.jsx(Fg,{delayMs:0}),o.jsx(Fg,{delayMs:160}),o.jsx(Fg,{delayMs:320})]})}function Fg({delayMs:e}){return o.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 uT(){return(await Ee.get("/me/github/repos")).repos}const cT="https://github.com/agent-team-foundation/first-tree";function Sb(e,t){return["Bind my source repo to an existing context-tree.","",`Source repo: ${e}`,`Existing tree: ${t}`,"","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.","",`Reference: ${cT}`].join(`
390
- `)}function fK(e){return["Create a brand-new context-tree for my source repo.","",`Source repo: ${e}`,"","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.","","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 PR.","",`Reference: ${cT}`].join(`
391
- `)}function hK(){const{role:e}=ot();return e==="admin"?o.jsx(xK,{}):o.jsx(mK,{})}function mK(){var f,m;const{organizationId:e}=ot(),[t,n]=x.useState({kind:"loading"}),[a,s]=x.useState(0);if(x.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[g,p]=await Promise.all([gb(e),Y_(e)]);if(h)return;n({kind:"loaded",tree:g,repos:p})}catch(g){if(h)return;n({kind:"error",message:g instanceof Error?g.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return o.jsx(gK,{});if(t.kind==="error")return o.jsx(pK,{message:t.message,onRetry:()=>s(h=>h+1)});const u=((f=t.tree)==null?void 0:f.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return u&&c.length>0?o.jsx(yK,{treeUrl:u,teamRepos:c}):u?o.jsx(vK,{treeUrl:u}):o.jsx(bK,{})}function pK({message:e,onRetry:t}){return o.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:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),o.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),o.jsx("div",{style:{marginTop:"var(--sp-3)"},children:o.jsx(pe,{type:"button",onClick:t,children:"Try again"})})]})}function gK(){return o.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function yK({treeUrl:e,teamRepos:t}){var w,k;const n=Rn(),{dismissOnboarding:a}=ot(),{addToast:s}=Pc(),[u,c]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(t.length===1?((w=t[0])==null?void 0:w.url)??null:null),p=x.useCallback(async()=>{if(h){c(!0),m(null);try{const j=await kb(),C=await jh(j.uuid);await Eh(j.uuid,{expectedVersion:C.version,payload:{gitRepos:[{url:h}]}});const E=await vb(j.uuid),T=Sb(h,e);try{await Co(E.id,T)}catch{}ui("tree_chat_started",{agentUuid:j.uuid,chatId:E.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(E.id)}`,{replace:!1})}catch(j){m(j instanceof Error?j.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),b=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),a(),s(jb(n))},[a,s,n]);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[o.jsx(Ky,{label:"Tree",value:e}),t.length===1?o.jsx(Ky,{label:"Source repo",value:((k=t[0])==null?void 0:k.url)??""}):o.jsxs("fieldset",{disabled:u,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[o.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repo to bind your agent to"}),t.map(j=>{const C=h===j.url;return o.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:u?"not-allowed":"pointer",color:C?"var(--fg)":"var(--fg-2)",fontWeight:C?600:400},children:[o.jsx("input",{type:"radio",name:"invitee-source-repo",value:j.url,checked:C,onChange:()=>g(j.url),className:"sr-only"}),o.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:j.url})]},j.url)})]}),f?o.jsx(Eb,{children:f}):null,o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!h||u,onClick:()=>void p(),children:u?"Starting…":"Confirm"}),o.jsx(pe,{type:"button",variant:"outline",onClick:b,disabled:u,children:"I'll do it later"})]})]})]})}function vK({treeUrl:e}){const t=Rn(),{dismissOnboarding:n}=ot(),{addToast:a}=Pc(),[s,u]=x.useState(!1),[c,f]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),[b,w]=x.useState(null);x.useEffect(()=>{let C=!1;return(async()=>{try{const E=await uT();if(C)return;h(E)}catch(E){C||p(E instanceof Error?E.message:"Failed to list GitHub repositories")}})(),()=>{C=!0}},[]);const k=x.useCallback(async()=>{if(b){u(!0),f(null);try{const C=await kb(),E=await jh(C.uuid);await Eh(C.uuid,{expectedVersion:E.version,payload:{gitRepos:[{url:b}]}});const T=await vb(C.uuid),O=Sb(b,e);try{await Co(T.id,O)}catch{}ui("tree_chat_started",{agentUuid:C.uuid,chatId:T.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(T.id)}`,{replace:!1})}catch(C){f(C instanceof Error?C.message:"Failed to start the chat"),u(!1)}}},[b,e,t,n]),j=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),n(),a(jb(t))},[n,a,t]);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repo you'll work with."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(wb,{}),o.jsx(is,{number:"01",state:"complete",children:o.jsx(Ky,{label:"Tree",value:e})}),o.jsx(is,{number:"02",state:b?"complete":"active",children:o.jsx(dT,{disabled:s,repos:m,error:g,selectedRepoUrl:b,onSelect:w})}),o.jsxs(is,{number:"03",state:b?"active":"idle",children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:b?"var(--fg)":"var(--fg-4)",fontWeight:b?600:500},children:"Let your agent join the tree"}),b?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"It'll install the skill and bind your source repo to the existing team tree."}),c?o.jsx(Eb,{style:{marginTop:"var(--sp-3)"},children:c}):null,o.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!b||s,onClick:()=>void k(),children:s?"Starting…":"Continue"}),o.jsx(pe,{type:"button",variant:"outline",onClick:j,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function bK(){const{dismissOnboarding:e}=ot(),{addToast:t}=Pc(),n=x.useRef(!1);return x.useEffect(()=>{n.current||(n.current=!0,ui("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),o.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:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),o.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they bind a source repo and a context-tree, this view will guide you to bind your agent. For now, you can chat with your agent for anything that doesn't need code context."})]})}function xK(){const e=Rn(),{dismissOnboarding:t,organizationId:n}=ot(),{addToast:a}=Pc(),[s,u]=x.useState(!1),[c,f]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(""),[b,w]=x.useState(null),[k,j]=x.useState(null),[C,E]=x.useState(null);x.useEffect(()=>{let M=!1;return(async()=>{try{const V=await uT();if(M)return;j(V)}catch(V){M||E(V instanceof Error?V.message:"Failed to list GitHub repositories")}})(),()=>{M=!0}},[]),x.useEffect(()=>{if(!n)return;let M=!1;return(async()=>{try{const V=await gb(n);if(M)return;V.repo&&(p(V.repo),h(I=>I??"existing"))}catch{}})(),()=>{M=!0}},[n]);const T=g.trim(),O=(()=>{if(m!=="existing")return!0;if(!T)return!1;try{return new URL(T).protocol==="https:"}catch{return!1}})(),D=x.useCallback(()=>{ui("tree_intro_dismissed"),t(),a(jb(e))},[t,a,e]),P=x.useCallback(async()=>{if(b&&m&&!(m==="existing"&&!O)){f(null),u(!0);try{const M=await kb(),V=await jh(M.uuid);if(await Eh(M.uuid,{expectedVersion:V.version,payload:{gitRepos:[{url:b}]}}),n)try{await X_(n,{repos:[{url:b}]})}catch(se){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",se)}if(m==="existing"&&n)try{await K_(n,{repo:T})}catch(se){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",se),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 I=await vb(M.uuid),X=m==="existing"?Sb(b,T):fK(b);try{await Co(I.id,X)}catch{}ui("tree_chat_started",{agentUuid:M.uuid,chatId:I.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(I.id)}`,{replace:!1})}catch(M){f(M instanceof Error?M.message:"Failed to start the tree-init chat"),u(!1)}}},[b,m,O,T,n,e,t,a]),z=!!b&&m!==null&&!s&&(m==="new"||O),B=!!m&&(m==="new"||O);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(wb,{}),o.jsx(is,{number:"01",state:b?"complete":"active",children:o.jsx(dT,{disabled:s,repos:k,error:C,selectedRepoUrl:b,onSelect:w})}),o.jsxs(is,{number:"02",state:B?"complete":b?"active":"idle",children:[o.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?o.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[o.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:[o.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(M=>{const V=m===M.value;return o.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:V?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:V?"var(--fg)":"var(--fg-3)",fontWeight:V?600:400,boxShadow:V?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[o.jsx("input",{type:"radio",name:"tree-mode",value:M.value,checked:V,onChange:()=>h(M.value),className:"sr-only"}),M.label]},M.value)})]}),m==="existing"?o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),o.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:g,onChange:M=>p(M.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?o.jsx("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 it to your source repo."}):null]}):null]}),o.jsxs(is,{number:"03",state:B?"active":"idle",children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:B?"var(--fg)":"var(--fg-4)",fontWeight:B?600:500},children:"Let your agent build it"}),B?o.jsxs(o.Fragment,{children:[o.jsx("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 your source repo."}),c?o.jsx(Eb,{style:{marginTop:"var(--sp-3)"},children:c}):null,o.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!z,onClick:()=>void P(),children:s?"Starting…":"Continue"}),o.jsx(pe,{type:"button",variant:"outline",onClick:D,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function kb(){const e=GO(),t=await Tv(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,u)=>u.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 jb(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 Ky({label:e,value:t}){return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),o.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 Eb({children:e,style:t}){return o.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 dT({disabled:e,repos:t,error:n,selectedRepoUrl:a,onSelect:s}){const u=o.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick the source repo"});return e?o.jsx("div",{children:u}):n?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[u,o.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),o.jsx("div",{style:{marginTop:"var(--sp-2)"},children:o.jsx(pe,{type:"button",variant:"outline",size:"sm",asChild:!0,children:o.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[u,o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[u,o.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."})]}):o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[u,o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about."}),o.jsx(wK,{repos:t,selectedRepoUrl:a,onSelect:s})]})}function wK({repos:e,selectedRepoUrl:t,onSelect:n}){const[a,s]=x.useState(!1),u=x.useRef(null);x.useEffect(()=>{if(!a)return;const m=g=>{u.current&&!u.current.contains(g.target)&&s(!1)},h=g=>{g.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[a]);const c=x.useMemo(()=>{const m=new Map;for(const h of e){const g=h.fullName.split("/")[0]??"",p=m.get(g);p?p.push(h):m.set(g,[h])}return[...m.entries()].sort(([h],[g])=>h.localeCompare(g))},[e]),f=e.find(m=>m.cloneUrl===t)??null;return o.jsxs("div",{ref:u,className:"relative",style:{marginTop:"var(--sp-2)"},children:[o.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(m=>!m),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:f?"var(--fg)":"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[o.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:f?f.fullName:"Select a repository…"}),o.jsx(yv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&o.jsx("div",{role:"listbox","aria-label":"GitHub repository",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(([m,h],g)=>o.jsxs("div",{children:[g>0&&o.jsx("div",{"aria-hidden":"true",style:{margin:"var(--sp-1) 0",height:"var(--hairline)",background:"var(--border-faint)"}}),o.jsx("div",{className:"text-eyebrow",style:{padding:"var(--sp-1) var(--sp-3)",color:"var(--fg-3)"},children:m}),h.map(p=>{const b=p.cloneUrl===t,w=p.fullName.slice(m.length+1);return o.jsxs("button",{type:"button",role:"option","aria-selected":b,onClick:()=>{n(p.cloneUrl),s(!1)},className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-3)",background:b?"var(--accent-bg)":"transparent",color:b?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:k=>{b||(k.currentTarget.style.background="var(--surface-1)")},onMouseLeave:k=>{b||(k.currentTarget.style.background="transparent")},children:[o.jsx("span",{style:{width:14,display:"inline-flex",flexShrink:0},children:b?o.jsx(wr,{className:"h-3.5 w-3.5"}):null}),o.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:w}),p.private&&o.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},p.cloneUrl)})]},m))})]})}function SK(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=ot(),[u,c]=oh(),f=u.get("step"),[m]=x.useState(()=>nE()),[h,g]=x.useState(()=>eE()),p=x.useCallback(j=>{ZO(j),g(j)},[]),b=s==="admin",w=x.useMemo(()=>f==="team"&&b?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&b?"step1":"step2",[f,e,h,m,b]),k=x.useCallback(()=>{p(!0);const j=new URLSearchParams(u);j.delete("step"),c(j,{replace:!0})},[p,u,c]);return o.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:o.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?o.jsx(YQ,{organizationId:n,onContinue:k}):w==="step2"?o.jsx(tK,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):o.jsx(hK,{})})})}function kK({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=ot();return e===rh?o.jsx(YV,{onCreated:t}):e?o.jsx(QQ,{chatId:e}):n!==null&&!a?o.jsx(SK,{}):o.jsx(KQ,{})}const jK={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function EK(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=ot(),{addToast:a}=Pc(),s=Rn(),[u,c]=oh(),f=u.get("c"),m=u.get("step"),h=eE(),p=nE()==="invite",b=x.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!p?1:2,[m,f,e,h,p]);if(e===null||t)return null;const w=e==="completed",k=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},j={1:$g(1,b,e),2:$g(2,b,e),3:$g(3,b,e)},C=E=>{if(E!==3)return;const T=new URLSearchParams(u);T.delete("c"),T.set("step","tree"),c(T,{replace:!1})};return o.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:[o.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((E,T)=>{const O=j[E],D=[1,2,3][T+1],P=D?nj(O)&&nj(j[D]):!1;return o.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[o.jsx(CK,{index:E,state:O,label:jK[E],onClick:E===3&&O==="active"?()=>C(E):void 0}),D?o.jsx(_K,{solid:P}):null]},E)})}),o.jsx("button",{type:"button",onClick:k,disabled:!w,title:w?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:w?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:w?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:w?1:.5},onMouseEnter:E=>{w&&(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:"✕"})]})}function $g(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function nj(e){return e==="active"||e==="completed"}function CK({index:e,state:t,label:n,onClick:a}){const s=!!a,u=NK(t,e);return o.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:[u,o.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function NK(e,t){return e==="completed"?o.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"?o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),o.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"?o.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:"⊗"}):o.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 _K({solid:e}){return o.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 TK(){const[e,t]=oh(),n=e.get("c"),a=e.get("a");AN(),x.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=x.useCallback(c=>{t({c})},[t]),u=x.useCallback(()=>{t({c:rh})},[t]);return o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx(FV,{selectedChatId:n,onSelectChat:s,onNewChat:u}),o.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[o.jsx(EK,{}),o.jsx(kK,{selectedChatId:n,onSelectChat:s})]})]})}const AK=new nR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function RK(){return o.jsx(rR,{client:AK,children:o.jsx(nz,{children:o.jsx(n4,{children:o.jsx(OO,{children:o.jsxs(lO,{children:[o.jsx(Mt,{path:"/login",element:o.jsx(jG,{})}),o.jsx(Mt,{path:"/signup",element:o.jsx(lr,{to:"/login",replace:!0})}),o.jsx(Mt,{path:"/auth/github/complete",element:o.jsx(EG,{})}),o.jsx(Mt,{path:"/invite/:token",element:o.jsx(xG,{})}),o.jsx(Mt,{element:o.jsx(lz,{}),children:o.jsxs(Mt,{element:o.jsx(TB,{children:o.jsx(e4,{})}),children:[o.jsx(Mt,{index:!0,element:o.jsx(TK,{})}),o.jsx(Mt,{path:"context",element:o.jsx(HZ,{})}),o.jsx(Mt,{path:"agents/:uuid",element:o.jsx(aZ,{})}),o.jsx(Mt,{path:"team",element:o.jsx(SV,{})}),o.jsxs(Mt,{path:"settings",element:o.jsx(fV,{}),children:[o.jsx(Mt,{index:!0,element:o.jsx(lr,{to:"computers",replace:!0})}),o.jsx(Mt,{path:"team",element:o.jsx(DV,{})}),o.jsx(Mt,{path:"computers",element:o.jsx(BG,{})}),o.jsx(Mt,{path:"github",element:o.jsx(VG,{})}),o.jsx(Mt,{path:"integrations",element:o.jsx(uV,{})}),o.jsx(Mt,{path:"onboarding",element:o.jsx(cV,{})}),o.jsx(Mt,{path:"setup",element:o.jsx(lr,{to:"/settings/onboarding",replace:!0})})]}),o.jsx(Mt,{path:"agents",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"clients",element:o.jsx(lr,{to:"/settings/computers",replace:!0})}),o.jsx(Mt,{path:"integrations",element:o.jsx(lr,{to:"/settings/integrations",replace:!0})}),o.jsx(Mt,{path:"team/members",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/agents",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/invite",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/settings",element:o.jsx(lr,{to:"/settings/team",replace:!0})}),o.jsx(Mt,{path:"admin",element:o.jsx(OK,{})})]})})]})})})})})}function OK(){const e=Sr();return e.hash==="#bindings"?o.jsx(lr,{to:`/settings/integrations${e.search}`,replace:!0}):o.jsx(lr,{to:`/team${e.hash}`,replace:!0})}const fT=document.getElementById("root");if(!fT)throw new Error("Root element not found");A2.createRoot(fT).render(o.jsx(x.StrictMode,{children:o.jsx(RK,{})}));export{iE as A,Lc as F,Oc as L,gt as c,o as j,x as r};