@agent-team-foundation/first-tree-hub 0.10.6 → 0.10.8
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.
- package/dist/cli/index.mjs +101 -14
- package/dist/{dist-CbX9mUVH.mjs → dist-DSr_I5Ia.mjs} +12 -0
- package/dist/{feishu-DvjRZMdZ.mjs → feishu-eynC54km.mjs} +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{invitation-BljIolbO-DLeHfURd.mjs → invitation-B1pjAyOz-BaCA9PII.mjs} +20 -6
- package/dist/invitation-CBnQyB7o-DVOpS_Ts.mjs +3 -0
- package/dist/{saas-connect-vLyx73kJ.mjs → saas-connect-D-fy3xu-.mjs} +470 -172
- package/dist/web/assets/index-B33n1w2k.js +388 -0
- package/dist/web/assets/index-BR-pWR44.css +1 -0
- package/dist/web/assets/{index-FAu90ACE.js → index-DIgiOalZ.js} +4 -9
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/invitation-D3feYxet-366MNOor.mjs +0 -3
- package/dist/web/assets/index-5490TxIp.css +0 -1
- package/dist/web/assets/index-CJEdMYWd.js +0 -387
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
var e1=e=>{throw TypeError(e)};var Xm=(e,t,n)=>t.has(e)||e1("Cannot "+n);var I=(e,t,n)=>(Xm(e,t,"read from private field"),n?n.call(e):t.get(e)),ke=(e,t,n)=>t.has(e)?e1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ve=(e,t,n,a)=>(Xm(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Me=(e,t,n)=>(Xm(e,t,"access private method"),n);var yd=(e,t,n,a)=>({set _(l){ve(e,t,l,n)},get _(){return I(e,t,a)}});function I2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const o=Object.getOwnPropertyDescriptor(a,l);o&&Object.defineProperty(e,l,o.get?o:{enumerable:!0,get:()=>a[l]})}}}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 l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function ff(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},nu={};/**
|
|
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 t1;function U2(){if(t1)return nu;t1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,l,o){var c=null;if(o!==void 0&&(c=""+o),l.key!==void 0&&(c=""+l.key),"key"in l){o={};for(var f in l)f!=="key"&&(o[f]=l[f])}else o=l;return l=o.ref,{$$typeof:e,type:a,key:c,ref:l!==void 0?l:null,props:o}}return nu.Fragment=t,nu.jsx=n,nu.jsxs=n,nu}var n1;function P2(){return n1||(n1=1,Jm.exports=U2()),Jm.exports}var u=P2(),Wm={exports:{}},Fe={};/**
|
|
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 r1;function B2(){if(r1)return Fe;r1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function C(P,B,T){this.props=P,this.context=B,this.refs=E,this.updater=T||k}C.prototype.isReactComponent={},C.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,B,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function N(){}N.prototype=C.prototype;function z(P,B,T){this.props=P,this.context=B,this.refs=E,this.updater=T||k}var L=z.prototype=new N;L.constructor=z,j(L,C.prototype),L.isPureReactComponent=!0;var D=Array.isArray;function O(){}var M={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function X(P,B,T){var q=T.ref;return{$$typeof:e,type:P,key:B,ref:q!==void 0?q:null,props:T}}function F(P,B){return X(P.type,B,P.props)}function J(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function ee(P){var B={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(T){return B[T]})}var ye=/\/+/g;function he(P,B){return typeof P=="object"&&P!==null&&P.key!=null?ee(""+P.key):B.toString(36)}function ne(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(O,O):(P.status="pending",P.then(function(B){P.status==="pending"&&(P.status="fulfilled",P.value=B)},function(B){P.status==="pending"&&(P.status="rejected",P.reason=B)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function Z(P,B,T,q,K){var ce=typeof P;(ce==="undefined"||ce==="boolean")&&(P=null);var xe=!1;if(P===null)xe=!0;else switch(ce){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(P.$$typeof){case e:case t:xe=!0;break;case y:return xe=P._init,Z(xe(P._payload),B,T,q,K)}}if(xe)return K=K(P),xe=q===""?"."+he(P,0):q,D(K)?(T="",xe!=null&&(T=xe.replace(ye,"$&/")+"/"),Z(K,B,T,"",function(Xe){return Xe})):K!=null&&(J(K)&&(K=F(K,T+(K.key==null||P&&P.key===K.key?"":(""+K.key).replace(ye,"$&/")+"/")+xe)),B.push(K)),1;xe=0;var we=q===""?".":q+":";if(D(P))for(var pe=0;pe<P.length;pe++)q=P[pe],ce=we+he(q,pe),xe+=Z(q,B,T,ce,K);else if(pe=w(P),typeof pe=="function")for(P=pe.call(P),pe=0;!(q=P.next()).done;)q=q.value,ce=we+he(q,pe++),xe+=Z(q,B,T,ce,K);else if(ce==="object"){if(typeof P.then=="function")return Z(ne(P),B,T,q,K);throw B=String(P),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return xe}function te(P,B,T){if(P==null)return P;var q=[],K=0;return Z(P,q,"","",function(ce){return B.call(T,ce,K++)}),q}function ie(P){if(P._status===-1){var B=P._result;B=B(),B.then(function(T){(P._status===0||P._status===-1)&&(P._status=1,P._result=T)},function(T){(P._status===0||P._status===-1)&&(P._status=2,P._result=T)}),P._status===-1&&(P._status=0,P._result=B)}if(P._status===1)return P._result.default;throw P._result}var ue=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},A={map:te,forEach:function(P,B,T){te(P,function(){B.apply(this,arguments)},T)},count:function(P){var B=0;return te(P,function(){B++}),B},toArray:function(P){return te(P,function(B){return B})||[]},only:function(P){if(!J(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Fe.Activity=g,Fe.Children=A,Fe.Component=C,Fe.Fragment=n,Fe.Profiler=l,Fe.PureComponent=z,Fe.StrictMode=a,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return M.H.useMemoCache(P)}},Fe.cache=function(P){return function(){return P.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(P,B,T){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var q=j({},P.props),K=P.key;if(B!=null)for(ce in B.key!==void 0&&(K=""+B.key),B)!U.call(B,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&B.ref===void 0||(q[ce]=B[ce]);var ce=arguments.length-2;if(ce===1)q.children=T;else if(1<ce){for(var xe=Array(ce),we=0;we<ce;we++)xe[we]=arguments[we+2];q.children=xe}return X(P.type,K,q)},Fe.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},Fe.createElement=function(P,B,T){var q,K={},ce=null;if(B!=null)for(q in B.key!==void 0&&(ce=""+B.key),B)U.call(B,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(K[q]=B[q]);var xe=arguments.length-2;if(xe===1)K.children=T;else if(1<xe){for(var we=Array(xe),pe=0;pe<xe;pe++)we[pe]=arguments[pe+2];K.children=we}if(P&&P.defaultProps)for(q in xe=P.defaultProps,xe)K[q]===void 0&&(K[q]=xe[q]);return X(P,ce,K)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(P){return{$$typeof:f,render:P}},Fe.isValidElement=J,Fe.lazy=function(P){return{$$typeof:y,_payload:{_status:-1,_result:P},_init:ie}},Fe.memo=function(P,B){return{$$typeof:h,type:P,compare:B===void 0?null:B}},Fe.startTransition=function(P){var B=M.T,T={};M.T=T;try{var q=P(),K=M.S;K!==null&&K(T,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(O,ue)}catch(ce){ue(ce)}finally{B!==null&&T.types!==null&&(B.types=T.types),M.T=B}},Fe.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},Fe.use=function(P){return M.H.use(P)},Fe.useActionState=function(P,B,T){return M.H.useActionState(P,B,T)},Fe.useCallback=function(P,B){return M.H.useCallback(P,B)},Fe.useContext=function(P){return M.H.useContext(P)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(P,B){return M.H.useDeferredValue(P,B)},Fe.useEffect=function(P,B){return M.H.useEffect(P,B)},Fe.useEffectEvent=function(P){return M.H.useEffectEvent(P)},Fe.useId=function(){return M.H.useId()},Fe.useImperativeHandle=function(P,B,T){return M.H.useImperativeHandle(P,B,T)},Fe.useInsertionEffect=function(P,B){return M.H.useInsertionEffect(P,B)},Fe.useLayoutEffect=function(P,B){return M.H.useLayoutEffect(P,B)},Fe.useMemo=function(P,B){return M.H.useMemo(P,B)},Fe.useOptimistic=function(P,B){return M.H.useOptimistic(P,B)},Fe.useReducer=function(P,B,T){return M.H.useReducer(P,B,T)},Fe.useRef=function(P){return M.H.useRef(P)},Fe.useState=function(P){return M.H.useState(P)},Fe.useSyncExternalStore=function(P,B,T){return M.H.useSyncExternalStore(P,B,T)},Fe.useTransition=function(){return M.H.useTransition()},Fe.version="19.2.4",Fe}var a1;function Kg(){return a1||(a1=1,Wm.exports=B2()),Wm.exports}var x=Kg();const $2=ff(x),Yg=I2({__proto__:null,default:$2},[x]);var ep={exports:{}},ru={},tp={exports:{}},np={};/**
|
|
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 i1;function F2(){return i1||(i1=1,(function(e){function t(Z,te){var ie=Z.length;Z.push(te);e:for(;0<ie;){var ue=ie-1>>>1,A=Z[ue];if(0<l(A,te))Z[ue]=te,Z[ie]=A,ie=ue;else break e}}function n(Z){return Z.length===0?null:Z[0]}function a(Z){if(Z.length===0)return null;var te=Z[0],ie=Z.pop();if(ie!==te){Z[0]=ie;e:for(var ue=0,A=Z.length,P=A>>>1;ue<P;){var B=2*(ue+1)-1,T=Z[B],q=B+1,K=Z[q];if(0>l(T,ie))q<A&&0>l(K,T)?(Z[ue]=K,Z[q]=ie,ue=q):(Z[ue]=T,Z[B]=ie,ue=B);else if(q<A&&0>l(K,ie))Z[ue]=K,Z[q]=ie,ue=q;else break e}}return te}function l(Z,te){var ie=Z.sortIndex-te.sortIndex;return ie!==0?ie:Z.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],y=1,g=null,b=3,w=!1,k=!1,j=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function L(Z){for(var te=n(h);te!==null;){if(te.callback===null)a(h);else if(te.startTime<=Z)a(h),te.sortIndex=te.expirationTime,t(m,te);else break;te=n(h)}}function D(Z){if(j=!1,L(Z),!k)if(n(m)!==null)k=!0,O||(O=!0,ee());else{var te=n(h);te!==null&&ne(D,te.startTime-Z)}}var O=!1,M=-1,U=5,X=-1;function F(){return E?!0:!(e.unstable_now()-X<U)}function J(){if(E=!1,O){var Z=e.unstable_now();X=Z;var te=!0;try{e:{k=!1,j&&(j=!1,N(M),M=-1),w=!0;var ie=b;try{t:{for(L(Z),g=n(m);g!==null&&!(g.expirationTime>Z&&F());){var ue=g.callback;if(typeof ue=="function"){g.callback=null,b=g.priorityLevel;var A=ue(g.expirationTime<=Z);if(Z=e.unstable_now(),typeof A=="function"){g.callback=A,L(Z),te=!0;break t}g===n(m)&&a(m),L(Z)}else a(m);g=n(m)}if(g!==null)te=!0;else{var P=n(h);P!==null&&ne(D,P.startTime-Z),te=!1}}break e}finally{g=null,b=ie,w=!1}te=void 0}}finally{te?ee():O=!1}}}var ee;if(typeof z=="function")ee=function(){z(J)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,he=ye.port2;ye.port1.onmessage=J,ee=function(){he.postMessage(null)}}else ee=function(){C(J,0)};function ne(Z,te){M=C(function(){Z(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Z){Z.callback=null},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(Z){switch(b){case 1:case 2:case 3:var te=3;break;default:te=b}var ie=b;b=te;try{return Z()}finally{b=ie}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(Z,te){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var ie=b;b=Z;try{return te()}finally{b=ie}},e.unstable_scheduleCallback=function(Z,te,ie){var ue=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?ue+ie:ue):ie=ue,Z){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=ie+A,Z={id:y++,callback:te,priorityLevel:Z,startTime:ie,expirationTime:A,sortIndex:-1},ie>ue?(Z.sortIndex=ie,t(h,Z),n(m)===null&&Z===n(h)&&(j?(N(M),M=-1):j=!0,ne(D,ie-ue))):(Z.sortIndex=A,t(m,Z),k||w||(k=!0,O||(O=!0,ee()))),Z},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(Z){var te=b;return function(){var ie=b;b=te;try{return Z.apply(this,arguments)}finally{b=ie}}}})(np)),np}var l1;function q2(){return l1||(l1=1,tp.exports=F2()),tp.exports}var rp={exports:{}},Cn={};/**
|
|
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 s1;function H2(){if(s1)return Cn;s1=1;var e=Kg();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)h+="&args[]="+encodeURIComponent(arguments[y])}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},l=Symbol.for("react.portal");function o(m,h,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:h,implementation:y}}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 Cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Cn.createPortal=function(m,h){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,y)},Cn.flushSync=function(m){var h=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=y,a.d.f()}},Cn.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))},Cn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Cn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var y=h.as,g=f(y,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;y==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:w}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Cn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var y=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:y,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)},Cn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var y=h.as,g=f(y,h.crossOrigin);a.d.L(m,y,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Cn.preloadModule=function(m,h){if(typeof m=="string")if(h){var y=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Cn.requestFormReset=function(m){a.d.r(m)},Cn.unstable_batchedUpdates=function(m,h){return m(h)},Cn.useFormState=function(m,h,y){return c.H.useFormState(m,h,y)},Cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Cn.version="19.2.4",Cn}var o1;function GS(){if(o1)return rp.exports;o1=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(),rp.exports=H2(),rp.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 u1;function Z2(){if(u1)return ru;u1=1;var e=q2(),t=Kg(),n=GS();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}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 l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,s=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(s=i.return),r=i.return;while(r)}return i.tag===3?s:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var s=r,d=i;;){var p=s.return;if(p===null)break;var v=p.alternate;if(v===null){if(d=p.return,d!==null){s=d;continue}break}if(p.child===v.child){for(v=p.child;v;){if(v===s)return m(p),r;if(v===d)return m(p),i;v=v.sibling}throw Error(a(188))}if(s.return!==d.return)s=p,d=v;else{for(var S=!1,_=p.child;_;){if(_===s){S=!0,s=p,d=v;break}if(_===d){S=!0,d=p,s=v;break}_=_.sibling}if(!S){for(_=v.child;_;){if(_===s){S=!0,s=v,d=p;break}if(_===d){S=!0,d=v,s=p;break}_=_.sibling}if(!S)throw Error(a(189))}}if(s.alternate!==d)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?r:i}function y(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=y(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),z=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function ee(r){return r===null||typeof r!="object"?null:(r=J&&r[J]||r["@@iterator"],typeof r=="function"?r:null)}var ye=Symbol.for("react.client.reference");function he(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ye?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case D:return"Suspense";case O:return"SuspenseList";case X:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case z:return r.displayName||"Context";case N:return(r._context.displayName||"Context")+".Consumer";case L:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case M:return i=r.displayName||null,i!==null?i:he(r.type)||"Memo";case U:i=r._payload,r=r._init;try{return he(r(i))}catch{}}return null}var ne=Array.isArray,Z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ue=[],A=-1;function P(r){return{current:r}}function B(r){0>A||(r.current=ue[A],ue[A]=null,A--)}function T(r,i){A++,ue[A]=r.current,r.current=i}var q=P(null),K=P(null),ce=P(null),xe=P(null);function we(r,i){switch(T(ce,i),T(K,r),T(q,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?k0(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=k0(i),r=j0(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}B(q),T(q,r)}function pe(){B(q),B(K),B(ce)}function Xe(r){r.memoizedState!==null&&T(xe,r);var i=q.current,s=j0(i,r.type);i!==s&&(T(K,r),T(q,s))}function Le(r){K.current===r&&(B(q),B(K)),xe.current===r&&(B(xe),Jo._currentValue=ie)}var re,Ee;function Ie(r){if(re===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);re=i&&i[1]||"",Ee=-1<s.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+re+r+Ee}var Pe=!1;function Lt(r,i){if(!r||Pe)return"";Pe=!0;var s=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(W){var Y=W}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(W){Y=W}r.call(fe.prototype)}}else{try{throw Error()}catch(W){Y=W}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(W){if(W&&Y&&typeof W.stack=="string")return[W.stack,Y.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),S=v[0],_=v[1];if(S&&_){var $=S.split(`
|
|
44
|
+
`),G=_.split(`
|
|
45
|
+
`);for(p=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;p<G.length&&!G[p].includes("DetermineComponentFrameRoot");)p++;if(d===$.length||p===G.length)for(d=$.length-1,p=G.length-1;1<=d&&0<=p&&$[d]!==G[p];)p--;for(;1<=d&&0<=p;d--,p--)if($[d]!==G[p]){if(d!==1||p!==1)do if(d--,p--,0>p||$[d]!==G[p]){var ae=`
|
|
46
|
+
`+$[d].replace(" at new "," at ");return r.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",r.displayName)),ae}while(1<=d&&0<=p);break}}}finally{Pe=!1,Error.prepareStackTrace=s}return(s=r?r.displayName||r.name:"")?Ie(s):""}function hn(r,i){switch(r.tag){case 26:case 27:case 5:return Ie(r.type);case 16:return Ie("Lazy");case 13:return r.child!==i&&i!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return Lt(r.type,!1);case 11:return Lt(r.type.render,!1);case 1:return Lt(r.type,!0);case 31:return Ie("Activity");default:return""}}function _l(r){try{var i="",s=null;do i+=hn(r,s),s=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var Ma=Object.prototype.hasOwnProperty,La=e.unstable_scheduleCallback,na=e.unstable_cancelCallback,oo=e.unstable_shouldYield,uo=e.unstable_requestPaint,mn=e.unstable_now,co=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,$e=e.unstable_LowPriority,at=e.unstable_IdlePriority,pn=e.log,fr=e.unstable_setDisableYieldValue,nn=null,Zt=null;function gn(r){if(typeof pn=="function"&&fr(r),Zt&&typeof Zt.setStrictMode=="function")try{Zt.setStrictMode(nn,r)}catch{}}var ht=Math.clz32?Math.clz32:nc,zr=Math.log,Ln=Math.LN2;function nc(r){return r>>>=0,r===0?32:31-(zr(r)/Ln|0)|0}var Li=256,Ii=262144,Ui=4194304;function Pr(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 Pi(r,i,s){var d=r.pendingLanes;if(d===0)return 0;var p=0,v=r.suspendedLanes,S=r.pingedLanes;r=r.warmLanes;var _=d&134217727;return _!==0?(d=_&~v,d!==0?p=Pr(d):(S&=_,S!==0?p=Pr(S):s||(s=_&~r,s!==0&&(p=Pr(s))))):(_=d&~v,_!==0?p=Pr(_):S!==0?p=Pr(S):s||(s=d&~r,s!==0&&(p=Pr(s)))),p===0?0:i!==0&&i!==p&&(i&v)===0&&(v=p&-p,s=i&-i,v>=s||v===32&&(s&4194048)!==0)?i:p}function Ia(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function rc(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 Se(){var r=Ui;return Ui<<=1,(Ui&62914560)===0&&(Ui=4194304),r}function Je(r){for(var i=[],s=0;31>s;s++)i.push(r);return i}function yn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function ra(r,i,s,d,p,v){var S=r.pendingLanes;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=s,r.entangledLanes&=s,r.errorRecoveryDisabledLanes&=s,r.shellSuspendCounter=0;var _=r.entanglements,$=r.expirationTimes,G=r.hiddenUpdates;for(s=S&~s;0<s;){var ae=31-ht(s),fe=1<<ae;_[ae]=0,$[ae]=-1;var Y=G[ae];if(Y!==null)for(G[ae]=null,ae=0;ae<Y.length;ae++){var W=Y[ae];W!==null&&(W.lane&=-536870913)}s&=~fe}d!==0&&fo(r,d,0),v!==0&&p===0&&r.tag!==0&&(r.suspendedLanes|=v&~(S&~i))}function fo(r,i,s){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-ht(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|s&261930}function ac(r,i){var s=r.entangledLanes|=i;for(r=r.entanglements;s;){var d=31-ht(s),p=1<<d;p&i|r[d]&i&&(r[d]|=i),s&=~p}}function sv(r,i){var s=i&-i;return s=(s&42)!==0?1:Bf(s),(s&(r.suspendedLanes|i))!==0?0:s}function Bf(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 $f(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ov(){var r=te.p;return r!==0?r:(r=window.event,r===void 0?32:Q0(r.type))}function uv(r,i){var s=te.p;try{return te.p=r,i()}finally{te.p=s}}var Ua=Math.random().toString(36).slice(2),vn="__reactFiber$"+Ua,In="__reactProps$"+Ua,Tl="__reactContainer$"+Ua,Ff="__reactEvents$"+Ua,EN="__reactListeners$"+Ua,NN="__reactHandles$"+Ua,cv="__reactResources$"+Ua,ho="__reactMarker$"+Ua;function qf(r){delete r[vn],delete r[In],delete r[Ff],delete r[EN],delete r[NN]}function Al(r){var i=r[vn];if(i)return i;for(var s=r.parentNode;s;){if(i=s[Tl]||s[vn]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(r=R0(r);r!==null;){if(s=r[vn])return s;r=R0(r)}return i}r=s,s=r.parentNode}return null}function Rl(r){if(r=r[vn]||r[Tl]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function mo(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function zl(r){var i=r[cv];return i||(i=r[cv]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function on(r){r[ho]=!0}var dv=new Set,fv={};function Bi(r,i){Ol(r,i),Ol(r+"Capture",i)}function Ol(r,i){for(fv[r]=i,r=0;r<i.length;r++)dv.add(i[r])}var _N=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]*$"),hv={},mv={};function TN(r){return Ma.call(mv,r)?!0:Ma.call(hv,r)?!1:_N.test(r)?mv[r]=!0:(hv[r]=!0,!1)}function ic(r,i,s){if(TN(i))if(s===null)r.removeAttribute(i);else{switch(typeof s){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,""+s)}}function lc(r,i,s){if(s===null)r.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+s)}}function aa(r,i,s,d){if(d===null)r.removeAttribute(s);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttributeNS(i,s,""+d)}}function hr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pv(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function AN(r,i,s){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var p=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return p.call(this)},set:function(S){s=""+S,v.call(this,S)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Hf(r){if(!r._valueTracker){var i=pv(r)?"checked":"value";r._valueTracker=AN(r,i,""+r[i])}}function gv(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var s=i.getValue(),d="";return r&&(d=pv(r)?r.checked?"true":"false":r.value),r=d,r!==s?(i.setValue(r),!0):!1}function sc(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 RN=/[\n"\\]/g;function mr(r){return r.replace(RN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Zf(r,i,s,d,p,v,S,_){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=""+hr(i)):r.value!==""+hr(i)&&(r.value=""+hr(i)):S!=="submit"&&S!=="reset"||r.removeAttribute("value"),i!=null?Vf(r,S,hr(i)):s!=null?Vf(r,S,hr(s)):d!=null&&r.removeAttribute("value"),p==null&&v!=null&&(r.defaultChecked=!!v),p!=null&&(r.checked=p&&typeof p!="function"&&typeof p!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?r.name=""+hr(_):r.removeAttribute("name")}function yv(r,i,s,d,p,v,S,_){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||s!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Hf(r);return}s=s!=null?""+hr(s):"",i=i!=null?""+hr(i):s,_||i===r.value||(r.value=i),r.defaultValue=i}d=d??p,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=_?r.checked:!!d,r.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.name=S),Hf(r)}function Vf(r,i,s){i==="number"&&sc(r.ownerDocument)===r||r.defaultValue===""+s||(r.defaultValue=""+s)}function Dl(r,i,s,d){if(r=r.options,i){i={};for(var p=0;p<s.length;p++)i["$"+s[p]]=!0;for(s=0;s<r.length;s++)p=i.hasOwnProperty("$"+r[s].value),r[s].selected!==p&&(r[s].selected=p),p&&d&&(r[s].defaultSelected=!0)}else{for(s=""+hr(s),i=null,p=0;p<r.length;p++){if(r[p].value===s){r[p].selected=!0,d&&(r[p].defaultSelected=!0);return}i!==null||r[p].disabled||(i=r[p])}i!==null&&(i.selected=!0)}}function vv(r,i,s){if(i!=null&&(i=""+hr(i),i!==r.value&&(r.value=i),s==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=s!=null?""+hr(s):""}function bv(r,i,s,d){if(i==null){if(d!=null){if(s!=null)throw Error(a(92));if(ne(d)){if(1<d.length)throw Error(a(93));d=d[0]}s=d}s==null&&(s=""),i=s}s=hr(i),r.defaultValue=s,d=r.textContent,d===s&&d!==""&&d!==null&&(r.value=d),Hf(r)}function Ml(r,i){if(i){var s=r.firstChild;if(s&&s===r.lastChild&&s.nodeType===3){s.nodeValue=i;return}}r.textContent=i}var zN=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 xv(r,i,s){var d=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,s):typeof s!="number"||s===0||zN.has(i)?i==="float"?r.cssFloat=s:r[i]=(""+s).trim():r[i]=s+"px"}function wv(r,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,s!=null){for(var d in s)!s.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var p in i)d=i[p],i.hasOwnProperty(p)&&s[p]!==d&&xv(r,p,d)}else for(var v in i)i.hasOwnProperty(v)&&xv(r,v,i[v])}function Qf(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 ON=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"]]),DN=/^[\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 oc(r){return DN.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function ia(){}var Gf=null;function Kf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ll=null,Il=null;function Sv(r){var i=Rl(r);if(i&&(r=i.stateNode)){var s=r[In]||null;e:switch(r=i.stateNode,i.type){case"input":if(Zf(r,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=r;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+mr(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var d=s[i];if(d!==r&&d.form===r.form){var p=d[In]||null;if(!p)throw Error(a(90));Zf(d,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(i=0;i<s.length;i++)d=s[i],d.form===r.form&&gv(d)}break e;case"textarea":vv(r,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&Dl(r,!!s.multiple,i,!1)}}}var Yf=!1;function kv(r,i,s){if(Yf)return r(i,s);Yf=!0;try{var d=r(i);return d}finally{if(Yf=!1,(Ll!==null||Il!==null)&&(Kc(),Ll&&(i=Ll,r=Il,Il=Ll=null,Sv(i),r)))for(i=0;i<r.length;i++)Sv(r[i])}}function po(r,i){var s=r.stateNode;if(s===null)return null;var d=s[In]||null;if(d===null)return null;s=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(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var la=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xf=!1;if(la)try{var go={};Object.defineProperty(go,"passive",{get:function(){Xf=!0}}),window.addEventListener("test",go,go),window.removeEventListener("test",go,go)}catch{Xf=!1}var Pa=null,Jf=null,uc=null;function jv(){if(uc)return uc;var r,i=Jf,s=i.length,d,p="value"in Pa?Pa.value:Pa.textContent,v=p.length;for(r=0;r<s&&i[r]===p[r];r++);var S=s-r;for(d=1;d<=S&&i[s-d]===p[v-d];d++);return uc=p.slice(r,1<d?1-d:void 0)}function cc(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 dc(){return!0}function Cv(){return!1}function Un(r){function i(s,d,p,v,S){this._reactName=s,this._targetInst=p,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var _ in r)r.hasOwnProperty(_)&&(s=r[_],this[_]=s?s(v):v[_]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?dc:Cv,this.isPropagationStopped=Cv,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=dc)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=dc)},persist:function(){},isPersistent:dc}),i}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fc=Un($i),yo=g({},$i,{view:0,detail:0}),MN=Un(yo),Wf,eh,vo,hc=g({},yo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nh,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"?(Wf=r.screenX-vo.screenX,eh=r.screenY-vo.screenY):eh=Wf=0,vo=r),Wf)},movementY:function(r){return"movementY"in r?r.movementY:eh}}),Ev=Un(hc),LN=g({},hc,{dataTransfer:0}),IN=Un(LN),UN=g({},yo,{relatedTarget:0}),th=Un(UN),PN=g({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),BN=Un(PN),$N=g({},$i,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),FN=Un($N),qN=g({},$i,{data:0}),Nv=Un(qN),HN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZN={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"},VN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QN(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=VN[r])?!!i[r]:!1}function nh(){return QN}var GN=g({},yo,{key:function(r){if(r.key){var i=HN[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=cc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?ZN[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nh,charCode:function(r){return r.type==="keypress"?cc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?cc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),KN=Un(GN),YN=g({},hc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_v=Un(YN),XN=g({},yo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nh}),JN=Un(XN),WN=g({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),e_=Un(WN),t_=g({},hc,{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}),n_=Un(t_),r_=g({},$i,{newState:0,oldState:0}),a_=Un(r_),i_=[9,13,27,32],rh=la&&"CompositionEvent"in window,bo=null;la&&"documentMode"in document&&(bo=document.documentMode);var l_=la&&"TextEvent"in window&&!bo,Tv=la&&(!rh||bo&&8<bo&&11>=bo),Av=" ",Rv=!1;function zv(r,i){switch(r){case"keyup":return i_.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ov(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ul=!1;function s_(r,i){switch(r){case"compositionend":return Ov(i);case"keypress":return i.which!==32?null:(Rv=!0,Av);case"textInput":return r=i.data,r===Av&&Rv?null:r;default:return null}}function o_(r,i){if(Ul)return r==="compositionend"||!rh&&zv(r,i)?(r=jv(),uc=Jf=Pa=null,Ul=!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 Tv&&i.locale!=="ko"?null:i.data;default:return null}}var u_={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 Dv(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!u_[r.type]:i==="textarea"}function Mv(r,i,s,d){Ll?Il?Il.push(d):Il=[d]:Ll=d,i=nd(i,"onChange"),0<i.length&&(s=new fc("onChange","change",null,s,d),r.push({event:s,listeners:i}))}var xo=null,wo=null;function c_(r){y0(r,0)}function mc(r){var i=mo(r);if(gv(i))return r}function Lv(r,i){if(r==="change")return i}var Iv=!1;if(la){var ah;if(la){var ih="oninput"in document;if(!ih){var Uv=document.createElement("div");Uv.setAttribute("oninput","return;"),ih=typeof Uv.oninput=="function"}ah=ih}else ah=!1;Iv=ah&&(!document.documentMode||9<document.documentMode)}function Pv(){xo&&(xo.detachEvent("onpropertychange",Bv),wo=xo=null)}function Bv(r){if(r.propertyName==="value"&&mc(wo)){var i=[];Mv(i,wo,r,Kf(r)),kv(c_,i)}}function d_(r,i,s){r==="focusin"?(Pv(),xo=i,wo=s,xo.attachEvent("onpropertychange",Bv)):r==="focusout"&&Pv()}function f_(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return mc(wo)}function h_(r,i){if(r==="click")return mc(i)}function m_(r,i){if(r==="input"||r==="change")return mc(i)}function p_(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Xn=typeof Object.is=="function"?Object.is:p_;function So(r,i){if(Xn(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var s=Object.keys(r),d=Object.keys(i);if(s.length!==d.length)return!1;for(d=0;d<s.length;d++){var p=s[d];if(!Ma.call(i,p)||!Xn(r[p],i[p]))return!1}return!0}function $v(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Fv(r,i){var s=$v(r);r=0;for(var d;s;){if(s.nodeType===3){if(d=r+s.textContent.length,r<=i&&d>=i)return{node:s,offset:i-r};r=d}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=$v(s)}}function qv(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?qv(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Hv(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=sc(r.document);i instanceof r.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)r=i.contentWindow;else break;i=sc(r.document)}return i}function lh(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 g_=la&&"documentMode"in document&&11>=document.documentMode,Pl=null,sh=null,ko=null,oh=!1;function Zv(r,i,s){var d=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;oh||Pl==null||Pl!==sc(d)||(d=Pl,"selectionStart"in d&&lh(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),ko&&So(ko,d)||(ko=d,d=nd(sh,"onSelect"),0<d.length&&(i=new fc("onSelect","select",null,i,s),r.push({event:i,listeners:d}),i.target=Pl)))}function Fi(r,i){var s={};return s[r.toLowerCase()]=i.toLowerCase(),s["Webkit"+r]="webkit"+i,s["Moz"+r]="moz"+i,s}var Bl={animationend:Fi("Animation","AnimationEnd"),animationiteration:Fi("Animation","AnimationIteration"),animationstart:Fi("Animation","AnimationStart"),transitionrun:Fi("Transition","TransitionRun"),transitionstart:Fi("Transition","TransitionStart"),transitioncancel:Fi("Transition","TransitionCancel"),transitionend:Fi("Transition","TransitionEnd")},uh={},Vv={};la&&(Vv=document.createElement("div").style,"AnimationEvent"in window||(delete Bl.animationend.animation,delete Bl.animationiteration.animation,delete Bl.animationstart.animation),"TransitionEvent"in window||delete Bl.transitionend.transition);function qi(r){if(uh[r])return uh[r];if(!Bl[r])return r;var i=Bl[r],s;for(s in i)if(i.hasOwnProperty(s)&&s in Vv)return uh[r]=i[s];return r}var Qv=qi("animationend"),Gv=qi("animationiteration"),Kv=qi("animationstart"),y_=qi("transitionrun"),v_=qi("transitionstart"),b_=qi("transitioncancel"),Yv=qi("transitionend"),Xv=new Map,ch="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(" ");ch.push("scrollEnd");function Or(r,i){Xv.set(r,i),Bi(i,[r])}var pc=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)},pr=[],$l=0,dh=0;function gc(){for(var r=$l,i=dh=$l=0;i<r;){var s=pr[i];pr[i++]=null;var d=pr[i];pr[i++]=null;var p=pr[i];pr[i++]=null;var v=pr[i];if(pr[i++]=null,d!==null&&p!==null){var S=d.pending;S===null?p.next=p:(p.next=S.next,S.next=p),d.pending=p}v!==0&&Jv(s,p,v)}}function yc(r,i,s,d){pr[$l++]=r,pr[$l++]=i,pr[$l++]=s,pr[$l++]=d,dh|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function fh(r,i,s,d){return yc(r,i,s,d),vc(r)}function Hi(r,i){return yc(r,null,null,i),vc(r)}function Jv(r,i,s){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s);for(var p=!1,v=r.return;v!==null;)v.childLanes|=s,d=v.alternate,d!==null&&(d.childLanes|=s),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(p=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,p&&i!==null&&(p=31-ht(s),r=v.hiddenUpdates,d=r[p],d===null?r[p]=[i]:d.push(i),i.lane=s|536870912),v):null}function vc(r){if(50<Zo)throw Zo=0,wm=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Fl={};function x_(r,i,s,d){this.tag=r,this.key=s,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 Jn(r,i,s,d){return new x_(r,i,s,d)}function hh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function sa(r,i){var s=r.alternate;return s===null?(s=Jn(r.tag,i,r.key,r.mode),s.elementType=r.elementType,s.type=r.type,s.stateNode=r.stateNode,s.alternate=r,r.alternate=s):(s.pendingProps=i,s.type=r.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=r.flags&65011712,s.childLanes=r.childLanes,s.lanes=r.lanes,s.child=r.child,s.memoizedProps=r.memoizedProps,s.memoizedState=r.memoizedState,s.updateQueue=r.updateQueue,i=r.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=r.sibling,s.index=r.index,s.ref=r.ref,s.refCleanup=r.refCleanup,s}function Wv(r,i){r.flags&=65011714;var s=r.alternate;return s===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=s.childLanes,r.lanes=s.lanes,r.child=s.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=s.memoizedProps,r.memoizedState=s.memoizedState,r.updateQueue=s.updateQueue,r.type=s.type,i=s.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function bc(r,i,s,d,p,v){var S=0;if(d=r,typeof r=="function")hh(r)&&(S=1);else if(typeof r=="string")S=C2(r,s,q.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case X:return r=Jn(31,s,i,p),r.elementType=X,r.lanes=v,r;case j:return Zi(s.children,p,v,i);case E:S=8,p|=24;break;case C:return r=Jn(12,s,i,p|2),r.elementType=C,r.lanes=v,r;case D:return r=Jn(13,s,i,p),r.elementType=D,r.lanes=v,r;case O:return r=Jn(19,s,i,p),r.elementType=O,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case z:S=10;break e;case N:S=9;break e;case L:S=11;break e;case M:S=14;break e;case U:S=16,d=null;break e}S=29,s=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Jn(S,s,i,p),i.elementType=r,i.type=d,i.lanes=v,i}function Zi(r,i,s,d){return r=Jn(7,r,d,i),r.lanes=s,r}function mh(r,i,s){return r=Jn(6,r,null,i),r.lanes=s,r}function eb(r){var i=Jn(18,null,null,0);return i.stateNode=r,i}function ph(r,i,s){return i=Jn(4,r.children!==null?r.children:[],r.key,i),i.lanes=s,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var tb=new WeakMap;function gr(r,i){if(typeof r=="object"&&r!==null){var s=tb.get(r);return s!==void 0?s:(i={value:r,source:i,stack:_l(i)},tb.set(r,i),i)}return{value:r,source:i,stack:_l(i)}}var ql=[],Hl=0,xc=null,jo=0,yr=[],vr=0,Ba=null,Br=1,$r="";function oa(r,i){ql[Hl++]=jo,ql[Hl++]=xc,xc=r,jo=i}function nb(r,i,s){yr[vr++]=Br,yr[vr++]=$r,yr[vr++]=Ba,Ba=r;var d=Br;r=$r;var p=32-ht(d)-1;d&=~(1<<p),s+=1;var v=32-ht(i)+p;if(30<v){var S=p-p%5;v=(d&(1<<S)-1).toString(32),d>>=S,p-=S,Br=1<<32-ht(i)+p|s<<p|d,$r=v+r}else Br=1<<v|s<<p|d,$r=r}function gh(r){r.return!==null&&(oa(r,1),nb(r,1,0))}function yh(r){for(;r===xc;)xc=ql[--Hl],ql[Hl]=null,jo=ql[--Hl],ql[Hl]=null;for(;r===Ba;)Ba=yr[--vr],yr[vr]=null,$r=yr[--vr],yr[vr]=null,Br=yr[--vr],yr[vr]=null}function rb(r,i){yr[vr++]=Br,yr[vr++]=$r,yr[vr++]=Ba,Br=i.id,$r=i.overflow,Ba=r}var bn=null,Nt=null,it=!1,$a=null,br=!1,vh=Error(a(519));function Fa(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Co(gr(i,r)),vh}function ab(r){var i=r.stateNode,s=r.type,d=r.memoizedProps;switch(i[vn]=r,i[In]=d,s){case"dialog":et("cancel",i),et("close",i);break;case"iframe":case"object":case"embed":et("load",i);break;case"video":case"audio":for(s=0;s<Qo.length;s++)et(Qo[s],i);break;case"source":et("error",i);break;case"img":case"image":case"link":et("error",i),et("load",i);break;case"details":et("toggle",i);break;case"input":et("invalid",i),yv(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":et("invalid",i);break;case"textarea":et("invalid",i),bv(i,d.value,d.defaultValue,d.children)}s=d.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||d.suppressHydrationWarning===!0||w0(i.textContent,s)?(d.popover!=null&&(et("beforetoggle",i),et("toggle",i)),d.onScroll!=null&&et("scroll",i),d.onScrollEnd!=null&&et("scrollend",i),d.onClick!=null&&(i.onclick=ia),i=!0):i=!1,i||Fa(r,!0)}function ib(r){for(bn=r.return;bn;)switch(bn.tag){case 5:case 31:case 13:br=!1;return;case 27:case 3:br=!0;return;default:bn=bn.return}}function Zl(r){if(r!==bn)return!1;if(!it)return ib(r),it=!0,!1;var i=r.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=r.type,s=!(s!=="form"&&s!=="button")||Lm(r.type,r.memoizedProps)),s=!s),s&&Nt&&Fa(r),ib(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Nt=A0(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Nt=A0(r)}else i===27?(i=Nt,ni(r.type)?(r=$m,$m=null,Nt=r):Nt=i):Nt=bn?wr(r.stateNode.nextSibling):null;return!0}function Vi(){Nt=bn=null,it=!1}function bh(){var r=$a;return r!==null&&(Fn===null?Fn=r:Fn.push.apply(Fn,r),$a=null),r}function Co(r){$a===null?$a=[r]:$a.push(r)}var xh=P(null),Qi=null,ua=null;function qa(r,i,s){T(xh,i._currentValue),i._currentValue=s}function ca(r){r._currentValue=xh.current,B(xh)}function wh(r,i,s){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===s)break;r=r.return}}function Sh(r,i,s,d){var p=r.child;for(p!==null&&(p.return=r);p!==null;){var v=p.dependencies;if(v!==null){var S=p.child;v=v.firstContext;e:for(;v!==null;){var _=v;v=p;for(var $=0;$<i.length;$++)if(_.context===i[$]){v.lanes|=s,_=v.alternate,_!==null&&(_.lanes|=s),wh(v.return,s,r),d||(S=null);break e}v=_.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(a(341));S.lanes|=s,v=S.alternate,v!==null&&(v.lanes|=s),wh(S,s,r),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===r){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function Vl(r,i,s,d){r=null;for(var p=i,v=!1;p!==null;){if(!v){if((p.flags&524288)!==0)v=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var _=p.type;Xn(p.pendingProps.value,S.value)||(r!==null?r.push(_):r=[_])}}else if(p===xe.current){if(S=p.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(r!==null?r.push(Jo):r=[Jo])}p=p.return}r!==null&&Sh(i,r,s,d),i.flags|=262144}function wc(r){for(r=r.firstContext;r!==null;){if(!Xn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Gi(r){Qi=r,ua=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function xn(r){return lb(Qi,r)}function Sc(r,i){return Qi===null&&Gi(r),lb(r,i)}function lb(r,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},ua===null){if(r===null)throw Error(a(308));ua=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else ua=ua.next=i;return s}var w_=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(s,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(s){return s()})}},S_=e.unstable_scheduleCallback,k_=e.unstable_NormalPriority,Kt={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kh(){return{controller:new w_,data:new Map,refCount:0}}function Eo(r){r.refCount--,r.refCount===0&&S_(k_,function(){r.controller.abort()})}var No=null,jh=0,Ql=0,Gl=null;function j_(r,i){if(No===null){var s=No=[];jh=0,Ql=Nm(),Gl={status:"pending",value:void 0,then:function(d){s.push(d)}}}return jh++,i.then(sb,sb),i}function sb(){if(--jh===0&&No!==null){Gl!==null&&(Gl.status="fulfilled");var r=No;No=null,Ql=0,Gl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function C_(r,i){var s=[],d={status:"pending",value:null,reason:null,then:function(p){s.push(p)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var p=0;p<s.length;p++)(0,s[p])(i)},function(p){for(d.status="rejected",d.reason=p,p=0;p<s.length;p++)(0,s[p])(void 0)}),d}var ob=Z.S;Z.S=function(r,i){Zx=mn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&j_(r,i),ob!==null&&ob(r,i)};var Ki=P(null);function Ch(){var r=Ki.current;return r!==null?r:kt.pooledCache}function kc(r,i){i===null?T(Ki,Ki.current):T(Ki,i.pool)}function ub(){var r=Ch();return r===null?null:{parent:Kt._currentValue,pool:r}}var Kl=Error(a(460)),Eh=Error(a(474)),jc=Error(a(542)),Cc={then:function(){}};function cb(r){return r=r.status,r==="fulfilled"||r==="rejected"}function db(r,i,s){switch(s=r[s],s===void 0?r.push(i):s!==i&&(i.then(ia,ia),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,hb(r),r;default:if(typeof i.status=="string")i.then(ia,ia);else{if(r=kt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var p=i;p.status="fulfilled",p.value=d}},function(d){if(i.status==="pending"){var p=i;p.status="rejected",p.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,hb(r),r}throw Xi=i,Kl}}function Yi(r){try{var i=r._init;return i(r._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Xi=s,Kl):s}}var Xi=null;function fb(){if(Xi===null)throw Error(a(459));var r=Xi;return Xi=null,r}function hb(r){if(r===Kl||r===jc)throw Error(a(483))}var Yl=null,_o=0;function Ec(r){var i=_o;return _o+=1,Yl===null&&(Yl=[]),db(Yl,r,i)}function To(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Nc(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 mb(r){function i(V,H){if(r){var Q=V.deletions;Q===null?(V.deletions=[H],V.flags|=16):Q.push(H)}}function s(V,H){if(!r)return null;for(;H!==null;)i(V,H),H=H.sibling;return null}function d(V){for(var H=new Map;V!==null;)V.key!==null?H.set(V.key,V):H.set(V.index,V),V=V.sibling;return H}function p(V,H){return V=sa(V,H),V.index=0,V.sibling=null,V}function v(V,H,Q){return V.index=Q,r?(Q=V.alternate,Q!==null?(Q=Q.index,Q<H?(V.flags|=67108866,H):Q):(V.flags|=67108866,H)):(V.flags|=1048576,H)}function S(V){return r&&V.alternate===null&&(V.flags|=67108866),V}function _(V,H,Q,oe){return H===null||H.tag!==6?(H=mh(Q,V.mode,oe),H.return=V,H):(H=p(H,Q),H.return=V,H)}function $(V,H,Q,oe){var ze=Q.type;return ze===j?ae(V,H,Q.props.children,oe,Q.key):H!==null&&(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&Yi(ze)===H.type)?(H=p(H,Q.props),To(H,Q),H.return=V,H):(H=bc(Q.type,Q.key,Q.props,null,V.mode,oe),To(H,Q),H.return=V,H)}function G(V,H,Q,oe){return H===null||H.tag!==4||H.stateNode.containerInfo!==Q.containerInfo||H.stateNode.implementation!==Q.implementation?(H=ph(Q,V.mode,oe),H.return=V,H):(H=p(H,Q.children||[]),H.return=V,H)}function ae(V,H,Q,oe,ze){return H===null||H.tag!==7?(H=Zi(Q,V.mode,oe,ze),H.return=V,H):(H=p(H,Q),H.return=V,H)}function fe(V,H,Q){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=mh(""+H,V.mode,Q),H.return=V,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return Q=bc(H.type,H.key,H.props,null,V.mode,Q),To(Q,H),Q.return=V,Q;case k:return H=ph(H,V.mode,Q),H.return=V,H;case U:return H=Yi(H),fe(V,H,Q)}if(ne(H)||ee(H))return H=Zi(H,V.mode,Q,null),H.return=V,H;if(typeof H.then=="function")return fe(V,Ec(H),Q);if(H.$$typeof===z)return fe(V,Sc(V,H),Q);Nc(V,H)}return null}function Y(V,H,Q,oe){var ze=H!==null?H.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return ze!==null?null:_(V,H,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===ze?$(V,H,Q,oe):null;case k:return Q.key===ze?G(V,H,Q,oe):null;case U:return Q=Yi(Q),Y(V,H,Q,oe)}if(ne(Q)||ee(Q))return ze!==null?null:ae(V,H,Q,oe,null);if(typeof Q.then=="function")return Y(V,H,Ec(Q),oe);if(Q.$$typeof===z)return Y(V,H,Sc(V,Q),oe);Nc(V,Q)}return null}function W(V,H,Q,oe,ze){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return V=V.get(Q)||null,_(H,V,""+oe,ze);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case w:return V=V.get(oe.key===null?Q:oe.key)||null,$(H,V,oe,ze);case k:return V=V.get(oe.key===null?Q:oe.key)||null,G(H,V,oe,ze);case U:return oe=Yi(oe),W(V,H,Q,oe,ze)}if(ne(oe)||ee(oe))return V=V.get(Q)||null,ae(H,V,oe,ze,null);if(typeof oe.then=="function")return W(V,H,Q,Ec(oe),ze);if(oe.$$typeof===z)return W(V,H,Q,Sc(H,oe),ze);Nc(H,oe)}return null}function Ce(V,H,Q,oe){for(var ze=null,ct=null,Te=H,Qe=H=0,rt=null;Te!==null&&Qe<Q.length;Qe++){Te.index>Qe?(rt=Te,Te=null):rt=Te.sibling;var dt=Y(V,Te,Q[Qe],oe);if(dt===null){Te===null&&(Te=rt);break}r&&Te&&dt.alternate===null&&i(V,Te),H=v(dt,H,Qe),ct===null?ze=dt:ct.sibling=dt,ct=dt,Te=rt}if(Qe===Q.length)return s(V,Te),it&&oa(V,Qe),ze;if(Te===null){for(;Qe<Q.length;Qe++)Te=fe(V,Q[Qe],oe),Te!==null&&(H=v(Te,H,Qe),ct===null?ze=Te:ct.sibling=Te,ct=Te);return it&&oa(V,Qe),ze}for(Te=d(Te);Qe<Q.length;Qe++)rt=W(Te,V,Qe,Q[Qe],oe),rt!==null&&(r&&rt.alternate!==null&&Te.delete(rt.key===null?Qe:rt.key),H=v(rt,H,Qe),ct===null?ze=rt:ct.sibling=rt,ct=rt);return r&&Te.forEach(function(si){return i(V,si)}),it&&oa(V,Qe),ze}function De(V,H,Q,oe){if(Q==null)throw Error(a(151));for(var ze=null,ct=null,Te=H,Qe=H=0,rt=null,dt=Q.next();Te!==null&&!dt.done;Qe++,dt=Q.next()){Te.index>Qe?(rt=Te,Te=null):rt=Te.sibling;var si=Y(V,Te,dt.value,oe);if(si===null){Te===null&&(Te=rt);break}r&&Te&&si.alternate===null&&i(V,Te),H=v(si,H,Qe),ct===null?ze=si:ct.sibling=si,ct=si,Te=rt}if(dt.done)return s(V,Te),it&&oa(V,Qe),ze;if(Te===null){for(;!dt.done;Qe++,dt=Q.next())dt=fe(V,dt.value,oe),dt!==null&&(H=v(dt,H,Qe),ct===null?ze=dt:ct.sibling=dt,ct=dt);return it&&oa(V,Qe),ze}for(Te=d(Te);!dt.done;Qe++,dt=Q.next())dt=W(Te,V,Qe,dt.value,oe),dt!==null&&(r&&dt.alternate!==null&&Te.delete(dt.key===null?Qe:dt.key),H=v(dt,H,Qe),ct===null?ze=dt:ct.sibling=dt,ct=dt);return r&&Te.forEach(function(L2){return i(V,L2)}),it&&oa(V,Qe),ze}function xt(V,H,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===j&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var ze=Q.key;H!==null;){if(H.key===ze){if(ze=Q.type,ze===j){if(H.tag===7){s(V,H.sibling),oe=p(H,Q.props.children),oe.return=V,V=oe;break e}}else if(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&Yi(ze)===H.type){s(V,H.sibling),oe=p(H,Q.props),To(oe,Q),oe.return=V,V=oe;break e}s(V,H);break}else i(V,H);H=H.sibling}Q.type===j?(oe=Zi(Q.props.children,V.mode,oe,Q.key),oe.return=V,V=oe):(oe=bc(Q.type,Q.key,Q.props,null,V.mode,oe),To(oe,Q),oe.return=V,V=oe)}return S(V);case k:e:{for(ze=Q.key;H!==null;){if(H.key===ze)if(H.tag===4&&H.stateNode.containerInfo===Q.containerInfo&&H.stateNode.implementation===Q.implementation){s(V,H.sibling),oe=p(H,Q.children||[]),oe.return=V,V=oe;break e}else{s(V,H);break}else i(V,H);H=H.sibling}oe=ph(Q,V.mode,oe),oe.return=V,V=oe}return S(V);case U:return Q=Yi(Q),xt(V,H,Q,oe)}if(ne(Q))return Ce(V,H,Q,oe);if(ee(Q)){if(ze=ee(Q),typeof ze!="function")throw Error(a(150));return Q=ze.call(Q),De(V,H,Q,oe)}if(typeof Q.then=="function")return xt(V,H,Ec(Q),oe);if(Q.$$typeof===z)return xt(V,H,Sc(V,Q),oe);Nc(V,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,H!==null&&H.tag===6?(s(V,H.sibling),oe=p(H,Q),oe.return=V,V=oe):(s(V,H),oe=mh(Q,V.mode,oe),oe.return=V,V=oe),S(V)):s(V,H)}return function(V,H,Q,oe){try{_o=0;var ze=xt(V,H,Q,oe);return Yl=null,ze}catch(Te){if(Te===Kl||Te===jc)throw Te;var ct=Jn(29,Te,null,V.mode);return ct.lanes=oe,ct.return=V,ct}finally{}}}var Ji=mb(!0),pb=mb(!1),Ha=!1;function Nh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _h(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 Za(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Va(r,i,s){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ft&2)!==0){var p=d.pending;return p===null?i.next=i:(i.next=p.next,p.next=i),d.pending=i,i=vc(r),Jv(r,null,s),i}return yc(r,d,i,s),vc(r)}function Ao(r,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,s|=d,i.lanes=s,ac(r,s)}}function Th(r,i){var s=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,s===d)){var p=null,v=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};v===null?p=v=S:v=v.next=S,s=s.next}while(s!==null);v===null?p=v=i:v=v.next=i}else p=v=i;s={baseState:d.baseState,firstBaseUpdate:p,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=s;return}r=s.lastBaseUpdate,r===null?s.firstBaseUpdate=i:r.next=i,s.lastBaseUpdate=i}var Ah=!1;function Ro(){if(Ah){var r=Gl;if(r!==null)throw r}}function zo(r,i,s,d){Ah=!1;var p=r.updateQueue;Ha=!1;var v=p.firstBaseUpdate,S=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var $=_,G=$.next;$.next=null,S===null?v=G:S.next=G,S=$;var ae=r.alternate;ae!==null&&(ae=ae.updateQueue,_=ae.lastBaseUpdate,_!==S&&(_===null?ae.firstBaseUpdate=G:_.next=G,ae.lastBaseUpdate=$))}if(v!==null){var fe=p.baseState;S=0,ae=G=$=null,_=v;do{var Y=_.lane&-536870913,W=Y!==_.lane;if(W?(nt&Y)===Y:(d&Y)===Y){Y!==0&&Y===Ql&&(Ah=!0),ae!==null&&(ae=ae.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ce=r,De=_;Y=i;var xt=s;switch(De.tag){case 1:if(Ce=De.payload,typeof Ce=="function"){fe=Ce.call(xt,fe,Y);break e}fe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=De.payload,Y=typeof Ce=="function"?Ce.call(xt,fe,Y):Ce,Y==null)break e;fe=g({},fe,Y);break e;case 2:Ha=!0}}Y=_.callback,Y!==null&&(r.flags|=64,W&&(r.flags|=8192),W=p.callbacks,W===null?p.callbacks=[Y]:W.push(Y))}else W={lane:Y,tag:_.tag,payload:_.payload,callback:_.callback,next:null},ae===null?(G=ae=W,$=fe):ae=ae.next=W,S|=Y;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;W=_,_=W.next,W.next=null,p.lastBaseUpdate=W,p.shared.pending=null}}while(!0);ae===null&&($=fe),p.baseState=$,p.firstBaseUpdate=G,p.lastBaseUpdate=ae,v===null&&(p.shared.lanes=0),Xa|=S,r.lanes=S,r.memoizedState=fe}}function gb(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function yb(r,i){var s=r.callbacks;if(s!==null)for(r.callbacks=null,r=0;r<s.length;r++)gb(s[r],i)}var Xl=P(null),_c=P(0);function vb(r,i){r=ba,T(_c,r),T(Xl,i),ba=r|i.baseLanes}function Rh(){T(_c,ba),T(Xl,Xl.current)}function zh(){ba=_c.current,B(Xl),B(_c)}var Wn=P(null),xr=null;function Qa(r){var i=r.alternate;T(Vt,Vt.current&1),T(Wn,r),xr===null&&(i===null||Xl.current!==null||i.memoizedState!==null)&&(xr=r)}function Oh(r){T(Vt,Vt.current),T(Wn,r),xr===null&&(xr=r)}function bb(r){r.tag===22?(T(Vt,Vt.current),T(Wn,r),xr===null&&(xr=r)):Ga()}function Ga(){T(Vt,Vt.current),T(Wn,Wn.current)}function er(r){B(Wn),xr===r&&(xr=null),B(Vt)}var Vt=P(0);function Tc(r){for(var i=r;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Pm(s)||Bm(s)))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 da=0,Ze=null,vt=null,Yt=null,Ac=!1,Jl=!1,Wi=!1,Rc=0,Oo=0,Wl=null,E_=0;function It(){throw Error(a(321))}function Dh(r,i){if(i===null)return!1;for(var s=0;s<i.length&&s<r.length;s++)if(!Xn(r[s],i[s]))return!1;return!0}function Mh(r,i,s,d,p,v){return da=v,Ze=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Z.H=r===null||r.memoizedState===null?nx:Yh,Wi=!1,v=s(d,p),Wi=!1,Jl&&(v=wb(i,s,d,p)),xb(r),v}function xb(r){Z.H=Lo;var i=vt!==null&&vt.next!==null;if(da=0,Yt=vt=Ze=null,Ac=!1,Oo=0,Wl=null,i)throw Error(a(300));r===null||Xt||(r=r.dependencies,r!==null&&wc(r)&&(Xt=!0))}function wb(r,i,s,d){Ze=r;var p=0;do{if(Jl&&(Wl=null),Oo=0,Jl=!1,25<=p)throw Error(a(301));if(p+=1,Yt=vt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}Z.H=rx,v=i(s,d)}while(Jl);return v}function N_(){var r=Z.H,i=r.useState()[0];return i=typeof i.then=="function"?Do(i):i,r=r.useState()[0],(vt!==null?vt.memoizedState:null)!==r&&(Ze.flags|=1024),i}function Lh(){var r=Rc!==0;return Rc=0,r}function Ih(r,i,s){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~s}function Uh(r){if(Ac){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Ac=!1}da=0,Yt=vt=Ze=null,Jl=!1,Oo=Rc=0,Wl=null}function Rn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?Ze.memoizedState=Yt=r:Yt=Yt.next=r,Yt}function Qt(){if(vt===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=vt.next;var i=Yt===null?Ze.memoizedState:Yt.next;if(i!==null)Yt=i,vt=r;else{if(r===null)throw Ze.alternate===null?Error(a(467)):Error(a(310));vt=r,r={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Yt===null?Ze.memoizedState=Yt=r:Yt=Yt.next=r}return Yt}function zc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(r){var i=Oo;return Oo+=1,Wl===null&&(Wl=[]),r=db(Wl,r,i),i=Ze,(Yt===null?i.memoizedState:Yt.next)===null&&(i=i.alternate,Z.H=i===null||i.memoizedState===null?nx:Yh),r}function Oc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Do(r);if(r.$$typeof===z)return xn(r)}throw Error(a(438,String(r)))}function Ph(r){var i=null,s=Ze.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var d=Ze.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(p){return p.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),s===null&&(s=zc(),Ze.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(r),d=0;d<r;d++)s[d]=F;return i.index++,s}function fa(r,i){return typeof i=="function"?i(r):i}function Dc(r){var i=Qt();return Bh(i,vt,r)}function Bh(r,i,s){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=s;var p=r.baseQueue,v=d.pending;if(v!==null){if(p!==null){var S=p.next;p.next=v.next,v.next=S}i.baseQueue=p=v,d.pending=null}if(v=r.baseState,p===null)r.memoizedState=v;else{i=p.next;var _=S=null,$=null,G=i,ae=!1;do{var fe=G.lane&-536870913;if(fe!==G.lane?(nt&fe)===fe:(da&fe)===fe){var Y=G.revertLane;if(Y===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),fe===Ql&&(ae=!0);else if((da&Y)===Y){G=G.next,Y===Ql&&(ae=!0);continue}else fe={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},$===null?(_=$=fe,S=v):$=$.next=fe,Ze.lanes|=Y,Xa|=Y;fe=G.action,Wi&&s(v,fe),v=G.hasEagerState?G.eagerState:s(v,fe)}else Y={lane:fe,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},$===null?(_=$=Y,S=v):$=$.next=Y,Ze.lanes|=fe,Xa|=fe;G=G.next}while(G!==null&&G!==i);if($===null?S=v:$.next=_,!Xn(v,r.memoizedState)&&(Xt=!0,ae&&(s=Gl,s!==null)))throw s;r.memoizedState=v,r.baseState=S,r.baseQueue=$,d.lastRenderedState=v}return p===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function $h(r){var i=Qt(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=r;var d=s.dispatch,p=s.pending,v=i.memoizedState;if(p!==null){s.pending=null;var S=p=p.next;do v=r(v,S.action),S=S.next;while(S!==p);Xn(v,i.memoizedState)||(Xt=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),s.lastRenderedState=v}return[v,d]}function Sb(r,i,s){var d=Ze,p=Qt(),v=it;if(v){if(s===void 0)throw Error(a(407));s=s()}else s=i();var S=!Xn((vt||p).memoizedState,s);if(S&&(p.memoizedState=s,Xt=!0),p=p.queue,Hh(Cb.bind(null,d,p,r),[r]),p.getSnapshot!==i||S||Yt!==null&&Yt.memoizedState.tag&1){if(d.flags|=2048,es(9,{destroy:void 0},jb.bind(null,d,p,s,i),null),kt===null)throw Error(a(349));v||(da&127)!==0||kb(d,i,s)}return s}function kb(r,i,s){r.flags|=16384,r={getSnapshot:i,value:s},i=Ze.updateQueue,i===null?(i=zc(),Ze.updateQueue=i,i.stores=[r]):(s=i.stores,s===null?i.stores=[r]:s.push(r))}function jb(r,i,s,d){i.value=s,i.getSnapshot=d,Eb(i)&&Nb(r)}function Cb(r,i,s){return s(function(){Eb(i)&&Nb(r)})}function Eb(r){var i=r.getSnapshot;r=r.value;try{var s=i();return!Xn(r,s)}catch{return!0}}function Nb(r){var i=Hi(r,2);i!==null&&qn(i,r,2)}function Fh(r){var i=Rn();if(typeof r=="function"){var s=r;if(r=s(),Wi){gn(!0);try{s()}finally{gn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:r},i}function _b(r,i,s,d){return r.baseState=s,Bh(r,vt,typeof d=="function"?d:fa)}function __(r,i,s,d,p){if(Ic(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:p,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};Z.T!==null?s(!0):v.isTransition=!1,d(v),s=i.pending,s===null?(v.next=i.pending=v,Tb(i,v)):(v.next=s.next,i.pending=s.next=v)}}function Tb(r,i){var s=i.action,d=i.payload,p=r.state;if(i.isTransition){var v=Z.T,S={};Z.T=S;try{var _=s(p,d),$=Z.S;$!==null&&$(S,_),Ab(r,i,_)}catch(G){qh(r,i,G)}finally{v!==null&&S.types!==null&&(v.types=S.types),Z.T=v}}else try{v=s(p,d),Ab(r,i,v)}catch(G){qh(r,i,G)}}function Ab(r,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(d){Rb(r,i,d)},function(d){return qh(r,i,d)}):Rb(r,i,s)}function Rb(r,i,s){i.status="fulfilled",i.value=s,zb(i),r.state=s,i=r.pending,i!==null&&(s=i.next,s===i?r.pending=null:(s=s.next,i.next=s,Tb(r,s)))}function qh(r,i,s){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=s,zb(i),i=i.next;while(i!==d)}r.action=null}function zb(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Ob(r,i){return i}function Db(r,i){if(it){var s=kt.formState;if(s!==null){e:{var d=Ze;if(it){if(Nt){t:{for(var p=Nt,v=br;p.nodeType!==8;){if(!v){p=null;break t}if(p=wr(p.nextSibling),p===null){p=null;break t}}v=p.data,p=v==="F!"||v==="F"?p:null}if(p){Nt=wr(p.nextSibling),d=p.data==="F!";break e}}Fa(d)}d=!1}d&&(i=s[0])}}return s=Rn(),s.memoizedState=s.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ob,lastRenderedState:i},s.queue=d,s=Wb.bind(null,Ze,d),d.dispatch=s,d=Fh(!1),v=Kh.bind(null,Ze,!1,d.queue),d=Rn(),p={state:i,dispatch:null,action:r,pending:null},d.queue=p,s=__.bind(null,Ze,p,v,s),p.dispatch=s,d.memoizedState=r,[i,s,!1]}function Mb(r){var i=Qt();return Lb(i,vt,r)}function Lb(r,i,s){if(i=Bh(r,i,Ob)[0],r=Dc(fa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=Do(i)}catch(S){throw S===Kl?jc:S}else d=i;i=Qt();var p=i.queue,v=p.dispatch;return s!==i.memoizedState&&(Ze.flags|=2048,es(9,{destroy:void 0},T_.bind(null,p,s),null)),[d,v,r]}function T_(r,i){r.action=i}function Ib(r){var i=Qt(),s=vt;if(s!==null)return Lb(i,s,r);Qt(),i=i.memoizedState,s=Qt();var d=s.queue.dispatch;return s.memoizedState=r,[i,d,!1]}function es(r,i,s,d){return r={tag:r,create:s,deps:d,inst:i,next:null},i=Ze.updateQueue,i===null&&(i=zc(),Ze.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=r.next=r:(d=s.next,s.next=r,r.next=d,i.lastEffect=r),r}function Ub(){return Qt().memoizedState}function Mc(r,i,s,d){var p=Rn();Ze.flags|=r,p.memoizedState=es(1|i,{destroy:void 0},s,d===void 0?null:d)}function Lc(r,i,s,d){var p=Qt();d=d===void 0?null:d;var v=p.memoizedState.inst;vt!==null&&d!==null&&Dh(d,vt.memoizedState.deps)?p.memoizedState=es(i,v,s,d):(Ze.flags|=r,p.memoizedState=es(1|i,v,s,d))}function Pb(r,i){Mc(8390656,8,r,i)}function Hh(r,i){Lc(2048,8,r,i)}function A_(r){Ze.flags|=4;var i=Ze.updateQueue;if(i===null)i=zc(),Ze.updateQueue=i,i.events=[r];else{var s=i.events;s===null?i.events=[r]:s.push(r)}}function Bb(r){var i=Qt().memoizedState;return A_({ref:i,nextImpl:r}),function(){if((ft&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function $b(r,i){return Lc(4,2,r,i)}function Fb(r,i){return Lc(4,4,r,i)}function qb(r,i){if(typeof i=="function"){r=r();var s=i(r);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function Hb(r,i,s){s=s!=null?s.concat([r]):null,Lc(4,4,qb.bind(null,i,r),s)}function Zh(){}function Zb(r,i){var s=Qt();i=i===void 0?null:i;var d=s.memoizedState;return i!==null&&Dh(i,d[1])?d[0]:(s.memoizedState=[r,i],r)}function Vb(r,i){var s=Qt();i=i===void 0?null:i;var d=s.memoizedState;if(i!==null&&Dh(i,d[1]))return d[0];if(d=r(),Wi){gn(!0);try{r()}finally{gn(!1)}}return s.memoizedState=[d,i],d}function Vh(r,i,s){return s===void 0||(da&1073741824)!==0&&(nt&261930)===0?r.memoizedState=i:(r.memoizedState=s,r=Qx(),Ze.lanes|=r,Xa|=r,s)}function Qb(r,i,s,d){return Xn(s,i)?s:Xl.current!==null?(r=Vh(r,s,d),Xn(r,i)||(Xt=!0),r):(da&42)===0||(da&1073741824)!==0&&(nt&261930)===0?(Xt=!0,r.memoizedState=s):(r=Qx(),Ze.lanes|=r,Xa|=r,i)}function Gb(r,i,s,d,p){var v=te.p;te.p=v!==0&&8>v?v:8;var S=Z.T,_={};Z.T=_,Kh(r,!1,i,s);try{var $=p(),G=Z.S;if(G!==null&&G(_,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ae=C_($,d);Mo(r,i,ae,rr(r))}else Mo(r,i,d,rr(r))}catch(fe){Mo(r,i,{then:function(){},status:"rejected",reason:fe},rr())}finally{te.p=v,S!==null&&_.types!==null&&(S.types=_.types),Z.T=S}}function R_(){}function Qh(r,i,s,d){if(r.tag!==5)throw Error(a(476));var p=Kb(r).queue;Gb(r,p,i,ie,s===null?R_:function(){return Yb(r),s(d)})}function Kb(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:ie},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:s},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function Yb(r){var i=Kb(r);i.next===null&&(i=r.alternate.memoizedState),Mo(r,i.next.queue,{},rr())}function Gh(){return xn(Jo)}function Xb(){return Qt().memoizedState}function Jb(){return Qt().memoizedState}function z_(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var s=rr();r=Za(s);var d=Va(i,r,s);d!==null&&(qn(d,i,s),Ao(d,i,s)),i={cache:kh()},r.payload=i;return}i=i.return}}function O_(r,i,s){var d=rr();s={lane:d,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ic(r)?ex(i,s):(s=fh(r,i,s,d),s!==null&&(qn(s,r,d),tx(s,i,d)))}function Wb(r,i,s){var d=rr();Mo(r,i,s,d)}function Mo(r,i,s,d){var p={lane:d,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Ic(r))ex(i,p);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,_=v(S,s);if(p.hasEagerState=!0,p.eagerState=_,Xn(_,S))return yc(r,i,p,0),kt===null&&gc(),!1}catch{}finally{}if(s=fh(r,i,p,d),s!==null)return qn(s,r,d),tx(s,i,d),!0}return!1}function Kh(r,i,s,d){if(d={lane:2,revertLane:Nm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ic(r)){if(i)throw Error(a(479))}else i=fh(r,s,d,2),i!==null&&qn(i,r,2)}function Ic(r){var i=r.alternate;return r===Ze||i!==null&&i===Ze}function ex(r,i){Jl=Ac=!0;var s=r.pending;s===null?i.next=i:(i.next=s.next,s.next=i),r.pending=i}function tx(r,i,s){if((s&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,s|=d,i.lanes=s,ac(r,s)}}var Lo={readContext:xn,use:Oc,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};Lo.useEffectEvent=It;var nx={readContext:xn,use:Oc,useCallback:function(r,i){return Rn().memoizedState=[r,i===void 0?null:i],r},useContext:xn,useEffect:Pb,useImperativeHandle:function(r,i,s){s=s!=null?s.concat([r]):null,Mc(4194308,4,qb.bind(null,i,r),s)},useLayoutEffect:function(r,i){return Mc(4194308,4,r,i)},useInsertionEffect:function(r,i){Mc(4,2,r,i)},useMemo:function(r,i){var s=Rn();i=i===void 0?null:i;var d=r();if(Wi){gn(!0);try{r()}finally{gn(!1)}}return s.memoizedState=[d,i],d},useReducer:function(r,i,s){var d=Rn();if(s!==void 0){var p=s(i);if(Wi){gn(!0);try{s(i)}finally{gn(!1)}}}else p=i;return d.memoizedState=d.baseState=p,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:p},d.queue=r,r=r.dispatch=O_.bind(null,Ze,r),[d.memoizedState,r]},useRef:function(r){var i=Rn();return r={current:r},i.memoizedState=r},useState:function(r){r=Fh(r);var i=r.queue,s=Wb.bind(null,Ze,i);return i.dispatch=s,[r.memoizedState,s]},useDebugValue:Zh,useDeferredValue:function(r,i){var s=Rn();return Vh(s,r,i)},useTransition:function(){var r=Fh(!1);return r=Gb.bind(null,Ze,r.queue,!0,!1),Rn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,s){var d=Ze,p=Rn();if(it){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),kt===null)throw Error(a(349));(nt&127)!==0||kb(d,i,s)}p.memoizedState=s;var v={value:s,getSnapshot:i};return p.queue=v,Pb(Cb.bind(null,d,v,r),[r]),d.flags|=2048,es(9,{destroy:void 0},jb.bind(null,d,v,s,i),null),s},useId:function(){var r=Rn(),i=kt.identifierPrefix;if(it){var s=$r,d=Br;s=(d&~(1<<32-ht(d)-1)).toString(32)+s,i="_"+i+"R_"+s,s=Rc++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=E_++,i="_"+i+"r_"+s.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Gh,useFormState:Db,useActionState:Db,useOptimistic:function(r){var i=Rn();i.memoizedState=i.baseState=r;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=Kh.bind(null,Ze,!0,s),s.dispatch=i,[r,i]},useMemoCache:Ph,useCacheRefresh:function(){return Rn().memoizedState=z_.bind(null,Ze)},useEffectEvent:function(r){var i=Rn(),s={impl:r};return i.memoizedState=s,function(){if((ft&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Yh={readContext:xn,use:Oc,useCallback:Zb,useContext:xn,useEffect:Hh,useImperativeHandle:Hb,useInsertionEffect:$b,useLayoutEffect:Fb,useMemo:Vb,useReducer:Dc,useRef:Ub,useState:function(){return Dc(fa)},useDebugValue:Zh,useDeferredValue:function(r,i){var s=Qt();return Qb(s,vt.memoizedState,r,i)},useTransition:function(){var r=Dc(fa)[0],i=Qt().memoizedState;return[typeof r=="boolean"?r:Do(r),i]},useSyncExternalStore:Sb,useId:Xb,useHostTransitionStatus:Gh,useFormState:Mb,useActionState:Mb,useOptimistic:function(r,i){var s=Qt();return _b(s,vt,r,i)},useMemoCache:Ph,useCacheRefresh:Jb};Yh.useEffectEvent=Bb;var rx={readContext:xn,use:Oc,useCallback:Zb,useContext:xn,useEffect:Hh,useImperativeHandle:Hb,useInsertionEffect:$b,useLayoutEffect:Fb,useMemo:Vb,useReducer:$h,useRef:Ub,useState:function(){return $h(fa)},useDebugValue:Zh,useDeferredValue:function(r,i){var s=Qt();return vt===null?Vh(s,r,i):Qb(s,vt.memoizedState,r,i)},useTransition:function(){var r=$h(fa)[0],i=Qt().memoizedState;return[typeof r=="boolean"?r:Do(r),i]},useSyncExternalStore:Sb,useId:Xb,useHostTransitionStatus:Gh,useFormState:Ib,useActionState:Ib,useOptimistic:function(r,i){var s=Qt();return vt!==null?_b(s,vt,r,i):(s.baseState=r,[r,s.queue.dispatch])},useMemoCache:Ph,useCacheRefresh:Jb};rx.useEffectEvent=Bb;function Xh(r,i,s,d){i=r.memoizedState,s=s(d,i),s=s==null?i:g({},i,s),r.memoizedState=s,r.lanes===0&&(r.updateQueue.baseState=s)}var Jh={enqueueSetState:function(r,i,s){r=r._reactInternals;var d=rr(),p=Za(d);p.payload=i,s!=null&&(p.callback=s),i=Va(r,p,d),i!==null&&(qn(i,r,d),Ao(i,r,d))},enqueueReplaceState:function(r,i,s){r=r._reactInternals;var d=rr(),p=Za(d);p.tag=1,p.payload=i,s!=null&&(p.callback=s),i=Va(r,p,d),i!==null&&(qn(i,r,d),Ao(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var s=rr(),d=Za(s);d.tag=2,i!=null&&(d.callback=i),i=Va(r,d,s),i!==null&&(qn(i,r,s),Ao(i,r,s))}};function ax(r,i,s,d,p,v,S){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!So(s,d)||!So(p,v):!0}function ix(r,i,s,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,d),i.state!==r&&Jh.enqueueReplaceState(i,i.state,null)}function el(r,i){var s=i;if("ref"in i){s={};for(var d in i)d!=="ref"&&(s[d]=i[d])}if(r=r.defaultProps){s===i&&(s=g({},s));for(var p in r)s[p]===void 0&&(s[p]=r[p])}return s}function lx(r){pc(r)}function sx(r){console.error(r)}function ox(r){pc(r)}function Uc(r,i){try{var s=r.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function ux(r,i,s){try{var d=r.onCaughtError;d(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Wh(r,i,s){return s=Za(s),s.tag=3,s.payload={element:null},s.callback=function(){Uc(r,i)},s}function cx(r){return r=Za(r),r.tag=3,r}function dx(r,i,s,d){var p=s.type.getDerivedStateFromError;if(typeof p=="function"){var v=d.value;r.payload=function(){return p(v)},r.callback=function(){ux(i,s,d)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(r.callback=function(){ux(i,s,d),typeof p!="function"&&(Ja===null?Ja=new Set([this]):Ja.add(this));var _=d.stack;this.componentDidCatch(d.value,{componentStack:_!==null?_:""})})}function D_(r,i,s,d,p){if(s.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=s.alternate,i!==null&&Vl(i,s,p,!0),s=Wn.current,s!==null){switch(s.tag){case 31:case 13:return xr===null?Yc():s.alternate===null&&Ut===0&&(Ut=3),s.flags&=-257,s.flags|=65536,s.lanes=p,d===Cc?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([d]):i.add(d),jm(r,d,p)),!1;case 22:return s.flags|=65536,d===Cc?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([d]):s.add(d)),jm(r,d,p)),!1}throw Error(a(435,s.tag))}return jm(r,d,p),Yc(),!1}if(it)return i=Wn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=p,d!==vh&&(r=Error(a(422),{cause:d}),Co(gr(r,s)))):(d!==vh&&(i=Error(a(423),{cause:d}),Co(gr(i,s))),r=r.current.alternate,r.flags|=65536,p&=-p,r.lanes|=p,d=gr(d,s),p=Wh(r.stateNode,d,p),Th(r,p),Ut!==4&&(Ut=2)),!1;var v=Error(a(520),{cause:d});if(v=gr(v,s),Ho===null?Ho=[v]:Ho.push(v),Ut!==4&&(Ut=2),i===null)return!0;d=gr(d,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,r=p&-p,s.lanes|=r,r=Wh(s.stateNode,d,r),Th(s,r),!1;case 1:if(i=s.type,v=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ja===null||!Ja.has(v))))return s.flags|=65536,p&=-p,s.lanes|=p,p=cx(p),dx(p,r,s,d),Th(s,p),!1}s=s.return}while(s!==null);return!1}var em=Error(a(461)),Xt=!1;function wn(r,i,s,d){i.child=r===null?pb(i,null,s,d):Ji(i,r.child,s,d)}function fx(r,i,s,d,p){s=s.render;var v=i.ref;if("ref"in d){var S={};for(var _ in d)_!=="ref"&&(S[_]=d[_])}else S=d;return Gi(i),d=Mh(r,i,s,S,v,p),_=Lh(),r!==null&&!Xt?(Ih(r,i,p),ha(r,i,p)):(it&&_&&gh(i),i.flags|=1,wn(r,i,d,p),i.child)}function hx(r,i,s,d,p){if(r===null){var v=s.type;return typeof v=="function"&&!hh(v)&&v.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=v,mx(r,i,v,d,p)):(r=bc(s.type,null,d,i,i.mode,p),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!om(r,p)){var S=v.memoizedProps;if(s=s.compare,s=s!==null?s:So,s(S,d)&&r.ref===i.ref)return ha(r,i,p)}return i.flags|=1,r=sa(v,d),r.ref=i.ref,r.return=i,i.child=r}function mx(r,i,s,d,p){if(r!==null){var v=r.memoizedProps;if(So(v,d)&&r.ref===i.ref)if(Xt=!1,i.pendingProps=d=v,om(r,p))(r.flags&131072)!==0&&(Xt=!0);else return i.lanes=r.lanes,ha(r,i,p)}return tm(r,i,s,d,p)}function px(r,i,s,d){var p=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|s:s,r!==null){for(d=i.child=r.child,p=0;d!==null;)p=p|d.lanes|d.childLanes,d=d.sibling;d=p&~v}else d=0,i.child=null;return gx(r,i,v,s,d)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&kc(i,v!==null?v.cachePool:null),v!==null?vb(i,v):Rh(),bb(i);else return d=i.lanes=536870912,gx(r,i,v!==null?v.baseLanes|s:s,s,d)}else v!==null?(kc(i,v.cachePool),vb(i,v),Ga(),i.memoizedState=null):(r!==null&&kc(i,null),Rh(),Ga());return wn(r,i,p,s),i.child}function Io(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function gx(r,i,s,d,p){var v=Ch();return v=v===null?null:{parent:Kt._currentValue,pool:v},i.memoizedState={baseLanes:s,cachePool:v},r!==null&&kc(i,null),Rh(),bb(i),r!==null&&Vl(r,i,d,!0),i.childLanes=p,null}function Pc(r,i){return i=$c({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function yx(r,i,s){return Ji(i,r.child,null,s),r=Pc(i,i.pendingProps),r.flags|=2,er(i),i.memoizedState=null,r}function M_(r,i,s){var d=i.pendingProps,p=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(it){if(d.mode==="hidden")return r=Pc(i,d),i.lanes=536870912,Io(null,r);if(Oh(i),(r=Nt)?(r=T0(r,br),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ba!==null?{id:Br,overflow:$r}:null,retryLane:536870912,hydrationErrors:null},s=eb(r),s.return=i,i.child=s,bn=i,Nt=null)):r=null,r===null)throw Fa(i);return i.lanes=536870912,null}return Pc(i,d)}var v=r.memoizedState;if(v!==null){var S=v.dehydrated;if(Oh(i),p)if(i.flags&256)i.flags&=-257,i=yx(r,i,s);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(Xt||Vl(r,i,s,!1),p=(s&r.childLanes)!==0,Xt||p){if(d=kt,d!==null&&(S=sv(d,s),S!==0&&S!==v.retryLane))throw v.retryLane=S,Hi(r,S),qn(d,r,S),em;Yc(),i=yx(r,i,s)}else r=v.treeContext,Nt=wr(S.nextSibling),bn=i,it=!0,$a=null,br=!1,r!==null&&rb(i,r),i=Pc(i,d),i.flags|=4096;return i}return r=sa(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Bc(r,i){var s=i.ref;if(s===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(r===null||r.ref!==s)&&(i.flags|=4194816)}}function tm(r,i,s,d,p){return Gi(i),s=Mh(r,i,s,d,void 0,p),d=Lh(),r!==null&&!Xt?(Ih(r,i,p),ha(r,i,p)):(it&&d&&gh(i),i.flags|=1,wn(r,i,s,p),i.child)}function vx(r,i,s,d,p,v){return Gi(i),i.updateQueue=null,s=wb(i,d,s,p),xb(r),d=Lh(),r!==null&&!Xt?(Ih(r,i,v),ha(r,i,v)):(it&&d&&gh(i),i.flags|=1,wn(r,i,s,v),i.child)}function bx(r,i,s,d,p){if(Gi(i),i.stateNode===null){var v=Fl,S=s.contextType;typeof S=="object"&&S!==null&&(v=xn(S)),v=new s(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Jh,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Nh(i),S=s.contextType,v.context=typeof S=="object"&&S!==null?xn(S):Fl,v.state=i.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(Xh(i,s,S,d),v.state=i.memoizedState),typeof s.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&&Jh.enqueueReplaceState(v,v.state,null),zo(i,d,v,p),Ro(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var _=i.memoizedProps,$=el(s,_);v.props=$;var G=v.context,ae=s.contextType;S=Fl,typeof ae=="object"&&ae!==null&&(S=xn(ae));var fe=s.getDerivedStateFromProps;ae=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,ae||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(_||G!==S)&&ix(i,v,d,S),Ha=!1;var Y=i.memoizedState;v.state=Y,zo(i,d,v,p),Ro(),G=i.memoizedState,_||Y!==G||Ha?(typeof fe=="function"&&(Xh(i,s,fe,d),G=i.memoizedState),($=Ha||ax(i,s,$,d,Y,G,S))?(ae||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=G),v.props=d,v.state=G,v.context=S,d=$):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,_h(r,i),S=i.memoizedProps,ae=el(s,S),v.props=ae,fe=i.pendingProps,Y=v.context,G=s.contextType,$=Fl,typeof G=="object"&&G!==null&&($=xn(G)),_=s.getDerivedStateFromProps,(G=typeof _=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==fe||Y!==$)&&ix(i,v,d,$),Ha=!1,Y=i.memoizedState,v.state=Y,zo(i,d,v,p),Ro();var W=i.memoizedState;S!==fe||Y!==W||Ha||r!==null&&r.dependencies!==null&&wc(r.dependencies)?(typeof _=="function"&&(Xh(i,s,_,d),W=i.memoizedState),(ae=Ha||ax(i,s,ae,d,Y,W,$)||r!==null&&r.dependencies!==null&&wc(r.dependencies))?(G||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,W,$),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,W,$)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&Y===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&Y===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=W),v.props=d,v.state=W,v.context=$,d=ae):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&Y===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&Y===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Bc(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,s=d&&typeof s.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Ji(i,r.child,null,p),i.child=Ji(i,null,s,p)):wn(r,i,s,p),i.memoizedState=v.state,r=i.child):r=ha(r,i,p),r}function xx(r,i,s,d){return Vi(),i.flags|=256,wn(r,i,s,d),i.child}var nm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rm(r){return{baseLanes:r,cachePool:ub()}}function am(r,i,s){return r=r!==null?r.childLanes&~s:0,i&&(r|=nr),r}function wx(r,i,s){var d=i.pendingProps,p=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=r!==null&&r.memoizedState===null?!1:(Vt.current&2)!==0),S&&(p=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,r===null){if(it){if(p?Qa(i):Ga(),(r=Nt)?(r=T0(r,br),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ba!==null?{id:Br,overflow:$r}:null,retryLane:536870912,hydrationErrors:null},s=eb(r),s.return=i,i.child=s,bn=i,Nt=null)):r=null,r===null)throw Fa(i);return Bm(r)?i.lanes=32:i.lanes=536870912,null}var _=d.children;return d=d.fallback,p?(Ga(),p=i.mode,_=$c({mode:"hidden",children:_},p),d=Zi(d,p,s,null),_.return=i,d.return=i,_.sibling=d,i.child=_,d=i.child,d.memoizedState=rm(s),d.childLanes=am(r,S,s),i.memoizedState=nm,Io(null,d)):(Qa(i),im(i,_))}var $=r.memoizedState;if($!==null&&(_=$.dehydrated,_!==null)){if(v)i.flags&256?(Qa(i),i.flags&=-257,i=lm(r,i,s)):i.memoizedState!==null?(Ga(),i.child=r.child,i.flags|=128,i=null):(Ga(),_=d.fallback,p=i.mode,d=$c({mode:"visible",children:d.children},p),_=Zi(_,p,s,null),_.flags|=2,d.return=i,_.return=i,d.sibling=_,i.child=d,Ji(i,r.child,null,s),d=i.child,d.memoizedState=rm(s),d.childLanes=am(r,S,s),i.memoizedState=nm,i=Io(null,d));else if(Qa(i),Bm(_)){if(S=_.nextSibling&&_.nextSibling.dataset,S)var G=S.dgst;S=G,d=Error(a(419)),d.stack="",d.digest=S,Co({value:d,source:null,stack:null}),i=lm(r,i,s)}else if(Xt||Vl(r,i,s,!1),S=(s&r.childLanes)!==0,Xt||S){if(S=kt,S!==null&&(d=sv(S,s),d!==0&&d!==$.retryLane))throw $.retryLane=d,Hi(r,d),qn(S,r,d),em;Pm(_)||Yc(),i=lm(r,i,s)}else Pm(_)?(i.flags|=192,i.child=r.child,i=null):(r=$.treeContext,Nt=wr(_.nextSibling),bn=i,it=!0,$a=null,br=!1,r!==null&&rb(i,r),i=im(i,d.children),i.flags|=4096);return i}return p?(Ga(),_=d.fallback,p=i.mode,$=r.child,G=$.sibling,d=sa($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,G!==null?_=sa(G,_):(_=Zi(_,p,s,null),_.flags|=2),_.return=i,d.return=i,d.sibling=_,i.child=d,Io(null,d),d=i.child,_=r.child.memoizedState,_===null?_=rm(s):(p=_.cachePool,p!==null?($=Kt._currentValue,p=p.parent!==$?{parent:$,pool:$}:p):p=ub(),_={baseLanes:_.baseLanes|s,cachePool:p}),d.memoizedState=_,d.childLanes=am(r,S,s),i.memoizedState=nm,Io(r.child,d)):(Qa(i),s=r.child,r=s.sibling,s=sa(s,{mode:"visible",children:d.children}),s.return=i,s.sibling=null,r!==null&&(S=i.deletions,S===null?(i.deletions=[r],i.flags|=16):S.push(r)),i.child=s,i.memoizedState=null,s)}function im(r,i){return i=$c({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function $c(r,i){return r=Jn(22,r,null,i),r.lanes=0,r}function lm(r,i,s){return Ji(i,r.child,null,s),r=im(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Sx(r,i,s){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),wh(r.return,i,s)}function sm(r,i,s,d,p,v){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:s,tailMode:p,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=s,S.tailMode=p,S.treeForkCount=v)}function kx(r,i,s){var d=i.pendingProps,p=d.revealOrder,v=d.tail;d=d.children;var S=Vt.current,_=(S&2)!==0;if(_?(S=S&1|2,i.flags|=128):S&=1,T(Vt,S),wn(r,i,d,s),d=it?jo:0,!_&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Sx(r,s,i);else if(r.tag===19)Sx(r,s,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(p){case"forwards":for(s=i.child,p=null;s!==null;)r=s.alternate,r!==null&&Tc(r)===null&&(p=s),s=s.sibling;s=p,s===null?(p=i.child,i.child=null):(p=s.sibling,s.sibling=null),sm(i,!1,p,s,v,d);break;case"backwards":case"unstable_legacy-backwards":for(s=null,p=i.child,i.child=null;p!==null;){if(r=p.alternate,r!==null&&Tc(r)===null){i.child=p;break}r=p.sibling,p.sibling=s,s=p,p=r}sm(i,!0,s,null,v,d);break;case"together":sm(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function ha(r,i,s){if(r!==null&&(i.dependencies=r.dependencies),Xa|=i.lanes,(s&i.childLanes)===0)if(r!==null){if(Vl(r,i,s,!1),(s&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,s=sa(r,r.pendingProps),i.child=s,s.return=i;r.sibling!==null;)r=r.sibling,s=s.sibling=sa(r,r.pendingProps),s.return=i;s.sibling=null}return i.child}function om(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&wc(r)))}function L_(r,i,s){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),qa(i,Kt,r.memoizedState.cache),Vi();break;case 27:case 5:Xe(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:qa(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Oh(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Qa(i),i.flags|=128,null):(s&i.child.childLanes)!==0?wx(r,i,s):(Qa(i),r=ha(r,i,s),r!==null?r.sibling:null);Qa(i);break;case 19:var p=(r.flags&128)!==0;if(d=(s&i.childLanes)!==0,d||(Vl(r,i,s,!1),d=(s&i.childLanes)!==0),p){if(d)return kx(r,i,s);i.flags|=128}if(p=i.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),T(Vt,Vt.current),d)break;return null;case 22:return i.lanes=0,px(r,i,s,i.pendingProps);case 24:qa(i,Kt,r.memoizedState.cache)}return ha(r,i,s)}function jx(r,i,s){if(r!==null)if(r.memoizedProps!==i.pendingProps)Xt=!0;else{if(!om(r,s)&&(i.flags&128)===0)return Xt=!1,L_(r,i,s);Xt=(r.flags&131072)!==0}else Xt=!1,it&&(i.flags&1048576)!==0&&nb(i,jo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Yi(i.elementType),i.type=r,typeof r=="function")hh(r)?(d=el(r,d),i.tag=1,i=bx(null,i,r,d,s)):(i.tag=0,i=tm(null,i,r,d,s));else{if(r!=null){var p=r.$$typeof;if(p===L){i.tag=11,i=fx(null,i,r,d,s);break e}else if(p===M){i.tag=14,i=hx(null,i,r,d,s);break e}}throw i=he(r)||r,Error(a(306,i,""))}}return i;case 0:return tm(r,i,i.type,i.pendingProps,s);case 1:return d=i.type,p=el(d,i.pendingProps),bx(r,i,d,p,s);case 3:e:{if(we(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;p=v.element,_h(r,i),zo(i,d,null,s);var S=i.memoizedState;if(d=S.cache,qa(i,Kt,d),d!==v.cache&&Sh(i,[Kt],s,!0),Ro(),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=xx(r,i,d,s);break e}else if(d!==p){p=gr(Error(a(424)),i),Co(p),i=xx(r,i,d,s);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(Nt=wr(r.firstChild),bn=i,it=!0,$a=null,br=!0,s=pb(i,null,d,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Vi(),d===p){i=ha(r,i,s);break e}wn(r,i,d,s)}i=i.child}return i;case 26:return Bc(r,i),r===null?(s=M0(i.type,null,i.pendingProps,null))?i.memoizedState=s:it||(s=i.type,r=i.pendingProps,d=rd(ce.current).createElement(s),d[vn]=i,d[In]=r,Sn(d,s,r),on(d),i.stateNode=d):i.memoizedState=M0(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Xe(i),r===null&&it&&(d=i.stateNode=z0(i.type,i.pendingProps,ce.current),bn=i,br=!0,p=Nt,ni(i.type)?($m=p,Nt=wr(d.firstChild)):Nt=p),wn(r,i,i.pendingProps.children,s),Bc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&it&&((p=d=Nt)&&(d=f2(d,i.type,i.pendingProps,br),d!==null?(i.stateNode=d,bn=i,Nt=wr(d.firstChild),br=!1,p=!0):p=!1),p||Fa(i)),Xe(i),p=i.type,v=i.pendingProps,S=r!==null?r.memoizedProps:null,d=v.children,Lm(p,v)?d=null:S!==null&&Lm(p,S)&&(i.flags|=32),i.memoizedState!==null&&(p=Mh(r,i,N_,null,null,s),Jo._currentValue=p),Bc(r,i),wn(r,i,d,s),i.child;case 6:return r===null&&it&&((r=s=Nt)&&(s=h2(s,i.pendingProps,br),s!==null?(i.stateNode=s,bn=i,Nt=null,r=!0):r=!1),r||Fa(i)),null;case 13:return wx(r,i,s);case 4:return we(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ji(i,null,d,s):wn(r,i,d,s),i.child;case 11:return fx(r,i,i.type,i.pendingProps,s);case 7:return wn(r,i,i.pendingProps,s),i.child;case 8:return wn(r,i,i.pendingProps.children,s),i.child;case 12:return wn(r,i,i.pendingProps.children,s),i.child;case 10:return d=i.pendingProps,qa(i,i.type,d.value),wn(r,i,d.children,s),i.child;case 9:return p=i.type._context,d=i.pendingProps.children,Gi(i),p=xn(p),d=d(p),i.flags|=1,wn(r,i,d,s),i.child;case 14:return hx(r,i,i.type,i.pendingProps,s);case 15:return mx(r,i,i.type,i.pendingProps,s);case 19:return kx(r,i,s);case 31:return M_(r,i,s);case 22:return px(r,i,s,i.pendingProps);case 24:return Gi(i),d=xn(Kt),r===null?(p=Ch(),p===null&&(p=kt,v=kh(),p.pooledCache=v,v.refCount++,v!==null&&(p.pooledCacheLanes|=s),p=v),i.memoizedState={parent:d,cache:p},Nh(i),qa(i,Kt,p)):((r.lanes&s)!==0&&(_h(r,i),zo(i,null,null,s),Ro()),p=r.memoizedState,v=i.memoizedState,p.parent!==d?(p={parent:d,cache:d},i.memoizedState=p,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=p),qa(i,Kt,d)):(d=v.cache,qa(i,Kt,d),d!==p.cache&&Sh(i,[Kt],s,!0))),wn(r,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function ma(r){r.flags|=4}function um(r,i,s,d,p){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(p&335544128)===p)if(r.stateNode.complete)r.flags|=8192;else if(Xx())r.flags|=8192;else throw Xi=Cc,Eh}else r.flags&=-16777217}function Cx(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!B0(i))if(Xx())r.flags|=8192;else throw Xi=Cc,Eh}function Fc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Se():536870912,r.lanes|=i,as|=i)}function Uo(r,i){if(!it)switch(r.tailMode){case"hidden":i=r.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?r.tail=null:s.sibling=null;break;case"collapsed":s=r.tail;for(var d=null;s!==null;)s.alternate!==null&&(d=s),s=s.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function _t(r){var i=r.alternate!==null&&r.alternate.child===r.child,s=0,d=0;if(i)for(var p=r.child;p!==null;)s|=p.lanes|p.childLanes,d|=p.subtreeFlags&65011712,d|=p.flags&65011712,p.return=r,p=p.sibling;else for(p=r.child;p!==null;)s|=p.lanes|p.childLanes,d|=p.subtreeFlags,d|=p.flags,p.return=r,p=p.sibling;return r.subtreeFlags|=d,r.childLanes=s,i}function I_(r,i,s){var d=i.pendingProps;switch(yh(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(i),null;case 1:return _t(i),null;case 3:return s=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),ca(Kt),pe(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(r===null||r.child===null)&&(Zl(i)?ma(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,bh())),_t(i),null;case 26:var p=i.type,v=i.memoizedState;return r===null?(ma(i),v!==null?(_t(i),Cx(i,v)):(_t(i),um(i,p,null,d,s))):v?v!==r.memoizedState?(ma(i),_t(i),Cx(i,v)):(_t(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&ma(i),_t(i),um(i,p,r,d,s)),null;case 27:if(Le(i),s=ce.current,p=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ma(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return _t(i),null}r=q.current,Zl(i)?ab(i):(r=z0(p,d,s),i.stateNode=r,ma(i))}return _t(i),null;case 5:if(Le(i),p=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ma(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return _t(i),null}if(v=q.current,Zl(i))ab(i);else{var S=rd(ce.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);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(p,{is:d.is}):S.createElement(p)}}v[vn]=i,v[In]=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(Sn(v,p,d),p){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ma(i)}}return _t(i),um(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,s),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&ma(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ce.current,Zl(i)){if(r=i.stateNode,s=i.memoizedProps,d=null,p=bn,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}r[vn]=i,r=!!(r.nodeValue===s||d!==null&&d.suppressHydrationWarning===!0||w0(r.nodeValue,s)),r||Fa(i,!0)}else r=rd(r).createTextNode(d),r[vn]=i,i.stateNode=r}return _t(i),null;case 31:if(s=i.memoizedState,r===null||r.memoizedState!==null){if(d=Zl(i),s!==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[vn]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;_t(i),r=!1}else s=bh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=s),r=!0;if(!r)return i.flags&256?(er(i),i):(er(i),null);if((i.flags&128)!==0)throw Error(a(558))}return _t(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(p=Zl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!p)throw Error(a(318));if(p=i.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(a(317));p[vn]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;_t(i),p=!1}else p=bh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=p),p=!0;if(!p)return i.flags&256?(er(i),i):(er(i),null)}return er(i),(i.flags&128)!==0?(i.lanes=s,i):(s=d!==null,r=r!==null&&r.memoizedState!==null,s&&(d=i.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048)),s!==r&&s&&(i.child.flags|=8192),Fc(i,i.updateQueue),_t(i),null);case 4:return pe(),r===null&&Rm(i.stateNode.containerInfo),_t(i),null;case 10:return ca(i.type),_t(i),null;case 19:if(B(Vt),d=i.memoizedState,d===null)return _t(i),null;if(p=(i.flags&128)!==0,v=d.rendering,v===null)if(p)Uo(d,!1);else{if(Ut!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=Tc(r),v!==null){for(i.flags|=128,Uo(d,!1),r=v.updateQueue,i.updateQueue=r,Fc(i,r),i.subtreeFlags=0,r=s,s=i.child;s!==null;)Wv(s,r),s=s.sibling;return T(Vt,Vt.current&1|2),it&&oa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&mn()>Qc&&(i.flags|=128,p=!0,Uo(d,!1),i.lanes=4194304)}else{if(!p)if(r=Tc(v),r!==null){if(i.flags|=128,p=!0,r=r.updateQueue,i.updateQueue=r,Fc(i,r),Uo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!it)return _t(i),null}else 2*mn()-d.renderingStartTime>Qc&&s!==536870912&&(i.flags|=128,p=!0,Uo(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=mn(),r.sibling=null,s=Vt.current,T(Vt,p?s&1|2:s&1),it&&oa(i,d.treeForkCount),r):(_t(i),null);case 22:case 23:return er(i),zh(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(s&536870912)!==0&&(i.flags&128)===0&&(_t(i),i.subtreeFlags&6&&(i.flags|=8192)):_t(i),s=i.updateQueue,s!==null&&Fc(i,s.retryQueue),s=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==s&&(i.flags|=2048),r!==null&&B(Ki),null;case 24:return s=null,r!==null&&(s=r.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),ca(Kt),_t(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function U_(r,i){switch(yh(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return ca(Kt),pe(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Le(i),null;case 31:if(i.memoizedState!==null){if(er(i),i.alternate===null)throw Error(a(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(er(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return B(Vt),null;case 4:return pe(),null;case 10:return ca(i.type),null;case 22:case 23:return er(i),zh(),r!==null&&B(Ki),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return ca(Kt),null;case 25:return null;default:return null}}function Ex(r,i){switch(yh(i),i.tag){case 3:ca(Kt),pe();break;case 26:case 27:case 5:Le(i);break;case 4:pe();break;case 31:i.memoizedState!==null&&er(i);break;case 13:er(i);break;case 19:B(Vt);break;case 10:ca(i.type);break;case 22:case 23:er(i),zh(),r!==null&&B(Ki);break;case 24:ca(Kt)}}function Po(r,i){try{var s=i.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&r)===r){d=void 0;var v=s.create,S=s.inst;d=v(),S.destroy=d}s=s.next}while(s!==p)}}catch(_){yt(i,i.return,_)}}function Ka(r,i,s){try{var d=i.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var v=p.next;d=v;do{if((d.tag&r)===r){var S=d.inst,_=S.destroy;if(_!==void 0){S.destroy=void 0,p=i;var $=s,G=_;try{G()}catch(ae){yt(p,$,ae)}}}d=d.next}while(d!==v)}}catch(ae){yt(i,i.return,ae)}}function Nx(r){var i=r.updateQueue;if(i!==null){var s=r.stateNode;try{yb(i,s)}catch(d){yt(r,r.return,d)}}}function _x(r,i,s){s.props=el(r.type,r.memoizedProps),s.state=r.memoizedState;try{s.componentWillUnmount()}catch(d){yt(r,i,d)}}function Bo(r,i){try{var s=r.ref;if(s!==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 s=="function"?r.refCleanup=s(d):s.current=d}}catch(p){yt(r,i,p)}}function Fr(r,i){var s=r.ref,d=r.refCleanup;if(s!==null)if(typeof d=="function")try{d()}catch(p){yt(r,i,p)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){yt(r,i,p)}else s.current=null}function Tx(r){var i=r.type,s=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&d.focus();break e;case"img":s.src?d.src=s.src:s.srcSet&&(d.srcset=s.srcSet)}}catch(p){yt(r,r.return,p)}}function cm(r,i,s){try{var d=r.stateNode;l2(d,r.type,s,i),d[In]=i}catch(p){yt(r,r.return,p)}}function Ax(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ni(r.type)||r.tag===4}function dm(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ax(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&&ni(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 fm(r,i,s){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(r,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(r),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=ia));else if(d!==4&&(d===27&&ni(r.type)&&(s=r.stateNode,i=null),r=r.child,r!==null))for(fm(r,i,s),r=r.sibling;r!==null;)fm(r,i,s),r=r.sibling}function qc(r,i,s){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?s.insertBefore(r,i):s.appendChild(r);else if(d!==4&&(d===27&&ni(r.type)&&(s=r.stateNode),r=r.child,r!==null))for(qc(r,i,s),r=r.sibling;r!==null;)qc(r,i,s),r=r.sibling}function Rx(r){var i=r.stateNode,s=r.memoizedProps;try{for(var d=r.type,p=i.attributes;p.length;)i.removeAttributeNode(p[0]);Sn(i,d,s),i[vn]=r,i[In]=s}catch(v){yt(r,r.return,v)}}var pa=!1,Jt=!1,hm=!1,zx=typeof WeakSet=="function"?WeakSet:Set,un=null;function P_(r,i){if(r=r.containerInfo,Dm=cd,r=Hv(r),lh(r)){if("selectionStart"in r)var s={start:r.selectionStart,end:r.selectionEnd};else e:{s=(s=r.ownerDocument)&&s.defaultView||window;var d=s.getSelection&&s.getSelection();if(d&&d.rangeCount!==0){s=d.anchorNode;var p=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{s.nodeType,v.nodeType}catch{s=null;break e}var S=0,_=-1,$=-1,G=0,ae=0,fe=r,Y=null;t:for(;;){for(var W;fe!==s||p!==0&&fe.nodeType!==3||(_=S+p),fe!==v||d!==0&&fe.nodeType!==3||($=S+d),fe.nodeType===3&&(S+=fe.nodeValue.length),(W=fe.firstChild)!==null;)Y=fe,fe=W;for(;;){if(fe===r)break t;if(Y===s&&++G===p&&(_=S),Y===v&&++ae===d&&($=S),(W=fe.nextSibling)!==null)break;fe=Y,Y=fe.parentNode}fe=W}s=_===-1||$===-1?null:{start:_,end:$}}else s=null}s=s||{start:0,end:0}}else s=null;for(Mm={focusedElem:r,selectionRange:s},cd=!1,un=i;un!==null;)if(i=un,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,un=r;else for(;un!==null;){switch(i=un,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(s=0;s<r.length;s++)p=r[s],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,s=i,p=v.memoizedProps,v=v.memoizedState,d=s.stateNode;try{var Ce=el(s.type,p);r=d.getSnapshotBeforeUpdate(Ce,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(De){yt(s,s.return,De)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,s=r.nodeType,s===9)Um(r);else if(s===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Um(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,un=r;break}un=i.return}}function Ox(r,i,s){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ya(r,s),d&4&&Po(5,s);break;case 1:if(ya(r,s),d&4)if(r=s.stateNode,i===null)try{r.componentDidMount()}catch(S){yt(s,s.return,S)}else{var p=el(s.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(p,i,r.__reactInternalSnapshotBeforeUpdate)}catch(S){yt(s,s.return,S)}}d&64&&Nx(s),d&512&&Bo(s,s.return);break;case 3:if(ya(r,s),d&64&&(r=s.updateQueue,r!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{yb(r,i)}catch(S){yt(s,s.return,S)}}break;case 27:i===null&&d&4&&Rx(s);case 26:case 5:ya(r,s),i===null&&d&4&&Tx(s),d&512&&Bo(s,s.return);break;case 12:ya(r,s);break;case 31:ya(r,s),d&4&&Lx(r,s);break;case 13:ya(r,s),d&4&&Ix(r,s),d&64&&(r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(s=G_.bind(null,s),m2(r,s))));break;case 22:if(d=s.memoizedState!==null||pa,!d){i=i!==null&&i.memoizedState!==null||Jt,p=pa;var v=Jt;pa=d,(Jt=i)&&!v?va(r,s,(s.subtreeFlags&8772)!==0):ya(r,s),pa=p,Jt=v}break;case 30:break;default:ya(r,s)}}function Dx(r){var i=r.alternate;i!==null&&(r.alternate=null,Dx(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&qf(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 Tt=null,Pn=!1;function ga(r,i,s){for(s=s.child;s!==null;)Mx(r,i,s),s=s.sibling}function Mx(r,i,s){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(nn,s)}catch{}switch(s.tag){case 26:Jt||Fr(s,i),ga(r,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Jt||Fr(s,i);var d=Tt,p=Pn;ni(s.type)&&(Tt=s.stateNode,Pn=!1),ga(r,i,s),Ko(s.stateNode),Tt=d,Pn=p;break;case 5:Jt||Fr(s,i);case 6:if(d=Tt,p=Pn,Tt=null,ga(r,i,s),Tt=d,Pn=p,Tt!==null)if(Pn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(s.stateNode)}catch(v){yt(s,i,v)}else try{Tt.removeChild(s.stateNode)}catch(v){yt(s,i,v)}break;case 18:Tt!==null&&(Pn?(r=Tt,N0(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.stateNode),fs(r)):N0(Tt,s.stateNode));break;case 4:d=Tt,p=Pn,Tt=s.stateNode.containerInfo,Pn=!0,ga(r,i,s),Tt=d,Pn=p;break;case 0:case 11:case 14:case 15:Ka(2,s,i),Jt||Ka(4,s,i),ga(r,i,s);break;case 1:Jt||(Fr(s,i),d=s.stateNode,typeof d.componentWillUnmount=="function"&&_x(s,i,d)),ga(r,i,s);break;case 21:ga(r,i,s);break;case 22:Jt=(d=Jt)||s.memoizedState!==null,ga(r,i,s),Jt=d;break;default:ga(r,i,s)}}function Lx(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{fs(r)}catch(s){yt(i,i.return,s)}}}function Ix(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{fs(r)}catch(s){yt(i,i.return,s)}}function B_(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new zx),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new zx),i;default:throw Error(a(435,r.tag))}}function Hc(r,i){var s=B_(r);i.forEach(function(d){if(!s.has(d)){s.add(d);var p=K_.bind(null,r,d);d.then(p,p)}})}function Bn(r,i){var s=i.deletions;if(s!==null)for(var d=0;d<s.length;d++){var p=s[d],v=r,S=i,_=S;e:for(;_!==null;){switch(_.tag){case 27:if(ni(_.type)){Tt=_.stateNode,Pn=!1;break e}break;case 5:Tt=_.stateNode,Pn=!1;break e;case 3:case 4:Tt=_.stateNode.containerInfo,Pn=!0;break e}_=_.return}if(Tt===null)throw Error(a(160));Mx(v,S,p),Tt=null,Pn=!1,v=p.alternate,v!==null&&(v.return=null),p.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ux(i,r),i=i.sibling}var Dr=null;function Ux(r,i){var s=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Bn(i,r),$n(r),d&4&&(Ka(3,r,r.return),Po(3,r),Ka(5,r,r.return));break;case 1:Bn(i,r),$n(r),d&512&&(Jt||s===null||Fr(s,s.return)),d&64&&pa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(s=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=s===null?d:s.concat(d))));break;case 26:var p=Dr;if(Bn(i,r),$n(r),d&512&&(Jt||s===null||Fr(s,s.return)),d&4){var v=s!==null?s.memoizedState:null;if(d=r.memoizedState,s===null)if(d===null)if(r.stateNode===null){e:{d=r.type,s=r.memoizedProps,p=p.ownerDocument||p;t:switch(d){case"title":v=p.getElementsByTagName("title")[0],(!v||v[ho]||v[vn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=p.createElement(d),p.head.insertBefore(v,p.querySelector("head > title"))),Sn(v,d,s),v[vn]=r,on(v),d=v;break e;case"link":var S=U0("link","href",p).get(d+(s.href||""));if(S){for(var _=0;_<S.length;_++)if(v=S[_],v.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&v.getAttribute("rel")===(s.rel==null?null:s.rel)&&v.getAttribute("title")===(s.title==null?null:s.title)&&v.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(_,1);break t}}v=p.createElement(d),Sn(v,d,s),p.head.appendChild(v);break;case"meta":if(S=U0("meta","content",p).get(d+(s.content||""))){for(_=0;_<S.length;_++)if(v=S[_],v.getAttribute("content")===(s.content==null?null:""+s.content)&&v.getAttribute("name")===(s.name==null?null:s.name)&&v.getAttribute("property")===(s.property==null?null:s.property)&&v.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&v.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(_,1);break t}}v=p.createElement(d),Sn(v,d,s),p.head.appendChild(v);break;default:throw Error(a(468,d))}v[vn]=r,on(v),d=v}r.stateNode=d}else P0(p,r.type,r.stateNode);else r.stateNode=I0(p,d,r.memoizedProps);else v!==d?(v===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):v.count--,d===null?P0(p,r.type,r.stateNode):I0(p,d,r.memoizedProps)):d===null&&r.stateNode!==null&&cm(r,r.memoizedProps,s.memoizedProps)}break;case 27:Bn(i,r),$n(r),d&512&&(Jt||s===null||Fr(s,s.return)),s!==null&&d&4&&cm(r,r.memoizedProps,s.memoizedProps);break;case 5:if(Bn(i,r),$n(r),d&512&&(Jt||s===null||Fr(s,s.return)),r.flags&32){p=r.stateNode;try{Ml(p,"")}catch(Ce){yt(r,r.return,Ce)}}d&4&&r.stateNode!=null&&(p=r.memoizedProps,cm(r,p,s!==null?s.memoizedProps:p)),d&1024&&(hm=!0);break;case 6:if(Bn(i,r),$n(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,s=r.stateNode;try{s.nodeValue=d}catch(Ce){yt(r,r.return,Ce)}}break;case 3:if(ld=null,p=Dr,Dr=ad(i.containerInfo),Bn(i,r),Dr=p,$n(r),d&4&&s!==null&&s.memoizedState.isDehydrated)try{fs(i.containerInfo)}catch(Ce){yt(r,r.return,Ce)}hm&&(hm=!1,Px(r));break;case 4:d=Dr,Dr=ad(r.stateNode.containerInfo),Bn(i,r),$n(r),Dr=d;break;case 12:Bn(i,r),$n(r);break;case 31:Bn(i,r),$n(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Hc(r,d)));break;case 13:Bn(i,r),$n(r),r.child.flags&8192&&r.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Vc=mn()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Hc(r,d)));break;case 22:p=r.memoizedState!==null;var $=s!==null&&s.memoizedState!==null,G=pa,ae=Jt;if(pa=G||p,Jt=ae||$,Bn(i,r),Jt=ae,pa=G,$n(r),d&8192)e:for(i=r.stateNode,i._visibility=p?i._visibility&-2:i._visibility|1,p&&(s===null||$||pa||Jt||tl(r)),s=null,i=r;;){if(i.tag===5||i.tag===26){if(s===null){$=s=i;try{if(v=$.stateNode,p)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{_=$.stateNode;var fe=$.memoizedProps.style,Y=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;_.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(Ce){yt($,$.return,Ce)}}}else if(i.tag===6){if(s===null){$=i;try{$.stateNode.nodeValue=p?"":$.memoizedProps}catch(Ce){yt($,$.return,Ce)}}}else if(i.tag===18){if(s===null){$=i;try{var W=$.stateNode;p?_0(W,!0):_0($.stateNode,!1)}catch(Ce){yt($,$.return,Ce)}}}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;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(s=d.retryQueue,s!==null&&(d.retryQueue=null,Hc(r,s))));break;case 19:Bn(i,r),$n(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Hc(r,d)));break;case 30:break;case 21:break;default:Bn(i,r),$n(r)}}function $n(r){var i=r.flags;if(i&2){try{for(var s,d=r.return;d!==null;){if(Ax(d)){s=d;break}d=d.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var p=s.stateNode,v=dm(r);qc(r,v,p);break;case 5:var S=s.stateNode;s.flags&32&&(Ml(S,""),s.flags&=-33);var _=dm(r);qc(r,_,S);break;case 3:case 4:var $=s.stateNode.containerInfo,G=dm(r);fm(r,G,$);break;default:throw Error(a(161))}}catch(ae){yt(r,r.return,ae)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function Px(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;Px(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function ya(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Ox(r,i.alternate,i),i=i.sibling}function tl(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ka(4,i,i.return),tl(i);break;case 1:Fr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&_x(i,i.return,s),tl(i);break;case 27:Ko(i.stateNode);case 26:case 5:Fr(i,i.return),tl(i);break;case 22:i.memoizedState===null&&tl(i);break;case 30:tl(i);break;default:tl(i)}r=r.sibling}}function va(r,i,s){for(s=s&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,p=r,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:va(p,v,s),Po(4,v);break;case 1:if(va(p,v,s),d=v,p=d.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(G){yt(d,d.return,G)}if(d=v,p=d.updateQueue,p!==null){var _=d.stateNode;try{var $=p.shared.hiddenCallbacks;if($!==null)for(p.shared.hiddenCallbacks=null,p=0;p<$.length;p++)gb($[p],_)}catch(G){yt(d,d.return,G)}}s&&S&64&&Nx(v),Bo(v,v.return);break;case 27:Rx(v);case 26:case 5:va(p,v,s),s&&d===null&&S&4&&Tx(v),Bo(v,v.return);break;case 12:va(p,v,s);break;case 31:va(p,v,s),s&&S&4&&Lx(p,v);break;case 13:va(p,v,s),s&&S&4&&Ix(p,v);break;case 22:v.memoizedState===null&&va(p,v,s),Bo(v,v.return);break;case 30:break;default:va(p,v,s)}i=i.sibling}}function mm(r,i){var s=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==s&&(r!=null&&r.refCount++,s!=null&&Eo(s))}function pm(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Eo(r))}function Mr(r,i,s,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Bx(r,i,s,d),i=i.sibling}function Bx(r,i,s,d){var p=i.flags;switch(i.tag){case 0:case 11:case 15:Mr(r,i,s,d),p&2048&&Po(9,i);break;case 1:Mr(r,i,s,d);break;case 3:Mr(r,i,s,d),p&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Eo(r)));break;case 12:if(p&2048){Mr(r,i,s,d),r=i.stateNode;try{var v=i.memoizedProps,S=v.id,_=v.onPostCommit;typeof _=="function"&&_(S,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch($){yt(i,i.return,$)}}else Mr(r,i,s,d);break;case 31:Mr(r,i,s,d);break;case 13:Mr(r,i,s,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?Mr(r,i,s,d):$o(r,i):v._visibility&2?Mr(r,i,s,d):(v._visibility|=2,ts(r,i,s,d,(i.subtreeFlags&10256)!==0||!1)),p&2048&&mm(S,i);break;case 24:Mr(r,i,s,d),p&2048&&pm(i.alternate,i);break;default:Mr(r,i,s,d)}}function ts(r,i,s,d,p){for(p=p&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,S=i,_=s,$=d,G=S.flags;switch(S.tag){case 0:case 11:case 15:ts(v,S,_,$,p),Po(8,S);break;case 23:break;case 22:var ae=S.stateNode;S.memoizedState!==null?ae._visibility&2?ts(v,S,_,$,p):$o(v,S):(ae._visibility|=2,ts(v,S,_,$,p)),p&&G&2048&&mm(S.alternate,S);break;case 24:ts(v,S,_,$,p),p&&G&2048&&pm(S.alternate,S);break;default:ts(v,S,_,$,p)}i=i.sibling}}function $o(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=r,d=i,p=d.flags;switch(d.tag){case 22:$o(s,d),p&2048&&mm(d.alternate,d);break;case 24:$o(s,d),p&2048&&pm(d.alternate,d);break;default:$o(s,d)}i=i.sibling}}var Fo=8192;function ns(r,i,s){if(r.subtreeFlags&Fo)for(r=r.child;r!==null;)$x(r,i,s),r=r.sibling}function $x(r,i,s){switch(r.tag){case 26:ns(r,i,s),r.flags&Fo&&r.memoizedState!==null&&E2(s,Dr,r.memoizedState,r.memoizedProps);break;case 5:ns(r,i,s);break;case 3:case 4:var d=Dr;Dr=ad(r.stateNode.containerInfo),ns(r,i,s),Dr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=Fo,Fo=16777216,ns(r,i,s),Fo=d):ns(r,i,s));break;default:ns(r,i,s)}}function Fx(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 qo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var d=i[s];un=d,Hx(d,r)}Fx(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)qx(r),r=r.sibling}function qx(r){switch(r.tag){case 0:case 11:case 15:qo(r),r.flags&2048&&Ka(9,r,r.return);break;case 3:qo(r);break;case 12:qo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Zc(r)):qo(r);break;default:qo(r)}}function Zc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var d=i[s];un=d,Hx(d,r)}Fx(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ka(8,i,i.return),Zc(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Zc(i));break;default:Zc(i)}r=r.sibling}}function Hx(r,i){for(;un!==null;){var s=un;switch(s.tag){case 0:case 11:case 15:Ka(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var d=s.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Eo(s.memoizedState.cache)}if(d=s.child,d!==null)d.return=s,un=d;else e:for(s=r;un!==null;){d=un;var p=d.sibling,v=d.return;if(Dx(d),d===s){un=null;break e}if(p!==null){p.return=v,un=p;break e}un=v}}}var $_={getCacheForType:function(r){var i=xn(Kt),s=i.data.get(r);return s===void 0&&(s=r(),i.data.set(r,s)),s},cacheSignal:function(){return xn(Kt).controller.signal}},F_=typeof WeakMap=="function"?WeakMap:Map,ft=0,kt=null,We=null,nt=0,gt=0,tr=null,Ya=!1,rs=!1,gm=!1,ba=0,Ut=0,Xa=0,nl=0,ym=0,nr=0,as=0,Ho=null,Fn=null,vm=!1,Vc=0,Zx=0,Qc=1/0,Gc=null,Ja=null,rn=0,Wa=null,is=null,xa=0,bm=0,xm=null,Vx=null,Zo=0,wm=null;function rr(){return(ft&2)!==0&&nt!==0?nt&-nt:Z.T!==null?Nm():ov()}function Qx(){if(nr===0)if((nt&536870912)===0||it){var r=Ii;Ii<<=1,(Ii&3932160)===0&&(Ii=262144),nr=r}else nr=536870912;return r=Wn.current,r!==null&&(r.flags|=32),nr}function qn(r,i,s){(r===kt&&(gt===2||gt===9)||r.cancelPendingCommit!==null)&&(ls(r,0),ei(r,nt,nr,!1)),yn(r,s),((ft&2)===0||r!==kt)&&(r===kt&&((ft&2)===0&&(nl|=s),Ut===4&&ei(r,nt,nr,!1)),qr(r))}function Gx(r,i,s){if((ft&6)!==0)throw Error(a(327));var d=!s&&(i&127)===0&&(i&r.expiredLanes)===0||Ia(r,i),p=d?Z_(r,i):km(r,i,!0),v=d;do{if(p===0){rs&&!d&&ei(r,i,0,!1);break}else{if(s=r.current.alternate,v&&!q_(s)){p=km(r,i,!1),v=!1;continue}if(p===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 _=r;p=Ho;var $=_.current.memoizedState.isDehydrated;if($&&(ls(_,S).flags|=256),S=km(_,S,!1),S!==2){if(gm&&!$){_.errorRecoveryDisabledLanes|=v,nl|=v,p=4;break e}v=Fn,Fn=p,v!==null&&(Fn===null?Fn=v:Fn.push.apply(Fn,v))}p=S}if(v=!1,p!==2)continue}}if(p===1){ls(r,0),ei(r,i,0,!0);break}e:{switch(d=r,v=p,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:ei(d,i,nr,!Ya);break e;case 2:Fn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(p=Vc+300-mn(),10<p)){if(ei(d,i,nr,!Ya),Pi(d,0,!0)!==0)break e;xa=i,d.timeoutHandle=C0(Kx.bind(null,d,s,Fn,Gc,vm,i,nr,nl,as,Ya,v,"Throttled",-0,0),p);break e}Kx(d,s,Fn,Gc,vm,i,nr,nl,as,Ya,v,null,-0,0)}}break}while(!0);qr(r)}function Kx(r,i,s,d,p,v,S,_,$,G,ae,fe,Y,W){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:ia},$x(i,v,fe);var Ce=(v&62914560)===v?Vc-mn():(v&4194048)===v?Zx-mn():0;if(Ce=N2(fe,Ce),Ce!==null){xa=v,r.cancelPendingCommit=Ce(r0.bind(null,r,i,v,s,d,p,S,_,$,ae,fe,null,Y,W)),ei(r,v,S,!G);return}}r0(r,i,v,s,d,p,S,_,$)}function q_(r){for(var i=r;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var d=0;d<s.length;d++){var p=s[d],v=p.getSnapshot;p=p.value;try{if(!Xn(v(),p))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;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 ei(r,i,s,d){i&=~ym,i&=~nl,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var p=i;0<p;){var v=31-ht(p),S=1<<v;d[v]=-1,p&=~S}s!==0&&fo(r,s,i)}function Kc(){return(ft&6)===0?(Vo(0),!1):!0}function Sm(){if(We!==null){if(gt===0)var r=We.return;else r=We,ua=Qi=null,Uh(r),Yl=null,_o=0,r=We;for(;r!==null;)Ex(r.alternate,r),r=r.return;We=null}}function ls(r,i){var s=r.timeoutHandle;s!==-1&&(r.timeoutHandle=-1,u2(s)),s=r.cancelPendingCommit,s!==null&&(r.cancelPendingCommit=null,s()),xa=0,Sm(),kt=r,We=s=sa(r.current,null),nt=i,gt=0,tr=null,Ya=!1,rs=Ia(r,i),gm=!1,as=nr=ym=nl=Xa=Ut=0,Fn=Ho=null,vm=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var p=31-ht(d),v=1<<p;i|=r[p],d&=~v}return ba=i,gc(),s}function Yx(r,i){Ze=null,Z.H=Lo,i===Kl||i===jc?(i=fb(),gt=3):i===Eh?(i=fb(),gt=4):gt=i===em?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,tr=i,We===null&&(Ut=1,Uc(r,gr(i,r.current)))}function Xx(){var r=Wn.current;return r===null?!0:(nt&4194048)===nt?xr===null:(nt&62914560)===nt||(nt&536870912)!==0?r===xr:!1}function Jx(){var r=Z.H;return Z.H=Lo,r===null?Lo:r}function Wx(){var r=Z.A;return Z.A=$_,r}function Yc(){Ut=4,Ya||(nt&4194048)!==nt&&Wn.current!==null||(rs=!0),(Xa&134217727)===0&&(nl&134217727)===0||kt===null||ei(kt,nt,nr,!1)}function km(r,i,s){var d=ft;ft|=2;var p=Jx(),v=Wx();(kt!==r||nt!==i)&&(Gc=null,ls(r,i)),i=!1;var S=Ut;e:do try{if(gt!==0&&We!==null){var _=We,$=tr;switch(gt){case 8:Sm(),S=6;break e;case 3:case 2:case 9:case 6:Wn.current===null&&(i=!0);var G=gt;if(gt=0,tr=null,ss(r,_,$,G),s&&rs){S=0;break e}break;default:G=gt,gt=0,tr=null,ss(r,_,$,G)}}H_(),S=Ut;break}catch(ae){Yx(r,ae)}while(!0);return i&&r.shellSuspendCounter++,ua=Qi=null,ft=d,Z.H=p,Z.A=v,We===null&&(kt=null,nt=0,gc()),S}function H_(){for(;We!==null;)e0(We)}function Z_(r,i){var s=ft;ft|=2;var d=Jx(),p=Wx();kt!==r||nt!==i?(Gc=null,Qc=mn()+500,ls(r,i)):rs=Ia(r,i);e:do try{if(gt!==0&&We!==null){i=We;var v=tr;t:switch(gt){case 1:gt=0,tr=null,ss(r,i,v,1);break;case 2:case 9:if(cb(v)){gt=0,tr=null,t0(i);break}i=function(){gt!==2&>!==9||kt!==r||(gt=7),qr(r)},v.then(i,i);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:cb(v)?(gt=0,tr=null,t0(i)):(gt=0,tr=null,ss(r,i,v,7));break;case 5:var S=null;switch(We.tag){case 26:S=We.memoizedState;case 5:case 27:var _=We;if(S?B0(S):_.stateNode.complete){gt=0,tr=null;var $=_.sibling;if($!==null)We=$;else{var G=_.return;G!==null?(We=G,Xc(G)):We=null}break t}}gt=0,tr=null,ss(r,i,v,5);break;case 6:gt=0,tr=null,ss(r,i,v,6);break;case 8:Sm(),Ut=6;break e;default:throw Error(a(462))}}V_();break}catch(ae){Yx(r,ae)}while(!0);return ua=Qi=null,Z.H=d,Z.A=p,ft=s,We!==null?0:(kt=null,nt=0,gc(),Ut)}function V_(){for(;We!==null&&!oo();)e0(We)}function e0(r){var i=jx(r.alternate,r,ba);r.memoizedProps=r.pendingProps,i===null?Xc(r):We=i}function t0(r){var i=r,s=i.alternate;switch(i.tag){case 15:case 0:i=vx(s,i,i.pendingProps,i.type,void 0,nt);break;case 11:i=vx(s,i,i.pendingProps,i.type.render,i.ref,nt);break;case 5:Uh(i);default:Ex(s,i),i=We=Wv(i,ba),i=jx(s,i,ba)}r.memoizedProps=r.pendingProps,i===null?Xc(r):We=i}function ss(r,i,s,d){ua=Qi=null,Uh(i),Yl=null,_o=0;var p=i.return;try{if(D_(r,p,i,s,nt)){Ut=1,Uc(r,gr(s,r.current)),We=null;return}}catch(v){if(p!==null)throw We=p,v;Ut=1,Uc(r,gr(s,r.current)),We=null;return}i.flags&32768?(it||d===1?r=!0:rs||(nt&536870912)!==0?r=!1:(Ya=r=!0,(d===2||d===9||d===3||d===6)&&(d=Wn.current,d!==null&&d.tag===13&&(d.flags|=16384))),n0(i,r)):Xc(i)}function Xc(r){var i=r;do{if((i.flags&32768)!==0){n0(i,Ya);return}r=i.return;var s=I_(i.alternate,i,ba);if(s!==null){We=s;return}if(i=i.sibling,i!==null){We=i;return}We=i=r}while(i!==null);Ut===0&&(Ut=5)}function n0(r,i){do{var s=U_(r.alternate,r);if(s!==null){s.flags&=32767,We=s;return}if(s=r.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(r=r.sibling,r!==null)){We=r;return}We=r=s}while(r!==null);Ut=6,We=null}function r0(r,i,s,d,p,v,S,_,$){r.cancelPendingCommit=null;do Jc();while(rn!==0);if((ft&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=dh,ra(r,s,v,S,_,$),r===kt&&(We=kt=null,nt=0),is=i,Wa=r,xa=s,bm=v,xm=p,Vx=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Y_(Ue,function(){return o0(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=Z.T,Z.T=null,p=te.p,te.p=2,S=ft,ft|=4;try{P_(r,i,s)}finally{ft=S,te.p=p,Z.T=d}}rn=1,a0(),i0(),l0()}}function a0(){if(rn===1){rn=0;var r=Wa,i=is,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=Z.T,Z.T=null;var d=te.p;te.p=2;var p=ft;ft|=4;try{Ux(i,r);var v=Mm,S=Hv(r.containerInfo),_=v.focusedElem,$=v.selectionRange;if(S!==_&&_&&_.ownerDocument&&qv(_.ownerDocument.documentElement,_)){if($!==null&&lh(_)){var G=$.start,ae=$.end;if(ae===void 0&&(ae=G),"selectionStart"in _)_.selectionStart=G,_.selectionEnd=Math.min(ae,_.value.length);else{var fe=_.ownerDocument||document,Y=fe&&fe.defaultView||window;if(Y.getSelection){var W=Y.getSelection(),Ce=_.textContent.length,De=Math.min($.start,Ce),xt=$.end===void 0?De:Math.min($.end,Ce);!W.extend&&De>xt&&(S=xt,xt=De,De=S);var V=Fv(_,De),H=Fv(_,xt);if(V&&H&&(W.rangeCount!==1||W.anchorNode!==V.node||W.anchorOffset!==V.offset||W.focusNode!==H.node||W.focusOffset!==H.offset)){var Q=fe.createRange();Q.setStart(V.node,V.offset),W.removeAllRanges(),De>xt?(W.addRange(Q),W.extend(H.node,H.offset)):(Q.setEnd(H.node,H.offset),W.addRange(Q))}}}}for(fe=[],W=_;W=W.parentNode;)W.nodeType===1&&fe.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<fe.length;_++){var oe=fe[_];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}cd=!!Dm,Mm=Dm=null}finally{ft=p,te.p=d,Z.T=s}}r.current=i,rn=2}}function i0(){if(rn===2){rn=0;var r=Wa,i=is,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=Z.T,Z.T=null;var d=te.p;te.p=2;var p=ft;ft|=4;try{Ox(r,i.alternate,i)}finally{ft=p,te.p=d,Z.T=s}}rn=3}}function l0(){if(rn===4||rn===3){rn=0,uo();var r=Wa,i=is,s=xa,d=Vx;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?rn=5:(rn=0,is=Wa=null,s0(r,r.pendingLanes));var p=r.pendingLanes;if(p===0&&(Ja=null),$f(s),i=i.stateNode,Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(nn,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=Z.T,p=te.p,te.p=2,Z.T=null;try{for(var v=r.onRecoverableError,S=0;S<d.length;S++){var _=d[S];v(_.value,{componentStack:_.stack})}}finally{Z.T=i,te.p=p}}(xa&3)!==0&&Jc(),qr(r),p=r.pendingLanes,(s&261930)!==0&&(p&42)!==0?r===wm?Zo++:(Zo=0,wm=r):Zo=0,Vo(0)}}function s0(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Eo(i)))}function Jc(){return a0(),i0(),l0(),o0()}function o0(){if(rn!==5)return!1;var r=Wa,i=bm;bm=0;var s=$f(xa),d=Z.T,p=te.p;try{te.p=32>s?32:s,Z.T=null,s=xm,xm=null;var v=Wa,S=xa;if(rn=0,is=Wa=null,xa=0,(ft&6)!==0)throw Error(a(331));var _=ft;if(ft|=4,qx(v.current),Bx(v,v.current,S,s),ft=_,Vo(0,!1),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(nn,v)}catch{}return!0}finally{te.p=p,Z.T=d,s0(r,i)}}function u0(r,i,s){i=gr(s,i),i=Wh(r.stateNode,i,2),r=Va(r,i,2),r!==null&&(yn(r,2),qr(r))}function yt(r,i,s){if(r.tag===3)u0(r,r,s);else for(;i!==null;){if(i.tag===3){u0(i,r,s);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ja===null||!Ja.has(d))){r=gr(s,r),s=cx(2),d=Va(i,s,2),d!==null&&(dx(s,d,i,r),yn(d,2),qr(d));break}}i=i.return}}function jm(r,i,s){var d=r.pingCache;if(d===null){d=r.pingCache=new F_;var p=new Set;d.set(i,p)}else p=d.get(i),p===void 0&&(p=new Set,d.set(i,p));p.has(s)||(gm=!0,p.add(s),r=Q_.bind(null,r,i,s),i.then(r,r))}function Q_(r,i,s){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&s,r.warmLanes&=~s,kt===r&&(nt&s)===s&&(Ut===4||Ut===3&&(nt&62914560)===nt&&300>mn()-Vc?(ft&2)===0&&ls(r,0):ym|=s,as===nt&&(as=0)),qr(r)}function c0(r,i){i===0&&(i=Se()),r=Hi(r,i),r!==null&&(yn(r,i),qr(r))}function G_(r){var i=r.memoizedState,s=0;i!==null&&(s=i.retryLane),c0(r,s)}function K_(r,i){var s=0;switch(r.tag){case 31:case 13:var d=r.stateNode,p=r.memoizedState;p!==null&&(s=p.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),c0(r,s)}function Y_(r,i){return La(r,i)}var Wc=null,os=null,Cm=!1,ed=!1,Em=!1,ti=0;function qr(r){r!==os&&r.next===null&&(os===null?Wc=os=r:os=os.next=r),ed=!0,Cm||(Cm=!0,J_())}function Vo(r,i){if(!Em&&ed){Em=!0;do for(var s=!1,d=Wc;d!==null;){if(r!==0){var p=d.pendingLanes;if(p===0)var v=0;else{var S=d.suspendedLanes,_=d.pingedLanes;v=(1<<31-ht(42|r)+1)-1,v&=p&~(S&~_),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(s=!0,m0(d,v))}else v=nt,v=Pi(d,d===kt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Ia(d,v)||(s=!0,m0(d,v));d=d.next}while(s);Em=!1}}function X_(){d0()}function d0(){ed=Cm=!1;var r=0;ti!==0&&o2()&&(r=ti);for(var i=mn(),s=null,d=Wc;d!==null;){var p=d.next,v=f0(d,i);v===0?(d.next=null,s===null?Wc=p:s.next=p,p===null&&(os=s)):(s=d,(r!==0||(v&3)!==0)&&(ed=!0)),d=p}rn!==0&&rn!==5||Vo(r),ti!==0&&(ti=0)}function f0(r,i){for(var s=r.suspendedLanes,d=r.pingedLanes,p=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var S=31-ht(v),_=1<<S,$=p[S];$===-1?((_&s)===0||(_&d)!==0)&&(p[S]=rc(_,i)):$<=i&&(r.expiredLanes|=_),v&=~_}if(i=kt,s=nt,s=Pi(r,r===i?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,s===0||r===i&&(gt===2||gt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&na(d),r.callbackNode=null,r.callbackPriority=0;if((s&3)===0||Ia(r,s)){if(i=s&-s,i===r.callbackPriority)return i;switch(d!==null&&na(d),$f(s)){case 2:case 8:s=be;break;case 32:s=Ue;break;case 268435456:s=at;break;default:s=Ue}return d=h0.bind(null,r),s=La(s,d),r.callbackPriority=i,r.callbackNode=s,i}return d!==null&&d!==null&&na(d),r.callbackPriority=2,r.callbackNode=null,2}function h0(r,i){if(rn!==0&&rn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var s=r.callbackNode;if(Jc()&&r.callbackNode!==s)return null;var d=nt;return d=Pi(r,r===kt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Gx(r,d,i),f0(r,mn()),r.callbackNode!=null&&r.callbackNode===s?h0.bind(null,r):null)}function m0(r,i){if(Jc())return null;Gx(r,i,!0)}function J_(){c2(function(){(ft&6)!==0?La(le,X_):d0()})}function Nm(){if(ti===0){var r=Ql;r===0&&(r=Li,Li<<=1,(Li&261888)===0&&(Li=256)),ti=r}return ti}function p0(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:oc(""+r)}function g0(r,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,r.id&&s.setAttribute("form",r.id),i.parentNode.insertBefore(s,i),r=new FormData(r),s.parentNode.removeChild(s),r}function W_(r,i,s,d,p){if(i==="submit"&&s&&s.stateNode===p){var v=p0((p[In]||null).action),S=d.submitter;S&&(i=(i=S[In]||null)?p0(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var _=new fc("action","action",null,d,p);r.push({event:_,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ti!==0){var $=S?g0(p,S):new FormData(p);Qh(s,{pending:!0,data:$,method:p.method,action:v},null,$)}}else typeof v=="function"&&(_.preventDefault(),$=S?g0(p,S):new FormData(p),Qh(s,{pending:!0,data:$,method:p.method,action:v},v,$))},currentTarget:p}]})}}for(var _m=0;_m<ch.length;_m++){var Tm=ch[_m],e2=Tm.toLowerCase(),t2=Tm[0].toUpperCase()+Tm.slice(1);Or(e2,"on"+t2)}Or(Qv,"onAnimationEnd"),Or(Gv,"onAnimationIteration"),Or(Kv,"onAnimationStart"),Or("dblclick","onDoubleClick"),Or("focusin","onFocus"),Or("focusout","onBlur"),Or(y_,"onTransitionRun"),Or(v_,"onTransitionStart"),Or(b_,"onTransitionCancel"),Or(Yv,"onTransitionEnd"),Ol("onMouseEnter",["mouseout","mouseover"]),Ol("onMouseLeave",["mouseout","mouseover"]),Ol("onPointerEnter",["pointerout","pointerover"]),Ol("onPointerLeave",["pointerout","pointerover"]),Bi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qo="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(" "),n2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qo));function y0(r,i){i=(i&4)!==0;for(var s=0;s<r.length;s++){var d=r[s],p=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var _=d[S],$=_.instance,G=_.currentTarget;if(_=_.listener,$!==v&&p.isPropagationStopped())break e;v=_,p.currentTarget=G;try{v(p)}catch(ae){pc(ae)}p.currentTarget=null,v=$}else for(S=0;S<d.length;S++){if(_=d[S],$=_.instance,G=_.currentTarget,_=_.listener,$!==v&&p.isPropagationStopped())break e;v=_,p.currentTarget=G;try{v(p)}catch(ae){pc(ae)}p.currentTarget=null,v=$}}}}function et(r,i){var s=i[Ff];s===void 0&&(s=i[Ff]=new Set);var d=r+"__bubble";s.has(d)||(v0(i,r,2,!1),s.add(d))}function Am(r,i,s){var d=0;i&&(d|=4),v0(s,r,d,i)}var td="_reactListening"+Math.random().toString(36).slice(2);function Rm(r){if(!r[td]){r[td]=!0,dv.forEach(function(s){s!=="selectionchange"&&(n2.has(s)||Am(s,!1,r),Am(s,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[td]||(i[td]=!0,Am("selectionchange",!1,i))}}function v0(r,i,s,d){switch(Q0(i)){case 2:var p=A2;break;case 8:p=R2;break;default:p=Vm}s=p.bind(null,i,s,r),p=void 0,!Xf||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(p=!0),d?p!==void 0?r.addEventListener(i,s,{capture:!0,passive:p}):r.addEventListener(i,s,!0):p!==void 0?r.addEventListener(i,s,{passive:p}):r.addEventListener(i,s,!1)}function zm(r,i,s,d,p){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 _=d.stateNode.containerInfo;if(_===p)break;if(S===4)for(S=d.return;S!==null;){var $=S.tag;if(($===3||$===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;_!==null;){if(S=Al(_),S===null)return;if($=S.tag,$===5||$===6||$===26||$===27){d=v=S;continue e}_=_.parentNode}}d=d.return}kv(function(){var G=v,ae=Kf(s),fe=[];e:{var Y=Xv.get(r);if(Y!==void 0){var W=fc,Ce=r;switch(r){case"keypress":if(cc(s)===0)break e;case"keydown":case"keyup":W=KN;break;case"focusin":Ce="focus",W=th;break;case"focusout":Ce="blur",W=th;break;case"beforeblur":case"afterblur":W=th;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=Ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=IN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=JN;break;case Qv:case Gv:case Kv:W=BN;break;case Yv:W=e_;break;case"scroll":case"scrollend":W=MN;break;case"wheel":W=n_;break;case"copy":case"cut":case"paste":W=FN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=_v;break;case"toggle":case"beforetoggle":W=a_}var De=(i&4)!==0,xt=!De&&(r==="scroll"||r==="scrollend"),V=De?Y!==null?Y+"Capture":null:Y;De=[];for(var H=G,Q;H!==null;){var oe=H;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||V===null||(oe=po(H,V),oe!=null&&De.push(Go(H,oe,Q))),xt)break;H=H.return}0<De.length&&(Y=new W(Y,Ce,null,s,ae),fe.push({event:Y,listeners:De}))}}if((i&7)===0){e:{if(Y=r==="mouseover"||r==="pointerover",W=r==="mouseout"||r==="pointerout",Y&&s!==Gf&&(Ce=s.relatedTarget||s.fromElement)&&(Al(Ce)||Ce[Tl]))break e;if((W||Y)&&(Y=ae.window===ae?ae:(Y=ae.ownerDocument)?Y.defaultView||Y.parentWindow:window,W?(Ce=s.relatedTarget||s.toElement,W=G,Ce=Ce?Al(Ce):null,Ce!==null&&(xt=o(Ce),De=Ce.tag,Ce!==xt||De!==5&&De!==27&&De!==6)&&(Ce=null)):(W=null,Ce=G),W!==Ce)){if(De=Ev,oe="onMouseLeave",V="onMouseEnter",H="mouse",(r==="pointerout"||r==="pointerover")&&(De=_v,oe="onPointerLeave",V="onPointerEnter",H="pointer"),xt=W==null?Y:mo(W),Q=Ce==null?Y:mo(Ce),Y=new De(oe,H+"leave",W,s,ae),Y.target=xt,Y.relatedTarget=Q,oe=null,Al(ae)===G&&(De=new De(V,H+"enter",Ce,s,ae),De.target=Q,De.relatedTarget=xt,oe=De),xt=oe,W&&Ce)t:{for(De=r2,V=W,H=Ce,Q=0,oe=V;oe;oe=De(oe))Q++;oe=0;for(var ze=H;ze;ze=De(ze))oe++;for(;0<Q-oe;)V=De(V),Q--;for(;0<oe-Q;)H=De(H),oe--;for(;Q--;){if(V===H||H!==null&&V===H.alternate){De=V;break t}V=De(V),H=De(H)}De=null}else De=null;W!==null&&b0(fe,Y,W,De,!1),Ce!==null&&xt!==null&&b0(fe,xt,Ce,De,!0)}}e:{if(Y=G?mo(G):window,W=Y.nodeName&&Y.nodeName.toLowerCase(),W==="select"||W==="input"&&Y.type==="file")var ct=Lv;else if(Dv(Y))if(Iv)ct=m_;else{ct=f_;var Te=d_}else W=Y.nodeName,!W||W.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?G&&Qf(G.elementType)&&(ct=Lv):ct=h_;if(ct&&(ct=ct(r,G))){Mv(fe,ct,s,ae);break e}Te&&Te(r,Y,G),r==="focusout"&&G&&Y.type==="number"&&G.memoizedProps.value!=null&&Vf(Y,"number",Y.value)}switch(Te=G?mo(G):window,r){case"focusin":(Dv(Te)||Te.contentEditable==="true")&&(Pl=Te,sh=G,ko=null);break;case"focusout":ko=sh=Pl=null;break;case"mousedown":oh=!0;break;case"contextmenu":case"mouseup":case"dragend":oh=!1,Zv(fe,s,ae);break;case"selectionchange":if(g_)break;case"keydown":case"keyup":Zv(fe,s,ae)}var Qe;if(rh)e:{switch(r){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Ul?zv(r,s)&&(rt="onCompositionEnd"):r==="keydown"&&s.keyCode===229&&(rt="onCompositionStart");rt&&(Tv&&s.locale!=="ko"&&(Ul||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Ul&&(Qe=jv()):(Pa=ae,Jf="value"in Pa?Pa.value:Pa.textContent,Ul=!0)),Te=nd(G,rt),0<Te.length&&(rt=new Nv(rt,r,null,s,ae),fe.push({event:rt,listeners:Te}),Qe?rt.data=Qe:(Qe=Ov(s),Qe!==null&&(rt.data=Qe)))),(Qe=l_?s_(r,s):o_(r,s))&&(rt=nd(G,"onBeforeInput"),0<rt.length&&(Te=new Nv("onBeforeInput","beforeinput",null,s,ae),fe.push({event:Te,listeners:rt}),Te.data=Qe)),W_(fe,r,G,s,ae)}y0(fe,i)})}function Go(r,i,s){return{instance:r,listener:i,currentTarget:s}}function nd(r,i){for(var s=i+"Capture",d=[];r!==null;){var p=r,v=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||v===null||(p=po(r,s),p!=null&&d.unshift(Go(r,p,v)),p=po(r,i),p!=null&&d.push(Go(r,p,v))),r.tag===3)return d;r=r.return}return[]}function r2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function b0(r,i,s,d,p){for(var v=i._reactName,S=[];s!==null&&s!==d;){var _=s,$=_.alternate,G=_.stateNode;if(_=_.tag,$!==null&&$===d)break;_!==5&&_!==26&&_!==27||G===null||($=G,p?(G=po(s,v),G!=null&&S.unshift(Go(s,G,$))):p||(G=po(s,v),G!=null&&S.push(Go(s,G,$)))),s=s.return}S.length!==0&&r.push({event:i,listeners:S})}var a2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function x0(r){return(typeof r=="string"?r:""+r).replace(a2,`
|
|
49
|
+
`).replace(i2,"")}function w0(r,i){return i=x0(i),x0(r)===i}function bt(r,i,s,d,p,v){switch(s){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Ml(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Ml(r,""+d);break;case"className":lc(r,"class",d);break;case"tabIndex":lc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(r,s,d);break;case"style":wv(r,d,v);break;case"data":if(i!=="object"){lc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||s!=="href")){r.removeAttribute(s);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(s);break}d=oc(""+d),r.setAttribute(s,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(s,"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"&&(s==="formAction"?(i!=="input"&&bt(r,i,"name",p.name,p,null),bt(r,i,"formEncType",p.formEncType,p,null),bt(r,i,"formMethod",p.formMethod,p,null),bt(r,i,"formTarget",p.formTarget,p,null)):(bt(r,i,"encType",p.encType,p,null),bt(r,i,"method",p.method,p,null),bt(r,i,"target",p.target,p,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(s);break}d=oc(""+d),r.setAttribute(s,d);break;case"onClick":d!=null&&(r.onclick=ia);break;case"onScroll":d!=null&&et("scroll",r);break;case"onScrollEnd":d!=null&&et("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(s=d.__html,s!=null){if(p.children!=null)throw Error(a(60));r.innerHTML=s}}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}s=oc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);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(s,""+d):r.removeAttribute(s);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(s,""):r.removeAttribute(s);break;case"capture":case"download":d===!0?r.setAttribute(s,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(s,d):r.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(s,d):r.removeAttribute(s);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(s):r.setAttribute(s,d);break;case"popover":et("beforetoggle",r),et("toggle",r),ic(r,"popover",d);break;case"xlinkActuate":aa(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":aa(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":aa(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":aa(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":aa(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":aa(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":aa(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":aa(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":aa(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ic(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=ON.get(s)||s,ic(r,s,d))}}function Om(r,i,s,d,p,v){switch(s){case"style":wv(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(s=d.__html,s!=null){if(p.children!=null)throw Error(a(60));r.innerHTML=s}}break;case"children":typeof d=="string"?Ml(r,d):(typeof d=="number"||typeof d=="bigint")&&Ml(r,""+d);break;case"onScroll":d!=null&&et("scroll",r);break;case"onScrollEnd":d!=null&&et("scrollend",r);break;case"onClick":d!=null&&(r.onclick=ia);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fv.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(p=s.endsWith("Capture"),i=s.slice(2,p?s.length-7:void 0),v=r[In]||null,v=v!=null?v[s]:null,typeof v=="function"&&r.removeEventListener(i,v,p),typeof d=="function")){typeof v!="function"&&v!==null&&(s in r?r[s]=null:r.hasAttribute(s)&&r.removeAttribute(s)),r.addEventListener(i,d,p);break e}s in r?r[s]=d:d===!0?r.setAttribute(s,""):ic(r,s,d)}}}function Sn(r,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",r),et("load",r);var d=!1,p=!1,v;for(v in s)if(s.hasOwnProperty(v)){var S=s[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:bt(r,i,v,S,s,null)}}p&&bt(r,i,"srcSet",s.srcSet,s,null),d&&bt(r,i,"src",s.src,s,null);return;case"input":et("invalid",r);var _=v=S=p=null,$=null,G=null;for(d in s)if(s.hasOwnProperty(d)){var ae=s[d];if(ae!=null)switch(d){case"name":p=ae;break;case"type":S=ae;break;case"checked":$=ae;break;case"defaultChecked":G=ae;break;case"value":v=ae;break;case"defaultValue":_=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:bt(r,i,d,ae,s,null)}}yv(r,v,_,$,G,S,p,!1);return;case"select":et("invalid",r),d=S=v=null;for(p in s)if(s.hasOwnProperty(p)&&(_=s[p],_!=null))switch(p){case"value":v=_;break;case"defaultValue":S=_;break;case"multiple":d=_;default:bt(r,i,p,_,s,null)}i=v,s=S,r.multiple=!!d,i!=null?Dl(r,!!d,i,!1):s!=null&&Dl(r,!!d,s,!0);return;case"textarea":et("invalid",r),v=p=d=null;for(S in s)if(s.hasOwnProperty(S)&&(_=s[S],_!=null))switch(S){case"value":d=_;break;case"defaultValue":p=_;break;case"children":v=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:bt(r,i,S,_,s,null)}bv(r,d,p,v);return;case"option":for($ in s)if(s.hasOwnProperty($)&&(d=s[$],d!=null))switch($){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:bt(r,i,$,d,s,null)}return;case"dialog":et("beforetoggle",r),et("toggle",r),et("cancel",r),et("close",r);break;case"iframe":case"object":et("load",r);break;case"video":case"audio":for(d=0;d<Qo.length;d++)et(Qo[d],r);break;case"image":et("error",r),et("load",r);break;case"details":et("toggle",r);break;case"embed":case"source":case"link":et("error",r),et("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(G in s)if(s.hasOwnProperty(G)&&(d=s[G],d!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:bt(r,i,G,d,s,null)}return;default:if(Qf(i)){for(ae in s)s.hasOwnProperty(ae)&&(d=s[ae],d!==void 0&&Om(r,i,ae,d,s,void 0));return}}for(_ in s)s.hasOwnProperty(_)&&(d=s[_],d!=null&&bt(r,i,_,d,s,null))}function l2(r,i,s,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,v=null,S=null,_=null,$=null,G=null,ae=null;for(W in s){var fe=s[W];if(s.hasOwnProperty(W)&&fe!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":$=fe;default:d.hasOwnProperty(W)||bt(r,i,W,null,d,fe)}}for(var Y in d){var W=d[Y];if(fe=s[Y],d.hasOwnProperty(Y)&&(W!=null||fe!=null))switch(Y){case"type":v=W;break;case"name":p=W;break;case"checked":G=W;break;case"defaultChecked":ae=W;break;case"value":S=W;break;case"defaultValue":_=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(a(137,i));break;default:W!==fe&&bt(r,i,Y,W,d,fe)}}Zf(r,S,_,$,G,ae,v,p);return;case"select":W=S=_=Y=null;for(v in s)if($=s[v],s.hasOwnProperty(v)&&$!=null)switch(v){case"value":break;case"multiple":W=$;default:d.hasOwnProperty(v)||bt(r,i,v,null,d,$)}for(p in d)if(v=d[p],$=s[p],d.hasOwnProperty(p)&&(v!=null||$!=null))switch(p){case"value":Y=v;break;case"defaultValue":_=v;break;case"multiple":S=v;default:v!==$&&bt(r,i,p,v,d,$)}i=_,s=S,d=W,Y!=null?Dl(r,!!s,Y,!1):!!d!=!!s&&(i!=null?Dl(r,!!s,i,!0):Dl(r,!!s,s?[]:"",!1));return;case"textarea":W=Y=null;for(_ in s)if(p=s[_],s.hasOwnProperty(_)&&p!=null&&!d.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:bt(r,i,_,null,d,p)}for(S in d)if(p=d[S],v=s[S],d.hasOwnProperty(S)&&(p!=null||v!=null))switch(S){case"value":Y=p;break;case"defaultValue":W=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(a(91));break;default:p!==v&&bt(r,i,S,p,d,v)}vv(r,Y,W);return;case"option":for(var Ce in s)if(Y=s[Ce],s.hasOwnProperty(Ce)&&Y!=null&&!d.hasOwnProperty(Ce))switch(Ce){case"selected":r.selected=!1;break;default:bt(r,i,Ce,null,d,Y)}for($ in d)if(Y=d[$],W=s[$],d.hasOwnProperty($)&&Y!==W&&(Y!=null||W!=null))switch($){case"selected":r.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:bt(r,i,$,Y,d,W)}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 De in s)Y=s[De],s.hasOwnProperty(De)&&Y!=null&&!d.hasOwnProperty(De)&&bt(r,i,De,null,d,Y);for(G in d)if(Y=d[G],W=s[G],d.hasOwnProperty(G)&&Y!==W&&(Y!=null||W!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,i));break;default:bt(r,i,G,Y,d,W)}return;default:if(Qf(i)){for(var xt in s)Y=s[xt],s.hasOwnProperty(xt)&&Y!==void 0&&!d.hasOwnProperty(xt)&&Om(r,i,xt,void 0,d,Y);for(ae in d)Y=d[ae],W=s[ae],!d.hasOwnProperty(ae)||Y===W||Y===void 0&&W===void 0||Om(r,i,ae,Y,d,W);return}}for(var V in s)Y=s[V],s.hasOwnProperty(V)&&Y!=null&&!d.hasOwnProperty(V)&&bt(r,i,V,null,d,Y);for(fe in d)Y=d[fe],W=s[fe],!d.hasOwnProperty(fe)||Y===W||Y==null&&W==null||bt(r,i,fe,Y,d,W)}function S0(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function s2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,s=performance.getEntriesByType("resource"),d=0;d<s.length;d++){var p=s[d],v=p.transferSize,S=p.initiatorType,_=p.duration;if(v&&_&&S0(S)){for(S=0,_=p.responseEnd,d+=1;d<s.length;d++){var $=s[d],G=$.startTime;if(G>_)break;var ae=$.transferSize,fe=$.initiatorType;ae&&S0(fe)&&($=$.responseEnd,S+=ae*($<_?1:(_-G)/($-G)))}if(--d,i+=8*(v+S)/(p.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 Dm=null,Mm=null;function rd(r){return r.nodeType===9?r:r.ownerDocument}function k0(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 j0(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 Lm(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 Im=null;function o2(){var r=window.event;return r&&r.type==="popstate"?r===Im?!1:(Im=r,!0):(Im=null,!1)}var C0=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,E0=typeof Promise=="function"?Promise:void 0,c2=typeof queueMicrotask=="function"?queueMicrotask:typeof E0<"u"?function(r){return E0.resolve(null).then(r).catch(d2)}:C0;function d2(r){setTimeout(function(){throw r})}function ni(r){return r==="head"}function N0(r,i){var s=i,d=0;do{var p=s.nextSibling;if(r.removeChild(s),p&&p.nodeType===8)if(s=p.data,s==="/$"||s==="/&"){if(d===0){r.removeChild(p),fs(i);return}d--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")d++;else if(s==="html")Ko(r.ownerDocument.documentElement);else if(s==="head"){s=r.ownerDocument.head,Ko(s);for(var v=s.firstChild;v;){var S=v.nextSibling,_=v.nodeName;v[ho]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&v.rel.toLowerCase()==="stylesheet"||s.removeChild(v),v=S}}else s==="body"&&Ko(r.ownerDocument.body);s=p}while(s);fs(i)}function _0(r,i){var s=r;r=0;do{var d=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),d&&d.nodeType===8)if(s=d.data,s==="/$"){if(r===0)break;r--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||r++;s=d}while(s)}function Um(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Um(s),qf(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}r.removeChild(s)}}function f2(r,i,s,d){for(;r.nodeType===1;){var p=s;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[ho])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!==p.rel||r.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||r.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||r.getAttribute("title")!==(p.title==null?null:p.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(p.src==null?null:p.src)||r.getAttribute("type")!==(p.type==null?null:p.type)||r.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=p.name==null?null:""+p.name;if(p.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=wr(r.nextSibling),r===null)break}return null}function h2(r,i,s){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=wr(r.nextSibling),r===null))return null;return r}function T0(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=wr(r.nextSibling),r===null))return null;return r}function Pm(r){return r.data==="$?"||r.data==="$~"}function Bm(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function m2(r,i){var s=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||s.readyState!=="loading")i();else{var d=function(){i(),s.removeEventListener("DOMContentLoaded",d)};s.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function wr(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 $m=null;function A0(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var s=r.data;if(s==="/$"||s==="/&"){if(i===0)return wr(r.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}r=r.nextSibling}return null}function R0(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var s=r.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return r;i--}else s!=="/$"&&s!=="/&"||i++}r=r.previousSibling}return null}function z0(r,i,s){switch(i=rd(s),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 Ko(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);qf(r)}var Sr=new Map,O0=new Set;function ad(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var wa=te.d;te.d={f:p2,r:g2,D:y2,C:v2,L:b2,m:x2,X:S2,S:w2,M:k2};function p2(){var r=wa.f(),i=Kc();return r||i}function g2(r){var i=Rl(r);i!==null&&i.tag===5&&i.type==="form"?Yb(i):wa.r(r)}var us=typeof document>"u"?null:document;function D0(r,i,s){var d=us;if(d&&typeof i=="string"&&i){var p=mr(i);p='link[rel="'+r+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),O0.has(p)||(O0.add(p),r={rel:r,crossOrigin:s,href:i},d.querySelector(p)===null&&(i=d.createElement("link"),Sn(i,"link",r),on(i),d.head.appendChild(i)))}}function y2(r){wa.D(r),D0("dns-prefetch",r,null)}function v2(r,i){wa.C(r,i),D0("preconnect",r,i)}function b2(r,i,s){wa.L(r,i,s);var d=us;if(d&&r&&i){var p='link[rel="preload"][as="'+mr(i)+'"]';i==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+mr(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+mr(s.imageSizes)+'"]')):p+='[href="'+mr(r)+'"]';var v=p;switch(i){case"style":v=cs(r);break;case"script":v=ds(r)}Sr.has(v)||(r=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:r,as:i},s),Sr.set(v,r),d.querySelector(p)!==null||i==="style"&&d.querySelector(Yo(v))||i==="script"&&d.querySelector(Xo(v))||(i=d.createElement("link"),Sn(i,"link",r),on(i),d.head.appendChild(i)))}}function x2(r,i){wa.m(r,i);var s=us;if(s&&r){var d=i&&typeof i.as=="string"?i.as:"script",p='link[rel="modulepreload"][as="'+mr(d)+'"][href="'+mr(r)+'"]',v=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ds(r)}if(!Sr.has(v)&&(r=g({rel:"modulepreload",href:r},i),Sr.set(v,r),s.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Xo(v)))return}d=s.createElement("link"),Sn(d,"link",r),on(d),s.head.appendChild(d)}}}function w2(r,i,s){wa.S(r,i,s);var d=us;if(d&&r){var p=zl(d).hoistableStyles,v=cs(r);i=i||"default";var S=p.get(v);if(!S){var _={loading:0,preload:null};if(S=d.querySelector(Yo(v)))_.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},s),(s=Sr.get(v))&&Fm(r,s);var $=S=d.createElement("link");on($),Sn($,"link",r),$._p=new Promise(function(G,ae){$.onload=G,$.onerror=ae}),$.addEventListener("load",function(){_.loading|=1}),$.addEventListener("error",function(){_.loading|=2}),_.loading|=4,id(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:_},p.set(v,S)}}}function S2(r,i){wa.X(r,i);var s=us;if(s&&r){var d=zl(s).hoistableScripts,p=ds(r),v=d.get(p);v||(v=s.querySelector(Xo(p)),v||(r=g({src:r,async:!0},i),(i=Sr.get(p))&&qm(r,i),v=s.createElement("script"),on(v),Sn(v,"link",r),s.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(p,v))}}function k2(r,i){wa.M(r,i);var s=us;if(s&&r){var d=zl(s).hoistableScripts,p=ds(r),v=d.get(p);v||(v=s.querySelector(Xo(p)),v||(r=g({src:r,async:!0,type:"module"},i),(i=Sr.get(p))&&qm(r,i),v=s.createElement("script"),on(v),Sn(v,"link",r),s.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(p,v))}}function M0(r,i,s,d){var p=(p=ce.current)?ad(p):null;if(!p)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=cs(s.href),s=zl(p).hoistableStyles,d=s.get(i),d||(d={type:"style",instance:null,count:0,state:null},s.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){r=cs(s.href);var v=zl(p).hoistableStyles,S=v.get(r);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,S),(v=p.querySelector(Yo(r)))&&!v._p&&(S.instance=v,S.state.loading=5),Sr.has(r)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Sr.set(r,s),v||j2(p,r,s,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=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ds(s),s=zl(p).hoistableScripts,d=s.get(i),d||(d={type:"script",instance:null,count:0,state:null},s.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function cs(r){return'href="'+mr(r)+'"'}function Yo(r){return'link[rel="stylesheet"]['+r+"]"}function L0(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function j2(r,i,s,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}),Sn(i,"link",s),on(i),r.head.appendChild(i))}function ds(r){return'[src="'+mr(r)+'"]'}function Xo(r){return"script[async]"+r}function I0(r,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+mr(s.href)+'"]');if(d)return i.instance=d,on(d),d;var p=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),on(d),Sn(d,"style",p),id(d,s.precedence,r),i.instance=d;case"stylesheet":p=cs(s.href);var v=r.querySelector(Yo(p));if(v)return i.state.loading|=4,i.instance=v,on(v),v;d=L0(s),(p=Sr.get(p))&&Fm(d,p),v=(r.ownerDocument||r).createElement("link"),on(v);var S=v;return S._p=new Promise(function(_,$){S.onload=_,S.onerror=$}),Sn(v,"link",d),i.state.loading|=4,id(v,s.precedence,r),i.instance=v;case"script":return v=ds(s.src),(p=r.querySelector(Xo(v)))?(i.instance=p,on(p),p):(d=s,(p=Sr.get(v))&&(d=g({},s),qm(d,p)),r=r.ownerDocument||r,p=r.createElement("script"),on(p),Sn(p,"link",d),r.head.appendChild(p),i.instance=p);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,id(d,s.precedence,r));return i.instance}function id(r,i,s){for(var d=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,v=p,S=0;S<d.length;S++){var _=d[S];if(_.dataset.precedence===i)v=_;else if(v!==p)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(r,i.firstChild))}function Fm(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function qm(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var ld=null;function U0(r,i,s){if(ld===null){var d=new Map,p=ld=new Map;p.set(s,d)}else p=ld,d=p.get(s),d||(d=new Map,p.set(s,d));if(d.has(r))return d;for(d.set(r,null),s=s.getElementsByTagName(r),p=0;p<s.length;p++){var v=s[p];if(!(v[ho]||v[vn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=r+S;var _=d.get(S);_?_.push(v):d.set(S,[v])}}return d}function P0(r,i,s){r=r.ownerDocument||r,r.head.insertBefore(s,i==="title"?r.querySelector("head > title"):null)}function C2(r,i,s){if(s===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 B0(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function E2(r,i,s,d){if(s.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=cs(d.href),v=i.querySelector(Yo(p));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=sd.bind(r),i.then(r,r)),s.state.loading|=4,s.instance=v,on(v);return}v=i.ownerDocument||i,d=L0(d),(p=Sr.get(p))&&Fm(d,p),v=v.createElement("link"),on(v);var S=v;S._p=new Promise(function(_,$){S.onload=_,S.onerror=$}),Sn(v,"link",d),s.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(r.count++,s=sd.bind(r),i.addEventListener("load",s),i.addEventListener("error",s))}}var Hm=0;function N2(r,i){return r.stylesheets&&r.count===0&&ud(r,r.stylesheets),0<r.count||0<r.imgCount?function(s){var d=setTimeout(function(){if(r.stylesheets&&ud(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Hm===0&&(Hm=62500*s2());var p=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&ud(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Hm?50:800)+i);return r.unsuspend=s,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function sd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ud(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var od=null;function ud(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,od=new Map,i.forEach(_2,r),od=null,sd.call(r))}function _2(r,i){if(!(i.state.loading&4)){var s=od.get(r);if(s)var d=s.get(null);else{s=new Map,od.set(r,s);for(var p=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<p.length;v++){var S=p[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),d=S)}d&&s.set(null,d)}p=i.instance,S=p.getAttribute("data-precedence"),v=s.get(S)||d,v===d&&s.set(null,p),s.set(S,p),this.count++,d=sd.bind(this),p.addEventListener("load",d),p.addEventListener("error",d),v?v.parentNode.insertBefore(p,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(p,r.firstChild)),i.state.loading|=4}}var Jo={$$typeof:z,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function T2(r,i,s,d,p,v,S,_,$){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=Je(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Je(0),this.hiddenUpdates=Je(null),this.identifierPrefix=d,this.onUncaughtError=p,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function $0(r,i,s,d,p,v,S,_,$,G,ae,fe){return r=new T2(r,i,s,S,$,G,ae,fe,_),i=1,v===!0&&(i|=24),v=Jn(3,null,null,i),r.current=v,v.stateNode=r,i=kh(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:s,cache:i},Nh(v),r}function F0(r){return r?(r=Fl,r):Fl}function q0(r,i,s,d,p,v){p=F0(p),d.context===null?d.context=p:d.pendingContext=p,d=Za(i),d.payload={element:s},v=v===void 0?null:v,v!==null&&(d.callback=v),s=Va(r,d,i),s!==null&&(qn(s,r,i),Ao(s,r,i))}function H0(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var s=r.retryLane;r.retryLane=s!==0&&s<i?s:i}}function Zm(r,i){H0(r,i),(r=r.alternate)&&H0(r,i)}function Z0(r){if(r.tag===13||r.tag===31){var i=Hi(r,67108864);i!==null&&qn(i,r,67108864),Zm(r,67108864)}}function V0(r){if(r.tag===13||r.tag===31){var i=rr();i=Bf(i);var s=Hi(r,i);s!==null&&qn(s,r,i),Zm(r,i)}}var cd=!0;function A2(r,i,s,d){var p=Z.T;Z.T=null;var v=te.p;try{te.p=2,Vm(r,i,s,d)}finally{te.p=v,Z.T=p}}function R2(r,i,s,d){var p=Z.T;Z.T=null;var v=te.p;try{te.p=8,Vm(r,i,s,d)}finally{te.p=v,Z.T=p}}function Vm(r,i,s,d){if(cd){var p=Qm(d);if(p===null)zm(r,i,d,dd,s),G0(r,d);else if(O2(p,r,i,s,d))d.stopPropagation();else if(G0(r,d),i&4&&-1<z2.indexOf(r)){for(;p!==null;){var v=Rl(p);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Pr(v.pendingLanes);if(S!==0){var _=v;for(_.pendingLanes|=2,_.entangledLanes|=2;S;){var $=1<<31-ht(S);_.entanglements[1]|=$,S&=~$}qr(v),(ft&6)===0&&(Qc=mn()+500,Vo(0))}}break;case 31:case 13:_=Hi(v,2),_!==null&&qn(_,v,2),Kc(),Zm(v,2)}if(v=Qm(d),v===null&&zm(r,i,d,dd,s),v===p)break;p=v}p!==null&&d.stopPropagation()}else zm(r,i,d,null,s)}}function Qm(r){return r=Kf(r),Gm(r)}var dd=null;function Gm(r){if(dd=null,r=Al(r),r!==null){var i=o(r);if(i===null)r=null;else{var s=i.tag;if(s===13){if(r=c(i),r!==null)return r;r=null}else if(s===31){if(r=f(i),r!==null)return r;r=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return dd=r,null}function Q0(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(co()){case le:return 2;case be:return 8;case Ue:case $e:return 32;case at:return 268435456;default:return 32}default:return 32}}var Km=!1,ri=null,ai=null,ii=null,Wo=new Map,eu=new Map,li=[],z2="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 G0(r,i){switch(r){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":ii=null;break;case"pointerover":case"pointerout":Wo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":eu.delete(i.pointerId)}}function tu(r,i,s,d,p,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:s,eventSystemFlags:d,nativeEvent:v,targetContainers:[p]},i!==null&&(i=Rl(i),i!==null&&Z0(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,p!==null&&i.indexOf(p)===-1&&i.push(p),r)}function O2(r,i,s,d,p){switch(i){case"focusin":return ri=tu(ri,r,i,s,d,p),!0;case"dragenter":return ai=tu(ai,r,i,s,d,p),!0;case"mouseover":return ii=tu(ii,r,i,s,d,p),!0;case"pointerover":var v=p.pointerId;return Wo.set(v,tu(Wo.get(v)||null,r,i,s,d,p)),!0;case"gotpointercapture":return v=p.pointerId,eu.set(v,tu(eu.get(v)||null,r,i,s,d,p)),!0}return!1}function K0(r){var i=Al(r.target);if(i!==null){var s=o(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){r.blockedOn=i,uv(r.priority,function(){V0(s)});return}}else if(i===31){if(i=f(s),i!==null){r.blockedOn=i,uv(r.priority,function(){V0(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){r.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}r.blockedOn=null}function fd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var s=Qm(r.nativeEvent);if(s===null){s=r.nativeEvent;var d=new s.constructor(s.type,s);Gf=d,s.target.dispatchEvent(d),Gf=null}else return i=Rl(s),i!==null&&Z0(i),r.blockedOn=s,!1;i.shift()}return!0}function Y0(r,i,s){fd(r)&&s.delete(i)}function D2(){Km=!1,ri!==null&&fd(ri)&&(ri=null),ai!==null&&fd(ai)&&(ai=null),ii!==null&&fd(ii)&&(ii=null),Wo.forEach(Y0),eu.forEach(Y0)}function hd(r,i){r.blockedOn===i&&(r.blockedOn=null,Km||(Km=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,D2)))}var md=null;function X0(r){md!==r&&(md=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){md===r&&(md=null);for(var i=0;i<r.length;i+=3){var s=r[i],d=r[i+1],p=r[i+2];if(typeof d!="function"){if(Gm(d||s)===null)continue;break}var v=Rl(s);v!==null&&(r.splice(i,3),i-=3,Qh(v,{pending:!0,data:p,method:s.method,action:d},d,p))}}))}function fs(r){function i($){return hd($,r)}ri!==null&&hd(ri,r),ai!==null&&hd(ai,r),ii!==null&&hd(ii,r),Wo.forEach(i),eu.forEach(i);for(var s=0;s<li.length;s++){var d=li[s];d.blockedOn===r&&(d.blockedOn=null)}for(;0<li.length&&(s=li[0],s.blockedOn===null);)K0(s),s.blockedOn===null&&li.shift();if(s=(r.ownerDocument||r).$$reactFormReplay,s!=null)for(d=0;d<s.length;d+=3){var p=s[d],v=s[d+1],S=p[In]||null;if(typeof v=="function")S||X0(s);else if(S){var _=null;if(v&&v.hasAttribute("formAction")){if(p=v,S=v[In]||null)_=S.formAction;else if(Gm(p)!==null)continue}else _=S.action;typeof _=="function"?s[d+1]=_:(s.splice(d,3),d-=3),X0(s)}}}function J0(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function i(){p!==null&&(p(),p=null),d||setTimeout(s,20)}function s(){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,p=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),p!==null&&(p(),p=null)}}}function Ym(r){this._internalRoot=r}pd.prototype.render=Ym.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,d=rr();q0(s,d,r,i,null,null)},pd.prototype.unmount=Ym.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;q0(r.current,2,null,r,null,null),Kc(),i[Tl]=null}};function pd(r){this._internalRoot=r}pd.prototype.unstable_scheduleHydration=function(r){if(r){var i=ov();r={blockedOn:null,target:r,priority:i};for(var s=0;s<li.length&&i!==0&&i<li[s].priority;s++);li.splice(s,0,r),s===0&&K0(r)}};var W0=t.version;if(W0!=="19.2.4")throw Error(a(527,W0,"19.2.4"));te.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?y(r):null,r=r===null?null:r.stateNode,r};var M2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gd.isDisabled&&gd.supportsFiber)try{nn=gd.inject(M2),Zt=gd}catch{}}return ru.createRoot=function(r,i){if(!l(r))throw Error(a(299));var s=!1,d="",p=lx,v=sx,S=ox;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(p=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=$0(r,1,!1,null,null,s,d,null,p,v,S,J0),r[Tl]=i.current,Rm(r),new Ym(i)},ru.hydrateRoot=function(r,i,s){if(!l(r))throw Error(a(299));var d=!1,p="",v=lx,S=sx,_=ox,$=null;return s!=null&&(s.unstable_strictMode===!0&&(d=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(v=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(_=s.onRecoverableError),s.formState!==void 0&&($=s.formState)),i=$0(r,1,!0,i,s??null,d,p,$,v,S,_,J0),i.context=F0(null),s=i.current,d=rr(),d=Bf(d),p=Za(d),p.callback=null,Va(s,p,d),s=d,i.current.lanes=s,yn(i,s),qr(i),r[Tl]=i.current,Rm(r),new pd(i)},ru.version="19.2.4",ru}var c1;function V2(){if(c1)return ep.exports;c1=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(),ep.exports=Z2(),ep.exports}var Q2=V2(),Sl=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(){}},ll,mi,Ts,LS,G2=(LS=class extends Sl{constructor(){super();ke(this,ll);ke(this,mi);ke(this,Ts);ve(this,Ts,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){I(this,mi)||this.setEventListener(I(this,Ts))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,mi))==null||t.call(this),ve(this,mi,void 0))}setEventListener(t){var n;ve(this,Ts,t),(n=I(this,mi))==null||n.call(this),ve(this,mi,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){I(this,ll)!==t&&(ve(this,ll,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof I(this,ll)=="boolean"?I(this,ll):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ll=new WeakMap,mi=new WeakMap,Ts=new WeakMap,LS),Xg=new G2,K2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},pi,Gg,IS,Y2=(IS=class{constructor(){ke(this,pi,K2);ke(this,Gg,!1)}setTimeoutProvider(e){ve(this,pi,e)}setTimeout(e,t){return I(this,pi).setTimeout(e,t)}clearTimeout(e){I(this,pi).clearTimeout(e)}setInterval(e,t){return I(this,pi).setInterval(e,t)}clearInterval(e){I(this,pi).clearInterval(e)}},pi=new WeakMap,Gg=new WeakMap,IS),il=new Y2;function X2(e){setTimeout(e,0)}var J2=typeof window>"u"||"Deno"in globalThis;function _n(){}function W2(e,t){return typeof e=="function"?e(t):e}function Vp(e){return typeof e=="number"&&e>=0&&e!==1/0}function KS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ci(e,t){return typeof e=="function"?e(t):e}function Cr(e,t){return typeof e=="function"?e(t):e}function d1(e,t){const{type:n="all",exact:a,fetchStatus:l,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==Jg(c,t.options))return!1}else if(!ku(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||l&&l!==t.state.fetchStatus||o&&!o(t))}function f1(e,t){const{exact:n,status:a,predicate:l,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(pl(t.options.mutationKey)!==pl(o))return!1}else if(!ku(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||l&&!l(t))}function Jg(e,t){return((t==null?void 0:t.queryKeyHashFn)||pl)(e)}function pl(e){return JSON.stringify(e,(t,n)=>Qp(n)?Object.keys(n).sort().reduce((a,l)=>(a[l]=n[l],a),{}):n)}function ku(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ku(e[n],t[n])):!1}var eT=Object.prototype.hasOwnProperty;function Wg(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=h1(e)&&h1(t);if(!a&&!(Qp(e)&&Qp(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),f=c.length,m=a?new Array(f):{};let h=0;for(let y=0;y<f;y++){const g=a?y:c[y],b=e[g],w=t[g];if(b===w){m[g]=b,(a?y<o:eT.call(e,g))&&h++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){m[g]=w;continue}const k=Wg(b,w,n+1);m[g]=k,k===b&&h++}return o===f&&h===o?e:m}function ju(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 h1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qp(e){if(!m1(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!m1(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function m1(e){return Object.prototype.toString.call(e)==="[object Object]"}function tT(e){return new Promise(t=>{il.setTimeout(t,e)})}function Gp(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Wg(e,t):t}function nT(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function rT(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var ey=Symbol();function YS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ey?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ty(e,t){return typeof e=="function"?e(...t):!!e}function aT(e,t,n){let a=!1,l;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(l??(l=t()),a||(a=!0,l.aborted?n():l.addEventListener("abort",n,{once:!0})),l)}),e}var Cu=(()=>{let e=()=>J2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Kp(){let e,t;const n=new Promise((l,o)=>{e=l,t=o});n.status="pending",n.catch(()=>{});function a(l){Object.assign(n,l),delete n.resolve,delete n.reject}return n.resolve=l=>{a({status:"fulfilled",value:l}),e(l)},n.reject=l=>{a({status:"rejected",reason:l}),t(l)},n}var iT=X2;function lT(){let e=[],t=0,n=f=>{f()},a=f=>{f()},l=iT;const o=f=>{t?e.push(f):l(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&l(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{l=f}}}var Bt=lT(),As,gi,Rs,US,sT=(US=class extends Sl{constructor(){super();ke(this,As,!0);ke(this,gi);ke(this,Rs);ve(this,Rs,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(){I(this,gi)||this.setEventListener(I(this,Rs))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,gi))==null||t.call(this),ve(this,gi,void 0))}setEventListener(t){var n;ve(this,Rs,t),(n=I(this,gi))==null||n.call(this),ve(this,gi,t(this.setOnline.bind(this)))}setOnline(t){I(this,As)!==t&&(ve(this,As,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return I(this,As)}},As=new WeakMap,gi=new WeakMap,Rs=new WeakMap,US),Qd=new sT;function oT(e){return Math.min(1e3*2**e,3e4)}function XS(e){return(e??"online")==="online"?Qd.isOnline():!0}var Yp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function JS(e){let t=!1,n=0,a;const l=Kp(),o=()=>l.status!=="pending",c=j=>{var E;if(!o()){const C=new Yp(j);b(C),(E=e.onCancel)==null||E.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>Xg.isFocused()&&(e.networkMode==="always"||Qd.isOnline())&&e.canRun(),y=()=>XS(e.networkMode)&&e.canRun(),g=j=>{o()||(a==null||a(),l.resolve(j))},b=j=>{o()||(a==null||a(),l.reject(j))},w=()=>new Promise(j=>{var E;a=C=>{(o()||h())&&j(C)},(E=e.onPause)==null||E.call(e)}).then(()=>{var j;a=void 0,o()||(j=e.onContinue)==null||j.call(e)}),k=()=>{if(o())return;let j;const E=n===0?e.initialPromise:void 0;try{j=E??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(g).catch(C=>{var O;if(o())return;const N=e.retry??(Cu.isServer()?0:3),z=e.retryDelay??oT,L=typeof z=="function"?z(n,C):z,D=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!D){b(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),tT(L).then(()=>h()?void 0:w()).then(()=>{t?b(C):k()})})};return{promise:l,status:()=>l.status,cancel:c,continue:()=>(a==null||a(),l),cancelRetry:f,continueRetry:m,canStart:y,start:()=>(y()?k():w().then(k),l)}}var sl,PS,WS=(PS=class{constructor(){ke(this,sl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vp(this.gcTime)&&ve(this,sl,il.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cu.isServer()?1/0:300*1e3))}clearGcTimeout(){I(this,sl)&&(il.clearTimeout(I(this,sl)),ve(this,sl,void 0))}},sl=new WeakMap,PS),ol,zs,kr,ul,cn,Du,cl,sr,ek,ka,BS,uT=(BS=class extends WS{constructor(t){super();ke(this,sr);ke(this,ol);ke(this,zs);ke(this,kr);ke(this,ul);ke(this,cn);ke(this,Du);ke(this,cl);ve(this,cl,!1),ve(this,Du,t.defaultOptions),this.setOptions(t.options),this.observers=[],ve(this,ul,t.client),ve(this,kr,I(this,ul).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ve(this,ol,g1(this.options)),this.state=t.state??I(this,ol),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=I(this,cn))==null?void 0:t.promise}setOptions(t){if(this.options={...I(this,Du),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=g1(this.options);n.data!==void 0&&(this.setState(p1(n.data,n.dataUpdatedAt)),ve(this,ol,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,kr).remove(this)}setData(t,n){const a=Gp(this.state.data,t,this.options);return Me(this,sr,ka).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Me(this,sr,ka).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,l;const n=(a=I(this,cn))==null?void 0:a.promise;return(l=I(this,cn))==null||l.cancel(t),n?n.then(_n).catch(_n):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return I(this,ol)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Cr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ey||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ci(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:!KS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,cn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,cn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),I(this,kr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(I(this,cn)&&(I(this,cl)||Me(this,sr,ek).call(this)?I(this,cn).cancel({revert:!0}):I(this,cn).cancelRetry()),this.scheduleGc()),I(this,kr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Me(this,sr,ka).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,y,g,b,w,k,j,E,C,N,z;if(this.state.fetchStatus!=="idle"&&((m=I(this,cn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(I(this,cn))return I(this,cn).continueRetry(),I(this,cn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const L=this.observers.find(D=>D.options.queryFn);L&&this.setOptions(L.options)}const a=new AbortController,l=L=>{Object.defineProperty(L,"signal",{enumerable:!0,get:()=>(ve(this,cl,!0),a.signal)})},o=()=>{const L=YS(this.options,n),O=(()=>{const M={client:I(this,ul),queryKey:this.queryKey,meta:this.meta};return l(M),M})();return ve(this,cl,!1),this.options.persister?this.options.persister(L,O,this):L(O)},f=(()=>{const L={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:I(this,ul),state:this.state,fetchFn:o};return l(L),L})();(h=this.options.behavior)==null||h.onFetch(f,this),ve(this,zs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=f.fetchOptions)==null?void 0:y.meta))&&Me(this,sr,ka).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),ve(this,cn,JS({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:L=>{L instanceof Yp&&L.revert&&this.setState({...I(this,zs),fetchStatus:"idle"}),a.abort()},onFail:(L,D)=>{Me(this,sr,ka).call(this,{type:"failed",failureCount:L,error:D})},onPause:()=>{Me(this,sr,ka).call(this,{type:"pause"})},onContinue:()=>{Me(this,sr,ka).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const L=await I(this,cn).start();if(L===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(L),(w=(b=I(this,kr).config).onSuccess)==null||w.call(b,L,this),(j=(k=I(this,kr).config).onSettled)==null||j.call(k,L,this.state.error,this),L}catch(L){if(L instanceof Yp){if(L.silent)return I(this,cn).promise;if(L.revert){if(this.state.data===void 0)throw L;return this.state.data}}throw Me(this,sr,ka).call(this,{type:"error",error:L}),(C=(E=I(this,kr).config).onError)==null||C.call(E,L,this),(z=(N=I(this,kr).config).onSettled)==null||z.call(N,this.state.data,L,this),L}finally{this.scheduleGc()}}},ol=new WeakMap,zs=new WeakMap,kr=new WeakMap,ul=new WeakMap,cn=new WeakMap,Du=new WeakMap,cl=new WeakMap,sr=new WeakSet,ek=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ka=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,...tk(a.data,this.options),fetchMeta:t.meta??null};case"success":const l={...a,...p1(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ve(this,zs,t.manual?l:void 0),l;case"error":const o=t.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),Bt.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),I(this,kr).notify({query:this,type:"updated",action:t})})},BS);function tk(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function p1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function g1(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 Zn,lt,Mu,On,dl,Os,ja,yi,Lu,Ds,Ms,fl,hl,vi,Ls,pt,mu,Xp,Jp,Wp,eg,tg,ng,rg,nk,$S,ny=($S=class extends Sl{constructor(t,n){super();ke(this,pt);ke(this,Zn);ke(this,lt);ke(this,Mu);ke(this,On);ke(this,dl);ke(this,Os);ke(this,ja);ke(this,yi);ke(this,Lu);ke(this,Ds);ke(this,Ms);ke(this,fl);ke(this,hl);ke(this,vi);ke(this,Ls,new Set);this.options=n,ve(this,Zn,t),ve(this,yi,null),ve(this,ja,Kp()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,lt).addObserver(this),y1(I(this,lt),this.options)?Me(this,pt,mu).call(this):this.updateResult(),Me(this,pt,eg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ag(I(this,lt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ag(I(this,lt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Me(this,pt,tg).call(this),Me(this,pt,ng).call(this),I(this,lt).removeObserver(this)}setOptions(t){const n=this.options,a=I(this,lt);if(this.options=I(this,Zn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Cr(this.options.enabled,I(this,lt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Me(this,pt,rg).call(this),I(this,lt).setOptions(this.options),n._defaulted&&!ju(this.options,n)&&I(this,Zn).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,lt),observer:this});const l=this.hasListeners();l&&v1(I(this,lt),a,this.options,n)&&Me(this,pt,mu).call(this),this.updateResult(),l&&(I(this,lt)!==a||Cr(this.options.enabled,I(this,lt))!==Cr(n.enabled,I(this,lt))||Ci(this.options.staleTime,I(this,lt))!==Ci(n.staleTime,I(this,lt)))&&Me(this,pt,Xp).call(this);const o=Me(this,pt,Jp).call(this);l&&(I(this,lt)!==a||Cr(this.options.enabled,I(this,lt))!==Cr(n.enabled,I(this,lt))||o!==I(this,vi))&&Me(this,pt,Wp).call(this,o)}getOptimisticResult(t){const n=I(this,Zn).getQueryCache().build(I(this,Zn),t),a=this.createResult(n,t);return dT(this,a)&&(ve(this,On,a),ve(this,Os,this.options),ve(this,dl,I(this,lt).state)),a}getCurrentResult(){return I(this,On)}trackResult(t,n){return new Proxy(t,{get:(a,l)=>(this.trackProp(l),n==null||n(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&I(this,ja).status==="pending"&&I(this,ja).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,l))})}trackProp(t){I(this,Ls).add(t)}getCurrentQuery(){return I(this,lt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=I(this,Zn).defaultQueryOptions(t),a=I(this,Zn).getQueryCache().build(I(this,Zn),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Me(this,pt,mu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,On)))}createResult(t,n){var X;const a=I(this,lt),l=this.options,o=I(this,On),c=I(this,dl),f=I(this,Os),h=t!==a?t.state:I(this,Mu),{state:y}=t;let g={...y},b=!1,w;if(n._optimisticResults){const F=this.hasListeners(),J=!F&&y1(t,n),ee=F&&v1(t,a,n,l);(J||ee)&&(g={...g,...tk(y.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:k,errorUpdatedAt:j,status:E}=g;w=g.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&E==="pending"){let F;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(F=o.data,C=!0):F=typeof n.placeholderData=="function"?n.placeholderData((X=I(this,Ms))==null?void 0:X.state.data,I(this,Ms)):n.placeholderData,F!==void 0&&(E="success",w=Gp(o==null?void 0:o.data,F,n),b=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===I(this,Lu))w=I(this,Ds);else try{ve(this,Lu,n.select),w=n.select(w),w=Gp(o==null?void 0:o.data,w,n),ve(this,Ds,w),ve(this,yi,null)}catch(F){ve(this,yi,F)}I(this,yi)&&(k=I(this,yi),w=I(this,Ds),j=Date.now(),E="error");const N=g.fetchStatus==="fetching",z=E==="pending",L=E==="error",D=z&&N,O=w!==void 0,U={status:E,fetchStatus:g.fetchStatus,isPending:z,isSuccess:E==="success",isError:L,isInitialLoading:D,isLoading:D,data:w,dataUpdatedAt:g.dataUpdatedAt,error:k,errorUpdatedAt:j,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!z,isLoadingError:L&&!O,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:L&&O,isStale:ry(t,n),refetch:this.refetch,promise:I(this,ja),isEnabled:Cr(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const F=U.data!==void 0,J=U.status==="error"&&!F,ee=ne=>{J?ne.reject(U.error):F&&ne.resolve(U.data)},ye=()=>{const ne=ve(this,ja,U.promise=Kp());ee(ne)},he=I(this,ja);switch(he.status){case"pending":t.queryHash===a.queryHash&&ee(he);break;case"fulfilled":(J||U.data!==he.value)&&ye();break;case"rejected":(!J||U.error!==he.reason)&&ye();break}}return U}updateResult(){const t=I(this,On),n=this.createResult(I(this,lt),this.options);if(ve(this,dl,I(this,lt).state),ve(this,Os,this.options),I(this,dl).data!==void 0&&ve(this,Ms,I(this,lt)),ju(n,t))return;ve(this,On,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:l}=this.options,o=typeof l=="function"?l():l;if(o==="all"||!o&&!I(this,Ls).size)return!0;const c=new Set(o??I(this,Ls));return this.options.throwOnError&&c.add("error"),Object.keys(I(this,On)).some(f=>{const m=f;return I(this,On)[m]!==t[m]&&c.has(m)})};Me(this,pt,nk).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Me(this,pt,eg).call(this)}},Zn=new WeakMap,lt=new WeakMap,Mu=new WeakMap,On=new WeakMap,dl=new WeakMap,Os=new WeakMap,ja=new WeakMap,yi=new WeakMap,Lu=new WeakMap,Ds=new WeakMap,Ms=new WeakMap,fl=new WeakMap,hl=new WeakMap,vi=new WeakMap,Ls=new WeakMap,pt=new WeakSet,mu=function(t){Me(this,pt,rg).call(this);let n=I(this,lt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(_n)),n},Xp=function(){Me(this,pt,tg).call(this);const t=Ci(this.options.staleTime,I(this,lt));if(Cu.isServer()||I(this,On).isStale||!Vp(t))return;const a=KS(I(this,On).dataUpdatedAt,t)+1;ve(this,fl,il.setTimeout(()=>{I(this,On).isStale||this.updateResult()},a))},Jp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,lt)):this.options.refetchInterval)??!1},Wp=function(t){Me(this,pt,ng).call(this),ve(this,vi,t),!(Cu.isServer()||Cr(this.options.enabled,I(this,lt))===!1||!Vp(I(this,vi))||I(this,vi)===0)&&ve(this,hl,il.setInterval(()=>{(this.options.refetchIntervalInBackground||Xg.isFocused())&&Me(this,pt,mu).call(this)},I(this,vi)))},eg=function(){Me(this,pt,Xp).call(this),Me(this,pt,Wp).call(this,Me(this,pt,Jp).call(this))},tg=function(){I(this,fl)&&(il.clearTimeout(I(this,fl)),ve(this,fl,void 0))},ng=function(){I(this,hl)&&(il.clearInterval(I(this,hl)),ve(this,hl,void 0))},rg=function(){const t=I(this,Zn).getQueryCache().build(I(this,Zn),this.options);if(t===I(this,lt))return;const n=I(this,lt);ve(this,lt,t),ve(this,Mu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},nk=function(t){Bt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(I(this,On))}),I(this,Zn).getQueryCache().notify({query:I(this,lt),type:"observerResultsUpdated"})})},$S);function cT(e,t){return Cr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function y1(e,t){return cT(e,t)||e.state.data!==void 0&&ag(e,t,t.refetchOnMount)}function ag(e,t,n){if(Cr(t.enabled,e)!==!1&&Ci(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&ry(e,t)}return!1}function v1(e,t,n,a){return(e!==t||Cr(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ry(e,n)}function ry(e,t){return Cr(t.enabled,e)!==!1&&e.isStaleByTime(Ci(t.staleTime,e))}function dT(e,t){return!ju(e.getCurrentResult(),t)}function b1(e){return{onFetch:(t,n)=>{var y,g,b,w,k;const a=t.options,l=(b=(g=(y=t.fetchOptions)==null?void 0:y.meta)==null?void 0:g.fetchMore)==null?void 0:b.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const E=z=>{aT(z,()=>t.signal,()=>j=!0)},C=YS(t.options,t.fetchOptions),N=async(z,L,D)=>{if(j)return Promise.reject();if(L==null&&z.pages.length)return Promise.resolve(z);const M=(()=>{const J={client:t.client,queryKey:t.queryKey,pageParam:L,direction:D?"backward":"forward",meta:t.options.meta};return E(J),J})(),U=await C(M),{maxPages:X}=t.options,F=D?rT:nT;return{pages:F(z.pages,U,X),pageParams:F(z.pageParams,L,X)}};if(l&&o.length){const z=l==="backward",L=z?fT:x1,D={pages:o,pageParams:c},O=L(a,D);f=await N(D,O,z)}else{const z=e??o.length;do{const L=m===0?c[0]??a.initialPageParam:x1(a,f);if(m>0&&L==null)break;f=await N(f,L),m++}while(m<z)}return f};t.options.persister?t.fetchFn=()=>{var j,E;return(E=(j=t.options).persister)==null?void 0:E.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function x1(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 fT(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 Iu,Zr,En,ml,Vr,di,FS,hT=(FS=class extends WS{constructor(t){super();ke(this,Vr);ke(this,Iu);ke(this,Zr);ke(this,En);ke(this,ml);ve(this,Iu,t.client),this.mutationId=t.mutationId,ve(this,En,t.mutationCache),ve(this,Zr,[]),this.state=t.state||rk(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){I(this,Zr).includes(t)||(I(this,Zr).push(t),this.clearGcTimeout(),I(this,En).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ve(this,Zr,I(this,Zr).filter(n=>n!==t)),this.scheduleGc(),I(this,En).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){I(this,Zr).length||(this.state.status==="pending"?this.scheduleGc():I(this,En).remove(this))}continue(){var t;return((t=I(this,ml))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,y,g,b,w,k,j,E,C,N,z,L,D,O,M;const n=()=>{Me(this,Vr,di).call(this,{type:"continue"})},a={client:I(this,Iu),meta:this.options.meta,mutationKey:this.options.mutationKey};ve(this,ml,JS({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(U,X)=>{Me(this,Vr,di).call(this,{type:"failed",failureCount:U,error:X})},onPause:()=>{Me(this,Vr,di).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>I(this,En).canRun(this)}));const l=this.state.status==="pending",o=!I(this,ml).canStart();try{if(l)n();else{Me(this,Vr,di).call(this,{type:"pending",variables:t,isPaused:o}),I(this,En).config.onMutate&&await I(this,En).config.onMutate(t,this,a);const X=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));X!==this.state.context&&Me(this,Vr,di).call(this,{type:"pending",context:X,variables:t,isPaused:o})}const U=await I(this,ml).start();return await((h=(m=I(this,En).config).onSuccess)==null?void 0:h.call(m,U,t,this.state.context,this,a)),await((g=(y=this.options).onSuccess)==null?void 0:g.call(y,U,t,this.state.context,a)),await((w=(b=I(this,En).config).onSettled)==null?void 0:w.call(b,U,null,this.state.variables,this.state.context,this,a)),await((j=(k=this.options).onSettled)==null?void 0:j.call(k,U,null,t,this.state.context,a)),Me(this,Vr,di).call(this,{type:"success",data:U}),U}catch(U){try{await((C=(E=I(this,En).config).onError)==null?void 0:C.call(E,U,t,this.state.context,this,a))}catch(X){Promise.reject(X)}try{await((z=(N=this.options).onError)==null?void 0:z.call(N,U,t,this.state.context,a))}catch(X){Promise.reject(X)}try{await((D=(L=I(this,En).config).onSettled)==null?void 0:D.call(L,void 0,U,this.state.variables,this.state.context,this,a))}catch(X){Promise.reject(X)}try{await((M=(O=this.options).onSettled)==null?void 0:M.call(O,void 0,U,t,this.state.context,a))}catch(X){Promise.reject(X)}throw Me(this,Vr,di).call(this,{type:"error",error:U}),U}finally{I(this,En).runNext(this)}}},Iu=new WeakMap,Zr=new WeakMap,En=new WeakMap,ml=new WeakMap,Vr=new WeakSet,di=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),Bt.batch(()=>{I(this,Zr).forEach(a=>{a.onMutationUpdate(t)}),I(this,En).notify({mutation:this,type:"updated",action:t})})},FS);function rk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ca,Lr,Uu,qS,mT=(qS=class extends Sl{constructor(t={}){super();ke(this,Ca);ke(this,Lr);ke(this,Uu);this.config=t,ve(this,Ca,new Set),ve(this,Lr,new Map),ve(this,Uu,0)}build(t,n,a){const l=new hT({client:t,mutationCache:this,mutationId:++yd(this,Uu)._,options:t.defaultMutationOptions(n),state:a});return this.add(l),l}add(t){I(this,Ca).add(t);const n=vd(t);if(typeof n=="string"){const a=I(this,Lr).get(n);a?a.push(t):I(this,Lr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(I(this,Ca).delete(t)){const n=vd(t);if(typeof n=="string"){const a=I(this,Lr).get(n);if(a)if(a.length>1){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}else a[0]===t&&I(this,Lr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vd(t);if(typeof n=="string"){const a=I(this,Lr).get(n),l=a==null?void 0:a.find(o=>o.state.status==="pending");return!l||l===t}else return!0}runNext(t){var a;const n=vd(t);if(typeof n=="string"){const l=(a=I(this,Lr).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(l==null?void 0:l.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bt.batch(()=>{I(this,Ca).forEach(t=>{this.notify({type:"removed",mutation:t})}),I(this,Ca).clear(),I(this,Lr).clear()})}getAll(){return Array.from(I(this,Ca))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>f1(n,a))}findAll(t={}){return this.getAll().filter(n=>f1(t,n))}notify(t){Bt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Bt.batch(()=>Promise.all(t.map(n=>n.continue().catch(_n))))}},Ca=new WeakMap,Lr=new WeakMap,Uu=new WeakMap,qS);function vd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ea,bi,Vn,Na,Ta,Ud,ig,HS,pT=(HS=class extends Sl{constructor(n,a){super();ke(this,Ta);ke(this,Ea);ke(this,bi);ke(this,Vn);ke(this,Na);ve(this,Ea,n),this.setOptions(a),this.bindMethods(),Me(this,Ta,Ud).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var l;const a=this.options;this.options=I(this,Ea).defaultMutationOptions(n),ju(this.options,a)||I(this,Ea).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,Vn),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&pl(a.mutationKey)!==pl(this.options.mutationKey)?this.reset():((l=I(this,Vn))==null?void 0:l.state.status)==="pending"&&I(this,Vn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=I(this,Vn))==null||n.removeObserver(this)}onMutationUpdate(n){Me(this,Ta,Ud).call(this),Me(this,Ta,ig).call(this,n)}getCurrentResult(){return I(this,bi)}reset(){var n;(n=I(this,Vn))==null||n.removeObserver(this),ve(this,Vn,void 0),Me(this,Ta,Ud).call(this),Me(this,Ta,ig).call(this)}mutate(n,a){var l;return ve(this,Na,a),(l=I(this,Vn))==null||l.removeObserver(this),ve(this,Vn,I(this,Ea).getMutationCache().build(I(this,Ea),this.options)),I(this,Vn).addObserver(this),I(this,Vn).execute(n)}},Ea=new WeakMap,bi=new WeakMap,Vn=new WeakMap,Na=new WeakMap,Ta=new WeakSet,Ud=function(){var a;const n=((a=I(this,Vn))==null?void 0:a.state)??rk();ve(this,bi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ig=function(n){Bt.batch(()=>{var a,l,o,c,f,m,h,y;if(I(this,Na)&&this.hasListeners()){const g=I(this,bi).variables,b=I(this,bi).context,w={client:I(this,Ea),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(l=(a=I(this,Na)).onSuccess)==null||l.call(a,n.data,g,b,w)}catch(k){Promise.reject(k)}try{(c=(o=I(this,Na)).onSettled)==null||c.call(o,n.data,null,g,b,w)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=I(this,Na)).onError)==null||m.call(f,n.error,g,b,w)}catch(k){Promise.reject(k)}try{(y=(h=I(this,Na)).onSettled)==null||y.call(h,void 0,n.error,g,b,w)}catch(k){Promise.reject(k)}}}this.listeners.forEach(g=>{g(I(this,bi))})})},HS);function w1(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function gT(e,t,n){const a=e.slice(0);return a[t]=n,a}var Is,lr,Us,Ps,jr,xi,Pu,Bu,$u,Fu,jn,lg,sg,og,ug,cg,ZS,yT=(ZS=class extends Sl{constructor(t,n,a){super();ke(this,jn);ke(this,Is);ke(this,lr);ke(this,Us);ke(this,Ps);ke(this,jr);ke(this,xi);ke(this,Pu);ke(this,Bu);ke(this,$u);ke(this,Fu,[]);ve(this,Is,t),ve(this,Ps,a),ve(this,Us,[]),ve(this,jr,[]),ve(this,lr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&I(this,jr).forEach(t=>{t.subscribe(n=>{Me(this,jn,ug).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,I(this,jr).forEach(t=>{t.destroy()})}setQueries(t,n){ve(this,Us,t),ve(this,Ps,n),Bt.batch(()=>{const a=I(this,jr),l=Me(this,jn,og).call(this,I(this,Us));l.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=l.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,b)=>g!==a[b]),h=f||m,y=h?!0:c.some((g,b)=>{const w=I(this,lr)[b];return!w||!ju(g,w)});!h&&!y||(h&&(ve(this,Fu,l),ve(this,jr,o)),ve(this,lr,c),this.hasListeners()&&(h&&(w1(a,o).forEach(g=>{g.destroy()}),w1(o,a).forEach(g=>{g.subscribe(b=>{Me(this,jn,ug).call(this,g,b)})})),Me(this,jn,cg).call(this)))})}getCurrentResult(){return I(this,lr)}getQueries(){return I(this,jr).map(t=>t.getCurrentQuery())}getObservers(){return I(this,jr)}getOptimisticResult(t,n){const a=Me(this,jn,og).call(this,t),l=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[l,c=>Me(this,jn,sg).call(this,c??l,n,o),()=>Me(this,jn,lg).call(this,l,a)]}},Is=new WeakMap,lr=new WeakMap,Us=new WeakMap,Ps=new WeakMap,jr=new WeakMap,xi=new WeakMap,Pu=new WeakMap,Bu=new WeakMap,$u=new WeakMap,Fu=new WeakMap,jn=new WeakSet,lg=function(t,n){return n.map((a,l)=>{const o=t[l];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},sg=function(t,n,a){if(n){const l=I(this,$u),o=a!==void 0&&l!==void 0&&(l.length!==a.length||a.some((c,f)=>c!==l[f]));return(!I(this,xi)||I(this,lr)!==I(this,Bu)||o||n!==I(this,Pu))&&(ve(this,Pu,n),ve(this,Bu,I(this,lr)),a!==void 0&&ve(this,$u,a),ve(this,xi,Wg(I(this,xi),n(t)))),I(this,xi)}return t},og=function(t){const n=new Map;I(this,jr).forEach(l=>{const o=l.options.queryHash;if(!o)return;const c=n.get(o);c?c.push(l):n.set(o,[l])});const a=[];return t.forEach(l=>{var m;const o=I(this,Is).defaultQueryOptions(l),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new ny(I(this,Is),o);a.push({defaultedQueryOptions:o,observer:f})}),a},ug=function(t,n){const a=I(this,jr).indexOf(t);a!==-1&&(ve(this,lr,gT(I(this,lr),a,n)),Me(this,jn,cg).call(this))},cg=function(){var t;if(this.hasListeners()){const n=I(this,xi),a=Me(this,jn,lg).call(this,I(this,lr),I(this,Fu)),l=Me(this,jn,sg).call(this,a,(t=I(this,Ps))==null?void 0:t.combine);n!==l&&Bt.batch(()=>{this.listeners.forEach(o=>{o(I(this,lr))})})}},ZS),Qr,VS,vT=(VS=class extends Sl{constructor(t={}){super();ke(this,Qr);this.config=t,ve(this,Qr,new Map)}build(t,n,a){const l=n.queryKey,o=n.queryHash??Jg(l,n);let c=this.get(o);return c||(c=new uT({client:t,queryKey:l,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(l)}),this.add(c)),c}add(t){I(this,Qr).has(t.queryHash)||(I(this,Qr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=I(this,Qr).get(t.queryHash);n&&(t.destroy(),n===t&&I(this,Qr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return I(this,Qr).get(t)}getAll(){return[...I(this,Qr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>d1(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>d1(t,a)):n}notify(t){Bt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Bt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Qr=new WeakMap,VS),Pt,wi,Si,Bs,$s,ki,Fs,qs,QS,bT=(QS=class{constructor(e={}){ke(this,Pt);ke(this,wi);ke(this,Si);ke(this,Bs);ke(this,$s);ke(this,ki);ke(this,Fs);ke(this,qs);ve(this,Pt,e.queryCache||new vT),ve(this,wi,e.mutationCache||new mT),ve(this,Si,e.defaultOptions||{}),ve(this,Bs,new Map),ve(this,$s,new Map),ve(this,ki,0)}mount(){yd(this,ki)._++,I(this,ki)===1&&(ve(this,Fs,Xg.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Pt).onFocus())})),ve(this,qs,Qd.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Pt).onOnline())})))}unmount(){var e,t;yd(this,ki)._--,I(this,ki)===0&&((e=I(this,Fs))==null||e.call(this),ve(this,Fs,void 0),(t=I(this,qs))==null||t.call(this),ve(this,qs,void 0))}isFetching(e){return I(this,Pt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return I(this,wi).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Pt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=I(this,Pt).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ci(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return I(this,Pt).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),l=I(this,Pt).get(a.queryHash),o=l==null?void 0:l.state.data,c=W2(t,o);if(c!==void 0)return I(this,Pt).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return Bt.batch(()=>I(this,Pt).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Pt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=I(this,Pt);Bt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=I(this,Pt);return Bt.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=Bt.batch(()=>I(this,Pt).findAll(e).map(l=>l.cancel(n)));return Promise.all(a).then(_n).catch(_n)}invalidateQueries(e,t={}){return Bt.batch(()=>(I(this,Pt).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=Bt.batch(()=>I(this,Pt).findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let o=l.fetch(void 0,n);return n.throwOnError||(o=o.catch(_n)),l.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(_n)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=I(this,Pt).build(this,t);return n.isStaleByTime(Ci(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}fetchInfiniteQuery(e){return e.behavior=b1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_n).catch(_n)}ensureInfiniteQueryData(e){return e.behavior=b1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Qd.isOnline()?I(this,wi).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,Pt)}getMutationCache(){return I(this,wi)}getDefaultOptions(){return I(this,Si)}setDefaultOptions(e){ve(this,Si,e)}setQueryDefaults(e,t){I(this,Bs).set(pl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...I(this,Bs).values()],n={};return t.forEach(a=>{ku(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){I(this,$s).set(pl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...I(this,$s).values()],n={};return t.forEach(a=>{ku(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...I(this,Si).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Jg(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===ey&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...I(this,Si).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){I(this,Pt).clear(),I(this,wi).clear()}},Pt=new WeakMap,wi=new WeakMap,Si=new WeakMap,Bs=new WeakMap,$s=new WeakMap,ki=new WeakMap,Fs=new WeakMap,qs=new WeakMap,QS),ak=x.createContext(void 0),dn=e=>{const t=x.useContext(ak);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xT=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(ak.Provider,{value:e,children:t})),ik=x.createContext(!1),lk=()=>x.useContext(ik);ik.Provider;function wT(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ST=x.createContext(wT()),sk=()=>x.useContext(ST),ok=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ty(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},uk=e=>{x.useEffect(()=>{e.clearReset()},[e])},ck=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:l})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(l&&e.data===void 0||ty(n,[e.error,a])),dk=e=>{if(e.suspense){const n=l=>l==="static"?l:Math.max(l??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...l)=>n(a(...l)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},kT=(e,t)=>e.isLoading&&e.isFetching&&!t,dg=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function jT({queries:e,...t},n){const a=dn(),l=lk(),o=sk(),c=x.useMemo(()=>e.map(j=>{const E=a.defaultQueryOptions(j);return E._optimisticResults=l?"isRestoring":"optimistic",E}),[e,a,l]);c.forEach(j=>{dk(j);const E=a.getQueryCache().get(j.queryHash);ok(j,o,E)}),uk(o);const[f]=x.useState(()=>new yT(a,c,t)),[m,h,y]=f.getOptimisticResult(c,t.combine),g=!l&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>g?f.subscribe(Bt.batchCalls(j)):_n,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),x.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((j,E)=>dg(c[E],j))?m.flatMap((j,E)=>{const C=c[E];if(C&&dg(C,j)){const N=new ny(a,C);return fg(C,N,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const k=m.find((j,E)=>{const C=c[E];return C&&ck({result:j,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(k!=null&&k.error)throw k.error;return h(y())}function CT(e,t,n){var b,w,k,j;const a=lk(),l=sk(),o=dn(),c=o.defaultQueryOptions(e);(w=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",dk(c),ok(c,l,f),uk(l);const m=!o.getQueryCache().get(c.queryHash),[h]=x.useState(()=>new t(o,c)),y=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(E=>{const C=g?h.subscribe(Bt.batchCalls(E)):_n;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setOptions(c)},[c,h]),dg(c,y))throw fg(c,h,l);if(ck({result:y,errorResetBoundary:l,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw y.error;if((j=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||j.call(k,c,y),c.experimental_prefetchInRender&&!Cu.isServer()&&kT(y,a)){const E=m?fg(c,h,l):f==null?void 0:f.promise;E==null||E.catch(_n).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?y:h.trackResult(y)}function He(e,t){return CT(e,ny)}function wt(e,t){const n=dn(),[a]=x.useState(()=>new pT(n,e));x.useEffect(()=>{a.setOptions(e)},[a,e]);const l=x.useSyncExternalStore(x.useCallback(c=>a.subscribe(Bt.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=x.useCallback((c,f)=>{a.mutate(c,f).catch(_n)},[a]);if(l.error&&ty(a.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:o,mutateAsync:l.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 S1="popstate";function k1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ET(e={}){function t(a,l){var h;let o=(h=l.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=o||a.location;return hg("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,l){return typeof l=="string"?l:Eu(l)}return _T(t,n,null,e)}function At(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Nr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function NT(){return Math.random().toString(36).substring(2,10)}function j1(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 hg(e,t,n=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Xs(t):t,state:n,key:t&&t.key||a||NT(),unstable_mask:l}}function Eu({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 Xs(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 _T(e,t,n,a={}){let{window:l=document.defaultView,v5Compat:o=!1}=a,c=l.history,f="POP",m=null,h=y();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let E=y(),C=E==null?null:E-h;h=E,m&&m({action:f,location:j.location,delta:C})}function b(E,C){f="PUSH";let N=k1(E)?E:hg(j.location,E,C);h=y()+1;let z=j1(N,h),L=j.createHref(N.unstable_mask||N);try{c.pushState(z,"",L)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;l.location.assign(L)}o&&m&&m({action:f,location:j.location,delta:1})}function w(E,C){f="REPLACE";let N=k1(E)?E:hg(j.location,E,C);h=y();let z=j1(N,h),L=j.createHref(N.unstable_mask||N);c.replaceState(z,"",L),o&&m&&m({action:f,location:j.location,delta:0})}function k(E){return TT(E)}let j={get action(){return f},get location(){return e(l,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(S1,g),m=E,()=>{l.removeEventListener(S1,g),m=null}},createHref(E){return t(l,E)},createURL:k,encodeLocation(E){let C=k(E);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:b,replace:w,go(E){return c.go(E)}};return j}function TT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),At(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Eu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function fk(e,t,n="/"){return AT(e,t,n,!1)}function AT(e,t,n,a){let l=typeof t=="string"?Xs(t):t,o=Aa(l.pathname||"/",n);if(o==null)return null;let c=hk(e);RT(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=FT(o);f=BT(c[m],h,a)}return f}function hk(e,t=[],n=[],a="",l=!1){let o=(c,f,m=l,h)=>{let y={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(a)&&m)return;At(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=Yr([a,y.relativePath]),b=n.concat(y);c.children&&c.children.length>0&&(At(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),hk(c.children,t,b,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:UT(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of mk(c.path))o(c,f,!0,h)}),t}function mk(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,l=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return l?[o,""]:[o];let c=mk(a.join("/")),f=[];return f.push(...c.map(m=>m===""?o:[o,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function RT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:PT(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var zT=/^:[\w-]+$/,OT=3,DT=2,MT=1,LT=10,IT=-2,C1=e=>e==="*";function UT(e,t){let n=e.split("/"),a=n.length;return n.some(C1)&&(a+=IT),t&&(a+=DT),n.filter(l=>!C1(l)).reduce((l,o)=>l+(zT.test(o)?OT:o===""?MT:LT),a)}function PT(e,t){return e.length===t.length&&e.slice(0,-1).every((a,l)=>a===t[l])?e[e.length-1]-t[t.length-1]:0}function BT(e,t,n=!1){let{routesMeta:a}=e,l={},o="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,y=o==="/"?t:t.slice(o.length)||"/",g=Gd({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},y),b=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=Gd({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Yr([o,g.pathname]),pathnameBase:VT(Yr([o,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(o=Yr([o,g.pathnameBase]))}return c}function Gd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=$T(e.path,e.caseSensitive,e.end),l=t.match(n);if(!l)return null;let o=l[0],c=o.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:a.reduce((h,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return g&&!w?h[y]=void 0:h[y]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function $T(e,t=!1,n=!0){Nr(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=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,h,y)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),a]}function FT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Nr(!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 Aa(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 qT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function HT(e,t="/"){let{pathname:n,search:a="",hash:l=""}=typeof e=="string"?Xs(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=E1(n.substring(1),"/"):o=E1(n,t)):o=t,{pathname:o,search:QT(a),hash:GT(l)}}function E1(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function ap(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 ZT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ay(e){let t=ZT(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function hf(e,t,n,a=!1){let l;typeof e=="string"?l=Xs(e):(l={...e},At(!l.pathname||!l.pathname.includes("?"),ap("?","pathname","search",l)),At(!l.pathname||!l.pathname.includes("#"),ap("#","pathname","hash",l)),At(!l.search||!l.search.includes("#"),ap("#","search","hash",l)));let o=e===""||l.pathname==="",c=o?"/":l.pathname,f;if(c==null)f=n;else{let g=t.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?t[g]:"/"}let m=HT(l,f),h=c&&c!=="/"&&c.endsWith("/"),y=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||y)&&(m.pathname+="/"),m}var Yr=e=>e.join("/").replace(/\/\/+/g,"/"),VT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),QT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,GT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,KT=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 YT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function XT(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gk(e,t){let n=e;if(typeof n!="string"||!qT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,l=!1;if(pk)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=Aa(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:l=!0}catch{Nr(!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:l,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yk=["POST","PUT","PATCH","DELETE"];new Set(yk);var JT=["GET",...yk];new Set(JT);var Js=x.createContext(null);Js.displayName="DataRouter";var mf=x.createContext(null);mf.displayName="DataRouterState";var WT=x.createContext(!1),vk=x.createContext({isTransitioning:!1});vk.displayName="ViewTransition";var eA=x.createContext(new Map);eA.displayName="Fetchers";var tA=x.createContext(null);tA.displayName="Await";var dr=x.createContext(null);dr.displayName="Navigation";var qu=x.createContext(null);qu.displayName="Location";var _r=x.createContext({outlet:null,matches:[],isDataRoute:!1});_r.displayName="Route";var iy=x.createContext(null);iy.displayName="RouteError";var bk="REACT_ROUTER_ERROR",nA="REDIRECT",rA="ROUTE_ERROR_RESPONSE";function aA(e){if(e.startsWith(`${bk}:${nA}:{`))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 iA(e){if(e.startsWith(`${bk}:${rA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new KT(t.status,t.statusText,t.data)}catch{}}function lA(e,{relative:t}={}){At(Ws(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=x.useContext(dr),{hash:l,pathname:o,search:c}=Hu(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Yr([n,o])),a.createHref({pathname:f,search:c,hash:l})}function Ws(){return x.useContext(qu)!=null}function Mn(){return At(Ws(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(qu).location}var xk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wk(e){x.useContext(dr).static||x.useLayoutEffect(e)}function fn(){let{isDataRoute:e}=x.useContext(_r);return e?wA():sA()}function sA(){At(Ws(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Js),{basename:t,navigator:n}=x.useContext(dr),{matches:a}=x.useContext(_r),{pathname:l}=Mn(),o=JSON.stringify(ay(a)),c=x.useRef(!1);return wk(()=>{c.current=!0}),x.useCallback((m,h={})=>{if(Nr(c.current,xk),!c.current)return;if(typeof m=="number"){n.go(m);return}let y=hf(m,JSON.parse(o),l,h.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:Yr([t,y.pathname])),(h.replace?n.replace:n.push)(y,h.state,h)},[t,n,o,l,e])}var oA=x.createContext(null);function uA(e){let t=x.useContext(_r).outlet;return x.useMemo(()=>t&&x.createElement(oA.Provider,{value:e},t),[t,e])}function Sk(){let{matches:e}=x.useContext(_r),t=e[e.length-1];return t?t.params:{}}function Hu(e,{relative:t}={}){let{matches:n}=x.useContext(_r),{pathname:a}=Mn(),l=JSON.stringify(ay(n));return x.useMemo(()=>hf(e,JSON.parse(l),a,t==="path"),[e,l,a,t])}function cA(e,t){return kk(e,t)}function kk(e,t,n){var E;At(Ws(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(dr),{matches:l}=x.useContext(_r),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";Ck(f,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let y=Mn(),g;if(t){let C=typeof t=="string"?Xs(t):t;At(m==="/"||((E=C.pathname)==null?void 0:E.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=y;let b=g.pathname||"/",w=b;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=fk(e,{pathname:w});Nr(h||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Nr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=pA(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Yr([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Yr([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),l,n);return t&&j?x.createElement(qu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function dA(){let e=xA(),t=YT(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)",l={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:o},"ErrorBoundary")," or"," ",x.createElement("code",{style:o},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:l},n):null,c)}var fA=x.createElement(dA,null),jk=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=iA(e.digest);n&&(e=n)}let t=e!==void 0?x.createElement(_r.Provider,{value:this.props.routeContext},x.createElement(iy.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(hA,{error:e},t):t}};jk.contextType=WT;var ip=new WeakMap;function hA({children:e,error:t}){let{basename:n}=x.useContext(dr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=aA(t.digest);if(a){let l=ip.get(t);if(l)throw l;let o=gk(a.location,n);if(pk&&!ip.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw ip.set(t,c),c}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function mA({routeContext:e,match:t,children:n}){let a=x.useContext(Js);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(_r.Provider,{value:e},n)}function pA(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 l=e,o=a==null?void 0:a.errors;if(o!=null){let y=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);At(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:b,errors:w}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||k){n.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(y,g)=>{var b,w;m(y,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:XT(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let w,k=!1,j=null,E=null;a&&(w=o&&g.route.id?o[g.route.id]:void 0,j=g.route.errorElement||fA,c&&(f<0&&b===0?(Ck("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,E=null):f===b&&(k=!0,E=g.route.hydrateFallbackElement||null)));let C=t.concat(l.slice(0,b+1)),N=()=>{let z;return w?z=j:k?z=E:g.route.Component?z=x.createElement(g.route.Component,null):g.route.element?z=g.route.element:z=y,x.createElement(mA,{match:g,routeContext:{outlet:y,matches:C,isDataRoute:a!=null},children:z})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?x.createElement(jk,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):N()},null)}function ly(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gA(e){let t=x.useContext(Js);return At(t,ly(e)),t}function yA(e){let t=x.useContext(mf);return At(t,ly(e)),t}function vA(e){let t=x.useContext(_r);return At(t,ly(e)),t}function sy(e){let t=vA(e),n=t.matches[t.matches.length-1];return At(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function bA(){return sy("useRouteId")}function xA(){var a;let e=x.useContext(iy),t=yA("useRouteError"),n=sy("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function wA(){let{router:e}=gA("useNavigate"),t=sy("useNavigate"),n=x.useRef(!1);return wk(()=>{n.current=!0}),x.useCallback(async(l,o={})=>{Nr(n.current,xk),n.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var N1={};function Ck(e,t,n){!t&&!N1[e]&&(N1[e]=!0,Nr(!1,n))}x.memo(SA);function SA({routes:e,future:t,state:n,isStatic:a,onError:l}){return kk(e,void 0,{state:n,isStatic:a,onError:l})}function pf({to:e,replace:t,state:n,relative:a}){At(Ws(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(dr);Nr(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=x.useContext(_r),{pathname:c}=Mn(),f=fn(),m=hf(e,ay(o),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 mg(e){return uA(e.context)}function ar(e){At(!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 kA({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){At(!Ws(),"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:l,static:o,unstable_useTransitions:c,future:{}}),[f,l,o,c]);typeof n=="string"&&(n=Xs(n));let{pathname:h="/",search:y="",hash:g="",state:b=null,key:w="default",unstable_mask:k}=n,j=x.useMemo(()=>{let E=Aa(h,f);return E==null?null:{location:{pathname:E,search:y,hash:g,state:b,key:w,unstable_mask:k},navigationType:a}},[f,h,y,g,b,w,a,k]);return Nr(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(dr.Provider,{value:m},x.createElement(qu.Provider,{children:t,value:j}))}function jA({children:e,location:t}){return cA(pg(e),t)}function pg(e,t=[]){let n=[];return x.Children.forEach(e,(a,l)=>{if(!x.isValidElement(a))return;let o=[...t,l];if(a.type===x.Fragment){n.push.apply(n,pg(a.props.children,o));return}At(a.type===ar,`[${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>`),At(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=pg(a.props.children,o)),n.push(c)}),n}var Pd="get",Bd="application/x-www-form-urlencoded";function gf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function CA(e){return gf(e)&&e.tagName.toLowerCase()==="button"}function EA(e){return gf(e)&&e.tagName.toLowerCase()==="form"}function NA(e){return gf(e)&&e.tagName.toLowerCase()==="input"}function _A(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function TA(e,t){return e.button===0&&(!t||t==="_self")&&!_A(e)}function gg(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(l=>[n,l]):[[n,a]])},[]))}function AA(e,t){let n=gg(e);return t&&t.forEach((a,l)=>{n.has(l)||t.getAll(l).forEach(o=>{n.append(l,o)})}),n}var bd=null;function RA(){if(bd===null)try{new FormData(document.createElement("form"),0),bd=!1}catch{bd=!0}return bd}var zA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function lp(e){return e!=null&&!zA.has(e)?(Nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bd}"`),null):e}function OA(e,t){let n,a,l,o,c;if(EA(e)){let f=e.getAttribute("action");a=f?Aa(f,t):null,n=e.getAttribute("method")||Pd,l=lp(e.getAttribute("enctype"))||Bd,o=new FormData(e)}else if(CA(e)||NA(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?Aa(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Pd,l=lp(e.getAttribute("formenctype"))||lp(f.getAttribute("enctype"))||Bd,o=new FormData(f,e),!RA()){let{name:h,type:y,value:g}=e;if(y==="image"){let b=h?`${h}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else h&&o.append(h,g)}}else{if(gf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Pd,a=null,l=Bd,c=e}return o&&l==="text/plain"&&(c=o,o=void 0),{action:a,method:n.toLowerCase(),encType:l,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function oy(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function DA(e,t,n,a){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:t&&Aa(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function MA(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 LA(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 IA(e,t,n){let a=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await MA(o,n);return c.links?c.links():[]}return[]}));return $A(a.flat(1).filter(LA).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function _1(e,t,n,a,l,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var y;return n[h].pathname!==m.pathname||((y=n[h].route.path)==null?void 0:y.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var g;let y=a.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function UA(e,t,{includeHydrateFallback:n}={}){return PA(e.map(a=>{let l=t.routes[a.route.id];if(!l)return[];let o=[l.module];return l.clientActionModule&&(o=o.concat(l.clientActionModule)),l.clientLoaderModule&&(o=o.concat(l.clientLoaderModule)),n&&l.hydrateFallbackModule&&(o=o.concat(l.hydrateFallbackModule)),l.imports&&(o=o.concat(l.imports)),o}).flat(1))}function PA(e){return[...new Set(e)]}function BA(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function $A(e,t){let n=new Set;return new Set(t),e.reduce((a,l)=>{let o=JSON.stringify(BA(l));return n.has(o)||(n.add(o),a.push({key:o,link:l})),a},[])}function Ek(){let e=x.useContext(Js);return oy(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function FA(){let e=x.useContext(mf);return oy(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var uy=x.createContext(void 0);uy.displayName="FrameworkContext";function Nk(){let e=x.useContext(uy);return oy(e,"You must render this element inside a <HydratedRouter> element"),e}function qA(e,t){let n=x.useContext(uy),[a,l]=x.useState(!1),[o,c]=x.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:y,onTouchStart:g}=t,b=x.useRef(null);x.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=C=>{C.forEach(N=>{c(N.isIntersecting)})},E=new IntersectionObserver(j,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),x.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{l(!0)},k=()=>{l(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:au(f,w),onBlur:au(m,k),onMouseEnter:au(h,w),onMouseLeave:au(y,k),onTouchStart:au(g,w)}]:[!1,b,{}]}function au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function HA({page:e,...t}){let{router:n}=Ek(),a=x.useMemo(()=>fk(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?x.createElement(VA,{page:e,matches:a,...t}):null}function ZA(e){let{manifest:t,routeModules:n}=Nk(),[a,l]=x.useState([]);return x.useEffect(()=>{let o=!1;return IA(e,t,n).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,n]),a}function VA({page:e,matches:t,...n}){let a=Mn(),{future:l,manifest:o,routeModules:c}=Nk(),{basename:f}=Ek(),{loaderData:m,matches:h}=FA(),y=x.useMemo(()=>_1(e,t,h,o,a,"data"),[e,t,h,o,a]),g=x.useMemo(()=>_1(e,t,h,o,a,"assets"),[e,t,h,o,a]),b=x.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,E=!1;if(t.forEach(N=>{var L;let z=o.routes[N.route.id];!z||!z.hasLoader||(!y.some(D=>D.route.id===N.route.id)&&N.route.id in m&&((L=c[N.route.id])!=null&&L.shouldRevalidate)||z.hasClientLoader?E=!0:j.add(N.route.id))}),j.size===0)return[];let C=DA(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return E&&j.size>0&&C.searchParams.set("_routes",t.filter(N=>j.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,o,y,t,e,c]),w=x.useMemo(()=>UA(g,o),[g,o]),k=ZA(g);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:E})=>x.createElement("link",{key:j,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function QA(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var GA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{GA&&(window.__reactRouterVersion="7.13.1")}catch{}function KA({basename:e,children:t,unstable_useTransitions:n,window:a}){let l=x.useRef();l.current==null&&(l.current=ET({window:a,v5Compat:!0}));let o=l.current,[c,f]=x.useState({action:o.action,location:o.location}),m=x.useCallback(h=>{n===!1?f(h):x.startTransition(()=>f(h))},[n]);return x.useLayoutEffect(()=>o.listen(m),[o,m]),x.createElement(kA,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var _k=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Zu=x.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:l,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},j){let{basename:E,navigator:C,unstable_useTransitions:N}=x.useContext(dr),z=typeof y=="string"&&_k.test(y),L=gk(y,E);y=L.to;let D=lA(y,{relative:l}),O=Mn(),M=null;if(f){let ne=hf(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);E!=="/"&&(ne.pathname=ne.pathname==="/"?E:Yr([E,ne.pathname])),M=C.createHref(ne)}let[U,X,F]=qA(a,k),J=JA(y,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:N});function ee(ne){t&&t(ne),ne.defaultPrevented||J(ne)}let ye=!(L.isExternal||o),he=x.createElement("a",{...k,...F,href:(ye?M:void 0)||L.absoluteURL||D,onClick:ye?ee:t,ref:QA(j,X),target:h,"data-discover":!z&&n==="render"?"true":void 0});return U&&!z?x.createElement(x.Fragment,null,he,x.createElement(HA,{page:D})):he});Zu.displayName="Link";var Tk=x.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:l=!1,style:o,to:c,viewTransition:f,children:m,...h},y){let g=Hu(c,{relative:h.relative}),b=Mn(),w=x.useContext(mf),{navigator:k,basename:j}=x.useContext(dr),E=w!=null&&rR(g)&&f===!0,C=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,N=b.pathname,z=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(N=N.toLowerCase(),z=z?z.toLowerCase():null,C=C.toLowerCase()),z&&j&&(z=Aa(z,j)||z);const L=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let D=N===C||!l&&N.startsWith(C)&&N.charAt(L)==="/",O=z!=null&&(z===C||!l&&z.startsWith(C)&&z.charAt(C.length)==="/"),M={isActive:D,isPending:O,isTransitioning:E},U=D?t:void 0,X;typeof a=="function"?X=a(M):X=[a,D?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let F=typeof o=="function"?o(M):o;return x.createElement(Zu,{...h,"aria-current":U,className:X,ref:y,style:F,to:c,viewTransition:f},typeof m=="function"?m(M):m)});Tk.displayName="NavLink";var YA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:l,state:o,method:c=Pd,action:f,onSubmit:m,relative:h,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:j}=x.useContext(dr),E=tR(),C=nR(f,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",z=typeof f=="string"&&_k.test(f),L=D=>{if(m&&m(D),D.defaultPrevented)return;D.preventDefault();let O=D.nativeEvent.submitter,M=(O==null?void 0:O.getAttribute("formmethod"))||c,U=()=>E(O||D.currentTarget,{fetcherKey:t,method:M,navigate:n,replace:l,state:o,relative:h,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});j&&n!==!1?x.startTransition(()=>U()):U()};return x.createElement("form",{ref:k,method:N,action:C,onSubmit:a?m:L,...w,"data-discover":!z&&e==="render"?"true":void 0})});YA.displayName="Form";function XA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ak(e){let t=x.useContext(Js);return At(t,XA(e)),t}function JA(e,{target:t,replace:n,unstable_mask:a,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let y=fn(),g=Mn(),b=Hu(e,{relative:c});return x.useCallback(w=>{if(TA(w,t)){w.preventDefault();let k=n!==void 0?n:Eu(g)===Eu(b),j=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?x.startTransition(()=>j()):j()}},[g,y,b,n,a,l,t,e,o,c,f,m,h])}function yf(e){Nr(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(gg(e)),n=x.useRef(!1),a=Mn(),l=x.useMemo(()=>AA(a.search,n.current?null:t.current),[a.search]),o=fn(),c=x.useCallback((f,m)=>{const h=gg(typeof f=="function"?f(new URLSearchParams(l)):f);n.current=!0,o("?"+h,m)},[o,l]);return[l,c]}var WA=0,eR=()=>`__${String(++WA)}__`;function tR(){let{router:e}=Ak("useSubmit"),{basename:t}=x.useContext(dr),n=bA(),a=e.fetch,l=e.navigate;return x.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:y,body:g}=OA(o,t);if(c.navigate===!1){let b=c.fetcherKey||eR();await a(b,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,l,t,n])}function nR(e,{relative:t}={}){let{basename:n}=x.useContext(dr),a=x.useContext(_r);At(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),o={...Hu(e||".",{relative:t})},c=Mn();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(y=>y==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();o.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Yr([n,o.pathname])),Eu(o)}function rR(e,{relative:t}={}){let n=x.useContext(vk);At(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ak("useViewTransitionState"),l=Hu(e,{relative:t});if(!n.isTransitioning)return!1;let o=Aa(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=Aa(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Gd(l.pathname,c)!=null||Gd(l.pathname,o)!=null}const aR="/api/v1";async function iR(e,t){const n=await fetch(`${aR}/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 l;try{l=JSON.parse(a).error??a}catch{l=a}throw new Error(l)}return await n.json()}const Rk="/api/v1",cy="first-tree-hub:tokens";let yg=null;function iu(e){yg=e}function lR(e){if(!yg||!e.startsWith("/admin/")&&e!=="/admin"||/[?&]organizationId=/.test(e))return e;const t=e.includes("?")?"&":"?";return`${e}${t}organizationId=${encodeURIComponent(yg)}`}function dy(){const e=localStorage.getItem(cy);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function vg(e){localStorage.setItem(cy,JSON.stringify(e))}function zk(){localStorage.removeItem(cy)}class Vu extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let lu=null;async function sR(e){return lu||(lu=(async()=>{try{const t=await fetch(`${Rk}/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 vg(a),a}catch{return null}finally{lu=null}})(),lu)}async function xd(e,t){const{method:n="GET",body:a}=t??{},l=lR(e),o=m=>{const h={};return m&&(h.Authorization=`Bearer ${m}`),a!==void 0&&(h["Content-Type"]="application/json"),fetch(`${Rk}${l}`,{method:n,headers:h,body:a!==void 0?JSON.stringify(a):void 0})},c=dy();let f=await o(c==null?void 0:c.accessToken);if(f.status===401&&(c!=null&&c.refreshToken)){const m=await sR(c.refreshToken);m&&(f=await o(m.accessToken))}if(!f.ok){f.status===401&&(zk(),window.dispatchEvent(new CustomEvent("auth:logout")));const m=await f.text();let h,y;try{const g=JSON.parse(m);h=g.error??m,Array.isArray(g.details)&&(y=g.details.filter(b=>typeof b=="object"&&b!==null&&Array.isArray(b.path)))}catch{h=m}throw new Vu(f.status,h,y)}if(f.status!==204)return await f.json()}const je={get:e=>xd(e),post:(e,t)=>xd(e,{method:"POST",body:t}),patch:(e,t)=>xd(e,{method:"PATCH",body:t}),delete:e=>xd(e,{method:"DELETE"})},fy="onboarding:joinPath",oR="onboarding:draft";function Ok(e){typeof window>"u"||window.sessionStorage.setItem(fy,e)}function uR(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(fy);return e==="solo"||e==="invite"?e:null}function cR(){typeof window>"u"||window.sessionStorage.removeItem(fy)}function dR(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function hy(e){return`${oR}:${e}`}function fR(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 hR(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(hy(e));if(!t)return null;try{return fR(JSON.parse(t))}catch{return null}}function mR(e,t){typeof window>"u"||window.sessionStorage.setItem(hy(e),JSON.stringify(t))}function pR(e){typeof window>"u"||window.sessionStorage.removeItem(hy(e))}const Dk=x.createContext(null),bg="first-tree-hub:selectedOrganizationId";function gR(){try{return localStorage.getItem(bg)}catch{return null}}function sp(e){try{e===null?localStorage.removeItem(bg):localStorage.setItem(bg,e)}catch{}}function yR({children:e}){const t=dn(),[n,a]=x.useState(()=>!!dy()),[l,o]=x.useState(null),[c,f]=x.useState([]),[m,h]=x.useState(()=>{const L=gR();return iu(L),L}),[y,g]=x.useState(null),[b,w]=x.useState(null),k=x.useCallback(()=>{zk(),sp(null),iu(null),t.clear(),a(!1),o(null),f([]),h(null),g(null),w(null)},[t]),j=x.useCallback(async()=>{var L;try{const D=await je.get("/me");o(D.user??null),g(D.member);const O=D.memberships??[];f(O);const M=((L=D.wizard)==null?void 0:L.step)??null;w(M),M==="completed"&&cR(),h(U=>{var J;const X=U&&O.some(ee=>ee.organizationId===U)?U:null;if(X)return iu(X),X;const F=D.member.organizationId??((J=O[0])==null?void 0:J.organizationId)??null;return sp(F),iu(F),F})}catch{}},[]),E=x.useCallback(async(L,D)=>{const O=await iR(L,D);vg({accessToken:O.accessToken,refreshToken:O.refreshToken}),a(!0),await j()},[j]),C=x.useCallback(async L=>{vg(L),a(!0),await j()},[j]),N=x.useCallback(async L=>{await je.post("/auth/switch-org",{organizationId:L}),sp(L),iu(L),t.clear(),h(L),await j()},[j,t]);x.useEffect(()=>{n&&!l&&j()},[n,l,j]),x.useEffect(()=>{const L=()=>k();return window.addEventListener("auth:logout",L),()=>window.removeEventListener("auth:logout",L)},[k]);const z=x.useMemo(()=>{if(c.length>0){const L=c.find(D=>D.organizationId===m);return L||(c[0]??null)}if(y){const L=y.role==="admin"?"admin":"member";return{id:y.id,organizationId:y.organizationId,organizationName:"",role:L,agentId:y.agentId}}return null},[c,m,y]);return u.jsx(Dk.Provider,{value:{isAuthenticated:n,user:l,memberships:c,currentMembership:z,organizationId:(z==null?void 0:z.organizationId)??null,memberId:(z==null?void 0:z.id)??null,role:(z==null?void 0:z.role)??null,agentId:(z==null?void 0:z.agentId)??null,wizardStep:b,login:E,adoptTokens:C,selectOrganization:N,refreshMe:j,logout:k},children:e})}function qt(){const e=x.useContext(Dk);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const vR="modulepreload",bR=function(e){return"/"+e},T1={},xR=function(t,n,a){let l=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(n.map(h=>{if(h=bR(h),h in T1)return;T1[h]=!0;const y=h.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":vR,y||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},wR=x.lazy(()=>xR(()=>import("./index-DIgiOalZ.js"),[]).then(e=>({default:e.LandingPage}))),SR=()=>u.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function kR(){const{isAuthenticated:e}=qt(),t=Mn();return e?u.jsx(mg,{}):t.pathname==="/"?u.jsx(x.Suspense,{fallback:u.jsx(SR,{}),children:u.jsx(wR,{})}):u.jsx(pf,{to:"/login",replace:!0,state:{from:t}})}/**
|
|
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 Mk=(...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 jR=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 CR=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 A1=e=>{const t=CR(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 ER={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 NR=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 _R=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:l="",children:o,iconNode:c,...f},m)=>x.createElement("svg",{ref:m,...ER,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:Mk("lucide",l),...!o&&!NR(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,y])=>x.createElement(h,y)),...Array.isArray(o)?o:[o]]));/**
|
|
96
|
+
* @license lucide-react v0.577.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const ot=(e,t)=>{const n=x.forwardRef(({className:a,...l},o)=>x.createElement(_R,{ref:o,iconNode:t,className:Mk(`lucide-${jR(A1(e))}`,`lucide-${e}`,a),...l}));return n.displayName=A1(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 TR=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],my=ot("arrow-left",TR);/**
|
|
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 AR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],RR=ot("arrow-right",AR);/**
|
|
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 zR=[["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"}]],OR=ot("bell",zR);/**
|
|
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 DR=[["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"}]],MR=ot("bot",DR);/**
|
|
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 LR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=ot("check",LR);/**
|
|
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 IR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lk=ot("chevron-down",IR);/**
|
|
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 UR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],PR=ot("chevron-right",UR);/**
|
|
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 BR=[["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"}]],vf=ot("copy",BR);/**
|
|
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 $R=[["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"}]],FR=ot("eye-off",$R);/**
|
|
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 qR=[["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"}]],HR=ot("eye",qR);/**
|
|
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 ZR=[["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"}]],Ik=ot("github",ZR);/**
|
|
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 VR=[["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"}]],QR=ot("layout-dashboard",VR);/**
|
|
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 GR=[["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"}]],xg=ot("link-2",GR);/**
|
|
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 KR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],YR=ot("loader-circle",KR);/**
|
|
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 XR=[["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"}]],Uk=ot("lock",XR);/**
|
|
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 JR=[["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"}]],WR=ot("log-out",JR);/**
|
|
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 ez=[["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"}]],py=ot("message-square",ez);/**
|
|
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 tz=[["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"}]],nz=ot("moon",tz);/**
|
|
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 rz=[["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"}]],az=ot("paperclip",rz);/**
|
|
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 iz=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],lz=ot("pause",iz);/**
|
|
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 sz=[["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"}]],Qu=ot("pencil",sz);/**
|
|
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 oz=[["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"}]],Pk=ot("play",oz);/**
|
|
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 uz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Jr=ot("plus",uz);/**
|
|
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 cz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bf=ot("search",cz);/**
|
|
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 dz=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],fz=ot("send",dz);/**
|
|
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 hz=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],mz=ot("settings",hz);/**
|
|
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 pz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],gz=ot("square",pz);/**
|
|
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 yz=[["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"}]],vz=ot("sun",yz);/**
|
|
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 bz=[["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"}]],Hs=ot("trash-2",bz);/**
|
|
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 xz=[["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"}]],gy=ot("triangle-alert",xz);/**
|
|
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 wz=[["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"}]],Sz=ot("undo-2",wz);/**
|
|
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 kz=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],jz=ot("unplug",kz);/**
|
|
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 Cz=[["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"}]],Ez=ot("user-plus",Cz);/**
|
|
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 Nz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kd=ot("x",Nz);/**
|
|
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 _z=[["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"}]],Tz=ot("zap",_z);function Bk(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=Bk(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function $k(){for(var e,t,n=0,a="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=Bk(e))&&(a&&(a+=" "),a+=t);return a}const Az=(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},Rz=(e,t)=>({classGroupId:e,validator:t}),Fk=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Yd="-",R1=[],zz="arbitrary..",Oz=e=>{const t=Mz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Dz(c);const f=c.split(Yd),m=f[0]===""&&f.length>1?1:0;return qk(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?Az(h,m):m:h||R1}return n[c]||R1}}},qk=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const l=e[t],o=n.nextPart.get(l);if(o){const h=qk(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Yd):e.slice(t).join(Yd),m=c.length;for(let h=0;h<m;h++){const y=c[h];if(y.validator(f))return y.classGroupId}},Dz=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?zz+a:void 0})(),Mz=e=>{const{theme:t,classGroups:n}=e;return Lz(n,t)},Lz=(e,t)=>{const n=Fk();for(const a in e){const l=e[a];yy(l,n,a,t)}return n},yy=(e,t,n,a)=>{const l=e.length;for(let o=0;o<l;o++){const c=e[o];Iz(c,t,n,a)}},Iz=(e,t,n,a)=>{if(typeof e=="string"){Uz(e,t,n);return}if(typeof e=="function"){Pz(e,t,n,a);return}Bz(e,t,n,a)},Uz=(e,t,n)=>{const a=e===""?t:Hk(t,e);a.classGroupId=n},Pz=(e,t,n,a)=>{if($z(e)){yy(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(Rz(n,e))},Bz=(e,t,n,a)=>{const l=Object.entries(e),o=l.length;for(let c=0;c<o;c++){const[f,m]=l[c];yy(m,Hk(t,f),n,a)}},Hk=(e,t)=>{let n=e;const a=t.split(Yd),l=a.length;for(let o=0;o<l;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=Fk(),n.nextPart.set(c,f)),n=f}return n},$z=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Fz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const l=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return l(o,c),c},set(o,c){o in n?n[o]=c:l(o,c)}}},wg="!",z1=":",qz=[],O1=(e,t,n,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:l}),Hz=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const o=[];let c=0,f=0,m=0,h;const y=l.length;for(let j=0;j<y;j++){const E=l[j];if(c===0&&f===0){if(E===z1){o.push(l.slice(m,j)),m=j+1;continue}if(E==="/"){h=j;continue}}E==="["?c++:E==="]"?c--:E==="("?f++:E===")"&&f--}const g=o.length===0?l:l.slice(m);let b=g,w=!1;g.endsWith(wg)?(b=g.slice(0,-1),w=!0):g.startsWith(wg)&&(b=g.slice(1),w=!0);const k=h&&h>m?h-m:void 0;return O1(o,w,b,k)};if(t){const l=t+z1,o=a;a=c=>c.startsWith(l)?o(c.slice(l.length)):O1(qz,!1,c,void 0,!0)}if(n){const l=a;a=o=>n({className:o,parseClassName:l})}return a},Zz=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let l=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",m=t.has(c);f||m?(l.length>0&&(l.sort(),a.push(...l),l=[]),a.push(c)):l.push(c)}return l.length>0&&(l.sort(),a.push(...l)),a}},Vz=e=>({cache:Fz(e.cacheSize),parseClassName:Hz(e),sortModifiers:Zz(e),...Oz(e)}),Qz=/\s+/,Gz=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:o}=t,c=[],f=e.trim().split(Qz);let m="";for(let h=f.length-1;h>=0;h-=1){const y=f[h],{isExternal:g,modifiers:b,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:j}=n(y);if(g){m=y+(m.length>0?" "+m:m);continue}let E=!!j,C=a(E?k.substring(0,j):k);if(!C){if(!E){m=y+(m.length>0?" "+m:m);continue}if(C=a(k),!C){m=y+(m.length>0?" "+m:m);continue}E=!1}const N=b.length===0?"":b.length===1?b[0]:o(b).join(":"),z=w?N+wg:N,L=z+C;if(c.indexOf(L)>-1)continue;c.push(L);const D=l(C,E);for(let O=0;O<D.length;++O){const M=D[O];c.push(z+M)}m=y+(m.length>0?" "+m:m)}return m},Kz=(...e)=>{let t=0,n,a,l="";for(;t<e.length;)(n=e[t++])&&(a=Zk(n))&&(l&&(l+=" "),l+=a);return l},Zk=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=Zk(e[a]))&&(n&&(n+=" "),n+=t);return n},Yz=(e,...t)=>{let n,a,l,o;const c=m=>{const h=t.reduce((y,g)=>g(y),e());return n=Vz(h),a=n.cache.get,l=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const y=Gz(m,n);return l(m,y),y};return o=c,(...m)=>o(Kz(...m))},Xz=[],an=e=>{const t=n=>n[e]||Xz;return t.isThemeGetter=!0,t},Vk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Jz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e3=/\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$/,t3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=e=>Jz.test(e),Ye=e=>!!e&&!Number.isNaN(Number(e)),ui=e=>!!e&&Number.isInteger(Number(e)),op=e=>e.endsWith("%")&&Ye(e.slice(0,-1)),Sa=e=>Wz.test(e),Gk=()=>!0,a3=e=>e3.test(e)&&!t3.test(e),vy=()=>!1,i3=e=>n3.test(e),l3=e=>r3.test(e),s3=e=>!Ne(e)&&!_e(e),o3=e=>zi(e,Xk,vy),Ne=e=>Vk.test(e),rl=e=>zi(e,Jk,a3),D1=e=>zi(e,g3,Ye),u3=e=>zi(e,ej,Gk),c3=e=>zi(e,Wk,vy),M1=e=>zi(e,Kk,vy),d3=e=>zi(e,Yk,l3),wd=e=>zi(e,tj,i3),_e=e=>Qk.test(e),su=e=>kl(e,Jk),f3=e=>kl(e,Wk),L1=e=>kl(e,Kk),h3=e=>kl(e,Xk),m3=e=>kl(e,Yk),Sd=e=>kl(e,tj,!0),p3=e=>kl(e,ej,!0),zi=(e,t,n)=>{const a=Vk.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},kl=(e,t,n=!1)=>{const a=Qk.exec(e);return a?a[1]?t(a[1]):n:!1},Kk=e=>e==="position"||e==="percentage",Yk=e=>e==="image"||e==="url",Xk=e=>e==="length"||e==="size"||e==="bg-size",Jk=e=>e==="length",g3=e=>e==="number",Wk=e=>e==="family-name",ej=e=>e==="number"||e==="weight",tj=e=>e==="shadow",y3=()=>{const e=an("color"),t=an("font"),n=an("text"),a=an("font-weight"),l=an("tracking"),o=an("leading"),c=an("breakpoint"),f=an("container"),m=an("spacing"),h=an("radius"),y=an("shadow"),g=an("inset-shadow"),b=an("text-shadow"),w=an("drop-shadow"),k=an("blur"),j=an("perspective"),E=an("aspect"),C=an("ease"),N=an("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...L(),_e,Ne],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],U=()=>[_e,Ne,m],X=()=>[oi,"full","auto",...U()],F=()=>[ui,"none","subgrid",_e,Ne],J=()=>["auto",{span:["full",ui,_e,Ne]},ui,_e,Ne],ee=()=>[ui,"auto",_e,Ne],ye=()=>["auto","min","max","fr",_e,Ne],he=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...U()],te=()=>[oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],ie=()=>[oi,"screen","full","dvw","lvw","svw","min","max","fit",...U()],ue=()=>[oi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],A=()=>[e,_e,Ne],P=()=>[...L(),L1,M1,{position:[_e,Ne]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",h3,o3,{size:[_e,Ne]}],q=()=>[op,su,rl],K=()=>["","none","full",h,_e,Ne],ce=()=>["",Ye,su,rl],xe=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[Ye,op,L1,M1],Xe=()=>["","none",k,_e,Ne],Le=()=>["none",Ye,_e,Ne],re=()=>["none",Ye,_e,Ne],Ee=()=>[Ye,_e,Ne],Ie=()=>[oi,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Sa],breakpoint:[Sa],color:[Gk],container:[Sa],"drop-shadow":[Sa],ease:["in","out","in-out"],font:[s3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Sa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Sa],shadow:[Sa],spacing:["px",Ye],text:[Sa],"text-shadow":[Sa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oi,Ne,_e,E]}],container:["container"],columns:[{columns:[Ye,Ne,_e,f]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:D()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:X()}],"inset-x":[{"inset-x":X()}],"inset-y":[{"inset-y":X()}],start:[{"inset-s":X(),start:X()}],end:[{"inset-e":X(),end:X()}],"inset-bs":[{"inset-bs":X()}],"inset-be":[{"inset-be":X()}],top:[{top:X()}],right:[{right:X()}],bottom:[{bottom:X()}],left:[{left:X()}],visibility:["visible","invisible","collapse"],z:[{z:[ui,"auto",_e,Ne]}],basis:[{basis:[oi,"full","auto",f,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ye,oi,"auto","initial","none",Ne]}],grow:[{grow:["",Ye,_e,Ne]}],shrink:[{shrink:["",Ye,_e,Ne]}],order:[{order:[ui,"first","last","none",_e,Ne]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ye()}],"auto-rows":[{"auto-rows":ye()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...he(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...he()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":he()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],"inline-size":[{inline:["auto",...ie()]}],"min-inline-size":[{"min-inline":["auto",...ie()]}],"max-inline-size":[{"max-inline":["none",...ie()]}],"block-size":[{block:["auto",...ue()]}],"min-block-size":[{"min-block":["auto",...ue()]}],"max-block-size":[{"max-block":["none",...ue()]}],w:[{w:[f,"screen",...te()]}],"min-w":[{"min-w":[f,"screen","none",...te()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",n,su,rl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,p3,u3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",op,Ne]}],"font-family":[{font:[f3,c3,t]}],"font-features":[{"font-features":[Ne]}],"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:[l,_e,Ne]}],"line-clamp":[{"line-clamp":[Ye,"none",_e,D1]}],leading:[{leading:[o,...U()]}],"list-image":[{"list-image":["none",_e,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_e,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ye,"from-font","auto",_e,rl]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[Ye,"auto",_e,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_e,Ne]}],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",_e,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ui,_e,Ne],radial:["",_e,Ne],conic:[ui,_e,Ne]},m3,d3]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],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:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-bs":[{"border-bs":ce()}],"border-w-be":[{"border-be":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ye,_e,Ne]}],"outline-w":[{outline:["",Ye,su,rl]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",y,Sd,wd]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",g,Sd,wd]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[Ye,rl]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",b,Sd,wd]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[Ye,_e,Ne]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[_e,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[Ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_e,Ne]}],filter:[{filter:["","none",_e,Ne]}],blur:[{blur:Xe()}],brightness:[{brightness:[Ye,_e,Ne]}],contrast:[{contrast:[Ye,_e,Ne]}],"drop-shadow":[{"drop-shadow":["","none",w,Sd,wd]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",Ye,_e,Ne]}],"hue-rotate":[{"hue-rotate":[Ye,_e,Ne]}],invert:[{invert:["",Ye,_e,Ne]}],saturate:[{saturate:[Ye,_e,Ne]}],sepia:[{sepia:["",Ye,_e,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",_e,Ne]}],"backdrop-blur":[{"backdrop-blur":Xe()}],"backdrop-brightness":[{"backdrop-brightness":[Ye,_e,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[Ye,_e,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ye,_e,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ye,_e,Ne]}],"backdrop-invert":[{"backdrop-invert":["",Ye,_e,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[Ye,_e,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[Ye,_e,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Ye,_e,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_e,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ye,"initial",_e,Ne]}],ease:[{ease:["linear","initial",C,_e,Ne]}],delay:[{delay:[Ye,_e,Ne]}],animate:[{animate:["none",N,_e,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,_e,Ne]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:Ee()}],"skew-x":[{"skew-x":Ee()}],"skew-y":[{"skew-y":Ee()}],transform:[{transform:[_e,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"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",_e,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_e,Ne]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[Ye,su,rl,D1]}],stroke:[{stroke:["none",...A()]}],"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"]}},v3=Yz(y3);function Ae(...e){return v3($k(e))}function Ni(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 b3(e){return je.delete(`/clients/${encodeURIComponent(e)}`)}function Gu(){return je.get("/admin/agents/activity")}function Ra(){return je.get("/clients")}function by(e){return je.get(`/clients/${e}`)}function x3(e){return je.post(`/clients/${e}/disconnect`)}function nj(){return je.post("/connect-tokens")}const rj=(e,t)=>["session",e,t],Xd=e=>["agent-sessions",e];function w3(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 S3(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 k3(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function eo(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 je.get(`/admin/sessions/agents/${e}${a?`?${a}`:""}`)}function j3(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 l=a.toString();return je.get(`/admin/sessions/agents/${e}/${t}/events${l?`?${l}`:""}`)}function C3(e,t){return je.post(`/admin/sessions/agents/${e}/${t}/suspend`)}function E3(e,t){return je.post(`/admin/sessions/agents/${e}/${t}/terminate`)}var I1=1,N3=.9,_3=.8,T3=.17,up=.1,cp=.999,A3=.9999,R3=.99,z3=/[\\\/_+.#"@\[\(\{&]/,O3=/[\\\/_+.#"@\[\(\{&]/g,D3=/[\s-]/,aj=/[\s-]/g;function Sg(e,t,n,a,l,o,c){if(o===t.length)return l===e.length?I1:R3;var f=`${l},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,l),y=0,g,b,w,k;h>=0;)g=Sg(e,t,n,a,h+1,o+1,c),g>y&&(h===l?g*=I1:z3.test(e.charAt(h-1))?(g*=_3,w=e.slice(l,h-1).match(O3),w&&l>0&&(g*=Math.pow(cp,w.length))):D3.test(e.charAt(h-1))?(g*=N3,k=e.slice(l,h-1).match(aj),k&&l>0&&(g*=Math.pow(cp,k.length))):(g*=T3,l>0&&(g*=Math.pow(cp,h-l))),e.charAt(h)!==t.charAt(o)&&(g*=A3)),(g<up&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(b=Sg(e,t,n,a,h+1,o+2,c),b*up>g&&(g=b*up)),g>y&&(y=g),h=n.indexOf(m,h+1);return c[f]=y,y}function U1(e){return e.toLowerCase().replace(aj," ")}function M3(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Sg(e,t,U1(e),U1(t),0,0,{})}function Ei(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function P1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _i(...e){return t=>{let n=!1;const a=e.map(l=>{const o=P1(l,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let l=0;l<a.length;l++){const o=a[l];typeof o=="function"?o():P1(e[l],null)}}}}function jl(...e){return x.useCallback(_i(...e),e)}function L3(e,t){const n=x.createContext(t),a=o=>{const{children:c,...f}=o,m=x.useMemo(()=>f,Object.values(f));return u.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function l(o){const c=x.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,l]}function I3(e,t=[]){let n=[];function a(o,c){const f=x.createContext(c),m=n.length;n=[...n,c];const h=g=>{var C;const{scope:b,children:w,...k}=g,j=((C=b==null?void 0:b[e])==null?void 0:C[m])||f,E=x.useMemo(()=>k,Object.values(k));return u.jsx(j.Provider,{value:E,children:w})};h.displayName=o+"Provider";function y(g,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(`\`${g}\` must be used within \`${o}\``)}return[h,y]}const l=()=>{const o=n.map(c=>x.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return l.scopeName=e,[a,U3(l,...t)]}function U3(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(o){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const g=m(o)[`__scope${h}`];return{...f,...g}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var Nu=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},P3=Yg[" useId ".trim().toString()]||(()=>{}),B3=0;function _a(e){const[t,n]=x.useState(P3());return Nu(()=>{n(a=>a??String(B3++))},[e]),t?`radix-${t}`:""}var $3=Yg[" useInsertionEffect ".trim().toString()]||Nu;function F3({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[l,o,c]=q3({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:l;{const y=x.useRef(e!==void 0);x.useEffect(()=>{const g=y.current;g!==f&&console.warn(`${a} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=f},[f,a])}const h=x.useCallback(y=>{var g;if(f){const b=H3(y)?y(e):y;b!==e&&((g=c.current)==null||g.call(c,b))}else o(y)},[f,e,o,c]);return[m,h]}function q3({defaultProp:e,onChange:t}){const[n,a]=x.useState(e),l=x.useRef(n),o=x.useRef(t);return $3(()=>{o.current=t},[t]),x.useEffect(()=>{var c;l.current!==n&&((c=o.current)==null||c.call(o,n),l.current=n)},[n,l]),[n,a,o]}function H3(e){return typeof e=="function"}var xy=GS();const Z3=ff(xy);function ij(e){const t=V3(e),n=x.forwardRef((a,l)=>{const{children:o,...c}=a,f=x.Children.toArray(o),m=f.find(G3);if(m){const h=m.props.children,y=f.map(g=>g===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:g);return u.jsx(t,{...c,ref:l,children:x.isValidElement(h)?x.cloneElement(h,void 0,y):null})}return u.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function V3(e){const t=x.forwardRef((n,a)=>{const{children:l,...o}=n;if(x.isValidElement(l)){const c=Y3(l),f=K3(o,l.props);return l.type!==x.Fragment&&(f.ref=a?_i(a,c):c),x.cloneElement(l,f)}return x.Children.count(l)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q3=Symbol("radix.slottable");function G3(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q3}function K3(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...f)=>{const m=o(...f);return l(...f),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function Y3(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],za=X3.reduce((e,t)=>{const n=ij(`Primitive.${t}`),a=x.forwardRef((l,o)=>{const{asChild:c,...f}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function J3(e,t){e&&xy.flushSync(()=>e.dispatchEvent(t))}function _u(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 W3(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e);x.useEffect(()=>{const a=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var eO="DismissableLayer",kg="dismissableLayer.update",tO="dismissableLayer.pointerDownOutside",nO="dismissableLayer.focusOutside",B1,lj=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),sj=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=x.useContext(lj),[y,g]=x.useState(null),b=(y==null?void 0:y.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=x.useState({}),k=jl(t,M=>g(M)),j=Array.from(h.layers),[E]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(E),N=y?j.indexOf(y):-1,z=h.layersWithOutsidePointerEventsDisabled.size>0,L=N>=C,D=iO(M=>{const U=M.target,X=[...h.branches].some(F=>F.contains(U));!L||X||(l==null||l(M),c==null||c(M),M.defaultPrevented||f==null||f())},b),O=lO(M=>{const U=M.target;[...h.branches].some(F=>F.contains(U))||(o==null||o(M),c==null||c(M),M.defaultPrevented||f==null||f())},b);return W3(M=>{N===h.layers.size-1&&(a==null||a(M),!M.defaultPrevented&&f&&(M.preventDefault(),f()))},b),x.useEffect(()=>{if(y)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(B1=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(y)),h.layers.add(y),$1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=B1)}},[y,b,n,h]),x.useEffect(()=>()=>{y&&(h.layers.delete(y),h.layersWithOutsidePointerEventsDisabled.delete(y),$1())},[y,h]),x.useEffect(()=>{const M=()=>w({});return document.addEventListener(kg,M),()=>document.removeEventListener(kg,M)},[]),u.jsx(za.div,{...m,ref:k,style:{pointerEvents:z?L?"auto":"none":void 0,...e.style},onFocusCapture:Ei(e.onFocusCapture,O.onFocusCapture),onBlurCapture:Ei(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Ei(e.onPointerDownCapture,D.onPointerDownCapture)})});sj.displayName=eO;var rO="DismissableLayerBranch",aO=x.forwardRef((e,t)=>{const n=x.useContext(lj),a=x.useRef(null),l=jl(t,a);return x.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),u.jsx(za.div,{...e,ref:l})});aO.displayName=rO;function iO(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e),a=x.useRef(!1),l=x.useRef(()=>{});return x.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){oj(tO,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=m,t.addEventListener("click",l.current,{once:!0})):m()}else t.removeEventListener("click",l.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function lO(e,t=globalThis==null?void 0:globalThis.document){const n=_u(e),a=x.useRef(!1);return x.useEffect(()=>{const l=o=>{o.target&&!a.current&&oj(nO,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function $1(){const e=new CustomEvent(kg);document.dispatchEvent(e)}function oj(e,t,n,{discrete:a}){const l=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?J3(l,o):l.dispatchEvent(o)}var dp="focusScope.autoFocusOnMount",fp="focusScope.autoFocusOnUnmount",F1={bubbles:!1,cancelable:!0},sO="FocusScope",uj=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:l,onUnmountAutoFocus:o,...c}=e,[f,m]=x.useState(null),h=_u(l),y=_u(o),g=x.useRef(null),b=jl(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(z){if(w.paused||!f)return;const L=z.target;f.contains(L)?g.current=L:fi(g.current,{select:!0})},E=function(z){if(w.paused||!f)return;const L=z.relatedTarget;L!==null&&(f.contains(L)||fi(g.current,{select:!0}))},C=function(z){if(document.activeElement===document.body)for(const D of z)D.removedNodes.length>0&&fi(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",E);const N=new MutationObserver(C);return f&&N.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",E),N.disconnect()}}},[a,f,w.paused]),x.useEffect(()=>{if(f){H1.add(w);const j=document.activeElement;if(!f.contains(j)){const C=new CustomEvent(dp,F1);f.addEventListener(dp,h),f.dispatchEvent(C),C.defaultPrevented||(oO(hO(cj(f)),{select:!0}),document.activeElement===j&&fi(f))}return()=>{f.removeEventListener(dp,h),setTimeout(()=>{const C=new CustomEvent(fp,F1);f.addEventListener(fp,y),f.dispatchEvent(C),C.defaultPrevented||fi(j??document.body,{select:!0}),f.removeEventListener(fp,y),H1.remove(w)},0)}}},[f,h,y,w]);const k=x.useCallback(j=>{if(!n&&!a||w.paused)return;const E=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(E&&C){const N=j.currentTarget,[z,L]=uO(N);z&&L?!j.shiftKey&&C===L?(j.preventDefault(),n&&fi(z,{select:!0})):j.shiftKey&&C===z&&(j.preventDefault(),n&&fi(L,{select:!0})):C===N&&j.preventDefault()}},[n,a,w.paused]);return u.jsx(za.div,{tabIndex:-1,...c,ref:b,onKeyDown:k})});uj.displayName=sO;function oO(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(fi(a,{select:t}),document.activeElement!==n)return}function uO(e){const t=cj(e),n=q1(t,e),a=q1(t.reverse(),e);return[n,a]}function cj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function q1(e,t){for(const n of e)if(!cO(n,{upTo:t}))return n}function cO(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 dO(e){return e instanceof HTMLInputElement&&"select"in e}function fi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&dO(e)&&t&&e.select()}}var H1=fO();function fO(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Z1(e,t),e.unshift(t)},remove(t){var n;e=Z1(e,t),(n=e[0])==null||n.resume()}}}function Z1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function hO(e){return e.filter(t=>t.tagName!=="A")}var mO="Portal",dj=x.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[l,o]=x.useState(!1);Nu(()=>o(!0),[]);const c=n||l&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?Z3.createPortal(u.jsx(za.div,{...a,ref:t}),c):null});dj.displayName=mO;function pO(e,t){return x.useReducer((n,a)=>t[n][a]??n,e)}var xf=e=>{const{present:t,children:n}=e,a=gO(t),l=typeof n=="function"?n({present:a.isPresent}):x.Children.only(n),o=jl(a.ref,yO(l));return typeof n=="function"||a.isPresent?x.cloneElement(l,{ref:o}):null};xf.displayName="Presence";function gO(e){const[t,n]=x.useState(),a=x.useRef(null),l=x.useRef(e),o=x.useRef("none"),c=e?"mounted":"unmounted",[f,m]=pO(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const h=kd(a.current);o.current=f==="mounted"?h:"none"},[f]),Nu(()=>{const h=a.current,y=l.current;if(y!==e){const b=o.current,w=kd(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(y&&b!==w?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,m]),Nu(()=>{if(t){let h;const y=t.ownerDocument.defaultView??window,g=w=>{const j=kd(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!l.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",h=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},b=w=>{w.target===t&&(o.current=kd(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{y.clearTimeout(h),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:x.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function kd(e){return(e==null?void 0:e.animationName)||"none"}function yO(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var hp=0;function vO(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??V1()),document.body.insertAdjacentElement("beforeend",e[1]??V1()),hp++,()=>{hp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),hp--}},[])}function V1(){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 Gr=function(){return Gr=Object.assign||function(t){for(var n,a=1,l=arguments.length;a<l;a++){n=arguments[a];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Gr.apply(this,arguments)};function fj(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 l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n}function bO(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,o;a<l;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var $d="right-scroll-bar-position",Fd="width-before-scroll-bar",xO="with-scroll-bars-hidden",wO="--removed-body-scroll-bar-size";function mp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function SO(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var l=n.value;l!==a&&(n.value=a,n.callback(a,l))}}}})[0];return n.callback=t,n.facade}var kO=typeof window<"u"?x.useLayoutEffect:x.useEffect,Q1=new WeakMap;function jO(e,t){var n=SO(null,function(a){return e.forEach(function(l){return mp(l,a)})});return kO(function(){var a=Q1.get(n);if(a){var l=new Set(a),o=new Set(e),c=n.current;l.forEach(function(f){o.has(f)||mp(f,null)}),o.forEach(function(f){l.has(f)||mp(f,c)})}Q1.set(n,e)},[e]),n}function CO(e){return e}function EO(e,t){t===void 0&&(t=CO);var n=[],a=!1,l={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(o),c=n}var m=function(){var y=c;c=[],y.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(y){c.push(y),h()},filter:function(y){return c=c.filter(y),n}}}};return l}function NO(e){e===void 0&&(e={});var t=EO(null);return t.options=Gr({async:!0,ssr:!1},e),t}var hj=function(e){var t=e.sideCar,n=fj(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,Gr({},n))};hj.isSideCarExport=!0;function _O(e,t){return e.useMedium(t),hj}var mj=NO(),pp=function(){},wf=x.forwardRef(function(e,t){var n=x.useRef(null),a=x.useState({onScrollCapture:pp,onWheelCapture:pp,onTouchMoveCapture:pp}),l=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,y=e.enabled,g=e.shards,b=e.sideCar,w=e.noRelative,k=e.noIsolation,j=e.inert,E=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,z=e.gapMode,L=fj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=b,O=jO([n,t]),M=Gr(Gr({},L),l);return x.createElement(x.Fragment,null,y&&x.createElement(D,{sideCar:mj,removeScrollBar:h,shards:g,noRelative:w,noIsolation:k,inert:j,setCallbacks:o,allowPinchZoom:!!E,lockRef:n,gapMode:z}),c?x.cloneElement(x.Children.only(f),Gr(Gr({},M),{ref:O})):x.createElement(N,Gr({},M,{className:m,ref:O}),f))});wf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wf.classNames={fullWidth:Fd,zeroRight:$d};var TO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function AO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TO();return t&&e.setAttribute("nonce",t),e}function RO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var OO=function(){var e=0,t=null;return{add:function(n){e==0&&(t=AO())&&(RO(t,n),zO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},DO=function(){var e=OO();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pj=function(){var e=DO(),t=function(n){var a=n.styles,l=n.dynamic;return e(a,l),null};return t},MO={left:0,top:0,right:0,gap:0},gp=function(e){return parseInt(e||"",10)||0},LO=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[gp(n),gp(a),gp(l)]},IO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return MO;var t=LO(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])}},UO=pj(),Es="data-scroll-locked",PO=function(e,t,n,a){var l=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
|
|
276
|
+
.`.concat(xO,` {
|
|
277
|
+
overflow: hidden `).concat(a,`;
|
|
278
|
+
padding-right: `).concat(f,"px ").concat(a,`;
|
|
279
|
+
}
|
|
280
|
+
body[`).concat(Es,`] {
|
|
281
|
+
overflow: hidden `).concat(a,`;
|
|
282
|
+
overscroll-behavior: contain;
|
|
283
|
+
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
284
|
+
padding-left: `.concat(l,`px;
|
|
285
|
+
padding-top: `).concat(o,`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($d,` {
|
|
294
|
+
right: `).concat(f,"px ").concat(a,`;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.`).concat(Fd,` {
|
|
298
|
+
margin-right: `).concat(f,"px ").concat(a,`;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.`).concat($d," .").concat($d,` {
|
|
302
|
+
right: 0 `).concat(a,`;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.`).concat(Fd," .").concat(Fd,` {
|
|
306
|
+
margin-right: 0 `).concat(a,`;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
body[`).concat(Es,`] {
|
|
310
|
+
`).concat(wO,": ").concat(f,`px;
|
|
311
|
+
}
|
|
312
|
+
`)},G1=function(){var e=parseInt(document.body.getAttribute(Es)||"0",10);return isFinite(e)?e:0},BO=function(){x.useEffect(function(){return document.body.setAttribute(Es,(G1()+1).toString()),function(){var e=G1()-1;e<=0?document.body.removeAttribute(Es):document.body.setAttribute(Es,e.toString())}},[])},$O=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,l=a===void 0?"margin":a;BO();var o=x.useMemo(function(){return IO(l)},[l]);return x.createElement(UO,{styles:PO(o,!t,l,n?"":"!important")})},jg=!1;if(typeof window<"u")try{var jd=Object.defineProperty({},"passive",{get:function(){return jg=!0,!0}});window.addEventListener("test",jd,jd),window.removeEventListener("test",jd,jd)}catch{jg=!1}var hs=jg?{passive:!1}:!1,FO=function(e){return e.tagName==="TEXTAREA"},gj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!FO(e)&&n[t]==="visible")},qO=function(e){return gj(e,"overflowY")},HO=function(e){return gj(e,"overflowX")},K1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var l=yj(e,a);if(l){var o=vj(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},ZO=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},VO=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},yj=function(e,t){return e==="v"?qO(t):HO(t)},vj=function(e,t){return e==="v"?ZO(t):VO(t)},QO=function(e,t){return e==="h"&&t==="rtl"?-1:1},GO=function(e,t,n,a,l){var o=QO(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,y=c>0,g=0,b=0;do{if(!f)break;var w=vj(e,f),k=w[0],j=w[1],E=w[2],C=j-E-o*k;(k||C)&&yj(e,f)&&(g+=C,b+=k);var N=f.parentNode;f=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(y&&Math.abs(g)<1||!y&&Math.abs(b)<1)&&(h=!0),h},Cd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Y1=function(e){return[e.deltaX,e.deltaY]},X1=function(e){return e&&"current"in e?e.current:e},KO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YO=function(e){return`
|
|
313
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
314
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
315
|
+
`)},XO=0,ms=[];function JO(e){var t=x.useRef([]),n=x.useRef([0,0]),a=x.useRef(),l=x.useState(XO++)[0],o=x.useState(pj)[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(l));var j=bO([e.lockRef.current],(e.shards||[]).map(X1),!0).filter(Boolean);return j.forEach(function(E){return E.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),j.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(l))})}}},[e.inert,e.lockRef.current,e.shards]);var f=x.useCallback(function(j,E){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var C=Cd(j),N=n.current,z="deltaX"in j?j.deltaX:N[0]-C[0],L="deltaY"in j?j.deltaY:N[1]-C[1],D,O=j.target,M=Math.abs(z)>Math.abs(L)?"h":"v";if("touches"in j&&M==="h"&&O.type==="range")return!1;var U=window.getSelection(),X=U&&U.anchorNode,F=X?X===O||X.contains(O):!1;if(F)return!1;var J=K1(M,O);if(!J)return!0;if(J?D=M:(D=M==="v"?"h":"v",J=K1(M,O)),!J)return!1;if(!a.current&&"changedTouches"in j&&(z||L)&&(a.current=D),!D)return!0;var ee=a.current||D;return GO(ee,E,j,ee==="h"?z:L)},[]),m=x.useCallback(function(j){var E=j;if(!(!ms.length||ms[ms.length-1]!==o)){var C="deltaY"in E?Y1(E):Cd(E),N=t.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&&KO(D.delta,C)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var z=(c.current.shards||[]).map(X1).filter(Boolean).filter(function(D){return D.contains(E.target)}),L=z.length>0?f(E,z[0]):!c.current.noIsolation;L&&E.cancelable&&E.preventDefault()}}},[]),h=x.useCallback(function(j,E,C,N){var z={name:j,delta:E,target:C,should:N,shadowParent:WO(C)};t.current.push(z),setTimeout(function(){t.current=t.current.filter(function(L){return L!==z})},1)},[]),y=x.useCallback(function(j){n.current=Cd(j),a.current=void 0},[]),g=x.useCallback(function(j){h(j.type,Y1(j),j.target,f(j,e.lockRef.current))},[]),b=x.useCallback(function(j){h(j.type,Cd(j),j.target,f(j,e.lockRef.current))},[]);x.useEffect(function(){return ms.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:b}),document.addEventListener("wheel",m,hs),document.addEventListener("touchmove",m,hs),document.addEventListener("touchstart",y,hs),function(){ms=ms.filter(function(j){return j!==o}),document.removeEventListener("wheel",m,hs),document.removeEventListener("touchmove",m,hs),document.removeEventListener("touchstart",y,hs)}},[]);var w=e.removeScrollBar,k=e.inert;return x.createElement(x.Fragment,null,k?x.createElement(o,{styles:YO(l)}):null,w?x.createElement($O,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function WO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eD=_O(mj,JO);var bj=x.forwardRef(function(e,t){return x.createElement(wf,Gr({},e,{ref:t,sideCar:eD}))});bj.classNames=wf.classNames;var tD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ps=new WeakMap,Ed=new WeakMap,Nd={},yp=0,xj=function(e){return e&&(e.host||xj(e.parentNode))},nD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=xj(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})},rD=function(e,t,n,a){var l=nD(t,Array.isArray(e)?e:[e]);Nd[n]||(Nd[n]=new WeakMap);var o=Nd[n],c=[],f=new Set,m=new Set(l),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};l.forEach(h);var y=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(b){if(f.has(b))y(b);else try{var w=b.getAttribute(a),k=w!==null&&w!=="false",j=(ps.get(b)||0)+1,E=(o.get(b)||0)+1;ps.set(b,j),o.set(b,E),c.push(b),j===1&&k&&Ed.set(b,!0),E===1&&b.setAttribute(n,"true"),k||b.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return y(t),f.clear(),yp++,function(){c.forEach(function(g){var b=ps.get(g)-1,w=o.get(g)-1;ps.set(g,b),o.set(g,w),b||(Ed.has(g)||g.removeAttribute(a),Ed.delete(g)),w||g.removeAttribute(n)}),yp--,yp||(ps=new WeakMap,ps=new WeakMap,Ed=new WeakMap,Nd={})}},aD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),l=tD(e);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live], script"))),rD(a,l,n,"aria-hidden")):function(){return null}},Sf="Dialog",[wj]=I3(Sf),[iD,Ur]=wj(Sf),Sj=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:l,onOpenChange:o,modal:c=!0}=e,f=x.useRef(null),m=x.useRef(null),[h,y]=F3({prop:a,defaultProp:l??!1,onChange:o,caller:Sf});return u.jsx(iD,{scope:t,triggerRef:f,contentRef:m,contentId:_a(),titleId:_a(),descriptionId:_a(),open:h,onOpenChange:y,onOpenToggle:x.useCallback(()=>y(g=>!g),[y]),modal:c,children:n})};Sj.displayName=Sf;var kj="DialogTrigger",jj=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Ur(kj,n),o=jl(t,l.triggerRef);return u.jsx(za.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":ky(l.open),...a,ref:o,onClick:Ei(e.onClick,l.onOpenToggle)})});jj.displayName=kj;var wy="DialogPortal",[lD,Cj]=wj(wy,{forceMount:void 0}),Ej=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:l}=e,o=Ur(wy,t);return u.jsx(lD,{scope:t,forceMount:n,children:x.Children.map(a,c=>u.jsx(xf,{present:n||o.open,children:u.jsx(dj,{asChild:!0,container:l,children:c})}))})};Ej.displayName=wy;var Jd="DialogOverlay",Nj=x.forwardRef((e,t)=>{const n=Cj(Jd,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,o=Ur(Jd,e.__scopeDialog);return o.modal?u.jsx(xf,{present:a||o.open,children:u.jsx(oD,{...l,ref:t})}):null});Nj.displayName=Jd;var sD=ij("DialogOverlay.RemoveScroll"),oD=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Ur(Jd,n);return u.jsx(bj,{as:sD,allowPinchZoom:!0,shards:[l.contentRef],children:u.jsx(za.div,{"data-state":ky(l.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),gl="DialogContent",_j=x.forwardRef((e,t)=>{const n=Cj(gl,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,o=Ur(gl,e.__scopeDialog);return u.jsx(xf,{present:a||o.open,children:o.modal?u.jsx(uD,{...l,ref:t}):u.jsx(cD,{...l,ref:t})})});_j.displayName=gl;var uD=x.forwardRef((e,t)=>{const n=Ur(gl,e.__scopeDialog),a=x.useRef(null),l=jl(t,n.contentRef,a);return x.useEffect(()=>{const o=a.current;if(o)return aD(o)},[]),u.jsx(Tj,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ei(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Ei(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:Ei(e.onFocusOutside,o=>o.preventDefault())})}),cD=x.forwardRef((e,t)=>{const n=Ur(gl,e.__scopeDialog),a=x.useRef(!1),l=x.useRef(!1);return u.jsx(Tj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&l.current&&o.preventDefault()}})}),Tj=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:o,...c}=e,f=Ur(gl,n),m=x.useRef(null),h=jl(t,m);return vO(),u.jsxs(u.Fragment,{children:[u.jsx(uj,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:o,children:u.jsx(sj,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":ky(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(dD,{titleId:f.titleId}),u.jsx(hD,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Sy="DialogTitle",Aj=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Ur(Sy,n);return u.jsx(za.h2,{id:l.titleId,...a,ref:t})});Aj.displayName=Sy;var Rj="DialogDescription",zj=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Ur(Rj,n);return u.jsx(za.p,{id:l.descriptionId,...a,ref:t})});zj.displayName=Rj;var Oj="DialogClose",Dj=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=Ur(Oj,n);return u.jsx(za.button,{type:"button",...a,ref:t,onClick:Ei(e.onClick,()=>l.onOpenChange(!1))})});Dj.displayName=Oj;function ky(e){return e?"open":"closed"}var Mj="DialogTitleWarning",[cZ,Lj]=L3(Mj,{contentName:gl,titleName:Sy,docsSlug:"dialog"}),dD=({titleId:e})=>{const t=Lj(Mj),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},fD="DialogDescriptionWarning",hD=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Lj(fD).contentName}}.`;return x.useEffect(()=>{var o;const l=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Ij=Sj,mD=jj,Uj=Ej,Pj=Nj,Bj=_j,pD=Aj,gD=zj,yD=Dj,vD=Symbol.for("react.lazy"),Wd=Yg[" use ".trim().toString()];function bD(e){return typeof e=="object"&&e!==null&&"then"in e}function $j(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vD&&"_payload"in e&&bD(e._payload)}function Fj(e){const t=wD(e),n=x.forwardRef((a,l)=>{let{children:o,...c}=a;$j(o)&&typeof Wd=="function"&&(o=Wd(o._payload));const f=x.Children.toArray(o),m=f.find(kD);if(m){const h=m.props.children,y=f.map(g=>g===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:g);return u.jsx(t,{...c,ref:l,children:x.isValidElement(h)?x.cloneElement(h,void 0,y):null})}return u.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}var xD=Fj("Slot");function wD(e){const t=x.forwardRef((n,a)=>{let{children:l,...o}=n;if($j(l)&&typeof Wd=="function"&&(l=Wd(l._payload)),x.isValidElement(l)){const c=CD(l),f=jD(o,l.props);return l.type!==x.Fragment&&(f.ref=a?_i(a,c):c),x.cloneElement(l,f)}return x.Children.count(l)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var SD=Symbol("radix.slottable");function kD(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SD}function jD(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...f)=>{const m=o(...f);return l(...f),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function CD(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ED=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oa=ED.reduce((e,t)=>{const n=Fj(`Primitive.${t}`),a=x.forwardRef((l,o)=>{const{asChild:c,...f}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),ou='[cmdk-group=""]',vp='[cmdk-group-items=""]',ND='[cmdk-group-heading=""]',qj='[cmdk-item=""]',J1=`${qj}:not([aria-disabled="true"])`,Cg="cmdk-item-select",bs="data-value",_D=(e,t,n)=>M3(e,t,n),Hj=x.createContext(void 0),Ku=()=>x.useContext(Hj),Zj=x.createContext(void 0),jy=()=>x.useContext(Zj),Vj=x.createContext(void 0),Qj=x.forwardRef((e,t)=>{let n=xs(()=>{var B,T;return{search:"",value:(T=(B=e.value)!=null?B:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=xs(()=>new Set),l=xs(()=>new Map),o=xs(()=>new Map),c=xs(()=>new Set),f=Gj(e),{label:m,children:h,value:y,onValueChange:g,filter:b,shouldFilter:w,loop:k,disablePointerSelection:j=!1,vimBindings:E=!0,...C}=e,N=_a(),z=_a(),L=_a(),D=x.useRef(null),O=PD();yl(()=>{if(y!==void 0){let B=y.trim();n.current.value=B,M.emit()}},[y]),yl(()=>{O(6,ye)},[]);let M=x.useMemo(()=>({subscribe:B=>(c.current.add(B),()=>c.current.delete(B)),snapshot:()=>n.current,setState:(B,T,q)=>{var K,ce,xe,we;if(!Object.is(n.current[B],T)){if(n.current[B]=T,B==="search")ee(),F(),O(1,J);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let pe=document.getElementById(L);pe?pe.focus():(K=document.getElementById(N))==null||K.focus()}if(O(7,()=>{var pe;n.current.selectedItemId=(pe=he())==null?void 0:pe.id,M.emit()}),q||O(5,ye),((ce=f.current)==null?void 0:ce.value)!==void 0){let pe=T??"";(we=(xe=f.current).onValueChange)==null||we.call(xe,pe);return}}M.emit()}},emit:()=>{c.current.forEach(B=>B())}}),[]),U=x.useMemo(()=>({value:(B,T,q)=>{var K;T!==((K=o.current.get(B))==null?void 0:K.value)&&(o.current.set(B,{value:T,keywords:q}),n.current.filtered.items.set(B,X(T,q)),O(2,()=>{F(),M.emit()}))},item:(B,T)=>(a.current.add(B),T&&(l.current.has(T)?l.current.get(T).add(B):l.current.set(T,new Set([B]))),O(3,()=>{ee(),F(),n.current.value||J(),M.emit()}),()=>{o.current.delete(B),a.current.delete(B),n.current.filtered.items.delete(B);let q=he();O(4,()=>{ee(),(q==null?void 0:q.getAttribute("id"))===B&&J(),M.emit()})}),group:B=>(l.current.has(B)||l.current.set(B,new Set),()=>{o.current.delete(B),l.current.delete(B)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:N,inputId:L,labelId:z,listInnerRef:D}),[]);function X(B,T){var q,K;let ce=(K=(q=f.current)==null?void 0:q.filter)!=null?K:_D;return B?ce(B,n.current.search,T):0}function F(){if(!n.current.search||f.current.shouldFilter===!1)return;let B=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(K=>{let ce=l.current.get(K),xe=0;ce.forEach(we=>{let pe=B.get(we);xe=Math.max(pe,xe)}),T.push([K,xe])});let q=D.current;ne().sort((K,ce)=>{var xe,we;let pe=K.getAttribute("id"),Xe=ce.getAttribute("id");return((xe=B.get(Xe))!=null?xe:0)-((we=B.get(pe))!=null?we:0)}).forEach(K=>{let ce=K.closest(vp);ce?ce.appendChild(K.parentElement===ce?K:K.closest(`${vp} > *`)):q.appendChild(K.parentElement===q?K:K.closest(`${vp} > *`))}),T.sort((K,ce)=>ce[1]-K[1]).forEach(K=>{var ce;let xe=(ce=D.current)==null?void 0:ce.querySelector(`${ou}[${bs}="${encodeURIComponent(K[0])}"]`);xe==null||xe.parentElement.appendChild(xe)})}function J(){let B=ne().find(q=>q.getAttribute("aria-disabled")!=="true"),T=B==null?void 0:B.getAttribute(bs);M.setState("value",T||void 0)}function ee(){var B,T,q,K;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ce=0;for(let xe of a.current){let we=(T=(B=o.current.get(xe))==null?void 0:B.value)!=null?T:"",pe=(K=(q=o.current.get(xe))==null?void 0:q.keywords)!=null?K:[],Xe=X(we,pe);n.current.filtered.items.set(xe,Xe),Xe>0&&ce++}for(let[xe,we]of l.current)for(let pe of we)if(n.current.filtered.items.get(pe)>0){n.current.filtered.groups.add(xe);break}n.current.filtered.count=ce}function ye(){var B,T,q;let K=he();K&&(((B=K.parentElement)==null?void 0:B.firstChild)===K&&((q=(T=K.closest(ou))==null?void 0:T.querySelector(ND))==null||q.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function he(){var B;return(B=D.current)==null?void 0:B.querySelector(`${qj}[aria-selected="true"]`)}function ne(){var B;return Array.from(((B=D.current)==null?void 0:B.querySelectorAll(J1))||[])}function Z(B){let T=ne()[B];T&&M.setState("value",T.getAttribute(bs))}function te(B){var T;let q=he(),K=ne(),ce=K.findIndex(we=>we===q),xe=K[ce+B];(T=f.current)!=null&&T.loop&&(xe=ce+B<0?K[K.length-1]:ce+B===K.length?K[0]:K[ce+B]),xe&&M.setState("value",xe.getAttribute(bs))}function ie(B){let T=he(),q=T==null?void 0:T.closest(ou),K;for(;q&&!K;)q=B>0?ID(q,ou):UD(q,ou),K=q==null?void 0:q.querySelector(J1);K?M.setState("value",K.getAttribute(bs)):te(B)}let ue=()=>Z(ne().length-1),A=B=>{B.preventDefault(),B.metaKey?ue():B.altKey?ie(1):te(1)},P=B=>{B.preventDefault(),B.metaKey?Z(0):B.altKey?ie(-1):te(-1)};return x.createElement(Oa.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:B=>{var T;(T=C.onKeyDown)==null||T.call(C,B);let q=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||q))switch(B.key){case"n":case"j":{E&&B.ctrlKey&&A(B);break}case"ArrowDown":{A(B);break}case"p":case"k":{E&&B.ctrlKey&&P(B);break}case"ArrowUp":{P(B);break}case"Home":{B.preventDefault(),Z(0);break}case"End":{B.preventDefault(),ue();break}case"Enter":{B.preventDefault();let K=he();if(K){let ce=new Event(Cg);K.dispatchEvent(ce)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:$D},m),kf(e,B=>x.createElement(Zj.Provider,{value:M},x.createElement(Hj.Provider,{value:U},B))))}),TD=x.forwardRef((e,t)=>{var n,a;let l=_a(),o=x.useRef(null),c=x.useContext(Vj),f=Ku(),m=Gj(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;yl(()=>{if(!h)return f.item(l,c==null?void 0:c.id)},[h]);let y=Kj(l,o,[e.value,e.children,o],e.keywords),g=jy(),b=Ti(O=>O.value&&O.value===y.current),w=Ti(O=>h||f.filter()===!1?!0:O.search?O.filtered.items.get(l)>0:!0);x.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(Cg,k),()=>O.removeEventListener(Cg,k)},[w,e.onSelect,e.disabled]);function k(){var O,M;j(),(M=(O=m.current).onSelect)==null||M.call(O,y.current)}function j(){g.setState("value",y.current,!0)}if(!w)return null;let{disabled:E,value:C,onSelect:N,forceMount:z,keywords:L,...D}=e;return x.createElement(Oa.div,{ref:_i(o,t),...D,id:l,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||f.getDisablePointerSelection()?void 0:j,onClick:E?void 0:k},e.children)}),AD=x.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:l,...o}=e,c=_a(),f=x.useRef(null),m=x.useRef(null),h=_a(),y=Ku(),g=Ti(w=>l||y.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);yl(()=>y.group(c),[]),Kj(c,f,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:c,forceMount:l}),[l]);return x.createElement(Oa.div,{ref:_i(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),kf(e,w=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},x.createElement(Vj.Provider,{value:b},w))))}),RD=x.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,l=x.useRef(null),o=Ti(c=>!c.search);return!n&&!o?null:x.createElement(Oa.div,{ref:_i(l,t),...a,"cmdk-separator":"",role:"separator"})}),zD=x.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,l=e.value!=null,o=jy(),c=Ti(h=>h.search),f=Ti(h=>h.selectedItemId),m=Ku();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Oa.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:l?e.value:c,onChange:h=>{l||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),OD=x.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...l}=e,o=x.useRef(null),c=x.useRef(null),f=Ti(h=>h.selectedItemId),m=Ku();return x.useEffect(()=>{if(c.current&&o.current){let h=c.current,y=o.current,g,b=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=h.offsetHeight;y.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(g),b.unobserve(h)}}},[]),x.createElement(Oa.div,{ref:_i(o,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},kf(e,h=>x.createElement("div",{ref:_i(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),DD=x.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:l,contentClassName:o,container:c,...f}=e;return x.createElement(Ij,{open:n,onOpenChange:a},x.createElement(Uj,{container:c},x.createElement(Pj,{"cmdk-overlay":"",className:l}),x.createElement(Bj,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Qj,{ref:t,...f}))))}),MD=x.forwardRef((e,t)=>Ti(n=>n.filtered.count===0)?x.createElement(Oa.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),LD=x.forwardRef((e,t)=>{let{progress:n,children:a,label:l="Loading...",...o}=e;return x.createElement(Oa.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},kf(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),Gn=Object.assign(Qj,{List:OD,Item:TD,Input:zD,Group:AD,Separator:RD,Dialog:DD,Empty:MD,Loading:LD});function ID(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function UD(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Gj(e){let t=x.useRef(e);return yl(()=>{t.current=e}),t}var yl=typeof window>"u"?x.useEffect:x.useLayoutEffect;function xs(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Ti(e){let t=jy(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function Kj(e,t,n,a=[]){let l=x.useRef(),o=Ku();return yl(()=>{var c;let f=(()=>{var h;for(let y of n){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(h=y.current.textContent)==null?void 0:h.trim():l.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(c=t.current)==null||c.setAttribute(bs,f),l.current=f}),l}var PD=()=>{let[e,t]=x.useState(),n=xs(()=>new Map);return yl(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,l)=>{n.current.set(a,l),t({})}};function BD(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function kf({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(BD(t),{ref:t.ref},n(t.props.children)):n(t)}var $D={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $t=Ij,FD=mD,qD=Uj,Yj=x.forwardRef(({className:e,...t},n)=>u.jsx(Pj,{ref:n,className:Ae("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}));Yj.displayName="DialogOverlay";const zt=x.forwardRef(({className:e,children:t,...n},a)=>u.jsxs(qD,{children:[u.jsx(Yj,{}),u.jsxs(Bj,{ref:a,className:Ae("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,u.jsxs(yD,{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:[u.jsx(Kd,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function Gt({className:e,...t}){return u.jsx("div",{className:Ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function tn({className:e,...t}){return u.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const Ft=x.forwardRef(({className:e,...t},n)=>u.jsx(pD,{ref:n,className:Ae("text-subtitle leading-none tracking-tight",e),...t}));Ft.displayName="DialogTitle";const jf=x.forwardRef(({className:e,...t},n)=>u.jsx(gD,{ref:n,className:Ae("text-body text-muted-foreground",e),...t}));jf.displayName="DialogDescription";const Xj=x.forwardRef(({className:e,...t},n)=>u.jsx(Gn,{ref:n,className:Ae("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Xj.displayName=Gn.displayName;function HD({open:e,onOpenChange:t,children:n}){return u.jsx($t,{open:e,onOpenChange:t,children:u.jsx(zt,{className:"overflow-hidden p-0 shadow-lg",children:u.jsx(Xj,{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 Jj=x.forwardRef(({className:e,...t},n)=>u.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[u.jsx(bf,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),u.jsx(Gn.Input,{ref:n,className:Ae("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})]}));Jj.displayName=Gn.Input.displayName;const Wj=x.forwardRef(({className:e,...t},n)=>u.jsx(Gn.List,{ref:n,className:Ae("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));Wj.displayName=Gn.List.displayName;const eC=x.forwardRef((e,t)=>u.jsx(Gn.Empty,{ref:t,className:"py-6 text-center text-body",...e}));eC.displayName=Gn.Empty.displayName;const qd=x.forwardRef(({className:e,...t},n)=>u.jsx(Gn.Group,{ref:n,className:Ae("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}));qd.displayName=Gn.Group.displayName;const Eg=x.forwardRef(({className:e,...t},n)=>u.jsx(Gn.Separator,{ref:n,className:Ae("-mx-1 h-px bg-border",e),...t}));Eg.displayName=Gn.Separator.displayName;const Hd=x.forwardRef(({className:e,...t},n)=>u.jsx(Gn.Item,{ref:n,className:Ae("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}));Hd.displayName=Gn.Item.displayName;function Yu(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 je.get(`/admin/agents${n?`?${n}`:""}`)}function ZD(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return je.get(`/admin/agents/all${n?`?${n}`:""}`)}function tC(e){return je.get(`/admin/agents/${encodeURIComponent(e)}`)}function VD(e){return je.post("/admin/agents",e)}function QD(e){return je.get(`/admin/agents/names/${encodeURIComponent(e)}/availability`)}function W1(e,t){return je.patch(`/admin/agents/${encodeURIComponent(e)}`,t)}function GD(e,t){return je.patch(`/admin/agents/${encodeURIComponent(e)}/rebind`,t)}function KD(e){return je.delete(`/admin/agents/${encodeURIComponent(e)}`)}function YD(e){return je.post(`/admin/agents/${encodeURIComponent(e)}/suspend`,{})}function XD(e){return je.post(`/admin/agents/${encodeURIComponent(e)}/reactivate`,{})}function JD(e){return je.post(`/admin/agents/${encodeURIComponent(e)}/test`,{})}function Cl(){const{data:e}=He({queryKey:["agents","name-map"],queryFn:()=>Yu({limit:100}),staleTime:3e4});return x.useMemo(()=>{const t=new Map;if(e!=null&&e.items)for(const n of e.items)t.set(n.uuid,n.displayName);return n=>n?t.get(n)??n:"—"},[e])}function Cy(){const{data:e}=He({queryKey:["agents","name-map"],queryFn:()=>Yu({limit:100}),staleTime:3e4});return x.useMemo(()=>{const t=new Map;if(e!=null&&e.items)for(const n of e.items)t.set(n.uuid,{name:n.name,displayName:n.displayName});return n=>n?t.get(n)??null:null},[e])}const WD=[{path:"/",label:"Workspace"},{path:"/agents",label:"Agents"},{path:"/clients",label:"Computers"},{path:"/settings",label:"Settings"},{path:"/admin",label:"Admin"}];function eM({open:e,onOpenChange:t}){const n=fn(),a=Cl(),{data:l}=He({queryKey:["activity"],queryFn:Gu,enabled:e,staleTime:3e4}),o=(l==null?void 0:l.agents)??[],f=He({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const y of o)try{const g=await eo(y.agentId);for(const b of g)h.push({agentId:y.agentId,session:b})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return u.jsxs(HD,{open:e,onOpenChange:t,children:[u.jsx(Jj,{placeholder:"Jump to agent, chat, or page…"}),u.jsxs(Wj,{children:[u.jsx(eC,{children:"No results"}),o.length>0&&u.jsx(qd,{heading:"Agents",children:o.map(h=>{const y=a(h.agentId);return u.jsxs(Hd,{value:`agent ${y} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[u.jsx(MR,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{className:"flex-1 truncate",children:y}),u.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(Eg,{}),u.jsx(qd,{heading:"Chats",children:f.map(({agentId:h,session:y})=>{const g=a(h);return u.jsxs(Hd,{value:`chat ${g} ${y.chatId}`,onSelect:()=>m(`/?a=${h}&c=${y.chatId}`),children:[u.jsx(py,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{className:"flex-1 truncate",children:g}),u.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:y.chatId.slice(0,8)})]},`${h}-${y.chatId}`)})})]}),u.jsx(Eg,{}),u.jsx(qd,{heading:"Pages",children:WD.map(h=>u.jsxs(Hd,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[u.jsx(QR,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{children:h.label})]},h.path))})]})]})}function tM(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function nM(){var a;const{user:e}=qt(),{data:t}=He({queryKey:["clients"],queryFn:Ra,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=tM(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const rM=160;function aM(){const e=fn(),{rows:t,firstHostname:n}=nM();if(t.length===0)return null;const a=t.length>1,l=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return u.jsxs("button",{type:"button",onClick:()=>e("/clients"),title:l,"aria-label":l,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:[u.jsx(iM,{}),a?u.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[u.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):u.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[u.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:rM,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),u.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function iM(){return u.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),u.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 to(e){return u.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[u.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),u.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),u.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),u.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),u.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),u.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),u.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),u.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),u.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),u.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function Ng(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 je.get(`/admin/notifications${n?`?${n}`:""}`)}function nC(e){return je.post(`/admin/notifications/${e}/read`)}function lM(){return je.post("/admin/notifications/read-all")}const sM={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 oM(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function rC({notification:e,onClick:t,clickable:n}){const a=(sM[e.type]??e.type).toString(),l=oM(e.severity),o=n??!0;return u.jsxs("button",{type:"button",onClick:t,className:Ae("w-full text-left transition-colors text-body",o?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${l}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:c=>{o&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[u.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[u.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:Ni(e.createdAt)})]}),u.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function uM(){var w;const[e,t]=x.useState(!1),[n,a]=x.useState(null),l=x.useRef(null),o=fn(),c=dn(),{data:f}=He({queryKey:["notifications","bell"],queryFn:()=>Ng({limit:8}),refetchInterval:1e4}),{data:m}=He({queryKey:["notifications","unread-count"],queryFn:()=>Ng({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,y=h>0,g=x.useCallback(async k=>{k.read||(nC(k.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),k.agentId&&k.chatId?o(`/?a=${k.agentId}&c=${k.chatId}`):k.agentId&&o(`/?a=${k.agentId}`)},[o,c]),b=x.useCallback(async()=>{a(null);try{await lM(),await c.invalidateQueries({queryKey:["notifications"]})}catch(k){a(k instanceof Error?k.message:"Failed to mark all as read")}},[c]);return u.jsxs("div",{className:"relative",children:[u.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:[u.jsx(OR,{className:"h-4 w-4"}),y&&u.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&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),u.jsxs("div",{ref:l,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:[u.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),y&&u.jsx("button",{type:"button",onClick:b,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&u.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}),u.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?u.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=>u.jsx(rC,{notification:k,clickable:!!k.agentId,onClick:()=>g(k)},k.id))})]})]})]})}function cM(){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 dM(){const[e,t]=x.useState(cM);return x.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),u.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"?u.jsx(vz,{className:"h-4 w-4"}):u.jsx(nz,{className:"h-4 w-4"})})}function fM(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function ew({src:e,name:t,size:n=28,className:a}){const l=`${n}px`;return e?u.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:l,height:l,borderRadius:"50%",objectFit:"cover",display:"block"}}):u.jsx("span",{className:a,role:"img","aria-label":t,style:{width:l,height:l,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:u.jsx("span",{className:"text-subtitle font-semibold",children:fM(t)})})}const tw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,nw=$k,hM=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return nw(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:o}=t,c=Object.keys(l).map(h=>{const y=n==null?void 0:n[h],g=o==null?void 0:o[h];if(y===null)return null;const b=tw(y)||tw(g);return l[h][b]}),f=n&&Object.entries(n).reduce((h,y)=>{let[g,b]=y;return b===void 0||(h[g]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,y)=>{let{class:g,className:b,...w}=y;return Object.entries(w).every(k=>{let[j,E]=k;return Array.isArray(E)?E.includes({...o,...f}[j]):{...o,...f}[j]===E})?[...h,g,b]:h},[]);return nw(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},mM=hM("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"}}),me=x.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...l},o)=>{const c=a?xD:"button";return u.jsx(c,{className:Ae(mM({variant:t,size:n,className:e})),ref:o,...l})});me.displayName="Button";const jt=x.forwardRef(({className:e,type:t,...n},a)=>u.jsx("input",{type:t,className:Ae("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}));jt.displayName="Input";function pM({action:e,onClose:t}){const n=e!==null;return u.jsx($t,{open:n,onOpenChange:a=>!a&&t(),children:u.jsxs(zt,{children:[u.jsxs(Gt,{children:[u.jsx(Ft,{children:e==="join"?"Join a team":"Create a new team"}),u.jsx(jf,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&u.jsx(yM,{onDone:t}),e==="join"&&u.jsx(vM,{onDone:t})]})})}function gM(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function yM({onDone:e}){const{adoptTokens:t}=qt(),n=fn(),[a,l]=x.useState(""),[o,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{l(""),c(null),m(!1)},[]);const h=async y=>{y.preventDefault();const g=a.trim();if(g){m(!0),c(null);try{const b=await je.post("/me/organizations",{name:gM(g),displayName:g});await t(b.tokens),e(),n("/",{replace:!0})}catch(b){c(b instanceof Error?b.message:"Failed to create team")}finally{m(!1)}}};return u.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),u.jsx(jt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:y=>l(y.target.value),placeholder:"Acme Robotics",autoFocus:!0}),u.jsx(me,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function vM({onDone:e}){const{adoptTokens:t}=qt(),n=fn(),[a,l]=x.useState(""),[o,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{l(""),c(null),m(!1)},[]);const h=async y=>{if(y.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),b=/\/invite\/([^/?#]+)/.exec(g),w=(b==null?void 0:b[1])??g,k=await je.post("/me/organizations/join",{token:w});await t(k.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return u.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),u.jsx(jt,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:y=>l(y.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),u.jsx(me,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function bM(){var N;const{organizationId:e,user:t,selectOrganization:n,logout:a}=qt(),l=fn(),[o,c]=x.useState([]),[f,m]=x.useState(!1),[h,y]=x.useState(null),g=x.useRef(null);x.useEffect(()=>{(async()=>{try{const z=await je.get("/me/organizations");c(z)}catch{}})()},[]),x.useEffect(()=>{const z=D=>{f&&g.current&&!g.current.contains(D.target)&&m(!1)},L=D=>{f&&D.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",z),window.addEventListener("keydown",L),()=>{window.removeEventListener("mousedown",z),window.removeEventListener("keydown",L)}},[f]);const b=(t==null?void 0:t.displayName)??"User",w=(t==null?void 0:t.username)??"",k=(t==null?void 0:t.avatarUrl)??null,j=async z=>{if(z===e){m(!1);return}try{await n(z),m(!1),l("/",{replace:!0})}catch{}},E=()=>{m(!1),y("create")},C=()=>{m(!1),y("join")};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{ref:g,className:"relative","data-testid":"user-menu",children:[u.jsx("button",{type:"button","aria-label":`User menu, ${b}`,"aria-haspopup":"menu","aria-expanded":f,onClick:()=>m(z=>!z),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:f?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:u.jsx(ew,{src:k,name:b,size:28})}),f&&u.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[u.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[u.jsx(ew,{src:k,name:b,size:32}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:b}),w&&w!==b&&u.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",w]})]})]}),o.length>0&&u.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[u.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Team"}),o.length===1?u.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[u.jsx("span",{style:{width:14,display:"inline-flex"},children:u.jsx(cr,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"truncate",children:(N=o[0])==null?void 0:N.displayName})]}):u.jsx("div",{children:o.map(z=>u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void j(z.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:[u.jsx("span",{style:{width:14,display:"inline-flex"},children:z.id===e?u.jsx(cr,{className:"h-3.5 w-3.5"}):null}),u.jsx("span",{className:"truncate",children:z.displayName})]},z.id))})]}),u.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:E,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:[u.jsx(Jr,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Create new team"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:C,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:[u.jsx(Ez,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Join with invite link"})]})]}),u.jsxs("div",{className:"py-1",children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{m(!1),l("/settings")},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:[u.jsx(mz,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Settings"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{m(!1),a()},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:[u.jsx(WR,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Sign out"})]})]})]})]}),u.jsx(pM,{action:h,onClose:()=>y(null)})]})}const rw=[{to:"/",label:"Workspace",end:!0,kbd:"⌘1"},{to:"/agents",label:"Agents",end:!1,kbd:"⌘2"},{to:"/clients",label:"Computers",end:!1,kbd:"⌘3"},{to:"/settings",label:"Settings",end:!1,kbd:"⌘4"}],xM={to:"/admin",label:"Admin",end:!1,kbd:"⌘5"};function wM(){const{role:e}=qt(),t=e==="admin",[n,a]=x.useState(!1),l=t?[...rw,xM]:rw,o=Mn(),c=o.pathname==="/"||o.search.includes("a=");return x.useEffect(()=>{const f=m=>{(m.metaKey||m.ctrlKey)&&m.key.toLowerCase()==="k"&&(m.preventDefault(),a(h=>!h))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]),u.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[u.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:[u.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[u.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[u.jsx(to,{width:16,height:18,style:{color:"var(--fg)"}}),u.jsxs("span",{className:"text-title",style:{color:"var(--fg)"},children:["First Tree"," ",u.jsx("span",{className:"font-normal",style:{color:"var(--fg-3)"},children:"Hub"})]})]}),u.jsx(aM,{})]}),u.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:l.map(f=>u.jsx(Tk,{to:f.to,end:f.end,style:{pointerEvents:"auto"},className:({isActive:m})=>Ae("inline-flex items-center transition-colors",m?"":"hover:text-[var(--fg)]"),children:({isActive:m})=>u.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:m?"var(--fg)":"var(--fg-3)",background:m?"var(--bg-hover)":"transparent"},children:[f.label,m&&u.jsx("span",{className:"kbd",children:f.kbd})]})},f.to))}),u.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[u.jsxs("button",{type:"button",onClick:()=>a(!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:f=>{f.currentTarget.style.color="var(--fg)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--fg-3)"},children:[u.jsx(bf,{className:"h-4 w-4"}),u.jsx("span",{children:"Jump to…"}),u.jsx("span",{className:"kbd",children:"⌘K"})]}),u.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),u.jsx(uM,{}),u.jsx(dM,{}),u.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),u.jsx(bM,{})]})]}),u.jsx(eM,{open:n,onOpenChange:a}),c?u.jsx(mg,{}):u.jsx("main",{className:"flex-1 overflow-auto",children:u.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:u.jsx(mg,{})})})]})}function se(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,y=Object.keys(h);for(let g=0;g<y.length;g++){const b=y[g];b in f||(f[b]=h[b].bind(f))}}const l=(n==null?void 0:n.Parent)??Object;class o extends l{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const y of h._zod.deferred)y();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 Ns extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class aC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const iC={};function Ai(e){return iC}function lC(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,l])=>t.indexOf(+a)===-1).map(([a,l])=>l)}function _g(e,t){return typeof t=="bigint"?t.toString():t}function Cf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ey(e){return e==null}function Ny(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function SM(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let l=(a.split(".")[1]||"").length;if(l===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(l=Number.parseInt(m[1]))}const o=n>l?n:l,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const aw=Symbol("evaluating");function mt(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==aw)return a===void 0&&(a=aw,a=n()),a},set(l){Object.defineProperty(e,t,{value:l})},configurable:!0})}function El(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oi(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function iw(e){return JSON.stringify(e)}function kM(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Tu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const jM=Cf(()=>{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 Zs(e){if(Tu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Tu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oC(e){return Zs(e)?{...e}:Array.isArray(e)?[...e]:e}const CM=new Set(["string","number","symbol"]);function Vs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Di(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 Re(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 EM(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const NM={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 _M(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Oi(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 El(this,"shape",c),c},checks:[]});return Di(e,o)}function TM(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Oi(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 El(this,"shape",c),c},checks:[]});return Di(e,o)}function AM(e,t){if(!Zs(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(o,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const l=Oi(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return El(this,"shape",o),o}});return Di(e,l)}function RM(e,t){if(!Zs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Oi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return El(this,"shape",a),a}});return Di(e,n)}function zM(e,t){const n=Oi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return El(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Di(e,n)}function OM(e,t,n){const l=t._zod.def.checks;if(l&&l.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=Oi(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 El(this,"shape",m),m},checks:[]});return Di(t,c)}function DM(e,t,n){const a=Oi(t._zod.def,{get shape(){const l=t._zod.def.shape,o={...l};if(n)for(const c in n){if(!(c in o))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(o[c]=new e({type:"nonoptional",innerType:l[c]}))}else for(const c in l)o[c]=new e({type:"nonoptional",innerType:l[c]});return El(this,"shape",o),o}});return Di(t,a)}function Ss(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 ks(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function _d(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ri(e,t,n){var l,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const y=_d((c=(o=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??_d((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??_d((m=n.customError)==null?void 0:m.call(n,e))??_d((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=y}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function _y(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Au(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const uC=(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,_g,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cC=se("$ZodError",uC),dC=se("$ZodError",uC,{Parent:Error});function MM(e,t=n=>n.message){const n={},a=[];for(const l of e.issues)l.path.length>0?(n[l.path[0]]=n[l.path[0]]||[],n[l.path[0]].push(t(l))):a.push(t(l));return{formErrors:a,fieldErrors:n}}function LM(e,t=n=>n.message){const n={_errors:[]},a=l=>{for(const o of l.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>a({issues:c}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let c=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Ty=e=>(t,n,a,l)=>{const o=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new Ns;if(c.issues.length){const f=new((l==null?void 0:l.Err)??e)(c.issues.map(m=>Ri(m,o,Ai())));throw sC(f,l==null?void 0:l.callee),f}return c.value},Ay=e=>async(t,n,a,l)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((l==null?void 0:l.Err)??e)(c.issues.map(m=>Ri(m,o,Ai())));throw sC(f,l==null?void 0:l.callee),f}return c.value},Ef=e=>(t,n,a)=>{const l=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},l);if(o instanceof Promise)throw new Ns;return o.issues.length?{success:!1,error:new(e??cC)(o.issues.map(c=>Ri(c,l,Ai())))}:{success:!0,data:o.value}},IM=Ef(dC),Nf=e=>async(t,n,a)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},l);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(c=>Ri(c,l,Ai())))}:{success:!0,data:o.value}},UM=Nf(dC),PM=e=>(t,n,a)=>{const l=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ty(e)(t,n,l)},BM=e=>(t,n,a)=>Ty(e)(t,n,a),$M=e=>async(t,n,a)=>{const l=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ay(e)(t,n,l)},FM=e=>async(t,n,a)=>Ay(e)(t,n,a),qM=e=>(t,n,a)=>{const l=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ef(e)(t,n,l)},HM=e=>(t,n,a)=>Ef(e)(t,n,a),ZM=e=>async(t,n,a)=>{const l=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Nf(e)(t,n,l)},VM=e=>async(t,n,a)=>Nf(e)(t,n,a),QM=/^[cC][^\s-]{8,}$/,GM=/^[0-9a-z]+$/,KM=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,YM=/^[0-9a-vA-V]{20}$/,XM=/^[A-Za-z0-9]{27}$/,JM=/^[a-zA-Z0-9_-]{21}$/,WM=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e4=/^([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})$/,lw=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)$/,t4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,n4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function r4(){return new RegExp(n4,"u")}const a4=/^(?:(?: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])$/,i4=/^(([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}|:))$/,l4=/^((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])$/,s4=/^(([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])$/,o4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fC=/^[A-Za-z0-9_-]*$/,u4=/^\+[1-9]\d{6,14}$/,hC="(?:(?:\\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])))",c4=new RegExp(`^${hC}$`);function mC(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 d4(e){return new RegExp(`^${mC(e)}$`)}function f4(e){const t=mC({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(`^${hC}T(?:${a})$`)}const h4=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}$`)},m4=/^-?\d+$/,pC=/^-?\d+(?:\.\d+)?$/,p4=/^(?:true|false)$/i,g4=/^[^A-Z]*$/,y4=/^[^a-z]*$/,Kn=se("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gC={number:"number",bigint:"bigint",object:"date"},yC=se("$ZodCheckLessThan",(e,t)=>{Kn.init(e,t);const n=gC[typeof t.value];e._zod.onattach.push(a=>{const l=a._zod.bag,o=(t.inclusive?l.maximum:l.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?l.maximum=t.value:l.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})}}),vC=se("$ZodCheckGreaterThan",(e,t)=>{Kn.init(e,t);const n=gC[typeof t.value];e._zod.onattach.push(a=>{const l=a._zod.bag,o=(t.inclusive?l.minimum:l.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?l.minimum=t.value:l.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})}}),v4=se("$ZodCheckMultipleOf",(e,t)=>{Kn.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):SM(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})}}),b4=se("$ZodCheckNumberFormat",(e,t)=>{var c;Kn.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[l,o]=NM[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=l,m.maximum=o,n&&(m.pattern=m4)}),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<l&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:l,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),x4=se("$ZodCheckMaxLength",(e,t)=>{var n;Kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Ey(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<l&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const l=a.value;if(l.length<=t.maximum)return;const c=_y(l);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),w4=se("$ZodCheckMinLength",(e,t)=>{var n;Kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Ey(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>l&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const l=a.value;if(l.length>=t.minimum)return;const c=_y(l);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),S4=se("$ZodCheckLengthEquals",(e,t)=>{var n;Kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Ey(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag;l.minimum=t.length,l.maximum=t.length,l.length=t.length}),e._zod.check=a=>{const l=a.value,o=l.length;if(o===t.length)return;const c=_y(l),f=o>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),_f=se("$ZodCheckStringFormat",(e,t)=>{var n,a;Kn.init(e,t),e._zod.onattach.push(l=>{const o=l._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=l=>{t.pattern.lastIndex=0,!t.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:t.format,input:l.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),k4=se("$ZodCheckRegex",(e,t)=>{_f.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})}}),j4=se("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=g4),_f.init(e,t)}),C4=se("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=y4),_f.init(e,t)}),E4=se("$ZodCheckIncludes",(e,t)=>{Kn.init(e,t);const n=Vs(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(l=>{const o=l._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(a)}),e._zod.check=l=>{l.value.includes(t.includes,t.position)||l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:l.value,inst:e,continue:!t.abort})}}),N4=se("$ZodCheckStartsWith",(e,t)=>{Kn.init(e,t);const n=new RegExp(`^${Vs(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.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})}}),_4=se("$ZodCheckEndsWith",(e,t)=>{Kn.init(e,t);const n=new RegExp(`.*${Vs(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.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})}}),T4=se("$ZodCheckOverwrite",(e,t)=>{Kn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class A4{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),l=Math.min(...a.map(c=>c.length-c.trimStart().length)),o=a.map(c=>c.slice(l)).map(c=>" ".repeat(this.indent*2)+c);for(const c of o)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,l=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,l.join(`
|
|
321
|
+
`))}}const R4={major:4,minor:3,patch:6},Ot=se("$ZodType",(e,t)=>{var l;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=R4;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(l=e._zod.deferred)==null||l.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let y=Ss(f),g;for(const b of m){if(b._zod.def.when){if(!b._zod.def.when(f))continue}else if(y)continue;const w=f.issues.length,k=b._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new Ns;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,f.issues.length!==w&&(y||(y=Ss(f,w)))});else{if(f.issues.length===w)continue;y||(y=Ss(f,w))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(Ss(f))return f.aborted=!0,f;const y=o(m,a,h);if(y instanceof Promise){if(h.async===!1)throw new Ns;return y.then(g=>e._zod.parse(g,h))}return e._zod.parse(y,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const y=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return y instanceof Promise?y.then(g=>c(g,f,m)):c(y,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new Ns;return h.then(y=>o(y,a,m))}return o(h,a,m)}}mt(e,"~standard",()=>({validate:o=>{var c;try{const f=IM(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return UM(e,o).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Ry=se("$ZodString",(e,t)=>{var n;Ot.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??h4(e._zod.bag),e._zod.parse=(a,l)=>{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}}),Rt=se("$ZodStringFormat",(e,t)=>{_f.init(e,t),Ry.init(e,t)}),z4=se("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=e4),Rt.init(e,t)}),O4=se("$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=lw(a))}else t.pattern??(t.pattern=lw());Rt.init(e,t)}),D4=se("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=t4),Rt.init(e,t)}),M4=se("$ZodURL",(e,t)=>{Rt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),l=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(l.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(l.protocol.endsWith(":")?l.protocol.slice(0,-1):l.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=l.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),L4=se("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=r4()),Rt.init(e,t)}),I4=se("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=JM),Rt.init(e,t)}),U4=se("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=QM),Rt.init(e,t)}),P4=se("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=GM),Rt.init(e,t)}),B4=se("$ZodULID",(e,t)=>{t.pattern??(t.pattern=KM),Rt.init(e,t)}),$4=se("$ZodXID",(e,t)=>{t.pattern??(t.pattern=YM),Rt.init(e,t)}),F4=se("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=XM),Rt.init(e,t)}),q4=se("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=f4(t)),Rt.init(e,t)}),H4=se("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=c4),Rt.init(e,t)}),Z4=se("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=d4(t)),Rt.init(e,t)}),V4=se("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=WM),Rt.init(e,t)}),Q4=se("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=a4),Rt.init(e,t),e._zod.bag.format="ipv4"}),G4=se("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=i4),Rt.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})}}}),K4=se("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=l4),Rt.init(e,t)}),Y4=se("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=s4),Rt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[l,o]=a;if(!o)throw new Error;const c=Number(o);if(`${c}`!==o)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${l}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function bC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const X4=se("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=o4),Rt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{bC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function J4(e){if(!fC.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return bC(n)}const W4=se("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=fC),Rt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{J4(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),e5=se("$ZodE164",(e,t)=>{t.pattern??(t.pattern=u4),Rt.init(e,t)});function t5(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const l=JSON.parse(atob(a));return!("typ"in l&&(l==null?void 0:l.typ)!=="JWT"||!l.alg||t&&(!("alg"in l)||l.alg!==t))}catch{return!1}}const n5=se("$ZodJWT",(e,t)=>{Rt.init(e,t),e._zod.check=n=>{t5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),xC=se("$ZodNumber",(e,t)=>{Ot.init(e,t),e._zod.pattern=e._zod.bag.pattern??pC,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const l=n.value;if(typeof l=="number"&&!Number.isNaN(l)&&Number.isFinite(l))return n;const o=typeof l=="number"?Number.isNaN(l)?"NaN":Number.isFinite(l)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...o?{received:o}:{}}),n}}),r5=se("$ZodNumberFormat",(e,t)=>{b4.init(e,t),xC.init(e,t)}),a5=se("$ZodBoolean",(e,t)=>{Ot.init(e,t),e._zod.pattern=p4,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const l=n.value;return typeof l=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:l,inst:e}),n}}),i5=se("$ZodUnknown",(e,t)=>{Ot.init(e,t),e._zod.parse=n=>n}),l5=se("$ZodNever",(e,t)=>{Ot.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function sw(e,t,n){e.issues.length&&t.issues.push(...ks(n,e.issues)),t.value[n]=e.value}const s5=se("$ZodArray",(e,t)=>{Ot.init(e,t),e._zod.parse=(n,a)=>{const l=n.value;if(!Array.isArray(l))return n.issues.push({expected:"array",code:"invalid_type",input:l,inst:e}),n;n.value=Array(l.length);const o=[];for(let c=0;c<l.length;c++){const f=l[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>sw(h,n,c))):sw(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function ef(e,t,n,a,l){if(e.issues.length){if(l&&!(n in a))return;t.issues.push(...ks(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function wC(e){var a,l,o,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(o=(l=(a=e.shape)==null?void 0:a[f])==null?void 0:l._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=EM(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function SC(e,t,n,a,l,o){const c=[],f=l.keySet,m=l.catchall._zod,h=m.def.type,y=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const b=m.run({value:t[g],issues:[]},a);b instanceof Promise?e.push(b.then(w=>ef(w,n,g,t,y))):ef(b,n,g,t,y)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const o5=se("$ZodObject",(e,t)=>{Ot.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=Cf(()=>wC(t));mt(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const y=f[h]._zod;if(y.values){m[h]??(m[h]=new Set);for(const g of y.values)m[h].add(g)}}return m});const l=Tu,o=t.catchall;let c;e._zod.parse=(f,m)=>{c??(c=a.value);const h=f.value;if(!l(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const y=[],g=c.shape;for(const b of c.keys){const w=g[b],k=w._zod.optout==="optional",j=w._zod.run({value:h[b],issues:[]},m);j instanceof Promise?y.push(j.then(E=>ef(E,f,b,h,k))):ef(j,f,b,h,k)}return o?SC(y,h,f,m,a.value,e):y.length?Promise.all(y).then(()=>f):f}}),u5=se("$ZodObjectJIT",(e,t)=>{o5.init(e,t);const n=e._zod.parse,a=Cf(()=>wC(t)),l=b=>{var z;const w=new A4(["shape","payload","ctx"]),k=a.value,j=L=>{const D=iw(L);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};w.write("const input = payload.value;");const E=Object.create(null);let C=0;for(const L of k.keys)E[L]=`key_${C++}`;w.write("const newResult = {};");for(const L of k.keys){const D=E[L],O=iw(L),M=b[L],U=((z=M==null?void 0:M._zod)==null?void 0:z.optout)==="optional";w.write(`const ${D} = ${j(L)};`),U?w.write(`
|
|
322
|
+
if (${D}.issues.length) {
|
|
323
|
+
if (${O} in input) {
|
|
324
|
+
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
|
325
|
+
...iss,
|
|
326
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
327
|
+
})));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (${D}.value === undefined) {
|
|
332
|
+
if (${O} in input) {
|
|
333
|
+
newResult[${O}] = undefined;
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
newResult[${O}] = ${D}.value;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
`):w.write(`
|
|
340
|
+
if (${D}.issues.length) {
|
|
341
|
+
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
|
342
|
+
...iss,
|
|
343
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
344
|
+
})));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (${D}.value === undefined) {
|
|
348
|
+
if (${O} in input) {
|
|
349
|
+
newResult[${O}] = undefined;
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
newResult[${O}] = ${D}.value;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const N=w.compile();return(L,D)=>N(b,L,D)};let o;const c=Tu,f=!iC.jitless,h=f&&jM.value,y=t.catchall;let g;e._zod.parse=(b,w)=>{g??(g=a.value);const k=b.value;return c(k)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=l(t.shape)),b=o(b,w),y?SC([],k,b,w,g,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),b)}});function ow(e,t,n,a){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const l=e.filter(o=>!Ss(o));return l.length===1?(t.value=l[0].value,l[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(c=>Ri(c,a,Ai())))}),t)}const kC=se("$ZodUnion",(e,t)=>{Ot.init(e,t),mt(e._zod,"optin",()=>t.options.some(l=>l._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(l=>l._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(l=>l._zod.values))return new Set(t.options.flatMap(l=>Array.from(l._zod.values)))}),mt(e._zod,"pattern",()=>{if(t.options.every(l=>l._zod.pattern)){const l=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${l.map(o=>Ny(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(l,o)=>{if(n)return a(l,o);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:l.value,issues:[]},o);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(m=>ow(m,l,e,o)):ow(f,l,e,o)}}),c5=se("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kC.init(e,t);const n=e._zod.parse;mt(e._zod,"propValues",()=>{const l={};for(const o of t.options){const c=o._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(c)){l[f]||(l[f]=new Set);for(const h of m)l[f].add(h)}}return l});const a=Cf(()=>{var c;const l=t.options,o=new Map;for(const f of l){const m=(c=f._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(l,o)=>{const c=l.value;if(!Tu(c))return l.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),l;const f=a.value.get(c==null?void 0:c[t.discriminator]);return f?f._zod.run(l,o):t.unionFallback?n(l,o):(l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),l)}}),d5=se("$ZodIntersection",(e,t)=>{Ot.init(e,t),e._zod.parse=(n,a)=>{const l=n.value,o=t.left._zod.run({value:l,issues:[]},a),c=t.right._zod.run({value:l,issues:[]},a);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([m,h])=>uw(n,m,h)):uw(n,o,c)}});function Tg(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(Zs(e)&&Zs(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),l={...e,...t};for(const o of a){const c=Tg(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};l[o]=c.data}return{valid:!0,data:l}}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 l=e[a],o=t[a],c=Tg(l,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function uw(e,t,n){const a=new Map;let l;for(const f of t.issues)if(f.code==="unrecognized_keys"){l??(l=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&l&&e.issues.push({...l,keys:o}),Ss(e))return e;const c=Tg(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 f5=se("$ZodRecord",(e,t)=>{Ot.init(e,t),e._zod.parse=(n,a)=>{const l=n.value;if(!Zs(l))return n.issues.push({expected:"record",code:"invalid_type",input:l,inst:e}),n;const o=[],c=t.keyType._zod.values;if(c){n.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const y=t.valueType._zod.run({value:l[h],issues:[]},a);y instanceof Promise?o.push(y.then(g=>{g.issues.length&&n.issues.push(...ks(h,g.issues)),n.value[h]=g.value})):(y.issues.length&&n.issues.push(...ks(h,y.issues)),n.value[h]=y.value)}let m;for(const h in l)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:l,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(l)){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"&&pC.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=l[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>Ri(g,a,Ai())),input:f,path:[f],inst:e});continue}const y=t.valueType._zod.run({value:l[f],issues:[]},a);y instanceof Promise?o.push(y.then(g=>{g.issues.length&&n.issues.push(...ks(f,g.issues)),n.value[m.value]=g.value})):(y.issues.length&&n.issues.push(...ks(f,y.issues)),n.value[m.value]=y.value)}}return o.length?Promise.all(o).then(()=>n):n}}),h5=se("$ZodEnum",(e,t)=>{Ot.init(e,t);const n=lC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(l=>CM.has(typeof l)).map(l=>typeof l=="string"?Vs(l):l.toString()).join("|")})$`),e._zod.parse=(l,o)=>{const c=l.value;return a.has(c)||l.issues.push({code:"invalid_value",values:n,input:c,inst:e}),l}}),m5=se("$ZodLiteral",(e,t)=>{if(Ot.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"?Vs(a):a?Vs(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,l)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),a}}),p5=se("$ZodTransform",(e,t)=>{Ot.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new aC(e.constructor.name);const l=t.transform(n.value,n);if(a.async)return(l instanceof Promise?l:Promise.resolve(l)).then(c=>(n.value=c,n));if(l instanceof Promise)throw new Ns;return n.value=l,n}});function cw(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const jC=se("$ZodOptional",(e,t)=>{Ot.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ny(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(o=>cw(o,n.value)):cw(l,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),g5=se("$ZodExactOptional",(e,t)=>{jC.init(e,t),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),y5=se("$ZodNullable",(e,t)=>{Ot.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ny(n.source)}|null)$`):void 0}),mt(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)}),v5=se("$ZodDefault",(e,t)=>{Ot.init(e,t),e._zod.optin="optional",mt(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 l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(o=>dw(o,t)):dw(l,t)}});function dw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const b5=se("$ZodPrefault",(e,t)=>{Ot.init(e,t),e._zod.optin="optional",mt(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))}),x5=se("$ZodNonOptional",(e,t)=>{Ot.init(e,t),mt(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 l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(o=>fw(o,e)):fw(l,e)}});function fw(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 w5=se("$ZodCatch",(e,t)=>{Ot.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>Ri(c,a,Ai()))},input:n.value}),n.issues=[]),n)):(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(o=>Ri(o,a,Ai()))},input:n.value}),n.issues=[]),n)}}),S5=se("$ZodPipe",(e,t)=>{Ot.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),mt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const o=t.out._zod.run(n,a);return o instanceof Promise?o.then(c=>Td(c,t.in,a)):Td(o,t.in,a)}const l=t.in._zod.run(n,a);return l instanceof Promise?l.then(o=>Td(o,t.out,a)):Td(l,t.out,a)}});function Td(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const k5=se("$ZodReadonly",(e,t)=>{Ot.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),mt(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 l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(hw):hw(l)}});function hw(e){return e.value=Object.freeze(e.value),e}const j5=se("$ZodCustom",(e,t)=>{Kn.init(e,t),Ot.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,l=t.fn(a);if(l instanceof Promise)return l.then(o=>mw(o,n,a,e));mw(l,n,a,e)}});function mw(e,t,n,a){if(!e){const l={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(l.params=a._zod.def.params),t.issues.push(Au(l))}}var pw;class C5{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 l={...a,...this._map.get(t)};return Object.keys(l).length?l:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function E5(){return new C5}(pw=globalThis).__zod_globalRegistry??(pw.__zod_globalRegistry=E5());const pu=globalThis.__zod_globalRegistry;function N5(e,t){return new e({type:"string",...Re(t)})}function _5(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Re(t)})}function gw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Re(t)})}function T5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(t)})}function A5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(t)})}function R5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(t)})}function z5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(t)})}function O5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Re(t)})}function D5(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(t)})}function M5(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(t)})}function L5(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(t)})}function I5(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(t)})}function U5(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(t)})}function P5(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Re(t)})}function B5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(t)})}function $5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(t)})}function F5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(t)})}function q5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(t)})}function H5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(t)})}function Z5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Re(t)})}function V5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(t)})}function Q5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Re(t)})}function G5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(t)})}function K5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(t)})}function Y5(e,t){return new e({type:"string",format:"date",check:"string_format",...Re(t)})}function X5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Re(t)})}function J5(e,t){return new e({type:"string",format:"duration",check:"string_format",...Re(t)})}function W5(e,t){return new e({type:"number",checks:[],...Re(t)})}function eL(e,t){return new e({type:"number",coerce:!0,checks:[],...Re(t)})}function tL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(t)})}function nL(e,t){return new e({type:"boolean",...Re(t)})}function rL(e){return new e({type:"unknown"})}function aL(e,t){return new e({type:"never",...Re(t)})}function yw(e,t){return new yC({check:"less_than",...Re(t),value:e,inclusive:!1})}function bp(e,t){return new yC({check:"less_than",...Re(t),value:e,inclusive:!0})}function vw(e,t){return new vC({check:"greater_than",...Re(t),value:e,inclusive:!1})}function xp(e,t){return new vC({check:"greater_than",...Re(t),value:e,inclusive:!0})}function bw(e,t){return new v4({check:"multiple_of",...Re(t),value:e})}function CC(e,t){return new x4({check:"max_length",...Re(t),maximum:e})}function tf(e,t){return new w4({check:"min_length",...Re(t),minimum:e})}function EC(e,t){return new S4({check:"length_equals",...Re(t),length:e})}function iL(e,t){return new k4({check:"string_format",format:"regex",...Re(t),pattern:e})}function lL(e){return new j4({check:"string_format",format:"lowercase",...Re(e)})}function sL(e){return new C4({check:"string_format",format:"uppercase",...Re(e)})}function oL(e,t){return new E4({check:"string_format",format:"includes",...Re(t),includes:e})}function uL(e,t){return new N4({check:"string_format",format:"starts_with",...Re(t),prefix:e})}function cL(e,t){return new _4({check:"string_format",format:"ends_with",...Re(t),suffix:e})}function no(e){return new T4({check:"overwrite",tx:e})}function dL(e){return no(t=>t.normalize(e))}function fL(){return no(e=>e.trim())}function hL(){return no(e=>e.toLowerCase())}function mL(){return no(e=>e.toUpperCase())}function pL(){return no(e=>kM(e))}function gL(e,t,n){return new e({type:"array",element:t,...Re(n)})}function yL(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Re(n)})}function vL(e){const t=bL(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(Au(a,n.value,t._zod.def));else{const l=a;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=t),l.continue??(l.continue=!t._zod.def.abort),n.issues.push(Au(l))}},e(n.value,n)));return t}function bL(e,t){const n=new Kn({check:"custom",...Re(t)});return n._zod.check=e,n}function NC(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)??pu,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 en(e,t,n={path:[],schemaPath:[]}){var y,g;var a;const l=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(g=(y=e._zod).toJSONSchema)==null?void 0:g.call(y);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[l.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);j(e,t,k,b)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),en(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"&&zn(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 _C(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 y of e.seen.entries()){const g=(c=e.metadataRegistry.get(y[0]))==null?void 0:c.id;if(g){const b=a.get(g);if(b&&b!==y[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,y[0])}}const l=y=>{var j;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(j=e.external.registry.get(y[0]))==null?void 0:j.id,C=e.external.uri??(z=>z);if(E)return{ref:C(E)};const N=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(y[1]===n)return{ref:"#"};const w=`#/${g}/`,k=y[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:w+k}},o=y=>{if(y[1].schema.$ref)return;const g=y[1],{ref:b,defId:w}=l(y);g.def={...g.schema},w&&(g.defId=w);const k=g.schema;for(const j in k)delete k[j];k.$ref=b};if(e.cycles==="throw")for(const y of e.seen.entries()){const g=y[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
|
|
356
|
+
|
|
357
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const g=y[1];if(t===y[0]){o(y);continue}if(e.external){const w=(m=e.external.registry.get(y[0]))==null?void 0:m.id;if(t!==y[0]&&w){o(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){o(y);continue}if(g.cycle){o(y);continue}if(g.count>1&&e.reused==="ref"){o(y);continue}}}function TC(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 y=e.seen.get(h);if(y.ref===null)return;const g=y.def??y.schema,b={...g},w=y.ref;if(y.ref=null,w){a(w);const j=e.seen.get(w),E=j.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Object.assign(g,E),Object.assign(g,b),h._zod.parent===w)for(const N in g)N==="$ref"||N==="allOf"||N in b||delete g[N];if(E.$ref&&j.def)for(const N in g)N==="$ref"||N==="allOf"||N in j.def&&JSON.stringify(g[N])===JSON.stringify(j.def[N])&&delete g[N]}const k=h._zod.parent;if(k&&k!==w){a(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(g.$ref=j.schema.$ref,j.def))for(const E in g)E==="$ref"||E==="allOf"||E in j.def&&JSON.stringify(g[E])===JSON.stringify(j.def[E])&&delete g[E]}e.override({zodSchema:h,jsonSchema:g,path:y.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$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");l.$id=e.external.uri(h)}Object.assign(l,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const y=h[1];y.def&&y.defId&&(o[y.defId]=y.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?l.$defs=o:l.definitions=o);try{const h=JSON.parse(JSON.stringify(l));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:nf(t,"input",e.processors),output:nf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function zn(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 zn(a.element,n);if(a.type==="set")return zn(a.valueType,n);if(a.type==="lazy")return zn(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 zn(a.innerType,n);if(a.type==="intersection")return zn(a.left,n)||zn(a.right,n);if(a.type==="record"||a.type==="map")return zn(a.keyType,n)||zn(a.valueType,n);if(a.type==="pipe")return zn(a.in,n)||zn(a.out,n);if(a.type==="object"){for(const l in a.shape)if(zn(a.shape[l],n))return!0;return!1}if(a.type==="union"){for(const l of a.options)if(zn(l,n))return!0;return!1}if(a.type==="tuple"){for(const l of a.items)if(zn(l,n))return!0;return!!(a.rest&&zn(a.rest,n))}return!1}const xL=(e,t={})=>n=>{const a=NC({...n,processors:t});return en(e,a),_C(a,e),TC(a,e)},nf=(e,t,n={})=>a=>{const{libraryOptions:l,target:o}=a??{},c=NC({...l??{},target:o,io:t,processors:n});return en(e,c),_C(c,e),TC(c,e)},wL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},SL=(e,t,n,a)=>{const l=n;l.type="string";const{minimum:o,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(l.minLength=o),typeof c=="number"&&(l.maxLength=c),f&&(l.format=wL[f]??f,l.format===""&&delete l.format,f==="time"&&delete l.format),h&&(l.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?l.pattern=y[0].source:y.length>1&&(l.allOf=[...y.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},kL=(e,t,n,a)=>{const l=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?l.type="integer":l.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.minimum=y,l.exclusiveMinimum=!0):l.exclusiveMinimum=y),typeof o=="number"&&(l.minimum=o,typeof y=="number"&&t.target!=="draft-04"&&(y>=o?delete l.minimum:delete l.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.maximum=h,l.exclusiveMaximum=!0):l.exclusiveMaximum=h),typeof c=="number"&&(l.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete l.maximum:delete l.exclusiveMaximum)),typeof m=="number"&&(l.multipleOf=m)},jL=(e,t,n,a)=>{n.type="boolean"},CL=(e,t,n,a)=>{n.not={}},EL=(e,t,n,a)=>{},NL=(e,t,n,a)=>{const l=e._zod.def,o=lC(l.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},_L=(e,t,n,a)=>{const l=e._zod.def,o=[];for(const c of l.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(c))}else o.push(c);if(o.length!==0)if(o.length===1){const c=o[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),o.every(c=>typeof c=="boolean")&&(n.type="boolean"),o.every(c=>c===null)&&(n.type="null"),n.enum=o},TL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},AL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},RL=(e,t,n,a)=>{const l=n,o=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(l.minItems=c),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=en(o.element,t,{...a,path:[...a.path,"items"]})},zL=(e,t,n,a)=>{var h;const l=n,o=e._zod.def;l.type="object",l.properties={};const c=o.shape;for(const y in c)l.properties[y]=en(c[y],t,{...a,path:[...a.path,"properties",y]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(y=>{const g=o.shape[y]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(l.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?l.additionalProperties=!1:o.catchall?o.catchall&&(l.additionalProperties=en(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(l.additionalProperties=!1)},OL=(e,t,n,a)=>{const l=e._zod.def,o=l.inclusive===!1,c=l.options.map((f,m)=>en(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},DL=(e,t,n,a)=>{const l=e._zod.def,o=en(l.left,t,{...a,path:[...a.path,"allOf",0]}),c=en(l.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},ML=(e,t,n,a)=>{const l=n,o=e._zod.def;l.type="object";const c=o.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const y=en(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});l.patternProperties={};for(const g of m)l.patternProperties[g.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(l.propertyNames=en(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),l.additionalProperties=en(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const y=[...h].filter(g=>typeof g=="string"||typeof g=="number");y.length>0&&(l.required=y)}},LL=(e,t,n,a)=>{const l=e._zod.def,o=en(l.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=l.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},IL=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType},UL=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType,n.default=JSON.parse(JSON.stringify(l.defaultValue))},PL=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},BL=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType;let c;try{c=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},$L=(e,t,n,a)=>{const l=e._zod.def,o=t.io==="input"?l.in._zod.def.type==="transform"?l.out:l.in:l.out;en(o,t,a);const c=t.seen.get(e);c.ref=o},FL=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType,n.readOnly=!0},AC=(e,t,n,a)=>{const l=e._zod.def;en(l.innerType,t,a);const o=t.seen.get(e);o.ref=l.innerType},qL=se("ZodISODateTime",(e,t)=>{q4.init(e,t),Mt.init(e,t)});function HL(e){return K5(qL,e)}const ZL=se("ZodISODate",(e,t)=>{H4.init(e,t),Mt.init(e,t)});function VL(e){return Y5(ZL,e)}const QL=se("ZodISOTime",(e,t)=>{Z4.init(e,t),Mt.init(e,t)});function GL(e){return X5(QL,e)}const KL=se("ZodISODuration",(e,t)=>{V4.init(e,t),Mt.init(e,t)});function YL(e){return J5(KL,e)}const XL=(e,t)=>{cC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>LM(e,n)},flatten:{value:n=>MM(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,_g,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,_g,2)}},isEmpty:{get(){return e.issues.length===0}}})},Tr=se("ZodError",XL,{Parent:Error}),JL=Ty(Tr),WL=Ay(Tr),eI=Ef(Tr),tI=Nf(Tr),nI=PM(Tr),rI=BM(Tr),aI=$M(Tr),iI=FM(Tr),lI=qM(Tr),sI=HM(Tr),oI=ZM(Tr),uI=VM(Tr),Dt=se("ZodType",(e,t)=>(Ot.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nf(e,"input"),output:nf(e,"output")}}),e.toJSONSchema=xL(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Oi(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)=>Di(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>JL(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>eI(e,n,a),e.parseAsync=async(n,a)=>WL(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>tI(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>nI(e,n,a),e.decode=(n,a)=>rI(e,n,a),e.encodeAsync=async(n,a)=>aI(e,n,a),e.decodeAsync=async(n,a)=>iI(e,n,a),e.safeEncode=(n,a)=>lI(e,n,a),e.safeDecode=(n,a)=>sI(e,n,a),e.safeEncodeAsync=async(n,a)=>oI(e,n,a),e.safeDecodeAsync=async(n,a)=>uI(e,n,a),e.refine=(n,a)=>e.check(t6(n,a)),e.superRefine=n=>e.check(n6(n)),e.overwrite=n=>e.check(no(n)),e.optional=()=>Sw(e),e.exactOptional=()=>FI(e),e.nullable=()=>kw(e),e.nullish=()=>Sw(kw(e)),e.nonoptional=n=>GI(e,n),e.array=()=>Qn(e),e.or=n=>OC([e,n]),e.and=n=>II(e,n),e.transform=n=>Rg(e,DC(n)),e.default=n=>ZI(e,n),e.prefault=n=>QI(e,n),e.catch=n=>YI(e,n),e.pipe=n=>Rg(e,n),e.readonly=()=>WI(e),e.describe=n=>{const a=e.clone();return pu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=pu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return pu.get(e);const a=e.clone();return pu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),RC=se("_ZodString",(e,t)=>{Ry.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(a,l,o)=>SL(e,a,l);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(iL(...a)),e.includes=(...a)=>e.check(oL(...a)),e.startsWith=(...a)=>e.check(uL(...a)),e.endsWith=(...a)=>e.check(cL(...a)),e.min=(...a)=>e.check(tf(...a)),e.max=(...a)=>e.check(CC(...a)),e.length=(...a)=>e.check(EC(...a)),e.nonempty=(...a)=>e.check(tf(1,...a)),e.lowercase=a=>e.check(lL(a)),e.uppercase=a=>e.check(sL(a)),e.trim=()=>e.check(fL()),e.normalize=(...a)=>e.check(dL(...a)),e.toLowerCase=()=>e.check(hL()),e.toUpperCase=()=>e.check(mL()),e.slugify=()=>e.check(pL())}),cI=se("ZodString",(e,t)=>{Ry.init(e,t),RC.init(e,t),e.email=n=>e.check(_5(dI,n)),e.url=n=>e.check(O5(fI,n)),e.jwt=n=>e.check(G5(NI,n)),e.emoji=n=>e.check(D5(hI,n)),e.guid=n=>e.check(gw(xw,n)),e.uuid=n=>e.check(T5(Ad,n)),e.uuidv4=n=>e.check(A5(Ad,n)),e.uuidv6=n=>e.check(R5(Ad,n)),e.uuidv7=n=>e.check(z5(Ad,n)),e.nanoid=n=>e.check(M5(mI,n)),e.guid=n=>e.check(gw(xw,n)),e.cuid=n=>e.check(L5(pI,n)),e.cuid2=n=>e.check(I5(gI,n)),e.ulid=n=>e.check(U5(yI,n)),e.base64=n=>e.check(Z5(jI,n)),e.base64url=n=>e.check(V5(CI,n)),e.xid=n=>e.check(P5(vI,n)),e.ksuid=n=>e.check(B5(bI,n)),e.ipv4=n=>e.check($5(xI,n)),e.ipv6=n=>e.check(F5(wI,n)),e.cidrv4=n=>e.check(q5(SI,n)),e.cidrv6=n=>e.check(H5(kI,n)),e.e164=n=>e.check(Q5(EI,n)),e.datetime=n=>e.check(HL(n)),e.date=n=>e.check(VL(n)),e.time=n=>e.check(GL(n)),e.duration=n=>e.check(YL(n))});function R(e){return N5(cI,e)}const Mt=se("ZodStringFormat",(e,t)=>{Rt.init(e,t),RC.init(e,t)}),dI=se("ZodEmail",(e,t)=>{D4.init(e,t),Mt.init(e,t)}),xw=se("ZodGUID",(e,t)=>{z4.init(e,t),Mt.init(e,t)}),Ad=se("ZodUUID",(e,t)=>{O4.init(e,t),Mt.init(e,t)}),fI=se("ZodURL",(e,t)=>{M4.init(e,t),Mt.init(e,t)}),hI=se("ZodEmoji",(e,t)=>{L4.init(e,t),Mt.init(e,t)}),mI=se("ZodNanoID",(e,t)=>{I4.init(e,t),Mt.init(e,t)}),pI=se("ZodCUID",(e,t)=>{U4.init(e,t),Mt.init(e,t)}),gI=se("ZodCUID2",(e,t)=>{P4.init(e,t),Mt.init(e,t)}),yI=se("ZodULID",(e,t)=>{B4.init(e,t),Mt.init(e,t)}),vI=se("ZodXID",(e,t)=>{$4.init(e,t),Mt.init(e,t)}),bI=se("ZodKSUID",(e,t)=>{F4.init(e,t),Mt.init(e,t)}),xI=se("ZodIPv4",(e,t)=>{Q4.init(e,t),Mt.init(e,t)}),wI=se("ZodIPv6",(e,t)=>{G4.init(e,t),Mt.init(e,t)}),SI=se("ZodCIDRv4",(e,t)=>{K4.init(e,t),Mt.init(e,t)}),kI=se("ZodCIDRv6",(e,t)=>{Y4.init(e,t),Mt.init(e,t)}),jI=se("ZodBase64",(e,t)=>{X4.init(e,t),Mt.init(e,t)}),CI=se("ZodBase64URL",(e,t)=>{W4.init(e,t),Mt.init(e,t)}),EI=se("ZodE164",(e,t)=>{e5.init(e,t),Mt.init(e,t)}),NI=se("ZodJWT",(e,t)=>{n5.init(e,t),Mt.init(e,t)}),zy=se("ZodNumber",(e,t)=>{xC.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(a,l,o)=>kL(e,a,l),e.gt=(a,l)=>e.check(vw(a,l)),e.gte=(a,l)=>e.check(xp(a,l)),e.min=(a,l)=>e.check(xp(a,l)),e.lt=(a,l)=>e.check(yw(a,l)),e.lte=(a,l)=>e.check(bp(a,l)),e.max=(a,l)=>e.check(bp(a,l)),e.int=a=>e.check(ww(a)),e.safe=a=>e.check(ww(a)),e.positive=a=>e.check(vw(0,a)),e.nonnegative=a=>e.check(xp(0,a)),e.negative=a=>e.check(yw(0,a)),e.nonpositive=a=>e.check(bp(0,a)),e.multipleOf=(a,l)=>e.check(bw(a,l)),e.step=(a,l)=>e.check(bw(a,l)),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 Ke(e){return W5(zy,e)}const _I=se("ZodNumberFormat",(e,t)=>{r5.init(e,t),zy.init(e,t)});function ww(e){return tL(_I,e)}const TI=se("ZodBoolean",(e,t)=>{a5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>jL(e,n,a)});function Wr(e){return nL(TI,e)}const AI=se("ZodUnknown",(e,t)=>{i5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>EL()});function St(){return rL(AI)}const RI=se("ZodNever",(e,t)=>{l5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>CL(e,n,a)});function zI(e){return aL(RI,e)}const OI=se("ZodArray",(e,t)=>{s5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>RL(e,n,a,l),e.element=t.element,e.min=(n,a)=>e.check(tf(n,a)),e.nonempty=n=>e.check(tf(1,n)),e.max=(n,a)=>e.check(CC(n,a)),e.length=(n,a)=>e.check(EC(n,a)),e.unwrap=()=>e.element});function Qn(e,t){return gL(OI,e,t)}const DI=se("ZodObject",(e,t)=>{u5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>zL(e,n,a,l),mt(e,"shape",()=>t.shape),e.keyof=()=>Ve(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:St()}),e.loose=()=>e.clone({...e._zod.def,catchall:St()}),e.strict=()=>e.clone({...e._zod.def,catchall:zI()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>AM(e,n),e.safeExtend=n=>RM(e,n),e.merge=n=>zM(e,n),e.pick=n=>_M(e,n),e.omit=n=>TM(e,n),e.partial=(...n)=>OM(MC,e,n[0]),e.required=(...n)=>DM(LC,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...Re(t)};return new DI(n)}const zC=se("ZodUnion",(e,t)=>{kC.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>OL(e,n,a,l),e.options=t.options});function OC(e,t){return new zC({type:"union",options:e,...Re(t)})}const MI=se("ZodDiscriminatedUnion",(e,t)=>{zC.init(e,t),c5.init(e,t)});function Oy(e,t,n){return new MI({type:"union",options:t,discriminator:e,...Re(n)})}const LI=se("ZodIntersection",(e,t)=>{d5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>DL(e,n,a,l)});function II(e,t){return new LI({type:"intersection",left:e,right:t})}const UI=se("ZodRecord",(e,t)=>{f5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>ML(e,n,a,l),e.keyType=t.keyType,e.valueType=t.valueType});function Ht(e,t,n){return new UI({type:"record",keyType:e,valueType:t,...Re(n)})}const Ag=se("ZodEnum",(e,t)=>{h5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(a,l,o)=>NL(e,a,l),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,l)=>{const o={};for(const c of a)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Ag({...t,checks:[],...Re(l),entries:o})},e.exclude=(a,l)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new Ag({...t,checks:[],...Re(l),entries:o})}});function Ve(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Ag({type:"enum",entries:n,...Re(t)})}const PI=se("ZodLiteral",(e,t)=>{m5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>_L(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ln(e,t){return new PI({type:"literal",values:Array.isArray(e)?e:[e],...Re(t)})}const BI=se("ZodTransform",(e,t)=>{p5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>AL(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new aC(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Au(o,n.value,t));else{const c=o;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(Au(c))}};const l=t.transform(n.value,n);return l instanceof Promise?l.then(o=>(n.value=o,n)):(n.value=l,n)}});function DC(e){return new BI({type:"transform",transform:e})}const MC=se("ZodOptional",(e,t)=>{jC.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>AC(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function Sw(e){return new MC({type:"optional",innerType:e})}const $I=se("ZodExactOptional",(e,t)=>{g5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>AC(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function FI(e){return new $I({type:"optional",innerType:e})}const qI=se("ZodNullable",(e,t)=>{y5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>LL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function kw(e){return new qI({type:"nullable",innerType:e})}const HI=se("ZodDefault",(e,t)=>{v5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>UL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ZI(e,t){return new HI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():oC(t)}})}const VI=se("ZodPrefault",(e,t)=>{b5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>PL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function QI(e,t){return new VI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():oC(t)}})}const LC=se("ZodNonOptional",(e,t)=>{x5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>IL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function GI(e,t){return new LC({type:"nonoptional",innerType:e,...Re(t)})}const KI=se("ZodCatch",(e,t)=>{w5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>BL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function YI(e,t){return new KI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const XI=se("ZodPipe",(e,t)=>{S5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>$L(e,n,a,l),e.in=t.in,e.out=t.out});function Rg(e,t){return new XI({type:"pipe",in:e,out:t})}const JI=se("ZodReadonly",(e,t)=>{k5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>FL(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function WI(e){return new JI({type:"readonly",innerType:e})}const e6=se("ZodCustom",(e,t)=>{j5.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,a,l)=>TL(e,n)});function t6(e,t={}){return yL(e6,e,t)}function n6(e){return vL(e)}function r6(e,t){return Rg(DC(e),t)}const wp={custom:"custom"};function Tf(e){return eL(zy,e)}const a6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function i6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function l6(e,t){const n=i6(e),a=new Map;for(const o of t)o.name&&a.set(o.name.toLowerCase(),o.agentId);if(a.size===0)return[];const l=new Set;for(const o of n.matchAll(a6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&l.add(f)}return[...l]}const s6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,jw="/";function IC(e){return!e||typeof e!="string"||e.length>256||!s6.test(e)?"/":e}const o6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},UC=Ve(["feishu","slack","kael"]),PC=Ve(["active","inactive"]);de({platform:UC,agentId:R().min(1),credentials:Ht(R(),St()),status:PC.default("active")});de({agentId:R().min(1).optional(),credentials:Ht(R(),St()).optional(),status:PC.optional()});de({id:Ke(),platform:R(),agentId:R(),hasCredentials:Wr(),status:R(),createdAt:R(),updatedAt:R()});const u6=Ve(["code","reverse_token","oauth","manual"]);de({appId:R().min(1),appSecret:R().min(1)});de({platform:UC,externalUserId:R().min(1),agentId:R().min(1),boundVia:u6.default("manual"),displayName:R().max(200).optional()});de({id:Ke(),platform:R(),externalUserId:R(),agentId:R(),boundVia:R().nullable(),displayName:R().nullable(),createdAt:R()});de({feishuUserId:R().min(1),displayName:R().max(200).optional()});de({configId:Ke(),platform:R(),agentId:R(),appId:R(),connected:Wr(),lastActiveAt:R().nullable()});const BC=Ve(["online","offline"]),$C=Ve(["idle","working","blocked","error"]);Ve(["active","suspended","evicted"]);const c6=Ve(["active","suspended"]);de({chatId:R().min(1),state:c6});de({runtimeState:$C});de({agentId:R().min(1),runtimeType:R().max(50),runtimeVersion:R().max(50).optional()});Ve(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);de({agentId:R(),status:BC,connectedAt:R().nullable(),lastSeenAt:R(),clientId:R().nullable().optional(),runtimeType:R().nullable().optional(),runtimeVersion:R().nullable().optional(),runtimeState:$C.nullable().optional(),activeSessions:Ke().int().nullable().optional(),totalSessions:Ke().int().nullable().optional(),runtimeUpdatedAt:R().nullable().optional()});de({total:Ke().int(),running:Ke().int(),byState:de({idle:Ke().int(),working:Ke().int(),blocked:Ke().int(),error:Ke().int()}),clients:Ke().int()});const rf={CLAUDE_CODE:"claude-code",CODEX:"codex"},Af=Ve(["claude-code","codex"]),d6={HUMAN:"human",PERSONAL_ASSISTANT:"personal_assistant",AUTONOMOUS_AGENT:"autonomous_agent"},Rf=Ve(["human","personal_assistant","autonomous_agent"]),Cw={PRIVATE:"private",ORGANIZATION:"organization"},Dy=Ve(["private","organization"]),f6=Ve(["admin-api","portal"]);Ve(["active","suspended"]);const zg=/^[a-z0-9][a-z0-9_-]{0,63}$/,js=64,h6=["admin","agent","first-tree","hub","me","null","system","undefined"],m6=new Set(h6);function Og(e){return m6.has(e)}de({name:R().min(1).max(64).regex(zg,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Og(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Rf,displayName:R().min(1).max(200).optional(),delegateMention:R().max(100).optional(),organizationId:R().max(100).optional(),source:f6.optional(),visibility:Dy.optional(),metadata:Ht(R(),St()).optional(),managerId:R().optional(),clientId:R().min(1).max(100).optional(),runtimeProvider:Af.optional()});de({type:Rf.optional(),displayName:R().min(1).max(200).optional(),delegateMention:R().max(100).nullable().optional(),visibility:Dy.optional(),metadata:Ht(R(),St()).optional(),managerId:R().nullable().optional(),clientId:R().min(1).max(100).nullable().optional()});de({clientId:R().min(1).max(100),runtimeProvider:Af,force:Wr().optional()});de({uuid:R(),name:R().nullable(),organizationId:R(),type:Rf,displayName:R(),delegateMention:R().nullable(),inboxId:R(),status:R(),source:R().nullable().optional(),visibility:Dy,metadata:Ht(R(),St()),managerId:R().nullable(),clientId:R().nullable(),runtimeProvider:Af,presenceStatus:BC.optional(),createdAt:R(),updatedAt:R()});de({repo:R().nullable(),branch:R().nullable()});de({type:ln("agent:pinned"),agentId:R(),name:R().nullable(),displayName:R(),agentType:Rf,runtimeProvider:Af});const p6=32e3,My=/^[a-z0-9][a-z0-9_-]{0,63}$/i,g6=/^[A-Z][A-Z0-9_]*$/,y6=de({append:R().max(p6).default("")}),v6=de({name:R().regex(My,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("stdio"),command:R().min(1),args:Qn(R()).optional()}),b6=de({name:R().regex(My,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("http"),url:R().url(),headers:Ht(R(),R()).optional()}),x6=de({name:R().regex(My,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:ln("sse"),url:R().url(),headers:Ht(R(),R()).optional()}),w6=Oy("transport",[v6,b6,x6]),S6=de({key:R().regex(g6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:R(),sensitive:Wr().default(!1)}),k6=de({url:R().min(1),ref:R().min(1).optional(),localPath:R().min(1).optional()}),zf=de({prompt:y6.default({append:""}),model:R().default("opus"),mcpServers:Qn(w6).default([]),env:Qn(S6).default([]),gitRepos:Qn(k6).default([])}),j6=zf.extend({kind:ln("claude-code")}),C6=zf.extend({kind:ln("codex")}),E6=Oy("kind",[j6,C6]),N6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:wp.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,c)=>{a.has(o.key)&&t.addIssue({code:wp.custom,path:["env",c,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const l=new Set;e.gitRepos.forEach((o,c)=>{const f=o.localPath??lf(o.url);f&&(l.has(f)&&t.addIssue({code:wp.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),l.add(f))})},FC=r6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,E6).superRefine((e,t)=>{N6(e,t)}),_6=de({agentId:R(),version:Ke().int().positive(),payload:FC,updatedAt:R(),updatedBy:R()});de({expectedVersion:Ke().int().positive(),payload:zf.partial()});de({payload:zf.partial()});de({current:_6,next:FC,diff:Qn(de({path:R(),op:Ve(["add","remove","replace"]),before:St().optional(),after:St().optional()}))});const af="***";function lf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}de({username:R().min(1),password:R().min(1)});de({accessToken:R(),refreshToken:R()});de({refreshToken:R().min(1)});de({token:R().min(1)});de({token:R(),expiresIn:Ke(),command:R()});const T6=Ve(["direct","group","thread"]);de({type:T6,topic:R().max(500).optional(),participantIds:Qn(R()).min(1),metadata:Ht(R(),St()).optional()});const qC=de({agentId:R(),role:R(),mode:R(),joinedAt:R()});qC.extend({name:R().nullable(),displayName:R(),type:R()});const A6=de({id:R(),organizationId:R(),type:R(),topic:R().nullable(),lifecyclePolicy:R().nullable().optional(),metadata:Ht(R(),St()),createdAt:R(),updatedAt:R()});A6.extend({participants:Qn(qC)});de({topic:R().trim().max(500).nullable()});de({agentId:R().min(1),mode:Ve(["full","mention_only"]).default("full")});de({agentId:R().min(1)});const R6=Ve(["connected","disconnected"]);de({id:R(),userId:R().nullable(),status:R6,sdkVersion:R().max(50).nullable(),hostname:R().max(100).nullable(),os:R().max(50).nullable(),agentCount:Ke().int().min(0),connectedAt:R().nullable(),lastSeenAt:R(),metadata:Ht(R(),St()).nullable()});const z6=de({wsInboxDeliver:Wr().default(!1)}).partial();de({clientId:R().min(1).max(100),hostname:R().max(100).optional(),os:R().max(50).optional(),sdkVersion:R().max(50).optional(),wireCapabilities:z6.optional()});de({clientId:R(),previousUserId:R().nullable(),unpinnedAgentCount:Ke().int().nonnegative()});const O6=Ve(["ok","missing","unauthenticated","error"]),D6=Ve(["api_key","oauth","auth_json","none"]),M6=de({state:O6,available:Wr(),authenticated:Wr(),sdkVersion:R().nullable().optional(),authMethod:D6,error:R().nullable().optional(),detectedAt:R()}),L6=Ht(R(),M6);de({capabilities:L6});de({limit:Tf().int().min(1).max(100).default(20),cursor:R().optional()});const I6=["image/png","image/jpeg","image/gif","image/webp"],Ly=Ve(I6);de({data:R().min(1),mimeType:Ly,filename:R().min(1),size:Ke().int().nonnegative().optional(),imageId:R().uuid().optional()});de({imageId:R().uuid(),mimeType:Ly,filename:R().min(1),size:Ke().int().nonnegative().optional()});de({type:ln("image_payload"),imageId:R().uuid(),chatId:R(),base64:R().min(1),mimeType:Ly,filename:R().min(1),size:Ke().int().nonnegative().optional()});const Iy=Ve(["hub_ui","cli","feishu","github","api"]),HC=Ve(["text","markdown","card","reference","file","task"]);de({format:HC.default("text"),content:St(),metadata:Ht(R(),St()).optional(),inReplyTo:R().optional(),replyToInbox:R().optional(),replyToChat:R().optional(),source:Iy.optional()});de({format:HC.default("text"),content:St(),metadata:Ht(R(),St()).optional(),replyToInbox:R().optional(),replyToChat:R().optional(),source:Iy.optional()});const U6=de({id:R(),chatId:R(),senderId:R(),format:R(),content:St(),metadata:Ht(R(),St()),replyToInbox:R().nullable(),replyToChat:R().nullable(),inReplyTo:R().nullable(),source:Iy.nullable(),createdAt:R()}),P6=de({senderId:R(),chatId:R(),replyToChat:R().nullable()}).nullable(),B6=Ve(["full","mention_only"]),$6=de({id:R(),senderId:R(),format:R(),content:St(),metadata:Ht(R(),St()).default({}),createdAt:R()}),ZC=U6.extend({configVersion:Ke().int().positive(),recipientMode:B6.default("full"),inReplyToSnapshot:P6.default(null),precedingMessages:Qn($6).default([])});Ve(["pending","delivered","acked","failed"]);const F6=de({id:Ke(),inboxId:R(),messageId:R(),chatId:R().nullable(),status:R(),retryCount:Ke(),createdAt:R(),deliveredAt:R().nullable(),ackedAt:R().nullable()});F6.extend({message:ZC});de({limit:Tf().int().min(1).max(50).default(10)});de({type:ln("inbox:deliver"),entryId:Ke().int().nonnegative(),inboxId:R().min(1),chatId:R().nullable(),message:ZC}).passthrough();de({type:ln("inbox:ack"),entryId:Ke().int().nonnegative()});const q6=7;de({organizationId:R(),organizationName:R(),organizationDisplayName:R(),role:R(),expiresAt:R().nullable()});de({id:R(),organizationId:R(),token:R(),inviteUrl:R(),role:R(),createdAt:R(),expiresAt:R().nullable()});de({token:R().min(1)});de({}).optional();Ve(["connect","create_agent","completed"]);de({id:R(),name:R(),displayName:R(),role:Ve(["admin","member"])});de({name:R().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:R().min(1).max(200)});de({organizationId:R().min(1)});de({id:R(),organizationId:R(),organizationName:R(),role:Ve(["admin","member"]),agentId:R()});const H6={ADMIN:"admin",MEMBER:"member"},Uy=Ve(["admin","member"]),Z6=de({id:R(),userId:R(),organizationId:R(),agentId:R(),role:Uy,createdAt:R()});de({username:R().min(1).max(100),displayName:R().min(1).max(200),role:Uy.default("member")});de({role:Uy.optional(),displayName:R().min(1).max(200).optional()});Z6.extend({username:R(),displayName:R(),password:R()});const V6=Ve(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),VC=Ve(["high","medium","low"]);de({id:R(),organizationId:R(),type:V6,severity:VC,agentId:R().nullable(),chatId:R().nullable(),message:R(),read:Wr(),createdAt:R()});de({limit:Tf().int().min(1).max(100).default(20),cursor:R().optional(),severity:VC.optional(),read:Ve(["true","false"]).transform(e=>e==="true").optional(),agentId:R().optional()});de({next:R().max(256).optional()});de({code:R().min(1),state:R().min(1)});de({githubId:R().min(1),login:R().min(1),email:R().email().optional(),displayName:R().optional(),next:R().max(256).optional()});const QC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;de({name:R().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=>!QC.test(e),"Name must not be a UUID format"),displayName:R().min(1).max(200),maxAgents:Ke().int().min(0).default(0),maxMessagesPerMinute:Ke().int().min(0).default(0),features:Ht(R(),St()).default({})});de({name:R().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=>!QC.test(e),"Name must not be a UUID format").optional(),displayName:R().min(1).max(200).optional(),maxAgents:Ke().int().min(0).optional(),maxMessagesPerMinute:Ke().int().min(0).optional(),features:Ht(R(),St()).optional()});de({id:R(),name:R(),displayName:R(),maxAgents:Ke(),maxMessagesPerMinute:Ke(),features:Ht(R(),St()),createdAt:R(),updatedAt:R()});const Q6=de({workingCount:Ke().int().nonnegative(),errorMask:Wr()}),G6=de({type:ln("pulse:tick"),organizationId:R(),agents:Ht(R(),Qn(Q6).length(32))}),K6=Ve(["tool_call","error","assistant_text","thinking","turn_end"]),GC=de({toolUseId:R(),name:R(),args:St(),status:Ve(["pending","ok","error"]),durationMs:Ke().int().nonnegative().optional(),resultPreview:R().max(400).optional()}),KC=de({source:Ve(["sdk","runtime","tool"]),message:R().max(2e3)}),YC=de({text:R().max(8e3)}),XC=de({}),JC=de({status:Ve(["success","error"])}),Y6=Oy("kind",[de({kind:ln("tool_call"),payload:GC}),de({kind:ln("error"),payload:KC}),de({kind:ln("assistant_text"),payload:YC}),de({kind:ln("thinking"),payload:XC}),de({kind:ln("turn_end"),payload:JC})]);de({id:R(),agentId:R(),chatId:R(),seq:Ke().int().positive(),kind:K6,payload:OC([GC,KC,YC,XC,JC]),createdAt:R()});de({agentId:R(),chatId:R(),event:Y6});de({agentId:R(),chatId:R()});de({type:ln("session:reconcile"),agentId:R().min(1),chatIds:Qn(R().min(1)).max(500)});de({type:ln("session:reconcile:result"),agentId:R().min(1),staleChatIds:Qn(R().min(1))});const X6=de({organizationId:R(),agentCount:Ke(),chatCount:Ke(),messageCount:Ke()});de({totalAgents:Ke(),totalChats:Ke(),totalMessages:Ke(),byOrganization:Qn(X6)});de({key:R(),value:St(),updatedAt:R()});Ht(R(),St());const ji={INBOX_TIMEOUT_SECONDS:"inbox_timeout_seconds",MAX_RETRY_COUNT:"max_retry_count",POLLING_INTERVAL_SECONDS:"polling_interval_seconds",PRESENCE_CLEANUP_SECONDS:"presence_cleanup_seconds"},Zd={[ji.INBOX_TIMEOUT_SECONDS]:300,[ji.MAX_RETRY_COUNT]:3,[ji.POLLING_INTERVAL_SECONDS]:5,[ji.PRESENCE_CLEANUP_SECONDS]:60},Ru=Ve(["pending","assigned","working","completed","failed","cancelled"]),Ew=Ve(["agent","admin"]),J6=Ve(["assigned","status_changed","cancelled"]);de({taskId:R(),event:J6,title:R(),body:R().default(""),status:Ru,fromStatus:Ru.optional(),originRef:R().nullable().optional()});const W6=de({title:R().min(1).max(500),body:R().optional(),assigneeAgentId:R().optional(),originRef:R().max(500).optional(),metadata:Ht(R(),St()).optional()});W6.extend({organizationId:R().optional()});de({status:Ve(["working","completed","failed"]),result:R().optional()});de({assigneeAgentId:R().nullable().optional(),status:Ru.optional(),result:R().optional()});de({chatId:R().min(1)});const eU=de({id:R(),organizationId:R(),title:R(),body:R(),status:Ru,assigneeAgentId:R().nullable(),createdByType:Ew,createdById:R(),originRef:R().nullable(),result:R().nullable(),metadata:Ht(R(),St()),createdAt:R(),updatedAt:R(),cancelledAt:R().nullable(),cancelledByType:Ew.nullable(),cancelledById:R().nullable()}),tU=de({taskId:R(),chatId:R(),linkedByAgentId:R().nullable(),linkedAt:R()});eU.extend({chats:Qn(tU)});de({status:Ru.optional(),assigneeAgentId:R().optional(),originRef:R().optional(),limit:Tf().int().min(1).max(100).default(20),cursor:R().optional()});const nU=Ve(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);de({taskId:R(),signal:nU,reason:R()});const rU=Ve(["active","suspended"]);de({id:R(),username:R(),displayName:R(),avatarUrl:R().nullable(),status:rU,createdAt:R(),updatedAt:R()});de({username:R().min(1).max(100),displayName:R().min(1).max(200),password:R().min(8).max(200)});de({displayName:R().min(1).max(200).optional(),password:R().min(8).max(200).optional()});de({type:ln("auth"),token:R().min(1)});const aU=de({wsInboxDeliver:Wr().default(!1)}).partial();de({type:ln("server:welcome"),serverCommandVersion:R().min(1),serverTimeMs:Ke().int().nonnegative(),capabilities:aU.optional()}).passthrough();const WC=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function iU(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 l=n[a],o=t[a];!l||!o||(o.workingCount+=l.workingCount,o.errorMask=o.errorMask||l.errorMask)}return t}const lU=2e3,sU=3e4;let hi=null,sf=!1,Sp=0,vu=null;const Dg=new Set;let gu=null,Cs=0;function oU(e){for(const t of Dg)try{t(e)}catch{}gu&&(e.type==="notification"?gu.invalidateQueries({queryKey:["notifications"]}):e.type==="session:state"&&(gu.invalidateQueries({queryKey:["activity"]}),gu.invalidateQueries({queryKey:["sessions"]})))}function eE(){const e=dy();if(!(e!=null&&e.accessToken))return;const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws/admin?token=${e.accessToken}`,a=new WebSocket(n);hi=a,a.onmessage=l=>{if(a===hi)try{const o=JSON.parse(l.data);oU(o)}catch{}},a.onopen=()=>{a===hi&&(Sp=0)},a.onclose=()=>{if(a!==hi||(hi=null,sf||Cs===0))return;Sp++;const l=Math.min(lU*2**(Sp-1),sU);vu=setTimeout(()=>{vu=null,!sf&&Cs>0&&eE()},l)}}function uU(){sf=!0,vu&&(clearTimeout(vu),vu=null),hi&&(hi.close(1e3,"unmount"),hi=null)}function tE(e){const{onMessage:t,enabled:n=!0}=e??{},a=dn(),l=x.useRef(t);l.current=t,x.useEffect(()=>{gu=a},[a]),x.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=l.current)==null?void 0:f.call(l,c)};return Dg.add(o),Cs++,Cs===1&&(sf=!1,eE()),()=>{Dg.delete(o),Cs--,Cs===0&&uU()}},[n])}const nE=x.createContext({aggregated:WC,agents:{},receivedAtMs:null,stale:!0});function cU({children:e}){const[t,n]=x.useState({aggregated:WC,agents:{},receivedAtMs:null}),[a,l]=x.useState(()=>Date.now());tE({onMessage:c=>{const f=G6.safeParse(c);f.success&&n({aggregated:iU(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),x.useEffect(()=>{const c=setInterval(()=>l(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=x.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return u.jsx(nE.Provider,{value:o,children:e})}function dU(){return x.useContext(nE)}function Of({title:e,subtitle:t,right:n,className:a,style:l,...o}){return u.jsxs("div",{className:Ae("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-3) var(--sp-5) var(--sp-2_5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)",...l},...o,children:[u.jsx("h1",{className:"m-0 text-title",style:{color:"var(--fg)"},children:e}),t&&u.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),u.jsx("div",{style:{flex:1}}),n]})}function rE({className:e,style:t,...n}){return u.jsx("div",{className:Ae("flex items-end",e),style:{gap:2,height:34,padding:"0 var(--sp-5)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",...t},...n})}function aE({active:e,onClick:t,children:n}){return u.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 bg-transparent text-body font-medium",style:{padding:"var(--sp-1_75) var(--sp-3)",marginBottom:-1,borderBottom:`var(--hairline-bold) solid ${e?"var(--accent)":"transparent"}`,color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",transition:"color 0.12s"},onMouseEnter:a=>{e||(a.currentTarget.style.color="var(--fg)")},onMouseLeave:a=>{e||(a.currentTarget.style.color="var(--fg-3)")},children:n})}const fU={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 kn({tone:e="neutral",className:t,style:n,...a}){const l=fU[e],o={background:l.bg,color:l.fg,border:`var(--hairline) solid ${l.bd}`,...n};return u.jsx("span",{className:Ae("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...a})}const vl=x.forwardRef(({className:e,...t},n)=>u.jsx("table",{ref:n,className:Ae("w-full",e),style:{borderCollapse:"separate",borderSpacing:0},...t}));vl.displayName="DenseTable";const bl=x.forwardRef(({className:e,...t},n)=>u.jsx("thead",{ref:n,className:e,...t}));bl.displayName="DenseTableHeader";const xl=x.forwardRef(({className:e,...t},n)=>u.jsx("tbody",{ref:n,className:e,...t}));xl.displayName="DenseTableBody";const or=x.forwardRef(({className:e,interactive:t,selected:n,style:a,...l},o)=>u.jsx("tr",{ref:o,className:Ae("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},...l}));or.displayName="DenseTableRow";const qe=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("th",{ref:a,className:Ae("mono text-left uppercase text-eyebrow whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3)",color:"var(--fg-4)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border)",...t},...n}));qe.displayName="DenseTableHead";const Be=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("td",{ref:a,className:Ae("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Be.displayName="DenseTableCell";const sn=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Ae("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));sn.displayName="Panel";const Ar=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Ae("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}));Ar.displayName="PanelHeader";const Rr=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Ae("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));Rr.displayName="PanelTitle";const ea=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Ae(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));ea.displayName="PanelBody";function Qs({children:e,right:t,className:n,style:a,...l}){return u.jsxs("div",{className:Ae("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},...l,children:[u.jsx("span",{children:e}),t]})}function Xu({className:e,style:t,...n}){return u.jsx("span",{className:Ae("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Py(){return je.get("/members")}function hU(e){return je.post("/members",e)}function mU(e,t){return je.patch(`/members/${encodeURIComponent(e)}`,t)}function pU(e){return je.delete(`/members/${encodeURIComponent(e)}`)}function By(){const{data:e}=He({queryKey:["members","name-map"],queryFn:Py,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 gU(){const e=fn(),t=By(),{data:n,isLoading:a,error:l}=He({queryKey:["admin-all-agents"],queryFn:()=>ZD({limit:100})});return u.jsxs("div",{children:[u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-2_5)"},children:"Every agent in the organization — including private agents owned by other members. Use this view to troubleshoot or reassign."}),u.jsxs(sn,{children:[u.jsxs(Qs,{children:["All agents · ",(n==null?void 0:n.items.length)??0]}),a?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):l?u.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load agents: ",l instanceof Error?l.message:"Unknown error"]}):!n||n.items.length===0?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No agents"}):u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{children:"Display name"}),u.jsx(qe,{children:"Agent name"}),u.jsx(qe,{children:"Type"}),u.jsx(qe,{children:"Visibility"}),u.jsx(qe,{children:"Owner"}),u.jsx(qe,{children:"Status"}),u.jsx(qe,{children:"Created"})]})}),u.jsx(xl,{children:n.items.map(o=>u.jsxs(or,{interactive:!0,onClick:()=>e(`/agents/${encodeURIComponent(o.uuid)}`),children:[u.jsx(Be,{children:u.jsx("span",{className:"font-medium",children:o.displayName})}),u.jsx(Be,{children:o.name?u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",o.name]}):u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:o.uuid.slice(0,8)})}),u.jsx(Be,{children:u.jsx(kn,{tone:o.type==="autonomous_agent"?"accent":"neutral",children:o.type})}),u.jsx(Be,{children:u.jsx(kn,{tone:o.visibility==="organization"?"accent":"outline",children:o.visibility})}),u.jsx(Be,{className:"text-label",style:{color:"var(--fg-2)"},children:o.managerId?t(o.managerId):"—"}),u.jsx(Be,{children:u.jsx(kn,{tone:o.status==="active"?"accent":"neutral",children:o.status})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ni(o.createdAt)})]},o.uuid))})]})]})]})}const ro=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));ro.displayName="Card";const ao=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("flex flex-col space-y-1.5 p-6",e),...t}));ao.displayName="CardHeader";const Ju=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("text-subtitle leading-none",e),...t}));Ju.displayName="CardTitle";const iE=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("text-body text-muted-foreground",e),...t}));iE.displayName="CardDescription";const io=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("p-6 pt-0",e),...t}));io.displayName="CardContent";const yU=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Ae("flex items-center p-6 pt-0",e),...t}));yU.displayName="CardFooter";function vU(e){const t=new Date(e),n=Date.now(),a=t.getTime()-n;if(a<=0)return`expired ${t.toLocaleDateString()}`;const l=Math.ceil(a/(1440*60*1e3));return`expires ${l===1?"in less than a day":`in ${l} days`} · ${t.toLocaleDateString()}`}function bU(){const{organizationId:e}=qt(),[t,n]=x.useState(null),[a,l]=x.useState(null),[o,c]=x.useState(!1),[f,m]=x.useState(!1);x.useEffect(()=>{e&&(async()=>{try{const y=await je.get(`/admin/organizations/${e}/invitations`);n(y)}catch(y){l(y instanceof Error?y.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),l(null);try{const y=await je.post(`/admin/organizations/${e}/invitations/rotate`);n(y)}catch(y){l(y instanceof Error?y.message:"Failed to rotate invite link")}finally{c(!1)}}};return u.jsxs(ro,{children:[u.jsxs(ao,{children:[u.jsx(Ju,{children:"Invite link"}),u.jsxs(iE,{children:["Anyone with this link can join your team as a member. Links expire after ",q6," days; rotating revokes the old link instantly and resets the timer."]})]}),u.jsxs(io,{className:"space-y-3",children:[a&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),u.jsx(me,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),u.jsx(me,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),u.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${vU(t.expiresAt)}`:" · no expiry"]})]}):u.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}var xU="Label",lE=x.forwardRef((e,t)=>u.jsx(Oa.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));lE.displayName=xU;var wU=lE;const st=x.forwardRef(({className:e,...t},n)=>u.jsx(wU,{ref:n,className:Ae("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));st.displayName="Label";const sE=Object.values(H6);function SU(e,t){const n=(e==null?void 0:e.trim())||t,a=n.split(/[\s._-]+/).filter(Boolean);if(a.length>=2){const l=a[0]??"",o=a[1]??"";return`${l[0]??""}${o[0]??""}`.toUpperCase()}return n.slice(0,2).toUpperCase()}function kU(){const e=dn(),{memberId:t}=qt(),[n,a]=x.useState(!1),[l,o]=x.useState({username:"",displayName:"",role:"member"}),[c,f]=x.useState(null),[m,h]=x.useState(null),{data:y,isLoading:g,error:b}=He({queryKey:["members"],queryFn:Py}),w=wt({mutationFn:()=>hU({username:l.username,displayName:l.displayName,role:l.role}),onSuccess:N=>{e.invalidateQueries({queryKey:["members"]}),f(N.password)}}),k=wt({mutationFn:pU,onSuccess:()=>e.invalidateQueries({queryKey:["members"]})});function j(){a(!1),o({username:"",displayName:"",role:"member"}),f(null)}function E(N){N.preventDefault(),w.mutate()}function C(N){window.confirm("Delete this member? Their human agent will also be deactivated.")&&k.mutate(N)}return u.jsxs(u.Fragment,{children:[u.jsxs(sn,{children:[u.jsxs(Qs,{right:u.jsxs($t,{open:n,onOpenChange:N=>N?a(!0):j(),children:[u.jsx(FD,{asChild:!0,children:u.jsxs(me,{size:"xs",className:"normal-case tracking-normal",children:[u.jsx(Jr,{className:"h-3 w-3"}),"Add member"]})}),u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:c?"Member Created":"Create Member"})}),c?u.jsxs("div",{className:"space-y-4",children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Member created. Share the password below — it will only be shown once."}),u.jsxs("div",{className:"flex items-center gap-2 rounded-md p-3",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)"},children:[u.jsx("code",{className:"flex-1 text-body mono",children:c}),u.jsx(me,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText(c),title:"Copy password",children:u.jsx(vf,{className:"h-4 w-4"})})]}),u.jsx(tn,{children:u.jsx(me,{onClick:j,children:"Done"})})]}):u.jsxs("form",{onSubmit:E,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"member-username",children:"Username"}),u.jsx(jt,{id:"member-username",type:"text",value:l.username,onChange:N=>o({...l,username:N.target.value}),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"member-name",children:"Display Name"}),u.jsx(jt,{id:"member-name",value:l.displayName,onChange:N=>o({...l,displayName:N.target.value}),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"member-role",children:"Role"}),u.jsx("select",{id:"member-role",value:l.role,onChange:N=>o({...l,role: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 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:sE.map(N=>u.jsx("option",{value:N,children:N},N))})]}),w.error instanceof Error&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:w.error.message}),u.jsx(tn,{children:u.jsx(me,{type:"submit",disabled:w.isPending,children:w.isPending?"Creating...":"Create"})})]})]})]}),children:["Members · ",(y==null?void 0:y.length)??0]}),g?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):b?u.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load members: ",b instanceof Error?b.message:"Unknown error"]}):(y==null?void 0:y.length)===0?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No members"}):u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{style:{width:30}}),u.jsx(qe,{children:"Username"}),u.jsx(qe,{children:"Name"}),u.jsx(qe,{children:"Role"}),u.jsx(qe,{children:"Created"}),u.jsx(qe,{style:{width:1}})]})}),u.jsx(xl,{children:y==null?void 0:y.map(N=>{const z=t===N.id;return u.jsxs(or,{children:[u.jsx(Be,{children:u.jsx("span",{className:"mono inline-flex items-center justify-center text-caption font-semibold",style:{width:22,height:22,borderRadius:"var(--radius-input)",background:z?"var(--accent-bg)":"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)",color:z?"var(--accent-dim)":"var(--fg-2)"},children:SU(N.displayName,N.username)})}),u.jsxs(Be,{children:[u.jsx("span",{className:"mono font-medium",children:N.username}),z&&u.jsx(Xu,{style:{marginLeft:6},children:"you"})]}),u.jsx(Be,{style:{color:"var(--fg-2)"},children:N.displayName}),u.jsx(Be,{children:u.jsx(kn,{tone:N.role==="admin"?"accent":"neutral",children:N.role})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ni(N.createdAt)}),u.jsx(Be,{style:{whiteSpace:"nowrap"},children:u.jsxs("div",{className:"flex gap-0.5 justify-end",children:[u.jsx(me,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>h({id:N.id,username:N.username,displayName:N.displayName,role:N.role}),title:"Edit",children:u.jsx(Qu,{className:"h-3.5 w-3.5"})}),u.jsx(me,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>C(N.id),disabled:k.isPending,title:"Delete",style:{color:"var(--fg-4)"},children:u.jsx(Hs,{className:"h-3.5 w-3.5"})})]})})]},N.id)})})]})]}),u.jsx(jU,{target:m,onClose:()=>h(null),onSaved:()=>{h(null),e.invalidateQueries({queryKey:["members"]})}})]})}function jU({target:e,onClose:t,onSaved:n}){const[a,l]=x.useState(""),[o,c]=x.useState("member"),[f,m]=x.useState(null);x.useEffect(()=>{e&&(l(e.displayName),c(e.role),m(null))},[e]);const h=wt({mutationFn:async()=>{if(!e)throw new Error("No target");const b={};return a.trim()&&a!==e.displayName&&(b.displayName=a.trim()),o!==e.role&&(b.role=o),Object.keys(b).length===0?e:mU(e.id,b)},onSuccess:()=>{m(null),n()},onError:b=>{m(b instanceof Error?b.message:String(b))}});function y(b){b.preventDefault(),h.mutate()}const g=e!==null;return u.jsx($t,{open:g,onOpenChange:b=>b?void 0:t(),children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Edit Member"})}),e&&u.jsxs("form",{onSubmit:y,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{children:"Username"}),u.jsx(jt,{value:e.username,disabled:!0,className:"font-mono"}),u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"edit-member-display",children:"Display Name"}),u.jsx(jt,{id:"edit-member-display",value:a,onChange:b=>l(b.target.value),required:!0,maxLength:200})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"edit-member-role",children:"Role"}),u.jsx("select",{id:"edit-member-role",value:o,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:sE.map(b=>u.jsx("option",{value:b,children:b},b))}),u.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&&u.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:t,disabled:h.isPending,children:"Cancel"}),u.jsx(me,{type:"submit",disabled:h.isPending,children:h.isPending?"Saving…":"Save"})]})]})]})})}function CU(){return je.get("/admin/system/config")}function EU(e){return je.patch("/admin/system/config",e)}function NU(e){return je.get(`/admin/organizations/${encodeURIComponent(e)}`)}function _U(e,t){return je.patch(`/admin/organizations/${encodeURIComponent(e)}`,t)}function TU(){return je.post("/me/organizations/leave")}function AU(){const{organizationId:e}=qt(),t=dn(),n=He({queryKey:["organization",e],queryFn:()=>e?NU(e):Promise.reject(new Error("no org")),enabled:!!e}),[a,l]=x.useState(""),[o,c]=x.useState(""),[f,m]=x.useState(!1);x.useEffect(()=>{n.data&&(l(n.data.displayName),c(n.data.name))},[n.data]);const h=wt({mutationFn:()=>{if(!e||!n.data)throw new Error("organization not loaded");const g={},b=a.trim(),w=o.trim();return b&&b!==n.data.displayName&&(g.displayName=b),w&&w!==n.data.name&&(g.name=w),Object.keys(g).length===0?Promise.resolve(n.data):_U(e,g)},onSuccess:g=>{t.setQueryData(["organization",e],g),t.invalidateQueries({queryKey:["me-organizations"]}),m(!0),setTimeout(()=>m(!1),2e3)}}),y=g=>{g.preventDefault(),h.mutate()};return u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsx(Rr,{children:"Team identity"}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),u.jsxs(me,{type:"submit",form:"team-identity-form",size:"xs",disabled:h.isPending||!n.data,children:[u.jsx(cr,{className:"h-3 w-3"}),h.isPending?"Saving…":"Save"]})]})]}),u.jsx(ea,{children:n.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n.error?u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:n.error instanceof Error?n.error.message:"Failed to load team"}):u.jsxs("form",{id:"team-identity-form",onSubmit:y,children:[u.jsx(Nw,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:a,onChange:l}),u.jsx(Nw,{label:"URL slug",hint:"Lowercase letters, digits, hyphens. Used in invite URLs.",value:o,onChange:g=>c(g.toLowerCase()),mono:!0,pattern:"[a-z0-9][a-z0-9-]*"}),h.error instanceof Error&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:h.error.message})]})})]})}function Nw({label:e,hint:t,value:n,onChange:a,mono:l,pattern:o}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"1fr var(--sp-45)",padding:"var(--sp-3_5) 0",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:t})]}),u.jsx("input",{value:n,onChange:c=>a(c.target.value),pattern:o,className:`w-full outline-none text-body ${l?"mono":""}`,style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]})}const oE=[{key:ji.INBOX_TIMEOUT_SECONDS,label:"Inbox timeout",description:"How long an agent waits for inbound messages before sleeping.",unit:"seconds"},{key:ji.MAX_RETRY_COUNT,label:"Max retry count",description:"Delivery attempts before a message is marked failed.",unit:null},{key:ji.POLLING_INTERVAL_SECONDS,label:"Polling interval",description:"Runtime heartbeat cadence for offline detection.",unit:"seconds"},{key:ji.PRESENCE_CLEANUP_SECONDS,label:"Presence cleanup",description:"When presence rows expire after disconnect.",unit:"seconds"}],_w=oE.map(e=>e.key);function RU(){const e=dn(),{data:t,isLoading:n}=He({queryKey:["system-config"],queryFn:CU}),[a,l]=x.useState({}),[o,c]=x.useState(!1);x.useEffect(()=>{if(!t)return;const y={};for(const g of _w){const b=t[g]??Zd[g]??"";y[g]=String(b)}l(y)},[t]);const f=wt({mutationFn:()=>{const y={};for(const[g,b]of Object.entries(a)){const w=b.trim();if(w==="")y[g]=Zd[g]??0;else{const k=Number(w);y[g]=Number.isNaN(k)?w:k}}return EU(y)},onSuccess:()=>{e.invalidateQueries({queryKey:["system-config"]}),c(!0),setTimeout(()=>c(!1),2e3)}});function m(){const y={};for(const g of _w)y[g]=String(Zd[g]??"");l(y)}function h(y){y.preventDefault(),f.mutate()}return u.jsxs("div",{className:"space-y-4",children:[u.jsx(AU,{}),u.jsx("form",{onSubmit:h,children:u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsx(Rr,{children:"System configuration"}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),u.jsx(me,{type:"button",variant:"ghost",size:"xs",onClick:m,disabled:f.isPending,children:"Reset defaults"}),u.jsxs(me,{type:"submit",size:"xs",disabled:f.isPending,children:[u.jsx(cr,{className:"h-3 w-3"}),f.isPending?"Saving…":"Save changes"]})]})]}),u.jsxs("div",{style:{padding:"var(--sp-1) var(--sp-4) var(--sp-3_5)"},children:[n?u.jsx("div",{className:"py-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):oE.map(y=>u.jsx(zU,{field:y,value:a[y.key]??"",onChange:g=>l({...a,[y.key]:g})},y.key)),f.error instanceof Error&&u.jsx("div",{className:"text-body pt-2",style:{color:"var(--state-error)"},children:f.error.message})]})]})})]})}function zU({field:e,value:t,onChange:n}){const a=String(Zd[e.key]??"—");return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"1fr var(--sp-45)",padding:"var(--sp-3_5) 0",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-baseline gap-2",children:[u.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.label}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.key})]}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:e.description}),u.jsxs(Xu,{style:{marginTop:4,display:"block"},children:["default"," ",u.jsx("span",{className:"mono normal-case tracking-normal",style:{color:"var(--fg-3)"},children:a})]})]}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("input",{value:t,onChange:l=>n(l.target.value),className:"w-full outline-none mono text-body",style:{padding:`var(--sp-1_25) ${e.unit?56:10}px var(--sp-1_25) var(--sp-2_5)`,background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}}),e.unit&&u.jsx("span",{className:"mono text-caption",style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",pointerEvents:"none"},children:e.unit})]})]})}const Tw=[{key:"members",label:"Members"},{key:"invite",label:"Invite link"},{key:"all-agents",label:"All agents"},{key:"settings",label:"Org settings"}];function OU(){const{role:e}=qt(),t=Mn(),n=fn();if(e===null)return u.jsx("div",{className:"text-body",style:{padding:20,color:"var(--fg-3)"},children:"Loading…"});if(e!=="admin")return u.jsx(pf,{to:"/settings",replace:!0});const a=t.hash.replace("#",""),l=Tw.some(c=>c.key===a)?a:"members",o=c=>{n({hash:c},{replace:!0})};return u.jsxs("div",{className:"-m-6",children:[u.jsx(Of,{title:"Admin",subtitle:"Organization-wide controls"}),u.jsx(rE,{children:Tw.map(c=>u.jsx(aE,{active:l===c.key,onClick:()=>o(c.key),children:c.label},c.key))}),u.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[l==="members"&&u.jsx(kU,{}),l==="invite"&&u.jsx(bU,{}),l==="all-agents"&&u.jsx(gU,{}),l==="settings"&&u.jsx(RU,{})]})]})}function DU(e){return je.get(`/admin/agents/${e}/config`)}function MU(e,t){return je.patch(`/admin/agents/${e}/config`,t)}function LU(e,t){return je.post(`/admin/agents/${e}/config/dry-run`,{payload:t})}function IU(e){return je.get(`/admin/agents/${e}/client-status`)}function UU({className:e,style:t,...n}){return u.jsx("div",{className:Ae("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function PU({onClick:e,children:t}){return u.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 BU(){return u.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function $U({children:e,mono:t}){return u.jsx("span",{className:Ae("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}function Xr({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?u.jsxs("span",{className:Ae("shrink-0",n),style:a,role:"img","aria-label":"working",children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),u.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"?u.jsx("span",{className:Ae("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:u.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?u.jsx("span",{className:Ae("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"?u.jsx("span",{className:Ae("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):u.jsx("span",{className:Ae("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function FU(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function Gs({state:e,className:t}){const n=e!==null&&FU(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return u.jsxs("span",{className:Ae("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[u.jsx(Xr,{state:n,size:7}),n]})}function Rd({label:e,value:t,accent:n}){return u.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[u.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),u.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function qU({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?u.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:u.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[u.jsxs("span",{children:["Runs on ",u.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&u.jsxs(u.Fragment,{children:[u.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),u.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function HU(e){const{agent:t}=e,[n,a]=x.useState(!1),[l,o]=x.useState(!1),c=t.displayName||t.name||t.uuid;return u.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:[u.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[u.jsx(gy,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),u.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),u.jsxs("div",{children:[t.status==="active"?u.jsx(kp,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:u.jsx(me,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):u.jsx(kp,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:u.jsx(me,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),u.jsx(kp,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:u.jsxs(me,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[u.jsx(Hs,{className:"h-3 w-3"}),"Delete"]})})]}),u.jsx(ZU,{open:l,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),u.jsx(VU,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function kp(e){return u.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:[u.jsxs("div",{children:[u.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),u.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),u.jsx("div",{children:e.action})]})}function ZU({open:e,onOpenChange:t,label:n,onConfirm:a,pending:l}){return u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsxs(Ft,{children:['Suspend "',n,'"?']})}),u.jsx("div",{className:"space-y-3",children:u.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."})}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:l,children:"Cancel"}),u.jsx(me,{type:"button",variant:"destructive",onClick:a,disabled:l,children:l?"Suspending…":"Suspend"})]})]})})}function VU({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:l}){const[o,c]=x.useState("");function f(m){m.preventDefault(),o===n&&a()}return u.jsx($t,{open:e,onOpenChange:m=>{t(m),m||c("")},children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsxs(Ft,{children:['Delete "',n,'"?']})}),u.jsxs("form",{onSubmit:f,className:"space-y-4",children:[u.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",u.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),u.jsx(jt,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:l,children:"Cancel"}),u.jsx(me,{type:"submit",variant:"destructive",disabled:o!==n||l,children:l?"Deleting…":"Delete"})]})]})]})})}const QU={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 $y({status:e,onEdit:t,onDelete:n,onUndo:a,children:l,disabled:o}){const c=QU[e],f=e==="deleted";return u.jsxs("div",{className:Ae("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:[u.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:l}),c.label&&u.jsx("span",{className:Ae("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?u.jsxs(me,{size:"sm",variant:"ghost",onClick:a,children:[u.jsx(Sz,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):u.jsxs("div",{className:"flex gap-1 shrink-0",children:[u.jsxs(me,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[u.jsx(Qu,{className:"h-3.5 w-3.5"}),u.jsx("span",{className:"sr-only",children:"Edit"})]}),u.jsxs(me,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[u.jsx(Hs,{className:"h-3.5 w-3.5"}),u.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function GU(e){const[t,n]=x.useState(null),[a,l]=x.useState(()=>new Set),o=f=>l(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 u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsxs(Rr,{children:["Environment variables (",c,")"]}),!e.disabled&&u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(Jr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(ea,{className:"space-y-2",children:e.items.length===0?u.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===af,y=m&&!h&&!!f.value.value,g=a.has(f.key);let b;return m?y&&g?b=f.value.value:b="••••••":b=f.value.value||u.jsx("em",{children:"(empty)"}),u.jsxs($y,{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:[u.jsx("span",{className:"font-mono font-medium",children:f.value.key}),u.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:b}),m&&u.jsx(Uk,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&u.jsx("button",{type:"button",onClick:()=>y&&o(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:y?g?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":g?"Hide value":"Reveal value",disabled:!y,style:{padding:0,opacity:y?1:.4},children:g?u.jsx(FR,{className:"h-3.5 w-3.5"}):u.jsx(HR,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&u.jsx(KU,{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 KU({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:l}){const[o,c]=x.useState((n==null?void 0:n.key)??""),[f,m]=x.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,y]=x.useState((n==null?void 0:n.sensitive)??!1),[g,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)??""),y((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function w(k){if(k.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){b(`Another entry already uses key "${o}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=af),!h&&!n&&!f){b("Value is required for non-sensitive entries.");return}l({key:o,value:j,sensitive:h})}return u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:n?"Edit environment variable":"Add environment variable"})}),u.jsxs("form",{onSubmit:w,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"env-key",children:"Key"}),u.jsx(jt,{id:"env-key",value:o,onChange:k=>c(k.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&u.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"env-value",children:"Value"}),u.jsx(jt,{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"})]}),u.jsxs("label",{className:"flex items-center gap-2 text-body",children:[u.jsx("input",{type:"checkbox",checked:h,onChange:k=>y(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&u.jsx("p",{className:"text-body text-destructive",children:g}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(me,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function YU(e){const[t,n]=x.useState(null),a=e.items.filter(l=>l.status!=="deleted").length;return u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsxs(Rr,{children:["Git repositories (",a,")"]}),!e.disabled&&u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(Jr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(ea,{className:"space-y-2",children:e.items.length===0?u.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(l=>{const o=l.value.localPath??lf(l.value.url);return u.jsxs($y,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[u.jsx("span",{className:"font-mono text-caption",children:l.value.url}),l.value.ref&&u.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",l.value.ref]}),u.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},l.key)})}),t&&u.jsx(XU,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function XU({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:l}){const[o,c]=x.useState((n==null?void 0:n.url)??""),[f,m]=x.useState((n==null?void 0:n.ref)??""),[h,y]=x.useState((n==null?void 0:n.localPath)??""),[g,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),y((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function w(k){k.preventDefault();const j=o.trim();if(!j){b("URL is required.");return}const E=h.trim()||lf(j);if(E&&a.has(E)){b(`Another repo already occupies local path "${E}".`);return}const C={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};l(C)}return u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:n?"Edit Git repository":"Add Git repository"})}),u.jsxs("form",{onSubmit:w,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"git-url",children:"URL"}),u.jsx(jt,{id:"git-url",value:o,onChange:k=>c(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),u.jsx(jt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"git-path",children:"Local path (optional)"}),u.jsx(jt,{id:"git-path",value:h,onChange:k=>y(k.target.value),placeholder:lf(o)||"repo-name",className:"font-mono"}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&u.jsx("p",{className:"text-body text-destructive",children:g}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(me,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function uE({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:l="—",className:o,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return u.jsx("span",{className:Ae("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:l});const y=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,b=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?u.jsxs("span",{className:Ae("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:y??void 0,children:[h&&u.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&u.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]}):u.jsxs("span",{className:Ae("inline-flex items-baseline gap-1.5",o),style:c,title:y??void 0,children:[h&&u.jsx("span",{style:{color:g},children:t}),m&&u.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]})}function JU({agent:e,onSave:t}){const[n,a]=x.useState(!1),l=Cy(),o=By(),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"):[],y=e.managerId?o(e.managerId):null,g=e.delegateMention?l(e.delegateMention):null;return u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsx(Rr,{children:"Profile"}),e.status==="active"&&u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[u.jsx(Qu,{className:"h-3 w-3"})," Edit"]})]}),u.jsxs(ea,{className:"text-body space-y-1",children:[u.jsxs("div",{children:[u.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&u.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),g&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),u.jsxs("span",{className:"text-muted-foreground",children:["delegate ",u.jsx(uE,{name:g.name,displayName:g.displayName})]})]})]}),u.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[u.jsxs("span",{children:["owner ",u.jsx("span",{className:"text-foreground",children:y??"—"})]}),m&&u.jsxs("span",{children:["role ",u.jsx("span",{className:"text-foreground",children:m})]}),u.jsxs("span",{children:["type ",u.jsx(kn,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),u.jsxs("span",{children:["visibility"," ",u.jsx(kn,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&u.jsxs("span",{children:["domains"," ",u.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>u.jsx(kn,{tone:"outline",children:b},b))})]})]})]}),u.jsx(WU,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function WU({agent:e,open:t,onOpenChange:n,onSave:a}){var L;const{memberId:l,role:o}=qt(),[c,f]=x.useState(e.displayName),[m,h]=x.useState(e.delegateMention??""),[y,g]=x.useState(e.visibility),[b,w]=x.useState(!1),[k,j]=x.useState(null);x.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),j(null))},[t,e]);const E=e.type==="human",C=o==="admin"||e.managerId===l,N=He({queryKey:["agents-for-delegate"],queryFn:async()=>(await Yu({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&E});async function z(D){D.preventDefault(),j(null);const O=c.trim();if(!O){j("Display name is required.");return}w(!0);try{const M={displayName:O,delegateMention:m||null};y!==e.visibility&&(M.visibility=y),await a(M),n(!1)}catch(M){j(M instanceof Error?M.message:String(M))}finally{w(!1)}}return u.jsx($t,{open:t,onOpenChange:n,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Edit Identity"})}),u.jsxs("form",{onSubmit:z,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{children:"Agent name"}),u.jsx(jt,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"id-display",children:"Display Name"}),u.jsx(jt,{id:"id-display",value:c,onChange:D=>f(D.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"id-visibility",children:"Visibility"}),u.jsxs("select",{id:"id-visibility",value:y,onChange:D=>g(D.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[u.jsx("option",{value:Cw.PRIVATE,children:"Private — only the manager"}),u.jsx("option",{value:Cw.ORGANIZATION,children:"Organization — all members"})]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:C?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),E&&u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"id-delegate",children:"Delegate Mention"}),u.jsxs("select",{id:"id-delegate",value:m,onChange:D=>h(D.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"",children:"None"}),(L=N.data)==null?void 0:L.map(D=>u.jsx("option",{value:D.uuid,children:D.displayName?`${D.displayName} (@${D.name??D.uuid})`:D.name?`@${D.name}`:D.uuid},D.uuid))]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&u.jsx("p",{className:"text-body text-destructive",children:k}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),u.jsx(me,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function eP(e){return e==="working"?"accent":e==="error"?"error":"outline"}function tP(e){const[t,n]=x.useState(null),a=e.items.filter(l=>l.status!=="deleted").length;return u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsxs(Rr,{children:["MCP servers (",a,")"]}),!e.disabled&&u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(Jr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(ea,{className:"space-y-2",children:e.items.length===0?u.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(l=>{const o=l.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(l.value.name);return u.jsxs($y,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[u.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:l.value.transport}),u.jsx("span",{className:"font-medium font-mono",children:l.value.name}),u.jsx(kn,{tone:eP(o),children:o}),u.jsx("span",{className:"text-caption text-muted-foreground truncate",children:nP(l.value)})]},l.key)})}),t&&u.jsx(rP,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function nP(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 rP({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:l}){const[o,c]=x.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=x.useState((n==null?void 0:n.name)??""),[h,y]=x.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,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,E]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),y((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:""),E(null))},[e,n]);function C(N){if(N.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){E(`Another MCP server is already named "${f}".`);return}let z;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const L=g.trim().split(/\s+/).filter(D=>D.length>0);z={name:f,transport:"stdio",command:h.trim(),...L.length?{args:L}:{}}}else{const L=w.trim();try{new URL(L)}catch{E("URL is not valid.");return}z={name:f,transport:o,url:L}}l(z)}return u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:n?"Edit MCP server":"Add MCP server"})}),u.jsxs("form",{onSubmit:C,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"mcp-transport",children:"Transport"}),u.jsxs("select",{id:"mcp-transport",value:o,onChange:N=>c(N.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),u.jsx("option",{value:"http",children:"http"}),u.jsx("option",{value:"sse",children:"sse"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"mcp-name",children:"Name"}),u.jsx(jt,{id:"mcp-name",value:f,onChange:N=>m(N.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"mcp-command",children:"Command"}),u.jsx(jt,{id:"mcp-command",value:h,onChange:N=>y(N.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),u.jsx(jt,{id:"mcp-args",value:g,onChange:N=>b(N.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"mcp-url",children:"URL"}),u.jsx(jt,{id:"mcp-url",value:w,onChange:N=>k(N.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&u.jsx("p",{className:"text-body text-destructive",children:j}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(me,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const aP=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],iP=[{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"}],lP={"claude-code":aP,codex:iP},sP={"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."},oP={value:"",label:"(unset — inherits local)"};function uP({value:e,baseline:t,onChange:n,onRevert:a,disabled:l,provider:o="claude-code"}){const c=e!==t,f=lP[o],m=x.useMemo(()=>{const h=[oP,...f];return e!==""&&!f.some(y=>y.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return u.jsxs(sn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[u.jsxs(Ar,{children:[u.jsxs(Rr,{children:["Model",c&&u.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&&u.jsx(me,{size:"xs",variant:"ghost",onClick:a,disabled:l,children:"Revert"})]}),u.jsxs(ea,{className:"space-y-2",children:[u.jsx(cP,{items:m,value:e,onChange:n,disabled:l}),u.jsx("p",{className:"text-caption text-muted-foreground",children:sP[o]})]})]})}function cP({items:e,value:t,onChange:n,disabled:a}){const[l,o]=x.useState(!1),[c,f]=x.useState(null),m=x.useRef(null),h=x.useRef(null),y=e.find(b=>b.value===t)??e[0],g=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(()=>{l&&g()},[l,g]),x.useEffect(()=>{if(!l)return;const b=j=>{var C,N;const E=j.target;(C=m.current)!=null&&C.contains(E)||(N=h.current)!=null&&N.contains(E)||o(!1)},w=j=>{var E;j.key==="Escape"&&(o(!1),(E=m.current)==null||E.focus())},k=()=>g();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)}},[l,g]),u.jsxs("div",{className:"max-w-md",children:[u.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(b=>!b),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":l,children:[u.jsx("span",{className:"truncate",style:{color:(y==null?void 0:y.value)===""?"var(--fg-3)":void 0},children:(y==null?void 0:y.label)??t}),u.jsx(Lk,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:l?"rotate(180deg)":void 0}})]}),l&&c&&xy.createPortal(u.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 u.jsxs("button",{type:"button",onClick:()=>{n(b.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:b.value===""?"var(--fg-3)":void 0},children:[u.jsx(cr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),u.jsx("span",{className:"flex-1 truncate",children:b.label}),b.hint&&u.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:b.hint})]},b.value||"__unset")})}),document.body)]})}function dP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mP={};function Aw(e,t){return(mP.jsx?hP:fP).test(e)}const pP=/[ \t\n\f\r]/g;function gP(e){return typeof e=="object"?e.type==="text"?Rw(e.value):!1:Rw(e)}function Rw(e){return e.replace(pP,"")===""}class Wu{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Wu.prototype.normal={};Wu.prototype.property={};Wu.prototype.space=void 0;function cE(e,t){const n={},a={};for(const l of e)Object.assign(n,l.property),Object.assign(a,l.normal);return new Wu(n,a,t)}function Mg(e){return e.toLowerCase()}class Yn{constructor(t,n){this.attribute=n,this.property=t}}Yn.prototype.attribute="";Yn.prototype.booleanish=!1;Yn.prototype.boolean=!1;Yn.prototype.commaOrSpaceSeparated=!1;Yn.prototype.commaSeparated=!1;Yn.prototype.defined=!1;Yn.prototype.mustUseProperty=!1;Yn.prototype.number=!1;Yn.prototype.overloadedBoolean=!1;Yn.prototype.property="";Yn.prototype.spaceSeparated=!1;Yn.prototype.space=void 0;let yP=0;const Ge=Nl(),Wt=Nl(),Lg=Nl(),ge=Nl(),Et=Nl(),_s=Nl(),ir=Nl();function Nl(){return 2**++yP}const Ig=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:Wt,commaOrSpaceSeparated:ir,commaSeparated:_s,number:ge,overloadedBoolean:Lg,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),jp=Object.keys(Ig);class Fy extends Yn{constructor(t,n,a,l){let o=-1;if(super(t,n),zw(this,"space",l),typeof a=="number")for(;++o<jp.length;){const c=jp[o];zw(this,jp[o],(a&Ig[c])===Ig[c])}}}Fy.prototype.defined=!0;function zw(e,t,n){n&&(e[t]=n)}function lo(e){const t={},n={};for(const[a,l]of Object.entries(e.properties)){const o=new Fy(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Mg(a)]=a,n[Mg(o.attribute)]=a}return new Wu(t,n,e.space)}const dE=lo({properties:{ariaActiveDescendant:null,ariaAtomic:Wt,ariaAutoComplete:null,ariaBusy:Wt,ariaChecked:Wt,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Wt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Wt,ariaFlowTo:Et,ariaGrabbed:Wt,ariaHasPopup:null,ariaHidden:Wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:ge,ariaLive:null,ariaModal:Wt,ariaMultiLine:Wt,ariaMultiSelectable:Wt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:Wt,ariaReadOnly:Wt,ariaRelevant:null,ariaRequired:Wt,ariaRoleDescription:Et,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:Wt,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function fE(e,t){return t in e?e[t]:t}function hE(e,t){return fE(e,t.toLowerCase())}const vP=lo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_s,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:Et,autoFocus:Ge,autoPlay:Ge,blocking:Et,capture:null,charSet:null,checked:Ge,cite:null,className:Et,cols:ge,colSpan:null,content:null,contentEditable:Wt,controls:Ge,controlsList:Et,coords:ge|_s,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Lg,draggable:Wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:Et,height:ge,hidden:Lg,high:ge,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ge,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,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:Ge,optimum:ge,pattern:null,ping:Et,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:Et,required:Ge,reversed:Ge,rows:ge,rowSpan:ge,sandbox:Et,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:Wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:Wt,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:Wt,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:hE}),bP=lo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ir,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:Et,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:_s,g2:_s,glyphName:_s,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,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:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ir,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fE}),mE=lo({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()}}),pE=lo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hE}),gE=lo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),xP={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"},wP=/[A-Z]/g,Ow=/-[a-z]/g,SP=/^data[-\w.:]+$/i;function kP(e,t){const n=Mg(t);let a=t,l=Yn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&SP.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Ow,CP);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Ow.test(o)){let c=o.replace(wP,jP);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Fy}return new l(a,t)}function jP(e){return"-"+e.toLowerCase()}function CP(e){return e.charAt(1).toUpperCase()}const EP=cE([dE,vP,mE,pE,gE],"html"),qy=cE([dE,bP,mE,pE,gE],"svg");function NP(e){return e.join(" ").trim()}var gs={},Cp,Dw;function _P(){if(Dw)return Cp;Dw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
358
|
+
`,h="/",y="*",g="",b="comment",w="declaration";function k(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var N=1,z=1;function L(he){var ne=he.match(t);ne&&(N+=ne.length);var Z=he.lastIndexOf(m);z=~Z?he.length-Z:z+he.length}function D(){var he={line:N,column:z};return function(ne){return ne.position=new O(he),X(),ne}}function O(he){this.start=he,this.end={line:N,column:z},this.source=C.source}O.prototype.content=E;function M(he){var ne=new Error(C.source+":"+N+":"+z+": "+he);if(ne.reason=he,ne.filename=C.source,ne.line=N,ne.column=z,ne.source=E,!C.silent)throw ne}function U(he){var ne=he.exec(E);if(ne){var Z=ne[0];return L(Z),E=E.slice(Z.length),ne}}function X(){U(n)}function F(he){var ne;for(he=he||[];ne=J();)ne!==!1&&he.push(ne);return he}function J(){var he=D();if(!(h!=E.charAt(0)||y!=E.charAt(1))){for(var ne=2;g!=E.charAt(ne)&&(y!=E.charAt(ne)||h!=E.charAt(ne+1));)++ne;if(ne+=2,g===E.charAt(ne-1))return M("End of comment missing");var Z=E.slice(2,ne-2);return z+=2,L(Z),E=E.slice(ne),z+=2,he({type:b,comment:Z})}}function ee(){var he=D(),ne=U(a);if(ne){if(J(),!U(l))return M("property missing ':'");var Z=U(o),te=he({type:w,property:j(ne[0].replace(e,g)),value:Z?j(Z[0].replace(e,g)):g});return U(c),te}}function ye(){var he=[];F(he);for(var ne;ne=ee();)ne!==!1&&(he.push(ne),F(he));return he}return X(),ye()}function j(E){return E?E.replace(f,g):g}return Cp=k,Cp}var Mw;function TP(){if(Mw)return gs;Mw=1;var e=gs&&gs.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(gs,"__esModule",{value:!0}),gs.default=n;const t=e(_P());function n(a,l){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:y}=m;f?l(h,y,m):y&&(o=o||{},o[h]=y)}),o}return gs}var uu={},Lw;function AP(){if(Lw)return uu;Lw=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)-/,l=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,y){return y.toUpperCase()},f=function(h,y){return"".concat(y,"-")},m=function(h,y){return y===void 0&&(y={}),o(h)?h:(h=h.toLowerCase(),y.reactCompat?h=h.replace(l,f):h=h.replace(a,f),h.replace(t,c))};return uu.camelCase=m,uu}var cu,Iw;function RP(){if(Iw)return cu;Iw=1;var e=cu&&cu.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(TP()),n=AP();function a(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,m){f&&m&&(c[(0,n.camelCase)(f,o)]=m)}),c}return a.default=a,cu=a,cu}var zP=RP();const OP=ff(zP),yE=vE("end"),Hy=vE("start");function vE(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 DP(e){const t=Hy(e),n=yE(e);if(t&&n)return{start:t,end:n}}function bu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Uw(e.position):"start"in e||"end"in e?Uw(e):"line"in e||"column"in e?Ug(e):""}function Ug(e){return Pw(e&&e.line)+":"+Pw(e&&e.column)}function Uw(e){return Ug(e&&e.start)+"-"+Ug(e&&e.end)}function Pw(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let l="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=bu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Zy={}.hasOwnProperty,MP=new Map,LP=/[A-Z]/g,IP=new Set(["table","tbody","thead","tfoot","tr"]),UP=new Set(["td","th"]),bE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function PP(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=QP(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=VP(n,t.jsx,t.jsxs)}const l={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"?qy:EP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=xE(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function xE(e,t,n){if(t.type==="element")return BP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $P(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qP(e,t,n);if(t.type==="mdxjsEsm")return FP(e,t);if(t.type==="root")return HP(e,t,n);if(t.type==="text")return ZP(e,t)}function BP(e,t,n){const a=e.schema;let l=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=qy,e.schema=l),e.ancestors.push(t);const o=SE(e,t.tagName,!1),c=GP(e,t);let f=Qy(e,t);return IP.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!gP(m):!0})),wE(e,c,o,t),Vy(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function $P(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)}zu(e,t.position)}function FP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zu(e,t.position)}function qP(e,t,n){const a=e.schema;let l=a;t.name==="svg"&&a.space==="html"&&(l=qy,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:SE(e,t.name,!0),c=KP(e,t),f=Qy(e,t);return wE(e,c,o,t),Vy(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function HP(e,t,n){const a={};return Vy(a,Qy(e,t)),e.create(t,e.Fragment,a,n)}function ZP(e,t){return t.value}function wE(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function Vy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function VP(e,t,n){return a;function a(l,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function QP(e,t){return n;function n(a,l,o,c){const f=Array.isArray(o.children),m=Hy(a);return t(l,o,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function GP(e,t){const n={};let a,l;for(l in t.properties)if(l!=="children"&&Zy.call(t.properties,l)){const o=YP(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&UP.has(t.tagName)?a=f:n[c]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function KP(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else zu(e,t.position);else{const l=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else zu(e,t.position);else o=a.value===null?!0:a.value;n[l]=o}return n}function Qy(e,t){const n=[];let a=-1;const l=e.passKeys?new Map:MP;for(;++a<t.children.length;){const o=t.children[a];let c;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=l.get(m)||0;c=m+"-"+h,l.set(m,h+1)}}const f=xE(e,o,c);f!==void 0&&n.push(f)}return n}function YP(e,t,n){const a=kP(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?dP(n):NP(n)),a.property==="style"){let l=typeof n=="object"?n:XP(e,String(n));return e.stylePropertyNameCase==="css"&&(l=JP(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?xP[a.property]||a.property:a.attribute,n]}}function XP(e,t){try{return OP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,l=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=bE+"#cannot-parse-style-attribute",l}}function SE(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,c;for(;++o<l.length;){const f=Aw(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=Aw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const l=a.value;return Zy.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);zu(e)}function zu(e,t){const n=new An("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=bE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function JP(e){const t={};let n;for(n in e)Zy.call(e,n)&&(t[WP(n)]=e[n]);return t}function WP(e){let t=e.replace(LP,e9);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function e9(e){return"-"+e.toLowerCase()}const Ep={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"]},t9={};function Gy(e,t){const n=t9,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kE(e,a,l)}function kE(e,t,n){if(n9(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 Bw(e.children,t,n)}return Array.isArray(e)?Bw(e,t,n):""}function Bw(e,t,n){const a=[];let l=-1;for(;++l<e.length;)a[l]=kE(e[l],t,n);return a.join("")}function n9(e){return!!(e&&typeof e=="object")}const $w=document.createElement("i");function Ky(e){const t="&"+e+";";$w.innerHTML=t;const n=$w.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ur(e,t,n,a){const l=e.length;let o=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<a.length;)c=a.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Er(e,t){return e.length>0?(ur(e,e.length,0,t),e):t}const Fw={}.hasOwnProperty;function jE(e){const t={};let n=-1;for(;++n<e.length;)r9(t,e[n]);return t}function r9(e,t){let n;for(n in t){const l=(Fw.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){Fw.call(l,c)||(l[c]=[]);const f=o[c];a9(l[c],Array.isArray(f)?f:f?[f]:[])}}}function a9(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);ur(e,0,0,a)}function CE(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 Ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dn=Mi(/[A-Za-z]/),Tn=Mi(/[\dA-Za-z]/),i9=Mi(/[#-'*+\--9=?A-Z^-~]/);function of(e){return e!==null&&(e<32||e===127)}const Pg=Mi(/\d/),l9=Mi(/[\dA-Fa-f]/),s9=Mi(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const Df=Mi(new RegExp("\\p{P}|\\p{S}","u")),wl=Mi(/\s/);function Mi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function so(e){const t=[];let n=-1,a=0,l=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Tn(e.charCodeAt(n+1))&&Tn(e.charCodeAt(n+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+l+1,c=""),l&&(n+=l,l=0)}return t.join("")+e.slice(a)}function ut(e,t,n,a){const l=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return tt(m)?(e.enter(n),f(m)):t(m)}function f(m){return tt(m)&&o++<l?(e.consume(m),f):(e.exit(n),t(m))}}const o9={tokenize:u9};function u9(e){const t=e.attempt(this.parser.constructs.contentInitial,a,l);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ut(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Oe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const c9={tokenize:d9},qw={tokenize:f9};function d9(e){const t=this,n=[];let a=0,l,o,c;return f;function f(z){if(a<n.length){const L=n[a];return t.containerState=L[1],e.attempt(L[0].continuation,m,h)(z)}return h(z)}function m(z){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&N();const L=t.events.length;let D=L,O;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){O=t.events[D][1].end;break}C(a);let M=L;for(;M<t.events.length;)t.events[M][1].end={...O},M++;return ur(t.events,D+1,0,t.events.slice(L)),t.events.length=M,h(z)}return f(z)}function h(z){if(a===n.length){if(!l)return b(z);if(l.currentConstruct&&l.currentConstruct.concrete)return k(z);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qw,y,g)(z)}function y(z){return l&&N(),C(a),b(z)}function g(z){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,k(z)}function b(z){return t.containerState={},e.attempt(qw,w,k)(z)}function w(z){return a++,n.push([t.currentConstruct,t.containerState]),b(z)}function k(z){if(z===null){l&&N(),C(0),e.consume(z);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),j(z)}function j(z){if(z===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(z);return}return Oe(z)?(e.consume(z),E(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(z),j)}function E(z,L){const D=t.sliceStream(z);if(L&&D.push(null),z.previous=o,o&&(o.next=z),o=z,l.defineSkip(z.start),l.write(D),t.parser.lazy[z.start.line]){let O=l.events.length;for(;O--;)if(l.events[O][1].start.offset<c&&(!l.events[O][1].end||l.events[O][1].end.offset>c))return;const M=t.events.length;let U=M,X,F;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(X){F=t.events[U][1].end;break}X=!0}for(C(a),O=M;O<t.events.length;)t.events[O][1].end={...F},O++;ur(t.events,U+1,0,t.events.slice(M)),t.events.length=O}}function C(z){let L=n.length;for(;L-- >z;){const D=n[L];t.containerState=D[1],D[0].exit.call(t,e)}n.length=z}function N(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function f9(e,t,n){return ut(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ks(e){if(e===null||Ct(e)||wl(e))return 1;if(Df(e))return 2}function Mf(e,t,n){const a=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Bg={name:"attention",resolveAll:h9,tokenize:m9};function h9(e,t){let n=-1,a,l,o,c,f,m,h,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[n][1].start};Hw(g,-m),Hw(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},l={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=Er(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=Er(h,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Er(h,Mf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=Er(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,h=Er(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,ur(e,a-1,n-a+3,h),n=a+h.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function m9(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,l=Ks(a);let o;return c;function c(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),y=Ks(m),g=!y||y===2&&l||n.includes(m),b=!l||l===2&&y||n.includes(a);return h._open=!!(o===42?g:g&&(l||!b)),h._close=!!(o===42?b:b&&(y||!g)),t(m)}}function Hw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const p9={name:"autolink",tokenize:g9};function g9(e,t,n){let a=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(w){return Dn(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Tn(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||Tn(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||of(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),y):i9(w)?(e.consume(w),h):n(w)}function y(w){return Tn(w)?g(w):n(w)}function g(w){return w===46?(e.consume(w),a=0,y):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||Tn(w))&&a++<63){const k=w===45?b:g;return e.consume(w),k}return n(w)}}const ec={partial:!0,tokenize:y9};function y9(e,t,n){return a;function a(o){return tt(o)?ut(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Oe(o)?t(o):n(o)}}const EE={continuation:{tokenize:b9},exit:x9,name:"blockQuote",tokenize:v9};function v9(e,t,n){const a=this;return l;function l(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function b9(e,t,n){const a=this;return l;function l(c){return tt(c)?ut(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(EE,t,n)(c)}}function x9(e){e.exit("blockQuote")}const NE={name:"characterEscape",tokenize:w9};function w9(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return s9(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const _E={name:"characterReference",tokenize:S9};function S9(e,t,n){const a=this;let l=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Tn,y(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=l9,y):(e.enter("characterReferenceValue"),o=7,c=Pg,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===Tn&&!Ky(a.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<o?(e.consume(g),y):n(g)}}const Zw={partial:!0,tokenize:j9},Vw={concrete:!0,name:"codeFenced",tokenize:k9};function k9(e,t,n){const a=this,l={partial:!0,tokenize:D};let o=0,c=0,f;return m;function m(O){return h(O)}function h(O){const M=a.events[a.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(O)}function y(O){return O===f?(c++,e.consume(O),y):c<3?n(O):(e.exit("codeFencedFenceSequence"),tt(O)?ut(e,g,"whitespace")(O):g(O))}function g(O){return O===null||Oe(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(Zw,j,L)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Oe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):tt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,w,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),b)}function w(O){return O===null||Oe(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(O))}function k(O){return O===null||Oe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?n(O):(e.consume(O),k)}function j(O){return e.attempt(l,L,E)(O)}function E(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return o>0&&tt(O)?ut(e,N,"linePrefix",o+1)(O):N(O)}function N(O){return O===null||Oe(O)?e.check(Zw,j,L)(O):(e.enter("codeFlowValue"),z(O))}function z(O){return O===null||Oe(O)?(e.exit("codeFlowValue"),N(O)):(e.consume(O),z)}function L(O){return e.exit("codeFenced"),t(O)}function D(O,M,U){let X=0;return F;function F(ne){return O.enter("lineEnding"),O.consume(ne),O.exit("lineEnding"),J}function J(ne){return O.enter("codeFencedFence"),tt(ne)?ut(O,ee,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):ee(ne)}function ee(ne){return ne===f?(O.enter("codeFencedFenceSequence"),ye(ne)):U(ne)}function ye(ne){return ne===f?(X++,O.consume(ne),ye):X>=c?(O.exit("codeFencedFenceSequence"),tt(ne)?ut(O,he,"whitespace")(ne):he(ne)):U(ne)}function he(ne){return ne===null||Oe(ne)?(O.exit("codeFencedFence"),M(ne)):U(ne)}}}function j9(e,t,n){const a=this;return l;function l(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const Np={name:"codeIndented",tokenize:E9},C9={partial:!0,tokenize:N9};function E9(e,t,n){const a=this;return l;function l(h){return e.enter("codeIndented"),ut(e,o,"linePrefix",5)(h)}function o(h){const y=a.events[a.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Oe(h)?e.attempt(C9,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Oe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function N9(e,t,n){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?n(c):Oe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):ut(e,o,"linePrefix",5)(c)}function o(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Oe(c)?l(c):n(c)}}const _9={name:"codeText",previous:A9,resolve:T9,tokenize:R9};function T9(e){let t=e.length-4,n=3,a,l;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;)l===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(l=a):(a===t||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),t-=a-l-2,a=l+2),l=void 0);return e}function A9(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function R9(e,t,n){let a=0,l,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),l=0,y(g)):Oe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Oe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class z9{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 l=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&du(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),du(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),du(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);du(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);du(this.left,n.reverse())}}}function du(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 TE(e){const t={};let n=-1,a,l,o,c,f,m,h;const y=new z9(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(a=y.get(n),n&&a[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,O9(y,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,l=void 0;o--;)if(c=y.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,n),f.unshift(a),y.splice(l,n-l+1,f))}}return ur(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!h}function O9(e,t){const n=e.get(t)[1],a=e.get(t)[2];let l=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let y,g,b=-1,w=n,k=0,j=0;const E=[j];for(;w;){for(;e.get(++l)[1]!==w;);o.push(l),w._tokenizer||(y=a.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=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,E.push(j),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),b=E.length;b--;){const C=f.slice(E[b],E[b+1]),N=o.pop();m.push([N,N+C.length-1]),e.splice(N,2,C)}for(m.reverse(),b=-1;++b<m.length;)h[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return h}const D9={resolve:L9,tokenize:I9},M9={partial:!0,tokenize:U9};function L9(e){return TE(e),e}function I9(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?o(f):Oe(f)?e.check(M9,c,o)(f):(e.consume(f),l)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function U9(e,t,n){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ut(e,o,"linePrefix")}function o(c){if(c===null||Oe(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 AE(e,t,n,a,l,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(C){return C===60?(e.enter(a),e.enter(l),e.enter(o),e.consume(C),e.exit(o),b):C===null||C===32||C===41||of(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(l),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),b(C)):C===null||C===60||Oe(C)?n(C):(e.consume(C),C===92?k:w)}function k(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function j(C){return!y&&(C===null||C===41||Ct(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):y<h&&C===40?(e.consume(C),y++,j):C===41?(e.consume(C),y--,j):C===null||C===32||C===40||of(C)?n(C):(e.consume(C),C===92?E:j)}function E(C){return C===40||C===41||C===92?(e.consume(C),j):j(C)}}function RE(e,t,n,a,l,o){const c=this;let f=0,m;return h;function h(w){return e.enter(a),e.enter(l),e.consume(w),e.exit(l),e.enter(o),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(o),e.enter(l),e.consume(w),e.exit(l),e.exit(a),t):Oe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Oe(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!tt(w)),w===92?b:g)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function zE(e,t,n,a,l,o){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):n(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),m(c)):b===null?n(b):Oe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ut(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Oe(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function xu(e,t){let n;return a;function a(l){return Oe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,a):tt(l)?ut(e,a,n?"linePrefix":"lineSuffix")(l):t(l)}}const P9={name:"definition",tokenize:$9},B9={partial:!0,tokenize:F9};function $9(e,t,n){const a=this;let l;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return RE.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=Ir(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 Ct(w)?xu(e,h)(w):h(w)}function h(w){return AE(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(B9,g,g)(w)}function g(w){return tt(w)?ut(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Oe(w)?(e.exit("definition"),a.parser.defined.push(l),t(w)):n(w)}}function F9(e,t,n){return a;function a(f){return Ct(f)?xu(e,l)(f):n(f)}function l(f){return zE(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return tt(f)?ut(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Oe(f)?t(f):n(f)}}const q9={name:"hardBreakEscape",tokenize:H9};function H9(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Oe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Z9={name:"headingAtx",resolve:V9,tokenize:Q9};function V9(e,t){let n=e.length-2,a=3,l,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},ur(e,a,n-a+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function Q9(e,t,n){let a=0;return l;function l(y){return e.enter("atxHeading"),o(y)}function o(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&a++<6?(e.consume(y),c):y===null||Ct(y)?(e.exit("atxHeadingSequence"),f(y)):n(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Oe(y)?(e.exit("atxHeading"),t(y)):tt(y)?ut(e,f,"whitespace")(y):(e.enter("atxHeadingText"),h(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function h(y){return y===null||y===35||Ct(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),h)}}const G9=["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"],Qw=["pre","script","style","textarea"],K9={concrete:!0,name:"htmlFlow",resolveTo:J9,tokenize:W9},Y9={partial:!0,tokenize:t8},X9={partial:!0,tokenize:e8};function J9(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 W9(e,t,n){const a=this;let l,o,c,f,m;return h;function h(T){return y(T)}function y(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),o=!0,j):T===63?(e.consume(T),l=3,a.interrupt?t:A):Dn(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function b(T){return T===45?(e.consume(T),l=2,w):T===91?(e.consume(T),l=5,f=0,k):Dn(T)?(e.consume(T),l=4,a.interrupt?t:A):n(T)}function w(T){return T===45?(e.consume(T),a.interrupt?t:A):n(T)}function k(T){const q="CDATA[";return T===q.charCodeAt(f++)?(e.consume(T),f===q.length?a.interrupt?t:ee:k):n(T)}function j(T){return Dn(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function E(T){if(T===null||T===47||T===62||Ct(T)){const q=T===47,K=c.toLowerCase();return!q&&!o&&Qw.includes(K)?(l=1,a.interrupt?t(T):ee(T)):G9.includes(c.toLowerCase())?(l=6,q?(e.consume(T),C):a.interrupt?t(T):ee(T)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?N(T):z(T))}return T===45||Tn(T)?(e.consume(T),c+=String.fromCharCode(T),E):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:ee):n(T)}function N(T){return tt(T)?(e.consume(T),N):F(T)}function z(T){return T===47?(e.consume(T),F):T===58||T===95||Dn(T)?(e.consume(T),L):tt(T)?(e.consume(T),z):F(T)}function L(T){return T===45||T===46||T===58||T===95||Tn(T)?(e.consume(T),L):D(T)}function D(T){return T===61?(e.consume(T),O):tt(T)?(e.consume(T),D):z(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),m=T,M):tt(T)?(e.consume(T),O):U(T)}function M(T){return T===m?(e.consume(T),m=null,X):T===null||Oe(T)?n(T):(e.consume(T),M)}function U(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ct(T)?D(T):(e.consume(T),U)}function X(T){return T===47||T===62||tt(T)?z(T):n(T)}function F(T){return T===62?(e.consume(T),J):n(T)}function J(T){return T===null||Oe(T)?ee(T):tt(T)?(e.consume(T),J):n(T)}function ee(T){return T===45&&l===2?(e.consume(T),Z):T===60&&l===1?(e.consume(T),te):T===62&&l===4?(e.consume(T),P):T===63&&l===3?(e.consume(T),A):T===93&&l===5?(e.consume(T),ue):Oe(T)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(Y9,B,ye)(T)):T===null||Oe(T)?(e.exit("htmlFlowData"),ye(T)):(e.consume(T),ee)}function ye(T){return e.check(X9,he,B)(T)}function he(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),ne}function ne(T){return T===null||Oe(T)?ye(T):(e.enter("htmlFlowData"),ee(T))}function Z(T){return T===45?(e.consume(T),A):ee(T)}function te(T){return T===47?(e.consume(T),c="",ie):ee(T)}function ie(T){if(T===62){const q=c.toLowerCase();return Qw.includes(q)?(e.consume(T),P):ee(T)}return Dn(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ie):ee(T)}function ue(T){return T===93?(e.consume(T),A):ee(T)}function A(T){return T===62?(e.consume(T),P):T===45&&l===2?(e.consume(T),A):ee(T)}function P(T){return T===null||Oe(T)?(e.exit("htmlFlowData"),B(T)):(e.consume(T),P)}function B(T){return e.exit("htmlFlow"),t(T)}}function e8(e,t,n){const a=this;return l;function l(c){return Oe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function t8(e,t,n){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(ec,t,n)}}const n8={name:"htmlText",tokenize:r8};function r8(e,t,n){const a=this;let l,o,c;return f;function f(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),h):A===47?(e.consume(A),D):A===63?(e.consume(A),z):Dn(A)?(e.consume(A),U):n(A)}function h(A){return A===45?(e.consume(A),y):A===91?(e.consume(A),o=0,k):Dn(A)?(e.consume(A),N):n(A)}function y(A){return A===45?(e.consume(A),w):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),b):Oe(A)?(c=g,te(A)):(e.consume(A),g)}function b(A){return A===45?(e.consume(A),w):g(A)}function w(A){return A===62?Z(A):A===45?b(A):g(A)}function k(A){const P="CDATA[";return A===P.charCodeAt(o++)?(e.consume(A),o===P.length?j:k):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),E):Oe(A)?(c=j,te(A)):(e.consume(A),j)}function E(A){return A===93?(e.consume(A),C):j(A)}function C(A){return A===62?Z(A):A===93?(e.consume(A),C):j(A)}function N(A){return A===null||A===62?Z(A):Oe(A)?(c=N,te(A)):(e.consume(A),N)}function z(A){return A===null?n(A):A===63?(e.consume(A),L):Oe(A)?(c=z,te(A)):(e.consume(A),z)}function L(A){return A===62?Z(A):z(A)}function D(A){return Dn(A)?(e.consume(A),O):n(A)}function O(A){return A===45||Tn(A)?(e.consume(A),O):M(A)}function M(A){return Oe(A)?(c=M,te(A)):tt(A)?(e.consume(A),M):Z(A)}function U(A){return A===45||Tn(A)?(e.consume(A),U):A===47||A===62||Ct(A)?X(A):n(A)}function X(A){return A===47?(e.consume(A),Z):A===58||A===95||Dn(A)?(e.consume(A),F):Oe(A)?(c=X,te(A)):tt(A)?(e.consume(A),X):Z(A)}function F(A){return A===45||A===46||A===58||A===95||Tn(A)?(e.consume(A),F):J(A)}function J(A){return A===61?(e.consume(A),ee):Oe(A)?(c=J,te(A)):tt(A)?(e.consume(A),J):X(A)}function ee(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,ye):Oe(A)?(c=ee,te(A)):tt(A)?(e.consume(A),ee):(e.consume(A),he)}function ye(A){return A===l?(e.consume(A),l=void 0,ne):A===null?n(A):Oe(A)?(c=ye,te(A)):(e.consume(A),ye)}function he(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||Ct(A)?X(A):(e.consume(A),he)}function ne(A){return A===47||A===62||Ct(A)?X(A):n(A)}function Z(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function te(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),ie}function ie(A){return tt(A)?ut(e,ue,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ue(A)}function ue(A){return e.enter("htmlTextData"),c(A)}}const Yy={name:"labelEnd",resolveAll:s8,resolveTo:o8,tokenize:u8},a8={tokenize:c8},i8={tokenize:d8},l8={tokenize:f8};function s8(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 l=a.type==="labelImage"?4:2;a.type="data",t+=l}}return e.length!==n.length&&ur(e,0,e.length,n),e}function o8(e,t){let n=e.length,a=0,l,o,c,f;for(;n--;)if(l=e[n][1],o){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(o=n,l.type!=="labelLink")){a=2;break}}else l.type==="labelEnd"&&(c=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=Er(f,e.slice(o+1,o+a+3)),f=Er(f,[["enter",y,t]]),f=Er(f,Mf(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=Er(f,[["exit",y,t],e[c-2],e[c-1],["exit",h,t]]),f=Er(f,e.slice(c+1)),f=Er(f,[["exit",m,t]]),ur(e,o,e.length,f),e}function u8(e,t,n){const a=this;let l=a.events.length,o,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){o=a.events[l][1];break}return f;function f(b){return o?o._inactive?g(b):(c=a.parser.defined.includes(Ir(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):n(b)}function m(b){return b===40?e.attempt(a8,y,c?y:g)(b):b===91?e.attempt(i8,y,c?h:g)(b):c?y(b):g(b)}function h(b){return e.attempt(l8,y,g)(b)}function y(b){return t(b)}function g(b){return o._balanced=!0,n(b)}}function c8(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Ct(g)?xu(e,o)(g):o(g)}function o(g){return g===41?y(g):AE(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ct(g)?xu(e,m)(g):y(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?zE(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function h(g){return Ct(g)?xu(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function d8(e,t,n){const a=this;return l;function l(f){return RE.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(Ir(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function f8(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const h8={name:"labelStartImage",resolveAll:Yy.resolveAll,tokenize:m8};function m8(e,t,n){const a=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const p8={name:"labelStartLink",resolveAll:Yy.resolveAll,tokenize:g8};function g8(e,t,n){const a=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const _p={name:"lineEnding",tokenize:y8};function y8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ut(e,t,"linePrefix")}}const Vd={name:"thematicBreak",tokenize:v8};function v8(e,t,n){let a=0,l;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return l=h,f(h)}function f(h){return h===l?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Oe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===l?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),tt(h)?ut(e,f,"whitespace")(h):f(h))}}const Hn={continuation:{tokenize:S8},exit:j8,name:"list",tokenize:w8},b8={partial:!0,tokenize:C8},x8={partial:!0,tokenize:k8};function w8(e,t,n){const a=this,l=a.events[a.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[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:Pg(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(Vd,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 Pg(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(ec,a.interrupt?n:y,e.attempt(b8,b,g))}function y(w){return a.containerState.initialBlankLine=!0,o++,b(w)}function g(w){return tt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):n(w)}function b(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function S8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(ec,l,o);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,ut(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!tt(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(x8,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,ut(e,e.attempt(Hn,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function k8(e,t,n){const a=this;return ut(e,l,"listItemIndent",a.containerState.size+1);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function j8(e){e.exit(this.containerState.type)}function C8(e,t,n){const a=this;return ut(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=a.events[a.events.length-1];return!tt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Gw={name:"setextUnderline",resolveTo:E8,tokenize:N8};function E8(e,t){let n=e.length,a,l,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function N8(e,t,n){const a=this;let l;return o;function o(h){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),l=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===l?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),tt(h)?ut(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Oe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const _8={tokenize:T8};function T8(e){const t=this,n=e.attempt(ec,a,e.attempt(this.parser.constructs.flowInitial,l,ut(e,e.attempt(this.parser.constructs.flow,l,e.attempt(D9,l)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const A8={resolveAll:DE()},R8=OE("string"),z8=OE("text");function OE(e){return{resolveAll:DE(e==="text"?O8:void 0),tokenize:t};function t(n){const a=this,l=this.parser.constructs[e],o=n.attempt(l,c,f);return c;function c(y){return h(y)?o(y):f(y)}function f(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),m}function m(y){return h(y)?(n.exit("data"),o(y)):(n.consume(y),m)}function h(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const w=g[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function DE(e){return t;function t(n,a){let l=-1,o;for(;++l<=n.length;)o===void 0?n[l]&&n[l][1].type==="data"&&(o=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==o+2&&(n[o][1].end=n[l-1][1].end,n.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(n,a):n}}function O8(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],l=t.sliceStream(a);let o=l.length,c=-1,f=0,m;for(;o--;){const h=l[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const D8={42:Hn,43:Hn,45:Hn,48:Hn,49:Hn,50:Hn,51:Hn,52:Hn,53:Hn,54:Hn,55:Hn,56:Hn,57:Hn,62:EE},M8={91:P9},L8={[-2]:Np,[-1]:Np,32:Np},I8={35:Z9,42:Vd,45:[Gw,Vd],60:K9,61:Gw,95:Vd,96:Vw,126:Vw},U8={38:_E,92:NE},P8={[-5]:_p,[-4]:_p,[-3]:_p,33:h8,38:_E,42:Bg,60:[p9,n8],91:p8,92:[q9,NE],93:Yy,95:Bg,96:_9},B8={null:[Bg,A8]},$8={null:[42,95]},F8={null:[]},q8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$8,contentInitial:M8,disable:F8,document:D8,flow:I8,flowInitial:L8,insideSpan:B8,string:U8,text:P8},Symbol.toStringTag,{value:"Module"}));function H8(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 l={},o=[];let c=[],f=[];const m={attempt:M(D),check:M(O),consume:N,enter:z,exit:L,interrupt:M(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:g};let y=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(J){return c=Er(c,J),E(),c[c.length-1]!==null?[]:(U(t,0),h.events=Mf(o,h.events,h),h.events)}function b(J,ee){return V8(w(J),ee)}function w(J){return Z8(c,J)}function k(){const{_bufferIndex:J,_index:ee,line:ye,column:he,offset:ne}=a;return{_bufferIndex:J,_index:ee,line:ye,column:he,offset:ne}}function j(J){l[J.line]=J.column,F()}function E(){let J;for(;a._index<c.length;){const ee=c[a._index];if(typeof ee=="string")for(J=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===J&&a._bufferIndex<ee.length;)C(ee.charCodeAt(a._bufferIndex));else C(ee)}}function C(J){y=y(J)}function N(J){Oe(J)?(a.line++,a.column=1,a.offset+=J===-3?2:1,F()):J!==-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=J}function z(J,ee){const ye=ee||{};return ye.type=J,ye.start=k(),h.events.push(["enter",ye,h]),f.push(ye),ye}function L(J){const ee=f.pop();return ee.end=k(),h.events.push(["exit",ee,h]),ee}function D(J,ee){U(J,ee.from)}function O(J,ee){ee.restore()}function M(J,ee){return ye;function ye(he,ne,Z){let te,ie,ue,A;return Array.isArray(he)?B(he):"tokenize"in he?B([he]):P(he);function P(ce){return xe;function xe(we){const pe=we!==null&&ce[we],Xe=we!==null&&ce.null,Le=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return B(Le)(we)}}function B(ce){return te=ce,ie=0,ce.length===0?Z:T(ce[ie])}function T(ce){return xe;function xe(we){return A=X(),ue=ce,ce.partial||(h.currentConstruct=ce),ce.name&&h.parser.constructs.disable.null.includes(ce.name)?K():ce.tokenize.call(ee?Object.assign(Object.create(h),ee):h,m,q,K)(we)}}function q(ce){return J(ue,A),ne}function K(ce){return A.restore(),++ie<te.length?T(te[ie]):Z}}}function U(J,ee){J.resolveAll&&!o.includes(J)&&o.push(J),J.resolve&&ur(h.events,ee,h.events.length-ee,J.resolve(h.events.slice(ee),h)),J.resolveTo&&(h.events=J.resolveTo(h.events,h))}function X(){const J=k(),ee=h.previous,ye=h.currentConstruct,he=h.events.length,ne=Array.from(f);return{from:he,restore:Z};function Z(){a=J,h.previous=ee,h.currentConstruct=ye,h.events.length=he,f=ne,F()}}function F(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function Z8(e,t){const n=t.start._index,a=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let c;if(n===l)c=[e[n].slice(a,o)];else{if(c=e.slice(n,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function V8(e,t){let n=-1;const a=[];let l;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
359
|
+
`;break}case-3:{c=`\r
|
|
360
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(o)}l=o===-2,a.push(c)}return a.join("")}function Q8(e){const a={constructs:jE([q8,...(e||{}).extensions||[]]),content:l(o9),defined:[],document:l(c9),flow:l(_8),lazy:{},string:l(R8),text:l(z8)};return a;function l(o){return c;function c(f){return H8(a,o,f)}}}function G8(e){for(;!TE(e););return e}const Kw=/[\0\t\n\r]/g;function K8(){let e=1,t="",n=!0,a;return l;function l(o,c,f){const m=[];let h,y,g,b,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(Kw.lastIndex=g,h=Kw.exec(o),b=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(b),!h){t=o.slice(g);break}if(w===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(o.slice(g,b)),e+=b-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const Y8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function X8(e){return e.replace(Y8,J8)}function J8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),o=l===120||l===88;return CE(n.slice(o?2:1),o?16:10)}return Ky(n)||e}const ME={}.hasOwnProperty;function W8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),eB(n)(G8(Q8(n).document().write(K8()(e,t,!0))))}function eB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ma),autolinkProtocol:X,autolinkEmail:X,atxHeading:o(Pe),blockQuote:o(Xe),characterEscape:X,characterReference:X,codeFenced:o(Le),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Le,c),codeText:o(re,c),codeTextData:X,data:X,codeFlowValue:X,definition:o(Ee),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Ie),hardBreakEscape:o(Lt),hardBreakTrailing:o(Lt),htmlFlow:o(hn,c),htmlFlowData:X,htmlText:o(hn,c),htmlTextData:X,image:o(_l),label:c,link:o(Ma),listItem:o(na),listItemValue:b,listOrdered:o(La,g),listUnordered:o(La),paragraph:o(oo),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Pe),strong:o(uo),thematicBreak:o(co)},exit:{atxHeading:m(),atxHeadingSequence:D,autolink:m(),autolinkEmail:pe,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:ce,characterReference:xe,codeFenced:m(E),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:F,codeIndented:m(C),codeText:m(ne),codeTextData:F,data:F,definition:m(),definitionDestinationString:L,definitionLabelString:N,definitionTitleString:z,emphasis:m(),hardBreakEscape:m(ee),hardBreakTrailing:m(ee),htmlFlow:m(ye),htmlFlowData:F,htmlText:m(he),htmlTextData:F,image:m(te),label:ue,labelText:ie,lineEnding:J,link:m(Z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:q,resourceDestinationString:A,resourceTitleString:P,resource:B,setextHeading:m(U),setextHeadingLineSequence:M,setextHeadingText:O,strong:m(),thematicBreak:m()}};LE(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(le){let be={type:"root",children:[]};const Ue={stack:[be],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:y,data:n},$e=[];let at=-1;for(;++at<le.length;)if(le[at][1].type==="listOrdered"||le[at][1].type==="listUnordered")if(le[at][0]==="enter")$e.push(at);else{const pn=$e.pop();at=l(le,pn,at)}for(at=-1;++at<le.length;){const pn=t[le[at][0]];ME.call(pn,le[at][1].type)&&pn[le[at][1].type].call(Object.assign({sliceSerialize:le[at][2].sliceSerialize},Ue),le[at][1])}if(Ue.tokenStack.length>0){const pn=Ue.tokenStack[Ue.tokenStack.length-1];(pn[1]||Yw).call(Ue,void 0,pn[0])}for(be.position={start:ci(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:ci(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},at=-1;++at<t.transforms.length;)be=t.transforms[at](be)||be;return be}function l(le,be,Ue){let $e=be-1,at=-1,pn=!1,fr,nn,Zt,gn;for(;++$e<=Ue;){const ht=le[$e];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?at++:at--,gn=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(fr&&!gn&&!at&&!Zt&&(Zt=$e),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=void 0}if(!at&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||at===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(fr){let zr=$e;for(nn=void 0;zr--;){const Ln=le[zr];if(Ln[1].type==="lineEnding"||Ln[1].type==="lineEndingBlank"){if(Ln[0]==="exit")continue;nn&&(le[nn][1].type="lineEndingBlank",pn=!0),Ln[1].type="lineEnding",nn=zr}else if(!(Ln[1].type==="linePrefix"||Ln[1].type==="blockQuotePrefix"||Ln[1].type==="blockQuotePrefixWhitespace"||Ln[1].type==="blockQuoteMarker"||Ln[1].type==="listItemIndent"))break}Zt&&(!nn||Zt<nn)&&(fr._spread=!0),fr.end=Object.assign({},nn?le[nn][1].start:ht[1].end),le.splice(nn||$e,0,["exit",fr,ht[2]]),$e++,Ue++}if(ht[1].type==="listItemPrefix"){const zr={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};fr=zr,le.splice($e,0,["enter",zr,ht[2]]),$e++,Ue++,Zt=void 0,gn=!0}}}return le[be][1]._spread=pn,Ue}function o(le,be){return Ue;function Ue($e){f.call(this,le($e),$e),be&&be.call(this,$e)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(le,be,Ue){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([be,Ue||void 0]),le.position={start:ci(be.start),end:void 0}}function m(le){return be;function be(Ue){le&&le.call(this,Ue),h.call(this,Ue)}}function h(le,be){const Ue=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==le.type&&(be?be.call(this,le,$e[0]):($e[1]||Yw).call(this,le,$e[0]));else throw new Error("Cannot close `"+le.type+"` ("+bu({start:le.start,end:le.end})+"): it’s not open");Ue.position.end=ci(le.end)}function y(){return Gy(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function w(){const le=this.resume(),be=this.stack[this.stack.length-1];be.lang=le}function k(){const le=this.resume(),be=this.stack[this.stack.length-1];be.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/(\r?\n|\r)$/g,"")}function N(le){const be=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=be,Ue.identifier=Ir(this.sliceSerialize(le)).toLowerCase()}function z(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function L(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function D(le){const be=this.stack[this.stack.length-1];if(!be.depth){const Ue=this.sliceSerialize(le).length;be.depth=Ue}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function M(le){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function X(le){const Ue=this.stack[this.stack.length-1].children;let $e=Ue[Ue.length-1];(!$e||$e.type!=="text")&&($e=mn(),$e.position={start:ci(le.start),end:void 0},Ue.push($e)),this.stack.push($e)}function F(le){const be=this.stack.pop();be.value+=this.sliceSerialize(le),be.position.end=ci(le.end)}function J(le){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=be.children[be.children.length-1];Ue.position.end=ci(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(X.call(this,le),F.call(this,le))}function ee(){this.data.atHardBreak=!0}function ye(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function he(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function ne(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function Z(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function te(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ie(le){const be=this.sliceSerialize(le),Ue=this.stack[this.stack.length-2];Ue.label=X8(be),Ue.identifier=Ir(be).toLowerCase()}function ue(){const le=this.stack[this.stack.length-1],be=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const $e=le.children;Ue.children=$e}else Ue.alt=be}function A(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function P(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function B(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function q(le){const be=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=be,Ue.identifier=Ir(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function K(le){this.data.characterReferenceType=le.type}function ce(le){const be=this.sliceSerialize(le),Ue=this.data.characterReferenceType;let $e;Ue?($e=CE(be,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Ky(be);const at=this.stack[this.stack.length-1];at.value+=$e}function xe(le){const be=this.stack.pop();be.position.end=ci(le.end)}function we(le){F.call(this,le);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(le)}function pe(le){F.call(this,le);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(le)}function Xe(){return{type:"blockquote",children:[]}}function Le(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Pe(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function hn(){return{type:"html",value:""}}function _l(){return{type:"image",title:null,url:"",alt:null}}function Ma(){return{type:"link",title:null,url:"",children:[]}}function La(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function na(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function oo(){return{type:"paragraph",children:[]}}function uo(){return{type:"strong",children:[]}}function mn(){return{type:"text",value:""}}function co(){return{type:"thematicBreak"}}}function ci(e){return{line:e.line,column:e.column,offset:e.offset}}function LE(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?LE(e,a):tB(e,a)}}function tB(e,t){let n;for(n in t)if(ME.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 Yw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+bu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is still open")}function nB(e){const t=this;t.parser=n;function n(a){return W8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rB(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 aB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
361
|
+
`}]}function iB(e,t){const n=t.value?t.value+`
|
|
362
|
+
`:"",a={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function lB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),l=so(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(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 uB(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 cB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function IE(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 l=e.all(t),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function dB(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return IE(e,t);const l={src:so(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function fB(e,t){const n={src:so(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 hB(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 mB(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return IE(e,t);const l={href:so(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function pB(e,t){const n={href:so(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 gB(e,t,n){const a=e.all(t),l=n?yB(n):UE(t),o={},c=[];if(typeof t.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
|
|
363
|
+
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=a[a.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
364
|
+
`});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function yB(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=UE(n[a])}return t}function UE(e){const t=e.spread;return t??e.children.length>1}function vB(e,t){const n={},a=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l<a.length;){const c=a[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function bB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SB(e,t){const n=e.all(t),a=n.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),l.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=Hy(t.children[1]),m=yE(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function kB(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:o,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),h.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,y),e.applyData(t,y)}function jB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Xw=9,Jw=32;function CB(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),l=0;const o=[];for(;a;)o.push(Ww(t.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=n.exec(t);return o.push(Ww(t.slice(l),l>0,!1)),o.join("")}function Ww(e,t,n){let a=0,l=e.length;if(t){let o=e.codePointAt(a);for(;o===Xw||o===Jw;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(l-1);for(;o===Xw||o===Jw;)l--,o=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function EB(e,t){const n={type:"text",value:CB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function NB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const _B={blockquote:rB,break:aB,code:iB,delete:lB,emphasis:sB,footnoteReference:oB,heading:uB,html:cB,imageReference:dB,image:fB,inlineCode:hB,linkReference:mB,link:pB,listItem:gB,list:vB,paragraph:bB,root:xB,strong:wB,table:SB,tableCell:jB,tableRow:kB,text:EB,thematicBreak:NB,toml:zd,yaml:zd,definition:zd,footnoteDefinition:zd};function zd(){}const PE=-1,Lf=0,wu=1,uf=2,Xy=3,Jy=4,Wy=5,ev=6,BE=7,$E=8,eS=typeof self=="object"?self:globalThis,TB=(e,t)=>{const n=(l,o)=>(e.set(o,l),l),a=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case Lf:case PE:return n(c,l);case wu:{const f=n([],l);for(const m of c)f.push(a(m));return f}case uf:{const f=n({},l);for(const[m,h]of c)f[a(m)]=a(h);return f}case Xy:return n(new Date(c),l);case Jy:{const{source:f,flags:m}=c;return n(new RegExp(f,m),l)}case Wy:{const f=n(new Map,l);for(const[m,h]of c)f.set(a(m),a(h));return f}case ev:{const f=n(new Set,l);for(const m of c)f.add(a(m));return f}case BE:{const{name:f,message:m}=c;return n(new eS[f](m),l)}case $E:return n(BigInt(c),l);case"BigInt":return n(Object(BigInt(c)),l);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 eS[o](c),l)};return a},tS=e=>TB(new Map,e)(0),ys="",{toString:AB}={},{keys:RB}=Object,fu=e=>{const t=typeof e;if(t!=="object"||!e)return[Lf,t];const n=AB.call(e).slice(8,-1);switch(n){case"Array":return[wu,ys];case"Object":return[uf,ys];case"Date":return[Xy,ys];case"RegExp":return[Jy,ys];case"Map":return[Wy,ys];case"Set":return[ev,ys];case"DataView":return[wu,n]}return n.includes("Array")?[wu,n]:n.includes("Error")?[BE,n]:[uf,n]},Od=([e,t])=>e===Lf&&(t==="function"||t==="symbol"),zB=(e,t,n,a)=>{const l=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},o=c=>{if(n.has(c))return n.get(c);let[f,m]=fu(c);switch(f){case Lf:{let y=c;switch(m){case"bigint":f=$E,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([PE],c)}return l([f,y],c)}case wu:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(o(b));return g}case uf:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const y=[],g=l([f,y],c);for(const b of RB(c))(e||!Od(fu(c[b])))&&y.push([o(b),o(c[b])]);return g}case Xy:return l([f,c.toISOString()],c);case Jy:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Wy:{const y=[],g=l([f,y],c);for(const[b,w]of c)(e||!(Od(fu(b))||Od(fu(w))))&&y.push([o(b),o(w)]);return g}case ev:{const y=[],g=l([f,y],c);for(const b of c)(e||!Od(fu(b)))&&y.push(o(b));return g}}const{message:h}=c;return l([f,{name:m,message:h}],c)};return o},nS=(e,{json:t,lossy:n}={})=>{const a=[];return zB(!(t||n),!!t,new Map,a)(e),a},cf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?tS(nS(e,t)):structuredClone(e):(e,t)=>tS(nS(e,t));function OB(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 DB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function MB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||OB,a=e.options.footnoteBackLabel||DB,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const y=e.all(h),g=String(h.identifier).toUpperCase(),b=so(g.toLowerCase());let w=0;const k=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++w<=j;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(m,w);typeof N=="string"&&(N={type:"text",value:N}),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(N)?N:[N]})}const E=y[y.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const N=E.children[E.children.length-1];N&&N.type==="text"?N.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...k)}else y.push(...k);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(y,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...cf(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
365
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
366
|
+
`}]}}const If=(function(e){if(e==null)return PB;if(typeof e=="function")return Uf(e);if(typeof e=="object")return Array.isArray(e)?LB(e):IB(e);if(typeof e=="string")return UB(e);throw new Error("Expected function, string, or object as test")});function LB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=If(e[n]);return Uf(a);function a(...l){let o=-1;for(;++o<t.length;)if(t[o].apply(this,l))return!0;return!1}}function IB(e){const t=e;return Uf(n);function n(a){const l=a;let o;for(o in e)if(l[o]!==t[o])return!1;return!0}}function UB(e){return Uf(t);function t(n){return n&&n.type===e}}function Uf(e){return t;function t(n,a,l){return!!(BB(n)&&e.call(this,n,typeof a=="number"?a:void 0,l||void 0))}}function PB(){return!0}function BB(e){return e!==null&&typeof e=="object"&&"type"in e}const FE=[],$B=!0,$g=!1,FB="skip";function qE(e,t,n,a){let l;typeof t=="function"&&typeof n!="function"?(a=n,n=t):l=t;const o=If(l),c=a?-1:1;f(e,void 0,[])();function f(m,h,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=FE,k,j,E;if((!t||o(m,h,y[y.length-1]||void 0))&&(w=qB(n(m,y)),w[0]===$g))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==FB)for(j=(a?C.children.length:-1)+c,E=y.concat(C);j>-1&&j<C.children.length;){const N=C.children[j];if(k=f(N,j,E)(),k[0]===$g)return k;j=typeof k[1]=="number"?k[1]:j+c}}return w}}}function qB(e){return Array.isArray(e)?e:typeof e=="number"?[$B,e]:e==null?FE:[e]}function tv(e,t,n,a){let l,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,l=n):(o=t,c=n,l=a),qE(e,o,f,l);function f(m,h){const y=h[h.length-1],g=y?y.children.indexOf(m):void 0;return c(m,g,y)}}const Fg={}.hasOwnProperty,HB={};function ZB(e,t){const n=t||HB,a=new Map,l=new Map,o=new Map,c={..._B,...n.handlers},f={all:h,applyData:QB,definitionById:a,footnoteById:l,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:VB,wrap:KB};return tv(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,w=f.handlers[b];if(Fg.call(f.handlers,b)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:j,...E}=y,C=cf(E);return C.children=f.all(y),C}return cf(y)}return(f.options.unknownHandler||GB)(f,y,g)}function h(y){const g=[];if("children"in y){const b=y.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],y);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=rS(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=rS(j.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function VB(e,t){e.position&&(t.position=DP(e))}function QB(e,t){let n=t;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const c="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,cf(o)),"children"in n&&n.children&&l!==null&&l!==void 0&&(n.children=l)}return n}function GB(e,t){const n=t.data||{},a="value"in t&&!(Fg.call(n,"hProperties")||Fg.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 KB(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 rS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function aS(e,t){const n=ZB(e,t),a=n.one(e,void 0),l=MB(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&o.children.push({type:"text",value:`
|
|
370
|
+
`},l),o}function YB(e,t){return e&&"run"in e?async function(n,a){const l=aS(n,{file:a,...t});await e.run(l,a)}:function(n,a){return aS(n,{file:a,...e||t})}}function iS(e){if(e)throw e}var Tp,lS;function XB(){if(lS)return Tp;lS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var y=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!y&&!g)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,y){n&&y.name==="__proto__"?n(h,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):h[y.name]=y.newValue},f=function(h,y){if(y==="__proto__")if(e.call(h,y)){if(a)return a(h,y).value}else return;return h[y]};return Tp=function m(){var h,y,g,b,w,k,j=arguments[0],E=1,C=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<C;++E)if(h=arguments[E],h!=null)for(y in h)g=f(j,y),b=f(h,y),j!==b&&(N&&b&&(o(b)||(w=l(b)))?(w?(w=!1,k=g&&l(g)?g:[]):k=g&&o(g)?g:{},c(j,{name:y,newValue:m(N,k,b)})):typeof b<"u"&&c(j,{name:y,newValue:b}));return j},Tp}var JB=XB();const Ap=ff(JB);function qg(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 WB(){const e=[],t={run:n,use:a};return t;function n(...l){let o=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...h){const y=e[++o];let g=-1;if(m){c(m);return}for(;++g<l.length;)(h[g]===null||h[g]===void 0)&&(h[g]=l[g]);l=h,y?e$(y,f)(...h):c(null,...h)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function e$(e,t){let n;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(h){const y=h;if(f&&n)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,l):m instanceof Error?l(m):o(m))}function l(c,...f){n||(n=!0,t(c,...f))}function o(c){l(null,c)}}const Hr={basename:t$,dirname:n$,extname:r$,join:a$,sep:"/"};function t$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');tc(e);let n=0,a=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else a<0&&(o=!0,a=l+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else c<0&&(o=!0,c=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(a=l):(f=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function n$(e){if(tc(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 r$(e){tc(e);let t=e.length,n=-1,a=0,l=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||n<0||o===0||o===1&&l===n-1&&l===a+1?"":e.slice(l,n)}function a$(...e){let t=-1,n;for(;++t<e.length;)tc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":i$(n)}function i$(e){tc(e);const t=e.codePointAt(0)===47;let n=l$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function l$(e,t){let n="",a=0,l=-1,o=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||o===1))if(l!==c-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),l=c,o=0;continue}}else if(n.length>0){n="",a=0,l=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(l+1,c):n=e.slice(l+1,c),a=c-l-1;l=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function tc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const s$={cwd:o$};function o$(){return"/"}function Hg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function u$(e){if(typeof e=="string")e=new URL(e);else if(!Hg(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 c$(e)}function c$(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 l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const Rp=["history","path","basename","stem","extname","dirname"];class HE{constructor(t){let n;t?Hg(t)?n={path:t}:typeof t=="string"||d$(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":s$.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Rp.length;){const o=Rp[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let l;for(l in n)Rp.includes(l)||(this[l]=n[l])}get basename(){return typeof this.path=="string"?Hr.basename(this.path):void 0}set basename(t){Op(t,"basename"),zp(t,"basename"),this.path=Hr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Hr.dirname(this.path):void 0}set dirname(t){sS(this.basename,"dirname"),this.path=Hr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Hr.extname(this.path):void 0}set extname(t){if(zp(t,"extname"),sS(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=Hr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Hg(t)&&(t=u$(t)),Op(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Hr.basename(this.path,this.extname):void 0}set stem(t){Op(t,"stem"),zp(t,"stem"),this.path=Hr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const l=this.message(t,n,a);throw l.fatal=!0,l}info(t,n,a){const l=this.message(t,n,a);return l.fatal=void 0,l}message(t,n,a){const l=new An(t,n,a);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zp(e,t){if(e&&e.includes(Hr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Hr.sep+"`")}function Op(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function d$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const f$=(function(e){const a=this.constructor.prototype,l=a[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),h$={}.hasOwnProperty;class nv extends f${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=WB()}copy(){const t=new nv;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Ap(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Lp("data",this.frozen),this.namespace[t]=n,this):h$.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Lp("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 l=n.call(t,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Dd(t),a=this.parser||this.Parser;return Dp("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Dp("process",this.parser||this.Parser),Mp("process",this.compiler||this.Compiler),n?l(void 0,n):new Promise(l);function l(o,c){const f=Dd(t),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return h(y);const w=g,k=a.stringify(w,b);g$(k)?b.value=k:b.result=k,h(y,b)});function h(y,g){y||!g?c(y):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Dp("processSync",this.parser||this.Parser),Mp("processSync",this.compiler||this.Compiler),this.process(t,l),uS("processSync","process",n),a;function l(o,c){n=!0,iS(o),a=c}}run(t,n,a){oS(t),this.freeze();const l=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=Dd(n);l.run(t,m,h);function h(y,g,b){const w=g||t;y?f(y):c?c(w):a(void 0,w,b)}}}runSync(t,n){let a=!1,l;return this.run(t,n,o),uS("runSync","run",a),l;function o(c,f){iS(c),l=f,a=!0}}stringify(t,n){this.freeze();const a=Dd(n),l=this.compiler||this.Compiler;return Mp("stringify",l),oS(t),l(t,a)}use(t,...n){const a=this.attachers,l=this.namespace;if(Lp("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[y,...g]=h;m(y,g)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(l.settings=Ap(!0,l.settings,h.settings))}function f(h){let y=-1;if(h!=null)if(Array.isArray(h))for(;++y<h.length;){const g=h[y];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,y){let g=-1,b=-1;for(;++g<a.length;)if(a[g][0]===h){b=g;break}if(b===-1)a.push([h,...y]);else if(y.length>0){let[w,...k]=y;const j=a[b][1];qg(j)&&qg(w)&&(w=Ap(!0,j,w)),a[b]=[h,w,...k]}}}}const m$=new nv().freeze();function Dp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Lp(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 oS(e){if(!qg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function uS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dd(e){return p$(e)?e:new HE(e)}function p$(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function g$(e){return typeof e=="string"||y$(e)}function y$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const v$="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",cS=[],dS={allowDangerousHtml:!0},b$=/^(https?|ircs?|mailto|xmpp)$/i,x$=[{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 w$(e){const t=S$(e),n=k$(e);return j$(t.runSync(t.parse(n),n),e)}function S$(e){const t=e.rehypePlugins||cS,n=e.remarkPlugins||cS,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...dS}:dS;return m$().use(nB).use(n).use(YB,a).use(t)}function k$(e){const t=e.children||"",n=new HE;return typeof t=="string"&&(n.value=t),n}function j$(e,t){const n=t.allowedElements,a=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||C$;for(const y of x$)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+v$+y.id,void 0);return tv(e,h),PP(e,{Fragment:u.Fragment,components:l,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function h(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Ep)if(Object.hasOwn(Ep,w)&&Object.hasOwn(y.properties,w)){const k=y.properties[w],j=Ep[w];(j===null||j.includes(y.tagName))&&(y.properties[w]=m(String(k||""),w,y))}}if(y.type==="element"){let w=n?!n.includes(y.tagName):o?o.includes(y.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(y,g,b)),w&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function C$(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||a!==-1&&t>a||b$.test(e.slice(0,t))?e:""}function E$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ZE(e,t,n){const l=If((n||{}).ignore||[]),o=N$(t);let c=-1;for(;++c<o.length;)qE(e,"text",f);function f(h,y){let g=-1,b;for(;++g<y.length;){const w=y[g],k=b?b.children:void 0;if(l(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(h,y)}function m(h,y){const g=y[y.length-1],b=o[c][0],w=o[c][1];let k=0;const E=g.children.indexOf(h);let C=!1,N=[];b.lastIndex=0;let z=b.exec(h.value);for(;z;){const L=z.index,D={index:z.index,input:z.input,stack:[...y,h]};let O=w(...z,D);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=L+1:(k!==L&&N.push({type:"text",value:h.value.slice(k,L)}),Array.isArray(O)?N.push(...O):O&&N.push(O),k=L+z[0].length,C=!0),!b.global)break;z=b.exec(h.value)}return C?(k<h.value.length&&N.push({type:"text",value:h.value.slice(k)}),g.children.splice(E,1,...N)):N=[h],E+N.length}}function N$(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 l=n[a];t.push([_$(l[0]),T$(l[1])])}return t}function _$(e){return typeof e=="string"?new RegExp(E$(e),"g"):e}function T$(e){return typeof e=="function"?e:function(){return e}}function A$(e){ZE(e,[/\r?\n|\r/g,R$])}function R$(){return{type:"break"}}function z$(){return function(e){A$(e)}}function fS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,l=n.indexOf(t);for(;l!==-1;)a++,l=n.indexOf(t,l+t.length);return a}const Ip="phrasing",Up=["autolink","link","image","label"];function O$(){return{transforms:[B$],enter:{literalAutolink:M$,literalAutolinkEmail:Pp,literalAutolinkHttp:Pp,literalAutolinkWww:Pp},exit:{literalAutolink:P$,literalAutolinkEmail:U$,literalAutolinkHttp:L$,literalAutolinkWww:I$}}}function D$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ip,notInConstruct:Up},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ip,notInConstruct:Up},{character:":",before:"[ps]",after:"\\/",inConstruct:Ip,notInConstruct:Up}]}}function M$(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Pp(e){this.config.enter.autolinkProtocol.call(this,e)}function L$(e){this.config.exit.autolinkProtocol.call(this,e)}function I$(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 U$(e){this.config.exit.autolinkEmail.call(this,e)}function P$(e){this.exit(e)}function B$(e){ZE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,$$],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),F$]],{ignore:["link","linkReference"]})}function $$(e,t,n,a,l){let o="";if(!VE(l)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!q$(n)))return!1;const c=H$(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function F$(e,t,n,a){return!VE(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function q$(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 H$(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 l=fS(e,"(");let o=fS(e,")");for(;a!==-1&&l>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function VE(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wl(n)||Df(n))&&(!t||n!==47)}QE.peek=W$;function Z$(){this.buffer()}function V$(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Q$(){this.buffer()}function G$(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function K$(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Y$(e){this.exit(e)}function X$(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function J$(e){this.exit(e)}function W$(){return"["}function QE(e,t,n,a){const l=n.createTracker(a);let o=l.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=l.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=l.move("]"),o}function eF(){return{enter:{gfmFootnoteCallString:Z$,gfmFootnoteCall:V$,gfmFootnoteDefinitionLabelString:Q$,gfmFootnoteDefinition:G$},exit:{gfmFootnoteCallString:K$,gfmFootnoteCall:Y$,gfmFootnoteDefinitionLabelString:X$,gfmFootnoteDefinition:J$}}}function tF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,l,o,c){const f=o.createTracker(c);let m=f.move("[^");const h=o.enter("footnoteDefinition"),y=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
|
|
371
|
+
`:" ")+o.indentLines(o.containerFlow(a,f.current()),t?GE:nF))),h(),m}}function nF(e,t,n){return t===0?e:GE(e,t,n)}function GE(e,t,n){return(n?"":" ")+e}const rF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];KE.peek=oF;function aF(){return{canContainEols:["delete"],enter:{strikethrough:lF},exit:{strikethrough:sF}}}function iF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rF}],handlers:{delete:KE}}}function lF(e){this.enter({type:"delete",children:[]},e)}function sF(e){this.exit(e)}function KE(e,t,n,a){const l=n.createTracker(a),o=n.enter("strikethrough");let c=l.move("~~");return c+=n.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function oF(){return"~"}function uF(e){return e.length}function cF(e,t){const n=t||{},a=(n.align||[]).concat(),l=n.stringLength||uF,o=[],c=[],f=[],m=[];let h=0,y=-1;for(;++y<e.length;){const j=[],E=[];let C=-1;for(e[y].length>h&&(h=e[y].length);++C<e[y].length;){const N=dF(e[y][C]);if(n.alignDelimiters!==!1){const z=l(N);E[C]=z,(m[C]===void 0||z>m[C])&&(m[C]=z)}j.push(N)}c[y]=j,f[y]=E}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=hS(a[g]);else{const j=hS(a);for(;++g<h;)o[g]=j}g=-1;const b=[],w=[];for(;++g<h;){const j=o[g];let E="",C="";j===99?(E=":",C=":"):j===108?E=":":j===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,m[g]-E.length-C.length);const z=E+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=E.length+N+C.length,N>m[g]&&(m[g]=N),w[g]=N),b[g]=z}c.splice(1,0,b),f.splice(1,0,w),y=-1;const k=[];for(;++y<c.length;){const j=c[y],E=f[y];g=-1;const C=[];for(;++g<h;){const N=j[g]||"";let z="",L="";if(n.alignDelimiters!==!1){const D=m[g]-(E[g]||0),O=o[g];O===114?z=" ".repeat(D):O===99?D%2?(z=" ".repeat(D/2+.5),L=" ".repeat(D/2-.5)):(z=" ".repeat(D/2),L=z):L=" ".repeat(D)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(z),C.push(N),n.alignDelimiters!==!1&&C.push(L),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}k.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return k.join(`
|
|
372
|
+
`)}function dF(e){return e==null?"":String(e)}function hS(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 fF(e,t,n,a){const l=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),hF);return l(),c}function hF(e,t,n){return">"+(n?"":" ")+e}function mF(e,t){return mS(e,t.inConstruct,!0)&&!mS(e,t.notInConstruct,!1)}function mS(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 pS(e,t,n,a){let l=-1;for(;++l<n.unsafe.length;)if(n.unsafe[l].character===`
|
|
373
|
+
`&&mF(n.stack,n.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
374
|
+
`}function pF(e,t){const n=String(e);let a=n.indexOf(t),l=a,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++o>c&&(c=o):o=1,l=a+t.length,a=n.indexOf(t,l);return c}function gF(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 yF(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 vF(e,t,n,a){const l=yF(n),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(gF(e,n)){const g=n.enter("codeIndented"),b=n.indentLines(o,bF);return g(),b}const f=n.createTracker(a),m=l.repeat(Math.max(pF(o,l)+1,3)),h=n.enter("codeFenced");let y=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${c}`);y+=f.move(n.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(n.safe(e.meta,{before:y,after:`
|
|
375
|
+
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
376
|
+
`),o&&(y+=f.move(o+`
|
|
377
|
+
`)),y+=f.move(m),h(),y}function bF(e,t,n){return(n?"":" ")+e}function rv(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 xF(e,t,n,a){const l=rv(n),o=l==='"'?"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${o}`),h+=m.move(" "+l),h+=m.move(n.safe(e.title,{before:h,after:l,...m.current()})),h+=m.move(l),f()),c(),h}function wF(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 Ou(e){return"&#x"+e.toString(16).toUpperCase()+";"}function df(e,t,n){const a=Ks(e),l=Ks(t);return a===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}YE.peek=SF;function YE(e,t,n,a){const l=wF(n),o=n.enter("emphasis"),c=n.createTracker(a),f=c.move(l);let m=c.move(n.containerPhrasing(e,{after:l,before:f,...c.current()}));const h=m.charCodeAt(0),y=df(a.before.charCodeAt(a.before.length-1),h,l);y.inside&&(m=Ou(h)+m.slice(1));const g=m.charCodeAt(m.length-1),b=df(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ou(g));const w=c.move(l);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function SF(e,t,n){return n.options.emphasis||"*"}function kF(e,t){let n=!1;return tv(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,$g}),!!((!e.depth||e.depth<3)&&Gy(e)&&(t.options.setext||n))}function jF(e,t,n,a){const l=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(kF(e,n)){const y=n.enter("headingSetext"),g=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
|
|
379
|
+
`,after:`
|
|
380
|
+
`});return g(),y(),b+`
|
|
381
|
+
`+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
382
|
+
`))+1))}const c="#".repeat(l),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
383
|
+
`,...o.current()});return/^[\t ]/.test(h)&&(h=Ou(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}XE.peek=CF;function XE(e){return e.value||""}function CF(){return"<"}JE.peek=EF;function JE(e,t,n,a){const l=rv(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+l),h+=m.move(n.safe(e.title,{before:h,after:l,...m.current()})),h+=m.move(l),f()),h+=m.move(")"),c(),h}function EF(){return"!"}WE.peek=NF;function WE(e,t,n,a){const l=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const y=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=y,o(),l==="full"||!h||h!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function NF(){return"!"}eN.peek=_F;function eN(e,t,n){let a=e.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return l+a+l}function _F(){return"`"}function tN(e,t){const n=Gy(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))}nN.peek=TF;function nN(e,t,n,a){const l=rv(n),o=l==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(tN(e,n)){const y=n.stack;n.stack=[],f=n.enter("autolink");let g=c.move("<");return g+=c.move(n.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),n.stack=y,g}f=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=c.move(" "+l),h+=c.move(n.safe(e.title,{before:h,after:l,...c.current()})),h+=c.move(l),m()),h+=c.move(")"),f(),h}function TF(e,t,n){return tN(e,n)?"<":"["}rN.peek=AF;function rN(e,t,n,a){const l=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const y=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=y,o(),l==="full"||!h||h!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function AF(){return"["}function av(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 RF(e){const t=av(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 zF(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 aN(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 OF(e,t,n,a){const l=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?zF(n):av(n);const f=e.ordered?c==="."?")":".":RF(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.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),aN(n)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];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=o,l(),h}function DF(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 MF(e,t,n,a){const l=DF(n);let o=n.bulletCurrent||av(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(c-o.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),y);return m(),h;function y(g,b,w){return b?(w?"":" ".repeat(c))+g:(w?o:o+" ".repeat(c-o.length))+g}}function LF(e,t,n,a){const l=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),l(),c}const IF=If(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function UF(e,t,n,a){return(e.children.some(function(c){return IF(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function PF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}iN.peek=BF;function iN(e,t,n,a){const l=PF(n),o=n.enter("strong"),c=n.createTracker(a),f=c.move(l+l);let m=c.move(n.containerPhrasing(e,{after:l,before:f,...c.current()}));const h=m.charCodeAt(0),y=df(a.before.charCodeAt(a.before.length-1),h,l);y.inside&&(m=Ou(h)+m.slice(1));const g=m.charCodeAt(m.length-1),b=df(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ou(g));const w=c.move(l+l);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function BF(e,t,n){return n.options.strong||"*"}function $F(e,t,n,a){return n.safe(e.value,a)}function FF(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 qF(e,t,n){const a=(aN(n)+(n.options.ruleSpaces?" ":"")).repeat(FF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const lN={blockquote:fF,break:pS,code:vF,definition:xF,emphasis:YE,hardBreak:pS,heading:jF,html:XE,image:JE,imageReference:WE,inlineCode:eN,link:nN,linkReference:rN,list:OF,listItem:MF,paragraph:LF,root:UF,strong:iN,text:$F,thematicBreak:qF};function HF(){return{enter:{table:ZF,tableData:gS,tableHeader:gS,tableRow:QF},exit:{codeText:GF,table:VF,tableData:Bp,tableHeader:Bp,tableRow:Bp}}}function ZF(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 VF(e){this.exit(e),this.data.inTable=void 0}function QF(e){this.enter({type:"tableRow",children:[]},e)}function Bp(e){this.exit(e)}function gS(e){this.enter({type:"tableCell",children:[]},e)}function GF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KF(e,t){return t==="|"?t:e}function YF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,l=t.stringLength,o=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,E){return h(y(w,j,E),w.align)}function f(w,k,j,E){const C=g(w,j,E),N=h([C]);return N.slice(0,N.indexOf(`
|
|
385
|
+
`))}function m(w,k,j,E){const C=j.enter("tableCell"),N=j.enter("phrasing"),z=j.containerPhrasing(w,{...E,before:o,after:o});return N(),C(),z}function h(w,k){return cF(w,{align:k,alignDelimiters:a,padding:n,stringLength:l})}function y(w,k,j){const E=w.children;let C=-1;const N=[],z=k.enter("table");for(;++C<E.length;)N[C]=g(E[C],k,j);return z(),N}function g(w,k,j){const E=w.children;let C=-1;const N=[],z=k.enter("tableRow");for(;++C<E.length;)N[C]=m(E[C],w,k,j);return z(),N}function b(w,k,j){let E=lN.inlineCode(w,k,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function XF(){return{exit:{taskListCheckValueChecked:yS,taskListCheckValueUnchecked:yS,paragraph:WF}}}function JF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:eq}}}function yS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function WF(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 l=t.children;let o=-1,c;for(;++o<l.length;){const f=l[o];if(f.type==="paragraph"){c=f;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function eq(e,t,n,a){const l=e.children[0],o=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(c);let m=lN.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(y){return y+c}}function tq(){return[O$(),eF(),aF(),HF(),XF()]}function nq(e){return{extensions:[D$(),tF(e),iF(),YF(e),JF()]}}const rq={tokenize:uq,partial:!0},sN={tokenize:cq,partial:!0},oN={tokenize:dq,partial:!0},uN={tokenize:fq,partial:!0},aq={tokenize:hq,partial:!0},cN={name:"wwwAutolink",tokenize:sq,previous:fN},dN={name:"protocolAutolink",tokenize:oq,previous:hN},Da={name:"emailAutolink",tokenize:lq,previous:mN},ta={};function iq(){return{text:ta}}let al=48;for(;al<123;)ta[al]=Da,al++,al===58?al=65:al===91&&(al=97);ta[43]=Da;ta[45]=Da;ta[46]=Da;ta[95]=Da;ta[72]=[Da,dN];ta[104]=[Da,dN];ta[87]=[Da,cN];ta[119]=[Da,cN];function lq(e,t,n){const a=this;let l,o;return c;function c(g){return!Zg(g)||!mN.call(a,a.previous)||iv(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Zg(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(aq,y,h)(g):g===45||g===95||Tn(g)?(o=!0,e.consume(g),m):y(g)}function h(g){return e.consume(g),l=!0,m}function y(g){return o&&l&&Dn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function sq(e,t,n){const a=this;return l;function l(c){return c!==87&&c!==119||!fN.call(a,a.previous)||iv(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(rq,e.attempt(sN,e.attempt(oN,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function oq(e,t,n){const a=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&hN.call(a,a.previous)&&!iv(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(Dn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||of(g)||Ct(g)||wl(g)||Df(g)?n(g):e.attempt(sN,e.attempt(oN,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function uq(e,t,n){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function cq(e,t,n){let a,l,o;return c;function c(h){return h===46||h===95?e.check(uN,m,f)(h):h===null||Ct(h)||wl(h)||h!==45&&Df(h)?m(h):(o=!0,e.consume(h),c)}function f(h){return h===95?a=!0:(l=a,a=void 0),e.consume(h),c}function m(h){return l||a||!o?n(h):t(h)}}function dq(e,t){let n=0,a=0;return l;function l(c){return c===40?(n++,e.consume(c),l):c===41&&a<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(uN,t,o)(c):c===null||Ct(c)||wl(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&a++,e.consume(c),l}}function fq(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),l):f===60||f===null||Ct(f)||wl(f)?t(f):n(f)}function l(f){return f===null||f===40||f===91||Ct(f)||wl(f)?t(f):a(f)}function o(f){return Dn(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):Dn(f)?(e.consume(f),c):n(f)}}function hq(e,t,n){return a;function a(o){return e.consume(o),l}function l(o){return Tn(o)?n(o):t(o)}}function fN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ct(e)}function hN(e){return!Dn(e)}function mN(e){return!(e===47||Zg(e))}function Zg(e){return e===43||e===45||e===46||e===95||Tn(e)}function iv(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 mq={tokenize:Sq,partial:!0};function pq(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:bq,continuation:{tokenize:xq},exit:wq}},text:{91:{name:"gfmFootnoteCall",tokenize:vq},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:gq,resolveTo:yq}}}}function gq(e,t,n){const a=this;let l=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][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=Ir(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function yq(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)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function vq(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||Ct(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(Ir(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Ct(g)||(c=!0),o++,e.consume(g),g===92?y:h}function y(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function bq(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||Ct(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Ir(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Ct(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(o)||l.push(o),ut(e,w,"gfmFootnoteDefinitionWhitespace")):n(k)}function w(k){return t(k)}}function xq(e,t,n){return e.check(ec,t,e.attempt(mq,t,n))}function wq(e){e.exit("gfmFootnoteDefinition")}function Sq(e,t,n){const a=this;return ut(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function kq(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:l};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(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 y={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&ur(b,b.length,0,Mf(w,c.slice(h+1,m),f)),ur(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),ur(c,h-1,m-h+3,b),m=h+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,y=this.events;let g=0;return b;function b(k){return h===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const j=Ks(h);if(k===126)return g>1?m(k):(c.consume(k),g++,w);if(g<2&&!n)return m(k);const E=c.exit("strikethroughSequenceTemporary"),C=Ks(k);return E._open=!C||C===2&&!!j,E._close=!j||j===2&&!!C,f(k)}}}class jq{constructor(){this.map=[]}add(t,n,a){Cq(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let l=a.pop();for(;l;){for(const o of l)t.push(o);l=a.pop()}this.map.length=0}}function Cq(e,t,n,a){let l=0;if(!(n===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=n,e.map[l][2].push(...a);return}l+=1}e.map.push([t,n,a])}}function Eq(e,t){let n=!1;const a=[];for(;t<e.length;){const l=e[t];if(n){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function Nq(){return{flow:{null:{name:"table",tokenize:_q,resolveAll:Tq}}}}function _q(e,t,n){const a=this;let l=0,o=0,c;return f;function f(F){let J=a.events.length-1;for(;J>-1;){const he=a.events[J][1].type;if(he==="lineEnding"||he==="linePrefix")J--;else break}const ee=J>-1?a.events[J][1].type:null,ye=ee==="tableHead"||ee==="tableRow"?O:m;return ye===O&&a.parser.lazy[a.now().line]?n(F):ye(F)}function m(F){return e.enter("tableHead"),e.enter("tableRow"),h(F)}function h(F){return F===124||(c=!0,o+=1),y(F)}function y(F){return F===null?n(F):Oe(F)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),w):n(F):tt(F)?ut(e,y,"whitespace")(F):(o+=1,c&&(c=!1,l+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(F)))}function g(F){return F===null||F===124||Ct(F)?(e.exit("data"),y(F)):(e.consume(F),F===92?b:g)}function b(F){return F===92||F===124?(e.consume(F),g):g(F)}function w(F){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(F):(e.enter("tableDelimiterRow"),c=!1,tt(F)?ut(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):k(F))}function k(F){return F===45||F===58?E(F):F===124?(c=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),j):D(F)}function j(F){return tt(F)?ut(e,E,"whitespace")(F):E(F)}function E(F){return F===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),C):F===45?(o+=1,C(F)):F===null||Oe(F)?L(F):D(F)}function C(F){return F===45?(e.enter("tableDelimiterFiller"),N(F)):D(F)}function N(F){return F===45?(e.consume(F),N):F===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),z):(e.exit("tableDelimiterFiller"),z(F))}function z(F){return tt(F)?ut(e,L,"whitespace")(F):L(F)}function L(F){return F===124?k(F):F===null||Oe(F)?!c||l!==o?D(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):D(F)}function D(F){return n(F)}function O(F){return e.enter("tableRow"),M(F)}function M(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),M):F===null||Oe(F)?(e.exit("tableRow"),t(F)):tt(F)?ut(e,M,"whitespace")(F):(e.enter("data"),U(F))}function U(F){return F===null||F===124||Ct(F)?(e.exit("data"),M(F)):(e.consume(F),F===92?X:U)}function X(F){return F===92||F===124?(e.consume(F),U):U(F)}}function Tq(e,t){let n=-1,a=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,y,g;const b=new jq;for(;++n<e.length;){const w=e[n],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(vS(b,t,m,h,y),y=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,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(n,0,[["enter",y,t]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=Md(b,t,o,l,void 0,g),o=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=Md(b,t,o,l,void 0,g)),o=c,c=[o[1],n,0,0])):k.type==="tableHead"?(f=!0,m=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=Md(b,t,o,l,n,g)):c[1]!==0&&(g=Md(b,t,c,l,n,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&vS(b,t,m,h,y),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=Eq(t.events,n))}return e}function Md(e,t,n,a,l,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},ws(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=ws(t.events,n[1]);if(o={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=ws(t.events,n[2]),y=ws(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,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",g,t]])}return l!==void 0&&(o.end=Object.assign({},ws(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function vS(e,t,n,a,l){const o=[],c=ws(t.events,n);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function ws(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const Aq={name:"tasklistCheck",tokenize:zq};function Rq(){return{text:{91:Aq}}}function zq(e,t,n){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return Ct(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 Oe(m)?t(m):tt(m)?e.check({tokenize:Oq},t,n)(m):n(m)}}function Oq(e,t,n){return ut(e,a,"whitespace");function a(l){return l===null?n(l):t(l)}}function Dq(e){return jE([iq(),pq(),kq(e),Nq(),Rq()])}const Mq={};function Lq(e){const t=this,n=e||Mq,a=t.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(Dq(n)),o.push(tq()),c.push(nq(n))}function pN({children:e,className:t}){return u.jsx("div",{className:Ae("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:u.jsx(w$,{remarkPlugins:[Lq,z$],children:e})})}function Iq({value:e,baseline:t,onChange:n,onRevert:a,disabled:l}){const[o,c]=x.useState(!1),f=x.useRef(null),m=e!==t;return x.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),u.jsxs(sn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[u.jsxs(Ar,{children:[u.jsxs(Rr,{children:["System prompt append",m&&u.jsx(Uq,{})]}),!o&&!l&&u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[u.jsx(Qu,{className:"h-3 w-3"})," Edit"]})]}),u.jsx(ea,{children:o?u.jsxs("div",{className:"space-y-2",children:[u.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}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(me,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),u.jsx(me,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),u.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."})]}):u.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?u.jsx(pN,{children:e}):u.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function Uq(){return u.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 gN={"claude-code":"Claude Code",codex:"Codex"},Pq=[rf.CLAUDE_CODE,rf.CODEX];function Bq({open:e,onOpenChange:t,agent:n}){const a=dn(),l=n.clientId,o=n.runtimeProvider,[c,f]=x.useState(l),[m,h]=x.useState(o),[y,g]=x.useState(!1),w=He({queryKey:["clients-rebind"],queryFn:Ra,enabled:e}).data??[],k=jT({queries:w.map(U=>({queryKey:["client-capabilities",U.id],queryFn:()=>by(U.id),enabled:e}))}),j=x.useMemo(()=>{const U=new Map;return k.forEach((X,F)=>{const J=w[F];if(!J)return;const ee=X.data;ee!=null&&ee.capabilities&&U.set(J.id,ee.capabilities)}),U},[k,w]);x.useEffect(()=>{e||(f(l),h(o),g(!1))},[e,l,o]);const E=c?j.get(c)??null:null,C=(E==null?void 0:E[m])??null,N=!C||C.state==="missing"||C.state==="error",z=!!c&&(c!==l||m!==o)&&(!N||y),L=m!==o,D=c!==l,O=wt({mutationFn:()=>{if(!c)throw new Error("clientId required");return GD(n.uuid,{clientId:c,runtimeProvider:m,force:N&&y?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),M=O.error instanceof Vu||O.error instanceof Error?O.error.message:null;return u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{className:"max-w-lg",children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Re-bind agent"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",u.jsx("span",{className:"mono",children:Fq(l,w,o)})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{children:"Computer"}),u.jsx("select",{value:c??"",onChange:U=>f(U.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(U=>u.jsx("option",{value:U.id,children:$q(U)},U.id))})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{children:"Runtime"}),u.jsx("div",{className:"space-y-2",children:Pq.map(U=>{const X=(E==null?void 0:E[U])??null,F=!!X&&X.state!=="missing",J=m===U;return u.jsxs("label",{className:J?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":F?"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:[u.jsx("input",{type:"radio",name:"rebind-runtime",checked:J,onChange:()=>h(U),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:gN[U]}),u.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:Hq(X,U)})]})]},U)})})]}),(D||L)&&u.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[u.jsxs("p",{children:[u.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),L&&u.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),N&&u.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[u.jsx("input",{type:"checkbox",checked:y,onChange:U=>g(U.target.checked),className:"mt-0.5"}),u.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."})]}),M&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:M})]}),u.jsxs(tn,{children:[u.jsx(me,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),u.jsx(me,{onClick:()=>O.mutate(),disabled:!z||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function $q(e){return`${e.hostname??e.id} · ${e.status}`}function Fq(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${gN[n]}`}const qq={"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 Hq(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. ${qq[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const Zq={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function Vq(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return u.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:u.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx(Xr,{state:"blocked",size:8}),u.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),u.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),u.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>u.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:Zq[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&u.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[u.jsx(cr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&u.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&u.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),u.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&u.jsx(me,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),u.jsx(me,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),u.jsx(me,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?u.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[u.jsx(YR,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function Su(e){return`agent-cfg-${e}`}function hu({anchorId:e,title:t,caption:n,right:a,children:l,className:o,sectionProps:c}){return u.jsxs("section",{id:e,className:Ae("space-y-3",o),...c,children:[u.jsxs("div",{className:"flex items-end justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&u.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),u.jsx("div",{className:"space-y-3",children:l})]})}function Qq(){return u.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const Gq={"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 Kq(e){const t=Gq[e.runtimeProvider];return u.jsxs("div",{className:"space-y-3",children:[u.jsx(Yq,{name:t.name,caption:t.caption,locked:!0}),u.jsx(Xq,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function Yq({name:e,caption:t,locked:n}){return u.jsxs(sn,{children:[u.jsx(Ar,{children:u.jsxs(Rr,{children:["Where it runs",n&&u.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[u.jsx(Uk,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),u.jsxs(ea,{className:"space-y-1 text-body",children:[u.jsxs("div",{className:"inline-flex items-center gap-2",children:[u.jsx(Pk,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),u.jsx("span",{className:"font-medium",children:e})]}),u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function Xq(e){const t=!!e.computerLabel;return u.jsxs(sn,{children:[u.jsxs(Ar,{children:[u.jsx(Rr,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&u.jsxs(me,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[u.jsx(xg,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&u.jsxs(me,{size:"xs",variant:"outline",onClick:e.onRebind,children:[u.jsx(xg,{className:"h-3 w-3"}),"Re-bind"]})]}),u.jsx(ea,{className:"text-body",children:t?u.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):u.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 Jq(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 Wq(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function e7(e,t){return JSON.stringify(e)===JSON.stringify(t)}function $p(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function bS(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:e7(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Fp(e,t){const n=e;return{add:a=>t(l=>{const o=l[e],c=new Set(o.map(h=>h.key)),f=Wq(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...l,[e]:bS(m)}}),update:(a,l)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:l}:m);return{...o,[e]:bS(f)}}),remove:a=>t(l=>{const c=l[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...l,[e]:c}}),undo:a=>t(l=>{const c=l[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...l,[e]:c}})}}function t7(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:$p(e.payload.mcpServers,"mcp"),env:$p(e.payload.env,"env"),git:$p(e.payload.gitRepos,"git")}}function n7(e){const[t,n]=x.useState(null);x.useEffect(()=>{e&&t===null&&n(t7(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},l=(e==null?void 0:e.payload.prompt.append)??"",o=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==l,f=a.model!==o,m=x.useMemo(()=>{const z=[],L=U=>U.reduce((X,F)=>F.status==="unchanged"?X:X+1,0),D=L(a.mcp),O=L(a.env),M=L(a.git);return c&&z.push("prompt"),f&&z.push("model"),D>0&&z.push("mcp"),O>0&&z.push("env"),M>0&&z.push("git"),{anyDirty:z.length>0,dirtySections:z,counts:{prompt:c?1:0,model:f?1:0,mcp:D,env:O,git:M}}},[a,c,f]),h=x.useCallback(z=>{n(L=>L&&z(L))},[]),y=x.useCallback(z=>h(L=>({...L,promptAppend:z})),[h]),g=x.useCallback(()=>h(z=>({...z,promptAppend:l})),[h,l]),b=x.useCallback(z=>h(L=>({...L,model:z})),[h]),w=x.useCallback(()=>h(z=>({...z,model:o})),[h,o]),k=x.useMemo(()=>Fp("mcp",h),[h]),j=x.useMemo(()=>Fp("env",h),[h]),E=x.useMemo(()=>Fp("git",h),[h]),C=x.useCallback(()=>{n(null)},[]),N=x.useCallback(()=>{if(!t||!e)return{};const z={};c&&(z.prompt={append:t.promptAppend}),f&&(z.model=t.model);const L=m.counts.mcp>0,D=m.counts.env>0,O=m.counts.git>0;return L&&(z.mcpServers=t.mcp.filter(M=>M.status!=="deleted").map(M=>M.value)),D&&(z.env=t.env.filter(M=>M.status!=="deleted").map(M=>{const U=M.value;return U.sensitive&&U.value===af?{key:U.key,value:af,sensitive:!0}:U})),O&&(z.gitRepos=t.git.filter(M=>M.status!=="deleted").map(M=>M.value)),z},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:y,revertPrompt:g,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:E.add,updateGit:E.update,deleteGit:E.remove,undoDeleteGit:E.undo,resetAll:C,buildPayloadPatch:N}}const Nn={overview:"ad-overview",setup:"ad-setup",prompt:Su("prompt"),tools:Su("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function r7(e){const t=[{key:"overview",label:"Profile",anchor:Nn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Nn.setup},{key:"prompt",label:"Prompt",anchor:Nn.prompt},{key:"tools",label:"Tools",anchor:Nn.tools},{key:"advanced",label:"Advanced",anchor:Nn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Nn.danger,divider:!0,danger:!0}),t}function a7(){var gn,ht,zr,Ln,nc,Li,Ii,Ui,Pr,Pi,Ia,rc;const t=Sk().uuid??"",n=fn(),a=dn(),l=He({queryKey:["agent",t],queryFn:()=>tC(t),enabled:!!t}),o=He({queryKey:["agent-config",t],queryFn:()=>DU(t),enabled:!!t&&((gn=l.data)==null?void 0:gn.type)!=="human"}),c=He({queryKey:["agent-client-status",t],queryFn:()=>IU(t),enabled:!!t&&((ht=l.data)==null?void 0:ht.type)!=="human"}),f=He({queryKey:["agent-sessions-active",t],queryFn:()=>eo(t,{state:"active"}),enabled:!!t&&((zr=l.data)==null?void 0:zr.type)!=="human"}),m=He({queryKey:["clients"],queryFn:Ra,enabled:!!t&&((Ln=l.data)==null?void 0:Ln.type)!=="human",refetchInterval:3e4}),h=n7(o.data),[y,g]=x.useState(null),[b,w]=x.useState(null),[k,j]=x.useState(!1),E=wt({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const Se=h.buildPayloadPatch();return MU(t,{expectedVersion:o.data.version,payload:Se})},onSuccess:Se=>{a.setQueryData(["agent-config",t],Se),g(null),w(null),j(!0)},onError:Se=>{if(j(!1),Se instanceof Vu&&Se.status===409){w("Someone else saved a newer version while you were editing."),g(null);return}g(Se instanceof Error?Se.message:String(Se))}});x.useEffect(()=>{if(!k)return;const Se=setTimeout(()=>j(!1),2500);return()=>clearTimeout(Se)},[k]),x.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const C=x.useCallback(()=>{w(null),g(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),N=x.useCallback(Se=>{const Je=document.getElementById(Se);Je&&Je.scrollIntoView({behavior:"smooth",block:"start"})},[]),z=wt({mutationFn:Se=>W1(t,Se),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),L=wt({mutationFn:()=>YD(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),D=wt({mutationFn:()=>XD(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),O=wt({mutationFn:()=>KD(t),onSuccess:()=>n("/agents")}),M=wt({mutationFn:()=>JD(t)}),[U,X]=x.useState(!1),[F,J]=x.useState(""),[ee,ye]=x.useState(null),[he,ne]=x.useState(!1),Z=He({queryKey:["clients"],queryFn:Ra,enabled:U}),te=wt({mutationFn:Se=>W1(t,{clientId:Se}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),X(!1),J(""),ye(null)},onError:Se=>ye(Se instanceof Error?Se.message:String(Se))}),[ie,ue]=x.useState(!1),[A,P]=x.useState(null),B=wt({mutationFn:()=>LU(t,h.buildPayloadPatch()),onSuccess:Se=>{const Je=Se.diff.length?Se.diff.map(yn=>`${yn.op} ${yn.path}`).join(`
|
|
386
|
+
`):"(no changes)";P(Je)},onError:Se=>P(`Dry run failed: ${Se instanceof Error?Se.message:String(Se)}`)});x.useEffect(()=>{if(!h.summary.anyDirty)return;const Se=Je=>{Je.preventDefault(),Je.returnValue=""};return window.addEventListener("beforeunload",Se),()=>window.removeEventListener("beforeunload",Se)},[h.summary.anyDirty]);const T=((nc=l.data)==null?void 0:nc.type)==="human",q=x.useMemo(()=>r7(T),[T]),K=x.useRef(null),[ce,xe]=x.useState(!1);x.useEffect(()=>{if(T)return;const Se=K.current;if(!Se||typeof IntersectionObserver>"u")return;const Je=new IntersectionObserver(yn=>{const ra=yn[0];ra&&xe(!ra.isIntersecting&&ra.boundingClientRect.top<0)},{threshold:0});return Je.observe(Se),()=>Je.disconnect()},[T]);const[we,pe]=x.useState(Nn.overview);x.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const Se=[];for(const Je of q){const yn=document.getElementById(Je.anchor);if(!yn)continue;const ra=new IntersectionObserver(fo=>{for(const ac of fo)ac.isIntersecting&&pe(Je.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});ra.observe(yn),Se.push(ra)}return()=>{for(const Je of Se)Je.disconnect()}},[q]);const Xe=x.useMemo(()=>{const Se=new Set;for(const Je of h.summary.dirtySections)Je==="prompt"&&Se.add(Nn.prompt),Je==="model"&&Se.add(Nn.setup),Je==="mcp"&&Se.add(Nn.tools),(Je==="env"||Je==="git")&&Se.add(Nn.advanced);return Se},[h.summary.dirtySections]);if(l.isLoading)return u.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:u.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(l.error)return u.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",l.error instanceof Error?l.error.message:"Unknown error"]});const Le=l.data;if(!Le)return u.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const re=Le.type==="human",Ee=c.data,Ie=((Li=f.data)==null?void 0:Li.length)??0,Pe=!re&&!(Ee!=null&&Ee.clientId),Lt=!re&&Ee?!Ee.online&&!!Ee.clientId:!1,hn=Le,_l=hn.runtimeState??null,Ma=hn.runtimeType??null,La=hn.totalSessions??null,na=Le.uuid.slice(0,8),oo=Jq({activeSessions:Ie,isUnclaimed:Pe,isOffline:Lt}),uo=h.draft.mcp.filter(Se=>Se.status!=="deleted"),mn=h.draft.env.filter(Se=>Se.status!=="deleted"),co=h.draft.git.filter(Se=>Se.status!=="deleted"),le=Se=>new Set(uo.filter(Je=>Je.key!==Se).map(Je=>Je.value.name.toLowerCase())),be=Se=>new Set(mn.filter(Je=>Je.key!==Se).map(Je=>Je.value.key)),Ue=Se=>new Set(co.filter(Je=>Je.key!==Se).map(Je=>{const{value:yn}=Je;return yn.localPath?yn.localPath:((yn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),$e={sessions:La??"—",active:Ie,runtime:Ma??(re?"human":"—"),model:((Ui=(Ii=o.data)==null?void 0:Ii.payload.model)==null?void 0:Ui.trim())||"—"},at=(Ee==null?void 0:Ee.clientId)??null,pn=at?((Pr=m.data)==null?void 0:Pr.find(Se=>Se.id===at))??null:null,fr=at?(pn==null?void 0:pn.hostname)??at:null,nn=Le.runtimeProvider??"claude-code",Zt=nn==="codex"?"Codex":"Claude Code";return u.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[u.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:[u.jsx(Xu,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),q.map(Se=>u.jsxs("div",{children:[Se.divider&&u.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),u.jsx(i7,{label:Se.label,active:we===Se.anchor,danger:Se.danger??!1,dirty:Xe.has(Se.anchor),onClick:()=>N(Se.anchor)})]},Se.key))]}),u.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[u.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[u.jsxs(UU,{style:{marginBottom:"var(--sp-2)"},children:[u.jsx(PU,{onClick:()=>n("/agents"),children:"Agents"}),u.jsx(BU,{}),u.jsx($U,{mono:!0,children:Le.name??na})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.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:u.jsx(to,{width:18,height:20,style:{color:"var(--accent)"}})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-baseline gap-2",children:[u.jsx("span",{className:"text-title",title:`agt_${na}`,children:Le.displayName}),u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Le.name??na]})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[u.jsx(kn,{tone:Le.type==="autonomous_agent"?"accent":"neutral",children:Le.type}),Le.visibility&&u.jsx(kn,{tone:Le.visibility==="organization"?"accent":"outline",children:Le.visibility}),(Ee==null?void 0:Ee.offlineSince)&&u.jsxs("span",{className:"mono",children:["offline since ",Ni(Ee.offlineSince)]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx(Gs,{state:_l}),u.jsxs(me,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Le.uuid}`),children:[u.jsx(py,{className:"h-3 w-3"})," Open chat"]}),!re&&Le.status==="active"&&u.jsxs(me,{variant:"outline",size:"xs",onClick:()=>{M.reset(),M.mutate()},disabled:M.isPending,children:[u.jsx(Pk,{className:"h-3 w-3"}),M.isPending?"Testing…":"Test"]})]})]}),u.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[u.jsx(Rd,{label:"sessions",value:$e.sessions}),u.jsx(Rd,{label:"active",value:$e.active,accent:typeof $e.active=="number"&&$e.active>0?"var(--accent)":void 0}),u.jsx(Rd,{label:"runtime",value:$e.runtime}),u.jsx(Rd,{label:"model",value:$e.model})]})]}),u.jsx("div",{ref:K,"aria-hidden":!0,style:{height:0}}),!re&&u.jsx(qU,{runtimeLabel:Zt,computerLabel:fr,visible:ce}),u.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:[(M.data||M.error)&&u.jsx(d7,{result:M.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>M.reset()}),u.jsx(hu,{anchorId:Nn.overview,title:"Profile",right:u.jsxs(me,{variant:"outline",size:"xs",onClick:()=>n(`/settings?agent=${Le.uuid}`),title:"Manage platform bindings in Settings",children:[u.jsx(xg,{className:"h-3 w-3"}),"Manage bindings"]}),children:u.jsx(JU,{agent:Le,onSave:async Se=>{await z.mutateAsync(Se)}})}),!re&&u.jsxs(u.Fragment,{children:[u.jsxs(hu,{anchorId:Nn.setup,title:"Setup",caption:((Pi=o.data)==null?void 0:Pi.version)!=null?u.jsxs("span",{className:"mono",children:["config v",o.data.version,h.summary.anyDirty&&u.jsxs(u.Fragment,{children:[" · ",u.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[o.isLoading&&u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),o.error&&u.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(o.error)]}),o.data&&u.jsx(Kq,{runtimeProvider:nn,computerLabel:fr,canBindComputer:Pe&&Le.status==="active",bindComputerPending:te.isPending,onBindComputer:()=>X(!0),onRebind:Le.clientId?()=>ne(!0):void 0,modelSlot:u.jsx(uP,{value:h.draft.model,baseline:((Ia=o.data)==null?void 0:Ia.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Le.status!=="active",provider:nn})})]}),u.jsx(hu,{anchorId:Nn.prompt,title:"Prompt",children:o.data?u.jsx(Iq,{value:h.draft.promptAppend,baseline:((rc=o.data)==null?void 0:rc.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Le.status!=="active"}):null}),u.jsx(hu,{anchorId:Nn.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?u.jsx(tP,{items:h.draft.mcp,otherNames:le,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Le.status!=="active"}):null}),u.jsx(hu,{anchorId:Nn.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:o.data&&u.jsxs("div",{className:"space-y-4",children:[u.jsx("div",{id:Su("env"),children:u.jsx(GU,{items:h.draft.env,otherKeys:be,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Le.status!=="active"})}),u.jsx("div",{id:Su("git"),children:u.jsx(YU,{items:h.draft.git,otherPaths:Ue,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Le.status!=="active"})}),A&&u.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:A}),h.summary.anyDirty&&u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:u.jsx("button",{type:"button",onClick:()=>B.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:B.isPending,children:B.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),u.jsx(Qq,{}),u.jsx(HU,{agent:Le,suspendPending:L.isPending,reactivatePending:D.isPending,deletePending:O.isPending,onSuspend:()=>L.mutate(),onReactivate:()=>D.mutate(),onDelete:()=>O.mutate()})]}),!re&&u.jsx(Vq,{summary:h.summary,saveHint:oo,conflictMessage:b,errorMessage:y,saving:E.isPending,justSaved:k,onSave:()=>E.mutate(),onDiscard:()=>{h.summary.anyDirty&&ue(!0)},onReloadRemote:C,onJumpTo:Se=>N(Su(Se))})]}),u.jsx(l7,{open:ie,onOpenChange:ue,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),g(null),w(null),ue(!1)}}),u.jsx($t,{open:U,onOpenChange:Se=>{X(Se),Se||(J(""),ye(null),te.reset())},children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Bind computer"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),Z.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):Z.error?u.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",Z.error instanceof Error?Z.error.message:"Unknown"]}):u.jsx(s7,{clients:Z.data??[],selected:F,onSelect:J}),ee&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ee})]}),u.jsxs(tn,{children:[u.jsx(me,{variant:"outline",onClick:()=>X(!1),children:"Cancel"}),u.jsx(me,{disabled:!F||te.isPending,onClick:()=>{ye(null),te.mutate(F)},children:te.isPending?"Binding…":"Bind"})]})]})}),u.jsx(Bq,{open:he,onOpenChange:ne,agent:Le})]})}function i7({label:e,active:t,danger:n,dirty:a,onClick:l}){return u.jsx("button",{type:"button",onClick:l,className:Ae("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:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"flex-1 truncate",children:e}),a&&u.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&&u.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 l7(e){return u.jsx($t,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:e.title})}),u.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(me,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function s7({clients:e,selected:t,onSelect:n}){const a=e.filter(l=>l.status==="connected");return a.length===0?u.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"," ",u.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."]}):u.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(l=>{const o=l.id===t,c=l.status==="online"||l.status==="active";return u.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:u.jsxs("button",{type:"button",onClick:()=>n(l.id),className:Ae("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[u.jsx("span",{className:Ae("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),u.jsxs("span",{className:"flex-1 min-w-0",children:[u.jsx("span",{className:"block text-body truncate font-medium",children:l.hostname??l.id}),u.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[l.id,l.os?` · ${l.os}`:"",l.sdkVersion?` · SDK ${l.sdkVersion}`:""]})]}),u.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:l.status})]})},l.id)})})}const o7={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},u7={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},c7={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function d7({result:e,onDismiss:t}){const n=u7[e.status],a=c7[e.status],l=e.connection;return u.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:u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(kn,{tone:a,children:o7[e.status]}),e.responseTime!=null&&u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),l&&u.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[u.jsx("div",{children:l.runtimeState&&u.jsxs("span",{className:"mono",children:["runtime: ",l.runtimeState]})}),l.client?u.jsxs("div",{children:["Computer: ",l.client.hostname??l.client.id,l.client.os&&` (${l.client.os})`,l.client.sdkVersion&&` · SDK ${l.client.sdkVersion}`]}):u.jsx("div",{children:"No computer bound"}),l.lastSeenAt&&u.jsxs("div",{children:["Last seen: ",new Date(l.lastSeenAt).toLocaleString()]})]}),e.responseContent&&u.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})]}),u.jsx(me,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function f7(e){return/^[A-Za-z0-9_./:=-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function h7({agent:e,open:t,onClose:n,onBound:a}){var g;const[l,o]=x.useState(!1),c=He({queryKey:["connect-token",e.uuid],queryFn:()=>nj(),enabled:t,staleTime:6e4}),f=He({queryKey:["agent-poll",e.uuid],queryFn:()=>tC(e.uuid),enabled:t&&!e.clientId,refetchInterval:2e3});x.useEffect(()=>{const b=f.data;b!=null&&b.clientId&&a(b)},[f.data,a]);const m=((g=c.data)==null?void 0:g.command)??"",h=m&&e.name?`npm install -g @agent-team-foundation/first-tree-hub && first-tree-hub agent add ${f7(e.name)} --agent-id ${e.uuid} && `+m:m;function y(){h&&(navigator.clipboard.writeText(h),o(!0),setTimeout(()=>o(!1),2e3))}return u.jsx($t,{open:t,onOpenChange:b=>!b&&n(),children:u.jsxs(zt,{className:"max-w-lg",children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Last step — connect your computer"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("p",{className:"text-body text-muted-foreground",children:"Open a terminal on your computer and run this command. It installs the First Tree Hub CLI, signs your computer in, and keeps it online in the background."}),u.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border bg-muted p-3",children:[u.jsx("code",{className:"flex-1 text-caption font-mono break-all select-all",children:h||"Generating command…"}),u.jsx(me,{variant:"outline",size:"icon",className:"shrink-0",onClick:y,disabled:!h,children:l?u.jsx(cr,{className:"h-4 w-4",style:{color:"var(--state-idle)"}}):u.jsx(vf,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"flex items-center gap-2 text-body text-muted-foreground",children:[u.jsx(Xr,{state:"working",size:8}),u.jsx("span",{children:"Waiting for your computer to connect…"})]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"The command is good for 10 minutes. After it runs once, your computer stays online automatically — no need to keep this terminal open."})]}),u.jsx(tn,{children:u.jsx(me,{variant:"outline",onClick:n,children:"Skip for now"})})]})})}function Vg(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,js)}const qp=200;function m7(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const l=a.path[0];if(typeof l=="string"&&n.includes(l)){const o=l;t[o]||(t[o]=a.message)}else t._root=a.message}return t}function p7(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,js)}function g7(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 y7({open:e,onOpenChange:t,onCreated:n}){const a=dn(),{refreshMe:l}=qt(),[o,c]=x.useState(""),[f,m]=x.useState(""),[h,y]=x.useState(!1),[g,b]=x.useState("claude-code"),[w,k]=x.useState("form"),[j,E]=x.useState([]),[C,N]=x.useState(null),[z,L]=x.useState(!1),[D,O]=x.useState({}),[M,U]=x.useState({status:"idle"});x.useEffect(()=>{e&&(c(""),m(""),y(!1),b("claude-code"),k("form"),E([]),N(null),L(!1),O({}),U({status:"idle"}))},[e]),x.useEffect(()=>{h||m(Vg(o))},[o,h]);const X=x.useRef(0);x.useEffect(()=>{if(!e||!f){U({status:"idle"});return}if(!zg.test(f)){U({status:"bad",reason:"invalid"});return}if(Og(f)){U({status:"bad",reason:"reserved"});return}const ue=++X.current;U({status:"checking"});const A=window.setTimeout(()=>{QD(f).then(P=>{ue===X.current&&(P.available?U({status:"ok"}):U({status:"bad",reason:P.reason}))}).catch(()=>{ue===X.current&&U({status:"idle"})})},300);return()=>window.clearTimeout(A)},[f,e]);const F=wt({mutationFn:async ue=>{const A=o.trim()||f.trim()||"Untitled assistant";return VD({name:f||void 0,type:"personal_assistant",displayName:A,clientId:ue.clientId,runtimeProvider:g})},onSuccess:ue=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),l(),n(ue,g)}}),J=x.useMemo(()=>{const ue=F.error;if(!ue)return{};if(ue instanceof Vu){const A=m7(ue.issues);return Object.keys(A).length>0?A:ue.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:ue.message}}return ue instanceof Error?{_root:ue.message}:{}},[F.error]),ee=M.status==="bad"?g7(M.reason):void 0,ye={...ee?{name:ee}:{},...J,...D};function he(){const ue={};return f?f.length>js?ue.name=`Agent name must be at most ${js} characters (got ${f.length}).`:zg.test(f)?Og(f)&&(ue.name="That agent name is reserved — pick a different one."):ue.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":o.trim().length>0&&(ue.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),o.length>qp&&(ue.displayName=`Display name must be at most ${qp} characters (got ${o.length}).`),ue}async function ne(ue){var P,B;ue.preventDefault();const A=he();if(O(A),!(Object.keys(A).length>0)&&M.status!=="bad"){L(!0);try{const q=(await Ra()).filter(ce=>ce.status==="connected");if(q.length===0){F.mutate({clientId:void 0});return}if(q.length===1){F.mutate({clientId:(P=q[0])==null?void 0:P.id});return}const K=[...q].sort((ce,xe)=>xe.lastSeenAt.localeCompare(ce.lastSeenAt));E(K),N(((B=K[0])==null?void 0:B.id)??null),k("pick-computer")}catch{F.mutate({clientId:void 0})}finally{L(!1)}}}function Z(){C&&F.mutate({clientId:C})}const te=M.status==="bad",ie=o.trim().length>0&&!te&&!F.isPending&&!z;return w==="pick-computer"?u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{className:"max-w-lg",children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Choose a computer"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("p",{className:"text-body text-muted-foreground",children:["Multiple computers are online. Pick where ",u.jsx("span",{className:"font-medium",children:o||f})," ","should run:"]}),u.jsx("div",{className:"space-y-2",children:j.map(ue=>{const A=C===ue.id;return u.jsxs("label",{className:A?"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:[u.jsx("input",{type:"radio",name:"target-computer",checked:A,onChange:()=>N(ue.id),className:"mt-1"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium truncate",children:ue.hostname??ue.id}),u.jsxs("div",{className:"text-caption text-muted-foreground",children:[ue.os??"unknown OS"," · last seen ",new Date(ue.lastSeenAt).toLocaleString()]})]})]},ue.id)})}),ye.clientId&&u.jsx("p",{className:"text-body text-destructive",children:ye.clientId}),ye._root&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:ye._root})]}),u.jsxs(tn,{children:[u.jsx(me,{variant:"outline",onClick:()=>k("form"),disabled:F.isPending,children:"Back"}),u.jsx(me,{onClick:Z,disabled:!C||F.isPending,children:F.isPending?"Creating…":"Create"})]})]})}):u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{className:"max-w-lg",children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"New Agent"})}),u.jsxs("form",{onSubmit:ne,className:"space-y-5",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"new-agent-display-name",children:"Display name"}),u.jsx(jt,{id:"new-agent-display-name",value:o,onChange:ue=>{c(ue.target.value),D.displayName&&O(A=>({...A,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:qp,"aria-invalid":ye.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),u.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."}),ye.displayName&&u.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:ye.displayName})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"new-agent-name",children:"Agent name"}),u.jsxs("div",{className:"flex items-stretch",children:[u.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:"@"}),u.jsx(jt,{id:"new-agent-name",value:f,onChange:ue=>{const A=p7(ue.target.value);m(A),y(!0),D.name&&O(P=>({...P,name:void 0}))},onBlur:ue=>{const A=Vg(ue.target.value);A!==f&&m(A)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:js,"aria-invalid":ye.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),u.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"," ",js," characters. Permanent after creation."]}),f&&!ye.name&&M.status!=="idle"&&u.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."]}),ye.name&&u.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:ye.name})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{children:"Where it runs"}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("label",{className:g==="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:[u.jsx("input",{type:"radio",name:"runtime",checked:g==="claude-code",onChange:()=>b("claude-code"),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:"Claude Code"}),u.jsx("div",{className:"text-caption text-muted-foreground",children:"Anthropic's Claude Code on the bound computer. (default)"})]})]}),u.jsxs("label",{className:g==="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:[u.jsx("input",{type:"radio",name:"runtime",checked:g==="codex",onChange:()=>b("codex"),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:"Codex"}),u.jsxs("div",{className:"text-caption text-muted-foreground",children:["OpenAI Codex CLI on the bound computer. Run ",u.jsx("code",{children:"codex login"})," on the host once."]})]})]})]})]}),ye._root&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:ye._root}),u.jsx(tn,{children:u.jsx(me,{type:"submit",disabled:!ie,children:z?"Checking computers…":F.isPending?"Creating…":"Create"})})]})]})})}function yu({active:e,count:t,warn:n,className:a,children:l,style:o,...c}){return u.jsxs("button",{type:"button",className:Ae("mono inline-flex items-center gap-1 text-caption leading-[1.6]",a),style:{padding:"var(--sp-0_5) var(--sp-1_75)",borderRadius:3,border:`var(--hairline) solid ${e?"var(--border-strong)":"var(--border)"}`,background:e?"var(--bg-active)":"transparent",color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",...o},...c,children:[l,t!==void 0&&u.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}const v7=Object.values(d6);function xS(e){return[...e].sort((t,n)=>{const a=(t.displayName||t.name||"").toLowerCase(),l=(n.displayName||n.name||"").toLowerCase();return a.localeCompare(l)})}function b7(e,t){const n=t.get(e.uuid);return{runtimeState:(n==null?void 0:n.runtimeState)??null}}function vs(e,t,n){var l;let a=0;for(const o of e)((l=t.get(o.uuid))==null?void 0:l.runtimeState)===n&&a++;return a}function x7(){const e=fn(),{memberId:t}=qt(),[n,a]=x.useState(),[l,o]=x.useState(""),[c,f]=x.useState(!1),[m,h]=x.useState(null),[y,g]=x.useState("all"),[b,w]=x.useState(""),k=Cl(),j=Cy(),E=By(),{data:C,isLoading:N,error:z}=He({queryKey:["agents",n,l],queryFn:()=>Yu({limit:100,cursor:n,type:l||void 0})}),{data:L}=He({queryKey:["activity"],queryFn:Gu,refetchInterval:1e4}),D=x.useMemo(()=>{const ie=new Map;for(const ue of(L==null?void 0:L.agents)??[])ie.set(ue.agentId,ue);return ie},[L==null?void 0:L.agents]),{myAgents:O,teamAgents:M}=x.useMemo(()=>{if(!(C!=null&&C.items))return{myAgents:[],teamAgents:[]};const ie=[],ue=[];for(const A of C.items)t&&A.managerId===t?ie.push(A):ue.push(A);return{myAgents:xS(ie),teamAgents:xS(ue)}},[C,t]),U=(C==null?void 0:C.items.length)??0,X=O.length,F=M.length,J=x.useMemo(()=>((C==null?void 0:C.items)??[]).filter(ie=>{var ue;return((ue=D.get(ie.uuid))==null?void 0:ue.runtimeState)==="working"}).length,[C==null?void 0:C.items,D]),ee=x.useMemo(()=>((C==null?void 0:C.items)??[]).filter(ie=>{var A;const ue=(A=D.get(ie.uuid))==null?void 0:A.runtimeState;return ue==="blocked"||ue==="error"}).length,[C==null?void 0:C.items,D]);function ye(ie){var A;const ue=(A=D.get(ie.uuid))==null?void 0:A.runtimeState;return y==="mine"?t!=null&&ie.managerId===t:y==="running"?ue==="working":y==="attn"?ue==="blocked"||ue==="error":!0}function he(ie){if(!b.trim())return!0;const ue=b.toLowerCase(),A=ie.delegateMention?k(ie.delegateMention):"",P=E(ie.managerId);return(ie.name??"").toLowerCase().includes(ue)||ie.displayName.toLowerCase().includes(ue)||A.toLowerCase().includes(ue)||P.toLowerCase().includes(ue)}const ne=O.filter(ie=>ye(ie)&&he(ie)),Z=M.filter(ie=>ye(ie)&&he(ie));function te(ie,ue){if(f(!1),ie.clientId){e(`/?a=${ie.uuid}`);return}if(ue==="claude-code"||ue==="codex"){h(ie);return}e(`/?a=${ie.uuid}`)}return u.jsxs("div",{className:"-m-6",children:[u.jsx(Of,{title:"Agents",subtitle:U>0?u.jsxs(u.Fragment,{children:[U," total · ",X," mine · ",F," team"]}):null,right:u.jsx("div",{className:"flex items-center gap-1.5",children:u.jsxs(me,{size:"xs",onClick:()=>f(!0),children:[u.jsx(Jr,{className:"h-3 w-3"}),"New agent"]})})}),u.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[u.jsxs("div",{className:"flex items-center gap-2.5 mb-3.5",style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)"},children:[u.jsxs("div",{className:"relative",style:{width:240},children:[u.jsx(bf,{className:"absolute pointer-events-none",style:{left:8,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"},size:13}),u.jsx("input",{value:b,onChange:ie=>w(ie.target.value),placeholder:"Filter by name, delegate, owner…",className:"w-full outline-none text-body",style:{padding:"var(--sp-1_25) var(--sp-2_5) var(--sp-1_25) var(--sp-7)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]}),u.jsxs("div",{className:"flex gap-1",children:[u.jsx(yu,{active:y==="all",count:U,onClick:()=>g("all"),children:"all"}),u.jsx(yu,{active:y==="mine",count:X,onClick:()=>g("mine"),children:"mine"}),u.jsx(yu,{active:y==="running",count:J,onClick:()=>g("running"),children:"running"}),u.jsx(yu,{active:y==="attn",count:ee,warn:!0,onClick:()=>g("attn"),children:"attn"})]}),u.jsx("div",{style:{flex:1}}),u.jsxs("select",{value:l,onChange:ie=>{o(ie.target.value),a(void 0)},className:"outline-none text-label",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"},children:[u.jsx("option",{value:"",children:"all types"}),v7.map(ie=>u.jsx("option",{value:ie,children:ie},ie))]})]}),N?u.jsx("div",{className:"text-center py-8",style:{color:"var(--fg-3)"},children:"Loading…"}):z?u.jsxs("div",{className:"text-center py-8",style:{color:"var(--state-error)"},children:["Failed to load agents: ",z instanceof Error?z.message:"Unknown error"]}):u.jsxs(u.Fragment,{children:[u.jsx(wS,{title:`My agents · ${ne.length}`,agents:ne,runtimeMap:D,resolveAgentIdentity:j,resolveMemberName:E,navigate:e,showOwner:!1,emptyLabel:O.length===0?"No agents yet — create one to get started":"No agents match the current filter",breakdown:u.jsx(SS,{items:[{state:"working",count:vs(O,D,"working")},{state:"blocked",count:vs(O,D,"blocked")},{state:"error",count:vs(O,D,"error")}]}),className:"mb-4"}),M.length>0&&u.jsx(wS,{title:`Team agents · ${Z.length}`,agents:Z,runtimeMap:D,resolveAgentIdentity:j,resolveMemberName:E,navigate:e,showOwner:!0,emptyLabel:"No agents match the current filter",breakdown:u.jsx(SS,{items:[{state:"working",count:vs(M,D,"working")},{state:"blocked",count:vs(M,D,"blocked")},{state:"error",count:vs(M,D,"error")}]})})]}),(C==null?void 0:C.nextCursor)&&u.jsx("div",{className:"flex justify-end mt-4",children:u.jsx(me,{variant:"outline",size:"xs",onClick:()=>a(C.nextCursor??void 0),children:"Next page"})})]}),u.jsx(y7,{open:c,onOpenChange:f,onCreated:te}),m&&u.jsx(h7,{agent:m,open:m!==null,onClose:()=>{const ie=m.uuid;h(null),e(`/?a=${ie}`)},onBound:ie=>{h(null),e(`/?a=${ie.uuid}`)}})]})}function wS({title:e,agents:t,runtimeMap:n,resolveAgentIdentity:a,resolveMemberName:l,navigate:o,emptyLabel:c,breakdown:f,className:m,showOwner:h}){return u.jsxs(sn,{className:m,children:[u.jsx(Qs,{right:f,children:e}),t.length===0?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:c}):u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{children:"Display name"}),u.jsx(qe,{children:"Agent name"}),u.jsx(qe,{children:"Type"}),u.jsx(qe,{children:"Delegate"}),h&&u.jsx(qe,{children:"Owner"}),u.jsx(qe,{children:"Runtime"}),u.jsx(qe,{children:"Status"}),u.jsx(qe,{children:"Created"})]})}),u.jsx(xl,{children:t.map(y=>u.jsx(w7,{agent:y,runtime:b7(y,n),resolveAgentIdentity:a,resolveMemberName:l,navigate:o,showOwner:h},y.uuid))})]})]})}function SS({items:e}){const t=e.filter(n=>n.count>0);return t.length===0?null:u.jsx("span",{className:"inline-flex items-center",children:t.map((n,a)=>u.jsxs("span",{className:"inline-flex items-center",children:[a>0&&u.jsx("span",{style:{color:"var(--fg-4)",margin:"0 var(--sp-1_5)"},"aria-hidden":!0,children:"·"}),u.jsxs("span",{className:"mono inline-flex items-center gap-1 text-caption",style:{color:`var(--state-${n.state})`},children:[u.jsx("span",{"aria-hidden":!0,children:"●"}),n.count," ",n.label??n.state]})]},n.state))})}function w7({agent:e,runtime:t,resolveAgentIdentity:n,resolveMemberName:a,navigate:l,showOwner:o}){const{runtimeState:c}=t,f=c==="idle"||c==="working"||c==="blocked"||c==="error"||c==="offline",m=e.delegateMention?n(e.delegateMention):null;return u.jsxs(or,{interactive:!0,onClick:()=>l(`/agents/${e.uuid}`),children:[u.jsx(Be,{children:u.jsx("span",{className:"font-medium",children:e.displayName})}),u.jsx(Be,{children:e.name?u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",e.name]}):u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:"—"})}),u.jsx(Be,{children:u.jsx(kn,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})}),u.jsx(Be,{children:e.delegateMention?u.jsx(uE,{name:(m==null?void 0:m.name)??null,displayName:(m==null?void 0:m.displayName)??null,tone:"accent"}):u.jsx("span",{style:{color:"var(--fg-4)"},children:"—"})}),o&&u.jsx(Be,{className:"text-label",style:{color:"var(--fg-2)"},children:a(e.managerId)}),u.jsx(Be,{children:c&&f?u.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[u.jsx(Xr,{state:c,size:7}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:c})]}):u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"—"})}),u.jsx(Be,{children:u.jsx(kn,{tone:e.status==="active"?"accent":"outline",children:e.status})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ni(e.createdAt)})]})}function S7(){const{data:e}=He({queryKey:["members","user-name-map"],queryFn:Py,staleTime:3e4});return x.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.userId,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}const k7=1500;function j7({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:l="Waiting for your computer to connect…",successContent:o,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,y]=x.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),y(!0),setTimeout(()=>y(!1),k7))},b=t!==void 0?Math.max(1,Math.round(t/60)):null,w=u.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?u.jsxs(u.Fragment,{children:[e,b!==null&&u.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",b,"m"]})]}):"Generating token…"}),k=u.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?u.jsx(cr,{className:"h-3.5 w-3.5"}):u.jsx(vf,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?u.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,k]}):u.jsxs(u.Fragment,{children:[w,k]}),f&&u.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&u.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:[u.jsx(C7,{}),l]}),n==="success"&&o&&u.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:[u.jsx(cr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),u.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&c&&u.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 C7(){return u.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 E7=3e3,N7=1200;function _7({open:e,onOpenChange:t}){const n=dn(),{user:a}=qt(),[l,o]=x.useState("loading"),[c,f]=x.useState(null),[m,h]=x.useState(null),[y,g]=x.useState(null),b=x.useRef(new Set);return x.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(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 nj();if(w)return;f(j),o("waiting")}catch(j){if(w)return;h(j instanceof Error?j.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),x.useEffect(()=>{if(!e||l!=="waiting"||!a)return;const k=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:Ra}),E=b.current,C=j.find(N=>!E.has(N.id)&&N.status==="connected"&&N.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},E7);return()=>clearInterval(k)},[e,l,n,a]),x.useEffect(()=>{if(l!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},N7);return()=>clearTimeout(w)},[l,t,n]),u.jsx($t,{open:e,onOpenChange:t,children:u.jsxs(zt,{children:[u.jsxs(Gt,{children:[u.jsx(Ft,{children:"Connect a new computer"}),u.jsx(jf,{children:"Run this command on the machine you want to pair with this Hub."})]}),u.jsx(j7,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:l,successContent:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"font-semibold",children:y??"Computer"})," connected. Closing…"]}),errorContent:m}),u.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:u.jsx(me,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function T7(){const e=dn(),t=Cl(),n=S7(),{role:a}=qt(),l=a==="admin",[o,c]=x.useState(null),[f,m]=x.useState(null),[h,y]=x.useState(null),[g,b]=x.useState(null),[w,k]=x.useState(!1),{data:j}=He({queryKey:["clients"],queryFn:Ra,refetchInterval:1e4}),{data:E}=He({queryKey:["activity"],queryFn:Gu,refetchInterval:1e4}),C=wt({mutationFn:x3,onSuccess:()=>{m(null),e.invalidateQueries({queryKey:["clients"]}),e.invalidateQueries({queryKey:["activity"]})}}),N=wt({mutationFn:b3,onSuccess:()=>{y(null),b(null),e.invalidateQueries({queryKey:["clients"]}),e.invalidateQueries({queryKey:["activity"]})},onError:M=>{M instanceof Vu?b(M.message):b(M instanceof Error?M.message:String(M))}}),z=x.useMemo(()=>{const M=new Map;for(const U of(E==null?void 0:E.agents)??[]){if(!U.clientId)continue;const X=M.get(U.clientId)??[];X.push(U),M.set(U.clientId,X)}return M},[E==null?void 0:E.agents]),L=M=>z.get(M)??[],D=(j??[]).filter(M=>M.status==="connected").length,O=(j??[]).reduce((M,U)=>M+U.agentCount,0);return u.jsxs("div",{className:"-m-6",children:[u.jsx(Of,{title:"Computers",subtitle:j&&j.length>0?u.jsxs(u.Fragment,{children:[j.length," total · ",D," connected · ",O," agents bound"]}):null,right:u.jsx("div",{className:"flex items-center gap-1.5",children:u.jsxs(me,{size:"xs",onClick:()=>k(!0),children:[u.jsx(Jr,{className:"h-3 w-3"}),"New Connection"]})})}),u.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[u.jsx(_7,{open:w,onOpenChange:k}),h&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:u.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:[u.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),u.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",u.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:h.hostname??h.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)."]}),L(h.id).length>0&&u.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:[u.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),u.jsx("ul",{className:"text-body space-y-0.5",children:L(h.id).map(M=>u.jsx("li",{className:"font-medium",children:t(M.agentId)},M.agentId))})]}),g&&u.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:g}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(me,{variant:"outline",size:"sm",onClick:()=>{y(null),b(null)},children:"Cancel"}),u.jsx(me,{variant:"destructive",size:"sm",onClick:()=>N.mutate(h.id),disabled:N.isPending,children:N.isPending?"Retiring…":"Retire"})]})]})}),f&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:u.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:[u.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),u.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",u.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)})," ","and affect all bound agents:"]}),u.jsx("ul",{className:"mb-4 space-y-1",children:L(f.id).length===0?u.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):L(f.id).map(M=>u.jsxs("li",{className:"text-body flex items-center gap-2",children:[u.jsx("span",{className:"font-medium",children:t(M.agentId)}),u.jsx(Gs,{state:M.runtimeState})]},M.agentId))}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(me,{variant:"outline",size:"sm",onClick:()=>m(null),children:"Cancel"}),u.jsx(me,{variant:"destructive",size:"sm",onClick:()=>C.mutate(f.id),disabled:C.isPending,children:C.isPending?"Disconnecting…":"Disconnect"})]})]})}),!j||j.length===0?u.jsx(sn,{children:u.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers. Use the button above to generate a connect command."})}):u.jsxs(sn,{children:[u.jsxs(Qs,{right:u.jsx("span",{className:"mono text-caption normal-case tracking-normal",style:{color:"var(--fg-3)"},children:"click a row to expand"}),children:["Registered · ",j.length]}),u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{style:{width:16}}),u.jsx(qe,{children:"Hostname"}),l&&u.jsx(qe,{children:"Owner"}),u.jsx(qe,{children:"OS"}),u.jsx(qe,{children:"SDK"}),u.jsx(qe,{children:"Agents"}),u.jsx(qe,{children:"Connected"}),u.jsx(qe,{children:"Status"}),u.jsx(qe,{})]})}),u.jsx(xl,{children:j.map(M=>{const U=o===M.id,X=L(M.id);return u.jsx(M7,{client:M,boundAgents:X,isExpanded:U,agentName:t,showOwner:l,ownerName:n,onToggle:()=>c(U?null:M.id),onDisconnect:()=>m(M),onRetire:()=>{b(null),y(M)}},M.id)})})]})]})]})]})}const A7={"claude-code":"Claude Code",codex:"Codex"},R7=[rf.CLAUDE_CODE,rf.CODEX],kS={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},z7={"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 O7({clientId:e,enabled:t}){const{data:n,isLoading:a}=He({queryKey:["client-capabilities",e],queryFn:()=>by(e),enabled:t}),l=(n==null?void 0:n.capabilities)??null;return u.jsxs(u.Fragment,{children:[u.jsx(Xu,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!l?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):l&&Object.keys(l).length===0?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):u.jsx("div",{className:"flex flex-col gap-1",children:R7.map(o=>u.jsx(D7,{provider:o,entry:l?l[o]??null:null},o))})]})}function D7({provider:e,entry:t}){const n=A7[e];if(!t)return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",kS[e]]})]});switch(t.state){case"ok":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",z7[e]]})]});case"missing":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",kS[e]]})]});case"error":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function M7({client:e,boundAgents:t,isExpanded:n,agentName:a,showOwner:l,ownerName:o,onToggle:c,onDisconnect:f,onRetire:m}){const h=l?9:8,y=e.status==="connected"?"idle":"offline";return u.jsxs(u.Fragment,{children:[u.jsxs(or,{interactive:!0,selected:n,onClick:c,children:[u.jsx(Be,{style:{width:16},children:u.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?u.jsx(Lk,{className:"h-3.5 w-3.5"}):u.jsx(PR,{className:"h-3.5 w-3.5"})})}),u.jsx(Be,{className:"font-medium",children:e.hostname??"—"}),l&&u.jsx(Be,{style:{color:"var(--fg-2)"},children:o(e.userId)}),u.jsx(Be,{style:{color:"var(--fg-3)"},children:e.os??"—"}),u.jsx(Be,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),u.jsx(Be,{children:u.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?Ni(e.connectedAt):"—"}),u.jsx(Be,{children:u.jsx(Gs,{state:y})}),u.jsx(Be,{style:{width:1,whiteSpace:"nowrap"},children:u.jsxs("div",{className:"flex gap-1 justify-end",children:[u.jsxs(me,{variant:"ghost",size:"xs",className:"text-label",onClick:g=>{g.stopPropagation(),f()},children:[u.jsx(jz,{className:"h-3 w-3"})," Disconnect"]}),u.jsxs(me,{variant:"ghost",size:"xs",className:"text-label",style:{color:"var(--fg-4)"},onClick:g=>{g.stopPropagation(),m()},children:[u.jsx(Hs,{className:"h-3 w-3"})," Retire"]})]})})]}),n&&u.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[u.jsx(Be,{}),u.jsxs(Be,{colSpan:h-1,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[u.jsx(O7,{clientId:e.id,enabled:n}),u.jsxs(Xu,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),t.length===0?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No agents bound to this computer"}):u.jsx("div",{className:"flex flex-col gap-1",children:t.map(g=>u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"mono font-medium",style:{minWidth:180},children:a(g.agentId)}),u.jsx(Gs,{state:g.runtimeState}),g.activeSessions!==null&&u.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[g.activeSessions," / ",g.totalSessions??0," sessions"]})]},g.agentId))})]})]})]})}function L7(){const{token:e}=Sk(),t=fn(),{isAuthenticated:n,adoptTokens:a}=qt(),[l,o]=x.useState(null),[c,f]=x.useState(null),[m,h]=x.useState(!1),[y,g]=x.useState(null);if(x.useEffect(()=>{e&&(async()=>{try{const E=await fetch(`/api/v1/invite/${encodeURIComponent(e)}/preview`);if(!E.ok){f("This invitation is no longer valid");return}o(await E.json())}catch{f("Network error while loading invitation")}})()},[e]),x.useEffect(()=>{n&&(async()=>{try{const E=await je.get("/me/organizations"),C=await je.get("/me"),N=E.find(z=>z.id===C.member.organizationId);g((N==null?void 0:N.displayName)??null)}catch{}})()},[n]),!e)return u.jsx(jS,{message:"Bad invitation URL"});if(c)return u.jsx(jS,{message:"This invitation is no longer valid"});if(!l)return u.jsx(I7,{});const b=async()=>{h(!0);try{const E=await je.post("/me/organizations/join",{token:e});await a(E.tokens),Ok("invite"),t("/",{replace:!0})}catch(E){f(E instanceof Error?E.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&y&&y!==l.organizationDisplayName,j=U7(l.expiresAt);return u.jsx(lv,{children:u.jsxs(ro,{className:"w-full max-w-sm",children:[u.jsx(ao,{className:"text-center",children:u.jsxs(Ju,{className:"text-title",children:["You're invited to join",u.jsx("br",{}),l.organizationDisplayName]})}),u.jsxs(io,{className:"space-y-4",children:[k&&u.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[u.jsx(gy,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),u.jsxs("span",{children:["You'll switch from ",u.jsx("span",{className:"font-medium",children:y})," to"," ",u.jsx("span",{className:"font-medium",children:l.organizationDisplayName}),"."]})]}),n?u.jsx(me,{className:"w-full",disabled:m,onClick:b,children:m?"Joining…":`Join ${l.organizationDisplayName}`}):u.jsx(me,{asChild:!0,className:"w-full",children:u.jsxs("a",{href:w,children:[u.jsx(Ik,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&u.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.text}),u.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",u.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",u.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function lv({children:e}){return u.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[u.jsx("header",{className:"px-4 py-3",children:u.jsxs(Zu,{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:[u.jsx(my,{className:"h-3.5 w-3.5"}),"Back to home"]})}),u.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function I7(){return u.jsx(lv,{children:u.jsxs(ro,{className:"w-full max-w-sm",children:[u.jsxs(ao,{className:"text-center",children:[u.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),u.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),u.jsxs(io,{className:"space-y-4",children:[u.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),u.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function jS({message:e}){return u.jsx(lv,{children:u.jsxs(ro,{className:"w-full max-w-sm",children:[u.jsxs(ao,{className:"text-center",children:[u.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:u.jsx(gy,{className:"h-6 w-6"})}),u.jsx(Ju,{className:"text-title",children:e})]}),u.jsxs(io,{className:"space-y-4",children:[u.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."}),u.jsx(me,{asChild:!0,variant:"outline",className:"w-full",children:u.jsxs(Zu,{to:"/",children:[u.jsx(my,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function U7(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),l=Math.floor(a/60),o=Math.floor(l/24);return o>7?null:o>=1?{text:`Expires in ${o} ${o===1?"day":"days"}`,urgent:!1}:l>=1?{text:`Expires in ${l} ${l===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function P7(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:"",l=`${t.pathname}${n}${a}`,o=IC(l);return o===jw&&l!==jw?null:o}function B7(){const{isAuthenticated:e}=qt(),t=Mn(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=P7(t.state)??"/",l=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?u.jsx(pf,{to:a,replace:!0}):u.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[u.jsx("header",{className:"px-4 py-3",children:u.jsxs(Zu,{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:[u.jsx(my,{className:"h-3.5 w-3.5"}),"Back to home"]})}),u.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:u.jsxs(ro,{className:"w-full max-w-sm",children:[u.jsxs(ao,{className:"text-center",children:[u.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:u.jsx(to,{width:28,height:32})}),u.jsxs(Ju,{className:"text-title",children:["First Tree ",u.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),u.jsxs(io,{className:"space-y-4",children:[u.jsx(me,{asChild:!0,className:"w-full",children:u.jsxs("a",{href:l,children:[u.jsx(Ik,{className:"h-4 w-4"}),"Continue with GitHub"]})}),u.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",u.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",u.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[u.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),u.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),u.jsx(me,{asChild:!0,variant:"outline",className:"w-full",children:u.jsxs("a",{href:o,children:[u.jsx(Tz,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function $7(){const e=fn(),{adoptTokens:t}=qt(),[n,a]=x.useState(null);return x.useEffect(()=>{const l=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(l),c=o.get("access"),f=o.get("refresh"),m=IC(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&Ok(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),u.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}function F7(){return je.get("/admin/adapter-mappings")}function q7(e){return je.post("/admin/adapter-mappings",e)}function H7(e){return je.delete(`/admin/adapter-mappings/${e}`)}function Z7(){return je.get("/admin/adapters/status")}function V7(){return je.get("/admin/adapters")}function Q7(e){return je.post("/admin/adapters",e)}function G7(e,t){return je.patch(`/admin/adapters/${e}`,t)}function K7(e){return je.delete(`/admin/adapters/${e}`)}const Y7=Object.values(o6),CS={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function ES(e){const[t,n]=x.useState(CS),[a,l]=x.useState("");x.useEffect(()=>{e.open&&(n({...CS,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),l(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),l(""),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)){l("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){l("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){l("Credentials are required");return}if(h)try{JSON.parse(h)}catch{l("Invalid JSON");return}}const m=X7(t);if(!e.editingId&&!m){l("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 u.jsx($t,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:c})}),u.jsxs("form",{onSubmit:o,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"binding-platform",children:"Platform"}),u.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:Y7.map(f=>u.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"binding-ext-id",children:"External user ID"}),u.jsx(jt,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"binding-name",children:"Display name (optional)"}),u.jsx(jt,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):u.jsxs(u.Fragment,{children:[t.platform==="feishu"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs(st,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(jt,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs(st,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),u.jsx(jt,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs(st,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(jt,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs(st,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(jt,{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&&u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):u.jsxs("div",{className:"space-y-2",children:[u.jsxs(st,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),u.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&&u.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(st,{htmlFor:"binding-status",children:"Status"}),u.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:[u.jsx("option",{value:"active",children:"active"}),u.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(me,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function X7(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 J7(){var T;const e=fn(),t=dn(),[n,a]=yf(),l=n.get("agent"),o=Cl(),c=He({queryKey:["adapters"],queryFn:V7}),f=He({queryKey:["adapter-mappings"],queryFn:F7}),m=He({queryKey:["adapter-statuses"],queryFn:Z7,refetchInterval:15e3}),y=((T=He({queryKey:["agents","name-map"],queryFn:()=>Yu({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],g=x.useMemo(()=>{const q=new Map;for(const K of m.data??[])q.set(K.configId,K);return q},[m.data]),b=x.useMemo(()=>{const q=c.data??[];return l?q.filter(K=>K.agentId===l):q},[c.data,l]),w=x.useMemo(()=>{const q=f.data??[];return l?q.filter(K=>K.agentId===l):q},[f.data,l]),k=b.reduce((q,K)=>{var ce;return q+((ce=g.get(K.id))!=null&&ce.connected?1:0)},0),j=b.length-k,E=c.isLoading||f.isLoading,[C,N]=x.useState(null),[z,L]=x.useState(""),[D,O]=x.useState(null),[M,U]=x.useState(null),[X,F]=x.useState(null),[J,ee]=x.useState(null),ye=wt({mutationFn:q=>Q7({platform:q.platform,agentId:q.agentId,credentials:q.credentials,status:q.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),he=wt({mutationFn:q=>{const K={status:q.status};return q.credentials&&(K.credentials=q.credentials),G7(q.id,K)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),ne=wt({mutationFn:K7,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),Z=wt({mutationFn:q=>q7({platform:q.platform,externalUserId:q.externalUserId,agentId:q.agentId,boundVia:"manual",displayName:q.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),U(null)}}),te=wt({mutationFn:H7,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ie(q){if(l){q==="bot"?O({agentId:l,editingId:null}):U({agentId:l});return}L(""),N({kind:q})}function ue(){!C||!z||(C.kind==="bot"?O({agentId:z,editingId:null}):U({agentId:z}),N(null))}function A(q){if(D){if(q.kind==="bot-create")ye.mutate({agentId:D.agentId,platform:q.draft.platform,status:q.draft.status,credentials:q.draft.credentials});else if(q.kind==="bot-update"){if(!D.editingId)return;he.mutate({id:D.editingId,status:q.status,credentials:q.credentials})}}}function P(q){!M||q.kind!=="user-create"||Z.mutate({agentId:M.agentId,platform:q.draft.platform,externalUserId:q.draft.externalUserId,displayName:q.draft.displayName})}const B=l?y.find(q=>q.uuid===l):null;return u.jsxs(u.Fragment,{children:[u.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."}),l&&u.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[u.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),u.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:[(B==null?void 0:B.displayName)??l,u.jsx("button",{type:"button",onClick:()=>{const q=new URLSearchParams(n);q.delete("agent"),a(q,{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:u.jsx(Kd,{className:"h-3 w-3"})})]})]}),u.jsxs(sn,{className:"mb-3.5",children:[u.jsxs(Qs,{right:u.jsxs("span",{className:"inline-flex items-center gap-2",children:[u.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[u.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[u.jsx(Xr,{state:"idle",size:6})," ",k," online"]}),u.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[u.jsx(Xr,{state:"offline",size:6})," ",j," offline"]})]}),u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>ie("bot"),children:[u.jsx(Jr,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",b.length]}),E?u.jsx(Ld,{children:"Loading…"}):b.length?u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{children:"Agent"}),u.jsx(qe,{children:"Platform"}),u.jsx(qe,{children:"Status"}),u.jsx(qe,{children:"Connection"}),u.jsx(qe,{children:"Created"}),u.jsx(qe,{style:{width:96,textAlign:"right"}})]})}),u.jsx(xl,{children:b.map(q=>{var ce;const K=((ce=g.get(q.id))==null?void 0:ce.connected)??!1;return u.jsxs(or,{interactive:!0,onClick:()=>e(`/agents/${q.agentId}`),children:[u.jsx(Be,{children:u.jsx("span",{className:"mono font-medium",children:o(q.agentId)})}),u.jsx(Be,{children:u.jsx(kn,{children:q.platform})}),u.jsx(Be,{children:u.jsx(kn,{tone:q.status==="active"?"accent":"outline",children:q.status})}),u.jsx(Be,{children:u.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[u.jsx(Xr,{state:K?"idle":"offline",size:7}),u.jsx("span",{style:{color:"var(--fg-3)"},children:K?"Online":"Offline"})]})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ni(q.createdAt)}),u.jsxs(Be,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:xe=>xe.stopPropagation(),children:[u.jsx(me,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:q.agentId,editingId:q.id,initialPlatform:W7(q.platform),initialStatus:eH(q.status)}),children:"Edit"}),u.jsx(me,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>F(q.id),disabled:ne.isPending,title:"Delete",children:u.jsx(Hs,{className:"h-3.5 w-3.5"})})]})]},q.id)})})]}):u.jsx(Ld,{children:l?"No bot bindings for this agent yet.":"No bot bindings"})]}),u.jsxs(sn,{children:[u.jsxs(Qs,{right:u.jsxs(me,{size:"xs",variant:"outline",onClick:()=>ie("user"),children:[u.jsx(Jr,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),E?u.jsx(Ld,{children:"Loading…"}):w.length?u.jsxs(vl,{children:[u.jsx(bl,{children:u.jsxs(or,{children:[u.jsx(qe,{children:"Agent"}),u.jsx(qe,{children:"Platform"}),u.jsx(qe,{children:"External user ID"}),u.jsx(qe,{children:"Display name"}),u.jsx(qe,{children:"Bound via"}),u.jsx(qe,{children:"Created"}),u.jsx(qe,{style:{width:32}})]})}),u.jsx(xl,{children:w.map(q=>u.jsxs(or,{interactive:!0,onClick:()=>e(`/agents/${q.agentId}`),children:[u.jsx(Be,{children:u.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(q.agentId)})}),u.jsx(Be,{children:u.jsx(kn,{children:q.platform})}),u.jsx(Be,{children:u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:q.externalUserId})}),u.jsx(Be,{style:{color:"var(--fg-2)"},children:q.displayName??"—"}),u.jsx(Be,{children:u.jsx(kn,{tone:"outline",children:q.boundVia??"—"})}),u.jsx(Be,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ni(q.createdAt)}),u.jsx(Be,{onClick:K=>K.stopPropagation(),children:u.jsx(me,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ee(q.id),disabled:te.isPending,title:"Delete",children:u.jsx(Hs,{className:"h-3.5 w-3.5"})})})]},q.id))})]}):u.jsx(Ld,{children:l?"No user bindings for this agent yet.":"No user bindings"})]}),u.jsx(tH,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:y,agentId:z,onAgentChange:L,onCancel:()=>N(null),onConfirm:ue}),u.jsx(ES,{open:D!=null,kind:"bot",editingId:(D==null?void 0:D.editingId)??null,initialPlatform:D==null?void 0:D.initialPlatform,initialStatus:D==null?void 0:D.initialStatus,agentLabel:D?o(D.agentId):"",pending:ye.isPending||he.isPending,errorMessage:(ye.error??he.error)instanceof Error?(ye.error??he.error).message:null,onOpenChange:q=>{q||(O(null),ye.reset(),he.reset())},onSubmit:A}),u.jsx(ES,{open:M!=null,kind:"user",editingId:null,agentLabel:M?o(M.agentId):"",pending:Z.isPending,errorMessage:Z.error instanceof Error?Z.error.message:null,onOpenChange:q=>{q||(U(null),Z.reset())},onSubmit:P}),u.jsx(NS,{open:X!=null,onOpenChange:q=>!q&&F(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:ne.isPending,onConfirm:()=>{X!=null&&(ne.mutate(X),F(null))}}),u.jsx(NS,{open:J!=null,onOpenChange:q=>!q&&ee(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:te.isPending,onConfirm:()=>{J!=null&&(te.mutate(J),ee(null))}})]})}function W7(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function eH(e){return e==="inactive"?"inactive":"active"}function Ld({children:e}){return u.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function tH(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 u.jsx($t,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),u.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:[u.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>u.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),u.jsxs(tn,{children:[u.jsx(me,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),u.jsx(me,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function NS(e){return u.jsx($t,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:e.title})}),u.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(me,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function nH(){const{organizationId:e,selectOrganization:t,logout:n}=qt(),[a,l]=x.useState([]),[o,c]=x.useState(!1),[f,m]=x.useState(!1),[h,y]=x.useState(null);x.useEffect(()=>{(async()=>{try{const k=await je.get("/me/organizations");l(k)}catch{}})()},[]);const g=a.find(k=>k.id===e),b=(g==null?void 0:g.displayName)??"this team",w=async()=>{m(!0),y(null);try{await TU();const j=(await je.get("/me/organizations").catch(()=>[])).find(E=>E.id!==e);j?await t(j.id):n()}catch(k){y(k instanceof Error?k.message:"Failed to leave team"),m(!1)}};return u.jsxs(u.Fragment,{children:[u.jsxs(sn,{children:[u.jsx(Ar,{children:u.jsx(Rr,{children:"Membership"})}),u.jsxs("div",{style:{padding:"var(--sp-3) var(--sp-4) var(--sp-4)"},children:[u.jsxs("div",{className:"text-body",style:{color:"var(--fg)"},children:["You're a member of ",u.jsx("span",{className:"font-medium",children:b}),"."]}),u.jsx("div",{className:"text-label text-muted-foreground",style:{marginTop:4},children:"Leaving removes your access immediately. Your agents stay in the team for history; you can re-join later if an admin shares an invite link."}),u.jsx("div",{style:{marginTop:"var(--sp-3)"},children:u.jsx(me,{variant:"destructive",size:"sm",onClick:()=>c(!0),disabled:f,children:f?"Leaving…":"Leave team"})}),h&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:h})]})]}),u.jsx($t,{open:o,onOpenChange:k=>!f&&c(k),children:u.jsxs(zt,{children:[u.jsxs(Gt,{children:[u.jsxs(Ft,{children:["Leave ",b,"?"]}),u.jsx(jf,{children:"You'll lose access to this team's agents and chats. Your historical messages stay, but you won't be able to read or send new ones until an admin re-invites you."})]}),u.jsxs(tn,{children:[u.jsx(me,{variant:"outline",size:"sm",onClick:()=>c(!1),disabled:f,children:"Cancel"}),u.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void w(),disabled:f,children:f?"Leaving…":"Leave team"})]})]})})]})}const _S=[{key:"bindings",label:"Bindings"},{key:"membership",label:"Membership"}];function rH(){const e=Mn(),t=fn(),n=e.hash.replace("#",""),a=_S.some(o=>o.key===n)?n:"bindings",l=o=>{t({hash:o},{replace:!0})};return u.jsxs("div",{className:"-m-6",children:[u.jsx(Of,{title:"Settings",subtitle:"Per-member controls"}),u.jsx(rE,{children:_S.map(o=>u.jsx(aE,{active:a===o.key,onClick:()=>l(o.key),children:o.label},o.key))}),u.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[a==="bindings"&&u.jsx(J7,{}),a==="membership"&&u.jsx(nH,{})]})]})}function aH(e){return je.get(`/admin/chats/${encodeURIComponent(e)}`)}function iH(e,t){return je.patch(`/admin/chats/${encodeURIComponent(e)}`,{topic:t})}function TS(e,t){return je.post(`/admin/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function lH(e,t){return je.post(`/admin/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function sH(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const l=a.result;if(typeof l!="string"){n(new Error("Unexpected FileReader result"));return}const o=l.indexOf(",");t(o>=0?l.slice(o+1):l)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function yN(e){return je.post(`/admin/agents/${encodeURIComponent(e)}/chats`,{})}function oH(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 je.get(`/admin/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}const uH="first-tree-hub-images",cH=1,Ys="images";let Id=null;function vN(){return Id||(Id=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(uH,cH);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(Ys)||n.createObjectStore(Ys,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Id)}async function dH(e){const t=await vN();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const l=t.transaction(Ys,"readwrite"),o=l.objectStore(Ys),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};o.put(c),l.oncomplete=()=>n(),l.onerror=()=>a(l.error??new Error("Image storage write failed")),l.onabort=()=>a(l.error??new Error("Image storage write aborted"))})}async function fH(e){const t=await vN();return t?new Promise(n=>{const o=t.transaction(Ys,"readonly").objectStore(Ys).get(e);o.onsuccess=()=>{const c=o.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},o.onerror=()=>n(null)}):null}function hH(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const l=e[n];if(l===void 0)return null;if(l==="@")break;if(!/[A-Za-z0-9_-]/.test(l))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const l=e[n-1];if(l!==void 0&&/[A-Za-z0-9_.@-]/.test(l))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function mH(e,t){if(!t)return[...e].sort((a,l)=>(a.displayName??a.name??"").localeCompare(l.displayName??l.name??"")).slice(0,8);const n=[];for(const a of e){const l=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let c=1/0;l.startsWith(t)?c=0:o.startsWith(t)?c=1:o.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,l)=>a.score-l.score||(a.c.displayName??"").localeCompare(l.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function pH(e,t,n,a){if(!a.name)return null;const l=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${l}${c}${m}`,y=l.length+c.length+(f?1:0);return{text:h,cursor:y}}function gH({value:e,cursor:t,candidates:n,onSelect:a,disabled:l}){const[o,c]=x.useState(0),[f,m]=x.useState(null),h=x.useMemo(()=>l?null:hH(e,t),[e,t,l]),y=x.useMemo(()=>h?mH(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";x.useEffect(()=>{c(0)},[g]),x.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const b=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&y.length>0&&!b;function k(){m((h==null?void 0:h.triggerIndex)??null)}function j(C){if(!h)return;const N=pH(e,h,t,C);N&&a(N)}return{trigger:w?h:null,results:w?y:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(N=>y.length===0?0:(N+1)%y.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(N=>y.length===0?0:(N-1+y.length)%y.length),!0;if(C.key==="Enter"||C.key==="Tab"){const N=y[o]??y[0];return N?(C.preventDefault(),j(N),!0):!1}return C.key==="Escape"?(C.preventDefault(),k(),!0):!1},pick:j,dismiss:k}}function yH({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:l}){const o=x.useRef(null);return x.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!l.current?null:u.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:Ae("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,right:0,background:"var(--bg-raised)",borderColor:"var(--border)"},children:t.map((f,m)=>{const h=m===n;return u.jsxs("button",{type:"button",role:"option","aria-selected":h,"data-mention-index":m,onMouseDown:y=>{y.preventDefault(),a(f)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:h?"var(--accent-dim)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer"},children:[u.jsx("span",{className:"font-medium",children:f.displayName??(f.name?`@${f.name}`:"—")}),f.name&&f.displayName&&u.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",f.name]})]},f.agentId)})})}function bN(e,t){return t&&(e==="idle"||e==="working"||e==="blocked"||e==="error")?e:"offline"}function vH(e){let t=-1;for(const l of e)l.kind==="turn_end"&&l.seq>t&&(t=l.seq);const n=e.filter(l=>l.kind==="turn_end"?!1:l.kind==="error"?!0:l.seq>t),a=new Map;for(const l of n){if(l.kind!=="tool_call")continue;const o=AS(l.payload);if(!o)continue;const c=a.get(o)??-1;l.seq>c&&a.set(o,l.seq)}return n.filter(l=>{if(l.kind!=="tool_call")return!0;const o=AS(l.payload);return o?a.get(o)===l.seq:!0})}function AS(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Pf(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=l=>{var o;return((o=n.find(c=>c.type===l))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function xN(e){if(!e)return"—";const t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const a=Math.round(n/60);if(a<60)return`${a}m ago`;const l=Math.round(a/60);return l<24?`${l}h ago`:`${Math.round(l/24)}d ago`}function bH(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function RS(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function xH({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function wH({agentId:e,chatId:t,session:n}){const a=dn(),[,l]=yf(),[o,c]=x.useState(!1),[f,m]=x.useState(null),h=rj(e,t),y=Xd(e),g=E=>{a.setQueryData(h,C=>C&&{...C,state:E}),a.setQueryData(y,C=>C&&C.map(N=>N.chatId===t?{...N,state:E}:N))},b=wt({mutationFn:()=>C3(e,t),onMutate:async()=>{await a.cancelQueries({queryKey:h}),await a.cancelQueries({queryKey:y});const E=a.getQueryData(h),C=a.getQueryData(y);return g("suspended"),{previousSession:E,previousList:C}},onError:(E,C,N)=>{N!=null&&N.previousSession&&a.setQueryData(h,N.previousSession),N!=null&&N.previousList&&a.setQueryData(y,N.previousList)},onSuccess:E=>{g(E.state)}}),w=wt({mutationFn:()=>E3(e,t),onMutate:async()=>{await a.cancelQueries({queryKey:h}),await a.cancelQueries({queryKey:y});const E=a.getQueryData(h),C=a.getQueryData(y);return a.setQueryData(y,N=>N&&N.filter(z=>z.chatId!==t)),{previousSession:E,previousList:C}},onError:(E,C,N)=>{N!=null&&N.previousSession&&a.setQueryData(h,N.previousSession),N!=null&&N.previousList&&a.setQueryData(y,N.previousList),m(E instanceof Error?E.message:"Terminate failed")},onSuccess:(E,C,N)=>{if(E.state!=="evicted"){N!=null&&N.previousList&&a.setQueryData(y,N.previousList),g(E.state),m(`Session is ${E.state}; terminate only applies to suspended sessions.`);return}m(null),c(!1),l({a:e})}}),k=(n==null?void 0:n.state)==="active",j=(n==null?void 0:n.state)==="suspended";return!k&&!j?null:u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"inline-flex items-center",style:{gap:4,padding:4,border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",background:"var(--bg-sunken)"},children:[k&&u.jsxs("button",{type:"button",onClick:()=>b.mutate(),disabled:b.isPending,className:"inline-flex items-center transition-colors text-label",style:{gap:6,padding:"var(--sp-1) var(--sp-2_5)",color:"var(--fg-2)",borderRadius:"var(--radius-input)"},onMouseEnter:E=>E.currentTarget.style.background="var(--bg-hover)",onMouseLeave:E=>E.currentTarget.style.background="transparent",children:[u.jsx(lz,{className:"h-3 w-3"})," Suspend",u.jsx("span",{className:"kbd",style:{marginLeft:2},children:"⌘⇧P"})]}),j&&u.jsxs("button",{type:"button",onClick:()=>{m(null),c(!0)},disabled:w.isPending,className:"inline-flex items-center transition-colors text-label font-semibold",style:{gap:6,padding:"var(--sp-1) var(--sp-2_5)",color:"var(--state-error)",background:"color-mix(in oklch, var(--state-error) 18%, transparent)",borderRadius:"var(--radius-input)"},onMouseEnter:E=>E.currentTarget.style.background="color-mix(in oklch, var(--state-error) 28%, transparent)",onMouseLeave:E=>E.currentTarget.style.background="color-mix(in oklch, var(--state-error) 18%, transparent)",children:[u.jsx(gz,{className:"h-3 w-3"})," Terminate"]})]}),u.jsx(SH,{open:o,onOpenChange:E=>{w.isPending||c(E),E||m(null)},session:n,chatId:t,error:f,pending:w.isPending,onConfirm:()=>w.mutate()})]})}function SH(e){const{open:t,onOpenChange:n,session:a,chatId:l,pending:o,error:c,onConfirm:f}=e;function m(y){y.preventDefault(),o||f()}const h=l.slice(0,8);return u.jsx($t,{open:t,onOpenChange:n,children:u.jsxs(zt,{children:[u.jsx(Gt,{children:u.jsx(Ft,{children:"Terminate session?"})}),u.jsxs("form",{onSubmit:m,className:"space-y-4",children:[u.jsx("p",{className:"text-body text-muted-foreground",children:"Ending this session is permanent. It is removed from the workspace and cannot be resumed. Chat history is preserved; a new message will start a fresh session."}),u.jsxs("div",{className:"mono text-label",style:{padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",display:"grid",gap:4},children:[u.jsxs("span",{children:["chat: ",u.jsxs("span",{className:"font-medium",children:[h,"…"]})]}),(a==null?void 0:a.lastActivityAt)&&u.jsxs("span",{children:["last activity: ",xN(a.lastActivityAt)]}),typeof(a==null?void 0:a.messageCount)=="number"&&u.jsxs("span",{children:["messages: ",a.messageCount]})]}),c&&u.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)"},children:c}),u.jsxs(tn,{children:[u.jsx(me,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:o,children:"Cancel"}),u.jsx(me,{type:"submit",variant:"destructive",disabled:o,children:o?"Terminating…":"Terminate"})]})]})]})})}function kH({event:e}){const t=w3(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",l=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",o=n?"failed":a?"using":"used";return u.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?u.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:l,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):u.jsx("span",{"aria-hidden":!0,style:{color:l,flexShrink:0},children:n?"⚠":"↳"}),u.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?RS(t.args):void 0,children:[u.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",u.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?u.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",RS(t.args),")"]}):null,t.durationMs!==void 0&&!a?u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",bH(t.durationMs)]}):null]})]})}function jH({event:e,agentNameFn:t,agentId:n}){const a=k3(e.payload);if(!a||a.text.length===0)return null;const l=t(n);return u.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[u.jsx(wN,{name:l,isSelf:!1}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[u.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:l}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Pf(e.createdAt)}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),u.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function CH({event:e}){return u.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:[u.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}}),u.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Pf(e.createdAt)})]})}function EH({event:e}){const t=S3(e.payload),n=Pf(e.createdAt);return u.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:[u.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),u.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 wN({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return u.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:u.jsx(to,{width:9,height:10,style:{color:"var(--accent)"}})})}function NH({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),l=t===e.senderId;return u.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[u.jsx(wN,{name:a,isSelf:l}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[u.jsx("span",{className:"mono text-body font-semibold",style:{color:l?"var(--fg)":"var(--accent)"},children:a}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Pf(e.createdAt)}),u.jsx("span",{style:{marginLeft:"auto"},children:u.jsx(xH,{msg:e,myAgentId:t})})]}),u.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&_H(e.content)?u.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"&&TH(e.content)?u.jsx(AH,{content:e.content}):e.format==="text"?u.jsx(pN,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):u.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 _H(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 TH(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 AH({content:e}){const[t,n]=x.useState({kind:"loading"});return x.useEffect(()=>{let a=!1;return fH(e.imageId).then(l=>{a||n(l?{kind:"hit",src:`data:${l.mimeType};base64,${l.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?u.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?u.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):u.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function RH({agentId:e,chatId:t}){var Le;const n=dn(),a=Cl(),l=Cy(),{agentId:o}=qt(),[c,f]=x.useState(""),[m,h]=x.useState(0),[y,g]=x.useState([]),[b,w]=x.useState(!1),[k,j]=x.useState(null),E=x.useRef(null),C=x.useRef(null),N=x.useRef(null),z=x.useRef(!1),L=x.useRef(new Set);x.useEffect(()=>{z.current=!1},[t]);const{data:D}=He({queryKey:["chat-messages",t],queryFn:()=>oH(t,{limit:50}),refetchInterval:5e3}),{data:O}=He({queryKey:["session-events",e,t],queryFn:()=>j3(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:M}=He({queryKey:rj(e,t),queryFn:()=>eo(e).then(re=>re.find(Ee=>Ee.chatId===t)??null),refetchInterval:5e3}),{data:U}=He({queryKey:["chat-detail",t],queryFn:()=>aH(t),enabled:!!t}),X=wt({mutationFn:re=>TS(t,re),onSuccess:()=>{f(""),n.invalidateQueries({queryKey:["chat-messages",t]}),n.invalidateQueries({queryKey:Xd(e)})}}),F=x.useCallback(re=>{const Ie=re.filter(hn=>hn.type.startsWith("image/"));if(Ie.length===0)return;const Pe=Ie.find(hn=>hn.size>5242880);if(Pe){j(`Image too large (${(Pe.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const Lt=Ie.map(hn=>({id:crypto.randomUUID(),file:hn,previewUrl:URL.createObjectURL(hn)}));g(hn=>[...hn,...Lt]),j(null)},[]),J=x.useCallback(re=>{g(Ee=>{const Ie=Ee.find(Pe=>Pe.id===re);return Ie&&URL.revokeObjectURL(Ie.previewUrl),Ee.filter(Pe=>Pe.id!==re)})},[]),ee=async()=>{const re=c.trim(),Ee=y;if(!(!re&&Ee.length===0)&&!b&&!(K&&ce.length===0)){if(Ee.length>0){w(!0),j(null);try{for(const Ie of Ee){const Pe=await sH(Ie.file),Lt=crypto.randomUUID();await dH({imageId:Lt,base64:Pe,mimeType:Ie.file.type}),await lH(t,{data:Pe,mimeType:Ie.file.type,filename:Ie.file.name,size:Ie.file.size,imageId:Lt}),URL.revokeObjectURL(Ie.previewUrl)}g([]),re&&await TS(t,re),f(""),n.invalidateQueries({queryKey:["chat-messages",t]}),n.invalidateQueries({queryKey:Xd(e)})}catch(Ie){j(Ie instanceof Error?Ie.message:"Failed to send image")}finally{w(!1)}return}X.mutate(re)}},[ye,he]=x.useState(!1),[ne,Z]=x.useState(""),te=x.useRef(null);x.useEffect(()=>{var re;ye&&((re=te.current)==null||re.focus())},[ye]);const ie=wt({mutationFn:re=>iH(t,re),onSuccess:()=>{he(!1),n.invalidateQueries({queryKey:["chat-detail",t]}),n.invalidateQueries({queryKey:["agent-sessions",e]}),n.invalidateQueries({queryKey:["session",e,t]})}}),ue=()=>{const re=ne.trim();ie.mutate(re.length>0?re:null)},A=x.useMemo(()=>{const re=(D==null?void 0:D.items)??[],Ee=vH((O==null?void 0:O.items)??[]),Ie=[...re.map(Pe=>({kind:"message",at:Pe.createdAt,key:`m-${Pe.id}`,data:Pe})),...Ee.map(Pe=>({kind:"event",at:Pe.createdAt,key:`e-${Pe.id}`,data:Pe}))];return Ie.sort((Pe,Lt)=>Pe.at.localeCompare(Lt.at)),Ie},[D,O]),P=A.length;x.useEffect(()=>{var re;P>0&&((re=N.current)==null||re.scrollIntoView({behavior:"smooth"}))},[P]);const B=U!=null&&U.participants?U.participants.map(re=>{const Ee=a(re.agentId);return`@${Ee.length>20?`${Ee.slice(0,17)}…`:Ee}`}).join(" "):`@${a(e)}`,T=a(e),q=x.useMemo(()=>{var Ie;const re=((Ie=U==null?void 0:U.participants)==null?void 0:Ie.map(Pe=>Pe.agentId))??[e],Ee=[];for(const Pe of re){if(Pe===o)continue;const Lt=l(Pe);!Lt||!Lt.name||Ee.push({agentId:Pe,name:Lt.name,displayName:Lt.displayName})}return Ee},[U==null?void 0:U.participants,e,l,o]),K=x.useMemo(()=>{if(!U)return!1;if(U.type==="group")return!0;const re=U.participants.some(Ee=>Ee.agentId===o);return U.type==="direct"&&!re&&U.participants.length>=2},[U,o]);x.useEffect(()=>{if(L.current.has(t)||!D||!O||!U||A.length>0||c.length>0||K||T===e)return;const re=`Hi ${T}! What can you help with?`;f(re),h(re.length),L.current.add(t),requestAnimationFrame(()=>{const Ee=C.current;Ee&&(Ee.focus(),Ee.setSelectionRange(re.length,re.length))})},[t,e,D,O,U,A.length,c.length,T,K]);const ce=x.useMemo(()=>{if(!K)return[];const re=q.map(Ee=>({agentId:Ee.agentId,name:Ee.name}));return l6(c,re)},[c,q,K]),xe=gH({value:c,cursor:m,candidates:q,disabled:X.isPending||b,onSelect:re=>{f(re.text),h(re.cursor),requestAnimationFrame(()=>{const Ee=C.current;Ee&&(Ee.focus(),Ee.setSelectionRange(re.cursor,re.cursor))})}}),we=(M==null?void 0:M.runtimeState)??"idle",pe=bN((M==null?void 0:M.runtimeState)??null,e?"connected":null),Xe=(M==null?void 0:M.messageCount)??((Le=D==null?void 0:D.items)==null?void 0:Le.length)??0;return u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"grid items-center shrink-0",style:{gridTemplateColumns:"1fr auto",gap:10,padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border)"},children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center",style:{gap:8},children:[u.jsx(Xr,{state:pe,size:8}),ye?u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:te,value:ne,onChange:re=>Z(re.target.value),onKeyDown:re=>{re.key==="Enter"?(re.preventDefault(),ue()):re.key==="Escape"&&(re.preventDefault(),he(!1))},disabled:ie.isPending,maxLength:500,placeholder:"Chat name",className:"outline-none text-subtitle",style:{flex:1,minWidth:0,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)"}}),u.jsx("button",{type:"button",onClick:ue,disabled:ie.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:u.jsx(cr,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:()=>he(!1),disabled:ie.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:u.jsx(Kd,{className:"h-3.5 w-3.5"})})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"truncate text-subtitle",style:{color:"var(--fg)"},children:(U==null?void 0:U.topic)||(M==null?void 0:M.summary)||`Chat · ${t.slice(0,8)}`}),u.jsx("button",{type:"button",onClick:()=>{Z((U==null?void 0:U.topic)??""),he(!0)},title:"Rename chat",className:"inline-flex items-center transition-colors",style:{color:"var(--fg-4)",padding:2},onMouseEnter:re=>re.currentTarget.style.color="var(--fg-2)",onMouseLeave:re=>re.currentTarget.style.color="var(--fg-4)",children:u.jsx(Qu,{className:"h-3 w-3"})})]}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)",padding:"var(--hairline) var(--sp-1_25)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)"},children:t})]}),u.jsxs("div",{className:"flex items-center text-caption",style:{color:"var(--fg-3)",marginTop:4,gap:10},children:[u.jsx("span",{className:"mono",children:B}),u.jsx("span",{children:"·"}),u.jsxs("span",{children:["started ",xN((M==null?void 0:M.startedAt)??null)]}),u.jsx("span",{children:"·"}),u.jsxs("span",{children:[Xe," msgs"]}),u.jsx("span",{children:"·"}),u.jsxs("span",{children:["runtime"," ",u.jsx("span",{className:"mono",style:{color:pe==="error"?"var(--state-error)":"var(--fg-2)"},children:we})]})]})]}),u.jsx(wH,{agentId:e,chatId:t,session:M??null})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[P===0&&u.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[u.jsx(py,{className:"h-8 w-8",style:{opacity:.3}}),"Send a message to start the conversation"]}),u.jsx("div",{className:"flex flex-col",style:{gap:4},children:A.map(re=>{if(re.kind==="event"){const Ee=re.data;switch(Ee.kind){case"tool_call":return u.jsx(kH,{event:Ee},re.key);case"assistant_text":return u.jsx(jH,{event:Ee,agentId:e,agentNameFn:a},re.key);case"thinking":return u.jsx(CH,{event:Ee},re.key);case"error":return u.jsx(EH,{event:Ee},re.key);default:return null}}return u.jsx(NH,{msg:re.data,myAgentId:o,agentNameFn:a},re.key)})}),u.jsx("div",{ref:N})]}),u.jsxs("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"},children:[u.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:re=>re.preventDefault(),onDrop:re=>{re.preventDefault(),F(Array.from(re.dataTransfer.files))},children:[y.length>0&&u.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:y.map(re=>u.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[u.jsx("img",{src:re.previewUrl,alt:re.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),u.jsx("button",{type:"button",onClick:()=>J(re.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:u.jsx(Kd,{className:"h-2 w-2"})})]},re.id))}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx(yH,{trigger:xe.trigger,results:xe.results,highlightIndex:xe.highlightIndex,anchorRef:C,onPick:xe.pick}),u.jsx("textarea",{ref:C,value:c,onChange:re=>{f(re.target.value),h(re.target.selectionStart??re.target.value.length)},onSelect:re=>{h(re.currentTarget.selectionStart??c.length)},onFocus:()=>{K&&(z.current||c.length>0||q.length===0||(z.current=!0,f("@"),h(1),requestAnimationFrame(()=>{const re=C.current;re&&re.setSelectionRange(1,1)})))},onPaste:re=>{const Ee=Array.from(re.clipboardData.files);Ee.length>0&&(re.preventDefault(),F(Ee))},placeholder:K?"Type @ to pick a recipient, then your message":`Message @${T} · / for commands · @ to mention`,rows:2,onKeyDown:re=>{xe.handleKey(re)||re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),ee())},disabled:X.isPending||b,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)"}})]}),u.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[u.jsxs("span",{className:"mono flex items-center",style:{gap:8},children:[u.jsx("button",{type:"button",onClick:()=>{var re;return(re=E.current)==null?void 0:re.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:u.jsx(az,{className:"h-3.5 w-3.5"})}),u.jsx("input",{ref:E,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:re=>{re.target.files&&(F(Array.from(re.target.files)),re.target.value="")}}),u.jsx("span",{children:"/suspend"}),u.jsx("span",{children:"/resume"}),u.jsx("span",{children:"/branch"}),u.jsx("span",{children:"/promote"})]}),u.jsxs("span",{className:"flex items-center",style:{gap:8},children:[b&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),u.jsxs("span",{children:[u.jsx("span",{className:"kbd",children:"⏎"})," send ",u.jsx("span",{className:"kbd",children:"⇧⏎"})," new line"]}),u.jsxs("button",{type:"button",onClick:ee,disabled:X.isPending||b||!c.trim()&&y.length===0||K&&ce.length===0,title:K&&ce.length===0?"Pick at least one recipient with @ before sending in a group chat":void 0,className:Ae("inline-flex items-center transition-colors text-label font-semibold",(X.isPending||b||!c.trim()&&y.length===0||K&&ce.length===0)&&"opacity-50 cursor-not-allowed"),style:{gap:6,padding:"var(--sp-1) var(--sp-2_5)",color:"oklch(0.14 0.01 150)",background:"var(--accent)",border:"var(--hairline) solid var(--accent)",borderRadius:"var(--radius-input)"},children:[u.jsx(fz,{className:"h-3 w-3"})," Send"]})]})]})]}),(X.isError||k)&&u.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:k??(X.error instanceof Error?X.error.message:"Failed to send")})]})]})}function zH(){return u.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:u.jsxs("div",{className:"text-center max-w-sm",children:[u.jsx(to,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),u.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),u.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."})]})})}const OH=3e4,DH=1e3,MH=3e3;function LH(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function IH(){var xe;const{refreshMe:e,organizationId:t,memberId:n}=qt(),a=fn(),l=dR(t,n),o=hR(l),c=o!=null&&o.connectToken&&o.connectTokenExpiresAt&&o.connectTokenExpiresAt>Date.now()?o.connectToken:null,f=c?(o==null?void 0:o.connectTokenExpiresAt)??null:null,[m,h]=x.useState(()=>(o==null?void 0:o.displayName)??""),[y,g]=x.useState(()=>(o==null?void 0:o.selectedRuntime)??null),[b,w]=x.useState(null),[k,j]=x.useState(null),[E,C]=x.useState(null),[N,z]=x.useState(()=>c),[L,D]=x.useState(()=>f),[O,M]=x.useState([]),[U,X]=x.useState("form"),[F,J]=x.useState(null),[ee]=x.useState(()=>uR()),ye=x.useRef(null),he=x.useRef(null),ne=x.useRef(null),Z=x.useRef(0);x.useEffect(()=>()=>{he.current&&(he.current.cancelled=!0)},[]),x.useEffect(()=>{mR(l,{displayName:m,selectedRuntime:y,connectToken:N,connectTokenExpiresAt:L})},[l,m,y,N,L]),x.useEffect(()=>{(async()=>{try{const we=await je.get("/me/organizations");M(we)}catch{}})()},[]),x.useEffect(()=>{if(U!=="form")return;let we=!1;const pe=async()=>{const Le=++Z.current;try{const re=await Ra();if(we||Le!==Z.current)return;const Ie=re.filter(Pe=>Pe.status==="connected").sort((Pe,Lt)=>Lt.lastSeenAt.localeCompare(Pe.lastSeenAt))[0]??null;if(w(Pe=>(Pe==null?void 0:Pe.id)===(Ie==null?void 0:Ie.id)?Pe:Ie),Ie){ne.current!==Ie.id&&(ne.current=null,C(null),j(null));try{const Pe=await by(Ie.id);if(we||Le!==Z.current)return;ne.current=Ie.id,C(Ie.id),j(Pe.capabilities)}catch{}}else ne.current=null,C(null),j(null)}catch{}};pe();const Xe=setInterval(pe,MH);return()=>{we=!0,clearInterval(Xe)}},[U]),x.useEffect(()=>{if(b)return;if(N&&L&&L>Date.now()){const pe=Math.max(L-Date.now(),0),Xe=window.setTimeout(()=>{z(null),D(null)},pe);return()=>window.clearTimeout(Xe)}N&&(z(null),D(null));let we=!1;return(async()=>{try{const pe=await je.post("/connect-tokens",{});we||(z(pe.token),D(Date.now()+pe.expiresIn*1e3))}catch(pe){we||J(pe instanceof Error?pe.message:"Failed to generate connect token")}})(),()=>{we=!0}},[b,N,L]);const te=b&&E===b.id?k:null;x.useEffect(()=>{g(we=>{if(!te)return we;const pe=Object.entries(te).filter(([,Xe])=>Xe.state==="ok").map(([Xe])=>Xe);return we&&pe.includes(we)?we:pe[0]??null})},[te]);const ie=te?Object.entries(te).filter(([,we])=>we.state==="ok").map(([we])=>we):[],ue=((xe=O.find(we=>we.id===t))==null?void 0:xe.displayName)??"",A=m.trim(),P=A||"your agent",B=N?`npm install -g @agent-team-foundation/first-tree-hub
|
|
387
|
+
first-tree-hub connect ${N}`:null,T=x.useCallback(async we=>{he.current&&(he.current.cancelled=!0);const pe={cancelled:!1};he.current=pe;const Xe=Date.now();for(;!pe.cancelled;){let Le=!1;try{const re=await je.get(`/admin/agents/${encodeURIComponent(we)}/client-status`);if(pe.cancelled)return;Le=re.online===!0}catch{if(pe.cancelled)return}if(Le){try{const re=await yN(we);if(pe.cancelled||(pR(l),await e(),pe.cancelled))return;a(`/?a=${encodeURIComponent(we)}&c=${encodeURIComponent(re.id)}`,{replace:!0})}catch(re){if(pe.cancelled)return;J(re instanceof Error?re.message:"Failed to open chat"),X("timeout")}return}if(Date.now()-Xe>OH){pe.cancelled||X("timeout");return}await new Promise(re=>setTimeout(re,DH))}},[l,e,a]),q=!!(A&&b&&y&&ie.includes(y)&&U==="form"),K=x.useCallback(async()=>{if(!b||!y||!A)return;J(null),X("creating");const we=Vg(A);let pe;try{pe=(await je.post("/admin/agents",{type:"personal_assistant",displayName:A,...we?{name:we}:{},clientId:b.id,runtimeProvider:y})).uuid,ye.current=pe}catch(Xe){J(Xe instanceof Error?Xe.message:"Failed to create agent"),X("form");return}await T(pe)},[A,b,y,T]),ce=x.useCallback(async()=>{const we=ye.current;we&&(J(null),X("creating"),await T(we))},[T]);return u.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:u.jsxs("div",{style:{width:"100%",maxWidth:560},children:[U==="form"&&u.jsx(UH,{joinPath:ee,teamName:ue,displayName:m,setDisplayName:h,trimmedName:A,connectedClient:b,cliCommand:B,okRuntimes:ie,selectedRuntime:y,setSelectedRuntime:g,capabilitiesLoaded:te!==null,error:F,canCreate:q,onCreate:K}),U==="creating"&&u.jsx(ZH,{nameOrFallback:P}),U==="timeout"&&u.jsx(VH,{nameOrFallback:P,hostname:(b==null?void 0:b.hostname)??null,error:F,onRetry:ce})]})})}function UH({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:l,connectedClient:o,cliCommand:c,okRuntimes:f,selectedRuntime:m,setSelectedRuntime:h,capabilitiesLoaded:y,error:g,canCreate:b,onCreate:w}){const k=x.useRef(null),E=e==="invite"&&t?`Welcome — you've joined ${t}`:"Welcome to First Tree Hub",C=l?o?m?"Ready to create.":"Next: choose a runtime.":"Next: connect the computer where they'll work.":"Next: name your agent.";return x.useEffect(()=>{var N;l||(N=k.current)==null||N.focus()},[l]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex flex-col items-start",style:{gap:"var(--sp-4)",paddingTop:0},children:[u.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)",maxWidth:420},children:[u.jsx("span",{style:{color:"var(--fg-2)"},children:E}),u.jsx("span",{style:{color:"var(--fg-4)"},children:" · "}),"Where agents and humans work as one team."]}),u.jsx("h1",{className:"text-title font-semibold",style:{margin:0,color:"var(--fg)"},children:"Let's create your first agent."})]}),u.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[u.jsx(PH,{}),u.jsx(zS,{number:"01",state:l?"complete":"active",children:u.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[u.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"What should we call this agent?"}),u.jsx("input",{ref:k,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:N=>a(N.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:N=>{N.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:N=>{N.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),u.jsx(zS,{number:"02",state:b?"complete":l?"active":"idle",children:u.jsxs("div",{style:{animation:l?"subtle-fade 200ms ease-out":void 0},children:[u.jsxs("h2",{className:"text-subtitle font-semibold",style:{color:l?"var(--fg)":"var(--fg-4)",fontWeight:l?600:500},children:["Where will ",l||"this agent"," run?"]}),l?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`This computer will run ${l} and keep it connected to Hub.`:"This agent needs a computer to do its work. Connect the one it should use."}),!o&&u.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?u.jsx(FH,{hostname:o.hostname??o.id}):u.jsxs(u.Fragment,{children:[u.jsx(BH,{command:c}),u.jsx($H,{})]}),o&&u.jsx(qH,{runtimes:f,selected:m,onSelect:h,capabilitiesLoaded:y})]}):null]})})]}),g&&u.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g}),l&&u.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&&u.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),b&&u.jsxs(me,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:N=>{N.currentTarget.style.transform="scale(1.01)",N.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:N=>{N.currentTarget.style.transform="scale(1)",N.currentTarget.style.boxShadow="var(--shadow-md)"},children:[u.jsxs("span",{children:["Create ",l]}),u.jsx(RR,{className:"h-4 w-4"})]}),u.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 PH(){return u.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 zS({number:e,state:t,children:n}){const a=t==="active",l=t==="complete";return u.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[u.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||l?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||l?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||l?"var(--accent)":"var(--fg-4)",zIndex:1},children:l?u.jsx(cr,{className:"h-3 w-3"}):e}),u.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}function BH({command:e}){const[t,n]=x.useState(!1),l=(e?e.split(`
|
|
388
|
+
`):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=l.startsWith(o)?`${o}${l.slice(o.length,o.length+22)}…`:l.length>52?`${l.slice(0,52)}…`:l,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return u.jsx("div",{style:{marginTop:"var(--sp-2)"},children:u.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[u.jsx("pre",{className:"mono text-label",title:l,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…"}),u.jsxs(me,{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?u.jsx(cr,{className:"h-3.5 w-3.5"}):u.jsx(vf,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function $H(){return u.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:[u.jsx(HH,{}),u.jsx("span",{children:"Waiting for your computer…"})]})}function FH({hostname:e}){return u.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:[u.jsx(cr,{className:"h-3.5 w-3.5"}),u.jsxs("span",{children:[u.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function qH({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?u.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…"}):u.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),u.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[u.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((l,o)=>{const c=t===l;return u.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:c?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:c?600:400,animation:`onboarding-rise 220ms ease-out ${o*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[u.jsx("input",{type:"radio",name:"onboarding-runtime",value:l,checked:c,onChange:()=>n(l),className:"sr-only"}),u.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:14,height:14,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&&u.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)"}})}),LH(l)]},l)})]})]})}function HH(){return u.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),u.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function ZH({nameOrFallback:e}){return u.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[u.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),u.jsx(QH,{}),u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function VH({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const l=t??"your computer";return u.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[u.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?u.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}):u.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[u.jsx("p",{children:"This usually means:"}),u.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[u.jsxs("li",{children:["The runtime can't start on ",l," (missing API key, etc.)"]}),u.jsxs("li",{children:["The connection to ",l," dropped"]})]}),u.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",l,", then click ",u.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),u.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:u.jsx(me,{onClick:a,children:"Try again"})})]})}function QH(){return u.jsxs("span",{className:"flex items-center",style:{gap:6},children:[u.jsx(Hp,{delayMs:0}),u.jsx(Hp,{delayMs:160}),u.jsx(Hp,{delayMs:320})]})}function Hp({delayMs:e}){return u.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"}})}function GH({selectedAgentId:e,selectedChatId:t}){const{wizardStep:n}=qt();return t&&e?u.jsx(RH,{agentId:e,chatId:t}):n!==null&&n!=="completed"?u.jsx(IH,{}):u.jsx(zH,{})}function SN(){const{data:e}=He({queryKey:["clients"],queryFn:Ra,staleTime:1e4,refetchInterval:1e4});return x.useMemo(()=>{const t=e??[],n=new Map;for(const a of t)n.set(a.id,a);return{resolve:a=>a?n.get(a)??null:null,clients:t,connectedClients:t.filter(a=>a.status==="connected")}},[e])}function Qg({children:e}){return u.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)",marginBottom:8},children:e})}function kN({children:e}){return u.jsx("div",{className:"grid text-body",style:{gridTemplateColumns:"auto 1fr",columnGap:10,rowGap:4},children:e})}function Kr({label:e,children:t}){return u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{color:"var(--fg-3)"},children:e}),u.jsx("div",{className:"text-right truncate",style:{color:"var(--fg)",overflow:"hidden",textOverflow:"ellipsis"},children:t})]})}function OS(e){if(!e)return"—";const t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const a=Math.round(n/60);if(a<60)return`${a}m ago`;const l=Math.round(a/60);return l<24?`${l}h ago`:`${Math.round(l/24)}d ago`}function DS(e){if(!e)return"—";const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}h ${n%60}m`:`${Math.floor(a/24)}d ${a%24}h`}function Zp({label:e,value:t,accent:n}){return u.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:[u.jsx("div",{className:"mono uppercase text-caption",style:{color:"var(--fg-4)"},children:e}),u.jsx("div",{className:"mono text-subtitle",style:{color:n??"var(--fg)"},children:t})]})}function KH({notifications:e,agentId:t}){const[,n]=yf(),a=dn(),l=wt({mutationFn:o=>nC(o),onSuccess:()=>{a.invalidateQueries({queryKey:["notifications"]})}});return u.jsx("div",{className:"flex flex-col",style:{gap:4},children:e.map(o=>u.jsx(rC,{notification:o,clickable:!!o.chatId,onClick:()=>{o.read||l.mutate(o.id),o.chatId&&n({a:t,c:o.chatId})}},o.id))})}function jN({agentId:e}){var h;const t=Cl(),{resolve:n}=SN(),{data:a}=He({queryKey:["activity"],queryFn:Gu,refetchInterval:1e4}),l=(h=a==null?void 0:a.agents)==null?void 0:h.find(y=>y.agentId===e),o=n(l==null?void 0:l.clientId),{data:c}=He({queryKey:["notifications","agent",e],queryFn:()=>Ng({agentId:e,limit:3}),refetchInterval:3e4}),f=t(e),m=(l==null?void 0:l.runtimeState)??"offline";return u.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.jsxs("div",{style:{padding:"var(--sp-3) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{className:"flex items-center",style:{gap:10},children:[u.jsx("div",{className:"flex items-center justify-center",style:{width:32,height:32,borderRadius:5,background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:u.jsx(to,{width:14,height:16,style:{color:"var(--accent)"}})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-subtitle",style:{color:"var(--fg)"},children:f}),u.jsx("div",{className:"mono truncate text-body",style:{color:"var(--fg-4)"},children:e})]}),u.jsx(Gs,{state:m})]}),u.jsxs("div",{className:"grid",style:{gridTemplateColumns:"repeat(3, 1fr)",gap:4,marginTop:10},children:[u.jsx(Zp,{label:"sessions",value:(l==null?void 0:l.totalSessions)??0,accent:((l==null?void 0:l.totalSessions)??0)>0?"var(--fg)":"var(--fg-4)"}),u.jsx(Zp,{label:"active",value:(l==null?void 0:l.activeSessions)??0,accent:((l==null?void 0:l.activeSessions)??0)>0?"var(--accent)":"var(--fg-4)"}),u.jsx(Zp,{label:"uptime",value:DS((o==null?void 0:o.connectedAt)??null)})]})]}),u.jsxs("div",{style:{padding:"var(--sp-3) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsx(Qg,{children:"Computer · runtime"}),u.jsxs(kN,{children:[u.jsx(Kr,{label:"host",children:u.jsx("span",{className:"mono text-label",children:(o==null?void 0:o.hostname)??"—"})}),u.jsx(Kr,{label:"os",children:u.jsx("span",{className:"mono text-label",children:(o==null?void 0:o.os)??"—"})}),u.jsx(Kr,{label:"runtime",children:u.jsx("span",{className:"mono",children:(l==null?void 0:l.runtimeType)??"—"})}),u.jsx(Kr,{label:"sdk",children:u.jsx("span",{className:"mono text-label",children:(o==null?void 0:o.sdkVersion)??"—"})}),u.jsx(Kr,{label:"connected",children:u.jsx("span",{className:"mono text-label",children:DS((o==null?void 0:o.connectedAt)??null)})})]})]}),u.jsxs("div",{style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},className:"flex flex-col",children:[u.jsx("a",{href:`/agents/${e}`,style:{color:"var(--accent)"},className:"hover:underline text-label",children:"Manage agent →"}),u.jsx("a",{href:"/clients",style:{color:"var(--accent)",marginTop:4},className:"hover:underline text-label",children:"Computers →"})]}),u.jsxs("div",{style:{padding:"var(--sp-3) var(--sp-3_5)"},children:[u.jsx(Qg,{children:"Notifications"}),!(c!=null&&c.items)||c.items.length===0?u.jsx("div",{className:"text-center text-label",style:{color:"var(--fg-3)",padding:"var(--sp-3) 0"},children:"No notifications for this agent"}):u.jsx(KH,{notifications:c.items,agentId:e})]})]})}function YH({agentId:e,chatId:t}){const{data:n}=He({queryKey:["session",e,t],queryFn:()=>eo(e).then(a=>a.find(l=>l.chatId===t)??null),refetchInterval:5e3});return u.jsxs("div",{className:"flex flex-col overflow-hidden flex-1",children:[u.jsxs("div",{style:{padding:"var(--sp-3) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsx(Qg,{children:"Session"}),u.jsxs(kN,{children:[u.jsx(Kr,{label:"state",children:u.jsx(Gs,{state:(n==null?void 0:n.runtimeState)??(n==null?void 0:n.state)??null})}),u.jsx(Kr,{label:"chat",children:u.jsx("span",{className:"mono text-body",children:t.slice(0,12)})}),u.jsx(Kr,{label:"started",children:OS((n==null?void 0:n.startedAt)??null)}),u.jsx(Kr,{label:"last",children:OS((n==null?void 0:n.lastActivityAt)??null)}),u.jsx(Kr,{label:"messages",children:u.jsx("span",{className:"mono",children:(n==null?void 0:n.messageCount)??0})})]})]}),u.jsx(jN,{agentId:e})]})}function XH({selectedAgentId:e,selectedChatId:t}){return t&&e?u.jsx(YH,{agentId:e,chatId:t}):e?u.jsx(jN,{agentId:e}):null}const JH=32;function WH({aggregated:e,stale:t,className:n}){const a=Math.max(1,...e.map(l=>l.workingCount));return u.jsx("div",{className:Ae("flex items-end gap-[var(--sp-0_5)]",t&&"opacity-40",n),style:{height:22},"aria-hidden":!0,children:Array.from({length:JH}).map((l,o)=>{const c=e[o]??{workingCount:0,errorMask:!1},f=c.workingCount===0?.08:c.workingCount/a,m=.25+f*.7,h=c.errorMask?"var(--state-error)":"var(--accent)";return u.jsx("span",{className:"flex-1",style:{height:`${Math.max(12,f*100)}%`,background:h,opacity:m,borderRadius:.5}},o)})})}const eZ={error:0,blocked:1,working:2,idle:3};function tZ(e,t){return t?e?eZ[e]??4:4:5}function nZ(e,t){return t==="all"?!0:t==="active"?e.runtimeState==="working":e.runtimeState==="blocked"||e.runtimeState==="error"}function rZ({selectedAgentId:e,selectedChatId:t,onSelectAgent:n,onSelectChat:a}){const l=Cl(),{resolve:o}=SN(),c=dU(),[f,m]=x.useState(""),[h,y]=x.useState("all"),{data:g}=He({queryKey:["activity"],queryFn:Gu,refetchInterval:1e4}),{data:b}=He({queryKey:e?Xd(e):["agent-sessions",null],queryFn:()=>e?eo(e):Promise.resolve([]),enabled:!!e,refetchInterval:1e4}),w=wt({mutationFn:D=>yN(D),onSuccess:(D,O)=>{a(O,D.id)}}),{humans:k,agents:j,totalAll:E}=x.useMemo(()=>{const D=(g==null?void 0:g.agents)??[],O=f.trim().toLowerCase(),M=D.filter(J=>{var he;if(!nZ(J,h))return!1;if(!O)return!0;const ee=l(J.agentId).toLowerCase(),ye=J.clientId?(((he=o(J.clientId))==null?void 0:he.hostname)??"").toLowerCase():"";return ee.includes(O)||ye.includes(O)||J.agentId.toLowerCase().includes(O)}),U=J=>tZ(J.runtimeState,J.clientId),X=[],F=[];for(const J of M)(J.type==="human"?X:F).push(J);return X.sort((J,ee)=>U(J)-U(ee)),F.sort((J,ee)=>U(J)-U(ee)),{humans:X,agents:F,totalAll:D.length}},[g,f,h,l,o]),C=x.useMemo(()=>{const D=(g==null?void 0:g.agents)??[];return{working:D.filter(O=>O.runtimeState==="working").length,blocked:D.filter(O=>O.runtimeState==="blocked").length,error:D.filter(O=>O.runtimeState==="error").length}},[g]),N=[{value:"all",label:"all",count:E},{value:"active",label:"active",count:C.working},{value:"attn",label:"attn",count:C.blocked+C.error,warn:C.blocked+C.error>0}],z=D=>{var J;const O=e===D.agentId,M=bN(D.runtimeState,D.clientId),U=D.clientId?((J=o(D.clientId))==null?void 0:J.hostname)??D.clientId.slice(0,8):null,X=D.activeSessions??0,F=D.totalSessions??0;return u.jsxs("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("button",{type:"button",onClick:()=>n(O?null:D.agentId),className:Ae("w-full text-left transition-colors grid items-center","hover:bg-[var(--bg-hover)]"),style:{gridTemplateColumns:"var(--sp-3_5) 1fr auto",columnGap:8,padding:"var(--sp-1_75) var(--sp-2_5) var(--sp-1_75) var(--sp-3)",background:O?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${O?"var(--accent)":"transparent"}`},children:[u.jsx(Xr,{state:M,size:8}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"mono truncate text-body font-medium",style:{color:"var(--fg)"},children:l(D.agentId)}),D.type==="human"&&u.jsx("span",{className:"mono uppercase text-eyebrow",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--accent)",background:"color-mix(in oklch, var(--accent) 15%, transparent)"},children:"human"})]}),u.jsx("div",{className:"truncate text-body",style:{color:"var(--fg-3)"},children:M==="offline"?"disconnected":U||"—"})]}),u.jsx("div",{className:"flex flex-col items-end gap-0.5",children:F>0&&u.jsxs("span",{className:"mono tnum text-label",style:{color:"var(--fg-3)"},children:[X,u.jsxs("span",{style:{color:"var(--fg-4)"},children:[" / ",F]})]})})]}),O&&u.jsxs("div",{style:{background:"var(--bg-sunken)",paddingBottom:4},children:[(!b||b.length===0)&&u.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_75) var(--sp-2_5) var(--sp-1_75) var(--sp-7)",color:"var(--fg-4)"},children:"No sessions yet"}),b==null?void 0:b.filter(ee=>ee.state!=="evicted").map(ee=>{const ye=ee.state==="active"?"working":"idle";return u.jsxs("button",{type:"button",onClick:()=>a(D.agentId,ee.chatId),className:"w-full grid items-center text-left transition-colors",style:{gridTemplateColumns:"var(--sp-3_5) 1fr",columnGap:6,padding:"var(--sp-1_75) var(--sp-2_5) var(--sp-1_75) var(--sp-7)",background:t===ee.chatId?"var(--bg-hover)":"transparent",color:ee.state==="active"?"var(--fg-2)":"var(--fg-3)"},onMouseEnter:he=>{t!==ee.chatId&&(he.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:he=>{t!==ee.chatId&&(he.currentTarget.style.background="transparent")},children:[u.jsx(Xr,{state:ye,size:6}),u.jsx("span",{className:"truncate text-body",style:{color:ee.topic||ee.summary?"var(--fg-2)":"var(--fg-4)"},children:ee.topic||ee.summary||`Chat · ${ee.chatId.slice(0,8)}`})]},ee.chatId)}),u.jsxs("button",{type:"button",onClick:()=>w.mutate(D.agentId),disabled:w.isPending,className:"w-full flex items-center text-left transition-colors text-body",style:{gap:6,padding:"var(--sp-1_75) var(--sp-2_5) var(--sp-1_75) var(--sp-7)",color:"var(--fg-3)"},onMouseEnter:ee=>{ee.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:ee=>{ee.currentTarget.style.background="transparent"},children:[u.jsx(Jr,{className:"h-3 w-3"}),"New chat"]})]})]},D.agentId)},L=k.length+j.length;return u.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:268,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[u.jsxs("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsx("div",{style:{marginBottom:8},children:u.jsxs("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-3)"},children:[E," members"]})}),u.jsxs("div",{className:"relative",children:[u.jsx(bf,{className:"h-3.5 w-3.5 absolute pointer-events-none",style:{left:8,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),u.jsx("input",{value:f,onChange:D=>m(D.target.value),placeholder:"Filter…",className:"w-full outline-none text-body",style:{padding:"var(--sp-1_25) var(--sp-2) var(--sp-1_25) var(--sp-6_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]}),u.jsx("div",{className:"flex gap-1",style:{marginTop:8},children:N.map(D=>u.jsx(yu,{active:h===D.value,count:D.count,warn:D.warn,onClick:()=>y(D.value),children:D.label},D.value))})]}),u.jsxs("div",{className:"shrink-0",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:4},children:[u.jsxs("span",{className:"mono flex items-center gap-1.5 text-eyebrow",style:{color:"var(--fg-3)"},children:[u.jsx(aZ,{}),"5m"]}),u.jsx("span",{className:"mono text-body",style:{color:"var(--fg-4)"},children:c.stale?"stale":"live"})]}),u.jsx(WH,{aggregated:c.aggregated,stale:c.stale}),u.jsxs("div",{className:"flex justify-between text-body",style:{marginTop:6},children:[u.jsxs("span",{className:"mono",style:{color:"var(--state-working)"},children:[C.working," working"]}),u.jsxs("span",{className:"mono",style:{color:"var(--state-blocked)"},children:[C.blocked," blocked"]}),u.jsxs("span",{className:"mono",style:{color:"var(--state-error)"},children:[C.error," error"]})]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto",children:[L===0&&u.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:f||h!=="all"?"No matches":u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{margin:0},children:"No agents"}),u.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Your first agent will appear here."})]})}),j.length>0&&u.jsxs("div",{children:[u.jsx(MS,{label:"Agents",count:j.length}),j.map(z)]}),k.length>0&&u.jsxs("div",{children:[u.jsx(MS,{label:"Humans",count:k.length}),k.map(z)]})]})]})}function MS({label:e,count:t}){return u.jsxs("div",{className:"mono uppercase sticky top-0 z-10 text-eyebrow",style:{padding:"var(--sp-1_25) var(--sp-3)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[e," · ",t]})}function aZ(){return u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",focusable:"false",style:{color:"var(--accent)"},children:[u.jsx("title",{children:"pulse"}),u.jsx("path",{d:"M1 8 h3 l1.5 -4 l3 8 l2 -4 h4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function iZ(){const[e,t]=yf(),n=e.get("a"),a=e.get("c");tE();const l=x.useCallback(f=>{t(f?{a:f}:{})},[t]),o=x.useCallback((f,m)=>{t({a:f,c:m})},[t]),{data:c}=He({queryKey:["agent-sessions",n],queryFn:()=>n?eo(n):Promise.resolve([]),enabled:!!n&&!a});return x.useEffect(()=>{if(!n||a||!c||c.length===0)return;const f=[...c].filter(m=>m.state!=="evicted").sort((m,h)=>(h.lastActivityAt??"").localeCompare(m.lastActivityAt??""))[0];f&&t({a:n,c:f.chatId},{replace:!0})},[n,a,c,t]),u.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[u.jsx(rZ,{selectedAgentId:n,selectedChatId:a,onSelectAgent:l,onSelectChat:o}),u.jsx("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:u.jsx(GH,{selectedAgentId:n,selectedChatId:a})}),n&&u.jsx("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:290,borderLeft:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:u.jsx(XH,{selectedAgentId:n,selectedChatId:a})})]})}const lZ=new bT({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function sZ(){return u.jsx(xT,{client:lZ,children:u.jsx(yR,{children:u.jsx(KA,{children:u.jsxs(jA,{children:[u.jsx(ar,{path:"/login",element:u.jsx(B7,{})}),u.jsx(ar,{path:"/signup",element:u.jsx(pf,{to:"/login",replace:!0})}),u.jsx(ar,{path:"/auth/github/complete",element:u.jsx($7,{})}),u.jsx(ar,{path:"/invite/:token",element:u.jsx(L7,{})}),u.jsx(ar,{element:u.jsx(kR,{}),children:u.jsxs(ar,{element:u.jsx(cU,{children:u.jsx(wM,{})}),children:[u.jsx(ar,{index:!0,element:u.jsx(iZ,{})}),u.jsx(ar,{path:"agents",element:u.jsx(x7,{})}),u.jsx(ar,{path:"agents/:uuid",element:u.jsx(a7,{})}),u.jsx(ar,{path:"clients",element:u.jsx(T7,{})}),u.jsx(ar,{path:"settings",element:u.jsx(rH,{})}),u.jsx(ar,{path:"admin",element:u.jsx(OU,{})})]})})]})})})})}const CN=document.getElementById("root");if(!CN)throw new Error("Root element not found");Q2.createRoot(CN).render(u.jsx(x.StrictMode,{children:u.jsx(sZ,{})}));export{RR as A,to as F,Zu as L,ot as c,u as j,x as r};
|